From fddfde994fe98843db6802f438a5f23941836642 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 13 Jun 2018 04:29:42 +0300 Subject: Add cz enum for types in packet 0x0a68. --- src/map/script.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index d9350081a..1f4a42669 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24168,7 +24168,7 @@ BUILDIN(openstylist) if (sd == NULL) return false; - clif->open_ui(sd, STYLIST_UI); + clif->open_ui(sd, CZ_STYLIST_UI); return true; } -- cgit v1.2.3-60-g2f50 From ef8ee07753bfbf824e57eafc617acc7d921c0f38 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 13 Jun 2018 05:27:56 +0300 Subject: Split enum zc_ui_types by supported packet versions. Also fixed clif_open_ui for old clients. --- src/map/clif.c | 21 ++++++++++++++------- src/map/clif.h | 15 ++++++++++----- src/map/packets_struct.h | 7 +++++++ src/map/script.c | 2 ++ 4 files changed, 33 insertions(+), 12 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/clif.c b/src/map/clif.c index 9be4feb70..a9d82b1ac 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -20533,34 +20533,41 @@ void clif_parse_open_ui_request(int fd, struct map_session_data *sd) void clif_open_ui(struct map_session_data *sd, enum cz_ui_types uiType) { -#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411 - int claimed = 0; +#if PACKETVER >= 20150128 struct PACKET_ZC_OPEN_UI p; nullpo_retv(sd); - p.PacketType = 0xAE2; + p.PacketType = openUiType; switch (uiType) { case CZ_STYLIST_UI: - p.UIType = STYLIST_UI; + p.UIType = ZC_STYLIST_UI; +#if PACKETVER >= 20171122 p.data = 0; +#endif break; case CZ_ATTENDANCE_UI: + { +#if PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411 + int claimed = 0; if (clif->attendance_timediff(sd) != true) ++claimed; else if (sd->status.attendance_count >= VECTOR_LENGTH(clif->attendance_data)) sd->status.attendance_count = 0; p.UIType = ZC_ATTENDANCE_UI; p.data = sd->status.attendance_count * 10 + claimed; +#else + ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411.\n"); + return; +#endif break; + } default: - ShowWarning("clif_open_ui: Requested UI (%d) is not implemented yet.\n", uiType); + ShowWarning("clif_open_ui: Requested UI (%u) is not implemented yet.\n", uiType); return; } clif->send(&p, sizeof(p), &sd->bl, SELF); -#else - ShowWarning("Attendance System available only for PACKETVER_RE_NUM >= 20180307 || PACKETVER_MAIN_NUM >= 20180404 || PACKETVER_ZERO_NUM >= 20180411.\n"); #endif } diff --git a/src/map/clif.h b/src/map/clif.h index 40974b063..92f79c994 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -556,13 +556,18 @@ enum CZ_CONFIG { * used with packet 0xAE2 to request the client to open a specific ui **/ enum zc_ui_types { +#if PACKETVER >= 20150128 ZC_BANK_UI = 0, - ZC_STYLIST_UI, - ZC_CAPTCHA_UI, - ZC_MACRO_UI, + ZC_STYLIST_UI = 1, + ZC_CAPTCHA_UI = 2, + ZC_MACRO_UI = 3, +#endif + zc_ui_unused = 4, // for avoid compilation errors +#if PACKETVER >= 20171122 ZC_TIPBOX_UI = 5, - ZC_RENEWQUEST_UI, - ZC_ATTENDANCE_UI + ZC_RENEWQUEST_UI = 6, + ZC_ATTENDANCE_UI = 7 +#endif }; /** diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 971e7c330..d152ffd2a 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -368,6 +368,11 @@ enum packet_headers { questUpdateType = 0x2b5, #endif // PACKETVER < 20150513 questUpdateType2 = 0x8fe, +#if PACKETVER >= 20171122 + openUiType = 0xAE2, +#elif PACKETVER >= 20150128 + openUiType = 0xA38, +#endif }; #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute @@ -1720,7 +1725,9 @@ struct PACKET_CZ_OPEN_UI { struct PACKET_ZC_OPEN_UI { int16 PacketType; int8 UIType; +#if PACKETVER >= 20171122 int32 data; +#endif } __attribute__((packed)); struct PACKET_ZC_UI_ACTION { diff --git a/src/map/script.c b/src/map/script.c index 1f4a42669..1a9f774a1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24168,7 +24168,9 @@ BUILDIN(openstylist) if (sd == NULL) return false; +#if PACKETVER >= 20150128 clif->open_ui(sd, CZ_STYLIST_UI); +#endif return true; } -- cgit v1.2.3-60-g2f50