From a0f25125a6239894a86d51ae8dcf6a06a4d0a380 Mon Sep 17 00:00:00 2001 From: Jedzkie Date: Sat, 26 Dec 2015 19:56:18 +0800 Subject: Added support for MC_CARTDECORATE skill. *This skill is supported only by 2015-08-05aRagexeRE clients onwards.* Closes #1025 as merged Signed-off-by: Haru --- src/map/clif.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/map/clif.h | 3 +++ src/map/packets.h | 5 +++++ src/map/skill.c | 9 ++++++++- 4 files changed, 60 insertions(+), 1 deletion(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 827f57c45..b9c7afa2f 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10874,6 +10874,25 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd) pc->setcart(sd,type); } +/// Request to select cart's visual look for new cart design (CZ_SELECTCART). +/// 0980 .L .B +void clif_parse_SelectCart(int fd, struct map_session_data *sd) +{ +#if PACKETVER >= 20150805 // RagexeRE + int type; + + if (!sd || !pc->checkskill(sd, MC_CARTDECORATE) || RFIFOL(fd, 2) != sd->status.account_id) + return; + + type = (int)RFIFOB(fd, 6); + + if (type <= MAX_BASE_CARTS || type > MAX_CARTS) + return; + + pc->setcart(sd, type); +#endif +} + void clif_parse_StatusUp(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to increase status (CZ_STATUS_CHANGE). /// 00bb .W .B @@ -18607,6 +18626,28 @@ void clif_dressroom_open(struct map_session_data *sd, int view) WFIFOSET(fd,packet_len(0xa02)); } +/// Request to select cart's visual look for new cart design (ZC_SELECTCART). +/// 097f .W .L .B +void clif_selectcart(struct map_session_data *sd) +{ +#if PACKETVER >= 20150805 + int i = 0, fd; + + fd = sd->fd; + + WFIFOHEAD(fd, 8 + MAX_CART_DECORATION); + WFIFOW(fd, 0) = 0x97f; + WFIFOW(fd, 2) = 8 + MAX_CART_DECORATION; + WFIFOL(fd, 4) = sd->status.account_id; + + for (i = 0; i < MAX_CART_DECORATION; i++) { + WFIFOB(fd, 8 + i) = MAX_BASE_CARTS + 1 + i; + } + + WFIFOSET(fd, 8 + MAX_CART_DECORATION); +#endif +} + /* */ unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { if( sd ) { @@ -19419,6 +19460,8 @@ void clif_defaults(void) { clif->cancelmergeitem = clif_cancelmergeitem; clif->comparemergeitem = clif_comparemergeitem; clif->ackmergeitems = clif_ackmergeitems; + /* Cart Deco */ + clif->selectcart = clif_selectcart; /*------------------------ *- Parse Incoming Packet @@ -19467,6 +19510,7 @@ void clif_defaults(void) { clif->pGetItemFromCart = clif_parse_GetItemFromCart; clif->pRemoveOption = clif_parse_RemoveOption; clif->pChangeCart = clif_parse_ChangeCart; + clif->pSelectCart = clif_parse_SelectCart; clif->pStatusUp = clif_parse_StatusUp; clif->pSkillUp = clif_parse_SkillUp; clif->pUseSkillToId = clif_parse_UseSkillToId; diff --git a/src/map/clif.h b/src/map/clif.h index 5a6b01d31..7567e507b 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1338,6 +1338,9 @@ struct clif_interface { void (*add_random_options) (unsigned char* buf, struct item* item); void (*pHotkeyRowShift) (int fd, struct map_session_data *sd); void (*dressroom_open) (struct map_session_data *sd, int view); + /* Cart Deco */ + void(*selectcart) (struct map_session_data *sd); + void(*pSelectCart) (int fd, struct map_session_data *sd); }; #ifdef HERCULES_CORE diff --git a/src/map/packets.h b/src/map/packets.h index 9b9c7945f..f468cd3df 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -2915,6 +2915,11 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0a02,4); // ZC_DRESSROOM_OPEN #endif +#if PACKETVER >= 20150805 // RagexeRE + packet(0x097f,-1); // ZC_SELECTCART + packet(0x0980,7,clif->pSelectCart); // CZ_SELECTCART +#endif + /* PacketKeys: http://herc.ws/board/topic/1105-hercules-wpe-free-june-14th-patch/ */ #if PACKETVER >= 20110817 packetKeys(0x053D5CED,0x3DED6DED,0x6DED6DED); /* Thanks to Shakto */ diff --git a/src/map/skill.c b/src/map/skill.c index b3c264e43..d9ced959a 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6047,7 +6047,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; case MC_CHANGECART: - clif->skill_nodamage(src,bl,skill_id,skill_lv,1); + clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); + break; + + case MC_CARTDECORATE: + if (sd) { + clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); + clif->selectcart(sd); + } break; case TK_MISSION: -- cgit v1.2.3-70-g09d2