summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-08 19:43:56 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-12 01:03:20 +0300
commitdfe7b9e4bb9c0f890009be0f037d4ba1a516605f (patch)
treed4af5d5db98cf4b66a817f1cd8d88d6784a3d91a /src
parent092ffb2b754365ea5487a82c7a2c60667a471cef (diff)
downloadhercules-dfe7b9e4bb9c0f890009be0f037d4ba1a516605f.tar.gz
hercules-dfe7b9e4bb9c0f890009be0f037d4ba1a516605f.tar.bz2
hercules-dfe7b9e4bb9c0f890009be0f037d4ba1a516605f.tar.xz
hercules-dfe7b9e4bb9c0f890009be0f037d4ba1a516605f.zip
Add packet id clif_vendingreport (0x9e5 / ZC_DELETEITEM_FROM_MCSTORE2)
Based on rAthena commit: commit 01adc9c3ff3c1c6f0f69f6f9f2db77eba20071d4 Author: Napster <arokaice@live.com> Date: Mon Dec 21 20:05:29 2015 +0700
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c28
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/packets.h1
-rw-r--r--src/map/vending.c2
4 files changed, 23 insertions, 10 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index c6689f9c0..eb6f848e9 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -6428,20 +6428,32 @@ void clif_openvending(struct map_session_data* sd, int id, struct s_vending* ven
#endif
}
-/// Inform merchant that someone has bought an item (ZC_DELETEITEM_FROM_MCSTORE).
-/// 0137 <index>.W <amount>.W
-void clif_vendingreport(struct map_session_data* sd, int index, int amount)
+/// Inform merchant that someone has bought an item.
+/// 0137 <index>.W <amount>.W (ZC_DELETEITEM_FROM_MCSTORE).
+/// 09e5 <index>.W <amount>.W <GID>.L <Date>.L <zeny>.L (ZC_DELETEITEM_FROM_MCSTORE2).
+void clif_vendingreport(struct map_session_data* sd, int index, int amount, uint32 char_id, int zeny)
{
int fd;
+#if PACKETVER < 20141016 // TODO : not sure for client date [Napster]
+ const int cmd = 0x137;
+#else
+ const int cmd = 0x9e5;
+#endif
+ const int len = packet_len(cmd);
nullpo_retv(sd);
fd = sd->fd;
- WFIFOHEAD(fd,packet_len(0x137));
- WFIFOW(fd,0) = 0x137;
- WFIFOW(fd,2) = index+2;
- WFIFOW(fd,4) = amount;
- WFIFOSET(fd,packet_len(0x137));
+ WFIFOHEAD(fd, len);
+ WFIFOW(fd, 0) = cmd;
+ WFIFOW(fd, 2) = index + 2;
+ WFIFOW(fd, 4) = amount;
+#if PACKETVER >= 20141016
+ WFIFOL(fd,6) = char_id; // GID
+ WFIFOL(fd,10) = (int)time(NULL); // Date
+ WFIFOL(fd,14) = zeny; // zeny
+#endif
+ WFIFOSET(fd, len);
}
/// Result of organizing a party (ZC_ACK_MAKE_GROUP).
diff --git a/src/map/clif.h b/src/map/clif.h
index 8b75a32f3..60c03d6e0 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -896,7 +896,7 @@ struct clif_interface {
void (*vendinglist) (struct map_session_data* sd, unsigned int id, struct s_vending* vending_list);
void (*buyvending) (struct map_session_data* sd, int index, int amount, int fail);
void (*openvending) (struct map_session_data* sd, int id, struct s_vending* vending_list);
- void (*vendingreport) (struct map_session_data* sd, int index, int amount);
+ 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 (*updatestorageamount) (struct map_session_data* sd, int amount, int max_amount);
diff --git a/src/map/packets.h b/src/map/packets.h
index 077320798..236728bf8 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -2820,6 +2820,7 @@ packet(0x96e,-1,clif->ackmergeitems);
packet(0x0936,36,clif->pStoragePassword,0);
packet(0x09DF,7);
packet(0x0a00,269);
+ packet(0x09e5,18); // ZC_DELETEITEM_FROM_MCSTORE2
#endif
/* Roulette System [Yommy/Hercules] */
diff --git a/src/map/vending.c b/src/map/vending.c
index 6f4515120..f92437cb8 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -191,7 +191,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
// vending item
pc->additem(sd, &vsd->status.cart[idx], amount, LOG_TYPE_VENDING);
vsd->vending[vend_list[i]].amount -= amount;
- clif->vendingreport(vsd, idx, amount);
+ clif->vendingreport(vsd, idx, amount, sd->status.char_id, (int)z);
pc->cart_delitem(vsd, idx, amount, 0, LOG_TYPE_VENDING);
//print buyer's name