From 60a03815c37f04485c048bb3e4f37960b6ba18cb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 13 Dec 2018 21:33:08 +0300 Subject: Add packet CZ_INVENTORY_EXPAND --- src/map/clif.c | 17 +++++++++++++++++ src/map/clif.h | 1 + src/map/packets.h | 4 ++++ src/map/packets_struct.h | 7 +++++++ 4 files changed, 29 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 863321422..10f6f0bdc 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3107,6 +3107,22 @@ static void clif_inventoryExpandResult(struct map_session_data *sd, enum expand_ #endif } +static void clif_parse_inventoryExpansion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_inventoryExpansion(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 + char evname[EVENT_NAME_LENGTH]; + struct event_data *ev = NULL; + + safestrncpy(evname, "inventory_expansion::OnInvExpandRequest", EVENT_NAME_LENGTH); + if ((ev = strdb_get(npc->ev_db, evname))) { + script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id); + } else { + ShowError("clif_parse_inventoryExpansion: event '%s' not found, operation failed.\n", evname); + } +#endif +} + /// Removes cart (ZC_CARTOFF). /// 012b /// Client behavior: @@ -22575,6 +22591,7 @@ void clif_defaults(void) clif->inventoryExpansionInfo = clif_inventoryExpansionInfo; clif->inventoryExpandAck = clif_inventoryExpandAck; clif->inventoryExpandResult = clif_inventoryExpandResult; + clif->pInventoryExpansion = clif_parse_inventoryExpansion; clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; clif->item_identify_list = clif_item_identify_list; diff --git a/src/map/clif.h b/src/map/clif.h index c4be2c7ee..7993429a1 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -870,6 +870,7 @@ struct clif_interface { void (*inventoryExpansionInfo) (struct map_session_data *sd); void (*inventoryExpandAck) (struct map_session_data *sd, enum expand_inventory result, int itemId); void (*inventoryExpandResult) (struct map_session_data *sd, enum expand_inventory_result result); + void (*pInventoryExpansion) (int fd, struct map_session_data *sd); void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); void (*item_identify_list) (struct map_session_data *sd); diff --git a/src/map/packets.h b/src/map/packets.h index 507c8362d..4e81b3bf3 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1910,4 +1910,8 @@ packet(0x96e,clif->ackmergeitems); packet(0x0b11,clif->pStopUseSkillToId); #endif +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 + packet(0x0b14,clif->pInventoryExpansion); +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index e7fbdb7bd..ad67091dc 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3006,6 +3006,13 @@ struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT { DEFINE_PACKET_HEADER(ZC_ACK_INVENTORY_EXPAND_RESULT, 0x0b17); #endif +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 +struct PACKET_CZ_INVENTORY_EXPAND { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND, 0x0b14); +#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