summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-07-19 04:10:48 +0300
committerAndrei Karas <akaras@inbox.ru>2018-07-28 04:40:43 +0300
commiteac9c04d28fb71757efb1d6414ebfed5a832b5ca (patch)
treee69f334ea26f2650d24f6a965bee6b7a90b4df47
parenta7285e774dac19e47c9e9adca3cc97212ed30c59 (diff)
downloadhercules-eac9c04d28fb71757efb1d6414ebfed5a832b5ca.tar.gz
hercules-eac9c04d28fb71757efb1d6414ebfed5a832b5ca.tar.bz2
hercules-eac9c04d28fb71757efb1d6414ebfed5a832b5ca.tar.xz
hercules-eac9c04d28fb71757efb1d6414ebfed5a832b5ca.zip
Add support for chat commands /changedress and /nocosplay for remove costumes
Also add at command for remove costumes @changedress and @nocosplay. Thanks @Lemongrass3110 and @Everade.
-rw-r--r--src/map/atcommand.c9
-rw-r--r--src/map/clif.c12
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/packets.h4
4 files changed, 24 insertions, 2 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 52bf64e87..bedb58478 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -9472,6 +9472,8 @@ ACMD(costume)
};
unsigned short k = 0, len = ARRAYLENGTH(names);
+ bool isChangeDress = (strcmpi(info->command, "changedress") == 0 || strcmpi(info->command, "nocosplay") == 0);
+
if (!*message) {
for (k = 0; k < len; k++) {
if (sd->sc.data[name2id[k]]) {
@@ -9482,6 +9484,8 @@ ACMD(costume)
}
}
+ if (isChangeDress)
+ return true;
clif->message(sd->fd, msg_fd(fd, 1472)); // - Available Costumes
for (k = 0; k < len; k++) {
@@ -9491,6 +9495,9 @@ ACMD(costume)
return false;
}
+ if (isChangeDress)
+ return true;
+
for (k = 0; k < len; k++) {
if (sd->sc.data[name2id[k]]) {
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1470), names[k]); // You're already with a '%s' costume, type '@costume' to remove it.
@@ -10014,6 +10021,8 @@ static void atcommand_basecommands(void)
ACMD_DEF(fontcolor),
ACMD_DEF(searchstore),
ACMD_DEF(costume),
+ ACMD_DEF2("changedress", costume),
+ ACMD_DEF2("nocosplay", costume),
ACMD_DEF(skdebug),
ACMD_DEF(cddebug),
ACMD_DEF(lang),
diff --git a/src/map/clif.c b/src/map/clif.c
index e01bef5c9..b29fde76b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -21575,6 +21575,17 @@ static void clif_overweight_percent(struct map_session_data *sd)
#endif
}
+static void clif_parse_changeDress(int fd, struct map_session_data *sd) __attribute__((nonnull(2)));
+/// 0ae8 <packet len>.W
+static void clif_parse_changeDress(int fd, struct map_session_data *sd)
+{
+ const char commandname[] = "changedress";
+ char command[sizeof commandname + 3] = ""; // '@' command + ' ' + NUL
+
+ sprintf(command, "%c%s ", atcommand->at_symbol, commandname);
+ atcommand->exec(fd, sd, command, true);
+}
+
/*==========================================
* Main client packet processing function
*------------------------------------------*/
@@ -22613,6 +22624,7 @@ void clif_defaults(void)
clif->pMoveItem = clif_parse_MoveItem;
clif->p_cz_blocking_play_cancel = clif_parse_cz_blocking_play_cancel;
clif->overweight_percent = clif_overweight_percent;
+ clif->pChangeDress = clif_parse_changeDress;
/* dull */
clif->pDull = clif_parse_dull;
/* BGQueue */
diff --git a/src/map/clif.h b/src/map/clif.h
index 57ff4001c..3af637629 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -1493,6 +1493,7 @@ struct clif_interface {
void (*hat_effect) (struct block_list *bl, struct block_list *tbl, enum send_target target);
void (*hat_effect_single) (struct block_list *bl, uint16 effectId, bool enable);
void (*overweight_percent) (struct map_session_data *sd);
+ void (*pChangeDress) (int fd, struct map_session_data *sd);
bool (*pAttendanceDB) (void);
bool (*attendancedb_libconfig_sub) (struct config_setting_t *it, int n, const char *source);
diff --git a/src/map/packets.h b/src/map/packets.h
index 9ee290741..38b08a6a1 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -3936,7 +3936,7 @@ packet(0x96e,-1,clif->ackmergeitems);
// new packets
packet(0x0ae6,30);
packet(0x0ae7,30);
- packet(0x0ae8,2);
+ packet(0x0ae8,2,clif->pChangeDress);
// changed packet sizes
#endif
#endif // PACKETVER_ZERO
@@ -3953,7 +3953,7 @@ packet(0x96e,-1,clif->ackmergeitems);
// 2017-12-20aRagexe
#if PACKETVER >= 20171220
// new packets
- packet(0x0ae8,2);
+ packet(0x0ae8,2,clif->pChangeDress);
packet(0x0ae9,64);
packet(0x0aea,11);
// changed packet sizes