diff options
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 66 |
1 files changed, 53 insertions, 13 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 4fcf20b10..738ca9485 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -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; |