From d16e7e616093a741aa89c3f2b8ba73752e443bea Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Sat, 19 May 2018 00:37:41 +0200 Subject: [PATCH] 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. --- conf/atcommand_athena.conf | 1 + conf/groups.conf | 2 +- conf/help.txt | 1 + src/map/atcommand.cpp | 22 ++++++++++++++++++++++ src/map/clif.cpp | 15 +++++++++++++++ src/map/clif_packetdb.hpp | 5 +++++ 6 files changed, 45 insertions(+), 1 deletion(-) diff --git a/conf/atcommand_athena.conf b/conf/atcommand_athena.conf index 81fc0af6ae..53eff8088b 100644 --- a/conf/atcommand_athena.conf +++ b/conf/atcommand_athena.conf @@ -63,6 +63,7 @@ aliases: { cloneequip: ["eqclone"] clonestat: ["stclone"] reloadnpcfile: ["reloadnpc"] + changedress: ["nocosplay"] } /* Commands help file */ diff --git a/conf/groups.conf b/conf/groups.conf index 627076370a..ccdde95ff8 100644 --- a/conf/groups.conf +++ b/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 diff --git a/conf/help.txt b/conf/help.txt index c941c46f44..4a089a264b 100644 --- a/conf/help.txt +++ b/conf/help.txt @@ -322,3 +322,4 @@ reload: "Params: \n" "Reload a database or configuration file.\n" " questdb msgconf packetdb\n" langtype: "Params: \n" "Changes your language setting." limitedsale: "Opens the limited sale window." +changedress: "Removes all character costumes." diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index c1cd06b847..198180de65 100644 --- a/src/map/atcommand.cpp +++ b/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; diff --git a/src/map/clif.cpp b/src/map/clif.cpp index f03a73204b..b2d7de9074 100644 --- a/src/map/clif.cpp +++ b/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 *------------------------------------------*/ diff --git a/src/map/clif_packetdb.hpp b/src/map/clif_packetdb.hpp index d3b1d5ceab..296234954b 100644 --- a/src/map/clif_packetdb.hpp +++ b/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);