summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 332f396f9..e36418706 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5599,9 +5599,9 @@ void clif_closevendingboard(struct block_list* bl, int fd)
}
/*==========================================
- * Sends a list of items in a shop
+ * Sends a list of items in a shop (ZC_PC_PURCHASE_ITEMLIST_FROMMC/ZC_PC_PURCHASE_ITEMLIST_FROMMC2)
* R 0133 <len>.w <ID>.l {<value>.l <amount>.w <index>.w <type>.B <item ID>.w <identify flag>.B <attribute?>.B <refine>.B <card>.4w}.22B
- * R 0800 <len>.w <ID>.l <ID?>.l {<value>.l <amount>.w <index>.w <type>.B <item ID>.w <identify flag>.B <attribute?>.B <refine>.B <card>.4w}.22B
+ * R 0800 <len>.w <ID>.l <UniqueID>.l {<value>.l <amount>.w <index>.w <type>.B <item ID>.w <identify flag>.B <attribute?>.B <refine>.B <card>.4w}.22B
*------------------------------------------*/
void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* vending)
{
@@ -5628,7 +5628,7 @@ void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* ven
WFIFOW(fd,2) = offset+count*22;
WFIFOL(fd,4) = id;
#if PACKETVER >= 20100105
- WFIFOL(fd,8) = vsd->status.char_id;
+ WFIFOL(fd,8) = vsd->vender_id;
#endif
for( i = 0; i < count; i++ )
@@ -5649,12 +5649,14 @@ void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* ven
}
/*==========================================
- * Shop purchase failure
+ * Shop purchase failure (ZC_PC_PURCHASE_RESULT_FROMMC)
* R 0135 <index>.w <amount>.w <fail>.B
* fail=1 - not enough zeny
* fail=2 - overweight
* fail=4 - out of stock
* fail=5 - "cannot use an npc shop while in a trade"
+ * fail=6 - Because the store information was incorrect the item was not purchased.
+ * fail=7 - No sales information.
*------------------------------------------*/
void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail)
{
@@ -10884,7 +10886,7 @@ void clif_parse_VendingListReq(int fd, struct map_session_data* sd)
}
/*==========================================
- * Shop item(s) purchase request
+ * Shop item(s) purchase request (CZ_PC_PURCHASE_ITEMLIST_FROMMC)
* S 0134 <len>.w <ID>.l {<amount>.w <index>.w}.4B*
*------------------------------------------*/
void clif_parse_PurchaseReq(int fd, struct map_session_data* sd)
@@ -10893,21 +10895,27 @@ void clif_parse_PurchaseReq(int fd, struct map_session_data* sd)
int id = (int)RFIFOL(fd,4);
const uint8* data = (uint8*)RFIFOP(fd,8);
- vending_purchasereq(sd, id, -1, data, len/4);
+ vending_purchasereq(sd, id, sd->vended_id, data, len/4);
+
+ // whether it fails or not, the buy window is closed
+ sd->vended_id = 0;
}
/*==========================================
- * Shop item(s) purchase request
- * S 0134/0801 <len>.w <AID>.l <CID>.l {<amount>.w <index>.w}.4B*
+ * Shop item(s) purchase request (CZ_PC_PURCHASE_ITEMLIST_FROMMC2)
+ * S 0801 <len>.w <AID>.l <UniqueID>.l {<amount>.w <index>.w}.4B*
*------------------------------------------*/
void clif_parse_PurchaseReq2(int fd, struct map_session_data* sd)
{
int len = (int)RFIFOW(fd,2) - 12;
int aid = (int)RFIFOL(fd,4);
- int cid = (int)RFIFOL(fd,8);
+ int uid = (int)RFIFOL(fd,8);
const uint8* data = (uint8*)RFIFOP(fd,12);
- vending_purchasereq(sd, aid, cid, data, len/4);
+ vending_purchasereq(sd, aid, uid, data, len/4);
+
+ // whether it fails or not, the buy window is closed
+ sd->vended_id = 0;
}
/*==========================================