From cedd00b65123d2fcd32ac79dc0f6a077f4a279c2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 16 Jan 2019 06:31:59 +0300 Subject: Add support for barter shops for main and re clients with version 20190116 --- src/map/packets_struct.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/map/packets_struct.h') diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index d20b20bee..534da6378 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3056,7 +3056,7 @@ struct PACKET_CZ_PARTY_CONFIG { } __attribute__((packed)); DEFINE_PACKET_HEADER(CZ_PARTY_CONFIG, 0x02c8); -#if PACKETVER_ZERO_NUM >= 20181226 +#if PACKETVER_MAIN_NUM >= 20190116 || PACKETVER_RE_NUM >= 20190116 || PACKETVER_ZERO_NUM >= 20181226 struct PACKET_ZC_NPC_BARTER_OPEN_sub { #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 nameid; @@ -3084,14 +3084,14 @@ struct PACKET_ZC_NPC_BARTER_OPEN { DEFINE_PACKET_HEADER(ZC_NPC_BARTER_OPEN, 0x0b0e); #endif -#if PACKETVER_ZERO_NUM >= 20181226 +#if PACKETVER_MAIN_NUM >= 20190116 || PACKETVER_RE_NUM >= 20190116 || PACKETVER_ZERO_NUM >= 20181226 struct PACKET_CZ_NPC_BARTER_CLOSE { int16 packetType; } __attribute__((packed)); DEFINE_PACKET_HEADER(CZ_NPC_BARTER_CLOSE, 0x0b12); #endif -#if PACKETVER_ZERO_NUM >= 20181226 +#if PACKETVER_MAIN_NUM >= 20190116 || PACKETVER_RE_NUM >= 20190116 || PACKETVER_ZERO_NUM >= 20181226 struct PACKET_CZ_NPC_BARTER_PURCHASE_sub { #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; -- cgit v1.2.3-70-g09d2 From 0b408f5971a9e4152b2aadc2b9208a0e8643f6e3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 30 Jan 2019 16:43:10 +0300 Subject: Update packet ZC_USESKILL_ACK --- src/map/clif.c | 41 ++++++++++++++++++++--------------------- src/map/packets_struct.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 21 deletions(-) (limited to 'src/map/packets_struct.h') diff --git a/src/map/clif.c b/src/map/clif.c index d41570640..44635d699 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5417,32 +5417,31 @@ static void clif_skillinfo(struct map_session_data *sd, int skill_id, int inf) /// 1 = no text static void clif_useskill(struct block_list *bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, uint16 skill_lv, int casttime) { -#if PACKETVER < 20091124 - const int cmd = 0x13e; -#else - const int cmd = 0x7fb; -#endif - unsigned char buf[32]; - int property = skill->get_ele(skill_id, skill_lv); + nullpo_retv(bl); - WBUFW(buf,0) = cmd; - WBUFL(buf,2) = src_id; - WBUFL(buf,6) = dst_id; - WBUFW(buf,10) = dst_x; - WBUFW(buf,12) = dst_y; - WBUFW(buf,14) = skill_id; - WBUFL(buf,16) = property<0?0:property; //Avoid sending negatives as element [Skotlex] - WBUFL(buf,20) = casttime; -#if PACKETVER >= 20091124 - WBUFB(buf,24) = 0; // isDisposable + const int element = skill->get_ele(skill_id, skill_lv); + struct PACKET_ZC_USESKILL_ACK p; + p.packetType = HEADER_ZC_USESKILL_ACK; + p.srcId = src_id; + p.dstId = dst_id; + p.x = dst_x; + p.y = dst_y; + p.skillId = skill_id; + p.element = element < 0 ? 0 : element; //Avoid sending negatives as element [Skotlex] + p.delayTime = casttime; +#if PACKETVER_MAIN_NUM >= 20091124 || PACKETVER_RE_NUM >= 20091124 || defined(PACKETVER_ZERO) + p.disposable = 0; +#endif +#if PACKETVER_ZERO_NUM >= 20190130 + p.unknown = 0; #endif if (clif->isdisguised(bl)) { - clif->send(buf,packet_len(cmd), bl, AREA_WOS); - WBUFL(buf,2) = -src_id; - clif->send(buf,packet_len(cmd), bl, SELF); + clif->send(&p, sizeof(p), bl, AREA_WOS); + p.srcId = -src_id; + clif->send(&p, sizeof(p), bl, SELF); } else { - clif->send(buf,packet_len(cmd), bl, AREA); + clif->send(&p, sizeof(p), bl, AREA); } #if PACKETVER >= 20151223 if ((skill->get_inf2(skill_id) & INF2_SHOW_SKILL_SCALE) != 0) diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 534da6378..9ebc8a75e 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3111,6 +3111,47 @@ struct PACKET_CZ_NPC_BARTER_PURCHASE { DEFINE_PACKET_HEADER(CZ_NPC_BARTER_PURCHASE, 0x0b0f); #endif +#if PACKETVER_ZERO_NUM >= 20190130 +struct PACKET_ZC_USESKILL_ACK { + int16 packetType; + uint32 srcId; + uint32 dstId; + uint16 x; + uint16 y; + uint16 skillId; + uint32 element; + uint32 delayTime; + uint8 disposable; + uint32 unknown; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_USESKILL_ACK, 0x0b1a); +#elif PACKETVER_MAIN_NUM >= 20091124 || PACKETVER_RE_NUM >= 20091124 || defined(PACKETVER_ZERO) +struct PACKET_ZC_USESKILL_ACK { + int16 packetType; + uint32 srcId; + uint32 dstId; + uint16 x; + uint16 y; + uint16 skillId; + uint32 element; + uint32 delayTime; + uint8 disposable; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_USESKILL_ACK, 0x07fb); +#elif PACKETVER_MAIN_NUM >= 20090406 || PACKETVER_SAK_NUM >= 20080618 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO) +struct PACKET_ZC_USESKILL_ACK { + int16 packetType; + uint32 srcId; + uint32 dstId; + uint16 x; + uint16 y; + uint16 skillId; + uint32 element; + uint32 delayTime; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_USESKILL_ACK, 0x013e); +#endif + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris -- cgit v1.2.3-70-g09d2 From 1efc9f3571988551407191a0784b363022c7fcc5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 Feb 2019 22:30:04 +0300 Subject: Add packet CZ_CLIENT_VERSION For now unused, but can be used. This packet works in some old clients near 2015 versions. --- configure | 2 +- src/map/clif.c | 9 +++++++++ src/map/clif.h | 1 + src/map/packets.h | 4 ++++ src/map/packets_struct.h | 8 ++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src/map/packets_struct.h') diff --git a/configure b/configure index 41b308828..0560d8d85 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac e207bf99b. +# From configure.ac 5b2340b4d. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # diff --git a/src/map/clif.c b/src/map/clif.c index 44635d699..ae92e7b2c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -22289,6 +22289,14 @@ static void clif_parse_NPCBarterPurchase(int fd, struct map_session_data *sd) #endif } +static void clif_parse_clientVersion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_clientVersion(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20090406 || PACKETVER_RE_NUM >= 20090408 || PACKETVER_SAK_NUM >= 20090408 || defined(PACKETVER_ZERO) + // TODO: show or store client version +#endif +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -23478,4 +23486,5 @@ void clif_defaults(void) clif->npc_barter_open = clif_npc_barter_open; clif->pNPCBarterClosed = clif_parse_NPCBarterClosed; clif->pNPCBarterPurchase = clif_parse_NPCBarterPurchase; + clif->pClientVersion = clif_parse_clientVersion; } diff --git a/src/map/clif.h b/src/map/clif.h index 1aee11c33..36c360cbc 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1599,6 +1599,7 @@ struct clif_interface { void (*npc_barter_open) (struct map_session_data *sd, struct npc_data *nd); void (*pNPCBarterClosed) (int fd, struct map_session_data *sd); void (*pNPCBarterPurchase) (int fd, struct map_session_data *sd); + void (*pClientVersion) (int fd, struct map_session_data *sd); }; #ifdef HERCULES_CORE diff --git a/src/map/packets.h b/src/map/packets.h index d430a6de8..50784f09a 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -649,6 +649,10 @@ packet(0x96e,clif->ackmergeitems); packet(0x0439,clif->pUseItem,2,4); #endif +#if PACKETVER_MAIN_NUM >= 20090406 || PACKETVER_RE_NUM >= 20090408 || PACKETVER_SAK_NUM >= 20090408 || defined(PACKETVER_ZERO) + packet(0x044a,clif->pClientVersion); +#endif + // 2009-05-20aRagexe, 2009-05-20aRagexeRE #if PACKETVER >= 20090520 // new packets diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 9ebc8a75e..2339935ec 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3152,6 +3152,14 @@ struct PACKET_ZC_USESKILL_ACK { DEFINE_PACKET_HEADER(ZC_USESKILL_ACK, 0x013e); #endif +#if PACKETVER_MAIN_NUM >= 20090406 || PACKETVER_RE_NUM >= 20090408 || PACKETVER_SAK_NUM >= 20090408 || defined(PACKETVER_ZERO) +struct PACKET_CZ_CLIENT_VERSION { + int16 packetType; + uint32 clientVersion; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_CLIENT_VERSION, 0x044a); +#endif + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris -- cgit v1.2.3-70-g09d2