summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/clif.c21
-rw-r--r--src/map/clif.h15
-rw-r--r--src/map/packets_struct.h7
-rw-r--r--src/map/script.c2
4 files changed, 33 insertions, 12 deletions
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;
}