Vending&Buying Store report Packet Implemented

* New Feature for 2014-10-23 client or newer
  When user close shop, the client showing report for buy/sell
This commit is contained in:
Napster 2015-12-21 20:05:29 +07:00
parent d8830d21f6
commit 01adc9c3ff
5 changed files with 61 additions and 27 deletions

View File

@ -1715,9 +1715,10 @@ packet_keys: 0x382A6DEF,0x5CBE7202,0x61F46637 // [Shakto]
0x0439,8,useitem,2:4
0x0365,41,bookingregreq,2:4:6
// New Packet
0x090F,-1 // ZC_NOTIFY_NEWENTRY7
0x0914,-1 // ZC_NOTIFY_MOVEENTRY7
0x0915,-1 // ZC_NOTIFY_STANDENTRY7
0x0914,-1 // ZC_NOTIFY_MOVEENTRY8
0x0915,-1 // ZC_NOTIFY_STANDENTRY9
//2012-04-10aRagexeRE
packet_ver: 30
@ -2375,6 +2376,8 @@ packet_keys: 0x2DFF467C,0x444B37EE,0x2C1B634F // [YomRawr]
0x0A01,3,hotkeyrowshift,2 // CZ_SHORTCUTKEYBAR_ROTATE
0x0A02,4 // ZC_DRESSROOM_OPEN
0x09F7,75 // ZC_PROPERTY_HOMUN_2
0x09E5,18 // ZC_DELETEITEM_FROM_MCSTORE2
0x09E6,22 // ZC_UPDATE_ITEM_FROM_BUYING_STORE2
// Roulette System [Yommy]
0x0A19,2,rouletteopen,0 // CZ_REQ_OPEN_ROULETTE
@ -2425,8 +2428,6 @@ packet_keys: 0x290551EA,0x2B952C75,0x2D67669B // [YomRawr]
// New Packet
0x0A18,14 // ZC_ACCEPT_ENTER3
0x0A23,-1 // ZC_ALL_ACH_LIST
0x0A24,66 // ZC_ACH_UPDATE
0x0A28,3 // ZC_ACK_OPENSTORE2
0x09FD,-1 // ZC_NOTIFY_MOVEENTRY11
0x09FE,-1 // ZC_NOTIFY_NEWENTRY11
@ -2491,7 +2492,6 @@ packet_keys: 0x62C86D09,0x75944F17,0x112C133D // [YomRawr]
0x0A08,26,dull,0 // CZ_REQ_OPEN_WRITE_MAIL
0x0A12,27 // ZC_ACK_OPEN_WRITE_MAIL
0x0A32,2 // ZC_OPEN_RODEX_THROUGH_NPC_ONLY
0x0A13,26,dull,0 // CZ_CHECK_RECEIVE_CHARACTER_NAME
0x0A14,10 // ZC_CHECK_RECEIVE_CHARACTER_NAME
@ -2508,6 +2508,12 @@ packet_keys: 0x62C86D09,0x75944F17,0x112C133D // [YomRawr]
// OneClick Itemidentify
0x0A35,4,oneclick_itemidentify,2 // CZ_REQ_ONECLICK_ITEMIDENTIFY
// Achievement System
0x0A23,-1 // ZC_ALL_ACH_LIST
0x0A24,66 // ZC_ACH_UPDATE
0x0A25,6,dull,0 // CZ_REQ_ACH_REWARD
0x0A26,7 // ZC_REQ_ACH_REWARD_ACK
// Title System
0x0A2E,6,dull,0 // CZ_REQ_CHANGE_TITLE
0x0A2F,7 // ZC_ACK_CHANGE_TITLE

View File

