static void mapif_parse_Auction_close(int fd) { int char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6); struct auction_data *auction; if( (auction = (struct auction_data *)idb_get(auction_db_, auction_id)) == NULL ) { mapif_Auction_close(fd, char_id, 2); // Bid Number is Incorrect return; } if( auction->seller_id != char_id ) { mapif_Auction_close(fd, char_id, 1); // You cannot end the auction return; } if( auction->buyer_id == 0 ) { mapif_Auction_close(fd, char_id, 1); // You cannot end the auction return; } // Send Money to Seller mail_sendmail(0, "Auction Manager", auction->seller_id, auction->seller_name, "Auction", "Auction closed.", auction->price, NULL); // Send Item to Buyer mail_sendmail(0, "Auction Manager", auction->buyer_id, auction->buyer_name, "Auction", "Auction winner.", 0, &auction->item); mapif_Auction_message(auction->buyer_id, 6); // You have won the auction auction_delete(auction); mapif_Auction_close(fd, char_id, 0); // You have ended the auction }
void mapif_parse_Auction_close(int fd) { uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6); struct auction_data *auction; if( (auction = (struct auction_data *)idb_get(auction_db_, auction_id)) == NULL ) { mapif_Auction_close(fd, char_id, 2); // Bid Number is Incorrect return; } if( auction->seller_id != char_id ) { mapif_Auction_close(fd, char_id, 1); // You cannot end the auction return; } if( auction->buyer_id == 0 ) { mapif_Auction_close(fd, char_id, 1); // You cannot end the auction return; } // Send Money to Seller mail_sendmail(0, msg_txt(200), auction->seller_id, auction->seller_name, msg_txt(201), msg_txt(206), auction->price, NULL, 0); // Send Item to Buyer mail_sendmail(0, msg_txt(200), auction->buyer_id, auction->buyer_name, msg_txt(201), msg_txt(207), 0, &auction->item, 1); mapif_Auction_message(auction->buyer_id, 6); // You have won the auction auction_delete(auction); mapif_Auction_close(fd, char_id, 0); // You have ended the auction }