* Revised packets related to auction system.

- Added packet documentation and corrected existing one.
- Removed an impossible condition in clif_parse_Auction_setitem (since r12301).
- Updated backet db definitions and removed a duplicate entry (entries from older packet versions carry over to newer).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14981 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ai4rei 2011-10-23 11:03:24 +00:00
parent 761b02ed7d
commit 831027c3fb
3 changed files with 63 additions and 19 deletions

View File

@ -1,5 +1,10 @@
Date Added
2011/10/23
* Revised packets related to auction system. [Ai4rei]
- Added packet documentation and corrected existing one.
- Removed an impossible condition in clif_parse_Auction_setitem (since r12301).
- Updated backet db definitions and removed a duplicate entry (entries from older packet versions carry over to newer).
2011/10/17
* Remove 'hack code' in party_member_added causing crashes since r14968. (bugreport:5069) [FlavioJS]
2011/10/16

View File

@ -768,10 +768,10 @@ packet_ver: 18
0x0249,3
0x024a,70
0x024b,4,auctioncancelreg,2
0x024c,8,auctionsetitem,0
0x024c,8,auctionsetitem,2:4
0x024d,14
0x024e,6,auctioncancel,0
0x024f,10,auctionbid,0
0x024e,6,auctioncancel,2
0x024f,10,auctionbid,2:6
0x0250,3
0x0251,2
0x0252,-1
@ -826,7 +826,7 @@ packet_ver: 19
//2005-10-13aSakexe
0x007a,6
0x0251,32
0x025c,4,auctionbuysell,0
0x025c,4,auctionbuysell,2
//2005-10-17aSakexe
0x007a,58
@ -838,8 +838,7 @@ packet_ver: 19
0x0260,6
//2005-11-07aSakexe
0x024e,6,auctioncancel,0
0x0251,34,auctionsearch,0
0x0251,34,auctionsearch,2:4:8:32
//2006-01-09aSakexe
0x0261,11

View File