@ -468,7 +468,7 @@ void buyingstore_trade(struct map_session_data* sd, uint32 account_id, unsigned
// notify clients
clif_buyingstore_delete_item(sd, index, amount, pl_sd->buyingstore.items[listidx].price);
clif_buyingstore_update_item(pl_sd, nameid, amount);
clif_buyingstore_update_item(pl_sd, nameid, amount, sd->status.char_id, zeny);
}
if( save_settings&CHARSAVE_BANK ) {

View File

@ -7065,20 +7065,29 @@ void clif_openvending(struct map_session_data* sd, int id, struct s_vending* ven
}
/// 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)
{
int fd;
/// 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) {
#if PACKETVER < 20141016 // TODO : not sure for client date [Napster]
const int cmd = 0x137;
#else
const int cmd = 0x9e5;
#endif
int fd = sd->fd;
nullpo_retv(sd);
fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x137));
WFIFOW(fd,0) = 0x137;
WFIFOHEAD(fd,packet_len(cmd));
WFIFOW(fd,0) = cmd;
WFIFOW(fd,2) = index+2;
WFIFOW(fd,4) = amount;
WFIFOSET(fd,packet_len(0x137));
#if PACKETVER >= 20141016
WFIFOL(fd,6) = char_id; // GID
WFIFOL(fd,10) = (int)time(NULL); // Date
WFIFOL(fd,14) = zeny; // zeny
#endif
WFIFOSET(fd,packet_len(cmd));
}
@ -16946,18 +16955,33 @@ void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short resu
}
/// Updates the zeny limit and an item in the buying store item list (ZC_UPDATE_ITEM_FROM_BUYING_STORE).
/// 081b <name id>.W <amount>.W <limit zeny>.L
void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount)
{
/// Updates the zeny limit and an item in the buying store item list.
/// 081b <name id>.W <amount>.W <limit zeny>.L (ZC_UPDATE_ITEM_FROM_BUYING_STORE)
/// 09e6 <name id>.W <amount>.W <zeny>.L <limit zeny>.L <GID>.L <Date>.L (ZC_UPDATE_ITEM_FROM_BUYING_STORE2)
void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny) {
#if PACKETVER < 20141016 // TODO : not sure for client date [Napster]
const int cmd = 0x81b;
#else
const int cmd = 0x9e6;
#endif
int offset = 0;
int fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x81b));
WFIFOW(fd,0) = 0x81b;
WFIFOHEAD(fd,packet_len(cmd));
WFIFOW(fd,0) = cmd;
WFIFOW(fd,2) = nameid;
WFIFOW(fd,4) = amount; // amount of nameid received
WFIFOL(fd,6) = sd->buyingstore.zenylimit;
WFIFOSET(fd,packet_len(0x81b));
#if PACKETVER >= 20141016
WFIFOL(fd,6) = zeny; // zeny
offset += 4;
#endif
WFIFOL(fd,6+offset) = sd->buyingstore.zenylimit;
#if PACKETVER >= 20141016
WFIFOL(fd,10+offset) = char_id; // GID
WFIFOL(fd,14+offset) = (int)time(NULL); // date
#endif
WFIFOSET(fd,packet_len(cmd));
}
@ -18936,7 +18960,7 @@ void packetdb_readdb(bool reload)
//#0x09C0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0,102, 0,
0, 0, 0, 0, 2, 0, -1, -1, 2, 0, 0, -1, -1, -1, 0, 7,
0, 0, 0, 0, 0, 0, 0, 3, 11, 0, 11, -1, 0, 3, 11, 0,
0, 0, 0, 0, 0, 18, 22, 3, 11, 0, 11, -1, 0, 3, 11, 0,
0, 11, 12, 11, 0, 0, 0, 75, -1,143, 0, 0, 0, -1, -1, -1,
//#0x0A00
#if PACKETVER >= 20141022

View File

@ -668,7 +668,7 @@ void clif_closevendingboard(struct block_list* bl, int fd);
void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* vending);
void clif_buyvending(struct map_session_data* sd, int index, int amount, int fail);
void clif_openvending(struct map_session_data* sd, int id, struct s_vending* vending);
void clif_vendingreport(struct map_session_data* sd, int index, int amount);
void clif_vendingreport(struct map_session_data* sd, int index, int amount, uint32 char_id, int zeny);
void clif_movetoattack(struct map_session_data *sd,struct block_list *bl);
@ -891,7 +891,7 @@ void clif_buyingstore_disappear_entry(struct map_session_data* sd);
void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd);
void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd);
void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result);
void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount);
void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny);
void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price);
void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid);

View File

@ -199,10 +199,12 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
short amount = *(uint16*)(data + 4*i + 0);
short idx = *(uint16*)(data + 4*i + 2);
idx -= 2;
z = 0.; // zeny counter
// vending item
pc_additem(sd, &vsd->status.cart[idx], amount, LOG_TYPE_VENDING);
vsd->vending[vend_list[i]].amount -= amount;
z += ((double)vsd->vending[i].value * (double)amount);
if( vsd->vending[vend_list[i]].amount ) {
if( Sql_Query( mmysql_handle, "UPDATE `%s` SET `amount` = %d WHERE `vending_id` = %d and `cartinventory_id` = %d", vending_items_db, vsd->vending[vend_list[i]].amount, vsd->vender_id, vsd->status.cart[idx].id ) != SQL_SUCCESS ) {
@ -215,7 +217,9 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui
}
pc_cart_delitem(vsd, idx, amount, 0, LOG_TYPE_VENDING);
clif_vendingreport(vsd, idx, amount);
if( battle_config.vending_tax )
z -= z * (battle_config.vending_tax/10000.);
clif_vendingreport(vsd, idx, amount, sd->status.char_id, (int)z);
//print buyer's name
if( battle_config.buyer_name ) {