Initial support for newer packet versions (#4944)

Basic support for packets up to April 2020
Changing the default packet version to 2020-04-01

Thanks to everyone involved!
This commit is contained in:
Lemongrass3110
2020-06-03 16:35:10 +02:00
committed by GitHub
parent 929c30c414
commit 45cd5808b7
34 changed files with 6983 additions and 2728 deletions

View File

@@ -1682,7 +1682,7 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int
* @param item_list: List of items to purchase
* @return clif_cashshop_ack value to display
*/
int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, unsigned short* item_list)
int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub* item_list)
{
int i, j, amount, new_, w, vt;
unsigned short nameid;
@@ -1702,8 +1702,8 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
// Validating Process ----------------------------------------------------
for( i = 0; i < count; i++ )
{
nameid = item_list[i*2+1];
amount = item_list[i*2+0];
nameid = item_list[i].itemId;
amount = item_list[i].amount;
id = itemdb_exists(nameid);
if( !id || amount <= 0 )
@@ -1713,12 +1713,12 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
if( j == nd->u.shop.count || nd->u.shop.shop_item[j].value <= 0 )
return ERROR_TYPE_ITEM_ID;
nameid = item_list[i*2+1] = nd->u.shop.shop_item[j].nameid; //item_avail replacement
nameid = item_list[i].itemId = nd->u.shop.shop_item[j].nameid; //item_avail replacement
if( !itemdb_isstackable2(id) && amount > 1 )
{
ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %hu!\n", sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
amount = item_list[i*2+0] = 1;
amount = item_list[i].amount = 1;
}
switch( pc_checkadditem(sd,nameid,amount) )
@@ -1745,8 +1745,8 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
// Delivery Process ----------------------------------------------------
for( i = 0; i < count; i++ ) {
nameid = item_list[i*2+1];
amount = item_list[i*2+0];
nameid = item_list[i].itemId;
amount = item_list[i].amount;
if( !pet_create_egg(sd,nameid) ) {
struct item item_tmp;
@@ -3040,7 +3040,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
nd->u.shop.shop_item[nd->u.shop.count].value = value;
#if PACKETVER >= 20131223
nd->u.shop.shop_item[nd->u.shop.count].flag = 0;
if (type == NPCTYPE_MARKETSHOP)
if (type == NPCTYPE_MARKETSHOP )
nd->u.shop.shop_item[nd->u.shop.count].qty = qty;
#endif
nd->u.shop.count++;