diff options
author | Andrei Karas <akaras@inbox.ru> | 2019-05-09 03:26:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-06-02 00:23:24 +0300 |
commit | e68d49654e4eb5f6749f16d2fc3ca4e7a747b91c (patch) | |
tree | 7e0a8c7d5e8a3f9f4b8ce0a882a89daa2486b3da | |
parent | 0d5238bba6552616921f22d484f6b707d0abe6fe (diff) | |
download | hercules-e68d49654e4eb5f6749f16d2fc3ca4e7a747b91c.tar.gz hercules-e68d49654e4eb5f6749f16d2fc3ca4e7a747b91c.tar.bz2 hercules-e68d49654e4eb5f6749f16d2fc3ca4e7a747b91c.tar.xz hercules-e68d49654e4eb5f6749f16d2fc3ca4e7a747b91c.zip |
Update packet CZ_SHORTCUT_KEY_CHANGE
-rw-r--r-- | src/map/clif.c | 41 | ||||
-rw-r--r-- | src/map/clif.h | 3 | ||||
-rw-r--r-- | src/map/packets.h | 9 | ||||
-rw-r--r-- | src/map/packets_struct.h | 20 |
4 files changed, 59 insertions, 14 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index b04637ebc..69a73e9f1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10871,22 +10871,38 @@ static void clif_parse_HotkeyRowShift(int fd, struct map_session_data *sd) sd->status.hotkey_rowshift = RFIFOB(fd, packet_db[cmd].pos[0]); } -static void clif_parse_Hotkey(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -/// Request to update a position on the hotkey bar (CZ_SHORTCUT_KEY_CHANGE). +static void clif_parse_Hotkey1(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +/// Request to update a position on the hotkey bar (CZ_SHORTCUT_KEY_CHANGE1). /// 02ba <index>.W <is skill>.B <id>.L <count>.W -static void clif_parse_Hotkey(int fd, struct map_session_data *sd) +static void clif_parse_Hotkey1(int fd, struct map_session_data *sd) { #ifdef HOTKEY_SAVING - unsigned short idx; - int cmd; +#if PACKETVER_MAIN_NUM >= 20070618 || defined(PACKETVER_RE) || defined(PACKETVER_ZERO) || PACKETVER_AD_NUM >= 20070618 || PACKETVER_SAK_NUM >= 20070618 + const struct PACKET_CZ_SHORTCUT_KEY_CHANGE1 *p = RFIFOP(fd, 0); + const unsigned short idx = p->index; + Assert_retv(idx < MAX_HOTKEYS); - cmd = RFIFOW(fd, 0); - idx = RFIFOW(fd, packet_db[cmd].pos[0]); - if (idx >= MAX_HOTKEYS) return; + sd->status.hotkeys[idx].type = p->hotkey.isSkill; + sd->status.hotkeys[idx].id = p->hotkey.id; + sd->status.hotkeys[idx].lv = p->hotkey.count; +#endif +#endif +} - sd->status.hotkeys[idx].type = RFIFOB(fd, packet_db[cmd].pos[1]); - sd->status.hotkeys[idx].id = RFIFOL(fd, packet_db[cmd].pos[2]); - sd->status.hotkeys[idx].lv = RFIFOW(fd, packet_db[cmd].pos[3]); +static void clif_parse_Hotkey2(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +/// Request to update a position on the hotkey bar (CZ_SHORTCUT_KEY_CHANGE2). +static void clif_parse_Hotkey2(int fd, struct map_session_data *sd) +{ +#ifdef HOTKEY_SAVING +#if PACKETVER_RE_NUM >= 20190508 + const struct PACKET_CZ_SHORTCUT_KEY_CHANGE2 *p = RFIFOP(fd, 0); + const unsigned short idx = p->index + p->tab * MAX_HOTKEYS; + Assert_retv(idx < MAX_HOTKEYS_DB); + + sd->status.hotkeys[idx].type = p->hotkey.isSkill; + sd->status.hotkeys[idx].id = p->hotkey.id; + sd->status.hotkeys[idx].lv = p->hotkey.count; +#endif #endif } @@ -23529,7 +23545,8 @@ void clif_defaults(void) clif->pWantToConnection = clif_parse_WantToConnection; clif->pLoadEndAck = clif_parse_LoadEndAck; clif->pTickSend = clif_parse_TickSend; - clif->pHotkey = clif_parse_Hotkey; + clif->pHotkey1 = clif_parse_Hotkey1; + clif->pHotkey2 = clif_parse_Hotkey2; clif->pProgressbar = clif_parse_progressbar; clif->pWalkToXY = clif_parse_WalkToXY; clif->pQuitGame = clif_parse_QuitGame; diff --git a/src/map/clif.h b/src/map/clif.h index 1e49e50a2..bef2726f3 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1289,7 +1289,8 @@ struct clif_interface { void (*pWantToConnection) (int fd, struct map_session_data *sd); void (*pLoadEndAck) (int fd,struct map_session_data *sd); void (*pTickSend) (int fd, struct map_session_data *sd); - void (*pHotkey) (int fd, struct map_session_data *sd); + void (*pHotkey1) (int fd, struct map_session_data *sd); + void (*pHotkey2) (int fd, struct map_session_data *sd); void (*pProgressbar) (int fd, struct map_session_data * sd); void (*pWalkToXY) (int fd, struct map_session_data *sd); void (*pQuitGame) (int fd, struct map_session_data *sd); diff --git a/src/map/packets.h b/src/map/packets.h index bffec4f43..b9f2d5910 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -589,7 +589,6 @@ packet(0x96e,clif->ackmergeitems); #if PACKETVER >= 20070227 packet(0x0288,clif->pcashshop_buy,2,4,6); packet(0x02b6,clif->pquestStateAck,2,6); - packet(0x02ba,clif->pHotkey,2,4,5,9); packet(0x02c4,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ packet(0x02c7,clif->pReplyPartyInvite2,2,6); packet(0x02c8,clif->pPartyTick,2); @@ -599,6 +598,10 @@ packet(0x96e,clif->ackmergeitems); packet(0x02db,clif->pBattleChat,2,4); #endif +#if PACKETVER_MAIN_NUM >= 20070618 || defined(PACKETVER_RE) || defined(PACKETVER_ZERO) || PACKETVER_AD_NUM >= 20070618 || PACKETVER_SAK_NUM >= 20070618 + packet(0x02ba,clif->pHotkey1); +#endif + //2008-01-02aSakexe #if PACKETVER >= 20080102 packet(0x01df,clif->pGMReqAccountName,2); @@ -1948,4 +1951,8 @@ packet(0x96e,clif->ackmergeitems); packet(0x0b1c,clif->pPing); #endif +#if PACKETVER_RE_NUM >= 20190508 + packet(0x0b21,clif->pHotkey2); +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 4e3d7de84..1982ae7a1 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -1462,6 +1462,25 @@ struct PACKET_ZC_SHORTCUT_KEY_LIST { } __attribute__((packed)); DEFINE_PACKET_HEADER(ZC_SHORTCUT_KEY_LIST, 0x02b9); #endif + +#if PACKETVER_MAIN_NUM >= 20070618 || defined(PACKETVER_RE) || defined(PACKETVER_ZERO) || PACKETVER_AD_NUM >= 20070618 || PACKETVER_SAK_NUM >= 20070618 +struct PACKET_CZ_SHORTCUT_KEY_CHANGE1 { + int16 packetType; + uint16 index; + struct hotkey_data hotkey; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_SHORTCUT_KEY_CHANGE1, 0x02ba); +#endif + +#if PACKETVER_RE_NUM >= 20190508 +struct PACKET_CZ_SHORTCUT_KEY_CHANGE2 { + int16 packetType; + uint16 tab; + uint16 index; + struct hotkey_data hotkey; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_SHORTCUT_KEY_CHANGE2, 0x0b21); +#endif #endif // HOTKEY_SAVING /** @@ -3414,6 +3433,7 @@ struct PACKET_ZC_REFINE_STATUS { DEFINE_PACKET_HEADER(ZC_REFINE_STATUS, 0x0ada); #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 |