Browse Source

Converted CZ_AUCTION_ADD to struct (#8825)

Lemongrass3110 6 months ago
parent
commit
ef14f29a14
3 changed files with 19 additions and 9 deletions
  1. 10 8
      src/map/clif.cpp
  2. 1 1
      src/map/clif_packetdb.hpp
  3. 8 0
      src/map/packets.hpp

+ 10 - 8
src/map/clif.cpp

@@ -16882,19 +16882,20 @@ void clif_Auction_close(int32 fd, unsigned char flag)
 }
 
 
-/// Request to add an auction (CZ_AUCTION_ADD).
-/// 024d <now money>.L <max money>.L <delete hour>.W
-void clif_parse_Auction_register(int32 fd, map_session_data *sd)
-{
+/// Request to add an auction.
+/// 024d <now money>.L <max money>.L <delete hour>.W (CZ_AUCTION_ADD)
+void clif_parse_Auction_register( int32 fd, map_session_data* sd ){
+#if PACKETVER >= 20050808
+	const PACKET_CZ_AUCTION_ADD* p = reinterpret_cast<PACKET_CZ_AUCTION_ADD*>( RFIFOP( fd, 0 ) );
+
 	struct auction_data auction;
-	struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
 
 	if( !battle_config.feature_auction )
 		return;
 
-	auction.price = RFIFOL(fd,info->pos[0]);
-	auction.buynow = RFIFOL(fd,info->pos[1]);
-	auction.hours = RFIFOW(fd,info->pos[2]);
+	auction.price = p->now_money;
+	auction.buynow = p->max_money;
+	auction.hours = p->hours;
 
 	// Invalid Situations...
 	if( sd->auction.amount < 1 ) {
@@ -16966,6 +16967,7 @@ void clif_parse_Auction_register(int32 fd, map_session_data *sd)
 
 		pc_payzeny(sd, zeny, LOG_TYPE_AUCTION);
 	}
+#endif
 }
 
 

+ 1 - 1
src/map/clif_packetdb.hpp

@@ -702,7 +702,7 @@
 
 // 2005-08-08aSakexe
 #if PACKETVER >= 20050808
-	parseable_packet(0x024d,12,clif_parse_Auction_register,2,6,10);
+	parseable_packet( HEADER_CZ_AUCTION_ADD, sizeof( PACKET_CZ_AUCTION_ADD ), clif_parse_Auction_register, 0 );
 	packet(0x024e,4);
 #endif
 

+ 8 - 0
src/map/packets.hpp

@@ -1608,6 +1608,14 @@ struct PACKET_CZ_AUCTION_BUY{
 } __attribute__((packed));
 DEFINE_PACKET_HEADER(CZ_AUCTION_BUY, 0x24f);
 
+struct PACKET_CZ_AUCTION_ADD{
+	int16 packetType;
+	uint32 now_money;
+	uint32 max_money;
+	uint16 hours;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_AUCTION_ADD, 0x24d);
+
 // 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 )