Selaa lähdekoodia

Added support for changedress command (#3109)

This adds support for /changedress and /nocosplay by adding an atcommand for it and redirecting the client command to it.

Thanks to @Everade for finding this.
Lemongrass3110 7 vuotta sitten
vanhempi
commit
d16e7e6160
6 muutettua tiedostoa jossa 45 lisäystä ja 1 poistoa
  1. 1 0
      conf/atcommand_athena.conf
  2. 1 1
      conf/groups.conf
  3. 1 0
      conf/help.txt
  4. 22 0
      src/map/atcommand.cpp
  5. 15 0
      src/map/clif.cpp
  6. 5 0
      src/map/clif_packetdb.hpp

+ 1 - 0
conf/atcommand_athena.conf

@@ -63,6 +63,7 @@ aliases: {
 	cloneequip: ["eqclone"]
 	clonestat: ["stclone"]
 	reloadnpcfile: ["reloadnpc"]
+	changedress: ["nocosplay"]
 }
 
 /* Commands help file */

+ 1 - 1
conf/groups.conf

@@ -86,7 +86,7 @@ groups: (
 	level: 0
 	inherit: ( /*empty list*/ )
 	commands: {
-		/* no commands by default */
+		changedress: true
 	}
 	permissions: {
 		/* without this basic permissions regular players could not 

+ 1 - 0
conf/help.txt

@@ -322,3 +322,4 @@ reload: "Params: <type>\n" "Reload a database or configuration file.\n"
 	"   questdb              msgconf       packetdb\n"
 langtype: "Params: <language>\n" "Changes your language setting."
 limitedsale: "Opens the limited sale window."
+changedress: "Removes all character costumes."

+ 22 - 0
src/map/atcommand.cpp

@@ -9726,6 +9726,27 @@ ACMD_FUNC(fullstrip) {
 	return 0;
 }
 
+ACMD_FUNC(changedress){
+	sc_type name2id[] = {
+		SC_WEDDING,
+		SC_XMAS,
+		SC_SUMMER,
+		SC_DRESSUP,
+		SC_HANBOK,
+		SC_OKTOBERFEST
+	};
+
+	for( sc_type type : name2id ) {
+		if( sd->sc.data[type] ) {
+			status_change_end( &sd->bl, type, INVALID_TIMER );
+			// You should only be able to have one - so we cancel here
+			return 0;
+		}
+	}
+
+	return -1;
+}
+
 ACMD_FUNC(costume) {
 	const char* names[] = {
 		"Wedding",
@@ -10297,6 +10318,7 @@ void atcommand_basecommands(void) {
 		ACMD_DEF(agitstart3),
 		ACMD_DEF(agitend3),
 		ACMD_DEFR(limitedsale, ATCMD_NOCONSOLE|ATCMD_NOAUTOTRADE),
+		ACMD_DEFR(changedress, ATCMD_NOCONSOLE|ATCMD_NOAUTOTRADE),
 	};
 	AtCommandInfo* atcommand;
 	int i;

+ 15 - 0
src/map/clif.cpp

@@ -20251,6 +20251,21 @@ void clif_achievement_reward_ack(int fd, unsigned char result, int achievement_i
 	WFIFOSET(fd, packet_len(0xa26));
 }
 
+/*
+ * This packet is sent by /changedress or /nocosplay
+ *
+ * 0ae8
+ */
+void clif_parse_changedress( int fd, struct map_session_data* sd ){
+#if PACKETVER >= 20180103
+	char command[CHAT_SIZE_MAX];
+
+	safesnprintf( command, sizeof(command), "%cchangedress", atcommand_symbol );
+	
+	is_atcommand( fd, sd, command, 1 );
+#endif
+}
+
 /*==========================================
  * Main client packet processing function
  *------------------------------------------*/

+ 5 - 0
src/map/clif_packetdb.hpp

@@ -2363,6 +2363,11 @@
 	packet(0x0ACC,18);
 #endif
 
+// 2018-01-03aRagexeRE or 2018-01-03bRagexeRE
+#if PACKETVER >= 20180103
+	parseable_packet(0x0ae8,2,clif_parse_changedress,0);
+#endif
+
 // 2018-02-07bRagexeRE
 #if PACKETVER >= 20180207
 	parseable_packet(0x0AF4,11,clif_parse_UseSkillToPos,2,4,6,8,10);