From fabfaf566459da17e1543be920769677d92c79b8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 07:33:05 +0300 Subject: Add incomplete packet CA_ACK_MOBILE_OTP. --- src/map/packets_struct.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/map') diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index cd3a3b989..51db7cc78 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -30,10 +30,6 @@ // Packet DB #define MAX_PACKET_POS 20 -#define DEFINE_PACKET_HEADER(name, id) \ - STATIC_ASSERT(sizeof(struct PACKET_##name) == PACKET_LEN_##id, "Wrong size PACKET_"#name); \ - enum { HEADER_##name = id }; - /** * **/ -- cgit v1.2.3-70-g09d2 From 6bf44bf62f2c2a8bbe74b332dba6f583452cf10b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 16:50:46 +0300 Subject: Add support for int32 item id fields in zero client 20181114. --- src/map/clif.c | 12 ++--- src/map/itemdb.h | 6 +-- src/map/packets.h | 15 ++++++ src/map/packets_struct.h | 124 +++++++++++++++++++++++------------------------ 4 files changed, 86 insertions(+), 71 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 7d539b3cd..3af7a09d2 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1116,7 +1116,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; -#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704 +#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 p.shield = vd->shield; #endif p.accessory2 = vd->head_top; @@ -1273,7 +1273,7 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target) p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; -#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704 +#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 p.shield = vd->shield; #endif p.accessory2 = vd->head_top; @@ -1382,7 +1382,7 @@ static void clif_set_unit_walking(struct block_list *bl, struct map_session_data p.weapon = vd->weapon; p.accessory = vd->head_bottom; p.moveStartTime = (unsigned int)timer->gettick(); -#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704 +#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 p.shield = vd->shield; #endif p.accessory2 = vd->head_top; @@ -12474,7 +12474,7 @@ static void clif_parse_SelectArrow(int fd, struct map_session_data *sd) clif_menuskill_clear(sd); return; } -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 itemId = RFIFOL(fd, 2); #else itemId = RFIFOW(fd, 2); @@ -21631,7 +21631,7 @@ static void clif_ui_action(struct map_session_data *sd, int32 UIType, int32 data static void clif_parse_private_airship_request(int fd, struct map_session_data *sd) __attribute__((nonnull(2))); static void clif_parse_private_airship_request(int fd, struct map_session_data *sd) { -#if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620 +#if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620 || defined(PACKETVER_ZERO) char evname[EVENT_NAME_LENGTH]; struct event_data *ev = NULL; const struct PACKET_CZ_PRIVATE_AIRSHIP_REQUEST *p = RP2PTR(fd); @@ -21651,7 +21651,7 @@ static void clif_parse_private_airship_request(int fd, struct map_session_data * static void clif_private_airship_response(struct map_session_data *sd, uint32 flag) { -#if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620 +#if PACKETVER_RE_NUM >= 20180321 || PACKETVER_MAIN_NUM >= 20180620 || defined(PACKETVER_ZERO) struct PACKET_ZC_PRIVATE_AIRSHIP_RESPONSE p; nullpo_retv(sd); diff --git a/src/map/itemdb.h b/src/map/itemdb.h index d92940445..1d3b0c0d7 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -38,7 +38,7 @@ struct hplugin_data_store; #endif #ifndef MAX_ITEM_ID -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 #define MAX_ITEM_ID 0x20000 #else #define MAX_ITEM_ID 0xFFFF @@ -72,8 +72,8 @@ struct hplugin_data_store; #if MAX_ITEM_ID < MAX_ITEMDB #error "MAX_ITEM_ID must be bigger or same with MAX_ITEMDB" #endif -#if MAX_ITEM_ID > 0xFFFF && PACKETVER_RE_NUM < 20180704 -#error "For clients before 20180704 RE, MAX_ITEM_ID must be smaller than 0x10000" +#if MAX_ITEM_ID > 0xFFFF && PACKETVER_RE_NUM < 20180704 && PACKETVER_ZERO_NUM < 20181114 +#error "For clients before 20180704 RE and 2018114 zero, MAX_ITEM_ID must be smaller than 0x10000" #endif enum item_itemid { diff --git a/src/map/packets.h b/src/map/packets.h index 036fd4f2a..1e1a12acb 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1875,4 +1875,19 @@ packet(0x96e,clif->ackmergeitems); packet(0x0a49,clif->pPrivateAirshipRequest); // CZ_PRIVATE_AIRSHIP_REQUEST #endif +// 2018-11-14aRagexe_zero +#if PACKETVER_ZERO_NUM >= 20181114 +// new packets +// changed packet sizes + packet(0x018e,clif->pProduceMix); // CZ_REQMAKINGITEM + packet(0x01ae,clif->pSelectArrow,2); // CZ_REQ_MAKINGARROW + packet(0x01fd,clif->pRepairItem); // CZ_REQ_ITEMREPAIR + packet(0x025b,clif->pCooking); // CZ_REQ_MAKINGITEM + packet(0x0445,clif->pDull/*,XXX*/); // CZ_SIMPLE_BUY_CASH_POINT_ITEM + packet(0x09ae,clif->pDull/*,XXX*/); // CZ_REQ_APPLY_BARGAIN_SALE_ITEM + packet(0x09b0,clif->pDull/*,XXX*/); // CZ_REQ_REMOVE_BARGAIN_SALE_ITEM + packet(0x09c3,clif->pDull/*,XXX*/); // CZ_REQ_COUNT_BARGAIN_SALE_ITEM + packet(0x0a49,clif->pPrivateAirshipRequest); // CZ_PRIVATE_AIRSHIP_REQUEST +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 51db7cc78..622ec235a 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -465,7 +465,7 @@ enum packet_headers { * structs for data */ struct EQUIPSLOTINFO { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 card[4]; #else uint16 card[4]; @@ -474,7 +474,7 @@ struct EQUIPSLOTINFO { struct NORMALITEM_INFO { int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -512,7 +512,7 @@ struct ItemOptions { struct EQUIPITEM_INFO { int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -589,7 +589,7 @@ struct packet_additem { int16 PacketType; uint16 Index; uint16 count; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 nameid; #else uint16 nameid; @@ -623,7 +623,7 @@ struct packet_additem { struct packet_dropflooritem { int16 PacketType; uint32 ITAID; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -735,7 +735,7 @@ struct packet_spawn_unit { #else uint32 weapon; #endif -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 shield; #endif uint16 accessory; @@ -808,7 +808,7 @@ struct packet_unit_walking { #else uint32 weapon; #endif -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 shield; #endif uint16 accessory; @@ -880,7 +880,7 @@ struct packet_idle_unit { #else uint32 weapon; #endif -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 shield; #endif uint16 accessory; @@ -1043,7 +1043,7 @@ struct packet_package_item_announce { int16 PacketType; int16 PacketLength; uint8 type; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ItemID; #else uint16 ItemID; @@ -1051,7 +1051,7 @@ struct packet_package_item_announce { int8 len; char Name[NAME_LENGTH]; int8 unknown; // probably unused -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 BoxItemID; #else uint16 BoxItemID; @@ -1063,7 +1063,7 @@ struct packet_item_drop_announce { int16 PacketType; int16 PacketLength; uint8 type; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ItemID; #else uint16 ItemID; @@ -1118,7 +1118,7 @@ struct packet_roulette_open_ack { int32 Serial; int8 Step; int8 Idx; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 AdditionItemID; #else uint16 AdditionItemID; @@ -1156,7 +1156,7 @@ struct packet_roulette_generate_ack { uint8 Result; uint16 Step; uint16 Idx; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 AdditionItemID; #else uint16 AdditionItemID; @@ -1174,7 +1174,7 @@ struct packet_roulette_itemrecv_req { struct packet_roulette_itemrecv_ack { int16 PacketType; uint8 Result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 AdditionItemID; #else uint16 AdditionItemID; @@ -1379,7 +1379,7 @@ struct packet_npc_market_purchase { int16 PacketType; int16 PacketLength; struct { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -1393,7 +1393,7 @@ struct packet_npc_market_result_ack { int16 PacketLength; uint8 result; struct { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -1408,7 +1408,7 @@ struct packet_npc_market_open { int16 PacketLength; /* inner struct figured by Ind after some annoying hour of debugging (data Thanks to Yommy) */ struct { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 nameid; #else uint16 nameid; @@ -1533,7 +1533,7 @@ struct PACKET_ZC_ADD_ITEM_TO_MAIL { int8 result; int16 index; int16 count; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -1551,7 +1551,7 @@ struct PACKET_ZC_ADD_ITEM_TO_MAIL { struct mail_item { int16 count; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -1961,7 +1961,7 @@ struct PACKET_ZC_UI_ACTION { struct PACKET_CZ_PRIVATE_AIRSHIP_REQUEST { int16 PacketType; char mapName[MAP_NAME_LENGTH_EXT]; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ItemID; #else uint16 ItemID; @@ -2007,7 +2007,7 @@ struct pet_evolution_items { struct PACKET_CZ_PET_EVOLUTION { int16 PacketType; uint16 PacketLength; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 EvolvedPetEggID; #else uint16 EvolvedPetEggID; @@ -2041,7 +2041,7 @@ struct PACKET_ZC_NOTIFY_PLAYERCHAT { struct PACKET_ZC_ITEM_ENTRY { int16 packetType; uint32 AID; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2058,7 +2058,7 @@ struct PACKET_ZC_ADD_ITEM_TO_STORE { int16 packetType; int16 index; int32 amount; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2077,7 +2077,7 @@ struct PACKET_ZC_ADD_ITEM_TO_STORE { struct PACKET_ZC_MVP_GETTING_ITEM { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2087,7 +2087,7 @@ struct PACKET_ZC_MVP_GETTING_ITEM { struct PACKET_ZC_ACK_TOUSESKILL { int16 packetType; uint16 skillId; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 int32 btype; uint32 itemId; #else @@ -2102,7 +2102,7 @@ struct PACKET_ZC_ADD_ITEM_TO_CART { int16 packetType; int16 index; int32 amount; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2121,7 +2121,7 @@ struct PACKET_ZC_ADD_ITEM_TO_CART { struct PACKET_CZ_REQMAKINGITEM { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint32 material[3]; #else @@ -2133,7 +2133,7 @@ struct PACKET_CZ_REQMAKINGITEM { struct PACKET_ZC_ACK_REQMAKINGITEM { int16 packetType; int16 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2143,7 +2143,7 @@ struct PACKET_ZC_ACK_REQMAKINGITEM { struct PACKET_ZC_FEED_PET { int16 packetType; uint8 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2153,7 +2153,7 @@ struct PACKET_ZC_FEED_PET { struct PACKET_ZC_FEED_MER { int16 packetType; uint8 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2163,7 +2163,7 @@ struct PACKET_ZC_FEED_MER { struct PACKET_ZC_USE_ITEM_ACK { int16 packetType; int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint32 AID; #elif PACKETVER >= 3 @@ -2178,7 +2178,7 @@ struct PACKET_ZC_SPRITE_CHANGE { int16 packetType; uint32 AID; uint8 type; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 val; uint32 val2; #elif PACKETVER >= 4 @@ -2191,7 +2191,7 @@ struct PACKET_ZC_SPRITE_CHANGE { struct PACKET_ZC_ADD_EXCHANGE_ITEM { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint8 itemType; int32 amount; @@ -2214,7 +2214,7 @@ struct PACKET_ZC_ADD_EXCHANGE_ITEM { struct PACKET_ZC_CASH_TIME_COUNTER { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2225,7 +2225,7 @@ struct PACKET_ZC_CASH_TIME_COUNTER { struct PACKET_ZC_CASH_ITEM_DELETE { int16 packetType; uint16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2235,7 +2235,7 @@ struct PACKET_ZC_CASH_ITEM_DELETE { struct PACKET_ZC_ITEM_PICKUP_PARTY { int16 packetType; uint32 AID; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2250,7 +2250,7 @@ struct PACKET_ZC_ITEM_PICKUP_PARTY { struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2269,7 +2269,7 @@ struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE { struct PACKET_ZC_ACK_WEAPONREFINE { int16 packetType; int32 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2284,7 +2284,7 @@ struct PACKET_ZC_PROPERTY_HOMUN { uint16 level; uint16 hunger; uint16 intimacy; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2315,7 +2315,7 @@ struct PACKET_ZC_PROPERTY_HOMUN { struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER { int16 packetType; uint16 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2325,7 +2325,7 @@ struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER { struct PACKET_CZ_REQ_ITEMREPAIR { int16 packetType; int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2337,7 +2337,7 @@ struct PACKET_CZ_REQ_ITEMREPAIR { struct PACKET_CZ_REQ_MAKINGITEM { int16 packetType; int16 type; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2348,7 +2348,7 @@ struct PACKET_CZ_SSILIST_ITEM_CLICK { int16 packetType; uint32 AID; uint32 storeId; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2356,7 +2356,7 @@ struct PACKET_CZ_SSILIST_ITEM_CLICK { } __attribute__((packed)); struct PACKET_ZC_ACK_SCHEDULER_CASHITEM_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2377,7 +2377,7 @@ struct PACKET_ZC_PC_PURCHASE_MYITEMLIST_sub { int16 index; int16 amount; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2402,7 +2402,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST_sub { uint32 price; uint32 discountPrice; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2417,7 +2417,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST { struct PACKET_CZ_PC_PURCHASE_ITEMLIST_sub { uint16 amount; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2431,7 +2431,7 @@ struct PACKET_CZ_PC_PURCHASE_ITEMLIST { } __attribute__((packed)); struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2453,7 +2453,7 @@ struct PACKET_ZC_MYITEMLIST_BUYING_STORE_sub { uint32 price; uint16 amount; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2473,7 +2473,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST_FROMMC_sub { uint16 amount; int16 index; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2506,7 +2506,7 @@ struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE_sub { uint32 price; uint16 amount; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2524,7 +2524,7 @@ struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE { struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub { int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2541,7 +2541,7 @@ struct PACKET_CZ_REQ_TRADE_BUYING_STORE { } __attribute__((packed)); struct PACKET_ZC_MAKABLEITEMLIST_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint32 material[3]; #else @@ -2557,7 +2557,7 @@ struct PACKET_ZC_MAKABLEITEMLIST { } __attribute__((packed)); struct PACKET_ZC_MAKINGARROW_LIST_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2572,7 +2572,7 @@ struct PACKET_ZC_MAKINGARROW_LIST { struct PACKET_ZC_REPAIRITEMLIST_sub { int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2589,7 +2589,7 @@ struct PACKET_ZC_REPAIRITEMLIST { struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub { int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2605,7 +2605,7 @@ struct PACKET_ZC_NOTIFY_WEAPONITEMLIST { } __attribute__((packed)); struct PACKET_ZC_MAKINGITEM_LIST_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2615,7 +2615,7 @@ struct PACKET_ZC_MAKINGITEM_LIST_sub { struct PACKET_ZC_MAKINGITEM_LIST { int16 packetType; int16 packetLength; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 makeItem; #else uint16 makeItem; @@ -2627,7 +2627,7 @@ struct PACKET_ZC_PC_CASH_POINT_ITEMLIST_sub { uint32 price; uint32 discountPrice; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2646,7 +2646,7 @@ struct PACKET_ZC_PC_CASH_POINT_ITEMLIST { struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub { uint16 amount; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2670,7 +2670,7 @@ struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM { } __attribute__((packed)); struct PACKET_CZ_SEARCH_STORE_INFO_item { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2695,7 +2695,7 @@ struct PACKET_ZC_SEARCH_STORE_INFO_ACK_sub { uint32 storeId; uint32 AID; char shopName[MESSAGE_SIZE]; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; -- cgit v1.2.3-70-g09d2 From 7c87e5cb23eb568216b2da788b32aee20f8dd018 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 20 Nov 2018 02:13:05 +0300 Subject: Fix packet ZC_CLANINFO. --- src/map/clif.c | 15 +++++++++------ src/map/packets_struct.h | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 3af7a09d2..0e2424618 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -20358,21 +20358,21 @@ static const char *clif_get_bl_name(const struct block_list *bl) */ static void clif_clan_basicinfo(struct map_session_data *sd) { -#if PACKETVER >= 20120716 +#if PACKETVER_MAIN_NUM >= 20130626 || PACKETVER_RE_NUM >= 20130605 || defined(PACKETVER_ZERO) int len, i, fd; struct clan *c, *ally, *antagonist; struct PACKET_ZC_CLANINFO *packet = NULL; - nullpo_retv(sd); nullpo_retv(c = sd->clan); len = sizeof(struct PACKET_ZC_CLANINFO); fd = sd->fd; - WFIFOHEAD(fd, len); + const int maxEntries = 100; // max entries with clan names + WFIFOHEAD(fd, len + maxEntries * 24); packet = WFIFOP(fd, 0); - packet->PacketType = clanBasicInfo; + packet->PacketType = HEADER_ZC_CLANINFO; packet->ClanID = c->clan_id; safestrncpy(packet->ClanName, c->name, NAME_LENGTH); @@ -20383,24 +20383,27 @@ static void clif_clan_basicinfo(struct map_session_data *sd) packet->AllyCount = VECTOR_LENGTH(c->allies); packet->AntagonistCount = VECTOR_LENGTH(c->antagonists); + int cnt = 0; // All allies and antagonists are assumed as valid entries // since it only gets inside the vector after the validation // on clan->config_read - for (i = 0; i < VECTOR_LENGTH(c->allies); i++) { + for (i = 0; i < VECTOR_LENGTH(c->allies) && cnt < maxEntries; i++) { struct clan_relationship *al = &VECTOR_INDEX(c->allies, i); if ((ally = clan->search(al->clan_id)) != NULL) { safestrncpy(WFIFOP(fd, len), ally->name, NAME_LENGTH); len += NAME_LENGTH; + cnt ++; } } - for (i = 0; i < VECTOR_LENGTH(c->antagonists); i++) { + for (i = 0; i < VECTOR_LENGTH(c->antagonists) && cnt < maxEntries; i++) { struct clan_relationship *an = &VECTOR_INDEX(c->antagonists, i); if ((antagonist = clan->search(an->clan_id)) != NULL) { safestrncpy(WFIFOP(fd, len), antagonist->name, NAME_LENGTH); len += NAME_LENGTH; + cnt ++; } } diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 622ec235a..9ea5dc8a1 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -371,9 +371,6 @@ enum packet_headers { partymemberinfo = 0x01e9, partyinfo = 0x00fb, #endif -#if PACKETVER >= 20120702 - clanBasicInfo = 0x098A, ///< ZC_CLANINFO -#endif #if PACKETVER >= 20120716 clanOnlineCount = 0x0988, ///< ZC_NOTIFY_CLAN_CONNECTINFO clanLeave = 0x0989, ///< ZC_ACK_CLAN_LEAVE @@ -1800,6 +1797,7 @@ struct PACKET_ZC_GROUP_LIST { struct PACKET_ZC_GROUP_LIST_SUB members[]; } __attribute__((packed)); +#if PACKETVER_MAIN_NUM >= 20130626 || PACKETVER_RE_NUM >= 20130605 || defined(PACKETVER_ZERO) struct PACKET_ZC_CLANINFO { int16 PacketType; int16 PacketLength; @@ -1810,6 +1808,8 @@ struct PACKET_ZC_CLANINFO { uint8 AllyCount; uint8 AntagonistCount; } __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_CLANINFO, 0x098a); +#endif struct PACKET_ZC_NOTIFY_CLAN_CONNECTINFO { int16 PacketType; -- cgit v1.2.3-70-g09d2 From 1ebdcdb184dd9a23455dd70c31a55b289a27ee67 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 21 Nov 2018 18:07:15 +0300 Subject: Update keys up to 2018-12-12 --- src/map/packets_keys_main.h | 8 ++++++-- src/map/packets_keys_zero.h | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/packets_keys_main.h b/src/map/packets_keys_main.h index 129c4eaaa..7a1f84faa 100644 --- a/src/map/packets_keys_main.h +++ b/src/map/packets_keys_main.h @@ -37,7 +37,7 @@ packetKeys(0x49357d72,0x22c370a1,0x5f836591); #endif -// 2010-11-23aRagexeRE, 2010-11-24aRagexeRE, 2010-11-24bRagexeRE, 2010-11-25aRagexeRE, 2010-11-26aRagexeRE, 2010-11-30aRagexeRE, 2010-12-07aRagexeRE, 2010-12-14aRagexeRE, 2010-12-21aRagexeRE, 2010-12-23aRagexeRE, 2010-12-28aRagexeRE, 2011-01-04aRagexeRE, 2011-01-05aRagexeRE, 2011-01-11aRagexeRE, 2011-01-18aRagexeRE, 2011-01-25aRagexeRE, 2011-01-26aRagexeRE, 2011-01-26bRagexeRE, 2011-01-31aRagexeRE, 2011-01-31bRagexeRE, 2011-01-31cRagexeRE, 2011-02-08aRagexeRE, 2011-02-15aRagexeRE, 2011-02-22aRagexeRE, 2011-02-23aRagexeRE, 2011-02-23bRagexeRE, 2011-02-24aRagexeRE, 2011-02-25aRagexeRE, 2011-02-28aRagexeRE, 2011-03-08aRagexeRE, 2011-03-09aRagexeRE, 2011-03-09bRagexeRE, 2011-03-09cRagexeRE, 2011-03-09dRagexeRE, 2011-03-15aRagexeRE, 2011-03-22aRagexeRE, 2011-03-29aRagexeRE, 2011-03-30aRagexeRE, 2011-03-30cRagexeRE, 2011-04-05aRagexeRE, 2011-04-12aRagexeRE, 2011-04-19aRagexeRE, 2011-04-20aRagexeRE, 2011-04-26aRagexeRE, 2011-04-27aRagexeRE, 2011-05-03aRagexeRE, 2011-05-11aRagexeRE, 2011-05-17bRagexeRE, 2011-05-24aRagexeRE, 2011-05-26aRagexeRE, 2011-05-31aRagexeRE, 2011-06-07aRagexeRE, 2011-06-08aRagexeRE, 2011-06-08bRagexeRE, 2011-06-08cRagexeRE, 2011-06-09aRagexeRE, 2011-06-14bRagexeRE, 2011-06-22aRagexeRE, 2011-06-28aRagexeRE, 2011-07-06aRagexeRE, 2011-07-13aRagexeRE, 2011-07-13bRagexeRE, 2011-07-13cRagexeRE, 2011-07-19aRagexeRE, 2011-07-26aRagexeRE, 2011-08-03aRagexeRE, 2011-08-03bRagexeRE, 2011-08-10aRagexeRE, 2013-12-23aRagexeRE, 2014-05-08aRagexe, 2014-05-08aRagexeRE, 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE, 2018-04-18aRagexe, 2018-04-18bRagexeRE, 2018-04-25cRagexe, 2018-04-25cRagexeRE, 2018-05-02bRagexe, 2018-05-02bRagexeRE, 2018-05-02dRagexeRE, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-16cRagexeRE, 2018-05-23aRagexe, 2018-05-23aRagexeRE, 2018-05-30aRagexe, 2018-05-30bRagexeRE, 2018-05-30cRagexeRE, 2018-06-05bRagexe, 2018-06-05bRagexeRE, 2018-06-12aRagexeRE, 2018-06-12bRagexeRE, 2018-06-20cRagexe, 2018-06-20dRagexeRE, 2018-06-20eRagexe, 2018-06-20eRagexeRE, 2018-06-21aRagexe, 2018-06-21aRagexeRE, 2018-07-04aRagexe, 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexe, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexe, 2018-07-18cRagexeRE, 2018-08-01cRagexe, 2018-08-01cRagexeRE, 2018-08-08bRagexe, 2018-08-08bRagexeRE, 2018-08-22cRagexe, 2018-08-22cRagexeRE, 2018-08-29aRagexe, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-12dRagexeRE, 2018-09-19aRagexe, 2018-09-19aRagexeRE, 2018-10-02aRagexe, 2018-10-02aRagexeRE, 2018-10-02bRagexe, 2018-10-02bRagexeRE, 2018-10-17_02aRagexe, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexe, 2018-10-17_03aRagexeRE, 2018-10-17bRagexe, 2018-10-17bRagexeRE, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-10-31cRagexeRE, 2018-11-07aRagexe, 2018-11-07aRagexeRE, 2018-11-14cRagexe, 2018-11-14cRagexeRE +// 2010-11-23aRagexeRE, 2010-11-24aRagexeRE, 2010-11-24bRagexeRE, 2010-11-25aRagexeRE, 2010-11-26aRagexeRE, 2010-11-30aRagexeRE, 2010-12-07aRagexeRE, 2010-12-14aRagexeRE, 2010-12-21aRagexeRE, 2010-12-23aRagexeRE, 2010-12-28aRagexeRE, 2011-01-04aRagexeRE, 2011-01-05aRagexeRE, 2011-01-11aRagexeRE, 2011-01-18aRagexeRE, 2011-01-25aRagexeRE, 2011-01-26aRagexeRE, 2011-01-26bRagexeRE, 2011-01-31aRagexeRE, 2011-01-31bRagexeRE, 2011-01-31cRagexeRE, 2011-02-08aRagexeRE, 2011-02-15aRagexeRE, 2011-02-22aRagexeRE, 2011-02-23aRagexeRE, 2011-02-23bRagexeRE, 2011-02-24aRagexeRE, 2011-02-25aRagexeRE, 2011-02-28aRagexeRE, 2011-03-08aRagexeRE, 2011-03-09aRagexeRE, 2011-03-09bRagexeRE, 2011-03-09cRagexeRE, 2011-03-09dRagexeRE, 2011-03-15aRagexeRE, 2011-03-22aRagexeRE, 2011-03-29aRagexeRE, 2011-03-30aRagexeRE, 2011-03-30cRagexeRE, 2011-04-05aRagexeRE, 2011-04-12aRagexeRE, 2011-04-19aRagexeRE, 2011-04-20aRagexeRE, 2011-04-26aRagexeRE, 2011-04-27aRagexeRE, 2011-05-03aRagexeRE, 2011-05-11aRagexeRE, 2011-05-17bRagexeRE, 2011-05-24aRagexeRE, 2011-05-26aRagexeRE, 2011-05-31aRagexeRE, 2011-06-07aRagexeRE, 2011-06-08aRagexeRE, 2011-06-08bRagexeRE, 2011-06-08cRagexeRE, 2011-06-09aRagexeRE, 2011-06-14bRagexeRE, 2011-06-22aRagexeRE, 2011-06-28aRagexeRE, 2011-07-06aRagexeRE, 2011-07-13aRagexeRE, 2011-07-13bRagexeRE, 2011-07-13cRagexeRE, 2011-07-19aRagexeRE, 2011-07-26aRagexeRE, 2011-08-03aRagexeRE, 2011-08-03bRagexeRE, 2011-08-10aRagexeRE, 2013-12-23aRagexeRE, 2014-05-08aRagexe, 2014-05-08aRagexeRE, 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-21aRagexeRE, 2018-03-28bRagexe, 2018-03-28bRagexeRE, 2018-04-04bRagexe, 2018-04-04cRagexeRE, 2018-04-18aRagexe, 2018-04-18bRagexeRE, 2018-04-25cRagexe, 2018-04-25cRagexeRE, 2018-05-02bRagexe, 2018-05-02bRagexeRE, 2018-05-02dRagexeRE, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-16cRagexeRE, 2018-05-23aRagexe, 2018-05-23aRagexeRE, 2018-05-30aRagexe, 2018-05-30bRagexeRE, 2018-05-30cRagexeRE, 2018-06-05bRagexe, 2018-06-05bRagexeRE, 2018-06-12aRagexeRE, 2018-06-12bRagexeRE, 2018-06-20cRagexe, 2018-06-20dRagexeRE, 2018-06-20eRagexe, 2018-06-20eRagexeRE, 2018-06-21aRagexe, 2018-06-21aRagexeRE, 2018-07-04aRagexe, 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexe, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexe, 2018-07-18cRagexeRE, 2018-08-01cRagexe, 2018-08-01cRagexeRE, 2018-08-08bRagexe, 2018-08-08bRagexeRE, 2018-08-22cRagexe, 2018-08-22cRagexeRE, 2018-08-29aRagexe, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-12dRagexeRE, 2018-09-19aRagexe, 2018-09-19aRagexeRE, 2018-10-02aRagexe, 2018-10-02aRagexeRE, 2018-10-02bRagexe, 2018-10-02bRagexeRE, 2018-10-17_02aRagexe, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexe, 2018-10-17_03aRagexeRE, 2018-10-17bRagexe, 2018-10-17bRagexeRE, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-10-31cRagexeRE, 2018-11-07aRagexe, 2018-11-07aRagexeRE, 2018-11-14cRagexe, 2018-11-14cRagexeRE, 2018-11-14dRagexe, 2018-11-14dRagexeRE, 2018-11-21bRagexe, 2018-11-21cRagexeRE, 2018-11-28aRagexe, 2018-11-28aRagexeRE, 2018-11-28bRagexe, 2018-11-28cRagexe, 2018-12-05aRagexe, 2018-12-05bRagexeRE, 2018-12-12aRagexe, 2018-12-12aRagexeRE, 2018-12-12bRagexe, 2018-12-12bRagexeRE #if PACKETVER == 20101123 || \ PACKETVER == 20101124 || \ PACKETVER == 20101125 || \ @@ -126,7 +126,11 @@ PACKETVER == 20181024 || \ PACKETVER == 20181031 || \ PACKETVER == 20181107 || \ - PACKETVER >= 20181114 + PACKETVER == 20181114 || \ + PACKETVER == 20181121 || \ + PACKETVER == 20181128 || \ + PACKETVER == 20181205 || \ + PACKETVER >= 20181212 packetKeys(0x00000000,0x00000000,0x00000000); #endif diff --git a/src/map/packets_keys_zero.h b/src/map/packets_keys_zero.h index d5836bf96..1a592956e 100644 --- a/src/map/packets_keys_zero.h +++ b/src/map/packets_keys_zero.h @@ -30,7 +30,7 @@ /* This file is autogenerated, please do not commit manual changes */ -// 2017-10-18aRagexe_zero, 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero, 2018-04-11aRagexe_zero, 2018-04-25_3aRagexe_zero, 2018-05-09_3aRagexe_zero, 2018-05-23aRagexe_zero, 2018-06-05bRagexe_zero, 2018-06-05cRagexe_zero, 2018-06-27aRagexe_zero, 2018-07-03aRagexe_zero, 2018-07-11_2aRagexe_zero, 2018-07-25_2aRagexe_zero, 2018-08-01aRagexe_zero, 2018-08-08_2aRagexe_zero, 2018-08-22aRagexe_zero, 2018-08-29aRagexe_zero, 2018-09-05aRagexe_zero, 2018-09-12aRagexe_zero, 2018-09-19aRagexe_zero, 2018-09-28aRagexe_zero, 2018-10-10_2aRagexe_zero, 2018-10-24_2aRagexe_zero, 2018-11-14aRagexe_zero +// 2017-10-18aRagexe_zero, 2017-10-19aRagexe_zero, 2017-10-23aRagexe_zero, 2017-10-23bRagexe_zero, 2017-10-23cRagexe_zero, 2017-10-24aRagexe_2_zero, 2017-10-24aRagexe_zero, 2017-10-25bRagexe_zero, 2017-10-27aRagexe_zero, 2017-10-27bRagexe_zero, 2017-10-30aRagexe_zero, 2017-10-31aRagexe_zero, 2017-11-09aRagexe_zero, 2017-11-13aRagexe_zero, 2017-11-13bRagexe_zero, 2018-03-15aRagexe_zero, 2018-03-21aRagexe_zero, 2018-03-21bRagexe_zero, 2018-03-28_1aRagexe_zero, 2018-03-28cRagexe_zero, 2018-04-11aRagexe_zero, 2018-04-25_3aRagexe_zero, 2018-05-09_3aRagexe_zero, 2018-05-23aRagexe_zero, 2018-06-05bRagexe_zero, 2018-06-05cRagexe_zero, 2018-06-27aRagexe_zero, 2018-07-03aRagexe_zero, 2018-07-11_2aRagexe_zero, 2018-07-25_2aRagexe_zero, 2018-08-01aRagexe_zero, 2018-08-08_2aRagexe_zero, 2018-08-22aRagexe_zero, 2018-08-29aRagexe_zero, 2018-09-05aRagexe_zero, 2018-09-12aRagexe_zero, 2018-09-19aRagexe_zero, 2018-09-28aRagexe_zero, 2018-10-10_2aRagexe_zero, 2018-10-24_2aRagexe_zero, 2018-11-14aRagexe_zero, 2018-11-20aRagexe_zero, 2018-11-28aRagexe_zero, 2018-12-12aRagexe_zero #if PACKETVER == 20171018 || \ PACKETVER == 20171019 || \ PACKETVER == 20171023 || \ @@ -63,7 +63,10 @@ PACKETVER == 20180928 || \ PACKETVER == 20181010 || \ PACKETVER == 20181024 || \ - PACKETVER >= 20181114 + PACKETVER == 20181114 || \ + PACKETVER == 20181120 || \ + PACKETVER == 20181128 || \ + PACKETVER >= 20181212 packetKeys(0x00000000,0x00000000,0x00000000); #endif -- cgit v1.2.3-70-g09d2 From 0d8f2fb2bf1ba3d3ea420fc86206987867fc774f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 21 Nov 2018 19:12:47 +0300 Subject: Update shuffle packets up to 2018-12-12 --- src/map/packets_shuffle_main.h | 40 ++++++++++++++++++++++++++++++++++++++-- src/map/packets_shuffle_re.h | 8 ++++++-- src/map/packets_shuffle_zero.h | 9 ++++++--- 3 files changed, 50 insertions(+), 7 deletions(-) (limited to 'src/map') diff --git a/src/map/packets_shuffle_main.h b/src/map/packets_shuffle_main.h index 43be3821f..940dbcf89 100644 --- a/src/map/packets_shuffle_main.h +++ b/src/map/packets_shuffle_main.h @@ -3345,7 +3345,7 @@ packet(0x0969,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE // 2 #endif -// 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-28bRagexe, 2018-04-04bRagexe, 2018-04-18aRagexe, 2018-04-25cRagexe, 2018-05-02bRagexe, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-23aRagexe, 2018-05-30aRagexe, 2018-06-05bRagexe, 2018-06-20cRagexe, 2018-06-20eRagexe, 2018-06-21aRagexe, 2018-07-04aRagexe, 2018-07-18bRagexe, 2018-07-18cRagexe, 2018-08-01cRagexe, 2018-08-08bRagexe, 2018-08-22cRagexe, 2018-08-29aRagexe, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-19aRagexe, 2018-10-02aRagexe, 2018-10-02bRagexe, 2018-10-17_02aRagexe, 2018-10-17_03aRagexe, 2018-10-17bRagexe, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-11-07aRagexe, 2018-11-14cRagexe +// 2014-06-11eRagexe, 2015-02-25hRagexe, 2018-03-15aRagexe, 2018-03-21aRagexe, 2018-03-28bRagexe, 2018-04-04bRagexe, 2018-04-18aRagexe, 2018-04-25cRagexe, 2018-05-02bRagexe, 2018-05-09aRagexe, 2018-05-16cRagexe, 2018-05-23aRagexe, 2018-05-30aRagexe, 2018-06-05bRagexe, 2018-06-20cRagexe, 2018-06-20eRagexe, 2018-06-21aRagexe, 2018-07-04aRagexe, 2018-07-18bRagexe, 2018-07-18cRagexe, 2018-08-01cRagexe, 2018-08-08bRagexe, 2018-08-22cRagexe, 2018-08-29aRagexe, 2018-08-31aRagexe, 2018-09-12dRagexe, 2018-09-19aRagexe, 2018-10-02aRagexe, 2018-10-02bRagexe, 2018-10-17_02aRagexe, 2018-10-17_03aRagexe, 2018-10-17bRagexe, 2018-10-24bRagexe, 2018-10-31aRagexe, 2018-10-31bRagexe, 2018-11-07aRagexe, 2018-11-14cRagexe, 2018-11-14dRagexe #if PACKETVER == 20140611 || \ PACKETVER == 20150225 || \ PACKETVER == 20180315 || \ @@ -3376,7 +3376,7 @@ PACKETVER == 20181024 || \ PACKETVER == 20181031 || \ PACKETVER == 20181107 || \ - PACKETVER >= 20181114 + PACKETVER == 20181114 packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26 packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5 packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 @@ -9727,5 +9727,41 @@ packet(0x0967,clif->pSolveCharName,2); // CZ_REQNAME_BYGID // 6 #endif +// 2018-11-21bRagexe, 2018-11-28aRagexe, 2018-11-28bRagexe, 2018-11-28cRagexe, 2018-12-05aRagexe, 2018-12-12aRagexe, 2018-12-12bRagexe +#if PACKETVER == 20181121 || \ + PACKETVER == 20181128 || \ + PACKETVER == 20181205 || \ + PACKETVER >= 20181212 + packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26 + packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5 + packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 + packet(0x0281,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK // 4 + packet(0x02c4,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ // 26 + packet(0x035f,clif->pWalkToXY,2); // CZ_REQUEST_MOVE // 5 + packet(0x0360,clif->pTickSend,2); // CZ_REQUEST_TIME // 6 + packet(0x0361,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION // 5 + packet(0x0362,clif->pTakeItem,2); // CZ_ITEM_PICKUP // 6 + packet(0x0363,clif->pDropItem,2,4); // CZ_ITEM_THROW // 6 + packet(0x0364,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE // 8 + packet(0x0365,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY // 8 + packet(0x0366,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND // 10 + packet(0x0367,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX // 90 + packet(0x0368,clif->pGetCharNameRequest,2); // CZ_REQNAME // 6 + packet(0x0369,clif->pSolveCharName,2); // CZ_REQNAME_BYGID // 6 + packet(0x0436,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER // 19 + packet(0x0437,clif->pActionRequest,2,6); // CZ_REQUEST_ACT // 7 + packet(0x0438,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL // 10 + packet(0x07e4,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES // -1 + packet(0x07ec,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD // 8 + packet(0x0802,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER // 18 + packet(0x0811,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE // -1 + packet(0x0815,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE // 2 + packet(0x0817,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE // 6 + packet(0x0819,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE // -1 + packet(0x0835,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO // -1 + packet(0x0838,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE // 2 + packet(0x083c,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK // 14 +#endif + #endif /* MAP_PACKETS_SHUFFLE_MAIN_H */ diff --git a/src/map/packets_shuffle_re.h b/src/map/packets_shuffle_re.h index 429cf3012..dabc2ce6c 100644 --- a/src/map/packets_shuffle_re.h +++ b/src/map/packets_shuffle_re.h @@ -9663,7 +9663,7 @@ packet(0x083c,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK // 12 #endif -// 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexeRE, 2018-08-01cRagexeRE, 2018-08-08bRagexeRE, 2018-08-22cRagexeRE, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-09-12dRagexeRE, 2018-09-19aRagexeRE, 2018-10-02aRagexeRE, 2018-10-02bRagexeRE, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexeRE, 2018-10-17bRagexeRE, 2018-10-31cRagexeRE, 2018-11-07aRagexeRE, 2018-11-14cRagexeRE +// 2018-07-04aRagexeRE, 2018-07-11aRagexeRE, 2018-07-18bRagexeRE, 2018-07-18bRagexeRE1, 2018-07-18cRagexeRE, 2018-08-01cRagexeRE, 2018-08-08bRagexeRE, 2018-08-22cRagexeRE, 2018-08-29aRagexeRE, 2018-08-29bRagexeRE, 2018-09-12dRagexeRE, 2018-09-19aRagexeRE, 2018-10-02aRagexeRE, 2018-10-02bRagexeRE, 2018-10-17_02aRagexeRE, 2018-10-17_03aRagexeRE, 2018-10-17bRagexeRE, 2018-10-31cRagexeRE, 2018-11-07aRagexeRE, 2018-11-14cRagexeRE, 2018-11-14dRagexeRE, 2018-11-21cRagexeRE, 2018-11-28aRagexeRE, 2018-12-05bRagexeRE, 2018-12-12aRagexeRE, 2018-12-12bRagexeRE #if PACKETVER == 20180704 || \ PACKETVER == 20180711 || \ PACKETVER == 20180718 || \ @@ -9677,7 +9677,11 @@ PACKETVER == 20181017 || \ PACKETVER == 20181031 || \ PACKETVER == 20181107 || \ - PACKETVER >= 20181114 + PACKETVER == 20181114 || \ + PACKETVER == 20181121 || \ + PACKETVER == 20181128 || \ + PACKETVER == 20181205 || \ + PACKETVER >= 20181212 packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26 packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5 packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 diff --git a/src/map/packets_shuffle_zero.h b/src/map/packets_shuffle_zero.h index 7b68ec472..d38ed4008 100644 --- a/src/map/packets_shuffle_zero.h +++ b/src/map/packets_shuffle_zero.h @@ -69,7 +69,7 @@ PACKETVER == 20180919 || \ PACKETVER == 20180928 || \ PACKETVER == 20181010 || \ - PACKETVER >= 20181024 + PACKETVER == 20181024 packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26 packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5 packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 @@ -742,8 +742,11 @@ packet(0x0968,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 #endif -// 2018-11-14aRagexe_zero -#if PACKETVER == 20181114 +// 2018-11-14aRagexe_zero, 2018-11-20aRagexe_zero, 2018-11-28aRagexe_zero, 2018-12-12aRagexe_zero +#if PACKETVER == 20181114 || \ + PACKETVER == 20181120 || \ + PACKETVER == 20181128 || \ + PACKETVER >= 20181212 packet(0x0202,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS // 26 packet(0x022d,clif->pHomMenu,2,4); // CZ_COMMAND_MER // 5 packet(0x023b,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD // 36 -- cgit v1.2.3-70-g09d2 From b5c5728134ced5cd1f1609c3626832c42d425a05 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 21 Nov 2018 19:14:29 +0300 Subject: Update messages up to 2018-12-12 --- src/map/messages_main.h | 44 ++++++++++++++++++++++++++++++++++++++++---- src/map/messages_re.h | 44 ++++++++++++++++++++++++++++++++++++++++---- src/map/messages_zero.h | 28 ++++++++++++++++++++++++---- 3 files changed, 104 insertions(+), 12 deletions(-) (limited to 'src/map') diff --git a/src/map/messages_main.h b/src/map/messages_main.h index 4bef783ec..bb01d24cb 100644 --- a/src/map/messages_main.h +++ b/src/map/messages_main.h @@ -24,7 +24,7 @@ /* This file is autogenerated, please do not commit manual changes -Latest version: 20181107 +Latest version: 20181212 */ enum clif_messages { @@ -4630,9 +4630,11 @@ Thief Knight */ MSG_KNIGHT = 0x364, -/*20040913 to latest +/*20040913 to 20181128 Prieset Priest +20181205 to latest +Priest */ MSG_PRIEST = 0x365, /*20040913 to latest @@ -5269,9 +5271,11 @@ WhiteSmith Sniper */ MSG_HUNTER_H = 0x3dc, -/*20050613 to latest +/*20050613 to 20181128 Saaassin Cross Assassin Cross +20181205 to latest +Assassin Cross */ MSG_ASSASSIN_H = 0x3dd, /*20050613 to latest @@ -5299,9 +5303,11 @@ Sniper_W Sniper */ MSG_HUNTER_H_W = 0x3e2, -/*20050613 to latest +/*20050613 to 20181128 Saaassin Cross_W Assassin Cross +20181205 to latest +Assassin Cross_W */ MSG_ASSASSIN_H_W = 0x3e3, /*20050613 to latest @@ -21412,6 +21418,36 @@ PvP */ MSG_ID_DEE = 0xdee, #endif +#if PACKETVER >= 20181121 +/*20181121 to latest +같은 아이템을 %d개 이상 가질 수 없습니다. +*/ + MSG_ID_DEF = 0xdef, +/*20181121 to latest +소지 한계량 초과로 구입이 불가능합니다. +*/ + MSG_ID_DF0 = 0xdf0, +/*20181121 to latest +해당 아이템은 한 번에 한 개만 살 수 있습니다. +*/ + MSG_ID_DF1 = 0xdf1, +#endif +#if PACKETVER >= 20181205 +/*20181205 to latest +성제 +*/ + MSG_ID_DF2 = 0xdf2, +/*20181205 to latest +소울리퍼 +*/ + MSG_ID_DF3 = 0xdf3, +#endif +#if PACKETVER >= 20181212 +/*20181212 to latest +설정한 내용은 정상 종료 시 서버에 저장됩니다. +*/ + MSG_ID_DF4 = 0xdf4, +#endif }; #endif /* MAP_MESSAGES_MAIN_H */ diff --git a/src/map/messages_re.h b/src/map/messages_re.h index ee1a05b93..8b75d608d 100644 --- a/src/map/messages_re.h +++ b/src/map/messages_re.h @@ -24,7 +24,7 @@ /* This file is autogenerated, please do not commit manual changes -Latest version: 20181107 +Latest version: 20181212 */ enum clif_messages { @@ -4395,9 +4395,11 @@ Thief Knight */ MSG_KNIGHT = 0x364, -/*20080827 to latest +/*20080827 to 20181128 Prieset Priest +20181205 to latest +Priest */ MSG_PRIEST = 0x365, /*20080827 to latest @@ -4972,9 +4974,11 @@ WhiteSmith Sniper */ MSG_HUNTER_H = 0x3dc, -/*20080827 to latest +/*20080827 to 20181128 Saaassin Cross Assassin Cross +20181205 to latest +Assassin Cross */ MSG_ASSASSIN_H = 0x3dd, /*20080827 to latest @@ -5002,9 +5006,11 @@ Sniper_W Sniper */ MSG_HUNTER_H_W = 0x3e2, -/*20080827 to latest +/*20080827 to 20181128 Saaassin Cross_W Assassin Cross +20181205 to latest +Assassin Cross_W */ MSG_ASSASSIN_H_W = 0x3e3, /*20080827 to latest @@ -20891,6 +20897,36 @@ PvP */ MSG_ID_DEE = 0xdee, #endif +#if PACKETVER >= 20181121 +/*20181121 to latest +같은 아이템을 %d개 이상 가질 수 없습니다. +*/ + MSG_ID_DEF = 0xdef, +/*20181121 to latest +소지 한계량 초과로 구입이 불가능합니다. +*/ + MSG_ID_DF0 = 0xdf0, +/*20181121 to latest +해당 아이템은 한 번에 한 개만 살 수 있습니다. +*/ + MSG_ID_DF1 = 0xdf1, +#endif +#if PACKETVER >= 20181205 +/*20181205 to latest +성제 +*/ + MSG_ID_DF2 = 0xdf2, +/*20181205 to latest +소울리퍼 +*/ + MSG_ID_DF3 = 0xdf3, +#endif +#if PACKETVER >= 20181212 +/*20181212 to latest +설정한 내용은 정상 종료 시 서버에 저장됩니다. +*/ + MSG_ID_DF4 = 0xdf4, +#endif }; #endif /* MAP_MESSAGES_RE_H */ diff --git a/src/map/messages_zero.h b/src/map/messages_zero.h index d814b2305..f7f4cf360 100644 --- a/src/map/messages_zero.h +++ b/src/map/messages_zero.h @@ -24,7 +24,7 @@ /* This file is autogenerated, please do not commit manual changes -Latest version: 20181114 +Latest version: 20181212 */ enum clif_messages { @@ -4383,9 +4383,11 @@ Thief Knight */ MSG_KNIGHT = 0x364, -/*20171018 to latest +/*20171018 to 20181128 Prieset Priest +20181212 to latest +Priest */ MSG_PRIEST = 0x365, /*20171018 to latest @@ -4960,9 +4962,11 @@ WhiteSmith Sniper */ MSG_HUNTER_H = 0x3dc, -/*20171018 to latest +/*20171018 to 20181128 Saaassin Cross Assassin Cross +20181212 to latest +Assassin Cross */ MSG_ASSASSIN_H = 0x3dd, /*20171018 to latest @@ -4990,9 +4994,11 @@ Sniper_W Sniper */ MSG_HUNTER_H_W = 0x3e2, -/*20171018 to latest +/*20171018 to 20181128 Saaassin Cross_W Assassin Cross +20181212 to latest +Assassin Cross_W */ MSG_ASSASSIN_H_W = 0x3e3, /*20171018 to latest @@ -17509,6 +17515,20 @@ PvP */ MSG_ID_DF1 = 0xdf1, #endif +#if PACKETVER >= 20181212 +/*20181212 to latest +성제 +*/ + MSG_ID_DF2 = 0xdf2, +/*20181212 to latest +소울리퍼 +*/ + MSG_ID_DF3 = 0xdf3, +/*20181212 to latest +설정한 내용은 정상 종료 시 서버에 저장됩니다. +*/ + MSG_ID_DF4 = 0xdf4, +#endif }; #endif /* MAP_MESSAGES_ZERO_H */ -- cgit v1.2.3-70-g09d2 From 30cf149e9db5b9e33d819b831f78c02eeb586d39 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 21 Nov 2018 19:50:58 +0300 Subject: Add support for 4 bytes item id fields in main clients. From now all supported clients from some version can use item id up to 2 147 483 648. --- src/map/clif.c | 8 +-- src/map/itemdb.h | 6 +-- src/map/packets.h | 15 ++++++ src/map/packets_struct.h | 124 +++++++++++++++++++++++------------------------ 4 files changed, 84 insertions(+), 69 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 0e2424618..19f7a082a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1116,7 +1116,7 @@ static void clif_set_unit_idle(struct block_list *bl, struct map_session_data *t p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; -#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER < 7 || PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 p.shield = vd->shield; #endif p.accessory2 = vd->head_top; @@ -1273,7 +1273,7 @@ static void clif_spawn_unit(struct block_list *bl, enum send_target target) p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; -#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER < 7 || PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 p.shield = vd->shield; #endif p.accessory2 = vd->head_top; @@ -1382,7 +1382,7 @@ static void clif_set_unit_walking(struct block_list *bl, struct map_session_data p.weapon = vd->weapon; p.accessory = vd->head_bottom; p.moveStartTime = (unsigned int)timer->gettick(); -#if PACKETVER < 7 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER < 7 || PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 p.shield = vd->shield; #endif p.accessory2 = vd->head_top; @@ -12474,7 +12474,7 @@ static void clif_parse_SelectArrow(int fd, struct map_session_data *sd) clif_menuskill_clear(sd); return; } -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 itemId = RFIFOL(fd, 2); #else itemId = RFIFOW(fd, 2); diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 1d3b0c0d7..0c08efbeb 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -38,7 +38,7 @@ struct hplugin_data_store; #endif #ifndef MAX_ITEM_ID -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 #define MAX_ITEM_ID 0x20000 #else #define MAX_ITEM_ID 0xFFFF @@ -72,8 +72,8 @@ struct hplugin_data_store; #if MAX_ITEM_ID < MAX_ITEMDB #error "MAX_ITEM_ID must be bigger or same with MAX_ITEMDB" #endif -#if MAX_ITEM_ID > 0xFFFF && PACKETVER_RE_NUM < 20180704 && PACKETVER_ZERO_NUM < 20181114 -#error "For clients before 20180704 RE and 2018114 zero, MAX_ITEM_ID must be smaller than 0x10000" +#if MAX_ITEM_ID > 0xFFFF && PACKETVER_MAIN_NUM < 20181121 && PACKETVER_RE_NUM < 20180704 && PACKETVER_ZERO_NUM < 20181114 +#error "For clients before 20181121 Main and 20180704 RE and 20181114 zero, MAX_ITEM_ID must be smaller than 0x10000" #endif enum item_itemid { diff --git a/src/map/packets.h b/src/map/packets.h index 1e1a12acb..7dbd26a31 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1890,4 +1890,19 @@ packet(0x96e,clif->ackmergeitems); packet(0x0a49,clif->pPrivateAirshipRequest); // CZ_PRIVATE_AIRSHIP_REQUEST #endif +// 2018-11-21bRagexe +#if PACKETVER_ZERO_NUM >= 20181121 +// new packets +// changed packet sizes + packet(0x018e,clif->pProduceMix); // CZ_REQMAKINGITEM + packet(0x01ae,clif->pSelectArrow,2); // CZ_REQ_MAKINGARROW + packet(0x01fd,clif->pRepairItem); // CZ_REQ_ITEMREPAIR + packet(0x025b,clif->pCooking); // CZ_REQ_MAKINGITEM + packet(0x0445,clif->pDull/*,XXX*/); // CZ_SIMPLE_BUY_CASH_POINT_ITEM + packet(0x09ae,clif->pDull/*,XXX*/); // CZ_REQ_APPLY_BARGAIN_SALE_ITEM + packet(0x09b0,clif->pDull/*,XXX*/); // CZ_REQ_REMOVE_BARGAIN_SALE_ITEM + packet(0x09c3,clif->pDull/*,XXX*/); // CZ_REQ_COUNT_BARGAIN_SALE_ITEM + packet(0x0a49,clif->pPrivateAirshipRequest); // CZ_PRIVATE_AIRSHIP_REQUEST +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 9ea5dc8a1..357627ce7 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -462,7 +462,7 @@ enum packet_headers { * structs for data */ struct EQUIPSLOTINFO { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 card[4]; #else uint16 card[4]; @@ -471,7 +471,7 @@ struct EQUIPSLOTINFO { struct NORMALITEM_INFO { int16 index; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -509,7 +509,7 @@ struct ItemOptions { struct EQUIPITEM_INFO { int16 index; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -586,7 +586,7 @@ struct packet_additem { int16 PacketType; uint16 Index; uint16 count; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 nameid; #else uint16 nameid; @@ -620,7 +620,7 @@ struct packet_additem { struct packet_dropflooritem { int16 PacketType; uint32 ITAID; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -732,7 +732,7 @@ struct packet_spawn_unit { #else uint32 weapon; #endif -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 shield; #endif uint16 accessory; @@ -805,7 +805,7 @@ struct packet_unit_walking { #else uint32 weapon; #endif -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 shield; #endif uint16 accessory; @@ -877,7 +877,7 @@ struct packet_idle_unit { #else uint32 weapon; #endif -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 shield; #endif uint16 accessory; @@ -1040,7 +1040,7 @@ struct packet_package_item_announce { int16 PacketType; int16 PacketLength; uint8 type; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ItemID; #else uint16 ItemID; @@ -1048,7 +1048,7 @@ struct packet_package_item_announce { int8 len; char Name[NAME_LENGTH]; int8 unknown; // probably unused -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 BoxItemID; #else uint16 BoxItemID; @@ -1060,7 +1060,7 @@ struct packet_item_drop_announce { int16 PacketType; int16 PacketLength; uint8 type; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ItemID; #else uint16 ItemID; @@ -1115,7 +1115,7 @@ struct packet_roulette_open_ack { int32 Serial; int8 Step; int8 Idx; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 AdditionItemID; #else uint16 AdditionItemID; @@ -1153,7 +1153,7 @@ struct packet_roulette_generate_ack { uint8 Result; uint16 Step; uint16 Idx; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 AdditionItemID; #else uint16 AdditionItemID; @@ -1171,7 +1171,7 @@ struct packet_roulette_itemrecv_req { struct packet_roulette_itemrecv_ack { int16 PacketType; uint8 Result; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 AdditionItemID; #else uint16 AdditionItemID; @@ -1376,7 +1376,7 @@ struct packet_npc_market_purchase { int16 PacketType; int16 PacketLength; struct { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -1390,7 +1390,7 @@ struct packet_npc_market_result_ack { int16 PacketLength; uint8 result; struct { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -1405,7 +1405,7 @@ struct packet_npc_market_open { int16 PacketLength; /* inner struct figured by Ind after some annoying hour of debugging (data Thanks to Yommy) */ struct { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 nameid; #else uint16 nameid; @@ -1530,7 +1530,7 @@ struct PACKET_ZC_ADD_ITEM_TO_MAIL { int8 result; int16 index; int16 count; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -1548,7 +1548,7 @@ struct PACKET_ZC_ADD_ITEM_TO_MAIL { struct mail_item { int16 count; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -1961,7 +1961,7 @@ struct PACKET_ZC_UI_ACTION { struct PACKET_CZ_PRIVATE_AIRSHIP_REQUEST { int16 PacketType; char mapName[MAP_NAME_LENGTH_EXT]; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ItemID; #else uint16 ItemID; @@ -2007,7 +2007,7 @@ struct pet_evolution_items { struct PACKET_CZ_PET_EVOLUTION { int16 PacketType; uint16 PacketLength; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 EvolvedPetEggID; #else uint16 EvolvedPetEggID; @@ -2041,7 +2041,7 @@ struct PACKET_ZC_NOTIFY_PLAYERCHAT { struct PACKET_ZC_ITEM_ENTRY { int16 packetType; uint32 AID; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2058,7 +2058,7 @@ struct PACKET_ZC_ADD_ITEM_TO_STORE { int16 packetType; int16 index; int32 amount; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2077,7 +2077,7 @@ struct PACKET_ZC_ADD_ITEM_TO_STORE { struct PACKET_ZC_MVP_GETTING_ITEM { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2087,7 +2087,7 @@ struct PACKET_ZC_MVP_GETTING_ITEM { struct PACKET_ZC_ACK_TOUSESKILL { int16 packetType; uint16 skillId; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 int32 btype; uint32 itemId; #else @@ -2102,7 +2102,7 @@ struct PACKET_ZC_ADD_ITEM_TO_CART { int16 packetType; int16 index; int32 amount; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2121,7 +2121,7 @@ struct PACKET_ZC_ADD_ITEM_TO_CART { struct PACKET_CZ_REQMAKINGITEM { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint32 material[3]; #else @@ -2133,7 +2133,7 @@ struct PACKET_CZ_REQMAKINGITEM { struct PACKET_ZC_ACK_REQMAKINGITEM { int16 packetType; int16 result; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2143,7 +2143,7 @@ struct PACKET_ZC_ACK_REQMAKINGITEM { struct PACKET_ZC_FEED_PET { int16 packetType; uint8 result; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2153,7 +2153,7 @@ struct PACKET_ZC_FEED_PET { struct PACKET_ZC_FEED_MER { int16 packetType; uint8 result; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2163,7 +2163,7 @@ struct PACKET_ZC_FEED_MER { struct PACKET_ZC_USE_ITEM_ACK { int16 packetType; int16 index; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint32 AID; #elif PACKETVER >= 3 @@ -2178,7 +2178,7 @@ struct PACKET_ZC_SPRITE_CHANGE { int16 packetType; uint32 AID; uint8 type; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 val; uint32 val2; #elif PACKETVER >= 4 @@ -2191,7 +2191,7 @@ struct PACKET_ZC_SPRITE_CHANGE { struct PACKET_ZC_ADD_EXCHANGE_ITEM { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint8 itemType; int32 amount; @@ -2214,7 +2214,7 @@ struct PACKET_ZC_ADD_EXCHANGE_ITEM { struct PACKET_ZC_CASH_TIME_COUNTER { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2225,7 +2225,7 @@ struct PACKET_ZC_CASH_TIME_COUNTER { struct PACKET_ZC_CASH_ITEM_DELETE { int16 packetType; uint16 index; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2235,7 +2235,7 @@ struct PACKET_ZC_CASH_ITEM_DELETE { struct PACKET_ZC_ITEM_PICKUP_PARTY { int16 packetType; uint32 AID; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2250,7 +2250,7 @@ struct PACKET_ZC_ITEM_PICKUP_PARTY { struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2269,7 +2269,7 @@ struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE { struct PACKET_ZC_ACK_WEAPONREFINE { int16 packetType; int32 result; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2284,7 +2284,7 @@ struct PACKET_ZC_PROPERTY_HOMUN { uint16 level; uint16 hunger; uint16 intimacy; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2315,7 +2315,7 @@ struct PACKET_ZC_PROPERTY_HOMUN { struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER { int16 packetType; uint16 result; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2325,7 +2325,7 @@ struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER { struct PACKET_CZ_REQ_ITEMREPAIR { int16 packetType; int16 index; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2337,7 +2337,7 @@ struct PACKET_CZ_REQ_ITEMREPAIR { struct PACKET_CZ_REQ_MAKINGITEM { int16 packetType; int16 type; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2348,7 +2348,7 @@ struct PACKET_CZ_SSILIST_ITEM_CLICK { int16 packetType; uint32 AID; uint32 storeId; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2356,7 +2356,7 @@ struct PACKET_CZ_SSILIST_ITEM_CLICK { } __attribute__((packed)); struct PACKET_ZC_ACK_SCHEDULER_CASHITEM_sub { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2377,7 +2377,7 @@ struct PACKET_ZC_PC_PURCHASE_MYITEMLIST_sub { int16 index; int16 amount; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2402,7 +2402,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST_sub { uint32 price; uint32 discountPrice; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2417,7 +2417,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST { struct PACKET_CZ_PC_PURCHASE_ITEMLIST_sub { uint16 amount; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2431,7 +2431,7 @@ struct PACKET_CZ_PC_PURCHASE_ITEMLIST { } __attribute__((packed)); struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2453,7 +2453,7 @@ struct PACKET_ZC_MYITEMLIST_BUYING_STORE_sub { uint32 price; uint16 amount; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2473,7 +2473,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST_FROMMC_sub { uint16 amount; int16 index; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2506,7 +2506,7 @@ struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE_sub { uint32 price; uint16 amount; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2524,7 +2524,7 @@ struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE { struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub { int16 index; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2541,7 +2541,7 @@ struct PACKET_CZ_REQ_TRADE_BUYING_STORE { } __attribute__((packed)); struct PACKET_ZC_MAKABLEITEMLIST_sub { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint32 material[3]; #else @@ -2557,7 +2557,7 @@ struct PACKET_ZC_MAKABLEITEMLIST { } __attribute__((packed)); struct PACKET_ZC_MAKINGARROW_LIST_sub { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2572,7 +2572,7 @@ struct PACKET_ZC_MAKINGARROW_LIST { struct PACKET_ZC_REPAIRITEMLIST_sub { int16 index; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2589,7 +2589,7 @@ struct PACKET_ZC_REPAIRITEMLIST { struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub { int16 index; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2605,7 +2605,7 @@ struct PACKET_ZC_NOTIFY_WEAPONITEMLIST { } __attribute__((packed)); struct PACKET_ZC_MAKINGITEM_LIST_sub { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2615,7 +2615,7 @@ struct PACKET_ZC_MAKINGITEM_LIST_sub { struct PACKET_ZC_MAKINGITEM_LIST { int16 packetType; int16 packetLength; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 makeItem; #else uint16 makeItem; @@ -2627,7 +2627,7 @@ struct PACKET_ZC_PC_CASH_POINT_ITEMLIST_sub { uint32 price; uint32 discountPrice; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2646,7 +2646,7 @@ struct PACKET_ZC_PC_CASH_POINT_ITEMLIST { struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub { uint16 amount; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2670,7 +2670,7 @@ struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM { } __attribute__((packed)); struct PACKET_CZ_SEARCH_STORE_INFO_item { -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2695,7 +2695,7 @@ struct PACKET_ZC_SEARCH_STORE_INFO_ACK_sub { uint32 storeId; uint32 AID; char shopName[MESSAGE_SIZE]; -#if PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; -- cgit v1.2.3-70-g09d2 From c76f8ded8743966abe10a15a3a03604d76d2d5df Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Nov 2018 05:57:43 +0300 Subject: Add packet ZC_ENCHANT_EQUIPMENT --- src/map/clif.c | 16 ++++++++++++++++ src/map/clif.h | 1 + src/map/packets_struct.h | 15 +++++++++++++++ 3 files changed, 32 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 19f7a082a..00d3d8908 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -21991,6 +21991,21 @@ static void clif_item_preview(struct map_session_data *sd, int n) #endif } +// insert cardId into equipped item in pos equipment slot into slot cardSlot. +static void clif_enchant_equipment(struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId) +{ +#if PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO) + nullpo_retv(sd); + Assert_retv(cardSlot >= 0 && cardSlot <= 3); + struct PACKET_ZC_ENCHANT_EQUIPMENT p; + p.packetType = HEADER_ZC_ENCHANT_EQUIPMENT; + p.wearState = pos; + p.cardSlot = cardSlot; + p.itemId = cardId; + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -23157,6 +23172,7 @@ void clif_defaults(void) clif->camera_showWindow = clif_camera_showWindow; clif->camera_change = clif_camera_change; clif->item_preview = clif_item_preview; + clif->enchant_equipment = clif_enchant_equipment; // -- Pet Evolution clif->pPetEvolution = clif_parse_pet_evolution; diff --git a/src/map/clif.h b/src/map/clif.h index 593dc15c1..088e7827e 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1554,6 +1554,7 @@ struct clif_interface { void (*camera_showWindow) (struct map_session_data *sd); void (*camera_change) (struct map_session_data *sd, float range, float rotation, float latitude, enum send_target target); void (*item_preview) (struct map_session_data *sd, int n); + void (*enchant_equipment) (struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId); }; #ifdef HERCULES_CORE diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 357627ce7..c1b93e781 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2919,6 +2919,21 @@ DEFINE_PACKET_HEADER(ZC_ITEM_PREVIEW, 0x0ab9); #endif // PACKETVER_MAIN_NUM >= 20181017 || PACKETVER_RE_NUM >= 20181017 || PACKETVER_ZERO_NUM >= 20181024 #endif // PACKETVER_MAIN_NUM >= 20170726 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO) +#if PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO) +struct PACKET_ZC_ENCHANT_EQUIPMENT { + int16 packetType; + int16 wearState; + int16 cardSlot; +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 + int32 itemId; +#else + int16 itemId; +#endif + int8 equipFlag; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ENCHANT_EQUIPMENT, 0x0a3f); +#endif // PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO) + #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 -- cgit v1.2.3-70-g09d2 From 2d33d766bd7ea81eb40c15fe45d59ab155b16fde Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Nov 2018 20:40:33 +0300 Subject: Add script command for insert cards into equipped items. enchantitem(, , ) --- doc/script_commands.txt | 11 +++++++++++ src/map/clif.c | 9 ++++++--- src/map/clif.h | 2 +- src/map/script.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 90d4d77cc..b88ff8809 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10237,3 +10237,14 @@ Update already opened preview window with item from Works for 20181017 RE and main clients or newer. --------------------------------------- + +*enchantitem(, , ); + +Insert card into equipped item in EQI_* slot. +card_slot - can be 0 to 3. +card_id - any card item id. + +returns true if all parameters correct +false in other case. +Works for 20160831 main, 20151118 RE, any zero version +--------------------------------------- diff --git a/src/map/clif.c b/src/map/clif.c index 00d3d8908..4d298f520 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -21992,17 +21992,20 @@ static void clif_item_preview(struct map_session_data *sd, int n) } // insert cardId into equipped item in pos equipment slot into slot cardSlot. -static void clif_enchant_equipment(struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId) +static bool clif_enchant_equipment(struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId) { #if PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO) - nullpo_retv(sd); - Assert_retv(cardSlot >= 0 && cardSlot <= 3); + nullpo_ret(sd); + Assert_ret(cardSlot >= 0 && cardSlot < MAX_SLOTS); struct PACKET_ZC_ENCHANT_EQUIPMENT p; p.packetType = HEADER_ZC_ENCHANT_EQUIPMENT; p.wearState = pos; p.cardSlot = cardSlot; p.itemId = cardId; clif->send(&p, sizeof(p), &sd->bl, SELF); + return true; +#else + return false; #endif } diff --git a/src/map/clif.h b/src/map/clif.h index 088e7827e..2aab4c227 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1554,7 +1554,7 @@ struct clif_interface { void (*camera_showWindow) (struct map_session_data *sd); void (*camera_change) (struct map_session_data *sd, float range, float rotation, float latitude, enum send_target target); void (*item_preview) (struct map_session_data *sd, int n); - void (*enchant_equipment) (struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId); + bool (*enchant_equipment) (struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId); }; #ifdef HERCULES_CORE diff --git a/src/map/script.c b/src/map/script.c index 41f21cd72..4760fd4a0 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24790,6 +24790,56 @@ static BUILDIN(itempreview) return true; } +// insert or remove card into equipped item +static BUILDIN(enchantitem) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + const int pos = script_getnum(st, 2); + if ((pos < EQI_ACC_L || pos > EQI_HAND_R) && pos != EQI_AMMO) { + ShowError("Wrong equip position: %d\n", pos); + script->reportfunc(st); + script->reportsrc(st); + script_pushint(st, false); + return true; + } + const int cardId = script_getnum(st, 4); + struct item_data *it = itemdb->exists(cardId); + if (it == NULL || it->type != IT_CARD) { + ShowError("Item id is not card or not exists: %d\n", cardId); + script->reportfunc(st); + script->reportsrc(st); + script_pushint(st, false); + return true; + } + const int n = sd->equip_index[pos]; + if (n < 0) { + ShowError("Item in equipment slot %d is not equipped\n", pos); + script->reportfunc(st); + script->reportsrc(st); + script_pushint(st, false); + return true; + } + const int cardSlot = script_getnum(st, 3); + if (cardSlot < 0 || cardSlot >= MAX_SLOTS) { + ShowError("Wrong card slot %d. Must be in range 0-3.\n", cardSlot); + script->reportfunc(st); + script->reportsrc(st); + script_pushint(st, false); + return true; + } + const bool res = clif->enchant_equipment(sd, pc->equip_pos[pos], cardSlot, cardId); + if (res) { + logs->pick_pc(sd, LOG_TYPE_CARD, -1, &sd->status.inventory[n],sd->inventory_data[n]); + sd->status.inventory[n].card[cardSlot] = cardId; + logs->pick_pc(sd, LOG_TYPE_CARD, 1, &sd->status.inventory[n],sd->inventory_data[n]); + status_calc_pc(sd, SCO_NONE); + } + script_pushint(st, res); + return true; +} + /** * Adds a built-in script function. * @@ -25528,6 +25578,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(changecamera, "iii?"), BUILDIN_DEF(itempreview, "i"), + BUILDIN_DEF(enchantitem, "iii"), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up -- cgit v1.2.3-70-g09d2 From 15f51b36f4eb881b33bd56b434ba181d3add754d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Nov 2018 21:25:51 +0300 Subject: Add some missing checks for inventory index variable. --- src/map/clif.c | 1 + src/map/pc.c | 1 + 2 files changed, 2 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 4d298f520..3f45c7aca 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3824,6 +3824,7 @@ static void clif_equipitemack(struct map_session_data *sd, int n, int pos, enum p.index = n+2; p.wearLocation = pos; #if PACKETVER >= 20100629 + Assert_retv(n >= 0 && n < MAX_INVENTORY); if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&EQP_VISIBLE) p.wItemSpriteNumber = sd->inventory_data[n]->view_sprite; else diff --git a/src/map/pc.c b/src/map/pc.c index fcd36a233..0a2508f29 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1073,6 +1073,7 @@ static int pc_isequip(struct map_session_data *sd, int n) struct item_data *item; nullpo_ret(sd); + Assert_ret(n >= 0 && n < MAX_INVENTORY); item = sd->inventory_data[n]; -- cgit v1.2.3-70-g09d2 From a3b66189064b5b7ec2be2caf6d2ae42c5d9a7851 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 26 Nov 2018 07:28:28 +0300 Subject: Add missing enum values into roulette generate ack packet. --- src/map/clif.c | 2 +- src/map/clif.h | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 3f45c7aca..d27d659b2 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -20083,7 +20083,7 @@ static bool clif_parse_roulette_db(void) /** * **/ -static void clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID) +static void clif_roulette_generate_ack(struct map_session_data *sd, enum GENERATE_ROULETTE_ACK result, short stage, short prizeIdx, int bonusItemID) { #if PACKETVER >= 20140612 struct packet_roulette_generate_ack p; diff --git a/src/map/clif.h b/src/map/clif.h index 2aab4c227..7f3dc204d 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -493,10 +493,14 @@ enum RECV_ROULETTE_ITEM_ACK { }; enum GENERATE_ROULETTE_ACK { - GENERATE_ROULETTE_SUCCESS = 0x0, - GENERATE_ROULETTE_FAILED = 0x1, - GENERATE_ROULETTE_NO_ENOUGH_POINT = 0x2, - GENERATE_ROULETTE_LOSING = 0x3, + GENERATE_ROULETTE_SUCCESS = 0x0, + GENERATE_ROULETTE_FAILED = 0x1, + GENERATE_ROULETTE_NO_ENOUGH_POINT = 0x2, + GENERATE_ROULETTE_LOSING = 0x3, + GENERATE_ROULETTE_NO_ENOUGH_INVENTORY_SPACE = 0x4, +#if PACKETVER >= 20141001 + GENERATE_ROULETTE_CANT_PLAY = 0x5, +#endif }; enum OPEN_ROULETTE_ACK{ @@ -1219,7 +1223,7 @@ struct clif_interface { void (*npc_market_purchase_ack) (struct map_session_data *sd, const struct itemlist *item_list, unsigned char response); /* */ bool (*parse_roulette_db) (void); - void (*roulette_generate_ack) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID); + void (*roulette_generate_ack) (struct map_session_data *sd, enum GENERATE_ROULETTE_ACK result, short stage, short prizeIdx, int bonusItemID); /* Merge Items */ void (*openmergeitem) (int fd, struct map_session_data *sd); void (*cancelmergeitem) (int fd, struct map_session_data *sd); -- cgit v1.2.3-70-g09d2 From cde8cf6b18c124f5453451276c9978141271e6d3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 26 Nov 2018 07:58:45 +0300 Subject: Use enum OPEN_ROULETTE_ACK in roulette open ack packet. --- src/map/clif.c | 2 +- src/map/clif.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index d27d659b2..da8ba3a95 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -19824,7 +19824,7 @@ static void clif_parse_RouletteOpen(int fd, struct map_session_data *sd) } p.PacketType = 0xa1a; - p.Result = 0; + p.Result = OPEN_ROULETTE_SUCCESS; p.Serial = 0; p.Step = sd->roulette.stage - 1; p.Idx = (char)sd->roulette.prizeIdx; diff --git a/src/map/clif.h b/src/map/clif.h index 7f3dc204d..c8db1a0fd 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -503,7 +503,7 @@ enum GENERATE_ROULETTE_ACK { #endif }; -enum OPEN_ROULETTE_ACK{ +enum OPEN_ROULETTE_ACK { OPEN_ROULETTE_SUCCESS = 0x0, OPEN_ROULETTE_FAILED = 0x1, }; -- cgit v1.2.3-70-g09d2 From d9c56ea3e0722aec976baa2366b93eb0b86b991b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 26 Nov 2018 20:07:35 +0300 Subject: Fix packet ZC_PROPERTY_HOMUN for old clients. --- src/map/clif.c | 4 +++- src/map/packets_struct.h | 46 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 11 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index da8ba3a95..82ced2d24 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1627,6 +1627,7 @@ static bool clif_spawn(struct block_list *bl) /// 022e .24B .B .W .W .W .W .W .W .W .W .W .W .W .W .W .W .W .W .L .L .W .W static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { +#if PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO_NUM) struct status_data *hstatus; enum homun_type htype; struct PACKET_ZC_PROPERTY_HOMUN p; @@ -1638,7 +1639,7 @@ static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int htype = homun->class2type(hd->homunculus.class_); memset(&p, 0, sizeof(p)); - p.packetType = hominfoType; + p.packetType = HEADER_ZC_PROPERTY_HOMUN; memcpy(p.name, hd->homunculus.name, NAME_LENGTH); // Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true) p.flags = (!battle_config.hom_rename && hd->homunculus.rename_flag ? 0x1 : 0x0) | (hd->homunculus.vaporize == HOM_ST_REST ? 0x2 : 0) | (hd->homunculus.hp > 0 ? 0x4 : 0); @@ -1704,6 +1705,7 @@ static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int p.skillPoints = hd->homunculus.skillpts; p.range = status_get_range(&hd->bl); clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif } /// Notification about a change in homunuculus' state (ZC_CHANGESTATE_MER). diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index c1b93e781..1f4df6fc9 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -417,12 +417,6 @@ enum packet_headers { buyingStoreUpdateItemType = 0x9e6, #else buyingStoreUpdateItemType = 0x81b, -#endif -// probably can works also for < 20141223, but in 3CeaM packet size defined only for 20150513 -#if PACKETVER >= 20150513 - hominfoType = 0x9f7, -#else - hominfoType = 0x22e, #endif reqName = 0x95, #if PACKETVER >= 20150503 // Confirm this? @@ -2276,6 +2270,8 @@ struct PACKET_ZC_ACK_WEAPONREFINE { #endif } __attribute__((packed)); +#if PACKETVER_MAIN_NUM >= 20131230 || PACKETVER_RE_NUM >= 20131230 || defined(PACKETVER_ZERO_NUM) +// PACKET_ZC_PROPERTY_HOMUN2 struct PACKET_ZC_PROPERTY_HOMUN { int16 packetType; char name[NAME_LENGTH]; @@ -2297,13 +2293,41 @@ struct PACKET_ZC_PROPERTY_HOMUN { uint16 mdef; uint16 flee; uint16 amotion; -#if PACKETVER < 20150513 - uint16 hp; - uint16 maxHp; -#else uint32 hp; uint32 maxHp; + uint16 sp; + uint16 maxSp; + uint32 exp; + uint32 expNext; + uint16 skillPoints; + uint16 range; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_PROPERTY_HOMUN, 0x09f7); +#elif PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO_NUM) +// PACKET_ZC_PROPERTY_HOMUN1 +struct PACKET_ZC_PROPERTY_HOMUN { + int16 packetType; + char name[NAME_LENGTH]; + // Bit field, bit 0 : rename_flag (1 = already renamed), bit 1 : homunc vaporized (1 = true), bit 2 : homunc dead (1 = true) + uint8 flags; + uint16 level; + uint16 hunger; + uint16 intimacy; +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 + uint32 itemId; +#else + uint16 itemId; #endif + uint16 atk2; + uint16 matk; + uint16 hit; + uint16 crit; + uint16 def; + uint16 mdef; + uint16 flee; + uint16 amotion; + uint16 hp; + uint16 maxHp; uint16 sp; uint16 maxSp; uint32 exp; @@ -2311,6 +2335,8 @@ struct PACKET_ZC_PROPERTY_HOMUN { uint16 skillPoints; uint16 range; } __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_PROPERTY_HOMUN, 0x022e); +#endif struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER { int16 packetType; -- cgit v1.2.3-70-g09d2 From 5c29241d2d4bc43184faeedd7c1ffe3af8753fc9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 27 Nov 2018 04:38:34 +0300 Subject: Add packet ZC_SERVICE_MESSAGE_COLOR --- src/map/clif.c | 29 +++++++++++++++++++++++++++++ src/map/clif.h | 1 + src/map/packets_struct.h | 10 ++++++++++ 3 files changed, 40 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 82ced2d24..df7b3839b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8971,6 +8971,34 @@ static void clif_messagecolor(struct block_list *bl, uint32 color, const char *m clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); } +// Message without owner, not logged in chat +static void clif_serviceMessageColor(struct map_session_data *sd, uint32 color, const char *msg) +{ +#if PACKETVER_MAIN_NUM >= 20170830 || PACKETVER_RE_NUM >= 20170830 || defined(PACKETVER_ZERO) + nullpo_retv(sd); + nullpo_retv(msg); + + int msg_len = (int)strlen(msg) + 1; + + if (msg_len > 512) { + ShowWarning("clif_serviceMessageColor: Truncating too long message '%s' (len=%d).\n", msg, msg_len); + msg_len = 512; + } + + const int len = sizeof(struct PACKET_ZC_SERVICE_MESSAGE_COLOR) + msg_len; + const int fd = sd->fd; + WFIFOHEAD(fd, len); + struct PACKET_ZC_SERVICE_MESSAGE_COLOR *p = WFIFOP(fd, 0); + + p->packetType = HEADER_ZC_SERVICE_MESSAGE_COLOR; + p->packetLength = len; + p->color = RGB2BGR(color); + safestrncpy(p->message, msg, msg_len); + + WFIFOSET(fd, len); +#endif +} + /** * Notifies the client that the storage window is still open * @@ -22592,6 +22620,7 @@ void clif_defaults(void) clif->broadcast2 = clif_broadcast2; clif->messagecolor_self = clif_messagecolor_self; clif->messagecolor = clif_messagecolor; + clif->serviceMessageColor = clif_serviceMessageColor; clif->disp_overhead = clif_disp_overhead; clif->notify_playerchat = clif_notify_playerchat; clif->msgtable_skill = clif_msgtable_skill; diff --git a/src/map/clif.h b/src/map/clif.h index c8db1a0fd..be127a54f 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -972,6 +972,7 @@ struct clif_interface { void (*broadcast2) (struct block_list *bl, const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target); void (*messagecolor_self) (int fd, uint32 color, const char *msg); void (*messagecolor) (struct block_list* bl, uint32 color, const char* msg); + void (*serviceMessageColor) (struct map_session_data *sd, uint32 color, const char *msg); void (*disp_overhead) (struct block_list *bl, const char *mes, enum send_target target, struct block_list *target_bl); void (*notify_playerchat) (struct block_list *bl, const char *mes); void (*msgtable) (struct map_session_data* sd, enum clif_messages msg_id); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 1f4df6fc9..5c9a60465 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2960,6 +2960,16 @@ struct PACKET_ZC_ENCHANT_EQUIPMENT { DEFINE_PACKET_HEADER(ZC_ENCHANT_EQUIPMENT, 0x0a3f); #endif // PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO) +#if PACKETVER_MAIN_NUM >= 20170830 || PACKETVER_RE_NUM >= 20170830 || defined(PACKETVER_ZERO) +struct PACKET_ZC_SERVICE_MESSAGE_COLOR { + int16 packetType; + int16 packetLength; + int32 color; + char message[]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_SERVICE_MESSAGE_COLOR, 0x0adb); +#endif + #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 -- cgit v1.2.3-70-g09d2 From eaeebdc9ddaa62488a58885c6a20b43d67e43d4a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 27 Nov 2018 05:40:22 +0300 Subject: Add script command servicemessage. This command will show colored message in chat. This message will be not logged to file and will be not visible over head. --- doc/script_commands.txt | 10 ++++++++++ src/map/script.c | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'src/map') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index b88ff8809..0096cedfd 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10248,3 +10248,13 @@ returns true if all parameters correct false in other case. Works for 20160831 main, 20151118 RE, any zero version --------------------------------------- + +*servicemessage("", {, }) +*servicemessage("", {, }) + +That command will send a service message to the chat window of the character +specified by account ID or name, or to connected to npc player. +It will not be seen by anyone else. + +Works fro 20170830 RE and main and for any zero clients +--------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index 4760fd4a0..52c0cf75c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15678,6 +15678,29 @@ static BUILDIN(message) return true; } +static BUILDIN(servicemessage) +{ + struct map_session_data *sd = NULL; + + if (script_hasdata(st, 4)) { + if (script_isstringtype(st, 4)) + sd = script->nick2sd(st, script_getstr(st, 4)); + else + sd = script->id2sd(st, script_getnum(st, 4)); + } else { + sd = script->rid2sd(st); + } + + if (sd == NULL) + return true; + + const char *message = script_getstr(st, 2); + const int color = script_getnum(st, 3); + clif->serviceMessageColor(sd, color, message); + + return true; +} + /*========================================== * npctalk (sends message to surrounding area) * usage: npctalk(""{, ""{, }}); @@ -25244,6 +25267,7 @@ static void script_parse_builtin(void) BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr] BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr] BUILDIN_DEF(message,"vs"), // [MouseJstr] + BUILDIN_DEF(servicemessage, "si?"), BUILDIN_DEF(npctalk,"s??"), // [Valaris][Murilo BiO] BUILDIN_DEF(mobcount,"ss"), BUILDIN_DEF(getlook,"i"), -- cgit v1.2.3-70-g09d2 From b0143067c797a502ffe2cf122fa8e364a0634571 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 28 Nov 2018 20:53:50 +0300 Subject: Update packet ZC_AUTOSPELLLIST --- src/map/clif.c | 8 +++++--- src/map/packets_struct.h | 29 ++++++++++++----------------- 2 files changed, 17 insertions(+), 20 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index df7b3839b..9f56e0136 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7512,10 +7512,11 @@ static void clif_pet_food(struct map_session_data *sd, int foodid, int fail) /// 01cd { .L }*7 static void clif_autospell(struct map_session_data *sd, uint16 skill_lv) { +#if PACKETVER_MAIN_NUM >= 20090406 || defined(PACKETVER_RE) || defined(PACKETVER_ZERO) || PACKETVER_SAK_NUM >= 20080618 nullpo_retv(sd); int fd = sd->fd; -#if PACKETVER_RE_NUM >= 20181031 +#if PACKETVER_MAIN_NUM >= 20181128 || PACKETVER_RE_NUM >= 20181031 // reserve space for 7 skills WFIFOHEAD(fd, sizeof(struct PACKET_ZC_AUTOSPELLLIST) + 4 * 7); #else @@ -7523,7 +7524,7 @@ static void clif_autospell(struct map_session_data *sd, uint16 skill_lv) #endif struct PACKET_ZC_AUTOSPELLLIST *p = WFIFOP(fd, 0); memset(p, 0, sizeof(struct PACKET_ZC_AUTOSPELLLIST)); - p->packetType = autoSpellList; + p->packetType = HEADER_ZC_AUTOSPELLLIST; int index = 0; if (skill_lv > 0 && pc->checkskill(sd, MG_NAPALMBEAT) > 0) @@ -7541,7 +7542,7 @@ static void clif_autospell(struct map_session_data *sd, uint16 skill_lv) if (skill_lv > 9 && pc->checkskill(sd, MG_FROSTDIVER) > 0) p->skills[index++] = MG_FROSTDIVER; -#if PACKETVER_RE_NUM >= 20181031 +#if PACKETVER_MAIN_NUM >= 20181128 || PACKETVER_RE_NUM >= 20181031 const int len = sizeof(struct PACKET_ZC_AUTOSPELLLIST) + index * 4; p->packetLength = len; #else @@ -7551,6 +7552,7 @@ static void clif_autospell(struct map_session_data *sd, uint16 skill_lv) sd->menuskill_id = SA_AUTOSPELL; sd->menuskill_val = skill_lv; +#endif } /// Devotion's visual effect (ZC_DEVOTIONLIST). diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 5c9a60465..0542021ec 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -441,11 +441,6 @@ enum packet_headers { #else guildLeave = 0x15a, #endif -#if PACKETVER_RE_NUM >= 20181031 - autoSpellList = 0xafb, -#else - autoSpellList = 0x1cd, -#endif }; #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute @@ -2904,22 +2899,22 @@ struct PACKET_ZC_CAMERA_INFO { float latitude; } __attribute__((packed)); -#if PACKETVER_RE_NUM >= 20181031 -#define PACKET_ZC_AUTOSPELLLIST PACKET_ZC_AUTOSPELLLIST2 -#else -#define PACKET_ZC_AUTOSPELLLIST PACKET_ZC_AUTOSPELLLIST1 -#endif - -struct PACKET_ZC_AUTOSPELLLIST1 { - int16 packetType; - int skills[7]; -} __attribute__((packed)); - -struct PACKET_ZC_AUTOSPELLLIST2 { +#if PACKETVER_MAIN_NUM >= 20181128 || PACKETVER_RE_NUM >= 20181031 +// PACKET_ZC_AUTOSPELLLIST2 +struct PACKET_ZC_AUTOSPELLLIST { int16 packetType; int16 packetLength; int skills[]; } __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_AUTOSPELLLIST, 0x0afb); +#elif PACKETVER_MAIN_NUM >= 20090406 || defined(PACKETVER_RE) || defined(PACKETVER_ZERO) || PACKETVER_SAK_NUM >= 20080618 +// PACKET_ZC_AUTOSPELLLIST1 +struct PACKET_ZC_AUTOSPELLLIST { + int16 packetType; + int skills[7]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_AUTOSPELLLIST, 0x01cd); +#endif #if PACKETVER_MAIN_NUM >= 20170726 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO) #if PACKETVER_MAIN_NUM >= 20181017 || PACKETVER_RE_NUM >= 20181017 || PACKETVER_ZERO_NUM >= 20181024 -- cgit v1.2.3-70-g09d2 From 63f57fa5c3944ba7759f84361dd42391709f21c8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 28 Nov 2018 22:06:11 +0300 Subject: Remove typedef from clr_type. --- src/map/clif.c | 8 ++++---- src/map/clif.h | 10 +++++----- src/map/pc.c | 6 +++--- src/map/pc.h | 6 +++--- src/map/unit.c | 8 ++++---- src/map/unit.h | 8 ++++---- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 9f56e0136..e76e9f852 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -890,7 +890,7 @@ static void clif_clearflooritem(struct flooritem_data *fitem, int fd) /// 2 = logged out /// 3 = teleport /// 4 = trickdead -static void clif_clearunit_single(int id, clr_type type, int fd) +static void clif_clearunit_single(int id, enum clr_type type, int fd) { WFIFOHEAD(fd, packet_len(0x80)); WFIFOW(fd,0) = 0x80; @@ -907,7 +907,7 @@ static void clif_clearunit_single(int id, clr_type type, int fd) /// 2 = logged out /// 3 = teleport /// 4 = trickdead -static void clif_clearunit_area(struct block_list *bl, clr_type type) +static void clif_clearunit_area(struct block_list *bl, enum clr_type type) { unsigned char buf[8]; @@ -936,12 +936,12 @@ static void clif_clearunit_area(struct block_list *bl, clr_type type) static int clif_clearunit_delayed_sub(int tid, int64 tick, int id, intptr_t data) { struct block_list *bl = (struct block_list *)data; - clif->clearunit_area(bl, (clr_type) id); + clif->clearunit_area(bl, (enum clr_type) id); ers_free(clif->delay_clearunit_ers,bl); return 0; } -static void clif_clearunit_delayed(struct block_list *bl, clr_type type, int64 tick) +static void clif_clearunit_delayed(struct block_list *bl, enum clr_type type, int64 tick) { struct block_list *tbl; diff --git a/src/map/clif.h b/src/map/clif.h index be127a54f..446abe8e3 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -237,13 +237,13 @@ typedef enum emotion_type { E_MAX } emotion_type; -typedef enum clr_type { +enum clr_type { CLR_OUTSIGHT = 0, CLR_DEAD, CLR_RESPAWN, CLR_TELEPORT, CLR_TRICKDEAD, -} clr_type; +}; enum map_property { // clif_map_property MAPPROPERTY_NOTHING = 0, @@ -756,9 +756,9 @@ struct clif_interface { void (*package_announce) (struct map_session_data *sd, int nameid, int containerid); void (*item_drop_announce) (struct map_session_data *sd, int nameid, char *monsterName); /* unit-related */ - void (*clearunit_single) (int id, clr_type type, int fd); - void (*clearunit_area) (struct block_list* bl, clr_type type); - void (*clearunit_delayed) (struct block_list* bl, clr_type type, int64 tick); + void (*clearunit_single) (int id, enum clr_type type, int fd); + void (*clearunit_area) (struct block_list* bl, enum clr_type type); + void (*clearunit_delayed) (struct block_list* bl, enum clr_type type, int64 tick); void (*walkok) (struct map_session_data *sd); void (*move) (struct unit_data *ud); void (*move2) (struct block_list *bl, struct view_data *vd, struct unit_data *ud); diff --git a/src/map/pc.c b/src/map/pc.c index 0a2508f29..d9e297e84 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5707,7 +5707,7 @@ static int pc_steal_coin(struct map_session_data *sd, struct block_list *target, * 1 - Invalid map index. * 2 - Map not in this map-server, and failed to locate alternate map-server. *------------------------------------------*/ -static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int x, int y, clr_type clrtype) +static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int x, int y, enum clr_type clrtype) { int16 m; @@ -5947,7 +5947,7 @@ static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int * 0 = fail or FIXME success (from pc->setpos) * x(1|2) = fail *------------------------------------------*/ -static int pc_randomwarp(struct map_session_data *sd, clr_type type) +static int pc_randomwarp(struct map_session_data *sd, enum clr_type type) { int x,y,i=0; int16 m; @@ -7946,7 +7946,7 @@ static int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id) return bonus; } -static void pc_respawn(struct map_session_data *sd, clr_type clrtype) +static void pc_respawn(struct map_session_data *sd, enum clr_type clrtype) { if( !pc_isdead(sd) ) return; // not applicable diff --git a/src/map/pc.h b/src/map/pc.h index 8302279b1..cca15e829 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -905,7 +905,7 @@ END_ZEROED_BLOCK; /* End */ int (*setrestartvalue) (struct map_session_data *sd,int type); int (*makesavestatus) (struct map_session_data *sd); - void (*respawn) (struct map_session_data* sd, clr_type clrtype); + void (*respawn) (struct map_session_data* sd, enum clr_type clrtype); int (*setnewpc) (struct map_session_data *sd, int account_id, int char_id, int login_id1, unsigned int client_tick, int sex, int fd); bool (*authok) (struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, const struct mmo_charstatus *st, bool changing_mapservers); void (*authfail) (struct map_session_data *sd); @@ -927,9 +927,9 @@ END_ZEROED_BLOCK; /* End */ int (*calc_skilltree_normalize_job) (struct map_session_data *sd); int (*clean_skilltree) (struct map_session_data *sd); - int (*setpos) (struct map_session_data* sd, unsigned short map_index, int x, int y, clr_type clrtype); + int (*setpos) (struct map_session_data* sd, unsigned short map_index, int x, int y, enum clr_type clrtype); int (*setsavepoint) (struct map_session_data *sd, short map_index, int x, int y); - int (*randomwarp) (struct map_session_data *sd,clr_type type); + int (*randomwarp) (struct map_session_data *sd, enum clr_type type); int (*memo) (struct map_session_data* sd, int pos); int (*checkadditem) (struct map_session_data *sd,int nameid,int amount); diff --git a/src/map/unit.c b/src/map/unit.c index ee856cb76..68e6aeec1 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -918,7 +918,7 @@ static int unit_blown(struct block_list *bl, int dx, int dy, int count, int flag //Warps a unit/ud to a given map/position. //In the case of players, pc->setpos is used. //it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks. -static int unit_warp(struct block_list *bl, short m, short x, short y, clr_type type) +static int unit_warp(struct block_list *bl, short m, short x, short y, enum clr_type type) { struct unit_data *ud; nullpo_ret(bl); @@ -2419,7 +2419,7 @@ static int unit_changeviewsize(struct block_list *bl, short size) * Otherwise it is assumed bl is being warped. * On-Kill specific stuff is not performed here, look at status->damage for that. *------------------------------------------*/ -static int unit_remove_map(struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func) +static int unit_remove_map(struct block_list *bl, enum clr_type clrtype, const char *file, int line, const char *func) { struct unit_data *ud = unit->bl2ud(bl); struct status_change *sc = status->get_sc(bl); @@ -2665,7 +2665,7 @@ static int unit_remove_map(struct block_list *bl, clr_type clrtype, const char * return 1; } -static void unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype) +static void unit_remove_map_pc(struct map_session_data *sd, enum clr_type clrtype) { nullpo_retv(sd); unit->remove_map(&sd->bl,clrtype,ALC_MARK); @@ -2697,7 +2697,7 @@ static void unit_free_pc(struct map_session_data *sd) * Function to free all related resources to the bl * if unit is on map, it is removed using the clrtype specified *------------------------------------------*/ -static int unit_free(struct block_list *bl, clr_type clrtype) +static int unit_free(struct block_list *bl, enum clr_type clrtype) { struct unit_data *ud = unit->bl2ud( bl ); nullpo_ret(bl); diff --git a/src/map/unit.h b/src/map/unit.h index 0c1c2405c..5c01cdc2e 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -116,7 +116,7 @@ struct unit_interface { int (*setdir) (struct block_list *bl, unsigned char dir); uint8 (*getdir) (struct block_list *bl); int (*blown) (struct block_list *bl, int dx, int dy, int count, int flag); - int (*warp) (struct block_list *bl, short m, short x, short y, clr_type type); + int (*warp) (struct block_list *bl, short m, short x, short y, enum clr_type type); int (*stop_walking) (struct block_list *bl, int type); int (*skilluse_id) (struct block_list *src, int target_id, uint16 skill_id, uint16 skill_lv); int (*step_timer) (int tid, int64 tick, int id, intptr_t data); @@ -142,10 +142,10 @@ struct unit_interface { int (*counttargeted) (struct block_list *bl); int (*fixdamage) (struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2); int (*changeviewsize) (struct block_list *bl, short size); - int (*remove_map) (struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func); - void (*remove_map_pc) (struct map_session_data *sd, clr_type clrtype); + int (*remove_map) (struct block_list *bl, enum clr_type clrtype, const char *file, int line, const char *func); + void (*remove_map_pc) (struct map_session_data *sd, enum clr_type clrtype); void (*free_pc) (struct map_session_data *sd); - int (*free) (struct block_list *bl, clr_type clrtype); + int (*free) (struct block_list *bl, enum clr_type clrtype); }; #ifdef HERCULES_CORE -- cgit v1.2.3-70-g09d2 From 22c267cd1256902d24417cbc0cd5689bc7bad60d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 1 Dec 2018 19:47:45 +0300 Subject: Add packet CZ_START_USE_SKILL --- src/map/clif.c | 99 ++++++++++++++++++++++++++++-------------------- src/map/clif.h | 2 + src/map/packets.h | 4 ++ src/map/packets_struct.h | 10 +++++ 4 files changed, 74 insertions(+), 41 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index e76e9f852..a01b9f7c1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11999,33 +11999,24 @@ static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct unit->skilluse_pos(&md->bl, x, y, skill_id, skill_lv); } -static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); -/// Request to use a targeted skill. -/// 0113 .W .W .L (CZ_USE_SKILL) -/// 0438 .W .W .L (CZ_USE_SKILL2) -/// There are various variants of this packet, some of them have padding between fields. -static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +static void clif_useSkillToIdReal(int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id) __attribute__((nonnull (2))); +static void clif_useSkillToIdReal(int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id) { - uint16 skill_id, skill_lv; - int tmp, target_id; int64 tick = timer->gettick(); - skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]); - skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]); - target_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[2]); - - if( skill_lv < 1 ) skill_lv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex] + if (skill_lv < 1) + skill_lv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex] - tmp = skill->get_inf(skill_id); - if (tmp&INF_GROUND_SKILL || !tmp) + int tmp = skill->get_inf(skill_id); + if (tmp & INF_GROUND_SKILL || !tmp) return; //Using a ground/passive skill on a target? WRONG. - if( skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL ) { + if (skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL) { clif->pUseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id); return; } - if( skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL ) { + if (skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL) { clif->pUseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id); return; } @@ -12042,51 +12033,52 @@ static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) return; } - if( pc_cant_act(sd) - && skill_id != RK_REFRESH - && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) - && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) // SELF skills can be used with the storage open, issue: 8027 - ) + if (pc_cant_act(sd) + && skill_id != RK_REFRESH + && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) + && (sd->state.storage_flag != STORAGE_FLAG_CLOSED && !(tmp&INF_SELF_SKILL)) // SELF skills can be used with the storage open, issue: 8027 + ) { return; + } - if( pc_issit(sd) ) + if (pc_issit(sd)) return; - if( skill->not_ok(skill_id, sd) ) + if (skill->not_ok(skill_id, sd)) return; - if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) + if (sd->bl.id != target_id && tmp & INF_SELF_SKILL) target_id = sd->bl.id; // never trust the client - if( target_id < 0 && -target_id == sd->bl.id ) // for disguises [Valaris] + if (target_id < 0 && -target_id == sd->bl.id) // for disguises [Valaris] target_id = sd->bl.id; - if( sd->ud.skilltimer != INVALID_TIMER ) { - if( skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST ) + if (sd->ud.skilltimer != INVALID_TIMER) { + if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return; - } else if( DIFF_TICK(tick, sd->ud.canact_tick) < 0 ) { - if( sd->skillitem != skill_id ) { + } else if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) { + if (sd->skillitem != skill_id) { clif->skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0, 0); return; } } - if( sd->sc.option&OPTION_COSTUME ) + if (sd->sc.option & OPTION_COSTUME) return; - if( sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id) ) + if (sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id)) return; // On basilica only caster can use Basilica again to stop it. - if( sd->menuskill_id ) { - if( sd->menuskill_id == SA_TAMINGMONSTER ) { + if (sd->menuskill_id) { + if (sd->menuskill_id == SA_TAMINGMONSTER) { clif_menuskill_clear(sd); //Cancel pet capture. - } else if( sd->menuskill_id != SA_AUTOSPELL ) + } else if (sd->menuskill_id != SA_AUTOSPELL) return; //Can't use skills while a menu is open. } - if( sd->skillitem == skill_id ) { - if( skill_lv != sd->skillitemlv ) + if (sd->skillitem == skill_id) { + if (skill_lv != sd->skillitemlv) skill_lv = sd->skillitemlv; - if( !(tmp&INF_SELF_SKILL) ) + if (!(tmp&INF_SELF_SKILL)) pc->delinvincibletimer(sd); // Target skills through items cancel invincibility. [Inkfish] unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); return; @@ -12095,22 +12087,45 @@ static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) sd->skillitem = sd->skillitemlv = 0; if (skill_id >= GD_SKILLBASE && skill_id < GD_MAX) { - if( sd->state.gmaster_flag ) + if (sd->state.gmaster_flag) skill_lv = guild->checkskill(sd->guild, skill_id); else skill_lv = 0; } else { tmp = pc->checkskill(sd, skill_id); - if( skill_lv > tmp ) + if (skill_lv > tmp) skill_lv = tmp; } pc->delinvincibletimer(sd); - if( skill_lv ) + if (skill_lv) unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); } +static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +/// Request to use a targeted skill. +/// 0113 .W .W .L (CZ_USE_SKILL) +/// 0438 .W .W .L (CZ_USE_SKILL2) +/// There are various variants of this packet, some of them have padding between fields. +static void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) +{ + clif->useSkillToIdReal(fd, + sd, + RFIFOW(fd, packet_db[RFIFOW(fd, 0)].pos[1]), + RFIFOW(fd, packet_db[RFIFOW(fd, 0)].pos[0]), + RFIFOL(fd, packet_db[RFIFOW(fd, 0)].pos[2])); +} + +static void clif_parse_startUseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_startUseSkillToId(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010 + const struct PACKET_CZ_START_USE_SKILL *p = RFIFOP(fd, 0); + clif->useSkillToIdReal(fd, sd, p->skillId, p->skillLv, p->targetId); +#endif +} + /*========================================== * Client tells server he'd like to use AoE skill id 'skill_id' of level 'skill_lv' on 'x','y' location *------------------------------------------*/ @@ -22947,6 +22962,8 @@ void clif_defaults(void) clif->pUseSkillToId = clif_parse_UseSkillToId; clif->pUseSkillToId_homun = clif_parse_UseSkillToId_homun; clif->pUseSkillToId_mercenary = clif_parse_UseSkillToId_mercenary; + clif->pStartUseSkillToId = clif_parse_startUseSkillToId; + clif->useSkillToIdReal = clif_useSkillToIdReal; clif->pUseSkillToPos = clif_parse_UseSkillToPos; clif->pUseSkillToPosSub = clif_parse_UseSkillToPosSub; clif->pUseSkillToPos_homun = clif_parse_UseSkillToPos_homun; diff --git a/src/map/clif.h b/src/map/clif.h index 446abe8e3..faf752528 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1290,7 +1290,9 @@ struct clif_interface { void (*pChangeCart) (int fd,struct map_session_data *sd); void (*pStatusUp) (int fd,struct map_session_data *sd); void (*pSkillUp) (int fd,struct map_session_data *sd); + void (*useSkillToIdReal) (int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id); void (*pUseSkillToId) (int fd, struct map_session_data *sd); + void (*pStartUseSkillToId) (int fd, struct map_session_data *sd); void (*pUseSkillToId_homun) (struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id); void (*pUseSkillToId_mercenary) (struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id); void (*pUseSkillToPos) (int fd, struct map_session_data *sd); diff --git a/src/map/packets.h b/src/map/packets.h index 7dbd26a31..4fcb263a2 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1905,4 +1905,8 @@ packet(0x96e,clif->ackmergeitems); packet(0x0a49,clif->pPrivateAirshipRequest); // CZ_PRIVATE_AIRSHIP_REQUEST #endif +#if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010 + packet(0x0b10,clif->pStartUseSkillToId); +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 0542021ec..69df71791 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2965,6 +2965,16 @@ struct PACKET_ZC_SERVICE_MESSAGE_COLOR { DEFINE_PACKET_HEADER(ZC_SERVICE_MESSAGE_COLOR, 0x0adb); #endif +#if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010 +struct PACKET_CZ_START_USE_SKILL { + int16 packetType; + int16 skillId; + int16 skillLv; + uint32 targetId; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_START_USE_SKILL, 0x0b10); +#endif + #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 -- cgit v1.2.3-70-g09d2 From d50e10c533cb43d94abf27c7fbb8b5e6c73ce01f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 1 Dec 2018 20:03:46 +0300 Subject: Add packet CZ_STOP_USE_SKILL --- src/map/clif.c | 12 ++++++++++++ src/map/clif.h | 1 + src/map/packets.h | 1 + src/map/packets_struct.h | 6 ++++++ 4 files changed, 20 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index a01b9f7c1..362264226 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -12126,6 +12126,17 @@ static void clif_parse_startUseSkillToId(int fd, struct map_session_data *sd) #endif } +static void clif_parse_stopUseSkillToId(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_stopUseSkillToId(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010 + const struct PACKET_CZ_STOP_USE_SKILL *p = RFIFOP(fd, 0); + if (p->skillId != GC_ROLLINGCUTTER) { + ShowWarning("Packet CZ_STOP_USE_SKILL usage for unknown skill: %d\n", p->skillId); + } +#endif +} + /*========================================== * Client tells server he'd like to use AoE skill id 'skill_id' of level 'skill_lv' on 'x','y' location *------------------------------------------*/ @@ -22963,6 +22974,7 @@ void clif_defaults(void) clif->pUseSkillToId_homun = clif_parse_UseSkillToId_homun; clif->pUseSkillToId_mercenary = clif_parse_UseSkillToId_mercenary; clif->pStartUseSkillToId = clif_parse_startUseSkillToId; + clif->pStopUseSkillToId = clif_parse_stopUseSkillToId; clif->useSkillToIdReal = clif_useSkillToIdReal; clif->pUseSkillToPos = clif_parse_UseSkillToPos; clif->pUseSkillToPosSub = clif_parse_UseSkillToPosSub; diff --git a/src/map/clif.h b/src/map/clif.h index faf752528..147dcfee3 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1293,6 +1293,7 @@ struct clif_interface { void (*useSkillToIdReal) (int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id); void (*pUseSkillToId) (int fd, struct map_session_data *sd); void (*pStartUseSkillToId) (int fd, struct map_session_data *sd); + void (*pStopUseSkillToId) (int fd, struct map_session_data *sd); void (*pUseSkillToId_homun) (struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id); void (*pUseSkillToId_mercenary) (struct mercenary_data *md, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id); void (*pUseSkillToPos) (int fd, struct map_session_data *sd); diff --git a/src/map/packets.h b/src/map/packets.h index 4fcb263a2..507c8362d 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1907,6 +1907,7 @@ packet(0x96e,clif->ackmergeitems); #if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010 packet(0x0b10,clif->pStartUseSkillToId); + packet(0x0b11,clif->pStopUseSkillToId); #endif #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 69df71791..f6b1a61fb 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2973,6 +2973,12 @@ struct PACKET_CZ_START_USE_SKILL { uint32 targetId; } __attribute__((packed)); DEFINE_PACKET_HEADER(CZ_START_USE_SKILL, 0x0b10); + +struct PACKET_CZ_STOP_USE_SKILL { + int16 packetType; + int16 skillId; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_STOP_USE_SKILL, 0x0b11); #endif #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute -- cgit v1.2.3-70-g09d2 From 57090ac78ed1b4f867c6c09763e54ac0f8410cf7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 5 Dec 2018 20:36:43 +0300 Subject: Add missing result values for packet ZC_PC_PURCHASE_RESULT --- src/map/clif.c | 2 ++ src/map/npc.c | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 362264226..45f029487 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11448,6 +11448,8 @@ static void clif_parse_NpcBuySellSelected(int fd, struct map_session_data *sd) /// 1 = "You do not have enough zeny." /// 2 = "You are over your Weight Limit." /// 3 = "Out of the maximum capacity, you have too many items." +/// 9 = "Amounts are exceeded the possession of the item is not available for purchase." +/// 10 = "Props open-air store sales will be traded in RODEX" static void clif_npc_buy_result(struct map_session_data *sd, unsigned char result) { int fd; diff --git a/src/map/npc.c b/src/map/npc.c index 7f57a9c50..c59988c00 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1948,7 +1948,11 @@ static int npc_buylist(struct map_session_data *sd, struct itemlist *item_list) break; case ADDITEM_OVERAMOUNT: +#if PACKETVER >= 20110705 + return 9; +#else return 2; +#endif } value = pc->modifybuyvalue(sd,value); -- cgit v1.2.3-70-g09d2 From c34b4fbb432350c3632800b53a143a8f54ab7dbc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 13 Dec 2018 20:21:44 +0300 Subject: Add packt ZC_INVENTORY_EXPANSION_INFO --- src/common/mmo.h | 11 +++++++++++ src/map/clif.c | 15 +++++++++++++++ src/map/clif.h | 1 + src/map/packets_struct.h | 8 ++++++++ src/map/pc.c | 2 ++ src/map/pc.h | 1 + 6 files changed, 38 insertions(+) (limited to 'src/map') diff --git a/src/common/mmo.h b/src/common/mmo.h index 9bcf82cc7..8b6bef431 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -165,7 +165,18 @@ #endif #define MAX_CARTS (MAX_BASE_CARTS + MAX_CARTDECORATION_CARTS) +#ifndef MAX_INVENTORY #define MAX_INVENTORY 100 +#endif + +#ifndef FIXED_INVENTORY_SIZE +#define FIXED_INVENTORY_SIZE 100 +#endif + +#if FIXED_INVENTORY_SIZE > MAX_INVENTORY +#error FIXED_INVENTORY_SIZE must be same or smaller than MAX_INVENTORY +#endif + //Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well. #if PACKETVER >= 20100413 #ifndef MAX_CHARS diff --git a/src/map/clif.c b/src/map/clif.c index 45f029487..e1e06d890 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3064,6 +3064,20 @@ static void clif_cartItems(struct map_session_data *sd, enum inventory_type type } } +static void clif_inventoryExpansionInfo(struct map_session_data *sd) +{ +#if PACKETVER_ZERO_NUM >= 20181212 + nullpo_retv(sd); + + const int fd = sd->fd; + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_INVENTORY_EXPANSION_INFO)); + struct PACKET_ZC_INVENTORY_EXPANSION_INFO *p = WFIFOP(fd, 0); + p->packetType = HEADER_ZC_INVENTORY_EXPANSION_INFO; + p->expansionSize = sd->inventorySize - FIXED_INVENTORY_SIZE; + WFIFOSET(fd, sizeof(struct PACKET_ZC_INVENTORY_EXPANSION_INFO)); +#endif +} + /// Removes cart (ZC_CARTOFF). /// 012b /// Client behavior: @@ -22529,6 +22543,7 @@ void clif_defaults(void) clif->equipItems = clif_equipItems; clif->cartList = clif_cartList; clif->cartItems = clif_cartItems; + clif->inventoryExpansionInfo = clif_inventoryExpansionInfo; clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; clif->item_identify_list = clif_item_identify_list; diff --git a/src/map/clif.h b/src/map/clif.h index 147dcfee3..de1d2b593 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -851,6 +851,7 @@ struct clif_interface { void (*equipItems) (struct map_session_data *sd, enum inventory_type type); void (*cartList) (struct map_session_data *sd); void (*cartItems) (struct map_session_data *sd, enum inventory_type type); + void (*inventoryExpansionInfo) (struct map_session_data *sd); void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); void (*item_identify_list) (struct map_session_data *sd); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index f6b1a61fb..78ed1a83b 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2981,6 +2981,14 @@ struct PACKET_CZ_STOP_USE_SKILL { DEFINE_PACKET_HEADER(CZ_STOP_USE_SKILL, 0x0b11); #endif +#if PACKETVER_ZERO_NUM >= 20181212 +struct PACKET_ZC_INVENTORY_EXPANSION_INFO { + int16 packetType; + int16 expansionSize; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_INVENTORY_EXPANSION_INFO, 0x0b18); +#endif + #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 diff --git a/src/map/pc.c b/src/map/pc.c index d9e297e84..39358adf4 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -773,6 +773,7 @@ static int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, sd->battle_status.speed = sd->base_status.speed = DEFAULT_WALK_SPEED; sd->state.warp_clean = 1; sd->catch_target_class = -1; + sd->inventorySize = 100; return 0; } @@ -1380,6 +1381,7 @@ static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expirat pc->setpos(sd,sd->status.last_point.map,0,0,CLR_OUTSIGHT); } + clif->inventoryExpansionInfo(sd); clif->overweight_percent(sd); clif->authok(sd); diff --git a/src/map/pc.h b/src/map/pc.h index cca15e829..20b995519 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -260,6 +260,7 @@ struct map_session_data { struct mmo_charstatus status; struct item_data *inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) + int inventorySize; struct storage_data storage; ///< Account Storage enum pc_checkitem_types itemcheck; short equip_index[EQI_MAX]; -- cgit v1.2.3-70-g09d2 From aee153a9a56ab05464779082a711adc95fb28663 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 13 Dec 2018 20:43:45 +0300 Subject: Add packet ZC_ACK_INVENTORY_EXPAND --- src/map/clif.c | 16 ++++++++++++++++ src/map/clif.h | 9 +++++++++ src/map/packets_struct.h | 9 +++++++++ 3 files changed, 34 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index e1e06d890..34bdb4a2a 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3078,6 +3078,21 @@ static void clif_inventoryExpansionInfo(struct map_session_data *sd) #endif } +static void clif_inventoryExpandAck(struct map_session_data *sd, enum expand_inventory result, int itemId) +{ +#if PACKETVER_ZERO_NUM >= 20181212 + nullpo_retv(sd); + + const int fd = sd->fd; + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_ACK_INVENTORY_EXPAND)); + struct PACKET_ZC_ACK_INVENTORY_EXPAND *p = WFIFOP(fd, 0); + p->packetType = HEADER_ZC_ACK_INVENTORY_EXPAND; + p->result = result; + p->itemId = itemId; + WFIFOSET(fd, sizeof(struct PACKET_ZC_ACK_INVENTORY_EXPAND)); +#endif +} + /// Removes cart (ZC_CARTOFF). /// 012b /// Client behavior: @@ -22544,6 +22559,7 @@ void clif_defaults(void) clif->cartList = clif_cartList; clif->cartItems = clif_cartItems; clif->inventoryExpansionInfo = clif_inventoryExpansionInfo; + clif->inventoryExpandAck = clif_inventoryExpandAck; clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; clif->item_identify_list = clif_item_identify_list; diff --git a/src/map/clif.h b/src/map/clif.h index de1d2b593..2c3e7499b 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -677,6 +677,14 @@ enum memorial_dungeon_command { COMMAND_MEMORIALDUNGEON_DESTROY_FORCE = 0x3, }; +enum expand_inventory { + EXPAND_INVENTORY_ASK_CONFIRMATION = 0, + EXPAND_INVENTORY_FAILED = 1, + EXPAND_INVENTORY_OTHER_WORK = 2, + EXPAND_INVENTORY_MISSING_ITEM = 3, + EXPAND_INVENTORY_MAX_SIZE = 4 +}; + /** * Clif.c Interface **/ @@ -852,6 +860,7 @@ struct clif_interface { void (*cartList) (struct map_session_data *sd); void (*cartItems) (struct map_session_data *sd, enum inventory_type type); void (*inventoryExpansionInfo) (struct map_session_data *sd); + void (*inventoryExpandAck) (struct map_session_data *sd, enum expand_inventory result, int itemId); void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); void (*item_identify_list) (struct map_session_data *sd); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 78ed1a83b..663e6cbbf 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2989,6 +2989,15 @@ struct PACKET_ZC_INVENTORY_EXPANSION_INFO { DEFINE_PACKET_HEADER(ZC_INVENTORY_EXPANSION_INFO, 0x0b18); #endif +#if PACKETVER_ZERO_NUM >= 20181212 +struct PACKET_ZC_ACK_INVENTORY_EXPAND { + int16 packetType; + uint8 result; + uint32 itemId; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ACK_INVENTORY_EXPAND, 0x0b15); +#endif + #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 -- cgit v1.2.3-70-g09d2 From 52fab52108281d215c61d7fbdb82438c043a10f5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 13 Dec 2018 21:04:58 +0300 Subject: Add packet ZC_ACK_INVENTORY_EXPAND_RESULT --- src/map/clif.c | 15 +++++++++++++++ src/map/clif.h | 9 +++++++++ src/map/packets_struct.h | 8 ++++++++ 3 files changed, 32 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 34bdb4a2a..863321422 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3093,6 +3093,20 @@ static void clif_inventoryExpandAck(struct map_session_data *sd, enum expand_inv #endif } +static void clif_inventoryExpandResult(struct map_session_data *sd, enum expand_inventory_result result) +{ +#if PACKETVER_ZERO_NUM >= 20181212 + nullpo_retv(sd); + + const int fd = sd->fd; + WFIFOHEAD(fd, sizeof(struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT)); + struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT *p = WFIFOP(fd, 0); + p->packetType = HEADER_ZC_ACK_INVENTORY_EXPAND_RESULT; + p->result = result; + WFIFOSET(fd, sizeof(struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT)); +#endif +} + /// Removes cart (ZC_CARTOFF). /// 012b /// Client behavior: @@ -22560,6 +22574,7 @@ void clif_defaults(void) clif->cartItems = clif_cartItems; clif->inventoryExpansionInfo = clif_inventoryExpansionInfo; clif->inventoryExpandAck = clif_inventoryExpandAck; + clif->inventoryExpandResult = clif_inventoryExpandResult; clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; clif->item_identify_list = clif_item_identify_list; diff --git a/src/map/clif.h b/src/map/clif.h index 2c3e7499b..c4be2c7ee 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -685,6 +685,14 @@ enum expand_inventory { EXPAND_INVENTORY_MAX_SIZE = 4 }; +enum expand_inventory_result { + EXPAND_INVENTORY_RESULT_SUCCESS = 0, + EXPAND_INVENTORY_RESULT_FAILED = 1, + EXPAND_INVENTORY_RESULT_OTHER_WORK = 2, + EXPAND_INVENTORY_RESULT_MISSING_ITEM = 3, + EXPAND_INVENTORY_RESULT_MAX_SIZE = 4 +}; + /** * Clif.c Interface **/ @@ -861,6 +869,7 @@ struct clif_interface { void (*cartItems) (struct map_session_data *sd, enum inventory_type type); void (*inventoryExpansionInfo) (struct map_session_data *sd); void (*inventoryExpandAck) (struct map_session_data *sd, enum expand_inventory result, int itemId); + void (*inventoryExpandResult) (struct map_session_data *sd, enum expand_inventory_result result); void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); void (*item_identify_list) (struct map_session_data *sd); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 663e6cbbf..e7fbdb7bd 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2998,6 +2998,14 @@ struct PACKET_ZC_ACK_INVENTORY_EXPAND { DEFINE_PACKET_HEADER(ZC_ACK_INVENTORY_EXPAND, 0x0b15); #endif +#if PACKETVER_ZERO_NUM >= 20181212 +struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT { + int16 packetType; + uint8 result; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_ACK_INVENTORY_EXPAND_RESULT, 0x0b17); +#endif + #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 -- cgit v1.2.3-70-g09d2 From 60a03815c37f04485c048bb3e4f37960b6ba18cb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 13 Dec 2018 21:33:08 +0300 Subject: Add packet CZ_INVENTORY_EXPAND --- src/map/clif.c | 17 +++++++++++++++++ src/map/clif.h | 1 + src/map/packets.h | 4 ++++ src/map/packets_struct.h | 7 +++++++ 4 files changed, 29 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 863321422..10f6f0bdc 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3107,6 +3107,22 @@ static void clif_inventoryExpandResult(struct map_session_data *sd, enum expand_ #endif } +static void clif_parse_inventoryExpansion(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_inventoryExpansion(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 + char evname[EVENT_NAME_LENGTH]; + struct event_data *ev = NULL; + + safestrncpy(evname, "inventory_expansion::OnInvExpandRequest", EVENT_NAME_LENGTH); + if ((ev = strdb_get(npc->ev_db, evname))) { + script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id); + } else { + ShowError("clif_parse_inventoryExpansion: event '%s' not found, operation failed.\n", evname); + } +#endif +} + /// Removes cart (ZC_CARTOFF). /// 012b /// Client behavior: @@ -22575,6 +22591,7 @@ void clif_defaults(void) clif->inventoryExpansionInfo = clif_inventoryExpansionInfo; clif->inventoryExpandAck = clif_inventoryExpandAck; clif->inventoryExpandResult = clif_inventoryExpandResult; + clif->pInventoryExpansion = clif_parse_inventoryExpansion; clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; clif->item_identify_list = clif_item_identify_list; diff --git a/src/map/clif.h b/src/map/clif.h index c4be2c7ee..7993429a1 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -870,6 +870,7 @@ struct clif_interface { void (*inventoryExpansionInfo) (struct map_session_data *sd); void (*inventoryExpandAck) (struct map_session_data *sd, enum expand_inventory result, int itemId); void (*inventoryExpandResult) (struct map_session_data *sd, enum expand_inventory_result result); + void (*pInventoryExpansion) (int fd, struct map_session_data *sd); void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); void (*item_identify_list) (struct map_session_data *sd); diff --git a/src/map/packets.h b/src/map/packets.h index 507c8362d..4e81b3bf3 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1910,4 +1910,8 @@ packet(0x96e,clif->ackmergeitems); packet(0x0b11,clif->pStopUseSkillToId); #endif +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 + packet(0x0b14,clif->pInventoryExpansion); +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index e7fbdb7bd..ad67091dc 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3006,6 +3006,13 @@ struct PACKET_ZC_ACK_INVENTORY_EXPAND_RESULT { DEFINE_PACKET_HEADER(ZC_ACK_INVENTORY_EXPAND_RESULT, 0x0b17); #endif +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 +struct PACKET_CZ_INVENTORY_EXPAND { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND, 0x0b14); +#endif + #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 -- cgit v1.2.3-70-g09d2 From 392c598c6ee3ce9e10eec9e44d6c2f93d4dae232 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 00:16:13 +0300 Subject: Add packet CZ_INVENTORY_EXPAND_CONFIRMED --- src/map/clif.c | 17 +++++++++++++++++ src/map/clif.h | 1 + src/map/packets.h | 1 + src/map/packets_struct.h | 7 +++++++ 4 files changed, 26 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 10f6f0bdc..a9fc3be74 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3123,6 +3123,22 @@ static void clif_parse_inventoryExpansion(int fd, struct map_session_data *sd) #endif } +static void clif_parse_inventoryExpansionConfirmed(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_inventoryExpansionConfirmed(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 + char evname[EVENT_NAME_LENGTH]; + struct event_data *ev = NULL; + + safestrncpy(evname, "inventory_expansion::OnInvExpandConfirmed", EVENT_NAME_LENGTH); + if ((ev = strdb_get(npc->ev_db, evname))) { + script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id); + } else { + ShowError("clif_parse_inventoryExpansionConfirmed: event '%s' not found, operation failed.\n", evname); + } +#endif +} + /// Removes cart (ZC_CARTOFF). /// 012b /// Client behavior: @@ -22592,6 +22608,7 @@ void clif_defaults(void) clif->inventoryExpandAck = clif_inventoryExpandAck; clif->inventoryExpandResult = clif_inventoryExpandResult; clif->pInventoryExpansion = clif_parse_inventoryExpansion; + clif->pInventoryExpansionConfirmed = clif_parse_inventoryExpansionConfirmed; clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; clif->item_identify_list = clif_item_identify_list; diff --git a/src/map/clif.h b/src/map/clif.h index 7993429a1..6e743e57f 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -871,6 +871,7 @@ struct clif_interface { void (*inventoryExpandAck) (struct map_session_data *sd, enum expand_inventory result, int itemId); void (*inventoryExpandResult) (struct map_session_data *sd, enum expand_inventory_result result); void (*pInventoryExpansion) (int fd, struct map_session_data *sd); + void (*pInventoryExpansionConfirmed) (int fd, struct map_session_data *sd); void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); void (*item_identify_list) (struct map_session_data *sd); diff --git a/src/map/packets.h b/src/map/packets.h index 4e81b3bf3..bad3aa915 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1912,6 +1912,7 @@ packet(0x96e,clif->ackmergeitems); #if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 packet(0x0b14,clif->pInventoryExpansion); + packet(0x0b16,clif->pInventoryExpansionConfirmed); #endif #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index ad67091dc..ea385963c 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3013,6 +3013,13 @@ struct PACKET_CZ_INVENTORY_EXPAND { DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND, 0x0b14); #endif +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 +struct PACKET_CZ_INVENTORY_EXPAND_CONFIRMED { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND_CONFIRMED, 0x0b16); +#endif + #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 -- cgit v1.2.3-70-g09d2 From 1a26402c3bd986d0bba0435bfbd62e32abf07302 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 00:40:16 +0300 Subject: Add packet CZ_INVENTORY_EXPAND_REJECTED --- src/map/clif.c | 17 +++++++++++++++++ src/map/clif.h | 1 + src/map/packets.h | 1 + src/map/packets_struct.h | 7 +++++++ 4 files changed, 26 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index a9fc3be74..659ff920e 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3139,6 +3139,22 @@ static void clif_parse_inventoryExpansionConfirmed(int fd, struct map_session_da #endif } +static void clif_parse_inventoryExpansionRejected(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_inventoryExpansionRejected(int fd, struct map_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 + char evname[EVENT_NAME_LENGTH]; + struct event_data *ev = NULL; + + safestrncpy(evname, "inventory_expansion::OnInvExpandRejected", EVENT_NAME_LENGTH); + if ((ev = strdb_get(npc->ev_db, evname))) { + script->run_npc(ev->nd->u.scr.script, ev->pos, sd->bl.id, ev->nd->bl.id); + } else { + ShowError("clif_parse_inventoryExpansionRejected: event '%s' not found, operation failed.\n", evname); + } +#endif +} + /// Removes cart (ZC_CARTOFF). /// 012b /// Client behavior: @@ -22609,6 +22625,7 @@ void clif_defaults(void) clif->inventoryExpandResult = clif_inventoryExpandResult; clif->pInventoryExpansion = clif_parse_inventoryExpansion; clif->pInventoryExpansionConfirmed = clif_parse_inventoryExpansionConfirmed; + clif->pInventoryExpansionRejected = clif_parse_inventoryExpansionRejected; clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; clif->item_identify_list = clif_item_identify_list; diff --git a/src/map/clif.h b/src/map/clif.h index 6e743e57f..47766b33d 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -872,6 +872,7 @@ struct clif_interface { void (*inventoryExpandResult) (struct map_session_data *sd, enum expand_inventory_result result); void (*pInventoryExpansion) (int fd, struct map_session_data *sd); void (*pInventoryExpansionConfirmed) (int fd, struct map_session_data *sd); + void (*pInventoryExpansionRejected) (int fd, struct map_session_data *sd); void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); void (*item_identify_list) (struct map_session_data *sd); diff --git a/src/map/packets.h b/src/map/packets.h index bad3aa915..4ce7ee916 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1913,6 +1913,7 @@ packet(0x96e,clif->ackmergeitems); #if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 packet(0x0b14,clif->pInventoryExpansion); packet(0x0b16,clif->pInventoryExpansionConfirmed); + packet(0x0b19,clif->pInventoryExpansionRejected); #endif #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index ea385963c..c075d8674 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3020,6 +3020,13 @@ struct PACKET_CZ_INVENTORY_EXPAND_CONFIRMED { DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND_CONFIRMED, 0x0b16); #endif +#if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 +struct PACKET_CZ_INVENTORY_EXPAND_REJECTED { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND_REJECTED, 0x0b19); +#endif + #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 -- cgit v1.2.3-70-g09d2 From bc682624496b854607b8e1bd976bb317eb8b0d4f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 01:20:44 +0300 Subject: Add inventory size field into db and using it in server. --- sql-files/main.sql | 2 + sql-files/upgrades/2018-12-14--01-02.sql | 24 +++++++++ sql-files/upgrades/index.txt | 1 + src/char/char.c | 33 ++++++++++-- src/common/mmo.h | 7 ++- src/map/achievement.c | 3 +- src/map/atcommand.c | 24 +++------ src/map/chrif.c | 4 +- src/map/clif.c | 90 ++++++++++++++++---------------- src/map/mail.c | 4 +- src/map/npc.c | 2 +- src/map/packets_struct.h | 2 + src/map/pc.c | 82 ++++++++++++++--------------- src/map/pc.h | 1 - src/map/pet.c | 14 ++--- src/map/quest.c | 2 +- src/map/rodex.c | 6 +-- src/map/script.c | 72 +++++++++++++------------ src/map/skill.c | 20 +++---- src/map/status.c | 2 +- src/map/storage.c | 4 +- src/map/trade.c | 28 +++++----- 22 files changed, 235 insertions(+), 192 deletions(-) create mode 100644 sql-files/upgrades/2018-12-14--01-02.sql (limited to 'src/map') diff --git a/sql-files/main.sql b/sql-files/main.sql index 37bfaf0ec..f322d1cda 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -244,6 +244,7 @@ CREATE TABLE IF NOT EXISTS `char` ( `attendance_count` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0', `attendance_timer` BIGINT(20) NULL DEFAULT '0', `title_id` INT(11) UNSIGNED NOT NULL DEFAULT '0', + `inventory_size` INT(11) UNSIGNED NOT NULL DEFAULT '100', PRIMARY KEY (`char_id`), UNIQUE KEY `name_key` (`name`), KEY `account_id` (`account_id`), @@ -922,6 +923,7 @@ INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1528026381); -- 2018-06-0 INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1528180320); -- 2018-06-05--12-02.sql INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1532403228); -- 2018-07-24--03-23.sql INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1535865732); -- 2018-09-01--05-22.sql +INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1544738447); -- 2018-12-14--01-02.sql -- -- Table structure for table `storage` diff --git a/sql-files/upgrades/2018-12-14--01-02.sql b/sql-files/upgrades/2018-12-14--01-02.sql new file mode 100644 index 000000000..7bcd583c2 --- /dev/null +++ b/sql-files/upgrades/2018-12-14--01-02.sql @@ -0,0 +1,24 @@ +#1544738447 + +-- This file is part of Hercules. +-- http://herc.ws - http://github.com/HerculesWS/Hercules +-- +-- Copyright (C) 2018 Hercules Dev Team +-- Copyright (C) 4144 +-- +-- Hercules is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +ALTER TABLE `char` ADD `inventory_size` INT(11) UNSIGNED NOT NULL DEFAULT '100'; + +INSERT INTO `sql_updates` (`timestamp`, `ignored`) VALUES (1544738447, 'No'); diff --git a/sql-files/upgrades/index.txt b/sql-files/upgrades/index.txt index 2c88535cc..ed892df12 100644 --- a/sql-files/upgrades/index.txt +++ b/sql-files/upgrades/index.txt @@ -50,3 +50,4 @@ 2018-06-05--12-02.sql 2018-07-24--03-23.sql 2018-09-01--05-22.sql +2018-12-14--01-02.sql diff --git a/src/char/char.c b/src/char/char.c index e08933f7b..0546e49df 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -479,11 +479,18 @@ static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) (p->show_equip != cp->show_equip) || (p->allow_party != cp->allow_party) || (p->font != cp->font) || (p->uniqueitem_counter != cp->uniqueitem_counter) || (p->hotkey_rowshift != cp->hotkey_rowshift) || (p->clan_id != cp->clan_id) || (p->last_login != cp->last_login) || (p->attendance_count != cp->attendance_count) || - (p->attendance_timer != cp->attendance_timer) || (p->title_id != cp->title_id) + (p->attendance_timer != cp->attendance_timer) || (p->title_id != cp->title_id) || (p->inventorySize != cp->inventorySize) ) { //Save status unsigned int opt = 0; + if (p->inventorySize <= 0 || p->inventorySize > MAX_INVENTORY) { + ShowError("Wrong inventorySize field: %d. Must be in range 1 to %d. Character %s (CID: %d, AID: %d)\n", + p->inventorySize, MAX_INVENTORY, p->name, p->char_id, p->account_id); + Assert_report(0); + p->inventorySize = FIXED_INVENTORY_SIZE; + } + if( p->allow_party ) opt |= OPT_ALLOW_PARTY; if( p->show_equip ) @@ -498,7 +505,7 @@ static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `rename`='%d'," "`delete_date`='%lu',`robe`='%d',`slotchange`='%d', `char_opt`='%u', `font`='%u', `uniqueitem_counter` ='%u'," "`hotkey_rowshift`='%d',`clan_id`='%d',`last_login`='%"PRId64"',`attendance_count`='%d',`attendance_timer`='%"PRId64"'," - "`title_id`='%d'" + "`title_id`='%d', `inventory_size`='%d'" " WHERE `account_id`='%d' AND `char_id` = '%d'", char_db, p->base_level, p->job_level, p->base_exp, p->job_exp, p->zeny, @@ -511,7 +518,7 @@ static int char_mmo_char_tosql(int char_id, struct mmo_charstatus *p) (unsigned long)p->delete_date, // FIXME: platform-dependent size p->look.robe,p->slotchange,opt,p->font,p->uniqueitem_counter, p->hotkey_rowshift,p->clan_id,p->last_login, p->attendance_count, p->attendance_timer, - p->title_id, + p->title_id, p->inventorySize, p->account_id, p->char_id) ) { Sql_ShowDebug(inter->sql_handle); @@ -1085,7 +1092,7 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf, int "`str`,`agi`,`vit`,`int`,`dex`,`luk`,`max_hp`,`hp`,`max_sp`,`sp`," "`status_point`,`skill_point`,`option`,`karma`,`manner`,`hair`,`hair_color`," "`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`rename`,`delete_date`," - "`robe`,`slotchange`,`unban_time`,`sex`,`title_id`" + "`robe`,`slotchange`,`unban_time`,`sex`,`title_id`,`inventory_size`" " FROM `%s` WHERE `account_id`='%d' AND `char_num` < '%d'", char_db, sd->account_id, MAX_CHARS) || SQL_ERROR == SQL->StmtExecute(stmt) || SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, sizeof p.char_id, NULL, NULL) @@ -1129,6 +1136,7 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf, int || SQL_ERROR == SQL->StmtBindColumn(stmt, 38, SQLDT_TIME, &unban_time, sizeof unban_time, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 39, SQLDT_ENUM, &sex, sizeof sex, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 40, SQLDT_INT, &p.title_id, sizeof p.title_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 41, SQLDT_INT, &p.inventorySize, sizeof p.inventorySize, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); SQL->StmtFree(stmt); @@ -1139,6 +1147,12 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf, int for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->StmtNextRow(stmt); i++) { if (p.slot >= MAX_CHARS) continue; + if (p.inventorySize <= 0 || p.inventorySize > MAX_INVENTORY) { + ShowError("Wrong inventorySize field: %d. Must be in range 1 to %d. Character %s (CID: %d, AID: %d)\n", + p.inventorySize, MAX_INVENTORY, p.name, p.char_id, p.account_id); + Assert_report(0); + p.inventorySize = FIXED_INVENTORY_SIZE; + } p.last_point.map = mapindex->name2id(last_map); sd->found_char[p.slot] = p.char_id; sd->unban_time[p.slot] = unban_time; @@ -1179,6 +1193,7 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa nullpo_ret(p); memset(p, 0, sizeof(struct mmo_charstatus)); + p->inventorySize = FIXED_INVENTORY_SIZE; if (chr->show_save_log) ShowInfo("Char load request (%d)\n", char_id); @@ -1198,7 +1213,7 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa "`hair_color`,`clothes_color`,`body`,`weapon`,`shield`,`head_top`,`head_mid`,`head_bottom`,`last_map`,`last_x`,`last_y`," "`save_map`,`save_x`,`save_y`,`partner_id`,`father`,`mother`,`child`,`fame`,`rename`,`delete_date`,`robe`,`slotchange`," "`char_opt`,`font`,`uniqueitem_counter`,`sex`,`hotkey_rowshift`,`clan_id`,`last_login`, `attendance_count`, `attendance_timer`," - "`title_id`" + "`title_id`, `inventory_size`" " FROM `%s` WHERE `char_id`=? LIMIT 1", char_db) || SQL_ERROR == SQL->StmtBindParam(stmt, 0, SQLDT_INT, &char_id, sizeof char_id) || SQL_ERROR == SQL->StmtExecute(stmt) @@ -1266,6 +1281,7 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa || SQL_ERROR == SQL->StmtBindColumn(stmt, 61, SQLDT_SHORT, &p->attendance_count, sizeof p->attendance_count, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 62, SQLDT_INT64, &p->attendance_timer, sizeof p->attendance_timer, NULL, NULL) || SQL_ERROR == SQL->StmtBindColumn(stmt, 63, SQLDT_INT, &p->title_id, sizeof p->title_id, NULL, NULL) + || SQL_ERROR == SQL->StmtBindColumn(stmt, 64, SQLDT_INT, &p->inventorySize, sizeof p->inventorySize, NULL, NULL) ) { SqlStmt_ShowDebug(stmt); SQL->StmtFree(stmt); @@ -1297,6 +1313,13 @@ static int char_mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool loa p->save_point.y = mapindex->default_y; } + if (p->inventorySize <= 0 || p->inventorySize > MAX_INVENTORY) { + ShowError("Wrong inventorySize field: %d. Must be in range 1 to %d. Character %s (CID: %d, AID: %d)\n", + p->inventorySize, MAX_INVENTORY, p->name, p->char_id, p->account_id); + Assert_report(0); + p->inventorySize = FIXED_INVENTORY_SIZE; + } + strcat(t_msg, " status"); if (!load_everything) // For quick selection of data when displaying the char menu diff --git a/src/common/mmo.h b/src/common/mmo.h index 8b6bef431..4b8f49fa2 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -166,8 +166,12 @@ #define MAX_CARTS (MAX_BASE_CARTS + MAX_CARTDECORATION_CARTS) #ifndef MAX_INVENTORY +#if PACKETVER_ZERO_NUM >= 20181212 +#define MAX_INVENTORY 200 +#else #define MAX_INVENTORY 100 -#endif +#endif // PACKETVER_ZERO_NUM >= 20181212 +#endif // MAX_INVENTORY #ifndef FIXED_INVENTORY_SIZE #define FIXED_INVENTORY_SIZE 100 @@ -721,6 +725,7 @@ struct mmo_charstatus { int64 last_login; struct point last_point,save_point,memo_point[MAX_MEMOPOINTS]; + int inventorySize; struct item inventory[MAX_INVENTORY],cart[MAX_CART]; struct s_skill skill[MAX_SKILL_DB]; diff --git a/src/map/achievement.c b/src/map/achievement.c index 7148acae8..057ea29c3 100644 --- a/src/map/achievement.c +++ b/src/map/achievement.c @@ -760,14 +760,13 @@ static void achievement_validate_refine(struct map_session_data *sd, unsigned in struct item_data *id = NULL; nullpo_retv(sd); - Assert_retv(idx < MAX_INVENTORY); + Assert_retv(idx < sd->status.inventorySize); id = itemdb->exists(sd->status.inventory[idx].nameid); if (sd->achievements_received == false) return; - Assert_retv(idx < MAX_INVENTORY); Assert_retv(id != NULL); criteria.goal = sd->status.inventory[idx].refine; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 6cfa86163..0a1fd6da3 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1359,9 +1359,7 @@ ACMD(item2) *------------------------------------------*/ ACMD(itemreset) { - int i; - - for (i = 0; i < MAX_INVENTORY; i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) { pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_NORMAL, LOG_TYPE_COMMAND); } @@ -4274,10 +4272,8 @@ ACMD(partyspy) *------------------------------------------*/ ACMD(repairall) { - int count, i; - - count = 0; - for (i = 0; i < MAX_INVENTORY; i++) { + int count = 0; + for (int i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].card[0] == CARD0_PET) continue; if (sd->status.inventory[i].nameid && (sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { @@ -5286,9 +5282,7 @@ ACMD(follow) *------------------------------------------*/ ACMD(dropall) { - int i; - - for (i = 0; i < MAX_INVENTORY; i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].amount) { if(sd->status.inventory[i].equip != 0) pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); @@ -5304,8 +5298,6 @@ ACMD(dropall) *------------------------------------------*/ ACMD(storeall) { - int i; - if (sd->state.storage_flag != STORAGE_FLAG_NORMAL) { //Open storage. if (storage->open(sd) == 1) { @@ -5319,7 +5311,7 @@ ACMD(storeall) return false; } - for (i = 0; i < MAX_INVENTORY; i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].amount) { if(sd->status.inventory[i].equip != 0) pc->unequipitem(sd, i, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); @@ -6714,9 +6706,9 @@ ACMD(refreshall) *------------------------------------------*/ ACMD(identify) { - int i,num; + int num = 0; - for (i=num=0;istatus.inventorySize; i++) { if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify!=1){ num++; } @@ -8256,7 +8248,7 @@ ACMD(itemlist) } else if( strcmpi(info->command, "itemlist") == 0 ) { location = "inventory"; items = sd->status.inventory; - size = MAX_INVENTORY; + size = sd->status.inventorySize; } else return false; diff --git a/src/map/chrif.c b/src/map/chrif.c index af3504ca2..a3277d4c2 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -975,14 +975,14 @@ static bool chrif_divorceack(int char_id, int partner_id) if( ( sd = map->charid2sd(char_id) ) != NULL && sd->status.partner_id == partner_id ) { sd->status.partner_id = 0; - for(i = 0; i < MAX_INVENTORY; i++) + for (i = 0; i < sd->status.inventorySize; i++) if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F) pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_DIVORCE); } if( ( sd = map->charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) { sd->status.partner_id = 0; - for(i = 0; i < MAX_INVENTORY; i++) + for (i = 0; i < sd->status.inventorySize; i++) if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F) pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_DIVORCE); } diff --git a/src/map/clif.c b/src/map/clif.c index 659ff920e..123dd1a52 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2162,14 +2162,14 @@ static void clif_buylist(struct map_session_data *sd, struct npc_data *nd) /// 00c7 .W { .W .L .L }* static void clif_selllist(struct map_session_data *sd) { - int fd,i,c=0,val; + int c = 0, val; nullpo_retv(sd); - fd=sd->fd; - WFIFOHEAD(fd, MAX_INVENTORY * 10 + 4); + int fd = sd->fd; + WFIFOHEAD(fd, sd->status.inventorySize * 10 + 4); WFIFOW(fd,0)=0xc7; - for( i = 0; i < MAX_INVENTORY; i++ ) + for (int i = 0; i < sd->status.inventorySize; i++) { if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] ) { @@ -2584,7 +2584,7 @@ static void clif_additem(struct map_session_data *sd, int n, int amount, int fai p.count = amount; if( !fail ) { - if( n < 0 || n >= MAX_INVENTORY || sd->status.inventory[n].nameid <=0 || sd->inventory_data[n] == NULL ) + if (n < 0 || n >= sd->status.inventorySize || sd->status.inventory[n].nameid <= 0 || sd->inventory_data[n] == NULL) return; if (sd->inventory_data[n]->view_id > 0) @@ -2806,7 +2806,7 @@ static void clif_inventoryItems(struct map_session_data *sd, enum inventory_type int i, normal = 0, equip = 0; nullpo_retv(sd); - for( i = 0; i < MAX_INVENTORY; i++ ) { + for (i = 0; i < sd->status.inventorySize; i++) { if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL ) continue; @@ -2840,7 +2840,7 @@ static void clif_inventoryItems(struct map_session_data *sd, enum inventory_type } /* on 20120925 onwards this is a field on clif_item_equip/normal */ #if PACKETVER >= 20111122 && PACKETVER < 20120925 - for( i = 0; i < MAX_INVENTORY; i++ ) { + for (i = 0; i < sd->status.inventorySize; i++) { if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL ) continue; @@ -2868,7 +2868,7 @@ static void clif_equipItems(struct map_session_data *sd, enum inventory_type typ int i, equip = 0; nullpo_retv(sd); - for( i = 0; i < MAX_INVENTORY; i++ ) { + for (i = 0; i < sd->status.inventorySize; i++) { if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL ) continue; @@ -2888,7 +2888,7 @@ static void clif_equipItems(struct map_session_data *sd, enum inventory_type typ /* on 20120925 onwards this is a field on clif_item_equip */ #if PACKETVER >= 20111122 && PACKETVER < 20120925 - for( i = 0; i < MAX_INVENTORY; i++ ) { + for (i = 0; i < sd->status.inventorySize; i++) { if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL ) continue; @@ -3073,7 +3073,7 @@ static void clif_inventoryExpansionInfo(struct map_session_data *sd) WFIFOHEAD(fd, sizeof(struct PACKET_ZC_INVENTORY_EXPANSION_INFO)); struct PACKET_ZC_INVENTORY_EXPANSION_INFO *p = WFIFOP(fd, 0); p->packetType = HEADER_ZC_INVENTORY_EXPANSION_INFO; - p->expansionSize = sd->inventorySize - FIXED_INVENTORY_SIZE; + p->expansionSize = sd->status.inventorySize - FIXED_INVENTORY_SIZE; WFIFOSET(fd, sizeof(struct PACKET_ZC_INVENTORY_EXPANSION_INFO)); #endif } @@ -3917,7 +3917,7 @@ static void clif_equipitemack(struct map_session_data *sd, int n, int pos, enum p.index = n+2; p.wearLocation = pos; #if PACKETVER >= 20100629 - Assert_retv(n >= 0 && n < MAX_INVENTORY); + Assert_retv(n >= 0 && n < sd->status.inventorySize); if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&EQP_VISIBLE) p.wItemSpriteNumber = sd->inventory_data[n]->view_sprite; else @@ -4059,7 +4059,7 @@ static void clif_useitemack(struct map_session_data *sd, int index, int amount, nullpo_retv(sd); - if (index < 0 || index >= MAX_INVENTORY) + if (index < 0 || index >= sd->status.inventorySize) return; fd = sd->fd; @@ -4408,7 +4408,7 @@ static void clif_tradeadditem(struct map_session_data *sd, struct map_session_da if (index != 0) { index -= 2; //index fix - Assert_retv(index >= 0 && index < MAX_INVENTORY); + Assert_retv(index >= 0 && index < sd->status.inventorySize); if(sd->inventory_data[index] && sd->inventory_data[index]->view_id > 0) p.itemId = sd->inventory_data[index]->view_id; else @@ -6471,10 +6471,10 @@ static void clif_use_card(struct map_session_data *sd, int idx) if (!pc->can_insert_card(sd, idx)) return; - WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4); + WFIFOHEAD(fd, sd->status.inventorySize * 2 + 4); WFIFOW(fd, 0) = 0x17b; - for (i = c = 0; i < MAX_INVENTORY; i++) { + for (i = c = 0; i < sd->status.inventorySize; i++) { if (!pc->can_insert_card_into(sd, idx, i)) continue; WFIFOW(fd, 4 + c * 2) = i + 2; @@ -6518,9 +6518,9 @@ static void clif_item_identify_list(struct map_session_data *sd) fd=sd->fd; - WFIFOHEAD(fd,MAX_INVENTORY * 2 + 4); + WFIFOHEAD(fd, sd->status.inventorySize * 2 + 4); WFIFOW(fd,0)=0x177; - for(i=c=0;istatus.inventorySize; i++) { if(sd->status.inventory[i].nameid > 0 && !sd->status.inventory[i].identify){ WFIFOW(fd,c*2+4)=i+2; c++; @@ -6565,11 +6565,11 @@ static void clif_item_repair_list(struct map_session_data *sd, struct map_sessio fd = sd->fd; - len = MAX_INVENTORY * sizeof(struct PACKET_ZC_REPAIRITEMLIST_sub) + sizeof(struct PACKET_ZC_REPAIRITEMLIST); + len = dstsd->status.inventorySize * sizeof(struct PACKET_ZC_REPAIRITEMLIST_sub) + sizeof(struct PACKET_ZC_REPAIRITEMLIST); WFIFOHEAD(fd, len); p = WFIFOP(fd, 0); p->packetType = 0x1fc; - for (i = c = 0; i < MAX_INVENTORY; i++) { + for (i = c = 0; i < sd->status.inventorySize; i++) { int nameid = dstsd->status.inventory[i].nameid; if (nameid > 0 && (dstsd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { // && skill_can_repair(sd,nameid)) { p->items[c].index = i; @@ -6645,11 +6645,11 @@ static void clif_item_refine_list(struct map_session_data *sd) skill_lv = pc->checkskill(sd, WS_WEAPONREFINE); fd = sd->fd; - len = MAX_INVENTORY * sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub) + sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST); + len = sd->status.inventorySize * sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub) + sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST); WFIFOHEAD(fd, len); p = WFIFOP(fd, 0); p->packetType = 0x221; - for (i = c = 0; i < MAX_INVENTORY; i++) { + for (i = c = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify && itemdb_wlv(sd->status.inventory[i].nameid) >= 1 && !sd->inventory_data[i]->flag.no_refine @@ -7479,9 +7479,9 @@ static void clif_sendegg(struct map_session_data *sd) return; } - WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4); + WFIFOHEAD(fd, sd->status.inventorySize * 2 + 4); WFIFOW(fd,0) = 0x1a6; - for (i = n = 0; i < MAX_INVENTORY; i++) { + for (i = n = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL || sd->inventory_data[i]->type!=IT_PETEGG || sd->status.inventory[i].amount <= 0) continue; WFIFOW(fd, n * 2 + 4) = i + 2; @@ -11394,7 +11394,7 @@ static void clif_parse_UseItem(int fd, struct map_session_data *sd) pc->update_idle_time(sd, BCIDLE_USEITEM); n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; - if (n < 0 || n >= MAX_INVENTORY) + if (n < 0 || n >= sd->status.inventorySize) return; if (!pc->useitem(sd,n)) clif->useitemack(sd,n,0,false); //Send an empty ack packet or the client gets stuck. @@ -11415,7 +11415,7 @@ static void clif_parse_EquipItem(int fd, struct map_session_data *sd) } index = p->index - 2; - if (index >= MAX_INVENTORY) + if (index >= sd->status.inventorySize) return; //Out of bounds check. if( sd->npc_id ) { @@ -12606,7 +12606,7 @@ static void clif_parse_OneClick_ItemIdentify(int fd, struct map_session_data *sd short idx = RFIFOW(fd, packet_db[cmd].pos[0]) - 2; int n; - if (idx < 0 || idx >= MAX_INVENTORY || sd->inventory_data[idx] == NULL || sd->status.inventory[idx].nameid <= 0) + if (idx < 0 || idx >= sd->status.inventorySize || sd->inventory_data[idx] == NULL || sd->status.inventory[idx].nameid <= 0) return; if ((n = pc->have_magnifier(sd) ) != INDEX_NOT_FOUND && @@ -12756,7 +12756,7 @@ static void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) item_index = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2; item_amount = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[1]); - if (item_index < 0 || item_index >= MAX_INVENTORY || item_amount < 1) + if (item_index < 0 || item_index >= sd->status.inventorySize || item_amount < 1) return; if (sd->state.storage_flag == STORAGE_FLAG_NORMAL) @@ -14407,10 +14407,10 @@ static void clif_parse_pet_evolution(int fd, struct map_session_data *sd) return; } - ARR_FIND(0, MAX_INVENTORY, idx, sd->status.inventory[idx].card[0] == CARD0_PET && + ARR_FIND(0, sd->status.inventorySize, idx, sd->status.inventory[idx].card[0] == CARD0_PET && sd->status.pet_id == MakeDWord(sd->status.inventory[idx].card[1], sd->status.inventory[idx].card[2])); - if (idx == MAX_INVENTORY) { + if (idx == sd->status.inventorySize) { clif->petEvolutionResult(fd, PET_EVOL_NO_PETEGG); return; } @@ -16395,7 +16395,7 @@ static void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) if( sd->auction.amount > 0 ) sd->auction.amount = 0; - if( idx < 0 || idx >= MAX_INVENTORY ) { + if (idx < 0 || idx >= sd->status.inventorySize) { ShowWarning("Character %s trying to set invalid item index in auctions.\n", sd->status.name); return; } @@ -16470,7 +16470,7 @@ static void clif_parse_Auction_register(int fd, struct map_session_data *sd) if (!battle_config.feature_auction) return; - Assert_retv(sd->auction.index >= 0 && sd->auction.index < MAX_INVENTORY); + Assert_retv(sd->auction.index >= 0 && sd->auction.index < sd->status.inventorySize); memset(&auction, 0, sizeof(auction)); auction.price = RFIFOL(fd,2); @@ -17950,8 +17950,8 @@ static void clif_parse_ItemListWindowSelected(int fd, struct map_session_data *s return; // Canceled by player. } - if (n > MAX_INVENTORY) - n = MAX_INVENTORY; // It should be impossible to have more than that. + if (n > sd->status.inventorySize) + n = sd->status.inventorySize; // It should be impossible to have more than that. if (sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL) { clif_menuskill_clear(sd); @@ -18704,7 +18704,7 @@ static int clif_spellbook_list(struct map_session_data *sd) WFIFOHEAD(fd, 8 * 8 + 8); WFIFOW(fd,0) = 0x1ad; - for( i = 0, c = 0; i < MAX_INVENTORY; i ++ ) + for (i = 0, c = 0; i < sd->status.inventorySize; i ++ ) { if( itemdb_is_spellbook(sd->status.inventory[i].nameid) ) { @@ -18744,7 +18744,7 @@ static int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, sh WFIFOHEAD(fd, 8 * 8 + 8); WFIFOW(fd,0) = 0x1ad; // This is the official packet. [pakpil] - for( i = 0, c = 0; i < MAX_INVENTORY; i ++ ) { + for (i = 0, c = 0; i < sd->status.inventorySize; i ++) { if( itemdb_is_element(sd->status.inventory[i].nameid) ) { WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid; c ++; @@ -18781,7 +18781,7 @@ static int clif_poison_list(struct map_session_data *sd, uint16 skill_lv) WFIFOHEAD(fd, 8 * 8 + 8); WFIFOW(fd,0) = 0x1ad; // This is the official packet. [pakpil] - for( i = 0, c = 0; i < MAX_INVENTORY; i ++ ) { + for (i = 0, c = 0; i < sd->status.inventorySize; i ++) { if( itemdb_is_poison(sd->status.inventory[i].nameid) ) { WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid; c ++; @@ -18922,7 +18922,7 @@ static void clif_parse_MoveItem(int fd, struct map_session_data *sd) index = RFIFOW(fd,2)-2; - if (index < 0 || index >= MAX_INVENTORY) + if (index < 0 || index >= sd->status.inventorySize) return; if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) @@ -19928,7 +19928,7 @@ static void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) int count = (p->PacketLength - 4) / sizeof p->list[0]; struct itemlist item_list; - Assert_retv(count >= 0 && count <= MAX_INVENTORY); + Assert_retv(count >= 0 && count <= sd->status.inventorySize); VECTOR_INIT(item_list); VECTOR_ENSURE(item_list, count, 1); @@ -20266,7 +20266,7 @@ static void clif_openmergeitem(int fd, struct map_session_data *sd) nullpo_retv(sd); memset(&merge_items,'\0',sizeof(merge_items)); - for (i = 0; i < MAX_INVENTORY; i++) { + for (i = 0; i < sd->status.inventorySize; i++) { struct item *item_data = &sd->status.inventory[i]; if (item_data->nameid == 0 || !itemdb->isstackable(item_data->nameid) || item_data->bound != IBT_NONE) @@ -20327,7 +20327,7 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd) nullpo_retv(sd); length = (RFIFOW(fd,2) - 4)/2; - if (length >= MAX_INVENTORY || length < 2) { + if (length >= sd->status.inventorySize || length < 2) { WFIFOHEAD(fd,7); WFIFOW(fd,0) = 0x96f; WFIFOW(fd,2) = 0; @@ -20341,7 +20341,7 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd) int16 idx = RFIFOW(fd,i*2+4) - 2; struct item *it = NULL; - if (idx < 0 || idx >= MAX_INVENTORY) + if (idx < 0 || idx >= sd->status.inventorySize) continue; it = &sd->status.inventory[idx]; @@ -20391,7 +20391,7 @@ static void clif_ackmergeitems(int fd, struct map_session_data *sd) item_data.unique_id = itemdb->unique_id(sd); pc->additem(sd,&item_data,count,LOG_TYPE_NPC); - ARR_FIND(0,MAX_INVENTORY,i,item_data.unique_id == sd->status.inventory[i].unique_id); + ARR_FIND(0, sd->status.inventorySize, i, item_data.unique_id == sd->status.inventory[i].unique_id); WFIFOHEAD(fd,7); WFIFOW(fd,0) = 0x96f; @@ -20950,7 +20950,7 @@ static void clif_rodex_add_item_result(struct map_session_data *sd, int16 idx, i int fd, j; nullpo_retv(sd); - if (idx < 0 || idx >= MAX_INVENTORY) + if (idx < 0 || idx >= sd->status.inventorySize) return; fd = sd->fd; @@ -21003,7 +21003,7 @@ static void clif_rodex_remove_item_result(struct map_session_data *sd, int16 idx int fd; nullpo_retv(sd); - Assert_retv(idx >= 0 && idx < MAX_INVENTORY); + Assert_retv(idx >= 0 && idx < sd->status.inventorySize); fd = sd->fd; @@ -22128,7 +22128,7 @@ static void clif_item_preview(struct map_session_data *sd, int n) { #if PACKETVER_MAIN_NUM >= 20170726 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO) nullpo_retv(sd); - Assert_retv(n >= 0 && n < MAX_INVENTORY); + Assert_retv(n >= 0 && n < sd->status.inventorySize); struct PACKET_ZC_ITEM_PREVIEW p; p.packetType = HEADER_ZC_ITEM_PREVIEW; diff --git a/src/map/mail.c b/src/map/mail.c index d67e658fd..0a4b91e34 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -100,7 +100,7 @@ static unsigned char mail_setitem(struct map_session_data *sd, int idx, int amou idx -= 2; mail->removeitem(sd, 0); - if( idx < 0 || idx >= MAX_INVENTORY ) + if (idx < 0 || idx >= sd->status.inventorySize) return 1; if( amount <= 0 || amount > sd->status.inventory[idx].amount ) return 1; @@ -128,7 +128,7 @@ static bool mail_setattachment(struct map_session_data *sd, struct mail_message return false; n = sd->mail.index; - Assert_retr(false, n >= 0 && n < MAX_INVENTORY); + Assert_retr(false, n >= 0 && n < sd->status.inventorySize); if( sd->mail.amount ) { if( sd->status.inventory[n].nameid != sd->mail.nameid ) diff --git a/src/map/npc.c b/src/map/npc.c index c59988c00..fd11b6c5f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2235,7 +2235,7 @@ static int npc_selllist(struct map_session_data *sd, struct itemlist *item_list) struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i); int nameid, value, idx = entry->id; - if (idx >= MAX_INVENTORY || idx < 0 || entry->amount < 0) { + if (idx >= sd->status.inventorySize || idx < 0 || entry->amount < 0) { return 1; } diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index c075d8674..1283f8494 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -1285,6 +1285,7 @@ struct packet_viewequip_ack { int16 body2; #endif uint8 sex; + // [4144] need remove MAX_INVENTORY from here struct EQUIPITEM_INFO list[MAX_INVENTORY]; } __attribute__((packed)); @@ -1386,6 +1387,7 @@ struct packet_npc_market_result_ack { #endif uint16 qty; uint32 price; + // [4144] need remove MAX_INVENTORY from here } list[MAX_INVENTORY];/* assuming MAX_INVENTORY is max since you can't hold more than MAX_INVENTORY items thus cant buy that many at once. */ } __attribute__((packed)); diff --git a/src/map/pc.c b/src/map/pc.c index 39358adf4..ad8cf2a94 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -568,7 +568,7 @@ static void pc_rental_expire(struct map_session_data *sd, int i) int nameid; nullpo_retv(sd); - Assert_retv(i >= 0 && i < MAX_INVENTORY); + Assert_retv(i >= 0 && i < sd->status.inventorySize); nameid = sd->status.inventory[i].nameid; /* Soon to be dropped, we got plans to integrate it with item db */ @@ -637,11 +637,11 @@ static void pc_rental_expire(struct map_session_data *sd, int i) } static void pc_inventory_rentals(struct map_session_data *sd) { - int i, c = 0; + int c = 0; int64 expire_tick, next_tick = INT64_MAX; nullpo_retv(sd); - for( i = 0; i < MAX_INVENTORY; i++ ) + for (int i = 0; i < sd->status.inventorySize; i++ ) { // Check for Rentals on Inventory if( sd->status.inventory[i].nameid == 0 ) continue; // Nothing here @@ -773,7 +773,6 @@ static int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, sd->battle_status.speed = sd->base_status.speed = DEFAULT_WALK_SPEED; sd->state.warp_clean = 1; sd->catch_target_class = -1; - sd->inventorySize = 100; return 0; } @@ -783,7 +782,7 @@ static int pc_equippoint(struct map_session_data *sd, int n) int ep = 0; nullpo_ret(sd); - Assert_ret(n >= 0 && n < MAX_INVENTORY); + Assert_ret(n >= 0 && n < sd->status.inventorySize); if(!sd->inventory_data[n]) return 0; @@ -839,11 +838,9 @@ static int pc_item_equippoint(struct map_session_data *sd, struct item_data *id) static int pc_setinventorydata(struct map_session_data *sd) { - int i; - nullpo_ret(sd); - for (i = 0; i < MAX_INVENTORY; i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { int id = sd->status.inventory[i].nameid; sd->inventory_data[i] = id?itemdb->search(id):NULL; } @@ -903,7 +900,7 @@ static int pc_setequipindex(struct map_session_data *sd) for(i=0;iequip_index[i] = -1; - for(i=0;istatus.inventorySize; i++) { if(sd->status.inventory[i].nameid <= 0) continue; if(sd->status.inventory[i].equip) { @@ -1074,7 +1071,7 @@ static int pc_isequip(struct map_session_data *sd, int n) struct item_data *item; nullpo_ret(sd); - Assert_ret(n >= 0 && n < MAX_INVENTORY); + Assert_ret(n >= 0 && n < sd->status.inventorySize); item = sd->inventory_data[n]; @@ -4311,7 +4308,7 @@ static bool pc_can_insert_card_into(struct map_session_data *sd, int idx_card, i nullpo_ret(sd); - if (idx_equip < 0 || idx_equip >= MAX_INVENTORY || sd->inventory_data[idx_equip] == NULL) + if (idx_equip < 0 || idx_equip >= sd->status.inventorySize || sd->inventory_data[idx_equip] == NULL) return false; //Invalid item index. if (sd->status.inventory[idx_equip].nameid <= 0 || sd->status.inventory[idx_equip].amount < 1) return false; // target item missing @@ -4345,7 +4342,7 @@ static bool pc_can_insert_card(struct map_session_data *sd, int idx_card) { nullpo_ret(sd); - if (idx_card < 0 || idx_card >= MAX_INVENTORY || sd->inventory_data[idx_card] == NULL) + if (idx_card < 0 || idx_card >= sd->status.inventorySize || sd->inventory_data[idx_card] == NULL) return false; //Invalid card index. if (sd->status.inventory[idx_card].nameid <= 0 || sd->status.inventory[idx_card].amount < 1) return false; // target card missing @@ -4441,7 +4438,6 @@ static int pc_modifysellvalue(struct map_session_data *sd, int orig_value) *------------------------------------------*/ static int pc_checkadditem(struct map_session_data *sd, int nameid, int amount) { - int i; struct item_data* data; nullpo_ret(sd); @@ -4457,7 +4453,7 @@ static int pc_checkadditem(struct map_session_data *sd, int nameid, int amount) if( data->stack.inventory && amount > data->stack.amount ) return ADDITEM_OVERAMOUNT; - for(i=0;istatus.inventorySize; i++) { // FIXME: This does not consider the checked item's cards, thus could check a wrong slot for stackability. if(sd->status.inventory[i].nameid==nameid){ if( amount > MAX_AMOUNT - sd->status.inventory[i].amount || ( data->stack.inventory && amount > data->stack.amount - sd->status.inventory[i].amount ) ) @@ -4475,11 +4471,10 @@ static int pc_checkadditem(struct map_session_data *sd, int nameid, int amount) *------------------------------------------*/ static int pc_inventoryblank(struct map_session_data *sd) { - int i,b; - nullpo_ret(sd); + int b = 0; - for(i=0,b=0;istatus.inventorySize; i++) { if(sd->status.inventory[i].nameid==0) b++; } @@ -4676,8 +4671,8 @@ static int pc_search_inventory(struct map_session_data *sd, int item_id) int i; nullpo_retr(INDEX_NOT_FOUND, sd); - ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == item_id && (sd->status.inventory[i].amount > 0 || item_id == 0) ); - return ( i < MAX_INVENTORY ) ? i : INDEX_NOT_FOUND; + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].nameid == item_id && (sd->status.inventory[i].amount > 0 || item_id == 0)); + return (i < sd->status.inventorySize) ? i : INDEX_NOT_FOUND; } /*========================================== @@ -4739,11 +4734,11 @@ static int pc_additem(struct map_session_data *sd, const struct item *item_data, } } - i = MAX_INVENTORY; + i = sd->status.inventorySize; // Stackable | Non Rental if( itemdb->isstackable2(data) && item_data->expire_time == 0 ) { - for( i = 0; i < MAX_INVENTORY; i++ ) { + for (i = 0; i < sd->status.inventorySize; i++) { if( sd->status.inventory[i].nameid == item_data->nameid && sd->status.inventory[i].bound == item_data->bound && sd->status.inventory[i].expire_time == 0 && @@ -4758,7 +4753,7 @@ static int pc_additem(struct map_session_data *sd, const struct item *item_data, } } - if ( i >= MAX_INVENTORY ) { + if (i >= sd->status.inventorySize) { i = pc->search_inventory(sd,0); if (i == INDEX_NOT_FOUND) return 4; @@ -4818,7 +4813,7 @@ static int pc_additem(struct map_session_data *sd, const struct item *item_data, static int pc_delitem(struct map_session_data *sd, int n, int amount, int type, short reason, e_log_pick_type log_type) { nullpo_retr(1, sd); - Assert_retr(1, n >= 0 && n < MAX_INVENTORY); + Assert_retr(1, n >= 0 && n < sd->status.inventorySize); if(sd->status.inventory[n].nameid==0 || amount <= 0 || sd->status.inventory[n].amountinventory_data[n] == NULL) return 1; @@ -4852,7 +4847,7 @@ static int pc_dropitem(struct map_session_data *sd, int n, int amount) { nullpo_retr(1, sd); - if(n < 0 || n >= MAX_INVENTORY) + if(n < 0 || n >= sd->status.inventorySize) return 0; if(amount <= 0) @@ -4963,7 +4958,7 @@ static int pc_isUseitem(struct map_session_data *sd, int n) int nameid; nullpo_ret(sd); - Assert_ret(n >= 0 && n < MAX_INVENTORY); + Assert_ret(n >= 0 && n < sd->status.inventorySize); item = sd->inventory_data[n]; nameid = sd->status.inventory[n].nameid; @@ -5199,7 +5194,7 @@ static int pc_useitem(struct map_session_data *sd, int n) bool removeItem = false; nullpo_ret(sd); - Assert_ret(n >= 0 && n < MAX_INVENTORY); + Assert_ret(n >= 0 && n < sd->status.inventorySize); if (sd->npc_id || sd->state.workinprogress & 1) { #if PACKETVER >= 20110308 @@ -5436,7 +5431,7 @@ static int pc_cart_delitem(struct map_session_data *sd, int n, int amount, int t { struct item_data * data; nullpo_retr(1, sd); - Assert_retr(1, n >= 0 && n < MAX_INVENTORY); + Assert_retr(1, n >= 0 && n < MAX_CART); if( sd->status.cart[n].nameid == 0 || sd->status.cart[n].amount < amount || !(data = itemdb->exists(sd->status.cart[n].nameid)) ) return 1; @@ -5470,7 +5465,7 @@ static int pc_putitemtocart(struct map_session_data *sd, int idx, int amount) nullpo_ret(sd); - if (idx < 0 || idx >= MAX_INVENTORY) //Invalid index check [Skotlex] + if (idx < 0 || idx >= sd->status.inventorySize) //Invalid index check [Skotlex] return 1; item_data = &sd->status.inventory[idx]; @@ -5540,7 +5535,7 @@ static void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type t /* both restricted to inventory */ case IBT_PARTY: case IBT_CHARACTER: - for( i = 0; i < MAX_INVENTORY; i++ ){ + for (i = 0; i < sd->status.inventorySize; i++ ) { if( sd->status.inventory[i].bound == type ) { pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_SKILLUSE, LOG_TYPE_OTHER); // FIXME: is this the correct reason flag? } @@ -5552,7 +5547,7 @@ static void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type t case IBT_GUILD: { struct guild_storage *gstor = idb_get(gstorage->db,sd->status.guild_id); - for( i = 0; i < MAX_INVENTORY; i++ ){ + for (i = 0; i < sd->status.inventorySize; i++ ) { if(sd->status.inventory[i].bound == type) { if( gstor ) gstorage->additem(sd,gstor,&sd->status.inventory[i],sd->status.inventory[i].amount); @@ -8293,15 +8288,15 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src) if(id == 0) continue; if(id == -1){ - int eq_num=0,eq_n[MAX_INVENTORY],k; + int eq_num = 0, eq_n[MAX_INVENTORY], k; memset(eq_n,0,sizeof(eq_n)); - for(i=0;istatus.inventorySize; i++) { if( (type == 1 && !sd->status.inventory[i].equip) || (type == 2 && sd->status.inventory[i].equip) || type == 3) { - ARR_FIND( 0, MAX_INVENTORY, k, eq_n[k] <= 0 ); - if( k < MAX_INVENTORY ) + ARR_FIND(0, sd->status.inventorySize, k, eq_n[k] <= 0); + if (k < sd->status.inventorySize) eq_n[k] = i; eq_num++; @@ -8317,7 +8312,7 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src) } } else if(id > 0){ - for(i=0;istatus.inventorySize; i++) { if(sd->status.inventory[i].nameid == id && rnd()%10000 < per && ((type == 1 && !sd->status.inventory[i].equip) @@ -10148,7 +10143,7 @@ static int pc_equipitem(struct map_session_data *sd, int n, int req_pos) nullpo_ret(sd); - if( n < 0 || n >= MAX_INVENTORY ) { + if (n < 0 || n >= sd->status.inventorySize) { clif->equipitemack(sd,0,0,EIA_FAIL); return 0; } @@ -10356,7 +10351,7 @@ static int pc_unequipitem(struct map_session_data *sd, int n, int flag) nullpo_ret(sd); - if (n < 0 || n >= MAX_INVENTORY) { + if (n < 0 || n >= sd->status.inventorySize) { clif->unequipitemack(sd, 0, 0, UIA_FAIL); return 0; } @@ -10508,7 +10503,7 @@ static int pc_checkitem(struct map_session_data *sd) int id = 0; if (sd->itemcheck & PCCHECKITEM_INVENTORY) { - for (i = 0; i < MAX_INVENTORY; i++) { + for (i = 0; i < sd->status.inventorySize; i++) { if ((id = sd->status.inventory[i].nameid) == 0) continue; @@ -10588,7 +10583,7 @@ static int pc_checkitem(struct map_session_data *sd) } } - for (i = 0; i < MAX_INVENTORY; i++) { + for (i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].nameid == 0) continue; @@ -10762,11 +10757,14 @@ static int pc_divorce(struct map_session_data *sd) // Both players online, lets do the divorce manually sd->status.partner_id = 0; p_sd->status.partner_id = 0; - for( i = 0; i < MAX_INVENTORY; i++ ) + for (i = 0; i < sd->status.inventorySize; i++) { - if( sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F ) + if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F) pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_DIVORCE); - if( p_sd->status.inventory[i].nameid == WEDDING_RING_M || p_sd->status.inventory[i].nameid == WEDDING_RING_F ) + } + for (i = 0; i < p_sd->status.inventorySize; i++) + { + if (p_sd->status.inventory[i].nameid == WEDDING_RING_M || p_sd->status.inventory[i].nameid == WEDDING_RING_F) pc->delitem(p_sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_DIVORCE); } diff --git a/src/map/pc.h b/src/map/pc.h index 20b995519..cca15e829 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -260,7 +260,6 @@ struct map_session_data { struct mmo_charstatus status; struct item_data *inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) - int inventorySize; struct storage_data storage; ///< Account Storage enum pc_checkitem_types itemcheck; short equip_index[EQI_MAX]; diff --git a/src/map/pet.c b/src/map/pet.c index c32a92b78..dd9f1ebbf 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -94,10 +94,10 @@ static void pet_set_intimate(struct pet_data *pd, int value) if (value <= 0) { int i; - ARR_FIND(0, MAX_INVENTORY, i, sd->status.inventory[i].card[0] == CARD0_PET && + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); - if (i != MAX_INVENTORY) { + if (i != sd->status.inventorySize) { pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_EGG); } } @@ -342,10 +342,10 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) pet->lootitem_drop(pd,sd); // Pet Evolution - ARR_FIND(0, MAX_INVENTORY, i, sd->status.inventory[i].card[0] == CARD0_PET && + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET && pd->pet.pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); - if (i != MAX_INVENTORY) { + if (i != sd->status.inventorySize) { sd->status.inventory[i].attribute &= ~ATTR_BROKEN; sd->status.inventory[i].bound = IBT_NONE; } @@ -492,10 +492,10 @@ static int pet_recv_petdata(int account_id, struct s_pet *p, int flag) if(p->incubate == 1) { int i; // Get Egg Index - ARR_FIND(0, MAX_INVENTORY, i, sd->status.inventory[i].card[0] == CARD0_PET && + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].card[0] == CARD0_PET && p->pet_id == MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2])); - if(i == MAX_INVENTORY) { + if(i == sd->status.inventorySize) { ShowError("pet_recv_petdata: Hatching pet (%d:%s) aborted, couldn't find egg in inventory for removal!\n",p->pet_id, p->name); sd->status.pet_id = 0; return 1; @@ -527,7 +527,7 @@ static int pet_select_egg(struct map_session_data *sd, int egg_index) { nullpo_ret(sd); - if(egg_index < 0 || egg_index >= MAX_INVENTORY) + if (egg_index < 0 || egg_index >= sd->status.inventorySize) return 0; //Forged packet! if(sd->status.inventory[egg_index].card[0] == CARD0_PET) diff --git a/src/map/quest.c b/src/map/quest.c index f10d6847f..7a216095e 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -814,7 +814,7 @@ static bool quest_questinfo_validate_items(struct map_session_data *sd, struct q for (int i = 0; i < VECTOR_LENGTH(qi->items); i++) { struct questinfo_itemreq *item = &VECTOR_INDEX(qi->items, i); int count = 0; - for (int j = 0; j < MAX_INVENTORY; j++) { + for (int j = 0; j < sd->status.inventorySize; j++) { if (sd->status.inventory[j].nameid == item->nameid) count += sd->status.inventory[j].amount; } diff --git a/src/map/rodex.c b/src/map/rodex.c index 602754d42..eea27b6d0 100644 --- a/src/map/rodex.c +++ b/src/map/rodex.c @@ -83,7 +83,7 @@ static void rodex_add_item(struct map_session_data *sd, int16 idx, int16 amount) nullpo_retv(sd); - if (idx < 0 || idx >= MAX_INVENTORY) { + if (idx < 0 || idx >= sd->status.inventorySize) { clif->rodex_add_item_result(sd, idx, amount, RODEX_ADD_ITEM_FATAL_ERROR); return; } @@ -160,7 +160,7 @@ static void rodex_remove_item(struct map_session_data *sd, int16 idx, int16 amou struct item_data *itd; nullpo_retv(sd); - Assert_retv(idx >= 0 && idx < MAX_INVENTORY); + Assert_retv(idx >= 0 && idx < sd->status.inventorySize); for (i = 0; i < RODEX_MAX_ITEM; ++i) { if (sd->rodex.tmp.items[i].idx == idx) @@ -504,7 +504,7 @@ static void rodex_get_items(struct map_session_data *sd, int8 opentype, int64 ma } required_slots = msg->items_count; - for (i = 0; i < MAX_INVENTORY; ++i) { + for (i = 0; i < sd->status.inventorySize; ++i) { if (sd->status.inventory[i].nameid == 0) { empty_slots++; } else if (itemdb->isstackable(sd->status.inventory[i].nameid) == 1) { diff --git a/src/map/script.c b/src/map/script.c index 52c0cf75c..8d3de56a5 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7553,7 +7553,6 @@ static BUILDIN(viewpoint) *------------------------------------------*/ static BUILDIN(countitem) { - int nameid, i; int count = 0; struct item_data* id = NULL; @@ -7575,11 +7574,12 @@ static BUILDIN(countitem) return false; } - nameid = id->nameid; + int nameid = id->nameid; - for(i = 0; i < MAX_INVENTORY; i++) - if(sd->status.inventory[i].nameid == nameid) + for (int i = 0; i < sd->status.inventorySize; i++) { + if (sd->status.inventory[i].nameid == nameid) count += sd->status.inventory[i].amount; + } script_pushint(st,count); return true; @@ -7593,7 +7593,6 @@ static BUILDIN(countitem2) { int nameid, iden, ref, attr, c1, c2, c3, c4; int count = 0; - int i; struct item_data* id = NULL; struct map_session_data *sd = script->rid2sd(st); @@ -7623,7 +7622,7 @@ static BUILDIN(countitem2) c3 = script_getnum(st,8); c4 = script_getnum(st,9); - for(i = 0; i < MAX_INVENTORY; i++) + for (int i = 0; i < sd->status.inventorySize; i++) if (sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] != NULL && sd->status.inventory[i].amount > 0 && sd->status.inventory[i].nameid == nameid && sd->status.inventory[i].identify == iden && sd->status.inventory[i].refine == ref && @@ -9148,13 +9147,13 @@ static BUILDIN(getequipname) *------------------------------------------*/ static BUILDIN(getbrokenid) { - int i,num,id=0,brokencounter=0; + int num,id=0,brokencounter=0; struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; num=script_getnum(st,2); - for(i=0; istatus.inventorySize; i++) { if (sd->status.inventory[i].card[0] == CARD0_PET) continue; if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { @@ -9181,7 +9180,7 @@ static BUILDIN(getbrokencount) if (sd == NULL) return true; - for (i = 0; i < MAX_INVENTORY; i++) { + for (i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].card[0] == CARD0_PET) continue; if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) @@ -9198,14 +9197,13 @@ static BUILDIN(getbrokencount) *------------------------------------------*/ static BUILDIN(repair) { - int i,num; int repaircounter=0; struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; - num=script_getnum(st,2); - for(i=0; istatus.inventorySize; i++) { if (sd->status.inventory[i].card[0] == CARD0_PET) continue; if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { @@ -9229,12 +9227,12 @@ static BUILDIN(repair) *------------------------------------------*/ static BUILDIN(repairall) { - int i, repaircounter = 0; + int repaircounter = 0; struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; - for(i = 0; i < MAX_INVENTORY; i++) + for (int i = 0; i < sd->status.inventorySize; i++) { if (sd->status.inventory[i].card[0] == CARD0_PET) continue; @@ -14722,10 +14720,10 @@ static BUILDIN(getinventorylist) struct map_session_data *sd = script->rid2sd(st); char card_var[SCRIPT_VARNAME_LENGTH]; - int i,j=0,k; + int j=0,k; if(!sd) return true; - for(i=0;istatus.inventorySize; i++) { if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0) { pc->setreg(sd,reference_uid(script->add_variable("@inventorylist_id"), j),sd->status.inventory[i].nameid); pc->setreg(sd,reference_uid(script->add_variable("@inventorylist_amount"), j),sd->status.inventory[i].amount); @@ -14816,10 +14814,9 @@ static BUILDIN(getskilllist) static BUILDIN(clearitem) { struct map_session_data *sd = script->rid2sd(st); - int i; if (sd == NULL) return true; - for (i=0; istatus.inventorySize; i++) { if (sd->status.inventory[i].amount) { pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_NORMAL, LOG_TYPE_SCRIPT); } @@ -15590,19 +15587,18 @@ static BUILDIN(getmercinfo) *------------------------------------------*/ static BUILDIN(checkequipedcard) { - int n,i,c=0; struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; - c = script_getnum(st,2); + int c = script_getnum(st,2); - for( i=0; istatus.inventorySize; i++) { if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount && sd->inventory_data[i]) { if (itemdb_isspecial(sd->status.inventory[i].card[0])) continue; - for(n=0;ninventory_data[i]->slot;n++) { + for (int n = 0; n < sd->inventory_data[i]->slot; n++) { if(sd->status.inventory[i].card[n]==c) { script_pushint(st,1); return true; @@ -16470,9 +16466,9 @@ static BUILDIN(equip) ShowError("wrong item ID : equipitem(%d)\n",nameid); return false; } - ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid && sd->status.inventory[i].equip == 0 ); - if( i < MAX_INVENTORY ) - pc->equipitem(sd,i,item_data->equip); + ARR_FIND(0, sd->status.inventorySize, i, sd->status.inventory[i].nameid == nameid && sd->status.inventory[i].equip == 0); + if (i < sd->status.inventorySize) + pc->equipitem(sd, i, item_data->equip); return true; } @@ -16530,21 +16526,21 @@ static BUILDIN(equip2) c2 = script_getnum(st, 7); c3 = script_getnum(st, 8); - ARR_FIND( 0, MAX_INVENTORY, i,( sd->status.inventory[i].equip == 0 && + ARR_FIND(0, sd->status.inventorySize, i, (sd->status.inventory[i].equip == 0 && sd->status.inventory[i].nameid == nameid && sd->status.inventory[i].refine == ref && sd->status.inventory[i].attribute == attr && sd->status.inventory[i].card[0] == c0 && sd->status.inventory[i].card[1] == c1 && sd->status.inventory[i].card[2] == c2 && - sd->status.inventory[i].card[3] == c3 ) ); + sd->status.inventory[i].card[3] == c3)); - if( i < MAX_INVENTORY ) { + if (i < sd->status.inventorySize) { script_pushint(st,1); pc->equipitem(sd,i,item_data->equip); - } - else + } else { script_pushint(st,0); + } return true; } @@ -23658,7 +23654,7 @@ static BUILDIN(bg_join_team) *------------------------------------------*/ static BUILDIN(countbound) { - int i, type, j=0, k=0; + int type, j=0, k=0; struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) @@ -23666,7 +23662,7 @@ static BUILDIN(countbound) type = script_hasdata(st,2)?script_getnum(st,2):0; - for(i=0;istatus.inventorySize; i++) { if(sd->status.inventory[i].nameid > 0 && ( (!type && sd->status.inventory[i].bound > 0) || (type && sd->status.inventory[i].bound == type) @@ -23712,20 +23708,21 @@ static BUILDIN(checkbound) ShowError("script_checkbound: Not a valid bind type! Type=%d\n", bound_type); } - ARR_FIND( 0, MAX_INVENTORY, i, (sd->status.inventory[i].nameid == nameid && + ARR_FIND(0, sd->status.inventorySize, i, (sd->status.inventory[i].nameid == nameid && ( sd->status.inventory[i].refine == (script_hasdata(st,4)? script_getnum(st,4) : sd->status.inventory[i].refine) ) && ( sd->status.inventory[i].attribute == (script_hasdata(st,5)? script_getnum(st,5) : sd->status.inventory[i].attribute) ) && ( sd->status.inventory[i].card[0] == (script_hasdata(st,6)? script_getnum(st,6) : sd->status.inventory[i].card[0]) ) && ( sd->status.inventory[i].card[1] == (script_hasdata(st,7)? script_getnum(st,7) : sd->status.inventory[i].card[1]) ) && ( sd->status.inventory[i].card[2] == (script_hasdata(st,8)? script_getnum(st,8) : sd->status.inventory[i].card[2]) ) && ( sd->status.inventory[i].card[3] == (script_hasdata(st,9)? script_getnum(st,9) : sd->status.inventory[i].card[3]) ) && - ((sd->status.inventory[i].bound > 0 && !bound_type) || sd->status.inventory[i].bound == bound_type )) ); + ((sd->status.inventory[i].bound > 0 && !bound_type) || sd->status.inventory[i].bound == bound_type))); - if( i < MAX_INVENTORY ){ + if (i < sd->status.inventorySize) { script_pushint(st, sd->status.inventory[i].bound); return true; - } else + } else { script_pushint(st,0); + } return true; } @@ -25642,8 +25639,9 @@ static void script_hardcoded_constants(void) script->set_constant("MAX_LEVEL",MAX_LEVEL,false, false); script->set_constant("MAX_STORAGE",MAX_STORAGE,false, false); script->set_constant("MAX_GUILD_STORAGE",MAX_GUILD_STORAGE,false, false); - script->set_constant("MAX_CART",MAX_INVENTORY,false, false); + script->set_constant("MAX_CART", MAX_CART, false, false); script->set_constant("MAX_INVENTORY",MAX_INVENTORY,false, false); + script->set_constant("FIXED_INVENTORY_SIZE", FIXED_INVENTORY_SIZE, false, false); script->set_constant("MAX_ZENY",MAX_ZENY,false, false); script->set_constant("MAX_BANK_ZENY", MAX_BANK_ZENY, false, false); script->set_constant("MAX_BG_MEMBERS",MAX_BG_MEMBERS,false, false); diff --git a/src/map/skill.c b/src/map/skill.c index 8410a77d0..069db55df 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -14490,8 +14490,8 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s **/ case AB_ANCILLA: { - int count = 0, i; - for( i = 0; i < MAX_INVENTORY; i ++ ) + int count = 0; + for (int i = 0; i < sd->status.inventorySize; i ++) if (sd->status.inventory[i].nameid == ITEMID_ANSILA) count += sd->status.inventory[i].amount; if( count >= 3 ) { @@ -16109,7 +16109,7 @@ static void skill_repairweapon(struct map_session_data *sd, int idx) if (idx == 0xFFFF || idx == -1) // No item selected ('Cancel' clicked) return; - if( idx < 0 || idx >= MAX_INVENTORY ) + if (idx < 0 || idx >= sd->status.inventorySize) return; //Invalid index?? item = &target_sd->status.inventory[idx]; @@ -16157,7 +16157,7 @@ static void skill_identify(struct map_session_data *sd, int idx) nullpo_retv(sd); sd->state.workinprogress = 0; - if(idx >= 0 && idx < MAX_INVENTORY) { + if (idx >= 0 && idx < sd->status.inventorySize) { if(sd->status.inventory[idx].nameid > 0 && sd->status.inventory[idx].identify == 0 ){ flag=0; sd->status.inventory[idx].identify=1; @@ -16173,7 +16173,7 @@ static void skill_weaponrefine(struct map_session_data *sd, int idx) { nullpo_retv(sd); - if (idx >= 0 && idx < MAX_INVENTORY) { + if (idx >= 0 && idx < sd->status.inventorySize) { struct item *item; struct item_data *ditem = sd->inventory_data[idx]; item = &sd->status.inventory[idx]; @@ -17992,8 +17992,8 @@ static int skill_can_produce_mix(struct map_session_data *sd, int nameid, int tr if (pc->search_inventory(sd,id) == INDEX_NOT_FOUND) return 0; } else { - int x, y; - for(y=0,x=0;ystatus.inventorySize; y++) if( sd->status.inventory[y].nameid == id ) x+=sd->status.inventory[y].amount; if(xdbs->produce_db[i].mat_amount[j]) @@ -18064,7 +18064,7 @@ static int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int n else temp_qty = 1; if (data->stack.inventory) { - for( i = 0; i < MAX_INVENTORY; i++ ) { + for (i = 0; i < sd->status.inventorySize; i++ ) { if( sd->status.inventory[i].nameid == nameid ) { if( sd->status.inventory[i].amount >= data->stack.amount ) { #if PACKETVER >= 20090729 @@ -18872,7 +18872,7 @@ static int skill_elementalanalysis(struct map_session_data *sd, uint16 skill_lv, del_amount -= (del_amount % 10); add_amount = (skill_lv == 1) ? del_amount * (5 + rnd()%5) : del_amount / 10 ; - if (idx < 0 || idx >= MAX_INVENTORY + if (idx < 0 || idx >= sd->status.inventorySize || (nameid = sd->status.inventory[idx].nameid) <= 0 || del_amount < 0 || del_amount > sd->status.inventory[idx].amount) { clif->skill_fail(sd, SO_EL_ANALYSIS, USESKILL_FAIL_LEVEL, 0, 0); @@ -18943,7 +18943,7 @@ static int skill_changematerial(struct map_session_data *sd, const struct itemli for (k = 0; k < VECTOR_LENGTH(*item_list); k++) { const struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, k); int idx = entry->id; - Assert_ret(idx >= 0 && idx < MAX_INVENTORY); + Assert_ret(idx >= 0 && idx < sd->status.inventorySize); amount = entry->amount; nameid = sd->status.inventory[idx].nameid; if (nameid > 0 && sd->status.inventory[idx].identify == 0) { diff --git a/src/map/status.c b/src/map/status.c index 75744c59b..65b52cbcf 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2446,7 +2446,7 @@ static int status_calc_pc_(struct map_session_data *sd, enum e_status_calc_opt o sd->regen.sregen = &sd->sregen; sd->regen.ssregen = &sd->ssregen; sd->weight=0; - for(i=0;istatus.inventorySize; i++) { if(sd->status.inventory[i].nameid==0 || sd->inventory_data[i] == NULL) continue; sd->weight += sd->inventory_data[i]->weight*sd->status.inventory[i].amount; diff --git a/src/map/storage.c b/src/map/storage.c index a6f0715e7..90b620f63 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -285,7 +285,7 @@ static int storage_add_from_inventory(struct map_session_data *sd, int index, in if (sd->storage.aggregate > MAX_STORAGE) return 0; // storage full - if (index < 0 || index >= MAX_INVENTORY) + if (index < 0 || index >= sd->status.inventorySize) return 0; if (sd->status.inventory[index].nameid <= 0) @@ -623,7 +623,7 @@ static int storage_guild_storageadd(struct map_session_data *sd, int index, int if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE ) return 0; - if( index<0 || index>=MAX_INVENTORY ) + if (index < 0 || index >= sd->status.inventorySize) return 0; if( sd->status.inventory[index].nameid <= 0 ) diff --git a/src/map/trade.c b/src/map/trade.c index d4f846d19..9c284ba23 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -209,7 +209,7 @@ static int impossible_trade_check(struct map_session_data *sd) // remove this part: arrows can be trade and equipped // re-added! [celest] // remove equipped items (they can not be trade) - for (i = 0; i < MAX_INVENTORY; i++) + for (i = 0; i < sd->status.inventorySize; i++) if (inventory[i].nameid > 0 && inventory[i].equip && !(inventory[i].equip & EQP_AMMO)) memset(&inventory[i], 0, sizeof(struct item)); @@ -218,7 +218,7 @@ static int impossible_trade_check(struct map_session_data *sd) if (!sd->deal.item[i].amount) continue; index = sd->deal.item[i].index; - if (index < 0 || index >= MAX_INVENTORY) + if (index < 0 || index >= sd->status.inventorySize) return 1; if (inventory[index].amount < sd->deal.item[i].amount) { // if more than the player have -> hack @@ -281,9 +281,9 @@ static int trade_check(struct map_session_data *sd, struct map_session_data *tsd return 0; //qty Exploit? data = itemdb->search(inventory[n].nameid); - i = MAX_INVENTORY; + i = tsd->status.inventorySize; if (itemdb->isstackable2(data)) { //Stackable item. - for(i = 0; i < MAX_INVENTORY; i++) + for(i = 0; i < tsd->status.inventorySize; i++) if (inventory2[i].nameid == inventory[n].nameid && inventory2[i].card[0] == inventory[n].card[0] && inventory2[i].card[1] == inventory[n].card[1] && inventory2[i].card[2] == inventory[n].card[2] && inventory2[i].card[3] == inventory[n].card[3]) { @@ -295,9 +295,9 @@ static int trade_check(struct map_session_data *sd, struct map_session_data *tsd } } - if (i == MAX_INVENTORY) {// look for an empty slot. - for(i = 0; i < MAX_INVENTORY && inventory2[i].nameid; i++); - if (i == MAX_INVENTORY) + if (i == tsd->status.inventorySize) {// look for an empty slot. + for (i = 0; i < tsd->status.inventorySize && inventory2[i].nameid; i++); + if (i == tsd->status.inventorySize) return 0; memcpy(&inventory2[i], &inventory[n], sizeof(struct item)); inventory2[i].amount = amount; @@ -308,15 +308,15 @@ static int trade_check(struct map_session_data *sd, struct map_session_data *tsd if (!amount) continue; n = tsd->deal.item[trade_i].index; - if (n < 0 || n >= MAX_INVENTORY) + if (n < 0 || n >= tsd->status.inventorySize) return 0; if (amount > inventory2[n].amount) return 0; // search if it's possible to add item (for full inventory) data = itemdb->search(inventory2[n].nameid); - i = MAX_INVENTORY; + i = sd->status.inventorySize; if (itemdb->isstackable2(data)) { - for(i = 0; i < MAX_INVENTORY; i++) + for(i = 0; i < sd->status.inventorySize; i++) if (inventory[i].nameid == inventory2[n].nameid && inventory[i].card[0] == inventory2[n].card[0] && inventory[i].card[1] == inventory2[n].card[1] && inventory[i].card[2] == inventory2[n].card[2] && inventory[i].card[3] == inventory2[n].card[3]) { @@ -327,9 +327,9 @@ static int trade_check(struct map_session_data *sd, struct map_session_data *tsd break; } } - if (i == MAX_INVENTORY) { - for(i = 0; i < MAX_INVENTORY && inventory[i].nameid; i++); - if (i == MAX_INVENTORY) + if (i == sd->status.inventorySize) { + for(i = 0; i < sd->status.inventorySize && inventory[i].nameid; i++); + if (i == sd->status.inventorySize) return 0; memcpy(&inventory[i], &inventory2[n], sizeof(struct item)); inventory[i].amount = amount; @@ -369,7 +369,7 @@ static void trade_tradeadditem(struct map_session_data *sd, short index, short a index -= 2; // 0 is for zeny, 1 is unknown. Gravity, go figure... //Item checks... - if( index < 0 || index >= MAX_INVENTORY ) + if (index < 0 || index >= sd->status.inventorySize) return; if( amount < 0 || amount > sd->status.inventory[index].amount ) return; -- cgit v1.2.3-70-g09d2 From d17b51770830d9e9e395d1b87b26572d8434fd57 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 06:27:52 +0300 Subject: Add script command expandInventoryAck It send initial response for inventory expanding request. --- doc/script_commands.txt | 19 ++++++++++++++++++- src/map/script.c | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) (limited to 'src/map') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 0096cedfd..5fad09c9f 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10256,5 +10256,22 @@ That command will send a service message to the chat window of the character specified by account ID or name, or to connected to npc player. It will not be seen by anyone else. -Works fro 20170830 RE and main and for any zero clients +Works for 20170830 RE and main and for any zero clients +--------------------------------------- + +*expandInventoryAck({, }) + +Send initial inventory expansion result. +Normally this function should be called from script label +inventory_expansion::OnInventoryExpandRequest. + +Valid result statuses: + EXPAND_INVENTORY_ASK_CONFIRMATION - force client to ask player about inventory expansion + EXPAND_INVENTORY_FAILED - other failed reason + EXPAND_INVENTORY_OTHER_WORK - failed because player busy with other work + EXPAND_INVENTORY_MISSING_ITEM - failed because missing item + EXPAND_INVENTORY_MAX_SIZE - failed because inventory size already maximum + +ItemId make sense only if result is EXPAND_INVENTORY_ASK_CONFIRMATION +Works for 20181212 zero clients --------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index 8d3de56a5..cf192fce8 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24860,6 +24860,20 @@ static BUILDIN(enchantitem) return true; } +// send ack to inventory expand request +static BUILDIN(expandInventoryAck) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + int itemId = 0; + if (script_hasdata(st, 3)) { + itemId = script_getnum(st, 3); + } + clif->inventoryExpandAck(sd, script_getnum(st, 2), itemId); + return true; +} + /** * Adds a built-in script function. * @@ -25600,6 +25614,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(itempreview, "i"), BUILDIN_DEF(enchantitem, "iii"), + BUILDIN_DEF(expandInventoryAck, "i?"), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up @@ -26023,6 +26038,12 @@ static void script_hardcoded_constants(void) script->set_constant("ITR_NOAUCTION", ITR_NOAUCTION, false, false); script->set_constant("ITR_ALL", ITR_ALL, false, false); + script->constdb_comment("inventory expand ack responds"); + script->set_constant("EXPAND_INV_ASK_CONFIRMATION", EXPAND_INVENTORY_ASK_CONFIRMATION, false, false); + script->set_constant("EXPAND_INV_FAILED", EXPAND_INVENTORY_FAILED, false, false); + script->set_constant("EXPAND_INV_OTHER_WORK", EXPAND_INVENTORY_OTHER_WORK, false, false); + script->set_constant("EXPAND_INV_MISSING_ITEM", EXPAND_INVENTORY_MISSING_ITEM, false, false); + script->set_constant("EXPAND_INV_MAX_SIZE", EXPAND_INVENTORY_MAX_SIZE, false, false); script->constdb_comment("Renewal"); #ifdef RENEWAL -- cgit v1.2.3-70-g09d2 From 16f3fe4fd1eeaa27ad093ea70b0a26054096bdb0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 06:52:34 +0300 Subject: Add script command expandInventoryResult. This function send to client final expand status. --- doc/script_commands.txt | 20 ++++++++++++++++++++ src/map/script.c | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+) (limited to 'src/map') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 5fad09c9f..d2f945719 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10247,6 +10247,7 @@ card_id - any card item id. returns true if all parameters correct false in other case. Works for 20160831 main, 20151118 RE, any zero version + --------------------------------------- *servicemessage("", {, }) @@ -10257,6 +10258,7 @@ specified by account ID or name, or to connected to npc player. It will not be seen by anyone else. Works for 20170830 RE and main and for any zero clients + --------------------------------------- *expandInventoryAck({, }) @@ -10274,4 +10276,22 @@ Valid result statuses: ItemId make sense only if result is EXPAND_INVENTORY_ASK_CONFIRMATION Works for 20181212 zero clients + +--------------------------------------- + +*expandInventoryResult() + +Send final inventory expansion result. +Normally this function should be called from script label +inventory_expansion::OnInventoryExpandConfirmed. + +Valid result values: + EXPAND_INVENTORY_RESULT_SUCCESS - success message + EXPAND_INVENTORY_RESULT_FAILED - other failed reason + EXPAND_INVENTORY_RESULT_OTHER_WORK - failed because player busy with other work + EXPAND_INVENTORY_RESULT_MISSING_ITEM - failed because missing item + EXPAND_INVENTORY_RESULT_MAX_SIZE - failed because inventory size already maximum + +Works for 20181212 zero clients + --------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index cf192fce8..36b316320 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24874,6 +24874,16 @@ static BUILDIN(expandInventoryAck) return true; } +// send final ack to inventory expand request +static BUILDIN(expandInventoryResult) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + clif->inventoryExpandResult(sd, script_getnum(st, 2)); + return true; +} + /** * Adds a built-in script function. * @@ -25615,6 +25625,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(itempreview, "i"), BUILDIN_DEF(enchantitem, "iii"), BUILDIN_DEF(expandInventoryAck, "i?"), + BUILDIN_DEF(expandInventoryResult, "i"), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up @@ -26045,6 +26056,13 @@ static void script_hardcoded_constants(void) script->set_constant("EXPAND_INV_MISSING_ITEM", EXPAND_INVENTORY_MISSING_ITEM, false, false); script->set_constant("EXPAND_INV_MAX_SIZE", EXPAND_INVENTORY_MAX_SIZE, false, false); + script->constdb_comment("inventory expand final responds"); + script->set_constant("EXPAND_INV_RESULT_SUCCESS", EXPAND_INVENTORY_RESULT_SUCCESS, false, false); + script->set_constant("EXPAND_INV_RESULT_FAILED", EXPAND_INVENTORY_RESULT_FAILED, false, false); + script->set_constant("EXPAND_INV_RESULT_OTHER_WORK", EXPAND_INVENTORY_RESULT_OTHER_WORK, false, false); + script->set_constant("EXPAND_INV_RESULT_MISSING_ITEM", EXPAND_INVENTORY_RESULT_MISSING_ITEM, false, false); + script->set_constant("EXPAND_INV_RESULT_MAX_SIZE", EXPAND_INVENTORY_RESULT_MAX_SIZE, false, false); + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); -- cgit v1.2.3-70-g09d2 From c79927b6879f07784ceb19a606483acc791dea80 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 19:35:17 +0300 Subject: Add script command expandInventory This command allow adjust inventory size to positive or negative value. --- doc/script_commands.txt | 10 ++++++++++ src/map/pc.c | 18 ++++++++++++++++++ src/map/pc.h | 1 + src/map/script.c | 11 +++++++++++ 4 files changed, 40 insertions(+) (limited to 'src/map') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index d2f945719..5a9894217 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10295,3 +10295,13 @@ Valid result values: Works for 20181212 zero clients --------------------------------------- + +*expandInventory() + +Adjust player inventory to given value. +Maximum inventory size is MAX_INVENTORY. +Minimum inventory size is FIXED_INVENTORY_SIZE. +For supported clients it send inventory change packet. For old clients, +this change is silent. + +--------------------------------------- diff --git a/src/map/pc.c b/src/map/pc.c index ad8cf2a94..94d8cd0c6 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -12338,6 +12338,23 @@ static bool pc_has_second_costume(struct map_session_data *sd) return false; } +static bool pc_expandInventory(struct map_session_data *sd, int adjustSize) +{ + nullpo_retr(false, sd); + const int invSize = sd->status.inventorySize; + if (adjustSize > MAX_INVENTORY || invSize + adjustSize <= FIXED_INVENTORY_SIZE || invSize + adjustSize > MAX_INVENTORY) { + clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_MAX_SIZE); + return false; + } + if (pc_isdead(sd) || sd->state.vending || sd->state.buyingstore || sd->chat_id != 0 || sd->state.trading || sd->state.storage_flag || sd->state.prevend) { + clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_OTHER_WORK); + return false; + } + sd->status.inventorySize += adjustSize; + clif->inventoryExpansionInfo(sd); + return true; +} + static void do_final_pc(void) { @@ -12740,4 +12757,5 @@ void pc_defaults(void) pc->isDeathPenaltyJob = pc_isDeathPenaltyJob; pc->has_second_costume = pc_has_second_costume; + pc->expandInventory = pc_expandInventory; } diff --git a/src/map/pc.h b/src/map/pc.h index cca15e829..bc2fd5a62 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1185,6 +1185,7 @@ END_ZEROED_BLOCK; /* End */ bool (*check_basicskill) (struct map_session_data *sd, int level); bool (*isDeathPenaltyJob) (uint16 job); bool (*has_second_costume) (struct map_session_data *sd); + bool (*expandInventory) (struct map_session_data *sd, int adjustSize); }; #ifdef HERCULES_CORE diff --git a/src/map/script.c b/src/map/script.c index 36b316320..8dadf6d57 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24884,6 +24884,16 @@ static BUILDIN(expandInventoryResult) return true; } +// adjust player inventory size to given value positive or negative +static BUILDIN(expandInventory) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + script_pushint(st, pc->expandInventory(sd, script_getnum(st, 2))); + return true; +} + /** * Adds a built-in script function. * @@ -25626,6 +25636,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(enchantitem, "iii"), BUILDIN_DEF(expandInventoryAck, "i?"), BUILDIN_DEF(expandInventoryResult, "i"), + BUILDIN_DEF(expandInventory, "i"), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up -- cgit v1.2.3-70-g09d2 From ec05dccfddedf8250f1df61ce94dafb6823dace7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 19:46:43 +0300 Subject: Add script command getInventorySize. This command allow read current max inventory size. --- doc/script_commands.txt | 9 +++++++++ src/map/script.c | 11 +++++++++++ 2 files changed, 20 insertions(+) (limited to 'src/map') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 5a9894217..5171d65f3 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10303,5 +10303,14 @@ Maximum inventory size is MAX_INVENTORY. Minimum inventory size is FIXED_INVENTORY_SIZE. For supported clients it send inventory change packet. For old clients, this change is silent. +Current max inventory size can be read by function getInventorySize(). + +--------------------------------------- + +*getInventorySize() + +Return current player max inventory size. +This value always smaller or equal to MAX_INVENTORY. +Size can be changed by group of functions expandInventory* --------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index 8dadf6d57..3d3fba867 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24894,6 +24894,16 @@ static BUILDIN(expandInventory) return true; } +// return current player inventory size +static BUILDIN(getInventorySize) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + script_pushint(st, sd->status.inventorySize); + return true; +} + /** * Adds a built-in script function. * @@ -25637,6 +25647,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(expandInventoryAck, "i?"), BUILDIN_DEF(expandInventoryResult, "i"), BUILDIN_DEF(expandInventory, "i"), + BUILDIN_DEF(getInventorySize, ""), }; int i, len = ARRAYLENGTH(BUILDIN); RECREATE(script->buildin, char *, script->buildin_count + len); // Pre-alloc to speed up -- cgit v1.2.3-70-g09d2 From 2c8e11ba55a7257124610b1ee7286e07bf6b1fe9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 20:01:06 +0300 Subject: Add additional checks into CZ_INVENTORY_EXPAND and CZ_INVENTORY_EXPAND_CONFIRMED packets. --- src/map/clif.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 123dd1a52..a81b967d1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3111,6 +3111,15 @@ static void clif_parse_inventoryExpansion(int fd, struct map_session_data *sd) _ static void clif_parse_inventoryExpansion(int fd, struct map_session_data *sd) { #if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 + if (pc_isdead(sd) || pc_cant_act(sd)) { + clif->inventoryExpandAck(sd, EXPAND_INVENTORY_OTHER_WORK, 0); + return; + } + if (sd->status.inventorySize == MAX_INVENTORY) { + clif->inventoryExpandAck(sd, EXPAND_INVENTORY_MAX_SIZE, 0); + return; + } + char evname[EVENT_NAME_LENGTH]; struct event_data *ev = NULL; @@ -3127,6 +3136,15 @@ static void clif_parse_inventoryExpansionConfirmed(int fd, struct map_session_da static void clif_parse_inventoryExpansionConfirmed(int fd, struct map_session_data *sd) { #if PACKETVER_MAIN_NUM >= 20181031 || PACKETVER_RE_NUM >= 20181031 || PACKETVER_ZERO_NUM >= 20181114 + if (pc_isdead(sd) || pc_cant_act(sd)) { + clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_OTHER_WORK); + return; + } + if (sd->status.inventorySize == MAX_INVENTORY) { + clif->inventoryExpandResult(sd, EXPAND_INVENTORY_RESULT_MAX_SIZE); + return; + } + char evname[EVENT_NAME_LENGTH]; struct event_data *ev = NULL; -- cgit v1.2.3-70-g09d2 From 59eb8ed011d447ba91c085590c11e2681773d2a0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 23:51:48 +0300 Subject: Add packet CZ_REQ_REMAINTIME (with empty handler) --- src/map/clif.c | 7 +++++++ src/map/clif.h | 1 + src/map/packets.h | 1 + src/map/packets_struct.h | 5 +++++ 4 files changed, 14 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index a81b967d1..b0698fefd 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3173,6 +3173,12 @@ static void clif_parse_inventoryExpansionRejected(int fd, struct map_session_dat #endif } +// CZ_REQ_REMAINTIME +static void clif_parse_reqRemainTime(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_reqRemainTime(int fd, struct map_session_data *sd) +{ +} + /// Removes cart (ZC_CARTOFF). /// 012b /// Client behavior: @@ -23362,4 +23368,5 @@ void clif_defaults(void) clif->petEvolutionResult = clif_pet_evolution_result; clif->pMemorialDungeonCommand = clif_parse_memorial_dungeon_command; + clif->pReqRemainTime = clif_parse_reqRemainTime; } diff --git a/src/map/clif.h b/src/map/clif.h index 47766b33d..568c312cf 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1585,6 +1585,7 @@ struct clif_interface { void (*camera_change) (struct map_session_data *sd, float range, float rotation, float latitude, enum send_target target); void (*item_preview) (struct map_session_data *sd, int n); bool (*enchant_equipment) (struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId); + void (*pReqRemainTime) (int fd, struct map_session_data *sd); }; #ifdef HERCULES_CORE diff --git a/src/map/packets.h b/src/map/packets.h index 4ce7ee916..8e392cc63 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -147,6 +147,7 @@ packet(0x01ba,clif->pGMShift,2); packet(0x01bb,clif->pGMShift,2); packet(0x01bc,clif->pGMRecall,2); packet(0x01bd,clif->pGMRecall,2); +packet(0x01c0,clif->pReqRemainTime); packet(0x01ce,clif->pAutoSpell,2); packet(0x01d5,clif->pNpcStringInput,2,4,8); packet(0x01df,clif->pGMReqAccountName,2); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 1283f8494..26e6343d7 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3029,6 +3029,11 @@ struct PACKET_CZ_INVENTORY_EXPAND_REJECTED { DEFINE_PACKET_HEADER(CZ_INVENTORY_EXPAND_REJECTED, 0x0b19); #endif +struct PACKET_CZ_REQ_REMAINTIME { + int16 packetType; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_REQ_REMAINTIME, 0x01c0); + #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 -- cgit v1.2.3-70-g09d2 From 95c8d0751bcf73998c43550ee951014930f334e0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Dec 2018 21:05:52 +0300 Subject: Improve packet ZC_NPC_MARKET_OPEN --- src/map/clif.c | 35 ++++++++++++++++++----------------- src/map/packets_struct.h | 33 ++++++++++++++++++--------------- 2 files changed, 36 insertions(+), 32 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index b0698fefd..4e4e5ab8c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -92,8 +92,9 @@ static struct ZC_STORE_ITEMLIST_EQUIP storelist_equip; static struct packet_viewequip_ack viewequip_list; #if PACKETVER >= 20131223 static struct packet_npc_market_result_ack npcmarket_result; -static struct packet_npc_market_open npcmarket_open; #endif +// temporart buffer for send big packets +char packet_buf[0xffff]; //#define DUMP_UNKNOWN_PACKET //#define DUMP_INVALID_PACKET @@ -19871,31 +19872,31 @@ static void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) /* NPC Market (by Ind after an extensive debugging of the packet, only possible thanks to Yommy <3) */ static void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) { -#if PACKETVER >= 20131223 - struct npc_item_list *shop; - unsigned short shop_size, i, c; - +#if PACKETVER_MAIN_NUM >= 20131120 || PACKETVER_RE_NUM >= 20131106 || defined(PACKETVER_ZERO) nullpo_retv(sd); nullpo_retv(nd); - shop = nd->u.scr.shop->item; - shop_size = nd->u.scr.shop->items; - npcmarket_open.PacketType = npcmarketopenType; + struct npc_item_list *shop = nd->u.scr.shop->item; + const int shop_size = nd->u.scr.shop->items; - for(i = 0, c = 0; i < shop_size; i++) { + int c = 0; + int maxCount = (sizeof(packet_buf) - sizeof(struct PACKET_ZC_NPC_MARKET_OPEN)) / sizeof(struct PACKET_ZC_NPC_MARKET_OPEN_sub); + struct PACKET_ZC_NPC_MARKET_OPEN *packet = (struct PACKET_ZC_NPC_MARKET_OPEN*)&packet_buf[0]; + packet->packetType = HEADER_ZC_NPC_MARKET_OPEN; + + for (int i = 0; i < shop_size && c < maxCount; i++) { struct item_data *id = NULL; if (shop[i].nameid && (id = itemdb->exists(shop[i].nameid)) != NULL) { - npcmarket_open.list[c].nameid = shop[i].nameid; - npcmarket_open.list[c].price = shop[i].value; - npcmarket_open.list[c].qty = shop[i].qty; - npcmarket_open.list[c].type = itemtype(id->type); - npcmarket_open.list[c].view = ( id->view_id > 0 ) ? id->view_id : id->nameid; + packet->list[c].nameid = shop[i].nameid; + packet->list[c].price = shop[i].value; + packet->list[c].qty = shop[i].qty; + packet->list[c].type = itemtype(id->type); + packet->list[c].weight = id->weight; c++; } } - npcmarket_open.PacketLength = 4 + ( sizeof(npcmarket_open.list[0]) * c ); - - clif->send(&npcmarket_open,npcmarket_open.PacketLength,&sd->bl,SELF); + packet->packetLength = sizeof(struct PACKET_ZC_NPC_MARKET_OPEN) + sizeof(struct PACKET_ZC_NPC_MARKET_OPEN_sub) * c; + clif->send(packet, packet->packetLength, &sd->bl, SELF); #endif } diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 26e6343d7..9b82d82b9 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -1391,26 +1391,29 @@ struct packet_npc_market_result_ack { } list[MAX_INVENTORY];/* assuming MAX_INVENTORY is max since you can't hold more than MAX_INVENTORY items thus cant buy that many at once. */ } __attribute__((packed)); -struct packet_npc_market_open { - int16 PacketType; - int16 PacketLength; - /* inner struct figured by Ind after some annoying hour of debugging (data Thanks to Yommy) */ - struct { +#if PACKETVER_MAIN_NUM >= 20131120 || PACKETVER_RE_NUM >= 20131106 || defined(PACKETVER_ZERO) +/* inner struct figured by Ind after some annoying hour of debugging (data Thanks to Yommy) */ +struct PACKET_ZC_NPC_MARKET_OPEN_sub { #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 - uint32 nameid; + uint32 nameid; #else - uint16 nameid; + uint16 nameid; #endif - uint8 type; - uint32 price; - uint32 qty; - uint16 view; - // It seems that the client doesn't have any hard-coded limit for this list - // it's possible to send up to 1890 items without dropping a packet that's - // too large [Panikon] - } list[1000];/* TODO: whats the actual max of this? */ + uint8 type; + uint32 price; + uint32 qty; + uint16 weight; } __attribute__((packed)); +struct PACKET_ZC_NPC_MARKET_OPEN { + int16 packetType; + int16 packetLength; + struct PACKET_ZC_NPC_MARKET_OPEN_sub list[]; +} __attribute__((packed)); + +DEFINE_PACKET_HEADER(ZC_NPC_MARKET_OPEN, 0x09d5); +#endif + struct packet_wis_end { int16 PacketType; int8 result; -- cgit v1.2.3-70-g09d2 From a0f8fc8cd4a4bd6e245848835db2775596b9362f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Dec 2018 05:17:52 +0300 Subject: Update packet ZC_CAMERA_INFO to new format. --- src/map/clif.c | 4 ++-- src/map/packets_struct.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 4e4e5ab8c..e9c69257b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -22125,7 +22125,7 @@ static void clif_camera_showWindow(struct map_session_data *sd) #if PACKETVER >= 20160525 nullpo_retv(sd); struct PACKET_ZC_CAMERA_INFO p; - p.packetType = 0xa78; + p.packetType = HEADER_ZC_CAMERA_INFO; p.action = 1; p.range = 0; p.rotation = 0; @@ -22139,7 +22139,7 @@ static void clif_camera_change(struct map_session_data *sd, float range, float r #if PACKETVER >= 20160525 nullpo_retv(sd); struct PACKET_ZC_CAMERA_INFO p; - p.packetType = 0xa78; + p.packetType = HEADER_ZC_CAMERA_INFO; p.action = 0; p.range = range; p.rotation = rotation; diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 9b82d82b9..8fbe64e5f 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2896,6 +2896,7 @@ struct PACKET_ZC_REMOVE_EFFECT { uint32 effectId; } __attribute__((packed)); +#if PACKETVER >= 20160525 struct PACKET_ZC_CAMERA_INFO { int16 packetType; int8 action; @@ -2903,6 +2904,8 @@ struct PACKET_ZC_CAMERA_INFO { float rotation; float latitude; } __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_CAMERA_INFO, 0x0a78); +#endif #if PACKETVER_MAIN_NUM >= 20181128 || PACKETVER_RE_NUM >= 20181031 // PACKET_ZC_AUTOSPELLLIST2 -- cgit v1.2.3-70-g09d2 From 912bbffb23c385178b3d831b58deb76103bac322 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Dec 2018 05:14:33 +0300 Subject: Add packet CZ_CAMERA_INFO This will allow use client command: /viewpointvalue - show/hide camera information /setcamera range rotation latitude - same with @camerainfo --- src/map/clif.c | 16 ++++++++++++++++ src/map/clif.h | 1 + src/map/packets.h | 5 +++++ src/map/packets_struct.h | 11 +++++++++++ 4 files changed, 33 insertions(+) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index e9c69257b..fd3c01168 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -22148,6 +22148,21 @@ static void clif_camera_change(struct map_session_data *sd, float range, float r #endif } +static void clif_parse_cameraInfo(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); +static void clif_parse_cameraInfo(int fd, struct map_session_data *sd) +{ +#if PACKETVER >= 20160525 + const struct PACKET_CZ_CAMERA_INFO *const p = RFIFOP(fd, 0); + char command[100]; + if (p->action == 1) { + sprintf(command, "%ccamerainfo", atcommand->at_symbol); + } else { + sprintf(command, "%ccamerainfo %15f %15f %15f", atcommand->at_symbol, p->range, p->rotation, p->latitude); + } + atcommand->exec(fd, sd, command, true); +#endif +} + // show item preview in already opened preview window static void clif_item_preview(struct map_session_data *sd, int n) { @@ -23361,6 +23376,7 @@ void clif_defaults(void) clif->camera_showWindow = clif_camera_showWindow; clif->camera_change = clif_camera_change; + clif->pCameraInfo = clif_parse_cameraInfo; clif->item_preview = clif_item_preview; clif->enchant_equipment = clif_enchant_equipment; diff --git a/src/map/clif.h b/src/map/clif.h index 568c312cf..170e9639d 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1583,6 +1583,7 @@ struct clif_interface { void (*pMemorialDungeonCommand) (int fd, struct map_session_data *sd); void (*camera_showWindow) (struct map_session_data *sd); void (*camera_change) (struct map_session_data *sd, float range, float rotation, float latitude, enum send_target target); + void (*pCameraInfo) (int fd, struct map_session_data *sd); void (*item_preview) (struct map_session_data *sd, int n); bool (*enchant_equipment) (struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId); void (*pReqRemainTime) (int fd, struct map_session_data *sd); diff --git a/src/map/packets.h b/src/map/packets.h index 8e392cc63..81b861f78 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -1789,6 +1789,11 @@ packet(0x96e,clif->ackmergeitems); // changed packet sizes #endif +// all 2016-05-25 +#if PACKETVER >= 20160525 + packet(0x0a77,clif->pCameraInfo); // CZ_CAMERA_INFO +#endif + // 2017-02-28aRagexeRE #if PACKETVER >= 20170228 // new packets diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 8fbe64e5f..95bf65b6d 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2907,6 +2907,17 @@ struct PACKET_ZC_CAMERA_INFO { DEFINE_PACKET_HEADER(ZC_CAMERA_INFO, 0x0a78); #endif +#if PACKETVER >= 20160525 +struct PACKET_CZ_CAMERA_INFO { + int16 packetType; + int8 action; + float range; + float rotation; + float latitude; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_CAMERA_INFO, 0x0a77); +#endif + #if PACKETVER_MAIN_NUM >= 20181128 || PACKETVER_RE_NUM >= 20181031 // PACKET_ZC_AUTOSPELLLIST2 struct PACKET_ZC_AUTOSPELLLIST { -- cgit v1.2.3-70-g09d2 From 69c9054622594092f0449d92c526d6e9db71d5f3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Dec 2018 07:11:15 +0300 Subject: Fix and update packet CZ_PARTY_CONFIG. --- src/map/clif.c | 12 ++++++------ src/map/packets_struct.h | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index fd3c01168..9166c83ea 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7136,7 +7136,7 @@ static void clif_partyinvitationstate(struct map_session_data *sd) WFIFOHEAD(fd, packet_len(0x2c9)); WFIFOW(fd, 0) = 0x2c9; - WFIFOB(fd, 2) = sd->status.allow_party ? 1 : 0; + WFIFOB(fd, 2) = sd->status.allow_party ? 0 : 1; WFIFOSET(fd, packet_len(0x2c9)); } @@ -17002,13 +17002,13 @@ static void clif_parse_cz_config(int fd, struct map_session_data *sd) static void clif_parse_PartyTick(int fd, struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change party invitation tick. /// value: -/// 0 = disabled -/// 1 = enabled +/// 0 = enabled +/// 1 = disabled static void clif_parse_PartyTick(int fd, struct map_session_data *sd) { - bool flag = RFIFOB(fd,6)?true:false; - sd->status.allow_party = flag; - clif->partytickack(sd, flag); + const struct PACKET_CZ_PARTY_CONFIG *const p = RFIFOP(fd, 0); + sd->status.allow_party = p->refuseInvite ? false : true; + clif->partytickack(sd, sd->status.allow_party); } /// Questlog System [Kevin] [Inkfish] diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 95bf65b6d..f9b5fab0d 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -3051,6 +3051,12 @@ struct PACKET_CZ_REQ_REMAINTIME { } __attribute__((packed)); DEFINE_PACKET_HEADER(CZ_REQ_REMAINTIME, 0x01c0); +struct PACKET_CZ_PARTY_CONFIG { + int16 packetType; + uint8 refuseInvite; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_PARTY_CONFIG, 0x02c8); + #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 -- cgit v1.2.3-70-g09d2 From ad608a2b826a792834531bfe54ae6b5a12692f50 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Dec 2018 08:53:22 +0300 Subject: Add missing values into enum cz_ui_types --- src/map/clif.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.h b/src/map/clif.h index 170e9639d..91a91b5d3 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -587,8 +587,8 @@ enum zc_ui_types { **/ enum cz_ui_types { CZ_STYLIST_UI = 1, - //unknown = 2, - //unknown = 3, + CZ_MACRO_REGISTER_UI = 2, + CZ_MACRO_DETECTOR_UI = 3, CZ_ATTENDANCE_UI = 5 }; -- cgit v1.2.3-70-g09d2