From d9c56ea3e0722aec976baa2366b93eb0b86b991b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 26 Nov 2018 20:07:35 +0300 Subject: Fix packet ZC_PROPERTY_HOMUN for old clients. --- src/map/clif.c | 4 +++- src/map/packets_struct.h | 46 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/map/clif.c b/src/map/clif.c index da8ba3a95..82ced2d24 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1627,6 +1627,7 @@ static bool clif_spawn(struct block_list *bl) /// 022e .24B .B .W .W .W .W .W .W .W .W .W .W .W .W .W .W .W .W .L .L .W .W static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { +#if PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO_NUM) struct status_data *hstatus; enum homun_type htype; struct PACKET_ZC_PROPERTY_HOMUN p; @@ -1638,7 +1639,7 @@ static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int htype = homun->class2type(hd->homunculus.class_); memset(&p, 0, sizeof(p)); - p.packetType = hominfoType; + p.packetType = HEADER_ZC_PROPERTY_HOMUN; memcpy(p.name, hd->homunculus.name, NAME_LENGTH); // Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true) p.flags = (!battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); @@ -1704,6 +1705,7 @@ static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int p.skillPoints = hd->homunculus.skillpts; p.range = status_get_range(&hd->bl); clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif } /// Notification about a change in homunuculus' state (ZC_CHANGESTATE_MER). diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index c1b93e781..1f4df6fc9 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -417,12 +417,6 @@ enum packet_headers { buyingStoreUpdateItemType = 0x9e6, #else buyingStoreUpdateItemType = 0x81b, -#endif -// probably can works also for < 20141223, but in 3CeaM packet size defined only for 20150513 -#if PACKETVER >= 20150513 - hominfoType = 0x9f7, -#else - hominfoType = 0x22e, #endif reqName = 0x95, #if PACKETVER >= 20150503 // Confirm this? @@ -2276,6 +2270,8 @@ struct PACKET_ZC_ACK_WEAPONREFINE { #endif } __attribute__((packed)); +#if PACKETVER_MAIN_NUM >= 20131230 || PACKETVER_RE_NUM >= 20131230 || defined(PACKETVER_ZERO_NUM) +// PACKET_ZC_PROPERTY_HOMUN2 struct PACKET_ZC_PROPERTY_HOMUN { int16 packetType; char name[NAME_LENGTH]; @@ -2297,13 +2293,41 @@ struct PACKET_ZC_PROPERTY_HOMUN { uint16 mdef; uint16 flee; uint16 amotion; -#if PACKETVER < 20150513 - uint16 hp; - uint16 maxHp; -#else uint32 hp; uint32 maxHp; + uint16 sp; + uint16 maxSp; + uint32 exp; + uint32 expNext; + uint16 skillPoints; + uint16 range; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_PROPERTY_HOMUN, 0x09f7); +#elif PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO_NUM) +// PACKET_ZC_PROPERTY_HOMUN1 +struct PACKET_ZC_PROPERTY_HOMUN { + int16 packetType; + char name[NAME_LENGTH]; + // Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true) + uint8 flags; + uint16 level; + uint16 hunger; + uint16 intimacy; +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 + uint32 itemId; +#else + uint16 itemId; #endif + uint16 atk2; + uint16 matk; + uint16 hit; + uint16 crit; + uint16 def; + uint16 mdef; + uint16 flee; + uint16 amotion; + uint16 hp; + uint16 maxHp; uint16 sp; uint16 maxSp; uint32 exp; @@ -2311,6 +2335,8 @@ struct PACKET_ZC_PROPERTY_HOMUN { uint16 skillPoints; uint16 range; } __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_PROPERTY_HOMUN, 0x022e); +#endif struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER { int16 packetType; -- cgit v1.2.3-70-g09d2