@ -13138,6 +13138,12 @@ void clif_Auction_results(struct map_session_data *sd, short count, short pages,
WFIFOSET(fd,WFIFOW(fd,2));
}
/// Result from request to add an item (ZC_ACK_AUCTION_ADD_ITEM)
/// 0256 <index>.W <result>.B
/// result:
/// 0 = success
/// 1 = failure
static void clif_Auction_setitem(int fd, int index, bool fail)
{
WFIFOHEAD(fd,packet_len(0x256));
@ -13147,6 +13153,13 @@ static void clif_Auction_setitem(int fd, int index, bool fail)
WFIFOSET(fd,packet_len(0x256));
}
/// Request to initialize 'new auction' data (CZ_AUCTION_CREATE)
/// 024b <type>.W
/// type:
/// 0 = create (any other action in auction window)
/// 1 = cancel (cancel pressed on register tab)
/// ? = junk, uninitialized value (ex. when switching between list filters)
void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd)
{
if( sd->auction.amount > 0 )
@ -13155,6 +13168,9 @@ void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd)
sd->auction.amount = 0;
}
/// Request to add an item to the action (CZ_AUCTION_ADD_ITEM)
/// 024c <index>.W <count>.L
void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
{
int idx = RFIFOW(fd,2) - 2;
@ -13170,8 +13186,8 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
return;
}
if( amount != 1 || amount < 0 || amount > sd->status.inventory[idx].amount )
{ // By client, amount is allways set to 1. Maybe this is a future implementation.
if( amount != 1 || amount > sd->status.inventory[idx].amount )
{ // By client, amount is always set to 1. Maybe this is a future implementation.
ShowWarning("Character %s trying to set invalid amount in auctions.\n", sd->status.name);
return;
}
@ -13193,6 +13209,7 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
clif_Auction_setitem(fd, idx + 2, false);
}
/// Result from an auction action (ZC_AUCTION_RESULT)
/// 0250 <result>.B
/// result:
@ -13220,7 +13237,7 @@ void clif_Auction_message(int fd, unsigned char flag)
/// result:
/// 0 = You have ended the auction
/// 1 = You cannot end the auction
/// 2 = Bid number is incorrect
/// 2 = Auction ID is incorrect
void clif_Auction_close(int fd, unsigned char flag)
{
WFIFOHEAD(fd,packet_len(0x25e));
@ -13229,6 +13246,9 @@ void clif_Auction_close(int fd, unsigned char flag)
WFIFOSET(fd,packet_len(0x25e));
}
/// Request to add an auction (CZ_AUCTION_ADD)
/// 024d <now money>.L <max money>.L <delete hour>.W
void clif_parse_Auction_register(int fd, struct map_session_data *sd)
{
struct auction_data auction;
@ -13273,9 +13293,9 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd)
auction.auction_id = 0;
auction.seller_id = sd->status.char_id;
safestrncpy(auction.seller_name, sd->status.name, NAME_LENGTH);
safestrncpy(auction.seller_name, sd->status.name, sizeof(auction.seller_name));
auction.buyer_id = 0;
memset(&auction.buyer_name, '\0', NAME_LENGTH);
memset(auction.buyer_name, '\0', sizeof(auction.buyer_name));
if( sd->status.inventory[sd->auction.index].nameid == 0 || sd->status.inventory[sd->auction.index].amount < sd->auction.amount )
{
@ -13289,7 +13309,7 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd)
return;
}
safestrncpy(auction.item_name, item->jname, ITEM_NAME_LENGTH);
safestrncpy(auction.item_name, item->jname, sizeof(auction.item_name));
auction.type = item->type;
memcpy(&auction.item, &sd->status.inventory[sd->auction.index], sizeof(struct item));
auction.item.amount = 1;
@ -13305,6 +13325,9 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd)
}
}
/// Cancels an auction (CZ_AUCTION_ADD_CANCEL)
/// 024e <auction id>.L
void clif_parse_Auction_cancel(int fd, struct map_session_data *sd)
{
unsigned int auction_id = RFIFOL(fd,2);
@ -13312,6 +13335,9 @@ void clif_parse_Auction_cancel(int fd, struct map_session_data *sd)
intif_Auction_cancel(sd->status.char_id, auction_id);
}
/// Closes an auction (CZ_AUCTION_REQ_MY_SELL_STOP)
/// 025d <auction id>.L
void clif_parse_Auction_close(int fd, struct map_session_data *sd)
{
unsigned int auction_id = RFIFOL(fd,2);
@ -13319,6 +13345,9 @@ void clif_parse_Auction_close(int fd, struct map_session_data *sd)
intif_Auction_close(sd->status.char_id, auction_id);
}
/// Places a bid on an auction (CZ_AUCTION_BUY)
/// 024f <auction id>.L <money>.L
void clif_parse_Auction_bid(int fd, struct map_session_data *sd)
{
unsigned int auction_id = RFIFOL(fd,2);
@ -13341,23 +13370,34 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd)
}
}
/*------------------------------------------
* Auction Search
* S 0251 <search type>.w <search price>.l <search text>.24B <page number>.w
* Search Type: 0 Armor 1 Weapon 2 Card 3 Misc 4 By Text 5 By Price 6 Sell 7 Buy
*------------------------------------------*/
/// Auction Search (CZ_AUCTION_ITEM_SEARCH)
/// 0251 <search type>.W <auction id>.L <search text>.24B <page number>.W
/// search type:
/// 0 = armor
/// 1 = weapon
/// 2 = card
/// 3 = misc
/// 4 = name search
/// 5 = auction id search
void clif_parse_Auction_search(int fd, struct map_session_data* sd)
{
char search_text[NAME_LENGTH];
short type = RFIFOW(fd,2), page = RFIFOW(fd,32);
int price = RFIFOL(fd,4);
int price = RFIFOL(fd,4); // FIXME: bug #5071
clif_parse_Auction_cancelreg(fd, sd);
safestrncpy(search_text, (char*)RFIFOP(fd,8), NAME_LENGTH);
safestrncpy(search_text, (char*)RFIFOP(fd,8), sizeof(search_text));
intif_Auction_requestlist(sd->status.char_id, type, price, search_text, page);
}
/// Requests list of own currently active bids or auctions (CZ_AUCTION_REQ_MY_INFO)
/// 025c <type>.W
/// type:
/// 0 = sell (own auctions)
/// 1 = buy (own bids)
void clif_parse_Auction_buysell(int fd, struct map_session_data* sd)
{
short type = RFIFOW(fd,2) + 6;