Przeglądaj źródła

Converted CZ_AUCTION_BUY to struct (#8824)

Lemongrass3110 6 miesięcy temu
rodzic
commit
2bc2ce65b3

+ 1 - 1
conf/msg_conf/map_msg.conf

@@ -256,7 +256,7 @@
 243: Skills have been disabled on this map.
 244: Skills have been enabled on this map.
 245: Server Uptime: %ld days, %ld hours, %ld minutes, %ld seconds.
-246: Your GM level doesn't authorize you to preform this action.
+246: Your GM level doesn't authorize you to perform this action.
 247: You are not authorized to warp to this map.
 248: You are not authorized to warp from your current map.
 249: You are not authorized to warp to your save map.

+ 3 - 3
src/map/buyingstore.cpp

@@ -135,7 +135,7 @@ int8 buyingstore_create( map_session_data* sd, int32 zenylimit, unsigned char re
 	if( !pc_can_give_items(sd) )
 	{// custom: GM is not allowed to buy (give zeny)
 		sd->buyingstore.slots = 0;
-		clif_displaymessage(sd->fd, msg_txt(sd,246));
+		clif_displaymessage( sd->fd, msg_txt( sd, 246 ) ); // Your GM level doesn't authorize you to perform this action.
 		clif_buyingstore_open_failed(sd, BUYINGSTORE_CREATE, 0);
 		return 6;
 	}
@@ -298,7 +298,7 @@ void buyingstore_open(map_session_data* sd, uint32 account_id)
 
 	if( !pc_can_give_items(sd) )
 	{// custom: GM is not allowed to sell
-		clif_displaymessage(sd->fd, msg_txt(sd,246));
+		clif_displaymessage( sd->fd, msg_txt( sd, 246 ) ); // Your GM level doesn't authorize you to perform this action.
 		return;
 	}
 
@@ -343,7 +343,7 @@ void buyingstore_trade( map_session_data* sd, uint32 account_id, uint32 buyer_id
 
 	if( !pc_can_give_items(sd) )
 	{// custom: GM is not allowed to sell
-		clif_displaymessage(sd->fd, msg_txt(sd,246));
+		clif_displaymessage( sd->fd, msg_txt( sd, 246 ) ); // Your GM level doesn't authorize you to perform this action.
 		clif_buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0);
 		return;
 	}

+ 19 - 17
src/map/clif.cpp

@@ -16985,28 +16985,30 @@ void clif_parse_Auction_close(int32 fd, map_session_data *sd){
 }
 
 
-/// Places a bid on an auction (CZ_AUCTION_BUY).
-/// 024f <auction id>.L <money>.L
-void clif_parse_Auction_bid(int32 fd, map_session_data *sd){
-	struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
-	uint32 auction_id = RFIFOL(fd,info->pos[0]);
-	int32 bid = RFIFOL(fd,info->pos[1]);
+/// Places a bid on an auction.
+/// 024f <auction id>.L <money>.L (CZ_AUCTION_BUY)
+void clif_parse_Auction_bid( int32 fd, map_session_data* sd ){
+#if PACKETVER >= 20050718
+	const PACKET_CZ_AUCTION_BUY* p = reinterpret_cast<PACKET_CZ_AUCTION_BUY*>( RFIFOP( fd, 0 ) );
 
-	if( !pc_can_give_items(sd) ) { //They aren't supposed to give zeny [Inkfish]
-		clif_displaymessage(sd->fd, msg_txt(sd,246));
+	if( !pc_can_give_items(sd) ){
+		clif_displaymessage( sd->fd, msg_txt( sd, 246 ) ); // Your GM level doesn't authorize you to perform this action.
 		return;
 	}
-
-	if( bid <= 0 )
-		clif_Auction_message(fd, 0); // You have failed to bid into the auction
-	else if( bid > sd->status.zeny )
-		clif_Auction_message(fd, 8); // You do not have enough zeny
-	else if ( CheckForCharServer() ) // char server is down (bugreport:1138)
+		
+	// Check if char server is down (bugreport:1138)
+	if( CheckForCharServer() ){
 		clif_Auction_message(fd, 0); // You have failed to bid into the auction
-	else {
-		pc_payzeny(sd, bid, LOG_TYPE_AUCTION);
-		intif_Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid);
+		return;
 	}
+
+	if( pc_payzeny( sd, p->money, LOG_TYPE_AUCTION ) != 0 ){
+		clif_Auction_message( fd, 8 ); // You do not have enough zeny
+		return;
+	}
+
+	intif_Auction_bid( sd->status.char_id, sd->status.name, p->auction_id, p->money );
+#endif
 }
 
 

+ 1 - 1
src/map/clif_packetdb.hpp

@@ -669,7 +669,7 @@
 	parseable_packet(0x024c,8,clif_parse_Auction_setitem,2,4);
 	packet(0x024d,14);
 	parseable_packet(0x024e,6,clif_parse_Auction_cancel,2);
-	parseable_packet(0x024f,10,clif_parse_Auction_bid,2,6);
+	parseable_packet( HEADER_CZ_AUCTION_BUY, sizeof( PACKET_CZ_AUCTION_BUY ), clif_parse_Auction_bid, 0 );
 	packet(0x0250,3);
 	packet(0x0251,2);
 	packet(0x0252,-1);

+ 7 - 0
src/map/packets.hpp

@@ -1601,6 +1601,13 @@ struct PACKET_CZ_AUCTION_ITEM_SEARCH{
 } __attribute__((packed));
 DEFINE_PACKET_HEADER(CZ_AUCTION_ITEM_SEARCH, 0x251);
 
+struct PACKET_CZ_AUCTION_BUY{
+	int16 packetType;
+	uint32 auction_id;
+	uint32 money;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_AUCTION_BUY, 0x24f);
+
 // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
 #if !defined( sun ) && ( !defined( __NETBSD__ ) || __NetBSD_Version__ >= 600000000 )
 	#pragma pack( pop )

+ 3 - 3
src/map/storage.cpp

@@ -138,7 +138,7 @@ int32 storage_storageopen(map_session_data *sd)
 		return 1; //Already open?
 
 	if( !pc_can_give_items(sd) ) { // check is this GM level is allowed to put items to storage
-		clif_displaymessage(sd->fd, msg_txt(sd,246));
+		clif_displaymessage( sd->fd, msg_txt( sd, 246 ) ); // Your GM level doesn't authorize you to perform this action.
 		return 1;
 	}
 
@@ -580,7 +580,7 @@ char storage_guild_storageopen(map_session_data* sd)
 #endif
 
 	if( !pc_can_give_items(sd) ) { //check is this GM level can open guild storage and store items [Lupus]
-		clif_displaymessage(sd->fd, msg_txt(sd,246));
+		clif_displaymessage( sd->fd, msg_txt( sd, 246 ) ); // Your GM level doesn't authorize you to perform this action.
 		return GSTORAGE_ALREADY_OPEN;
 	}
 
@@ -1148,7 +1148,7 @@ bool storage_premiumStorage_load(map_session_data *sd, uint8 num, uint8 mode) {
 		return 0;
 
 	if (!pc_can_give_items(sd)) { // check is this GM level is allowed to put items to storage
-		clif_displaymessage(sd->fd, msg_txt(sd,246));
+		clif_displaymessage( sd->fd, msg_txt( sd, 246 ) ); // Your GM level doesn't authorize you to perform this action.
 		return 0;
 	}
 

+ 1 - 1
src/map/trade.cpp

@@ -71,7 +71,7 @@ void trade_traderequest(map_session_data *sd, map_session_data *target_sd)
 	}
 
 	if (!pc_can_give_items(sd) || !pc_can_give_items(target_sd)) { // check if both GMs are allowed to trade
-		clif_displaymessage(sd->fd, msg_txt(sd,246));
+		clif_displaymessage( sd->fd, msg_txt( sd, 246 ) ); // Your GM level doesn't authorize you to perform this action.
 		clif_traderesponse(*sd, TRADE_ACK_FAILED); // GM is not allowed to trade
 		return;
 	}

+ 1 - 1
src/map/vending.cpp

@@ -88,7 +88,7 @@ void vending_vendinglistreq(map_session_data* sd, int32 id)
 		return; // not vending
 
 	if (!pc_can_give_items(sd) || !pc_can_give_items(vsd)) { //check if both GMs are allowed to trade
-		clif_displaymessage(sd->fd, msg_txt(sd,246));
+		clif_displaymessage( sd->fd, msg_txt( sd, 246 ) ); // Your GM level doesn't authorize you to perform this action.
 		return;
 	}