Pārlūkot izejas kodu

Converted ZC_DRESSROOM_OPEN to struct (#8837)

Lemongrass3110 5 mēneši atpakaļ
vecāks
revīzija
f3c177699d
6 mainītis faili ar 27 papildinājumiem un 32 dzēšanām
  1. 2 5
      doc/script_commands.txt
  2. 8 12
      src/map/clif.cpp
  3. 1 1
      src/map/clif.hpp
  4. 0 1
      src/map/clif_packetdb.hpp
  5. 6 0
      src/map/packets.hpp
  6. 10 13
      src/map/script.cpp

+ 2 - 5
doc/script_commands.txt

@@ -11025,18 +11025,15 @@ The command returns 1 upon success, and these values upon failure:
 
 ---------------------------------------
 
-*opendressroom(<flag>{,<char_id>});
+*opendressroom({<char_id>});
 
 This will open the Dress Room window on the client connected to the invoking character.
 
 	mes "Close this window to open the Dress Room window.";
 	close2;
-	opendressroom(1);
+	opendressroom();
 	end;
 
-Valid flag are:
- 1 - Open the Dress Room window
-
 ---------------------------------------
 
 *navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});

+ 8 - 12
src/map/clif.cpp

@@ -21228,20 +21228,16 @@ void clif_broadcast_obtain_special_item( const char *char_name, t_itemid nameid,
 	}
 }
 
-/// Show body view windows (ZC_DRESSROOM_OPEN).
-/// 0A02 <view>.W
-/// Value <flag> has the following effects:
-/// 1: Open a Dress Room window.
-void clif_dressing_room(map_session_data *sd, int32 flag) {
-#if PACKETVER >= 20150513
-	int32 fd = sd->fd;
+/// Open the dress room window.
+/// 0A02 <view>.W (ZC_DRESSROOM_OPEN)
+void clif_dressing_room( map_session_data& sd ){
+#if PACKETVER >= 20140212
+	PACKET_ZC_DRESSROOM_OPEN p = {};
 
-	nullpo_retv(sd);
+	p.packetType = HEADER_ZC_DRESSROOM_OPEN;
+	p.view = 0; // Ignored
 
-	WFIFOHEAD(fd, packet_len(0xa02));
-	WFIFOW(fd,0) = 0xa02;
-	WFIFOW(fd,2) = flag;
-	WFIFOSET(fd, packet_len(0xa02));
+	clif_send( &p, sizeof( p ), &sd.bl, SELF );
 #endif
 }
 

+ 1 - 1
src/map/clif.hpp

@@ -1355,7 +1355,7 @@ void clif_merge_item_open( map_session_data& sd );
 
 void clif_broadcast_obtain_special_item(const char *char_name, t_itemid nameid, t_itemid container, enum BROADCASTING_SPECIAL_ITEM_OBTAIN type);
 
-void clif_dressing_room(map_session_data *sd, int32 flag);
+void clif_dressing_room( map_session_data& sd );
 void clif_navigateTo(map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id );
 void clif_SelectCart(map_session_data *sd);
 

+ 0 - 1
src/map/clif_packetdb.hpp

@@ -1783,7 +1783,6 @@
 	// New packet
 	packet(0x0A00,269); // ZC_SHORTCUT_KEY_LIST_V3
 	parseable_packet(0x0A01,3,clif_parse_HotkeyRowShift,2); // CZ_SHORTCUTKEYBAR_ROTATE
-	packet(0x0A02,4); // ZC_DRESSROOM_OPEN
 	packet(0x0A0E,14); // ZC_BATTLEFIELD_NOTIFY_HP2
 	packet(0x09F7,75); // ZC_PROPERTY_HOMUN_2
 	packet(0x09E6,22); // ZC_UPDATE_ITEM_FROM_BUYING_STORE2

+ 6 - 0
src/map/packets.hpp

@@ -1616,6 +1616,12 @@ struct PACKET_CZ_AUCTION_ADD{
 } __attribute__((packed));
 DEFINE_PACKET_HEADER(CZ_AUCTION_ADD, 0x24d);
 
+struct PACKET_ZC_DRESSROOM_OPEN{
+	int16 packetType;
+	uint16 view;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_DRESSROOM_OPEN, 0xa02);
+
 // 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 )

+ 10 - 13
src/map/script.cpp

@@ -24235,25 +24235,22 @@ BUILDIN_FUNC(geteleminfo) {
 }
 
 /**
- * opendressroom(<flag>{,<char_id>});
+ * opendressroom({<char_id>});
  */
 BUILDIN_FUNC(opendressroom)
 {
-#if PACKETVER >= 20150513
-	int32 flag = 1;
-    TBL_PC* sd;
-
-	if( script_hasdata(st,2) )
-		flag = script_getnum(st,2);
+#if PACKETVER >= 20140212
+	map_session_data* sd;
 
-    if (!script_charid2sd(3, sd))
-        return SCRIPT_CMD_FAILURE;
+	if (!script_charid2sd(2, sd))
+		return SCRIPT_CMD_FAILURE;
 
-    clif_dressing_room(sd, flag);
+	clif_dressing_room( *sd );
 
-    return SCRIPT_CMD_SUCCESS;
+	return SCRIPT_CMD_SUCCESS;
 #else
-    return SCRIPT_CMD_FAILURE;
+	ShowError( "buildin_opendressroom: This command requires PACKETVER 2014-02-12 or newer.\n" );
+	return SCRIPT_CMD_FAILURE;
 #endif
 }
 
@@ -28108,7 +28105,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(showscript,"s??"),
 	BUILDIN_DEF(ignoretimeout,"i?"),
 	BUILDIN_DEF(geteleminfo,"i?"),
-	BUILDIN_DEF(opendressroom,"i?"),
+	BUILDIN_DEF(opendressroom,"?"),
 	BUILDIN_DEF(navigateto,"s???????"),
 	BUILDIN_DEF(getguildalliance,"ii"),
 	BUILDIN_DEF(adopt,"vv"),