From fbbc7f4dec0c7301a0ee3547675a2fba6c62a34c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 12 Sep 2018 23:19:02 +0300 Subject: Update storage/guild storage packets for 2018-09-12 RE. --- src/map/clif.c | 38 +++++++++++++++++++++++++------------- src/map/clif.h | 16 +++++++++++++--- src/map/packets.h | 16 ++++++++-------- src/map/packets_struct.h | 16 ++++++++++++++-- 4 files changed, 60 insertions(+), 26 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index b36efd3f2..3b114cdca 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2867,45 +2867,51 @@ static void clif_storageList(struct map_session_data *sd, struct item *items, in { nullpo_retv(sd); - clif->storageStart(sd, "Storage"); + clif->inventoryStart(sd, INVTYPE_STORAGE, "Storage"); if (sd->storage.aggregate > 0) - clif->storageItems(sd, items, items_length); - clif->storageEnd(sd); + clif->storageItems(sd, INVTYPE_STORAGE, items, items_length); + clif->inventoryEnd(sd, INVTYPE_STORAGE); } static void clif_guildStorageList(struct map_session_data *sd, struct item *items, int items_length) { - clif->storageStart(sd, "Guild storage"); - clif->storageItems(sd, items, items_length); - clif->storageEnd(sd); + clif->inventoryStart(sd, INVTYPE_GUILD_STORAGE, "Guild storage"); + clif->storageItems(sd, INVTYPE_GUILD_STORAGE, items, items_length); + clif->inventoryEnd(sd, INVTYPE_GUILD_STORAGE); } -static void clif_storageStart(struct map_session_data *sd, const char *name) +static void clif_inventoryStart(struct map_session_data *sd, enum inventory_type type, const char *name) { #if PACKETVER_RE_NUM >= 20180829 nullpo_retv(sd); nullpo_retv(name); - struct ZC_STORE_START p; + struct ZC_INVENTORY_START p; p.packetType = 0xb08; +#if PACKETVER_RE_NUM >= 20180912 + p.invType = type; +#endif safestrncpy(p.name, name, NAME_LENGTH); clif->send(&p, sizeof(p), &sd->bl, SELF); #endif } -static void clif_storageEnd(struct map_session_data *sd) +static void clif_inventoryEnd(struct map_session_data *sd, enum inventory_type type) { #if PACKETVER_RE_NUM >= 20180829 nullpo_retv(sd); - struct ZC_STORE_END p; + struct ZC_INVENTORY_END p; p.packetType = 0xb0b; +#if PACKETVER_RE_NUM >= 20180912 + p.invType = type; +#endif p.flag = 0; clif->send(&p, sizeof(p), &sd->bl, SELF); #endif } -static void clif_storageItems(struct map_session_data *sd, struct item *items, int items_length) +static void clif_storageItems(struct map_session_data *sd, enum inventory_type type, struct item *items, int items_length) { nullpo_retv(sd); nullpo_retv(items); @@ -2933,6 +2939,9 @@ static void clif_storageItems(struct map_session_data *sd, struct item *items, i storelist_normal.PacketType = storageListNormalType; storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal); +#if PACKETVER_RE_NUM >= 20180912 + storelist_normal.invType = type; +#endif #if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829 safestrncpy(storelist_normal.name, "Storage", NAME_LENGTH); #endif @@ -2944,6 +2953,9 @@ static void clif_storageItems(struct map_session_data *sd, struct item *items, i storelist_equip.PacketType = storageListEquipType; storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip); +#if PACKETVER_RE_NUM >= 20180912 + storelist_equip.invType = type; +#endif #if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829 safestrncpy(storelist_equip.name, "Storage", NAME_LENGTH); #endif @@ -22401,8 +22413,8 @@ void clif_defaults(void) clif->storageList = clif_storageList; clif->guildStorageList = clif_guildStorageList; clif->storageItems = clif_storageItems; - clif->storageStart = clif_storageStart; - clif->storageEnd = clif_storageEnd; + clif->inventoryStart = clif_inventoryStart; + clif->inventoryEnd = clif_inventoryEnd; clif->updatestorageamount = clif_updatestorageamount; clif->storageitemadded = clif_storageitemadded; clif->storageitemremoved = clif_storageitemremoved; diff --git a/src/map/clif.h b/src/map/clif.h index 2de2ddc7d..335fb42c5 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -611,6 +611,16 @@ enum pet_evolution_result { PET_EVOL_SUCCESS = 0x6, }; +/** + * Inventory type for clients 2018-09-12 RE + + **/ +enum inventory_type { + INVTYPE_INVENTORY = 0, + INVTYPE_CART = 1, + INVTYPE_STORAGE = 2, + INVTYPE_GUILD_STORAGE = 3, +}; + /** * Structures **/ @@ -988,9 +998,9 @@ struct clif_interface { /* storage handling */ void (*storageList) (struct map_session_data* sd, struct item* items, int items_length); void (*guildStorageList) (struct map_session_data* sd, struct item* items, int items_length); - void (*storageItems) (struct map_session_data* sd, struct item* items, int items_length); - void (*storageStart) (struct map_session_data* sd, const char* name); - void (*storageEnd) (struct map_session_data* sd); + void (*storageItems) (struct map_session_data* sd, enum inventory_type type, struct item* items, int items_length); + void (*inventoryStart) (struct map_session_data* sd, enum inventory_type type, const char* name); + void (*inventoryEnd) (struct map_session_data* sd, enum inventory_type type); void (*updatestorageamount) (struct map_session_data* sd, int amount, int max_amount); void (*storageitemadded) (struct map_session_data* sd, struct item* i, int index, int amount); void (*storageitemremoved) (struct map_session_data* sd, int index, int amount); diff --git a/src/map/packets.h b/src/map/packets.h index 8283662ef..16ad4d00a 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -4276,10 +4276,10 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0b05,59); packet(0x0b06,53,clif->pDull/*,XXX*/); packet(0x0b07,-1); - packet(0x0b08,26); // ZC_STORE_START + packet(0x0b08,26); // ZC_INVENTORY_START packet(0x0b09,-1); // ZC_STORE_ITEMLIST_NORMAL_V6 packet(0x0b0a,-1); // ZC_STORE_ITEMLIST_EQUIP_V6 - packet(0x0b0b,3); // ZC_STORE_END + packet(0x0b0b,3); // ZC_INVENTORY_END packet(0x0b0c,155,clif->pDull/*,XXX*/); // changed packet sizes #endif @@ -4290,10 +4290,10 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0b05,63); packet(0x0b06,53,clif->pDull/*,XXX*/); packet(0x0b07,-1); - packet(0x0b08,26); // ZC_STORE_START + packet(0x0b08,26); // ZC_INVENTORY_START packet(0x0b09,-1); // ZC_STORE_ITEMLIST_NORMAL_V6 packet(0x0b0a,-1); // ZC_STORE_ITEMLIST_EQUIP_V6 - packet(0x0b0b,3); // ZC_STORE_END + packet(0x0b0b,3); // ZC_INVENTORY_END packet(0x0b0c,155,clif->pDull/*,XXX*/); // changed packet sizes #endif @@ -4303,8 +4303,8 @@ packet(0x96e,-1,clif->ackmergeitems); // new packets packet(0x0b0d,6,clif->pDull/*,XXX*/); // changed packet sizes - packet(0x0b08,27); // ZC_STORE_START - packet(0x0b0b,4); // ZC_STORE_END + packet(0x0b08,27); // ZC_INVENTORY_START + packet(0x0b0b,4); // ZC_INVENTORY_END #endif #ifndef PACKETVER_ZERO @@ -4315,8 +4315,8 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x0b0e,-1,clif->pDull/*,XXX*/); packet(0x0b0f,-1,clif->pDull/*,XXX*/); // changed packet sizes - packet(0x0b08,27,clif->pDull/*,XXX*/); // ZC_STORE_START - packet(0x0b0b,4,clif->pDull/*,XXX*/); // ZC_STORE_END + packet(0x0b08,27,clif->pDull/*,XXX*/); // ZC_INVENTORY_START + packet(0x0b0b,4,clif->pDull/*,XXX*/); // ZC_INVENTORY_END #endif #endif diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 7a15f4274..f21d493c8 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -1178,25 +1178,37 @@ struct packet_itemlist_equip { struct ZC_STORE_ITEMLIST_NORMAL { int16 PacketType; int16 PacketLength; +#if PACKETVER_RE_NUM >= 20180912 + uint8 invType; +#endif #if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829 char name[NAME_LENGTH]; #endif struct NORMALITEM_INFO list[MAX_ITEMLIST]; } __attribute__((packed)); -struct ZC_STORE_START { +struct ZC_INVENTORY_START { int16 packetType; +#if PACKETVER_RE_NUM >= 20180912 + uint8 invType; +#endif char name[NAME_LENGTH]; } __attribute__((packed)); -struct ZC_STORE_END { +struct ZC_INVENTORY_END { int16 packetType; +#if PACKETVER_RE_NUM >= 20180912 + uint8 invType; +#endif char flag; } __attribute__((packed)); struct ZC_STORE_ITEMLIST_EQUIP { int16 PacketType; int16 PacketLength; +#if PACKETVER_RE_NUM >= 20180912 + uint8 invType; +#endif #if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829 char name[NAME_LENGTH]; #endif -- cgit v1.2.3-70-g09d2