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 --- db/pre-re/skill_db.txt | 2 +- db/pre-re/skill_require_db.txt | 2 +- db/pre-re/skill_tree.conf | 1 + db/re/skill_db.txt | 2 +- db/re/skill_require_db.txt | 2 +- db/re/skill_tree.conf | 1 + src/common/mmo.h | 16 ++++++++++----- src/map/clif.c | 44 ++++++++++++++++++++++++++++++++++++++++++ src/map/clif.h | 3 +++ src/map/packets.h | 5 +++++ src/map/skill.c | 9 ++++++++- 11 files changed, 77 insertions(+), 10 deletions(-) diff --git a/db/pre-re/skill_db.txt b/db/pre-re/skill_db.txt index 5f8553127..dd72963cd 100644 --- a/db/pre-re/skill_db.txt +++ b/db/pre-re/skill_db.txt @@ -1024,7 +1024,7 @@ //2541,0,0,0,0,0,0,??,0,no,0,0,0,none,0, NPC_UGLYDANCE,Ugly Dance 2 //2542,0,0,0,0,0,0,??,0,no,0,0,0,none,0, ALL_TETANY,Tetany //2543,0,0,0,0,0,0,??,0,no,0,0,0,none,0, ALL_RAY_OF_PROTECTION,Ray of Protection -//2544,0,0,0,0,0,0,??,0,no,0,0,0,none,0, MC_CARTDECORATE,Decorate Cart +2544,0,6,4,0,0x1,0,1,1,no,0,0x1,0,none,0, MC_CARTDECORATE,Change Cart 2 //2545,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GM_ITEM_ATKMAX#Maximum Attack# //2546,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GM_ITEM_ATKMIN#Minimal Attack# //2547,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GM_ITEM_MATKMAX#Maximum Magic Attack# diff --git a/db/pre-re/skill_require_db.txt b/db/pre-re/skill_require_db.txt index 8b09f085e..87c11bc48 100644 --- a/db/pre-re/skill_require_db.txt +++ b/db/pre-re/skill_require_db.txt @@ -816,7 +816,7 @@ //2542,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //ALL_TETANY#Tentay# //2543,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //ALL_RAY_OF_PROTECTION#Ray of Protection# -//2544,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MC_CARTDECORATE#Cart Decorate# +2544,0,0,40,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MC_CARTDECORATE#Change Cart 2# // Rebellion 2551,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //RL_GLITTERING_GREED#Flip The Coin Greed# diff --git a/db/pre-re/skill_tree.conf b/db/pre-re/skill_tree.conf index 9f07d9805..805e7929c 100644 --- a/db/pre-re/skill_tree.conf +++ b/db/pre-re/skill_tree.conf @@ -217,6 +217,7 @@ Merchant: { MC_MAMMONITE: 10 MC_CARTREVOLUTION: 1 MC_CHANGECART: 1 + MC_CARTDECORATE: 1 MC_LOUD: 1 ALL_BUYING_STORE: { MaxLevel: 1 diff --git a/db/re/skill_db.txt b/db/re/skill_db.txt index eb875fc56..0821d41b2 100644 --- a/db/re/skill_db.txt +++ b/db/re/skill_db.txt @@ -1036,7 +1036,7 @@ //2541,0,0,0,0,0,0,??,0,no,0,0,0,none,0, NPC_UGLYDANCE,Ugly Dance 2 //2542,0,0,0,0,0,0,??,0,no,0,0,0,none,0, ALL_TETANY,Tetany //2543,0,0,0,0,0,0,??,0,no,0,0,0,none,0, ALL_RAY_OF_PROTECTION,Ray of Protection -//2544,0,0,0,0,0,0,??,0,no,0,0,0,none,0, MC_CARTDECORATE,Decorate Cart +2544,0,6,4,0,0x1,0,1,1,no,0,0x1,0,none,0, MC_CARTDECORATE,Change Cart 2 //2545,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GM_ITEM_ATKMAX#Maximum Attack# //2546,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GM_ITEM_ATKMIN#Minimal Attack# //2547,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GM_ITEM_MATKMAX#Maximum Magic Attack# diff --git a/db/re/skill_require_db.txt b/db/re/skill_require_db.txt index 1e7cd23d2..a2e763dc2 100644 --- a/db/re/skill_require_db.txt +++ b/db/re/skill_require_db.txt @@ -820,7 +820,7 @@ //2542,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //ALL_TETANY#Tentay# //2543,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //ALL_RAY_OF_PROTECTION#Ray of Protection# -//2544,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MC_CARTDECORATE#Cart Decorate# +2544,0,0,40,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MC_CARTDECORATE#Change Cart 2# // Rebellion 2551,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //RL_GLITTERING_GREED#Flip The Coin Greed# diff --git a/db/re/skill_tree.conf b/db/re/skill_tree.conf index f27f6e67a..6e040420b 100644 --- a/db/re/skill_tree.conf +++ b/db/re/skill_tree.conf @@ -217,6 +217,7 @@ Merchant: { MC_MAMMONITE: 10 MC_CARTREVOLUTION: 1 MC_CHANGECART: 1 + MC_CARTDECORATE: 1 MC_LOUD: 1 ALL_BUYING_STORE: { MaxLevel: 1 diff --git a/src/common/mmo.h b/src/common/mmo.h index eb1d7cc8e..17e6078fc 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -98,13 +98,19 @@ #endif // 20090603 #endif // 20070227 -/* Feb 1st 2012 */ -#if PACKETVER >= 20120201 -# define NEW_CARTS -# define MAX_CARTS 9 +#if PACKETVER >= 20150805 /* Cart Decoration */ + #define CART_DECORATION + #define MAX_CARTDECORATION_CARTS 3 // Currently there are 3 Carts available in kRO. [Frost] #else -# define MAX_CARTS 5 + #define MAX_CARTDECORATION_CARTS 0 #endif +#if PACKETVER >= 20120201 /* New Geneticist Carts */ + #define NEW_CARTS + #define MAX_BASE_CARTS 9 +#else + #define MAX_BASE_CARTS 5 +#endif +#define MAX_CARTS (MAX_BASE_CARTS + MAX_CARTDECORATION_CARTS) #define MAX_INVENTORY 100 //Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well. 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