summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure2
-rw-r--r--src/map/clif.c71
-rw-r--r--src/map/clif.h6
-rw-r--r--src/map/packets_struct.h44
-rw-r--r--src/map/storage.c4
5 files changed, 96 insertions, 31 deletions
diff --git a/configure b/configure
index 180fe971d..4f85787af 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac 234189f34.
+# From configure.ac 8f7af789e.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
diff --git a/src/map/clif.c b/src/map/clif.c
index 4e48d7886..77d072d20 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -86,8 +86,8 @@ static struct s_packet_db packet_db[MAX_PACKET_DB + 1];
/* re-usable */
static struct packet_itemlist_normal itemlist_normal;
static struct packet_itemlist_equip itemlist_equip;
-static struct packet_storelist_normal storelist_normal;
-static struct packet_storelist_equip storelist_equip;
+static struct ZC_STORE_ITEMLIST_NORMAL storelist_normal;
+static struct ZC_STORE_ITEMLIST_EQUIP storelist_equip;
static struct packet_viewequip_ack viewequip_list;
#if PACKETVER >= 20131223
static struct packet_npc_market_result_ack npcmarket_result;
@@ -2863,13 +2863,56 @@ static void clif_equiplist(struct map_session_data *sd)
#endif
}
-static void clif_storagelist(struct map_session_data *sd, struct item *items, int items_length)
+static void clif_storageList(struct map_session_data *sd, struct item *items, int items_length)
{
- int i = 0;
- struct item_data *id;
+ nullpo_retv(sd);
+
+ clif->storageStart(sd, "Storage");
+ if (sd->storage.aggregate > 0)
+ clif->storageItems(sd, items, items_length);
+ clif->storageEnd(sd);
+}
+
+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);
+}
+
+static void clif_storageStart(struct map_session_data *sd, const char *name)
+{
+#if PACKETVER_RE_NUM >= 20180829
+ nullpo_retv(sd);
+ nullpo_retv(name);
+
+ struct ZC_STORE_START p;
+ p.packetType = 0xb08;
+ safestrncpy(p.name, name, NAME_LENGTH);
+ clif->send(&p, sizeof(p), &sd->bl, SELF);
+#endif
+}
+static void clif_storageEnd(struct map_session_data *sd)
+{
+#if PACKETVER_RE_NUM >= 20180829
+ nullpo_retv(sd);
+
+ struct ZC_STORE_END p;
+ p.packetType = 0xb0b;
+ 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)
+{
nullpo_retv(sd);
nullpo_retv(items);
+
+ int i = 0;
+ struct item_data *id;
+
do {
int normal = 0, equip = 0, k = 0;
@@ -2887,10 +2930,10 @@ static void clif_storagelist(struct map_session_data *sd, struct item *items, in
}
if( normal ) {
- storelist_normal.PacketType = storagelistnormalType;
+ storelist_normal.PacketType = storageListNormalType;
storelist_normal.PacketLength = ( sizeof( storelist_normal ) - sizeof( storelist_normal.list ) ) + (sizeof(struct NORMALITEM_INFO) * normal);
-#if PACKETVER >= 20120925
+#if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829
safestrncpy(storelist_normal.name, "Storage", NAME_LENGTH);
#endif
@@ -2898,10 +2941,10 @@ static void clif_storagelist(struct map_session_data *sd, struct item *items, in
}
if( equip ) {
- storelist_equip.PacketType = storagelistequipType;
+ storelist_equip.PacketType = storageListEquipType;
storelist_equip.PacketLength = ( sizeof( storelist_equip ) - sizeof( storelist_equip.list ) ) + (sizeof(struct EQUIPITEM_INFO) * equip);
-#if PACKETVER >= 20120925
+#if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829
safestrncpy(storelist_equip.name, "Storage", NAME_LENGTH);
#endif
@@ -8825,8 +8868,8 @@ static void clif_refresh_storagewindow(struct map_session_data *sd)
if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) {
if (sd->storage.aggregate > 0) {
storage->sortitem(VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item));
- clif->storagelist(sd, VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item));
}
+ clif->storageList(sd, VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item));
clif->updatestorageamount(sd, sd->storage.aggregate, MAX_STORAGE);
}
// Notify the client that the gstorage is open otherwise it will
@@ -8838,7 +8881,7 @@ static void clif_refresh_storagewindow(struct map_session_data *sd)
intif->request_guild_storage(sd->status.account_id,sd->status.guild_id);
} else {
storage->sortitem(gstor->items, ARRAYLENGTH(gstor->items));
- clif->storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items));
+ clif->guildStorageList(sd, gstor->items, ARRAYLENGTH(gstor->items));
clif->updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE);
}
}
@@ -22355,7 +22398,11 @@ void clif_defaults(void)
clif->openvendingAck = clif_openvendingAck;
clif->vendingreport = clif_vendingreport;
/* storage handling */
- clif->storagelist = clif_storagelist;
+ clif->storageList = clif_storageList;
+ clif->guildStorageList = clif_guildStorageList;
+ clif->storageItems = clif_storageItems;
+ clif->storageStart = clif_storageStart;
+ clif->storageEnd = clif_storageEnd;
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 e3b2a90d3..2de2ddc7d 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -986,7 +986,11 @@ struct clif_interface {
void (*openvendingAck) (int fd, int result);
void (*vendingreport) (struct map_session_data* sd, int index, int amount, uint32 char_id, int zeny);
/* storage handling */
- void (*storagelist) (struct map_session_data* sd, struct item* items, int items_length);
+ 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 (*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_struct.h b/src/map/packets_struct.h
index 852a44cb8..7a15f4274 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -218,25 +218,29 @@ enum packet_headers {
#else
inventorylistequipType = 0xa4,
#endif
-#if PACKETVER >= 20120925
- storagelistnormalType = 0x995,
+#if PACKETVER_RE_NUM >= 20180829
+ storageListNormalType = 0xb09,
+#elif PACKETVER >= 20120925
+ storageListNormalType = 0x995,
#elif PACKETVER >= 20080102
- storagelistnormalType = 0x2ea,
+ storageListNormalType = 0x2ea,
#elif PACKETVER >= 20071002
- storagelistnormalType = 0x295,
+ storageListNormalType = 0x295,
#else
- storagelistnormalType = 0xa5,
+ storageListNormalType = 0xa5,
#endif
-#if PACKETVER >= 20150226
- storagelistequipType = 0xa10,
+#if PACKETVER_RE_NUM >= 20180829
+ storageListEquipType = 0xb0a,
+#elif PACKETVER >= 20150226
+ storageListEquipType = 0xa10,
#elif PACKETVER >= 20120925
- storagelistequipType = 0x996,
+ storageListEquipType = 0x996,
#elif PACKETVER >= 20080102
- storagelistequipType = 0x2d1,
+ storageListEquipType = 0x2d1,
#elif PACKETVER >= 20071002
- storagelistequipType = 0x296,
+ storageListEquipType = 0x296,
#else
- storagelistequipType = 0xa6,
+ storageListEquipType = 0xa6,
#endif
#if PACKETVER >= 20120925
cartlistnormalType = 0x993,
@@ -1171,19 +1175,29 @@ struct packet_itemlist_equip {
struct EQUIPITEM_INFO list[MAX_ITEMLIST];
} __attribute__((packed));
-struct packet_storelist_normal {
+struct ZC_STORE_ITEMLIST_NORMAL {
int16 PacketType;
int16 PacketLength;
-#if PACKETVER >= 20120925
+#if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829
char name[NAME_LENGTH];
#endif
struct NORMALITEM_INFO list[MAX_ITEMLIST];
} __attribute__((packed));
-struct packet_storelist_equip {
+struct ZC_STORE_START {
+ int16 packetType;
+ char name[NAME_LENGTH];
+} __attribute__((packed));
+
+struct ZC_STORE_END {
+ int16 packetType;
+ char flag;
+} __attribute__((packed));
+
+struct ZC_STORE_ITEMLIST_EQUIP {
int16 PacketType;
int16 PacketLength;
-#if PACKETVER >= 20120925
+#if PACKETVER >= 20120925 && PACKETVER_RE_NUM < 20180829
char name[NAME_LENGTH];
#endif
struct EQUIPITEM_INFO list[MAX_ITEMLIST];
diff --git a/src/map/storage.c b/src/map/storage.c
index ba8dcee3a..a6f0715e7 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -122,8 +122,8 @@ static int storage_storageopen(struct map_session_data *sd)
if (sd->storage.aggregate > 0) {
storage->sortitem(VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item));
- clif->storagelist(sd, VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item));
}
+ clif->storageList(sd, VECTOR_DATA(sd->storage.item), VECTOR_LENGTH(sd->storage.item));
clif->updatestorageamount(sd, sd->storage.aggregate, MAX_STORAGE);
return 0;
@@ -512,7 +512,7 @@ static int storage_guild_storageopen(struct map_session_data *sd)
gstor->storage_status = 1;
sd->state.storage_flag = STORAGE_FLAG_GUILD;
storage->sortitem(gstor->items, ARRAYLENGTH(gstor->items));
- clif->storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items));
+ clif->guildStorageList(sd, gstor->items, ARRAYLENGTH(gstor->items));
clif->updatestorageamount(sd, gstor->storage_amount, MAX_GUILD_STORAGE);
return 0;
}