summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-07-05 05:31:10 +0300
committerAndrei Karas <akaras@inbox.ru>2018-07-12 02:29:12 +0300
commit2f2ceeb24b8d469b98b410772563731d5921e470 (patch)
tree0a3b1cc8c046b524feaad47a14b9241afe3ec69e /src
parent3eeda93ef807f1753ff97f089d0c158a8ca85ebb (diff)
downloadhercules-2f2ceeb24b8d469b98b410772563731d5921e470.tar.gz
hercules-2f2ceeb24b8d469b98b410772563731d5921e470.tar.bz2
hercules-2f2ceeb24b8d469b98b410772563731d5921e470.tar.xz
hercules-2f2ceeb24b8d469b98b410772563731d5921e470.zip
Add packet struct ZC_ADD_ITEM_TO_STORE and update packet for latest RE client.
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c33
-rw-r--r--src/map/packets_struct.h19
2 files changed, 36 insertions, 16 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index e6aadc80f..6723cbe9f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -4311,31 +4311,32 @@ static void clif_updatestorageamount(struct map_session_data *sd, int amount, in
/// 01c4 <index>.W <amount>.L <nameid>.W <type>.B <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W (ZC_ADD_ITEM_TO_STORE2)
static void clif_storageitemadded(struct map_session_data *sd, struct item *i, int index, int amount)
{
- int view,fd;
- int offset = 0;
+ int view, fd;
+ struct PACKET_ZC_ADD_ITEM_TO_STORE p;
nullpo_retv(sd);
nullpo_retv(i);
- fd=sd->fd;
+
+ fd = sd->fd;
view = itemdb_viewid(i->nameid);
- WFIFOHEAD(fd,packet_len(storageaddType));
- WFIFOW(fd, 0) = storageaddType; // Storage item added
- WFIFOW(fd, 2) = index+1; // index
- WFIFOL(fd, 4) = amount; // amount
- WFIFOW(fd, 8) = ( view > 0 ) ? view : i->nameid; // id
+ WFIFOHEAD(fd, sizeof(p));
+ p.packetType = storageaddType; // Storage item added
+ p.index = index + 1; // index
+ p.amount = amount; // amount
+ p.itemId = (view > 0) ? view : i->nameid; // id
#if PACKETVER >= 5
- WFIFOB(fd,10) = itemtype(itemdb_type(i->nameid)); //type
- offset += 1;
+ p.itemType = itemtype(itemdb_type(i->nameid)); //type
#endif
- WFIFOB(fd,10+offset) = i->identify; //identify flag
- WFIFOB(fd,11+offset) = i->attribute; // attribute
- WFIFOB(fd,12+offset) = i->refine; //refine
- clif->addcards((struct EQUIPSLOTINFO*)WFIFOP(fd, 13 + offset), i);
+ p.identified = i->identify; //identify flag
+ p.damaged = i->attribute; // attribute
+ p.refine = i->refine; //refine
+ clif->addcards(&p.slot, i);
#if PACKETVER >= 20150226
- clif->add_item_options(WFIFOP(fd, 21 + offset), i);
+ clif->add_item_options(&p.option_data[0], i);
#endif
- WFIFOSET(fd,packet_len(storageaddType));
+ memcpy(WFIFOP(fd, 0), &p, sizeof(p));
+ WFIFOSET(fd, sizeof(p));
}
/// Notifies the client of an item being deleted from the storage (ZC_DELETE_ITEM_FROM_STORE).
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 75687c8ca..5d4790552 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -1841,6 +1841,25 @@ struct PACKET_ZC_ITEM_ENTRY {
uint8 subY;
} __attribute__((packed));
+struct PACKET_ZC_ADD_ITEM_TO_STORE {
+ int16 packetType;
+ int16 index;
+ int32 amount;
+#if PACKETVER_RE_NUM >= 20180704
+ uint32 itemId;
+#else
+ uint16 itemId;
+#endif
+#if PACKETVER >= 5
+ uint8 itemType;
+#endif
+ uint8 identified;
+ uint8 damaged;
+ uint8 refine;
+ struct EQUIPSLOTINFO slot;
+ struct ItemOptions option_data[MAX_ITEM_OPTIONS];
+} __attribute__((packed));
+
#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