From b4a5462cb762d03273b054708fe3378f6d82ede3 Mon Sep 17 00:00:00 2001 From: Asheraf Date: Thu, 19 Jul 2018 03:25:45 +0100 Subject: Add support for bodystyle in stylist shop ui --- db/re/item_db.conf | 5 +++++ db/stylist_db.conf | 12 ++++++++++++ src/map/clif.c | 12 +++++++++--- src/map/packets.h | 4 ++-- src/map/packets_struct.h | 3 +++ src/map/pc.c | 10 ++++++++++ src/map/pc.h | 1 + 7 files changed, 42 insertions(+), 5 deletions(-) diff --git a/db/re/item_db.conf b/db/re/item_db.conf index 3974a911e..c58a730a7 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -74525,6 +74525,11 @@ item_db: ( noauction: true } }, +{ + Id: 6959 + AegisName: "Costume_Change_Ticket" + Name: "Costume Change Ticket" +}, { Id: 7001 AegisName: "Mould_Powder" diff --git a/db/stylist_db.conf b/db/stylist_db.conf index f11bf016a..70d7162f5 100644 --- a/db/stylist_db.conf +++ b/db/stylist_db.conf @@ -306,4 +306,16 @@ stylist_db: ( Id: "Granpa_Beard" Zeny: 5000 }, +{ + Type: "LOOK_BODY2" + Id: 0 + ItemID: "Costume_Change_Ticket" + BoxItemID: "Costume_Change_Ticket" +}, +{ + Type: "LOOK_BODY2" + Id: 1 + ItemID: "Costume_Change_Ticket" + BoxItemID: "Costume_Change_Ticket" +}, ) diff --git a/src/map/clif.c b/src/map/clif.c index c4a401fa7..5d8e84a74 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -21189,7 +21189,7 @@ static bool clif_stylist_read_db_libconfig_sub(struct config_setting_t *it, int ShowWarning("clif_stylist_read_db_libconfig_sub: Invalid or missing Type (%d) in \"%s\", entry #%d, skipping.\n", type, source, idx); return false; } - if (!itemdb->lookup_const(it, "Id", &i32) || i32 <= 0) { + if (!itemdb->lookup_const(it, "Id", &i32) || i32 < 0) { ShowWarning("clif_stylist_read_db_libconfig_sub: Invalid or missing Id (%d) in \"%s\", entry #%d, skipping.\n", i32, source, idx); return false; } @@ -21226,7 +21226,7 @@ static bool clif_style_change_validate_requirements(struct map_session_data *sd, entry = &VECTOR_INDEX(stylist_data[type], idx); - if (entry->id != 0) { + if (entry->id >= 0) { if (entry->zeny != 0) { if (sd->status.zeny < entry->zeny) return false; @@ -21284,7 +21284,13 @@ static void clif_parse_cz_req_style_change(int fd, struct map_session_data *sd) clif->cz_req_style_change_sub(sd, LOOK_HEAD_MID, p->MidAccessory, true); if (p->BottomAccessory > 0) clif->cz_req_style_change_sub(sd, LOOK_HEAD_BOTTOM, p->BottomAccessory, true); - +#if PACKETVER_RE_NUM >= 20180718 + if (p->BodyStyle > 0) { + if (pc->has_second_costume(sd)) { + clif->cz_req_style_change_sub(sd, LOOK_BODY2, p->BodyStyle, false); + } + } +#endif clif->style_change_response(sd, STYLIST_SHOP_SUCCESS); return; } diff --git a/src/map/packets.h b/src/map/packets.h index d4f87f5a0..8ef011d08 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -4121,7 +4121,7 @@ packet(0x96e,-1,clif->ackmergeitems); // 2018-05-16cRagexe, 2018-05-16cRagexeRE #if PACKETVER >= 20180516 // new packets - packet(0x0afc,16,clif->pDull/*,XXX*/); + packet(0x0afc,16,clif->pReqStyleChange); // changed packet sizes #endif #endif // PACKETVER_ZERO @@ -4130,7 +4130,7 @@ packet(0x96e,-1,clif->ackmergeitems); // 2018-05-23aRagexe_zero #if PACKETVER >= 20180523 // new packets - packet(0x0afc,16,clif->pDull/*,XXX*/); + packet(0x0afc,16,clif->pReqStyleChange); // changed packet sizes #endif #endif // PACKETVER_ZERO diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 27c099a9e..b8950589e 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -1864,6 +1864,9 @@ struct PACKET_CZ_REQ_STYLE_CHANGE { int16 TopAccessory; int16 MidAccessory; int16 BottomAccessory; +#if PACKETVER_RE_NUM >= 20180718 + int16 BodyStyle; +#endif } __attribute__((packed)); struct PACKET_ZC_STYLE_CHANGE_RES { diff --git a/src/map/pc.c b/src/map/pc.c index cd49a6dbf..89d414263 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -12272,6 +12272,15 @@ static void pc_init_exp_groups(void) } } +static bool pc_has_second_costume(struct map_session_data *sd) +{ + nullpo_retr(false, sd); + + if ((sd->job & JOBL_THIRD) != 0) + return true; + return false; +} + static void do_final_pc(void) { @@ -12673,4 +12682,5 @@ void pc_defaults(void) pc->check_basicskill = pc_check_basicskill; pc->isDeathPenaltyJob = pc_isDeathPenaltyJob; + pc->has_second_costume = pc_has_second_costume; } diff --git a/src/map/pc.h b/src/map/pc.h index f998c799d..9bad3a135 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1177,6 +1177,7 @@ END_ZEROED_BLOCK; /* End */ void (*check_supernovice_call) (struct map_session_data *sd, const char *message); bool (*check_basicskill) (struct map_session_data *sd, int level); bool (*isDeathPenaltyJob) (uint16 job); + bool (*has_second_costume) (struct map_session_data *sd); }; #ifdef HERCULES_CORE -- cgit v1.2.3-70-g09d2 From f1ce1f48d541b8b574d2fbc2bc03ea92e816d71e Mon Sep 17 00:00:00 2001 From: Asheraf Date: Thu, 19 Jul 2018 03:26:31 +0100 Subject: enable bodystyle saving by default --- conf/map/battle/client.conf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/conf/map/battle/client.conf b/conf/map/battle/client.conf index 4dc803bca..2fb2d28ac 100644 --- a/conf/map/battle/client.conf +++ b/conf/map/battle/client.conf @@ -104,9 +104,7 @@ wedding_modifydisplay: false save_clothcolor: true // Save body styles? (Note 1) -// Note: Don't turn this on unless you know what your doing. -// Sprites are not released officially. -save_body_style: false +save_body_style: true // Do not display cloth colors for the wedding costume? // Note: Both save_clothcolor and wedding_modifydisplay have to be enabled -- cgit v1.2.3-70-g09d2