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/common/packetsstatic_len.h | 5 +++++ src/login/lclif.c | 12 ++++++++++++ src/login/lclif.p.h | 22 ++++++++++++++++++++++ src/map/packets_struct.h | 4 ---- 4 files changed, 39 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/common/packetsstatic_len.h b/src/common/packetsstatic_len.h index 9ccc4a673..8e724cfa8 100644 --- a/src/common/packetsstatic_len.h +++ b/src/common/packetsstatic_len.h @@ -24,6 +24,11 @@ #error packetLen already defined #endif +#define DEFINE_PACKET_HEADER(name, id) \ + STATIC_ASSERT(PACKET_LEN_##id == -1 || sizeof(struct PACKET_##name) == \ + PACKET_LEN_##id, "Wrong size PACKET_"#name); \ + enum { HEADER_##name = id }; + #define packetLen(id, len) PACKET_LEN_##id = (len), enum packet_lengths { #include "common/packets_len.h" diff --git a/src/login/lclif.c b/src/login/lclif.c index 1cb8bfdbd..b9ad7372f 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -225,6 +225,14 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_sessio return PACKET_VALID; } +/// @copydoc lclif_interface_private::parse_CA_ACK_MOBILE_OTP() +static enum parsefunc_rcode lclif_parse_CA_ACK_MOBILE_OTP(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_ACK_MOBILE_OTP(int fd, struct login_session_data *sd) +{ + // TODO: parsing packet data + return PACKET_VALID; +} + /// @copydoc lclif_interface_private::parse_CA_REQ_HASH() static enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) @@ -515,6 +523,9 @@ static void packetdb_loaddb(void) packet_def(CA_LOGIN_HAN), packet_def2(CA_SSO_LOGIN_REQ, -1), packet_def(CA_LOGIN_OTP), +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 + packet_def(CA_ACK_MOBILE_OTP), +#endif packet_def(CA_REQ_HASH), #undef packet_def #undef packet_def2 @@ -579,6 +590,7 @@ void lclif_defaults(void) lclif->p->parse_CA_LOGIN_HAN = lclif_parse_CA_LOGIN_HAN; lclif->p->parse_CA_SSO_LOGIN_REQ = lclif_parse_CA_SSO_LOGIN_REQ; lclif->p->parse_CA_LOGIN_OTP = lclif_parse_CA_LOGIN_OTP; + lclif->p->parse_CA_ACK_MOBILE_OTP = lclif_parse_CA_ACK_MOBILE_OTP; lclif->p->parse_CA_REQ_HASH = lclif_parse_CA_REQ_HASH; lclif->p->parse_CA_CHARSERVERCONNECT = lclif_parse_CA_CHARSERVERCONNECT; } diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index a80caafa2..e4d6fe31f 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -28,6 +28,7 @@ #include "common/hercules.h" #include "common/mmo.h" +#include "common/packetsstatic_len.h" /* Definitions and macros */ /// Maximum amount of packets processed at once from the same client @@ -60,6 +61,7 @@ enum login_packet_id { PACKET_ID_AC_ACCEPT_LOGIN = 0x0069, PACKET_ID_AC_ACCEPT_LOGIN2 = 0x0ac4, + PACKET_ID_AC_REQ_MOBILE_OTP = 0x09a2, PACKET_ID_AC_REFUSE_LOGIN = 0x006a, PACKET_ID_SC_NOTIFY_BAN = 0x0081, PACKET_ID_AC_ACK_HASH = 0x01dc, @@ -162,6 +164,25 @@ struct packet_CA_SSO_LOGIN_REQ { char t1[]; ///< SSO Login Token (variable length) } __attribute__((packed)); +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 +/** + * Packet structure for CA_SSO_LOGIN_REQ. + * + * Variable-length packet. + */ +struct PACKET_CA_ACK_MOBILE_OTP { + int16 packet_id; ///< Packet ID (#PACKET_ID_CA_SSO_LOGIN_REQ) + int16 packet_len; ///< Length (variable length) + uint32 aid; ///< Account ID + char code[6]; ///< Code +} __attribute__((packed)); + +DEFINE_PACKET_HEADER(CA_ACK_MOBILE_OTP, 0x09a3); +// for enum login_packet_id +#define PACKET_ID_CA_ACK_MOBILE_OTP HEADER_CA_ACK_MOBILE_OTP +#define packet_CA_ACK_MOBILE_OTP PACKET_CA_ACK_MOBILE_OTP +#endif + /** * Packet structure for CA_LOGIN_OTP. */ @@ -342,6 +363,7 @@ struct lclif_interface_private { LoginParseFunc *parse_CA_LOGIN_HAN; ///< Packet handler for #packet_CA_LOGIN_HAN. LoginParseFunc *parse_CA_SSO_LOGIN_REQ; ///< Packet handler for #packet_CA_SSO_LOGIN_REQ. LoginParseFunc *parse_CA_LOGIN_OTP; ///< Packet handler for #packet_CA_LOGIN_OTP. + LoginParseFunc *parse_CA_ACK_MOBILE_OTP; ///< Packet handler for #packet_CA_ACK_MOBILE_OTP. LoginParseFunc *parse_CA_REQ_HASH; ///< Packet handler for #packet_CA_REQ_HASH. LoginParseFunc *parse_CA_CHARSERVERCONNECT; ///< Packet handler for #packet_CA_CHARSERVERCONNECT. }; 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 602ea2bc985e317d483aedc89f80e052befec57a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 09:03:03 +0300 Subject: Add packet AC_REQ_MOBILE_OTP --- src/login/lclif.p.h | 3 +-- src/login/login.c | 22 ++++++++++++++++++++++ src/login/login.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index e4d6fe31f..21fc2048a 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -61,7 +61,6 @@ enum login_packet_id { PACKET_ID_AC_ACCEPT_LOGIN = 0x0069, PACKET_ID_AC_ACCEPT_LOGIN2 = 0x0ac4, - PACKET_ID_AC_REQ_MOBILE_OTP = 0x09a2, PACKET_ID_AC_REFUSE_LOGIN = 0x006a, PACKET_ID_SC_NOTIFY_BAN = 0x0081, PACKET_ID_AC_ACK_HASH = 0x01dc, @@ -176,8 +175,8 @@ struct PACKET_CA_ACK_MOBILE_OTP { uint32 aid; ///< Account ID char code[6]; ///< Code } __attribute__((packed)); - DEFINE_PACKET_HEADER(CA_ACK_MOBILE_OTP, 0x09a3); + // for enum login_packet_id #define PACKET_ID_CA_ACK_MOBILE_OTP HEADER_CA_ACK_MOBILE_OTP #define packet_CA_ACK_MOBILE_OTP PACKET_CA_ACK_MOBILE_OTP diff --git a/src/login/login.c b/src/login/login.c index c1844cb25..dce85e9c7 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -35,6 +35,7 @@ #include "common/memmgr.h" #include "common/md5calc.h" #include "common/nullpo.h" +#include "common/packetsstatic_len.h" #include "common/random.h" #include "common/showmsg.h" #include "common/socket.h" @@ -67,6 +68,14 @@ static AccountDB *accounts = NULL; //----------------------------------------------------- #define AUTH_TIMEOUT 30000 +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) +struct PACKET_AC_REQ_MOBILE_OTP { + int16 packet_id; ///< Packet ID (#PACKET_ID_CA_SSO_LOGIN_REQ) + uint32 aid; ///< Account ID +} __attribute__((packed)); +DEFINE_PACKET_HEADER(AC_REQ_MOBILE_OTP, 0x09a2); +#endif + /** * @see DBCreateData */ @@ -1400,6 +1409,18 @@ static bool login_client_login_otp(int fd, struct login_session_data *sd) #endif // PACKETVER_ZERO } +static void login_client_login_mobile_otp_request(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static void login_client_login_mobile_otp_request(int fd, struct login_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) + WFIFOHEAD(sd->fd, sizeof(struct PACKET_AC_REQ_MOBILE_OTP)); + struct PACKET_AC_REQ_MOBILE_OTP *packet = WP2PTR(sd->fd); + packet->packet_id = HEADER_AC_REQ_MOBILE_OTP; + packet->aid = sd->account_id; + WFIFOSET(fd, sizeof(struct PACKET_AC_REQ_MOBILE_OTP)); +#endif +} + static void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) __attribute__((nonnull (2))); static void login_char_server_connection_status(int fd, struct login_session_data* sd, uint8 status) { @@ -2275,6 +2296,7 @@ void login_defaults(void) login->parse_fromchar = login_parse_fromchar; login->client_login = login_client_login; login->client_login_otp = login_client_login_otp; + login->client_login_mobile_otp_request = login_client_login_mobile_otp_request; login->parse_request_connection = login_parse_request_connection; login->auth_ok = login_auth_ok; login->auth_failed = login_auth_failed; diff --git a/src/login/login.h b/src/login/login.h index 8a863f5aa..7f74057c6 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -219,6 +219,7 @@ struct login_interface { void (*auth_failed) (struct login_session_data* sd, int result); bool (*client_login) (int fd, struct login_session_data *sd); bool (*client_login_otp) (int fd, struct login_session_data *sd); + void (*client_login_mobile_otp_request) (int fd, struct login_session_data *sd); void (*char_server_connection_status) (int fd, struct login_session_data* sd, uint8 status); void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); void (*config_set_defaults) (void); -- 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') 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 854626875ad7cd206de247f6da6607280a7fd58b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 17:36:56 +0300 Subject: Add incomplete packet CA_OTP_CODE. --- src/login/lclif.c | 12 ++++++++++++ src/login/lclif.p.h | 14 +++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/login/lclif.c b/src/login/lclif.c index b9ad7372f..f391c5bd7 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -233,6 +233,14 @@ static enum parsefunc_rcode lclif_parse_CA_ACK_MOBILE_OTP(int fd, struct login_s return PACKET_VALID; } +/// @copydoc lclif_interface_private::parse_CA_OTP_CODE() +static enum parsefunc_rcode lclif_parse_CA_OTP_CODE(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); +static enum parsefunc_rcode lclif_parse_CA_OTP_CODE(int fd, struct login_session_data *sd) +{ + // TODO: parsing packet data + return PACKET_VALID; +} + /// @copydoc lclif_interface_private::parse_CA_REQ_HASH() static enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) @@ -525,6 +533,9 @@ static void packetdb_loaddb(void) packet_def(CA_LOGIN_OTP), #if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 packet_def(CA_ACK_MOBILE_OTP), +#endif +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) + packet_def(CA_OTP_CODE), #endif packet_def(CA_REQ_HASH), #undef packet_def @@ -591,6 +602,7 @@ void lclif_defaults(void) lclif->p->parse_CA_SSO_LOGIN_REQ = lclif_parse_CA_SSO_LOGIN_REQ; lclif->p->parse_CA_LOGIN_OTP = lclif_parse_CA_LOGIN_OTP; lclif->p->parse_CA_ACK_MOBILE_OTP = lclif_parse_CA_ACK_MOBILE_OTP; + lclif->p->parse_CA_OTP_CODE = lclif_parse_CA_OTP_CODE; lclif->p->parse_CA_REQ_HASH = lclif_parse_CA_REQ_HASH; lclif->p->parse_CA_CHARSERVERCONNECT = lclif_parse_CA_CHARSERVERCONNECT; } diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index 21fc2048a..815552eab 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -170,7 +170,7 @@ struct packet_CA_SSO_LOGIN_REQ { * Variable-length packet. */ struct PACKET_CA_ACK_MOBILE_OTP { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_SSO_LOGIN_REQ) + int16 packet_id; ///< Packet ID (#PACKET_ID_CA_ACK_MOBILE_OTP) int16 packet_len; ///< Length (variable length) uint32 aid; ///< Account ID char code[6]; ///< Code @@ -182,6 +182,17 @@ DEFINE_PACKET_HEADER(CA_ACK_MOBILE_OTP, 0x09a3); #define packet_CA_ACK_MOBILE_OTP PACKET_CA_ACK_MOBILE_OTP #endif +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) +struct PACKET_CA_OTP_CODE { + int16 packet_id; ///< Packet ID (#PACKET_ID_CA_OTP_CODE) + char code[9]; ///< Code +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CA_OTP_CODE, 0x0ad0); + +#define PACKET_ID_CA_OTP_CODE HEADER_CA_OTP_CODE +#define packet_CA_OTP_CODE PACKET_CA_OTP_CODE +#endif + /** * Packet structure for CA_LOGIN_OTP. */ @@ -363,6 +374,7 @@ struct lclif_interface_private { LoginParseFunc *parse_CA_SSO_LOGIN_REQ; ///< Packet handler for #packet_CA_SSO_LOGIN_REQ. LoginParseFunc *parse_CA_LOGIN_OTP; ///< Packet handler for #packet_CA_LOGIN_OTP. LoginParseFunc *parse_CA_ACK_MOBILE_OTP; ///< Packet handler for #packet_CA_ACK_MOBILE_OTP. + LoginParseFunc *parse_CA_OTP_CODE; ///< Packet handler for #packet_CA_OTP_CODE. LoginParseFunc *parse_CA_REQ_HASH; ///< Packet handler for #packet_CA_REQ_HASH. LoginParseFunc *parse_CA_CHARSERVERCONNECT; ///< Packet handler for #packet_CA_CHARSERVERCONNECT. }; -- cgit v1.2.3-70-g09d2 From 6988272675e7e3e1e6f117e93ff0fdf8f59559d2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 17:43:15 +0300 Subject: Rename defines PACKET_ID_* to HEADER_* --- src/login/lclif.c | 22 +++++++-------- src/login/lclif.h | 4 +-- src/login/lclif.p.h | 80 ++++++++++++++++++++++++++--------------------------- src/login/login.c | 2 +- 4 files changed, 53 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/login/lclif.c b/src/login/lclif.c index f391c5bd7..a54d9f11c 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -52,7 +52,7 @@ static void lclif_connection_error(int fd, uint8 error) struct packet_SC_NOTIFY_BAN *packet = NULL; WFIFOHEAD(fd, sizeof(*packet)); packet = WP2PTR(fd); - packet->packet_id = PACKET_ID_SC_NOTIFY_BAN; + packet->packet_id = HEADER_SC_NOTIFY_BAN; packet->error_code = error; WFIFOSET(fd, sizeof(*packet)); } @@ -288,9 +288,9 @@ static bool lclif_send_server_list(struct login_session_data *sd) packet = WP2PTR(sd->fd); #if PACKETVER < 20170315 - packet->packet_id = PACKET_ID_AC_ACCEPT_LOGIN; + packet->packet_id = HEADER_AC_ACCEPT_LOGIN; #else - packet->packet_id = PACKET_ID_AC_ACCEPT_LOGIN2; + packet->packet_id = HEADER_AC_ACCEPT_LOGIN2; #endif packet->packet_len = length; packet->auth_code = sd->login_id1; @@ -329,13 +329,13 @@ static void lclif_send_auth_failed(int fd, time_t ban, uint32 error) { #if PACKETVER >= 20180627 struct packet_AC_REFUSE_LOGIN_R2 *packet = NULL; - int packet_id = PACKET_ID_AC_REFUSE_LOGIN_R3; + int packet_id = HEADER_AC_REFUSE_LOGIN_R3; #elif PACKETVER >= 20101123 struct packet_AC_REFUSE_LOGIN_R2 *packet = NULL; - int packet_id = PACKET_ID_AC_REFUSE_LOGIN_R2; + int packet_id = HEADER_AC_REFUSE_LOGIN_R2; #else struct packet_AC_REFUSE_LOGIN *packet = NULL; - int packet_id = PACKET_ID_AC_REFUSE_LOGIN; + int packet_id = HEADER_AC_REFUSE_LOGIN; #endif WFIFOHEAD(fd, sizeof(*packet)); packet = WP2PTR(fd); @@ -354,7 +354,7 @@ static void lclif_send_login_error(int fd, uint8 error) struct packet_AC_REFUSE_LOGIN *packet = NULL; WFIFOHEAD(fd, sizeof(*packet)); packet = WP2PTR(fd); - packet->packet_id = PACKET_ID_AC_REFUSE_LOGIN; + packet->packet_id = HEADER_AC_REFUSE_LOGIN; packet->error_code = error; memset(packet->block_date, '\0', sizeof(packet->block_date)); WFIFOSET(fd, sizeof(*packet)); @@ -369,7 +369,7 @@ static void lclif_send_coding_key(int fd, struct login_session_data *sd) WFIFOHEAD(fd, size); packet = WP2PTR(fd); - packet->packet_id = PACKET_ID_AC_ACK_HASH; + packet->packet_id = HEADER_AC_ACK_HASH; packet->packet_len = size; memcpy(packet->secret, sd->md5key, sd->md5keylen); WFIFOSET(fd, size); @@ -492,7 +492,7 @@ static enum parsefunc_rcode lclif_parse_sub(int fd, struct login_session_data *s /// @copydoc lclif_interface::packet() static const struct login_packet_db *lclif_packet(int16 packet_id) { - if (packet_id == PACKET_ID_CA_CHARSERVERCONNECT) + if (packet_id == HEADER_CA_CHARSERVERCONNECT) return &lclif->p->dbs->packet_db[0]; if (packet_id > MAX_PACKET_LOGIN_DB || packet_id < MIN_PACKET_DB) @@ -519,8 +519,8 @@ static void packetdb_loaddb(void) int16 packet_len; LoginParseFunc **pFunc; } packet[] = { -#define packet_def(name) { PACKET_ID_ ## name, sizeof(struct packet_ ## name), &lclif->p->parse_ ## name } -#define packet_def2(name, len) { PACKET_ID_ ## name, (len), &lclif->p->parse_ ## name } +#define packet_def(name) { HEADER_ ## name, sizeof(struct packet_ ## name), &lclif->p->parse_ ## name } +#define packet_def2(name, len) { HEADER_ ## name, (len), &lclif->p->parse_ ## name } packet_def(CA_CONNECT_INFO_CHANGED), packet_def(CA_EXE_HASHCHECK), packet_def(CA_LOGIN), diff --git a/src/login/lclif.h b/src/login/lclif.h index d1e4317a2..26c061367 100644 --- a/src/login/lclif.h +++ b/src/login/lclif.h @@ -87,8 +87,8 @@ struct lclif_interface { * @param fd The client connection file descriptor. * @param ban The ban duration (if error == 6). * @param error The authentication error code. - * @see #PACKET_ID_AC_REFUSE_LOGIN. - * @see #PACKET_ID_AC_REFUSE_LOGIN_R2. + * @see #HEADER_AC_REFUSE_LOGIN. + * @see #HEADER_AC_REFUSE_LOGIN_R2. */ void (*auth_failed)(int fd, time_t ban, uint32 error); diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index 815552eab..6fe3e050c 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -43,29 +43,29 @@ /// Packet IDs enum login_packet_id { // CA (Client to Login) - PACKET_ID_CA_LOGIN = 0x0064, - PACKET_ID_CA_LOGIN2 = 0x01dd, - PACKET_ID_CA_LOGIN3 = 0x01fa, - PACKET_ID_CA_CONNECT_INFO_CHANGED = 0x0200, - PACKET_ID_CA_EXE_HASHCHECK = 0x0204, - PACKET_ID_CA_LOGIN_PCBANG = 0x0277, - PACKET_ID_CA_LOGIN4 = 0x027c, - PACKET_ID_CA_LOGIN_HAN = 0x02b0, - PACKET_ID_CA_SSO_LOGIN_REQ = 0x0825, - PACKET_ID_CA_LOGIN_OTP = 0x0acf, - PACKET_ID_CA_REQ_HASH = 0x01db, - PACKET_ID_CA_CHARSERVERCONNECT = 0x2710, // Custom Hercules Packet - //PACKET_ID_CA_SSO_LOGIN_REQa = 0x825a, /* unused */ + HEADER_CA_LOGIN = 0x0064, + HEADER_CA_LOGIN2 = 0x01dd, + HEADER_CA_LOGIN3 = 0x01fa, + HEADER_CA_CONNECT_INFO_CHANGED = 0x0200, + HEADER_CA_EXE_HASHCHECK = 0x0204, + HEADER_CA_LOGIN_PCBANG = 0x0277, + HEADER_CA_LOGIN4 = 0x027c, + HEADER_CA_LOGIN_HAN = 0x02b0, + HEADER_CA_SSO_LOGIN_REQ = 0x0825, + HEADER_CA_LOGIN_OTP = 0x0acf, + HEADER_CA_REQ_HASH = 0x01db, + HEADER_CA_CHARSERVERCONNECT = 0x2710, // Custom Hercules Packet + //HEADER_CA_SSO_LOGIN_REQa = 0x825a, /* unused */ // AC (Login to Client) - PACKET_ID_AC_ACCEPT_LOGIN = 0x0069, - PACKET_ID_AC_ACCEPT_LOGIN2 = 0x0ac4, - PACKET_ID_AC_REFUSE_LOGIN = 0x006a, - PACKET_ID_SC_NOTIFY_BAN = 0x0081, - PACKET_ID_AC_ACK_HASH = 0x01dc, - PACKET_ID_AC_REFUSE_LOGIN_R2 = 0x083e, - PACKET_ID_AC_REFUSE_LOGIN_R3 = 0x0b02, + HEADER_AC_ACCEPT_LOGIN = 0x0069, + HEADER_AC_ACCEPT_LOGIN2 = 0x0ac4, + HEADER_AC_REFUSE_LOGIN = 0x006a, + HEADER_SC_NOTIFY_BAN = 0x0081, + HEADER_AC_ACK_HASH = 0x01dc, + HEADER_AC_REFUSE_LOGIN_R2 = 0x083e, + HEADER_AC_REFUSE_LOGIN_R3 = 0x0b02, }; /* Packets Structs */ @@ -77,7 +77,7 @@ enum login_packet_id { * Packet structure for CA_LOGIN. */ struct packet_CA_LOGIN { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_LOGIN) + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN) uint32 version; ///< Client Version char id[24]; ///< Username char password[24]; ///< Password @@ -88,7 +88,7 @@ struct packet_CA_LOGIN { * Packet structure for CA_LOGIN2. */ struct packet_CA_LOGIN2 { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_LOGIN2) + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN2) uint32 version; ///< Client Version char id[24]; ///< Username uint8 password_md5[16]; ///< Password hash @@ -99,7 +99,7 @@ struct packet_CA_LOGIN2 { * Packet structure for CA_LOGIN3. */ struct packet_CA_LOGIN3 { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_LOGIN3) + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN3) uint32 version; ///< Client Version char id[24]; ///< Username uint8 password_md5[16]; ///< Password hash @@ -111,7 +111,7 @@ struct packet_CA_LOGIN3 { * Packet structure for CA_LOGIN4. */ struct packet_CA_LOGIN4 { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_LOGIN4) + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN4) uint32 version; ///< Client Version char id[24]; ///< Username uint8 password_md5[16]; ///< Password hash @@ -123,7 +123,7 @@ struct packet_CA_LOGIN4 { * Packet structure for CA_LOGIN_PCBANG. */ struct packet_CA_LOGIN_PCBANG { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_LOGIN_PCBANG) + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_PCBANG) uint32 version; ///< Client Version char id[24]; ///< Username char password[24]; ///< Password @@ -136,7 +136,7 @@ struct packet_CA_LOGIN_PCBANG { * Packet structure for CA_LOGIN_HAN. */ struct packet_CA_LOGIN_HAN { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_LOGIN_HAN) + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_HAN) uint32 version; ///< Client Version char id[24]; ///< Username char password[24]; ///< Password @@ -152,7 +152,7 @@ struct packet_CA_LOGIN_HAN { * Variable-length packet. */ struct packet_CA_SSO_LOGIN_REQ { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_SSO_LOGIN_REQ) + int16 packet_id; ///< Packet ID (#HEADER_CA_SSO_LOGIN_REQ) int16 packet_len; ///< Length (variable length) uint32 version; ///< Clientver uint8 clienttype; ///< Clienttype @@ -170,7 +170,7 @@ struct packet_CA_SSO_LOGIN_REQ { * Variable-length packet. */ struct PACKET_CA_ACK_MOBILE_OTP { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_ACK_MOBILE_OTP) + int16 packet_id; ///< Packet ID (#HEADER_CA_ACK_MOBILE_OTP) int16 packet_len; ///< Length (variable length) uint32 aid; ///< Account ID char code[6]; ///< Code @@ -178,18 +178,16 @@ struct PACKET_CA_ACK_MOBILE_OTP { DEFINE_PACKET_HEADER(CA_ACK_MOBILE_OTP, 0x09a3); // for enum login_packet_id -#define PACKET_ID_CA_ACK_MOBILE_OTP HEADER_CA_ACK_MOBILE_OTP #define packet_CA_ACK_MOBILE_OTP PACKET_CA_ACK_MOBILE_OTP #endif #if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) struct PACKET_CA_OTP_CODE { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_OTP_CODE) + int16 packet_id; ///< Packet ID (#HEADER_CA_OTP_CODE) char code[9]; ///< Code } __attribute__((packed)); DEFINE_PACKET_HEADER(CA_OTP_CODE, 0x0ad0); -#define PACKET_ID_CA_OTP_CODE HEADER_CA_OTP_CODE #define packet_CA_OTP_CODE PACKET_CA_OTP_CODE #endif @@ -197,7 +195,7 @@ DEFINE_PACKET_HEADER(CA_OTP_CODE, 0x0ad0); * Packet structure for CA_LOGIN_OTP. */ struct packet_CA_LOGIN_OTP { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_LOGIN_OTP) + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_OTP) #if PACKETVER >= 20171113 uint32 devFlags; ///< flags including dev flag #endif @@ -225,7 +223,7 @@ struct packet_CA_SSO_LOGIN_REQa { * New alive packet. Used to verify if client is always alive. */ struct packet_CA_CONNECT_INFO_CHANGED { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_CONNECT_INFO_CHANGED) + int16 packet_id; ///< Packet ID (#HEADER_CA_CONNECT_INFO_CHANGED) char id[24]; ///< account.userid } __attribute__((packed)); @@ -235,7 +233,7 @@ struct packet_CA_CONNECT_INFO_CHANGED { * (kRO 2004-05-31aSakexe langtype 0 and 6) */ struct packet_CA_EXE_HASHCHECK { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_EXE_HASHCHECK) + int16 packet_id; ///< Packet ID (#HEADER_CA_EXE_HASHCHECK) uint8 hash_value[16]; ///< Client MD5 hash } __attribute__((packed)); @@ -243,7 +241,7 @@ struct packet_CA_EXE_HASHCHECK { * Packet structure for CA_REQ_HASH. */ struct packet_CA_REQ_HASH { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_REQ_HASH) + int16 packet_id; ///< Packet ID (#HEADER_CA_REQ_HASH) } __attribute__((packed)); /** @@ -252,7 +250,7 @@ struct packet_CA_REQ_HASH { * This packet is used internally, to signal a char-server connection. */ struct packet_CA_CHARSERVERCONNECT { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_CHARSERVERCONNECT) + int16 packet_id; ///< Packet ID (#HEADER_CA_CHARSERVERCONNECT) char userid[24]; ///< Username char password[24]; ///< Password int32 unknown; @@ -268,7 +266,7 @@ struct packet_CA_CHARSERVERCONNECT { * Packet structure for SC_NOTIFY_BAN. */ struct packet_SC_NOTIFY_BAN { - int16 packet_id; ///< Packet ID (#PACKET_ID_SC_NOTIFY_BAN) + int16 packet_id; ///< Packet ID (#HEADER_SC_NOTIFY_BAN) uint8 error_code; ///< Error code } __attribute__((packed)); @@ -276,7 +274,7 @@ struct packet_SC_NOTIFY_BAN { * Packet structure for AC_REFUSE_LOGIN. */ struct packet_AC_REFUSE_LOGIN { - int16 packet_id; ///< Packet ID (#PACKET_ID_AC_REFUSE_LOGIN) + int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN) uint8 error_code; ///< Error code char block_date[20]; ///< Ban expiration date } __attribute__((packed)); @@ -285,7 +283,7 @@ struct packet_AC_REFUSE_LOGIN { * Packet structure for AC_REFUSE_LOGIN_R2. */ struct packet_AC_REFUSE_LOGIN_R2 { - int16 packet_id; ///< Packet ID (#PACKET_ID_AC_REFUSE_LOGIN_R2) + int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN_R2) uint32 error_code; ///< Error code char block_date[20]; ///< Ban expiration date } __attribute__((packed)); @@ -296,7 +294,7 @@ struct packet_AC_REFUSE_LOGIN_R2 { * Variable-length packet. */ struct packet_AC_ACCEPT_LOGIN { - int16 packet_id; ///< Packet ID (#PACKET_ID_AC_ACCEPT_LOGIN) + int16 packet_id; ///< Packet ID (#HEADER_AC_ACCEPT_LOGIN) int16 packet_len; ///< Packet length (variable length) int32 auth_code; ///< Authentication code uint32 aid; ///< Account ID @@ -327,7 +325,7 @@ struct packet_AC_ACCEPT_LOGIN { * Variable-length packet */ struct packet_AC_ACK_HASH { - int16 packet_id; ///< Packet ID (#PACKET_ID_AC_ACK_HASH) + int16 packet_id; ///< Packet ID (#HEADER_AC_ACK_HASH) int16 packet_len; ///< Packet length (variable length) uint8 secret[]; ///< Challenge string } __attribute__((packed)); diff --git a/src/login/login.c b/src/login/login.c index dce85e9c7..409b30473 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -70,7 +70,7 @@ static AccountDB *accounts = NULL; #if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) struct PACKET_AC_REQ_MOBILE_OTP { - int16 packet_id; ///< Packet ID (#PACKET_ID_CA_SSO_LOGIN_REQ) + int16 packet_id; ///< Packet ID (#HEADER_CA_SSO_LOGIN_REQ) uint32 aid; ///< Account ID } __attribute__((packed)); DEFINE_PACKET_HEADER(AC_REQ_MOBILE_OTP, 0x09a2); -- cgit v1.2.3-70-g09d2 From 175de7f89d615491f2aa3a2d6bdd3f08bb24ae49 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 17:50:51 +0300 Subject: Rename structs packet_* into PACKET_* --- src/login/lclif.c | 38 ++++++++++++++--------------- src/login/lclif.p.h | 69 +++++++++++++++++++++++++---------------------------- 2 files changed, 51 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/login/lclif.c b/src/login/lclif.c index a54d9f11c..f0d711303 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -49,7 +49,7 @@ struct lclif_interface *lclif; /// @copydoc lclif_interface::connection_error() static void lclif_connection_error(int fd, uint8 error) { - struct packet_SC_NOTIFY_BAN *packet = NULL; + struct PACKET_SC_NOTIFY_BAN *packet = NULL; WFIFOHEAD(fd, sizeof(*packet)); packet = WP2PTR(fd); packet->packet_id = HEADER_SC_NOTIFY_BAN; @@ -68,7 +68,7 @@ static enum parsefunc_rcode lclif_parse_CA_CONNECT_INFO_CHANGED(int fd, struct l static enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_session_data *sd) { - const struct packet_CA_EXE_HASHCHECK *packet = RP2PTR(fd); + const struct PACKET_CA_EXE_HASHCHECK *packet = RP2PTR(fd); sd->has_client_hash = 1; memcpy(sd->client_hash, packet->hash_value, 16); return PACKET_VALID; @@ -78,7 +78,7 @@ static enum parsefunc_rcode lclif_parse_CA_EXE_HASHCHECK(int fd, struct login_se static enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_data *sd) { - const struct packet_CA_LOGIN *packet = RP2PTR(fd); + const struct PACKET_CA_LOGIN *packet = RP2PTR(fd); sd->version = packet->version; sd->clienttype = packet->clienttype; @@ -97,7 +97,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN(int fd, struct login_session_da static enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_data *sd) { - const struct packet_CA_LOGIN2 *packet = RP2PTR(fd); + const struct PACKET_CA_LOGIN2 *packet = RP2PTR(fd); sd->version = packet->version; sd->clienttype = packet->clienttype; @@ -113,7 +113,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN2(int fd, struct login_session_d static enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_data *sd) { - const struct packet_CA_LOGIN3 *packet = RP2PTR(fd); + const struct PACKET_CA_LOGIN3 *packet = RP2PTR(fd); sd->version = packet->version; sd->clienttype = packet->clienttype; @@ -131,7 +131,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN3(int fd, struct login_session_d static enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_data *sd) { - const struct packet_CA_LOGIN4 *packet = RP2PTR(fd); + const struct PACKET_CA_LOGIN4 *packet = RP2PTR(fd); sd->version = packet->version; sd->clienttype = packet->clienttype; @@ -149,7 +149,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN4(int fd, struct login_session_d static enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_session_data *sd) { - const struct packet_CA_LOGIN_PCBANG *packet = RP2PTR(fd); + const struct PACKET_CA_LOGIN_PCBANG *packet = RP2PTR(fd); sd->version = packet->version; sd->clienttype = packet->clienttype; @@ -171,7 +171,7 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN_PCBANG(int fd, struct login_ses static enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_session_data *sd) { - const struct packet_CA_LOGIN_HAN *packet = RP2PTR(fd); + const struct PACKET_CA_LOGIN_HAN *packet = RP2PTR(fd); sd->version = packet->version; sd->clienttype = packet->clienttype; @@ -194,11 +194,11 @@ static enum parsefunc_rcode lclif_parse_CA_LOGIN_HAN(int fd, struct login_sessio static enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_session_data *sd) { - const struct packet_CA_SSO_LOGIN_REQ *packet = RP2PTR(fd); + const struct PACKET_CA_SSO_LOGIN_REQ *packet = RP2PTR(fd); int tokenlen = (int)RFIFOREST(fd) - (int)sizeof(*packet); if (tokenlen > PASSWD_LEN || tokenlen < 1) { - ShowError("packet_CA_SSO_LOGIN_REQ: Token length is not between allowed password length, kicking player ('%s')", packet->id); + ShowError("PACKET_CA_SSO_LOGIN_REQ: Token length is not between allowed password length, kicking player ('%s')", packet->id); sockt->eof(fd); return PACKET_VALID; } @@ -220,7 +220,7 @@ static enum parsefunc_rcode lclif_parse_CA_SSO_LOGIN_REQ(int fd, struct login_se static enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static enum parsefunc_rcode lclif_parse_CA_LOGIN_OTP(int fd, struct login_session_data *sd) { - //const struct packet_CA_LOGIN_OTP *packet = RP2PTR(fd); + //const struct PACKET_CA_LOGIN_OTP *packet = RP2PTR(fd); login->client_login_otp(fd, sd); return PACKET_VALID; } @@ -271,7 +271,7 @@ static bool lclif_send_server_list(struct login_session_data *sd) { int server_num = 0, i, n, length; uint32 ip; - struct packet_AC_ACCEPT_LOGIN *packet = NULL; + struct PACKET_AC_ACCEPT_LOGIN *packet = NULL; for (i = 0; i < ARRAYLENGTH(login->dbs->server); ++i) { if (sockt->session_is_active(login->dbs->server[i].fd)) @@ -328,13 +328,13 @@ static bool lclif_send_server_list(struct login_session_data *sd) static void lclif_send_auth_failed(int fd, time_t ban, uint32 error) { #if PACKETVER >= 20180627 - struct packet_AC_REFUSE_LOGIN_R2 *packet = NULL; + struct PACKET_AC_REFUSE_LOGIN_R2 *packet = NULL; int packet_id = HEADER_AC_REFUSE_LOGIN_R3; #elif PACKETVER >= 20101123 - struct packet_AC_REFUSE_LOGIN_R2 *packet = NULL; + struct PACKET_AC_REFUSE_LOGIN_R2 *packet = NULL; int packet_id = HEADER_AC_REFUSE_LOGIN_R2; #else - struct packet_AC_REFUSE_LOGIN *packet = NULL; + struct PACKET_AC_REFUSE_LOGIN *packet = NULL; int packet_id = HEADER_AC_REFUSE_LOGIN; #endif WFIFOHEAD(fd, sizeof(*packet)); @@ -351,7 +351,7 @@ static void lclif_send_auth_failed(int fd, time_t ban, uint32 error) /// @copydoc lclif_interface::login_error() static void lclif_send_login_error(int fd, uint8 error) { - struct packet_AC_REFUSE_LOGIN *packet = NULL; + struct PACKET_AC_REFUSE_LOGIN *packet = NULL; WFIFOHEAD(fd, sizeof(*packet)); packet = WP2PTR(fd); packet->packet_id = HEADER_AC_REFUSE_LOGIN; @@ -364,7 +364,7 @@ static void lclif_send_login_error(int fd, uint8 error) static void lclif_send_coding_key(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static void lclif_send_coding_key(int fd, struct login_session_data *sd) { - struct packet_AC_ACK_HASH *packet = NULL; + struct PACKET_AC_ACK_HASH *packet = NULL; int16 size = sizeof(*packet) + sd->md5keylen; WFIFOHEAD(fd, size); @@ -519,7 +519,7 @@ static void packetdb_loaddb(void) int16 packet_len; LoginParseFunc **pFunc; } packet[] = { -#define packet_def(name) { HEADER_ ## name, sizeof(struct packet_ ## name), &lclif->p->parse_ ## name } +#define packet_def(name) { HEADER_ ## name, sizeof(struct PACKET_ ## name), &lclif->p->parse_ ## name } #define packet_def2(name, len) { HEADER_ ## name, (len), &lclif->p->parse_ ## name } packet_def(CA_CONNECT_INFO_CHANGED), packet_def(CA_EXE_HASHCHECK), @@ -553,7 +553,7 @@ static void packetdb_loaddb(void) } //Explict case, we will save character login packet in position 0 which is unused and not valid by normal - lclif->p->dbs->packet_db[0].len = sizeof(struct packet_CA_CHARSERVERCONNECT); + lclif->p->dbs->packet_db[0].len = sizeof(struct PACKET_CA_CHARSERVERCONNECT); lclif->p->dbs->packet_db[0].pFunc = &lclif->p->parse_CA_CHARSERVERCONNECT; } diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index 6fe3e050c..f383998dc 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -76,7 +76,7 @@ enum login_packet_id { /** * Packet structure for CA_LOGIN. */ -struct packet_CA_LOGIN { +struct PACKET_CA_LOGIN { int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN) uint32 version; ///< Client Version char id[24]; ///< Username @@ -87,7 +87,7 @@ struct packet_CA_LOGIN { /** * Packet structure for CA_LOGIN2. */ -struct packet_CA_LOGIN2 { +struct PACKET_CA_LOGIN2 { int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN2) uint32 version; ///< Client Version char id[24]; ///< Username @@ -98,7 +98,7 @@ struct packet_CA_LOGIN2 { /** * Packet structure for CA_LOGIN3. */ -struct packet_CA_LOGIN3 { +struct PACKET_CA_LOGIN3 { int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN3) uint32 version; ///< Client Version char id[24]; ///< Username @@ -110,7 +110,7 @@ struct packet_CA_LOGIN3 { /** * Packet structure for CA_LOGIN4. */ -struct packet_CA_LOGIN4 { +struct PACKET_CA_LOGIN4 { int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN4) uint32 version; ///< Client Version char id[24]; ///< Username @@ -122,7 +122,7 @@ struct packet_CA_LOGIN4 { /** * Packet structure for CA_LOGIN_PCBANG. */ -struct packet_CA_LOGIN_PCBANG { +struct PACKET_CA_LOGIN_PCBANG { int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_PCBANG) uint32 version; ///< Client Version char id[24]; ///< Username @@ -135,7 +135,7 @@ struct packet_CA_LOGIN_PCBANG { /** * Packet structure for CA_LOGIN_HAN. */ -struct packet_CA_LOGIN_HAN { +struct PACKET_CA_LOGIN_HAN { int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_HAN) uint32 version; ///< Client Version char id[24]; ///< Username @@ -151,7 +151,7 @@ struct packet_CA_LOGIN_HAN { * * Variable-length packet. */ -struct packet_CA_SSO_LOGIN_REQ { +struct PACKET_CA_SSO_LOGIN_REQ { int16 packet_id; ///< Packet ID (#HEADER_CA_SSO_LOGIN_REQ) int16 packet_len; ///< Length (variable length) uint32 version; ///< Clientver @@ -176,9 +176,6 @@ struct PACKET_CA_ACK_MOBILE_OTP { char code[6]; ///< Code } __attribute__((packed)); DEFINE_PACKET_HEADER(CA_ACK_MOBILE_OTP, 0x09a3); - -// for enum login_packet_id -#define packet_CA_ACK_MOBILE_OTP PACKET_CA_ACK_MOBILE_OTP #endif #if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) @@ -187,14 +184,12 @@ struct PACKET_CA_OTP_CODE { char code[9]; ///< Code } __attribute__((packed)); DEFINE_PACKET_HEADER(CA_OTP_CODE, 0x0ad0); - -#define packet_CA_OTP_CODE PACKET_CA_OTP_CODE #endif /** * Packet structure for CA_LOGIN_OTP. */ -struct packet_CA_LOGIN_OTP { +struct PACKET_CA_LOGIN_OTP { int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_OTP) #if PACKETVER >= 20171113 uint32 devFlags; ///< flags including dev flag @@ -205,7 +200,7 @@ struct packet_CA_LOGIN_OTP { } __attribute__((packed)); #if 0 // Unused -struct packet_CA_SSO_LOGIN_REQa { +struct PACKET_CA_SSO_LOGIN_REQa { int16 packet_id; int16 packet_len; uint32 version; @@ -222,7 +217,7 @@ struct packet_CA_SSO_LOGIN_REQa { * * New alive packet. Used to verify if client is always alive. */ -struct packet_CA_CONNECT_INFO_CHANGED { +struct PACKET_CA_CONNECT_INFO_CHANGED { int16 packet_id; ///< Packet ID (#HEADER_CA_CONNECT_INFO_CHANGED) char id[24]; ///< account.userid } __attribute__((packed)); @@ -232,7 +227,7 @@ struct packet_CA_CONNECT_INFO_CHANGED { * * (kRO 2004-05-31aSakexe langtype 0 and 6) */ -struct packet_CA_EXE_HASHCHECK { +struct PACKET_CA_EXE_HASHCHECK { int16 packet_id; ///< Packet ID (#HEADER_CA_EXE_HASHCHECK) uint8 hash_value[16]; ///< Client MD5 hash } __attribute__((packed)); @@ -240,7 +235,7 @@ struct packet_CA_EXE_HASHCHECK { /** * Packet structure for CA_REQ_HASH. */ -struct packet_CA_REQ_HASH { +struct PACKET_CA_REQ_HASH { int16 packet_id; ///< Packet ID (#HEADER_CA_REQ_HASH) } __attribute__((packed)); @@ -249,7 +244,7 @@ struct packet_CA_REQ_HASH { * * This packet is used internally, to signal a char-server connection. */ -struct packet_CA_CHARSERVERCONNECT { +struct PACKET_CA_CHARSERVERCONNECT { int16 packet_id; ///< Packet ID (#HEADER_CA_CHARSERVERCONNECT) char userid[24]; ///< Username char password[24]; ///< Password @@ -265,7 +260,7 @@ struct packet_CA_CHARSERVERCONNECT { /** * Packet structure for SC_NOTIFY_BAN. */ -struct packet_SC_NOTIFY_BAN { +struct PACKET_SC_NOTIFY_BAN { int16 packet_id; ///< Packet ID (#HEADER_SC_NOTIFY_BAN) uint8 error_code; ///< Error code } __attribute__((packed)); @@ -273,7 +268,7 @@ struct packet_SC_NOTIFY_BAN { /** * Packet structure for AC_REFUSE_LOGIN. */ -struct packet_AC_REFUSE_LOGIN { +struct PACKET_AC_REFUSE_LOGIN { int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN) uint8 error_code; ///< Error code char block_date[20]; ///< Ban expiration date @@ -282,7 +277,7 @@ struct packet_AC_REFUSE_LOGIN { /** * Packet structure for AC_REFUSE_LOGIN_R2. */ -struct packet_AC_REFUSE_LOGIN_R2 { +struct PACKET_AC_REFUSE_LOGIN_R2 { int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN_R2) uint32 error_code; ///< Error code char block_date[20]; ///< Ban expiration date @@ -293,7 +288,7 @@ struct packet_AC_REFUSE_LOGIN_R2 { * * Variable-length packet. */ -struct packet_AC_ACCEPT_LOGIN { +struct PACKET_AC_ACCEPT_LOGIN { int16 packet_id; ///< Packet ID (#HEADER_AC_ACCEPT_LOGIN) int16 packet_len; ///< Packet length (variable length) int32 auth_code; ///< Authentication code @@ -324,7 +319,7 @@ struct packet_AC_ACCEPT_LOGIN { * * Variable-length packet */ -struct packet_AC_ACK_HASH { +struct PACKET_AC_ACK_HASH { int16 packet_id; ///< Packet ID (#HEADER_AC_ACK_HASH) int16 packet_len; ///< Packet length (variable length) uint8 secret[]; ///< Challenge string @@ -361,20 +356,20 @@ struct lclif_interface_private { */ enum parsefunc_rcode (*parse_sub)(int fd, struct login_session_data *sd); - LoginParseFunc *parse_CA_CONNECT_INFO_CHANGED; ///< Packet handler for #packet_CA_CONNECT_INFO_CHANGED. - LoginParseFunc *parse_CA_EXE_HASHCHECK; ///< Packet handler for #packet_CA_EXE_HASHCHECK. - LoginParseFunc *parse_CA_LOGIN; ///< Packet handler for #packet_CA_LOGIN. - LoginParseFunc *parse_CA_LOGIN2; ///< Packet handler for #packet_CA_LOGIN2. - LoginParseFunc *parse_CA_LOGIN3; ///< Packet handler for #packet_CA_LOGIN3. - LoginParseFunc *parse_CA_LOGIN4; ///< Packet handler for #packet_CA_LOGIN4. - LoginParseFunc *parse_CA_LOGIN_PCBANG; ///< Packet handler for #packet_CA_LOGIN_PCBANG. - LoginParseFunc *parse_CA_LOGIN_HAN; ///< Packet handler for #packet_CA_LOGIN_HAN. - LoginParseFunc *parse_CA_SSO_LOGIN_REQ; ///< Packet handler for #packet_CA_SSO_LOGIN_REQ. - LoginParseFunc *parse_CA_LOGIN_OTP; ///< Packet handler for #packet_CA_LOGIN_OTP. - LoginParseFunc *parse_CA_ACK_MOBILE_OTP; ///< Packet handler for #packet_CA_ACK_MOBILE_OTP. - LoginParseFunc *parse_CA_OTP_CODE; ///< Packet handler for #packet_CA_OTP_CODE. - LoginParseFunc *parse_CA_REQ_HASH; ///< Packet handler for #packet_CA_REQ_HASH. - LoginParseFunc *parse_CA_CHARSERVERCONNECT; ///< Packet handler for #packet_CA_CHARSERVERCONNECT. + LoginParseFunc *parse_CA_CONNECT_INFO_CHANGED; ///< Packet handler for #PACKET_CA_CONNECT_INFO_CHANGED. + LoginParseFunc *parse_CA_EXE_HASHCHECK; ///< Packet handler for #PACKET_CA_EXE_HASHCHECK. + LoginParseFunc *parse_CA_LOGIN; ///< Packet handler for #PACKET_CA_LOGIN. + LoginParseFunc *parse_CA_LOGIN2; ///< Packet handler for #PACKET_CA_LOGIN2. + LoginParseFunc *parse_CA_LOGIN3; ///< Packet handler for #PACKET_CA_LOGIN3. + LoginParseFunc *parse_CA_LOGIN4; ///< Packet handler for #PACKET_CA_LOGIN4. + LoginParseFunc *parse_CA_LOGIN_PCBANG; ///< Packet handler for #PACKET_CA_LOGIN_PCBANG. + LoginParseFunc *parse_CA_LOGIN_HAN; ///< Packet handler for #PACKET_CA_LOGIN_HAN. + LoginParseFunc *parse_CA_SSO_LOGIN_REQ; ///< Packet handler for #PACKET_CA_SSO_LOGIN_REQ. + LoginParseFunc *parse_CA_LOGIN_OTP; ///< Packet handler for #PACKET_CA_LOGIN_OTP. + LoginParseFunc *parse_CA_ACK_MOBILE_OTP; ///< Packet handler for #PACKET_CA_ACK_MOBILE_OTP. + LoginParseFunc *parse_CA_OTP_CODE; ///< Packet handler for #PACKET_CA_OTP_CODE. + LoginParseFunc *parse_CA_REQ_HASH; ///< Packet handler for #PACKET_CA_REQ_HASH. + LoginParseFunc *parse_CA_CHARSERVERCONNECT; ///< Packet handler for #PACKET_CA_CHARSERVERCONNECT. }; #endif // LOGIN_LCLIF_P_H -- cgit v1.2.3-70-g09d2 From 5964302e6cd5a8cceda5b7fd3cb85f8081815d7d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 17:51:39 +0300 Subject: Update HPM. --- src/common/HPMDataCheck.h | 30 ++++---- src/plugins/HPMHooking/HPMHooking.Defs.inc | 6 ++ .../HPMHooking/HPMHooking_login.HPMHooksCore.inc | 12 ++++ .../HPMHooking/HPMHooking_login.HookingPoints.inc | 3 + src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 80 ++++++++++++++++++++++ 5 files changed, 116 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index d92591501..e24ec04b8 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -344,23 +344,23 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #define LOGIN_LCLIF_H #endif // LOGIN_LCLIF_H #ifdef LOGIN_LCLIF_P_H + { "PACKET_AC_ACCEPT_LOGIN", sizeof(struct PACKET_AC_ACCEPT_LOGIN), SERVER_TYPE_LOGIN }, + { "PACKET_AC_REFUSE_LOGIN", sizeof(struct PACKET_AC_REFUSE_LOGIN), SERVER_TYPE_LOGIN }, + { "PACKET_AC_REFUSE_LOGIN_R2", sizeof(struct PACKET_AC_REFUSE_LOGIN_R2), SERVER_TYPE_LOGIN }, + { "PACKET_CA_CHARSERVERCONNECT", sizeof(struct PACKET_CA_CHARSERVERCONNECT), SERVER_TYPE_LOGIN }, + { "PACKET_CA_CONNECT_INFO_CHANGED", sizeof(struct PACKET_CA_CONNECT_INFO_CHANGED), SERVER_TYPE_LOGIN }, + { "PACKET_CA_EXE_HASHCHECK", sizeof(struct PACKET_CA_EXE_HASHCHECK), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN", sizeof(struct PACKET_CA_LOGIN), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN2", sizeof(struct PACKET_CA_LOGIN2), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN3", sizeof(struct PACKET_CA_LOGIN3), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN4", sizeof(struct PACKET_CA_LOGIN4), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN_HAN", sizeof(struct PACKET_CA_LOGIN_HAN), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN_OTP", sizeof(struct PACKET_CA_LOGIN_OTP), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN_PCBANG", sizeof(struct PACKET_CA_LOGIN_PCBANG), SERVER_TYPE_LOGIN }, + { "PACKET_CA_SSO_LOGIN_REQ", sizeof(struct PACKET_CA_SSO_LOGIN_REQ), SERVER_TYPE_LOGIN }, + { "PACKET_SC_NOTIFY_BAN", sizeof(struct PACKET_SC_NOTIFY_BAN), SERVER_TYPE_LOGIN }, { "lclif_interface_dbs", sizeof(struct lclif_interface_dbs), SERVER_TYPE_LOGIN }, { "lclif_interface_private", sizeof(struct lclif_interface_private), SERVER_TYPE_LOGIN }, - { "packet_AC_ACCEPT_LOGIN", sizeof(struct packet_AC_ACCEPT_LOGIN), SERVER_TYPE_LOGIN }, - { "packet_AC_REFUSE_LOGIN", sizeof(struct packet_AC_REFUSE_LOGIN), SERVER_TYPE_LOGIN }, - { "packet_AC_REFUSE_LOGIN_R2", sizeof(struct packet_AC_REFUSE_LOGIN_R2), SERVER_TYPE_LOGIN }, - { "packet_CA_CHARSERVERCONNECT", sizeof(struct packet_CA_CHARSERVERCONNECT), SERVER_TYPE_LOGIN }, - { "packet_CA_CONNECT_INFO_CHANGED", sizeof(struct packet_CA_CONNECT_INFO_CHANGED), SERVER_TYPE_LOGIN }, - { "packet_CA_EXE_HASHCHECK", sizeof(struct packet_CA_EXE_HASHCHECK), SERVER_TYPE_LOGIN }, - { "packet_CA_LOGIN", sizeof(struct packet_CA_LOGIN), SERVER_TYPE_LOGIN }, - { "packet_CA_LOGIN2", sizeof(struct packet_CA_LOGIN2), SERVER_TYPE_LOGIN }, - { "packet_CA_LOGIN3", sizeof(struct packet_CA_LOGIN3), SERVER_TYPE_LOGIN }, - { "packet_CA_LOGIN4", sizeof(struct packet_CA_LOGIN4), SERVER_TYPE_LOGIN }, - { "packet_CA_LOGIN_HAN", sizeof(struct packet_CA_LOGIN_HAN), SERVER_TYPE_LOGIN }, - { "packet_CA_LOGIN_OTP", sizeof(struct packet_CA_LOGIN_OTP), SERVER_TYPE_LOGIN }, - { "packet_CA_LOGIN_PCBANG", sizeof(struct packet_CA_LOGIN_PCBANG), SERVER_TYPE_LOGIN }, - { "packet_CA_SSO_LOGIN_REQ", sizeof(struct packet_CA_SSO_LOGIN_REQ), SERVER_TYPE_LOGIN }, - { "packet_SC_NOTIFY_BAN", sizeof(struct packet_SC_NOTIFY_BAN), SERVER_TYPE_LOGIN }, #else #define LOGIN_LCLIF_P_H #endif // LOGIN_LCLIF_P_H diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index ea1aa85a4..eb81ed693 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -4072,6 +4072,10 @@ typedef enum parsefunc_rcode (*HPMHOOK_pre_PRIV__lclif_parse_CA_SSO_LOGIN_REQ) ( typedef enum parsefunc_rcode (*HPMHOOK_post_PRIV__lclif_parse_CA_SSO_LOGIN_REQ) (enum parsefunc_rcode retVal___, int fd, struct login_session_data *sd); typedef enum parsefunc_rcode (*HPMHOOK_pre_PRIV__lclif_parse_CA_LOGIN_OTP) (int *fd, struct login_session_data **sd); typedef enum parsefunc_rcode (*HPMHOOK_post_PRIV__lclif_parse_CA_LOGIN_OTP) (enum parsefunc_rcode retVal___, int fd, struct login_session_data *sd); +typedef enum parsefunc_rcode (*HPMHOOK_pre_PRIV__lclif_parse_CA_ACK_MOBILE_OTP) (int *fd, struct login_session_data **sd); +typedef enum parsefunc_rcode (*HPMHOOK_post_PRIV__lclif_parse_CA_ACK_MOBILE_OTP) (enum parsefunc_rcode retVal___, int fd, struct login_session_data *sd); +typedef enum parsefunc_rcode (*HPMHOOK_pre_PRIV__lclif_parse_CA_OTP_CODE) (int *fd, struct login_session_data **sd); +typedef enum parsefunc_rcode (*HPMHOOK_post_PRIV__lclif_parse_CA_OTP_CODE) (enum parsefunc_rcode retVal___, int fd, struct login_session_data *sd); typedef enum parsefunc_rcode (*HPMHOOK_pre_PRIV__lclif_parse_CA_REQ_HASH) (int *fd, struct login_session_data **sd); typedef enum parsefunc_rcode (*HPMHOOK_post_PRIV__lclif_parse_CA_REQ_HASH) (enum parsefunc_rcode retVal___, int fd, struct login_session_data *sd); typedef enum parsefunc_rcode (*HPMHOOK_pre_PRIV__lclif_parse_CA_CHARSERVERCONNECT) (int *fd, struct login_session_data **sd); @@ -4354,6 +4358,8 @@ typedef bool (*HPMHOOK_pre_login_client_login) (int *fd, struct login_session_da typedef bool (*HPMHOOK_post_login_client_login) (bool retVal___, int fd, struct login_session_data *sd); typedef bool (*HPMHOOK_pre_login_client_login_otp) (int *fd, struct login_session_data **sd); typedef bool (*HPMHOOK_post_login_client_login_otp) (bool retVal___, int fd, struct login_session_data *sd); +typedef void (*HPMHOOK_pre_login_client_login_mobile_otp_request) (int *fd, struct login_session_data **sd); +typedef void (*HPMHOOK_post_login_client_login_mobile_otp_request) (int fd, struct login_session_data *sd); typedef void (*HPMHOOK_pre_login_char_server_connection_status) (int *fd, struct login_session_data **sd, uint8 *status); typedef void (*HPMHOOK_post_login_char_server_connection_status) (int fd, struct login_session_data *sd, uint8 status); typedef void (*HPMHOOK_pre_login_parse_request_connection) (int *fd, struct login_session_data **sd, const char **ip, uint32 *ipl); diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index 35dea3ce7..20607bdfd 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -204,6 +204,10 @@ struct { struct HPMHookPoint *HP_PRIV__lclif_parse_CA_SSO_LOGIN_REQ_post; struct HPMHookPoint *HP_PRIV__lclif_parse_CA_LOGIN_OTP_pre; struct HPMHookPoint *HP_PRIV__lclif_parse_CA_LOGIN_OTP_post; + struct HPMHookPoint *HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_pre; + struct HPMHookPoint *HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_post; + struct HPMHookPoint *HP_PRIV__lclif_parse_CA_OTP_CODE_pre; + struct HPMHookPoint *HP_PRIV__lclif_parse_CA_OTP_CODE_post; struct HPMHookPoint *HP_PRIV__lclif_parse_CA_REQ_HASH_pre; struct HPMHookPoint *HP_PRIV__lclif_parse_CA_REQ_HASH_post; struct HPMHookPoint *HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_pre; @@ -436,6 +440,8 @@ struct { struct HPMHookPoint *HP_login_client_login_post; struct HPMHookPoint *HP_login_client_login_otp_pre; struct HPMHookPoint *HP_login_client_login_otp_post; + struct HPMHookPoint *HP_login_client_login_mobile_otp_request_pre; + struct HPMHookPoint *HP_login_client_login_mobile_otp_request_post; struct HPMHookPoint *HP_login_char_server_connection_status_pre; struct HPMHookPoint *HP_login_char_server_connection_status_post; struct HPMHookPoint *HP_login_parse_request_connection_pre; @@ -997,6 +1003,10 @@ struct { int HP_PRIV__lclif_parse_CA_SSO_LOGIN_REQ_post; int HP_PRIV__lclif_parse_CA_LOGIN_OTP_pre; int HP_PRIV__lclif_parse_CA_LOGIN_OTP_post; + int HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_pre; + int HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_post; + int HP_PRIV__lclif_parse_CA_OTP_CODE_pre; + int HP_PRIV__lclif_parse_CA_OTP_CODE_post; int HP_PRIV__lclif_parse_CA_REQ_HASH_pre; int HP_PRIV__lclif_parse_CA_REQ_HASH_post; int HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT_pre; @@ -1229,6 +1239,8 @@ struct { int HP_login_client_login_post; int HP_login_client_login_otp_pre; int HP_login_client_login_otp_post; + int HP_login_client_login_mobile_otp_request_pre; + int HP_login_client_login_mobile_otp_request_post; int HP_login_char_server_connection_status_pre; int HP_login_char_server_connection_status_post; int HP_login_parse_request_connection_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index b03162550..20667f45f 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -126,6 +126,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(lclif->p->parse_CA_LOGIN_HAN, HP_PRIV__lclif_parse_CA_LOGIN_HAN) }, { HP_POP(lclif->p->parse_CA_SSO_LOGIN_REQ, HP_PRIV__lclif_parse_CA_SSO_LOGIN_REQ) }, { HP_POP(lclif->p->parse_CA_LOGIN_OTP, HP_PRIV__lclif_parse_CA_LOGIN_OTP) }, + { HP_POP(lclif->p->parse_CA_ACK_MOBILE_OTP, HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP) }, + { HP_POP(lclif->p->parse_CA_OTP_CODE, HP_PRIV__lclif_parse_CA_OTP_CODE) }, { HP_POP(lclif->p->parse_CA_REQ_HASH, HP_PRIV__lclif_parse_CA_REQ_HASH) }, { HP_POP(lclif->p->parse_CA_CHARSERVERCONNECT, HP_PRIV__lclif_parse_CA_CHARSERVERCONNECT) }, /* libconfig_interface */ @@ -244,6 +246,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(login->auth_failed, HP_login_auth_failed) }, { HP_POP(login->client_login, HP_login_client_login) }, { HP_POP(login->client_login_otp, HP_login_client_login_otp) }, + { HP_POP(login->client_login_mobile_otp_request, HP_login_client_login_mobile_otp_request) }, { HP_POP(login->char_server_connection_status, HP_login_char_server_connection_status) }, { HP_POP(login->parse_request_connection, HP_login_parse_request_connection) }, { HP_POP(login->config_set_defaults, HP_login_config_set_defaults) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index c4359a2ad..f556c621d 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -2409,6 +2409,60 @@ enum parsefunc_rcode HP_PRIV__lclif_parse_CA_LOGIN_OTP(int fd, struct login_sess } return retVal___; } +enum parsefunc_rcode HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP(int fd, struct login_session_data *sd) { + int hIndex = 0; + enum parsefunc_rcode retVal___ = PACKET_UNKNOWN; + if (HPMHooks.count.HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_pre > 0) { + enum parsefunc_rcode (*preHookFunc) (int *fd, struct login_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.PRIV__lclif.parse_CA_ACK_MOBILE_OTP(fd, sd); + } + if (HPMHooks.count.HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_post > 0) { + enum parsefunc_rcode (*postHookFunc) (enum parsefunc_rcode retVal___, int fd, struct login_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_PRIV__lclif_parse_CA_ACK_MOBILE_OTP_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fd, sd); + } + } + return retVal___; +} +enum parsefunc_rcode HP_PRIV__lclif_parse_CA_OTP_CODE(int fd, struct login_session_data *sd) { + int hIndex = 0; + enum parsefunc_rcode retVal___ = PACKET_UNKNOWN; + if (HPMHooks.count.HP_PRIV__lclif_parse_CA_OTP_CODE_pre > 0) { + enum parsefunc_rcode (*preHookFunc) (int *fd, struct login_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__lclif_parse_CA_OTP_CODE_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_PRIV__lclif_parse_CA_OTP_CODE_pre[hIndex].func; + retVal___ = preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.PRIV__lclif.parse_CA_OTP_CODE(fd, sd); + } + if (HPMHooks.count.HP_PRIV__lclif_parse_CA_OTP_CODE_post > 0) { + enum parsefunc_rcode (*postHookFunc) (enum parsefunc_rcode retVal___, int fd, struct login_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_PRIV__lclif_parse_CA_OTP_CODE_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_PRIV__lclif_parse_CA_OTP_CODE_post[hIndex].func; + retVal___ = postHookFunc(retVal___, fd, sd); + } + } + return retVal___; +} enum parsefunc_rcode HP_PRIV__lclif_parse_CA_REQ_HASH(int fd, struct login_session_data *sd) { int hIndex = 0; enum parsefunc_rcode retVal___ = PACKET_UNKNOWN; @@ -5521,6 +5575,32 @@ bool HP_login_client_login_otp(int fd, struct login_session_data *sd) { } return retVal___; } +void HP_login_client_login_mobile_otp_request(int fd, struct login_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_login_client_login_mobile_otp_request_pre > 0) { + void (*preHookFunc) (int *fd, struct login_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_client_login_mobile_otp_request_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_client_login_mobile_otp_request_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.login.client_login_mobile_otp_request(fd, sd); + } + if (HPMHooks.count.HP_login_client_login_mobile_otp_request_post > 0) { + void (*postHookFunc) (int fd, struct login_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_client_login_mobile_otp_request_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_client_login_mobile_otp_request_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} void HP_login_char_server_connection_status(int fd, struct login_session_data *sd, uint8 status) { int hIndex = 0; if (HPMHooks.count.HP_login_char_server_connection_status_pre > 0) { -- cgit v1.2.3-70-g09d2 From 6343c26dec1b8e9ae36fc3b8426dfd7b7dc09d7e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 18:24:49 +0300 Subject: Move packets struct in login server into separate files for AC and CA packets. --- src/login/HPMlogin.c | 2 + src/login/lclif.c | 2 + src/login/lclif.p.h | 292 ------------------------------------------ src/login/login.c | 9 +- src/login/packets_ac_struct.h | 125 ++++++++++++++++++ src/login/packets_ca_struct.h | 239 ++++++++++++++++++++++++++++++++++ src/plugins/HPMHooking.c | 2 + 7 files changed, 371 insertions(+), 300 deletions(-) create mode 100644 src/login/packets_ac_struct.h create mode 100644 src/login/packets_ca_struct.h (limited to 'src') diff --git a/src/login/HPMlogin.c b/src/login/HPMlogin.c index e5dc126eb..304db5501 100644 --- a/src/login/HPMlogin.c +++ b/src/login/HPMlogin.c @@ -30,6 +30,8 @@ #include "login/lclif.p.h" #include "login/login.h" #include "login/loginlog.h" +#include "login/packets_ac_struct.h" +#include "login/packets_ca_struct.h" #include "common/HPMi.h" #include "common/conf.h" #include "common/console.h" diff --git a/src/login/lclif.c b/src/login/lclif.c index f0d711303..97871922d 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -24,6 +24,8 @@ #include "login/ipban.h" #include "login/login.h" #include "login/loginlog.h" +#include "login/packets_ac_struct.h" +#include "login/packets_ca_struct.h" #include "common/HPM.h" #include "common/cbasetypes.h" #include "common/db.h" diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index f383998dc..e2c2133cd 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -28,7 +28,6 @@ #include "common/hercules.h" #include "common/mmo.h" -#include "common/packetsstatic_len.h" /* Definitions and macros */ /// Maximum amount of packets processed at once from the same client @@ -38,297 +37,6 @@ #define MIN_PACKET_DB 0x0064 #define MAX_PACKET_LOGIN_DB 0x0acf -/* Enums */ - -/// Packet IDs -enum login_packet_id { - // CA (Client to Login) - HEADER_CA_LOGIN = 0x0064, - HEADER_CA_LOGIN2 = 0x01dd, - HEADER_CA_LOGIN3 = 0x01fa, - HEADER_CA_CONNECT_INFO_CHANGED = 0x0200, - HEADER_CA_EXE_HASHCHECK = 0x0204, - HEADER_CA_LOGIN_PCBANG = 0x0277, - HEADER_CA_LOGIN4 = 0x027c, - HEADER_CA_LOGIN_HAN = 0x02b0, - HEADER_CA_SSO_LOGIN_REQ = 0x0825, - HEADER_CA_LOGIN_OTP = 0x0acf, - HEADER_CA_REQ_HASH = 0x01db, - HEADER_CA_CHARSERVERCONNECT = 0x2710, // Custom Hercules Packet - //HEADER_CA_SSO_LOGIN_REQa = 0x825a, /* unused */ - - // AC (Login to Client) - - HEADER_AC_ACCEPT_LOGIN = 0x0069, - HEADER_AC_ACCEPT_LOGIN2 = 0x0ac4, - HEADER_AC_REFUSE_LOGIN = 0x006a, - HEADER_SC_NOTIFY_BAN = 0x0081, - HEADER_AC_ACK_HASH = 0x01dc, - HEADER_AC_REFUSE_LOGIN_R2 = 0x083e, - HEADER_AC_REFUSE_LOGIN_R3 = 0x0b02, -}; - -/* Packets Structs */ -#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute -#pragma pack(push, 1) -#endif // not NetBSD < 6 / Solaris - -/** - * Packet structure for CA_LOGIN. - */ -struct PACKET_CA_LOGIN { - int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN) - uint32 version; ///< Client Version - char id[24]; ///< Username - char password[24]; ///< Password - uint8 clienttype; ///< Client Type -} __attribute__((packed)); - -/** - * Packet structure for CA_LOGIN2. - */ -struct PACKET_CA_LOGIN2 { - int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN2) - uint32 version; ///< Client Version - char id[24]; ///< Username - uint8 password_md5[16]; ///< Password hash - uint8 clienttype; ///< Client Type -} __attribute__((packed)); - -/** - * Packet structure for CA_LOGIN3. - */ -struct PACKET_CA_LOGIN3 { - int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN3) - uint32 version; ///< Client Version - char id[24]; ///< Username - uint8 password_md5[16]; ///< Password hash - uint8 clienttype; ///< Client Type - uint8 clientinfo; ///< Index of the connection in the clientinfo file (+10 if the command-line contains "pc") -} __attribute__((packed)); - -/** - * Packet structure for CA_LOGIN4. - */ -struct PACKET_CA_LOGIN4 { - int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN4) - uint32 version; ///< Client Version - char id[24]; ///< Username - uint8 password_md5[16]; ///< Password hash - uint8 clienttype; ///< Client Type - char mac_address[13]; ///< MAC Address -} __attribute__((packed)); - -/** - * Packet structure for CA_LOGIN_PCBANG. - */ -struct PACKET_CA_LOGIN_PCBANG { - int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_PCBANG) - uint32 version; ///< Client Version - char id[24]; ///< Username - char password[24]; ///< Password - uint8 clienttype; ///< Client Type - char ip[16]; ///< IP Address - char mac_address[13]; ///< MAC Address -} __attribute__((packed)); - -/** - * Packet structure for CA_LOGIN_HAN. - */ -struct PACKET_CA_LOGIN_HAN { - int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_HAN) - uint32 version; ///< Client Version - char id[24]; ///< Username - char password[24]; ///< Password - uint8 clienttype; ///< Client Type - char ip[16]; ///< IP Address - char mac_address[13]; ///< MAC Address - uint8 is_han_game_user; ///< 'isGravityID' -} __attribute__((packed)); - -/** - * Packet structure for CA_SSO_LOGIN_REQ. - * - * Variable-length packet. - */ -struct PACKET_CA_SSO_LOGIN_REQ { - int16 packet_id; ///< Packet ID (#HEADER_CA_SSO_LOGIN_REQ) - int16 packet_len; ///< Length (variable length) - uint32 version; ///< Clientver - uint8 clienttype; ///< Clienttype - char id[24]; ///< Username - char password[27]; ///< Password - int8 mac_address[17]; ///< MAC Address - char ip[15]; ///< IP Address - char t1[]; ///< SSO Login Token (variable length) -} __attribute__((packed)); - -#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 -/** - * Packet structure for CA_SSO_LOGIN_REQ. - * - * Variable-length packet. - */ -struct PACKET_CA_ACK_MOBILE_OTP { - int16 packet_id; ///< Packet ID (#HEADER_CA_ACK_MOBILE_OTP) - int16 packet_len; ///< Length (variable length) - uint32 aid; ///< Account ID - char code[6]; ///< Code -} __attribute__((packed)); -DEFINE_PACKET_HEADER(CA_ACK_MOBILE_OTP, 0x09a3); -#endif - -#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) -struct PACKET_CA_OTP_CODE { - int16 packet_id; ///< Packet ID (#HEADER_CA_OTP_CODE) - char code[9]; ///< Code -} __attribute__((packed)); -DEFINE_PACKET_HEADER(CA_OTP_CODE, 0x0ad0); -#endif - -/** - * Packet structure for CA_LOGIN_OTP. - */ -struct PACKET_CA_LOGIN_OTP { - int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_OTP) -#if PACKETVER >= 20171113 - uint32 devFlags; ///< flags including dev flag -#endif - char login[25]; ///< Username - char password[32]; ///< Password encrypted by rijndael - char flagsStr[5]; ///< Unknown flags. Normally string: G000 -} __attribute__((packed)); - -#if 0 // Unused -struct PACKET_CA_SSO_LOGIN_REQa { - int16 packet_id; - int16 packet_len; - uint32 version; - uint8 clienttype; - char id[24]; - int8 mac_address[17]; - char ip[15]; - char t1[]; -} __attribute__((packed)); -#endif // unused - -/** - * Packet structure for CA_CONNECT_INFO_CHANGED. - * - * New alive packet. Used to verify if client is always alive. - */ -struct PACKET_CA_CONNECT_INFO_CHANGED { - int16 packet_id; ///< Packet ID (#HEADER_CA_CONNECT_INFO_CHANGED) - char id[24]; ///< account.userid -} __attribute__((packed)); - -/** - * Packet structure for CA_EXE_HASHCHECK. - * - * (kRO 2004-05-31aSakexe langtype 0 and 6) - */ -struct PACKET_CA_EXE_HASHCHECK { - int16 packet_id; ///< Packet ID (#HEADER_CA_EXE_HASHCHECK) - uint8 hash_value[16]; ///< Client MD5 hash -} __attribute__((packed)); - -/** - * Packet structure for CA_REQ_HASH. - */ -struct PACKET_CA_REQ_HASH { - int16 packet_id; ///< Packet ID (#HEADER_CA_REQ_HASH) -} __attribute__((packed)); - -/** - * Packet structure for CA_CHARSERVERCONNECT. - * - * This packet is used internally, to signal a char-server connection. - */ -struct PACKET_CA_CHARSERVERCONNECT { - int16 packet_id; ///< Packet ID (#HEADER_CA_CHARSERVERCONNECT) - char userid[24]; ///< Username - char password[24]; ///< Password - int32 unknown; - int32 ip; ///< Charserver IP - int16 port; ///< Charserver port - char name[20]; ///< Charserver name - int16 unknown2; - int16 type; ///< Charserver type - int16 new; ///< Whether charserver is to be marked as new -} __attribute__((packed)); - -/** - * Packet structure for SC_NOTIFY_BAN. - */ -struct PACKET_SC_NOTIFY_BAN { - int16 packet_id; ///< Packet ID (#HEADER_SC_NOTIFY_BAN) - uint8 error_code; ///< Error code -} __attribute__((packed)); - -/** - * Packet structure for AC_REFUSE_LOGIN. - */ -struct PACKET_AC_REFUSE_LOGIN { - int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN) - uint8 error_code; ///< Error code - char block_date[20]; ///< Ban expiration date -} __attribute__((packed)); - -/** - * Packet structure for AC_REFUSE_LOGIN_R2. - */ -struct PACKET_AC_REFUSE_LOGIN_R2 { - int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN_R2) - uint32 error_code; ///< Error code - char block_date[20]; ///< Ban expiration date -} __attribute__((packed)); - -/** - * Packet structure for AC_ACCEPT_LOGIN. - * - * Variable-length packet. - */ -struct PACKET_AC_ACCEPT_LOGIN { - int16 packet_id; ///< Packet ID (#HEADER_AC_ACCEPT_LOGIN) - int16 packet_len; ///< Packet length (variable length) - int32 auth_code; ///< Authentication code - uint32 aid; ///< Account ID - uint32 user_level; ///< User level - uint32 last_login_ip; ///< Last login IP - char last_login_time[26]; ///< Last login timestamp - uint8 sex; ///< Account sex -#if PACKETVER >= 20170315 - char twitter_auth_token[16]; - uint8 twitter_flag; -#endif - struct { - uint32 ip; ///< Server IP address - int16 port; ///< Server port - char name[20]; ///< Server name - uint16 usercount; ///< Online users - uint16 state; ///< Server state - uint16 property; ///< Server property -#if PACKETVER >= 20170315 - char unknown2[128]; -#endif - } server_list[]; ///< List of charservers -} __attribute__((packed)); - -/** - * Packet structure for AC_ACK_HASH. - * - * Variable-length packet - */ -struct PACKET_AC_ACK_HASH { - int16 packet_id; ///< Packet ID (#HEADER_AC_ACK_HASH) - int16 packet_len; ///< Packet length (variable length) - uint8 secret[]; ///< Challenge string -} __attribute__((packed)); - -#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 - /** * Login Client Interface additional data */ diff --git a/src/login/login.c b/src/login/login.c index 409b30473..67abd45af 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -27,6 +27,7 @@ #include "login/ipban.h" #include "login/loginlog.h" #include "login/lclif.h" +#include "login/packets_ac_struct.h" #include "common/HPM.h" #include "common/cbasetypes.h" #include "common/conf.h" @@ -68,14 +69,6 @@ static AccountDB *accounts = NULL; //----------------------------------------------------- #define AUTH_TIMEOUT 30000 -#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) -struct PACKET_AC_REQ_MOBILE_OTP { - int16 packet_id; ///< Packet ID (#HEADER_CA_SSO_LOGIN_REQ) - uint32 aid; ///< Account ID -} __attribute__((packed)); -DEFINE_PACKET_HEADER(AC_REQ_MOBILE_OTP, 0x09a2); -#endif - /** * @see DBCreateData */ diff --git a/src/login/packets_ac_struct.h b/src/login/packets_ac_struct.h new file mode 100644 index 000000000..6ec92b38f --- /dev/null +++ b/src/login/packets_ac_struct.h @@ -0,0 +1,125 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2016-2018 Hercules Dev Team + * + * 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 . + */ +#ifndef LOGIN_PACKETS_AC_STRUCT_H +#define LOGIN_PACKETS_AC_STRUCT_H + +#include "common/hercules.h" +#include "common/mmo.h" +#include "common/packetsstatic_len.h" + +/* Enums */ + +/// Packet IDs +enum login_ac_packet_id { + HEADER_AC_ACCEPT_LOGIN = 0x0069, + HEADER_AC_ACCEPT_LOGIN2 = 0x0ac4, + HEADER_AC_REFUSE_LOGIN = 0x006a, + HEADER_SC_NOTIFY_BAN = 0x0081, + HEADER_AC_ACK_HASH = 0x01dc, + HEADER_AC_REFUSE_LOGIN_R2 = 0x083e, + HEADER_AC_REFUSE_LOGIN_R3 = 0x0b02, +}; + +/* Packets Structs */ +#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute +#pragma pack(push, 1) +#endif // not NetBSD < 6 / Solaris + +/** + * Packet structure for SC_NOTIFY_BAN. + */ +struct PACKET_SC_NOTIFY_BAN { + int16 packet_id; ///< Packet ID (#HEADER_SC_NOTIFY_BAN) + uint8 error_code; ///< Error code +} __attribute__((packed)); + +/** + * Packet structure for AC_REFUSE_LOGIN. + */ +struct PACKET_AC_REFUSE_LOGIN { + int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN) + uint8 error_code; ///< Error code + char block_date[20]; ///< Ban expiration date +} __attribute__((packed)); + +/** + * Packet structure for AC_REFUSE_LOGIN_R2. + */ +struct PACKET_AC_REFUSE_LOGIN_R2 { + int16 packet_id; ///< Packet ID (#HEADER_AC_REFUSE_LOGIN_R2) + uint32 error_code; ///< Error code + char block_date[20]; ///< Ban expiration date +} __attribute__((packed)); + +/** + * Packet structure for AC_ACCEPT_LOGIN. + * + * Variable-length packet. + */ +struct PACKET_AC_ACCEPT_LOGIN { + int16 packet_id; ///< Packet ID (#HEADER_AC_ACCEPT_LOGIN) + int16 packet_len; ///< Packet length (variable length) + int32 auth_code; ///< Authentication code + uint32 aid; ///< Account ID + uint32 user_level; ///< User level + uint32 last_login_ip; ///< Last login IP + char last_login_time[26]; ///< Last login timestamp + uint8 sex; ///< Account sex +#if PACKETVER >= 20170315 + char twitter_auth_token[16]; + uint8 twitter_flag; +#endif + struct { + uint32 ip; ///< Server IP address + int16 port; ///< Server port + char name[20]; ///< Server name + uint16 usercount; ///< Online users + uint16 state; ///< Server state + uint16 property; ///< Server property +#if PACKETVER >= 20170315 + char unknown2[128]; +#endif + } server_list[]; ///< List of charservers +} __attribute__((packed)); + +/** + * Packet structure for AC_ACK_HASH. + * + * Variable-length packet + */ +struct PACKET_AC_ACK_HASH { + int16 packet_id; ///< Packet ID (#HEADER_AC_ACK_HASH) + int16 packet_len; ///< Packet length (variable length) + uint8 secret[]; ///< Challenge string +} __attribute__((packed)); + +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) +struct PACKET_AC_REQ_MOBILE_OTP { + int16 packet_id; ///< Packet ID (#HEADER_CA_SSO_LOGIN_REQ) + uint32 aid; ///< Account ID +} __attribute__((packed)); +DEFINE_PACKET_HEADER(AC_REQ_MOBILE_OTP, 0x09a2); +#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 + +#endif // LOGIN_PACKETS_AC_STRUCT_H diff --git a/src/login/packets_ca_struct.h b/src/login/packets_ca_struct.h new file mode 100644 index 000000000..0828c7293 --- /dev/null +++ b/src/login/packets_ca_struct.h @@ -0,0 +1,239 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2016-2018 Hercules Dev Team + * + * 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 . + */ +#ifndef LOGIN_PACKETS_CA_STRUCT_H +#define LOGIN_PACKETS_CA_STRUCT_H + +#include "common/hercules.h" +#include "common/mmo.h" +#include "common/packetsstatic_len.h" + +/* Enums */ + +/// Packet IDs +enum login_packet_ca_id { + HEADER_CA_LOGIN = 0x0064, + HEADER_CA_LOGIN2 = 0x01dd, + HEADER_CA_LOGIN3 = 0x01fa, + HEADER_CA_CONNECT_INFO_CHANGED = 0x0200, + HEADER_CA_EXE_HASHCHECK = 0x0204, + HEADER_CA_LOGIN_PCBANG = 0x0277, + HEADER_CA_LOGIN4 = 0x027c, + HEADER_CA_LOGIN_HAN = 0x02b0, + HEADER_CA_SSO_LOGIN_REQ = 0x0825, + HEADER_CA_LOGIN_OTP = 0x0acf, + HEADER_CA_REQ_HASH = 0x01db, + HEADER_CA_CHARSERVERCONNECT = 0x2710, // Custom Hercules Packet + //HEADER_CA_SSO_LOGIN_REQa = 0x825a, /* unused */ +}; + +/* Packets Structs */ +#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute +#pragma pack(push, 1) +#endif // not NetBSD < 6 / Solaris + +/** + * Packet structure for CA_LOGIN. + */ +struct PACKET_CA_LOGIN { + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN) + uint32 version; ///< Client Version + char id[24]; ///< Username + char password[24]; ///< Password + uint8 clienttype; ///< Client Type +} __attribute__((packed)); + +/** + * Packet structure for CA_LOGIN2. + */ +struct PACKET_CA_LOGIN2 { + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN2) + uint32 version; ///< Client Version + char id[24]; ///< Username + uint8 password_md5[16]; ///< Password hash + uint8 clienttype; ///< Client Type +} __attribute__((packed)); + +/** + * Packet structure for CA_LOGIN3. + */ +struct PACKET_CA_LOGIN3 { + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN3) + uint32 version; ///< Client Version + char id[24]; ///< Username + uint8 password_md5[16]; ///< Password hash + uint8 clienttype; ///< Client Type + uint8 clientinfo; ///< Index of the connection in the clientinfo file (+10 if the command-line contains "pc") +} __attribute__((packed)); + +/** + * Packet structure for CA_LOGIN4. + */ +struct PACKET_CA_LOGIN4 { + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN4) + uint32 version; ///< Client Version + char id[24]; ///< Username + uint8 password_md5[16]; ///< Password hash + uint8 clienttype; ///< Client Type + char mac_address[13]; ///< MAC Address +} __attribute__((packed)); + +/** + * Packet structure for CA_LOGIN_PCBANG. + */ +struct PACKET_CA_LOGIN_PCBANG { + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_PCBANG) + uint32 version; ///< Client Version + char id[24]; ///< Username + char password[24]; ///< Password + uint8 clienttype; ///< Client Type + char ip[16]; ///< IP Address + char mac_address[13]; ///< MAC Address +} __attribute__((packed)); + +/** + * Packet structure for CA_LOGIN_HAN. + */ +struct PACKET_CA_LOGIN_HAN { + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_HAN) + uint32 version; ///< Client Version + char id[24]; ///< Username + char password[24]; ///< Password + uint8 clienttype; ///< Client Type + char ip[16]; ///< IP Address + char mac_address[13]; ///< MAC Address + uint8 is_han_game_user; ///< 'isGravityID' +} __attribute__((packed)); + +/** + * Packet structure for CA_SSO_LOGIN_REQ. + * + * Variable-length packet. + */ +struct PACKET_CA_SSO_LOGIN_REQ { + int16 packet_id; ///< Packet ID (#HEADER_CA_SSO_LOGIN_REQ) + int16 packet_len; ///< Length (variable length) + uint32 version; ///< Clientver + uint8 clienttype; ///< Clienttype + char id[24]; ///< Username + char password[27]; ///< Password + int8 mac_address[17]; ///< MAC Address + char ip[15]; ///< IP Address + char t1[]; ///< SSO Login Token (variable length) +} __attribute__((packed)); + +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 +/** + * Packet structure for CA_SSO_LOGIN_REQ. + * + * Variable-length packet. + */ +struct PACKET_CA_ACK_MOBILE_OTP { + int16 packet_id; ///< Packet ID (#HEADER_CA_ACK_MOBILE_OTP) + int16 packet_len; ///< Length (variable length) + uint32 aid; ///< Account ID + char code[6]; ///< Code +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CA_ACK_MOBILE_OTP, 0x09a3); +#endif + +#if PACKETVER_MAIN_NUM >= 20181114 || PACKETVER_RE_NUM >= 20181114 || defined(PACKETVER_ZERO) +struct PACKET_CA_OTP_CODE { + int16 packet_id; ///< Packet ID (#HEADER_CA_OTP_CODE) + char code[9]; ///< Code +} __attribute__((packed)); +DEFINE_PACKET_HEADER(CA_OTP_CODE, 0x0ad0); +#endif + +/** + * Packet structure for CA_LOGIN_OTP. + */ +struct PACKET_CA_LOGIN_OTP { + int16 packet_id; ///< Packet ID (#HEADER_CA_LOGIN_OTP) +#if PACKETVER >= 20171113 + uint32 devFlags; ///< flags including dev flag +#endif + char login[25]; ///< Username + char password[32]; ///< Password encrypted by rijndael + char flagsStr[5]; ///< Unknown flags. Normally string: G000 +} __attribute__((packed)); + +#if 0 // Unused +struct PACKET_CA_SSO_LOGIN_REQa { + int16 packet_id; + int16 packet_len; + uint32 version; + uint8 clienttype; + char id[24]; + int8 mac_address[17]; + char ip[15]; + char t1[]; +} __attribute__((packed)); +#endif // unused + +/** + * Packet structure for CA_CONNECT_INFO_CHANGED. + * + * New alive packet. Used to verify if client is always alive. + */ +struct PACKET_CA_CONNECT_INFO_CHANGED { + int16 packet_id; ///< Packet ID (#HEADER_CA_CONNECT_INFO_CHANGED) + char id[24]; ///< account.userid +} __attribute__((packed)); + +/** + * Packet structure for CA_EXE_HASHCHECK. + * + * (kRO 2004-05-31aSakexe langtype 0 and 6) + */ +struct PACKET_CA_EXE_HASHCHECK { + int16 packet_id; ///< Packet ID (#HEADER_CA_EXE_HASHCHECK) + uint8 hash_value[16]; ///< Client MD5 hash +} __attribute__((packed)); + +/** + * Packet structure for CA_REQ_HASH. + */ +struct PACKET_CA_REQ_HASH { + int16 packet_id; ///< Packet ID (#HEADER_CA_REQ_HASH) +} __attribute__((packed)); + +/** + * Packet structure for CA_CHARSERVERCONNECT. + * + * This packet is used internally, to signal a char-server connection. + */ +struct PACKET_CA_CHARSERVERCONNECT { + int16 packet_id; ///< Packet ID (#HEADER_CA_CHARSERVERCONNECT) + char userid[24]; ///< Username + char password[24]; ///< Password + int32 unknown; + int32 ip; ///< Charserver IP + int16 port; ///< Charserver port + char name[20]; ///< Charserver name + int16 unknown2; + int16 type; ///< Charserver type + int16 new; ///< Whether charserver is to be marked as new +} __attribute__((packed)); + +#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 + +#endif // LOGIN_PACKETS_CA_STRUCT_H diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index 64337d8f4..aef09d7a7 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -41,6 +41,8 @@ PRAGMA_GCC5(GCC diagnostic ignored "-Wdiscarded-qualifiers") #include "login/lclif.p.h" #include "login/login.h" #include "login/loginlog.h" +#include "login/packets_ac_struct.h" +#include "login/packets_ca_struct.h" #elif defined (HPMHOOKING_CHAR) #define HPM_SERVER_TYPE SERVER_TYPE_CHAR #define HPM_CORE_INCLUDE "HPMHooking/HPMHooking_char.HPMHooksCore.inc" -- cgit v1.2.3-70-g09d2 From 619dcd43d2419f83d99c4dd82b9e37e01cfd0c63 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 20:30:03 +0300 Subject: Increase default value for MAX_PACKET_LOGIN_DB to 0xad0 --- src/login/lclif.p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index e2c2133cd..4c444dbd1 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -35,7 +35,7 @@ // Packet DB #define MIN_PACKET_DB 0x0064 -#define MAX_PACKET_LOGIN_DB 0x0acf +#define MAX_PACKET_LOGIN_DB 0x0ad0 /** * Login Client Interface additional data -- cgit v1.2.3-70-g09d2 From af9e75a46245eee406eb1b9d7b3c98181b3a9cc4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 15 Nov 2018 23:58:28 +0300 Subject: Add validation for buffer size in char_mmo_char_tobuf. And use correct MAX_CHAR_BUF --- src/char/char.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/char/char.c b/src/char/char.c index a09eccd8a..023ab0ade 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -21,7 +21,7 @@ #define HERCULES_CORE #include "config/core.h" // CONSOLE_INPUT -#include "char.h" +#include "char/char.h" #include "char/HPMchar.h" #include "char/geoip.h" @@ -53,6 +53,7 @@ #include "common/mapindex.h" #include "common/mmo.h" #include "common/nullpo.h" +#include "common/packetsstatic_len.h" #include "common/showmsg.h" #include "common/socket.h" #include "common/strlib.h" @@ -1987,7 +1988,7 @@ static int char_count_users(void) // Writes char data to the buffer in the format used by the client. // Used in packets 0x6b (chars info) and 0x6d (new char info) // Returns the size -#define MAX_CHAR_BUF 150 //Max size (for WFIFOHEAD calls) +#define MAX_CHAR_BUF (PACKET_LEN_0x006d - 2) static int char_mmo_char_tobuf(uint8 *buffer, struct mmo_charstatus *p) { unsigned short offset = 0; @@ -2092,7 +2093,9 @@ static int char_mmo_char_tobuf(uint8 *buffer, struct mmo_charstatus *p) #endif #endif - return 106+offset; + if (106 + offset != MAX_CHAR_BUF) + Assert_report("Wrong buffer size in char_mmo_char_tobuf"); + return 106 + offset; } /* Made Possible by Yommy~! <3 */ -- cgit v1.2.3-70-g09d2 From 172734fc0a75b6f00f7ef8ecabfda32d5c341187 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 16 Nov 2018 00:24:59 +0300 Subject: Fix some visual studio warnings. --- src/common/packetsstatic_len.h | 4 ++-- src/common/socket.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/common/packetsstatic_len.h b/src/common/packetsstatic_len.h index 8e724cfa8..31a3988e8 100644 --- a/src/common/packetsstatic_len.h +++ b/src/common/packetsstatic_len.h @@ -25,8 +25,8 @@ #endif #define DEFINE_PACKET_HEADER(name, id) \ - STATIC_ASSERT(PACKET_LEN_##id == -1 || sizeof(struct PACKET_##name) == \ - PACKET_LEN_##id, "Wrong size PACKET_"#name); \ + STATIC_ASSERT((int32)(PACKET_LEN_##id) == -1 || sizeof(struct PACKET_##name) == \ + (size_t)PACKET_LEN_##id, "Wrong size PACKET_"#name); \ enum { HEADER_##name = id }; #define packetLen(id, len) PACKET_LEN_##id = (len), diff --git a/src/common/socket.c b/src/common/socket.c index 025776172..95d8bf578 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -2133,7 +2133,7 @@ static void socket_validateWfifo(int fd, size_t len) ShowError("Sent packet 0x%04X with size %d, but must be size %d\n", cmd, len2, packet_len); Assert_retv(0); } - if (last_head_size < packet_len) { + if (last_head_size < (uint32)packet_len) { ShowError("Reserved too small packet buffer for packet 0x%04X with size %u, but must be size %d\n", cmd, last_head_size, packet_len); Assert_retv(0); } -- 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') 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 c301b642c84d2a330c96817c70fd107804d992ba Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 21 Nov 2018 18:05:31 +0300 Subject: Update packet len table up to 2018-12-12 --- src/common/packets/packets2017_len_main.h | 2 +- src/common/packets/packets2017_len_re.h | 2 +- src/common/packets/packets2017_len_zero.h | 2 +- src/common/packets/packets2018_len_main.h | 307 +++++++++++++++++++++++++++++- src/common/packets/packets2018_len_re.h | 11 +- src/common/packets/packets2018_len_zero.h | 11 +- 6 files changed, 320 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/common/packets/packets2017_len_main.h b/src/common/packets/packets2017_len_main.h index 80fd4539e..572969174 100644 --- a/src/common/packets/packets2017_len_main.h +++ b/src/common/packets/packets2017_len_main.h @@ -8954,7 +8954,7 @@ packetLen(0x0acf, 52) // CA_LOGIN_OTP // Packet: 0x0ad0 #if PACKETVER >= 20170614 -packetLen(0x0ad0, 11) +packetLen(0x0ad0, 11) // CA_OTP_CODE #endif // Packet: 0x0ad1 diff --git a/src/common/packets/packets2017_len_re.h b/src/common/packets/packets2017_len_re.h index 33c7d5354..c2cbaa4aa 100644 --- a/src/common/packets/packets2017_len_re.h +++ b/src/common/packets/packets2017_len_re.h @@ -8960,7 +8960,7 @@ packetLen(0x0acf, 52) // CA_LOGIN_OTP // Packet: 0x0ad0 #if PACKETVER >= 20170614 -packetLen(0x0ad0, 11) +packetLen(0x0ad0, 11) // CA_OTP_CODE #endif // Packet: 0x0ad1 diff --git a/src/common/packets/packets2017_len_zero.h b/src/common/packets/packets2017_len_zero.h index 18427b766..dbe09dad6 100644 --- a/src/common/packets/packets2017_len_zero.h +++ b/src/common/packets/packets2017_len_zero.h @@ -5259,7 +5259,7 @@ packetLen(0x0acf, 64) // CA_LOGIN_OTP #endif // Packet: 0x0ad0 -packetLen(0x0ad0, 11) +packetLen(0x0ad0, 11) // CA_OTP_CODE // Packet: 0x0ad1 packetLen(0x0ad1, -1) diff --git a/src/common/packets/packets2018_len_main.h b/src/common/packets/packets2018_len_main.h index 095f1a5ab..e91e8998d 100644 --- a/src/common/packets/packets2018_len_main.h +++ b/src/common/packets/packets2018_len_main.h @@ -193,16 +193,28 @@ packetLen(0x009b, 34) // CZ_CHANGE_DIRECTION packetLen(0x009c, 9) // ZC_CHANGE_DIRECTION // Packet: 0x009d +#if PACKETVER >= 20181121 +packetLen(0x009d, 19) // ZC_ITEM_ENTRY +#elif PACKETVER >= 20180103 packetLen(0x009d, 17) // ZC_ITEM_ENTRY +#endif // Packet: 0x009e +#if PACKETVER >= 20181121 +packetLen(0x009e, 19) // ZC_ITEM_FALL_ENTRY +#elif PACKETVER >= 20180103 packetLen(0x009e, 17) // ZC_ITEM_FALL_ENTRY +#endif // Packet: 0x009f packetLen(0x009f, 20) // CZ_ITEM_PICKUP // Packet: 0x00a0 +#if PACKETVER >= 20181121 +packetLen(0x00a0, 33) // ZC_ITEM_PICKUP_ACK +#elif PACKETVER >= 20180103 packetLen(0x00a0, 23) // ZC_ITEM_PICKUP_ACK +#endif // Packet: 0x00a1 packetLen(0x00a1, 6) // ZC_ITEM_DISAPPEAR @@ -418,7 +430,11 @@ packetLen(0x00e7, 3) // ZC_ACK_EXCHANGE_ITEM packetLen(0x00e8, 8) // CZ_ADD_EXCHANGE_ITEM // Packet: 0x00e9 +#if PACKETVER >= 20181121 +packetLen(0x00e9, 29) // ZC_ADD_EXCHANGE_ITEM +#elif PACKETVER >= 20180103 packetLen(0x00e9, 19) // ZC_ADD_EXCHANGE_ITEM +#endif // Packet: 0x00ea packetLen(0x00ea, 5) // ZC_ACK_ADD_EXCHANGE_ITEM @@ -451,7 +467,11 @@ packetLen(0x00f2, 6) // ZC_NOTIFY_STOREITEM_COUNTINFO packetLen(0x00f3, -1) // CZ_REQUEST_CHAT // Packet: 0x00f4 +#if PACKETVER >= 20181121 +packetLen(0x00f4, 31) // ZC_ADD_ITEM_TO_STORE +#elif PACKETVER >= 20180103 packetLen(0x00f4, 21) // ZC_ADD_ITEM_TO_STORE +#endif // Packet: 0x00f5 packetLen(0x00f5, 11) // CZ_MOVE_ITEM_FROM_STORE_TO_BODY @@ -517,7 +537,11 @@ packetLen(0x0108, -1) // CZ_REQUEST_CHAT_PARTY packetLen(0x0109, -1) // ZC_NOTIFY_CHAT_PARTY // Packet: 0x010a +#if PACKETVER >= 20181121 +packetLen(0x010a, 6) // ZC_MVP_GETTING_ITEM +#elif PACKETVER >= 20180103 packetLen(0x010a, 4) // ZC_MVP_GETTING_ITEM +#endif // Packet: 0x010b packetLen(0x010b, 6) // ZC_MVP_GETTING_SPECIAL_EXP @@ -535,7 +559,11 @@ packetLen(0x010e, 11) // ZC_SKILLINFO_UPDATE packetLen(0x010f, -1) // ZC_SKILLINFO_LIST // Packet: 0x0110 +#if PACKETVER >= 20181121 +packetLen(0x0110, 14) // ZC_ACK_TOUSESKILL +#elif PACKETVER >= 20180103 packetLen(0x0110, 10) // ZC_ACK_TOUSESKILL +#endif // Packet: 0x0111 packetLen(0x0111, 39) // ZC_ADD_SKILL @@ -595,7 +623,11 @@ packetLen(0x0122, -1) // ZC_CART_EQUIPMENT_ITEMLIST packetLen(0x0123, -1) // ZC_CART_NORMAL_ITEMLIST // Packet: 0x0124 +#if PACKETVER >= 20181121 +packetLen(0x0124, 31) // ZC_ADD_ITEM_TO_CART +#elif PACKETVER >= 20180103 packetLen(0x0124, 21) // ZC_ADD_ITEM_TO_CART +#endif // Packet: 0x0125 packetLen(0x0125, 8) // ZC_DELETE_ITEM_FROM_CART @@ -907,10 +939,18 @@ packetLen(0x018c, 29) // ZC_MONSTER_INFO packetLen(0x018d, -1) // ZC_MAKABLEITEMLIST // Packet: 0x018e +#if PACKETVER >= 20181121 +packetLen(0x018e, 18) // CZ_REQMAKINGITEM +#elif PACKETVER >= 20180103 packetLen(0x018e, 10) // CZ_REQMAKINGITEM +#endif // Packet: 0x018f +#if PACKETVER >= 20181121 +packetLen(0x018f, 8) // ZC_ACK_REQMAKINGITEM +#elif PACKETVER >= 20180103 packetLen(0x018f, 6) // ZC_ACK_REQMAKINGITEM +#endif // Packet: 0x0190 packetLen(0x0190, 23) // CZ_USE_SKILL_TOGROUND_WITHTALKBOX @@ -970,7 +1010,11 @@ packetLen(0x01a1, 3) // CZ_COMMAND_PET packetLen(0x01a2, 37) // ZC_PROPERTY_PET // Packet: 0x01a3 +#if PACKETVER >= 20181121 +packetLen(0x01a3, 7) // ZC_FEED_PET +#elif PACKETVER >= 20180103 packetLen(0x01a3, 5) // ZC_FEED_PET +#endif // Packet: 0x01a4 packetLen(0x01a4, 11) // ZC_CHANGESTATE_PET @@ -1003,7 +1047,11 @@ packetLen(0x01ac, 6) // ZC_SKILL_UPDATE packetLen(0x01ad, -1) // ZC_MAKINGARROW_LIST // Packet: 0x01ae +#if PACKETVER >= 20181121 +packetLen(0x01ae, 6) // CZ_REQ_MAKINGARROW +#elif PACKETVER >= 20180103 packetLen(0x01ae, 4) // CZ_REQ_MAKINGARROW +#endif // Packet: 0x01af packetLen(0x01af, 4) // CZ_REQ_CHANGECART @@ -1069,10 +1117,18 @@ packetLen(0x01c2, 10) // ZC_INFO_REMAINTIME packetLen(0x01c3, -1) // ZC_BROADCAST2 // Packet: 0x01c4 +#if PACKETVER >= 20181121 +packetLen(0x01c4, 32) // ZC_ADD_ITEM_TO_STORE2 +#elif PACKETVER >= 20180103 packetLen(0x01c4, 22) // ZC_ADD_ITEM_TO_STORE2 +#endif // Packet: 0x01c5 +#if PACKETVER >= 20181121 +packetLen(0x01c5, 32) // ZC_ADD_ITEM_TO_CART2 +#elif PACKETVER >= 20180103 packetLen(0x01c5, 22) // ZC_ADD_ITEM_TO_CART2 +#endif // Packet: 0x01c6 packetLen(0x01c6, 4) // CS_REQ_ENCRYPTION @@ -1081,7 +1137,11 @@ packetLen(0x01c6, 4) // CS_REQ_ENCRYPTION packetLen(0x01c7, 2) // SC_ACK_ENCRYPTION // Packet: 0x01c8 +#if PACKETVER >= 20181121 +packetLen(0x01c8, 15) // ZC_USE_ITEM_ACK2 +#elif PACKETVER >= 20180103 packetLen(0x01c8, 13) // ZC_USE_ITEM_ACK2 +#endif // Packet: 0x01c9 packetLen(0x01c9, 97) // ZC_SKILL_ENTRY2 @@ -1126,16 +1186,32 @@ packetLen(0x01d5, -1) // CZ_INPUT_EDITDLGSTR packetLen(0x01d6, 4) // ZC_NOTIFY_MAPPROPERTY2 // Packet: 0x01d7 +#if PACKETVER >= 20181121 +packetLen(0x01d7, 15) // ZC_SPRITE_CHANGE2 +#elif PACKETVER >= 20180103 packetLen(0x01d7, 11) // ZC_SPRITE_CHANGE2 +#endif // Packet: 0x01d8 +#if PACKETVER >= 20181121 +packetLen(0x01d8, 58) // ZC_NOTIFY_STANDENTRY2 +#elif PACKETVER >= 20180103 packetLen(0x01d8, 54) // ZC_NOTIFY_STANDENTRY2 +#endif // Packet: 0x01d9 +#if PACKETVER >= 20181121 +packetLen(0x01d9, 57) // ZC_NOTIFY_NEWENTRY2 +#elif PACKETVER >= 20180103 packetLen(0x01d9, 53) // ZC_NOTIFY_NEWENTRY2 +#endif // Packet: 0x01da +#if PACKETVER >= 20181121 +packetLen(0x01da, 64) // ZC_NOTIFY_MOVEENTRY2 +#elif PACKETVER >= 20180103 packetLen(0x01da, 60) // ZC_NOTIFY_MOVEENTRY2 +#endif // Packet: 0x01db packetLen(0x01db, 2) // CA_REQ_HASH @@ -1240,7 +1316,11 @@ packetLen(0x01fb, 56) // CH_DELETE_CHAR2 packetLen(0x01fc, -1) // ZC_REPAIRITEMLIST // Packet: 0x01fd +#if PACKETVER >= 20181121 +packetLen(0x01fd, 25) // CZ_REQ_ITEMREPAIR +#elif PACKETVER >= 20180103 packetLen(0x01fd, 15) // CZ_REQ_ITEMREPAIR +#endif // Packet: 0x01fe packetLen(0x01fe, 5) // ZC_ACK_ITEMREPAIR @@ -1355,7 +1435,11 @@ packetLen(0x0221, -1) // ZC_NOTIFY_WEAPONITEMLIST packetLen(0x0222, 6) // CZ_REQ_WEAPONREFINE // Packet: 0x0223 +#if PACKETVER >= 20181121 +packetLen(0x0223, 10) // ZC_ACK_WEAPONREFINE +#elif PACKETVER >= 20180103 packetLen(0x0223, 8) // ZC_ACK_WEAPONREFINE +#endif // Packet: 0x0224 packetLen(0x0224, 10) // ZC_TAEKWON_POINT @@ -1376,13 +1460,25 @@ packetLen(0x0228, 18) // CZ_ACK_GAME_GUARD packetLen(0x0229, 15) // ZC_STATE_CHANGE3 // Packet: 0x022a +#if PACKETVER >= 20181121 +packetLen(0x022a, 62) // ZC_NOTIFY_STANDENTRY3 +#elif PACKETVER >= 20180103 packetLen(0x022a, 58) // ZC_NOTIFY_STANDENTRY3 +#endif // Packet: 0x022b +#if PACKETVER >= 20181121 +packetLen(0x022b, 61) // ZC_NOTIFY_NEWENTRY3 +#elif PACKETVER >= 20180103 packetLen(0x022b, 57) // ZC_NOTIFY_NEWENTRY3 +#endif // Packet: 0x022c +#if PACKETVER >= 20181121 +packetLen(0x022c, 69) // ZC_NOTIFY_MOVEENTRY3 +#elif PACKETVER >= 20180103 packetLen(0x022c, 65) // ZC_NOTIFY_MOVEENTRY3 +#endif // Packet: 0x022d #if PACKETVER >= 20180315 @@ -1396,10 +1492,18 @@ packetLen(0x022d, 2) // CZ_COMMAND_MER #endif // Packet: 0x022e +#if PACKETVER >= 20181121 +packetLen(0x022e, 73) // ZC_PROPERTY_HOMUN +#elif PACKETVER >= 20180103 packetLen(0x022e, 71) // ZC_PROPERTY_HOMUN +#endif // Packet: 0x022f +#if PACKETVER >= 20181121 +packetLen(0x022f, 7) // ZC_FEED_MER +#elif PACKETVER >= 20180103 packetLen(0x022f, 5) // ZC_FEED_MER +#endif // Packet: 0x0230 packetLen(0x0230, 12) // ZC_CHANGESTATE_MER @@ -1539,7 +1643,11 @@ packetLen(0x0259, 3) // AC_ACK_GAME_GUARD packetLen(0x025a, -1) // ZC_MAKINGITEM_LIST // Packet: 0x025b +#if PACKETVER >= 20181121 +packetLen(0x025b, 8) // CZ_REQ_MAKINGITEM +#elif PACKETVER >= 20180103 packetLen(0x025b, 6) // CZ_REQ_MAKINGITEM +#endif // Packet: 0x025c packetLen(0x025c, 4) // CZ_AUCTION_REQ_MY_INFO @@ -1735,13 +1843,25 @@ packetLen(0x0296, -1) // ZC_STORE_EQUIPMENT_ITEMLIST2 packetLen(0x0297, -1) // ZC_CART_EQUIPMENT_ITEMLIST2 // Packet: 0x0298 +#if PACKETVER >= 20181121 +packetLen(0x0298, 10) // ZC_CASH_TIME_COUNTER +#elif PACKETVER >= 20180103 packetLen(0x0298, 8) // ZC_CASH_TIME_COUNTER +#endif // Packet: 0x0299 +#if PACKETVER >= 20181121 +packetLen(0x0299, 8) // ZC_CASH_ITEM_DELETE +#elif PACKETVER >= 20180103 packetLen(0x0299, 6) // ZC_CASH_ITEM_DELETE +#endif // Packet: 0x029a +#if PACKETVER >= 20181121 +packetLen(0x029a, 37) // ZC_ITEM_PICKUP_ACK2 +#elif PACKETVER >= 20180103 packetLen(0x029a, 27) // ZC_ITEM_PICKUP_ACK2 +#endif // Packet: 0x029b packetLen(0x029b, 80) // ZC_MER_INIT @@ -1807,7 +1927,11 @@ packetLen(0x02b6, 7) // CZ_ACTIVE_QUEST packetLen(0x02b7, 7) // ZC_ACTIVE_QUEST // Packet: 0x02b8 +#if PACKETVER >= 20181121 +packetLen(0x02b8, 32) // ZC_ITEM_PICKUP_PARTY +#elif PACKETVER >= 20180103 packetLen(0x02b8, 22) // ZC_ITEM_PICKUP_PARTY +#endif // Packet: 0x02b9 packetLen(0x02b9, 191) // ZC_SHORTCUT_KEY_LIST @@ -1882,7 +2006,11 @@ packetLen(0x02d2, -1) // ZC_CART_EQUIPMENT_ITEMLIST3 packetLen(0x02d3, 4) // ZC_NOTIFY_BIND_ON_EQUIP // Packet: 0x02d4 +#if PACKETVER >= 20181121 +packetLen(0x02d4, 39) // ZC_ITEM_PICKUP_ACK3 +#elif PACKETVER >= 20180103 packetLen(0x02d4, 29) // ZC_ITEM_PICKUP_ACK3 +#endif // Packet: 0x02d5 packetLen(0x02d5, 2) // ZC_ISVR_DISCONNECT @@ -1954,13 +2082,25 @@ packetLen(0x02ea, -1) // ZC_STORE_NORMAL_ITEMLIST3 packetLen(0x02eb, 13) // ZC_ACCEPT_ENTER2 // Packet: 0x02ec +#if PACKETVER >= 20181121 +packetLen(0x02ec, 71) // ZC_NOTIFY_MOVEENTRY4 +#elif PACKETVER >= 20180103 packetLen(0x02ec, 67) // ZC_NOTIFY_MOVEENTRY4 +#endif // Packet: 0x02ed +#if PACKETVER >= 20181121 +packetLen(0x02ed, 63) // ZC_NOTIFY_NEWENTRY4 +#elif PACKETVER >= 20180103 packetLen(0x02ed, 59) // ZC_NOTIFY_NEWENTRY4 +#endif // Packet: 0x02ee +#if PACKETVER >= 20181121 +packetLen(0x02ee, 64) // ZC_NOTIFY_STANDENTRY4 +#elif PACKETVER >= 20180103 packetLen(0x02ee, 60) // ZC_NOTIFY_STANDENTRY4 +#endif // Packet: 0x02ef packetLen(0x02ef, 8) // ZC_NOTIFY_FONT @@ -2223,7 +2363,11 @@ packetLen(0x0443, 8) // CZ_SKILL_SELECT_RESPONSE packetLen(0x0444, -1) // ZC_SIMPLE_CASH_POINT_ITEMLIST // Packet: 0x0445 +#if PACKETVER >= 20181121 +packetLen(0x0445, 12) // CZ_SIMPLE_BUY_CASH_POINT_ITEM +#elif PACKETVER >= 20180103 packetLen(0x0445, 10) // CZ_SIMPLE_BUY_CASH_POINT_ITEM +#endif // Packet: 0x0446 packetLen(0x0446, 14) // ZC_QUEST_NOTIFY_EFFECT @@ -2451,7 +2595,11 @@ packetLen(0x080d, 3) // ZC_SIMPLE_CASH_BTNSHOW packetLen(0x080e, 14) // ZC_NOTIFY_HP_TO_GROUPM_R2 // Packet: 0x080f +#if PACKETVER >= 20181121 +packetLen(0x080f, 30) // ZC_ADD_EXCHANGE_ITEM2 +#elif PACKETVER >= 20180103 packetLen(0x080f, 20) // ZC_ADD_EXCHANGE_ITEM2 +#endif // Packet: 0x0810 packetLen(0x0810, 3) // ZC_OPEN_BUYING_STORE @@ -2521,7 +2669,11 @@ packetLen(0x0819, 2) // CZ_REQ_TRADE_BUYING_STORE packetLen(0x081a, 4) // ZC_FAILED_TRADE_BUYING_STORE_TO_BUYER // Packet: 0x081b +#if PACKETVER >= 20181121 +packetLen(0x081b, 12) // ZC_UPDATE_ITEM_FROM_BUYING_STORE +#elif PACKETVER >= 20180103 packetLen(0x081b, 10) // ZC_UPDATE_ITEM_FROM_BUYING_STORE +#endif // Packet: 0x081c packetLen(0x081c, 10) // ZC_ITEM_DELETE_BUYING_STORE @@ -2548,7 +2700,11 @@ packetLen(0x0822, 9) // CA_OTP_AUTH_REQ packetLen(0x0823, -1) // AC_OTP_AUTH_ACK // Packet: 0x0824 +#if PACKETVER >= 20181121 +packetLen(0x0824, 8) // ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER +#elif PACKETVER >= 20180103 packetLen(0x0824, 6) // ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER +#endif // Packet: 0x0825 packetLen(0x0825, -1) // CA_SSO_LOGIN_REQ @@ -2610,7 +2766,9 @@ packetLen(0x083a, 5) // ZC_OPEN_SEARCH_STORE_INFO packetLen(0x083b, 2) // CZ_CLOSE_SEARCH_STORE_INFO // Packet: 0x083c -#if PACKETVER >= 20180315 +#if PACKETVER >= 20181121 +packetLen(0x083c, 14) // CZ_SSILIST_ITEM_CLICK +#elif PACKETVER >= 20180315 packetLen(0x083c, 12) // CZ_SSILIST_ITEM_CLICK #elif PACKETVER >= 20180213 packetLen(0x083c, 2) // CZ_SSILIST_ITEM_CLICK @@ -2660,7 +2818,11 @@ packetLen(0x0849, 16) // ZC_SE_PC_BUY_CASHITEM_RESULT packetLen(0x084a, 2) // CZ_SE_CASHSHOP_CLOSE // Packet: 0x084b +#if PACKETVER >= 20181121 +packetLen(0x084b, 21) // ZC_ITEM_FALL_ENTRY4 +#elif PACKETVER >= 20180103 packetLen(0x084b, 19) // ZC_ITEM_FALL_ENTRY4 +#endif // Packet: 0x084c packetLen(0x084c, 10) // CZ_MACRO_USE_SKILL @@ -4235,7 +4397,11 @@ packetLen(0x098e, -1) // ZC_NOTIFY_CLAN_CHAT packetLen(0x098f, -1) // CH_DELETE_CHAR3_EXT // Packet: 0x0990 +#if PACKETVER >= 20181121 +packetLen(0x0990, 41) // ZC_ITEM_PICKUP_ACK_V5 +#elif PACKETVER >= 20180103 packetLen(0x0990, 31) // ZC_ITEM_PICKUP_ACK_V5 +#endif // Packet: 0x0991 packetLen(0x0991, -1) // ZC_INVENTORY_ITEMLIST_NORMAL_V5 @@ -4322,25 +4488,45 @@ packetLen(0x09ab, 6) // CZ_REQ_BANKING_CHECK packetLen(0x09ac, -1) // CZ_REQ_CASH_BARGAIN_SALE_ITEM_INFO // Packet: 0x09ad +#if PACKETVER >= 20181121 +packetLen(0x09ad, 12) // ZC_ACK_CASH_BARGAIN_SALE_ITEM_INFO +#elif PACKETVER >= 20180103 packetLen(0x09ad, 10) // ZC_ACK_CASH_BARGAIN_SALE_ITEM_INFO +#endif // Packet: 0x09ae +#if PACKETVER >= 20181121 +packetLen(0x09ae, 19) // CZ_REQ_APPLY_BARGAIN_SALE_ITEM +#elif PACKETVER >= 20180103 packetLen(0x09ae, 17) // CZ_REQ_APPLY_BARGAIN_SALE_ITEM +#endif // Packet: 0x09af packetLen(0x09af, 4) // ZC_ACK_APPLY_BARGAIN_SALE_ITEM // Packet: 0x09b0 +#if PACKETVER >= 20181121 +packetLen(0x09b0, 10) // CZ_REQ_REMOVE_BARGAIN_SALE_ITEM +#elif PACKETVER >= 20180103 packetLen(0x09b0, 8) // CZ_REQ_REMOVE_BARGAIN_SALE_ITEM +#endif // Packet: 0x09b1 packetLen(0x09b1, 4) // ZC_ACK_REMOVE_BARGAIN_SALE_ITEM // Packet: 0x09b2 +#if PACKETVER >= 20181121 +packetLen(0x09b2, 10) // ZC_NOTIFY_BARGAIN_SALE_SELLING +#elif PACKETVER >= 20180103 packetLen(0x09b2, 8) // ZC_NOTIFY_BARGAIN_SALE_SELLING +#endif // Packet: 0x09b3 +#if PACKETVER >= 20181121 +packetLen(0x09b3, 6) // ZC_NOTIFY_BARGAIN_SALE_CLOSE +#elif PACKETVER >= 20180103 packetLen(0x09b3, 4) // ZC_NOTIFY_BARGAIN_SALE_CLOSE +#endif // Packet: 0x09b4 packetLen(0x09b4, 6) // CZ_OPEN_BARGAIN_SALE_TOOL @@ -4385,10 +4571,18 @@ packetLen(0x09c1, 10) // ZC_C_MARKERINFO packetLen(0x09c2, -1) // HC_SECRETSCAN_DATA // Packet: 0x09c3 +#if PACKETVER >= 20181121 +packetLen(0x09c3, 10) // CZ_REQ_COUNT_BARGAIN_SALE_ITEM +#elif PACKETVER >= 20180103 packetLen(0x09c3, 8) // CZ_REQ_COUNT_BARGAIN_SALE_ITEM +#endif // Packet: 0x09c4 +#if PACKETVER >= 20181121 +packetLen(0x09c4, 10) // ZC_ACK_COUNT_BARGAIN_SALE_ITEM +#elif PACKETVER >= 20180103 packetLen(0x09c4, 8) // ZC_ACK_COUNT_BARGAIN_SALE_ITEM +#endif // Packet: 0x09c5 packetLen(0x09c5, 1042) // CS_LOGIN_QUERY @@ -4490,7 +4684,11 @@ packetLen(0x09e4, 8) // CZ_MOVE_ITEM_FROM_GUILDSTORAGE_TO_CART packetLen(0x09e5, 18) // ZC_DELETEITEM_FROM_MCSTORE2 // Packet: 0x09e6 +#if PACKETVER >= 20181121 +packetLen(0x09e6, 24) // ZC_UPDATE_ITEM_FROM_BUYING_STORE2 +#elif PACKETVER >= 20180103 packetLen(0x09e6, 22) // ZC_UPDATE_ITEM_FROM_BUYING_STORE2 +#endif // Packet: 0x09e7 packetLen(0x09e7, 3) // ZC_NOTIFY_UNREAD_RODEX @@ -4541,7 +4739,11 @@ packetLen(0x09f5, 11) // CZ_REQ_DELETE_RODEX packetLen(0x09f6, 11) // ZC_ACK_DELETE_RODEX // Packet: 0x09f7 +#if PACKETVER >= 20181121 +packetLen(0x09f7, 77) // ZC_PROPERTY_HOMUN_2 +#elif PACKETVER >= 20180103 packetLen(0x09f7, 75) // ZC_PROPERTY_HOMUN_2 +#endif // Packet: 0x09f8 packetLen(0x09f8, -1) // ZC_ALL_QUEST_LIST3 @@ -4583,7 +4785,11 @@ packetLen(0x0a03, 2) // CZ_REQ_CANCEL_WRITE_RODEX packetLen(0x0a04, 6) // CZ_REQ_ADD_ITEM_RODEX // Packet: 0x0a05 +#if PACKETVER >= 20181121 +packetLen(0x0a05, 63) // ZC_ACK_ADD_ITEM_RODEX +#elif PACKETVER >= 20180103 packetLen(0x0a05, 53) // ZC_ACK_ADD_ITEM_RODEX +#endif // Packet: 0x0a06 packetLen(0x0a06, 6) // CZ_REQ_REMOVE_RODEX_ITEM @@ -4595,16 +4801,32 @@ packetLen(0x0a07, 9) // ZC_ACK_REMOVE_RODEX_ITEM packetLen(0x0a08, 26) // CZ_REQ_OPEN_WRITE_RODEX // Packet: 0x0a09 +#if PACKETVER >= 20181121 +packetLen(0x0a09, 55) // ZC_ADD_EXCHANGE_ITEM3 +#elif PACKETVER >= 20180103 packetLen(0x0a09, 45) // ZC_ADD_EXCHANGE_ITEM3 +#endif // Packet: 0x0a0a +#if PACKETVER >= 20181121 +packetLen(0x0a0a, 57) // ZC_ADD_ITEM_TO_STORE3 +#elif PACKETVER >= 20180103 packetLen(0x0a0a, 47) // ZC_ADD_ITEM_TO_STORE3 +#endif // Packet: 0x0a0b +#if PACKETVER >= 20181121 +packetLen(0x0a0b, 57) // ZC_ADD_ITEM_TO_CART3 +#elif PACKETVER >= 20180103 packetLen(0x0a0b, 47) // ZC_ADD_ITEM_TO_CART3 +#endif // Packet: 0x0a0c +#if PACKETVER >= 20181121 +packetLen(0x0a0c, 66) // ZC_ITEM_PICKUP_ACK_V6 +#elif PACKETVER >= 20180103 packetLen(0x0a0c, 56) // ZC_ITEM_PICKUP_ACK_V6 +#endif // Packet: 0x0a0d packetLen(0x0a0d, -1) // ZC_INVENTORY_ITEMLIST_EQUIP_V6 @@ -4646,7 +4868,11 @@ packetLen(0x0a18, 14) // ZC_ACCEPT_ENTER3 packetLen(0x0a19, 2) // CZ_REQ_OPEN_ROULETTE // Packet: 0x0a1a +#if PACKETVER >= 20181121 +packetLen(0x0a1a, 25) // ZC_ACK_OPEN_ROULETTE +#elif PACKETVER >= 20180103 packetLen(0x0a1a, 23) // ZC_ACK_OPEN_ROULETTE +#endif // Packet: 0x0a1b packetLen(0x0a1b, 2) // CZ_REQ_ROULETTE_INFO @@ -4664,13 +4890,21 @@ packetLen(0x0a1e, 3) // ZC_ACK_CLOSE_ROULETTE packetLen(0x0a1f, 2) // CZ_REQ_GENERATE_ROULETTE // Packet: 0x0a20 +#if PACKETVER >= 20181121 +packetLen(0x0a20, 23) // ZC_ACK_GENERATE_ROULETTE +#elif PACKETVER >= 20180103 packetLen(0x0a20, 21) // ZC_ACK_GENERATE_ROULETTE +#endif // Packet: 0x0a21 packetLen(0x0a21, 3) // CZ_RECV_ROULETTE_ITEM // Packet: 0x0a22 +#if PACKETVER >= 20181121 +packetLen(0x0a22, 7) // ZC_RECV_ROULETTE_ITEM +#elif PACKETVER >= 20180103 packetLen(0x0a22, 5) // ZC_RECV_ROULETTE_ITEM +#endif // Packet: 0x0a23 packetLen(0x0a23, -1) // ZC_ALL_ACH_LIST @@ -4733,7 +4967,11 @@ packetLen(0x0a35, 4) // CZ_REQ_ONECLICK_ITEMIDENTIFY packetLen(0x0a36, 7) // ZC_HP_INFO_TINY // Packet: 0x0a37 +#if PACKETVER >= 20181121 +packetLen(0x0a37, 69) // ZC_ITEM_PICKUP_ACK_V7 +#elif PACKETVER >= 20180103 packetLen(0x0a37, 59) // ZC_ITEM_PICKUP_ACK_V7 +#endif // Packet: 0x0a38 packetLen(0x0a38, 3) // ZC_OPEN_UI @@ -4751,13 +4989,21 @@ packetLen(0x0a3b, -1) // ZC_CUSTOM_HAT_EFFECT packetLen(0x0a3c, -1) // Packet: 0x0a3d +#if PACKETVER >= 20181121 +packetLen(0x0a3d, 20) +#elif PACKETVER >= 20180103 packetLen(0x0a3d, 18) +#endif // Packet: 0x0a3e packetLen(0x0a3e, -1) // Packet: 0x0a3f +#if PACKETVER >= 20181121 +packetLen(0x0a3f, 11) +#elif PACKETVER >= 20180103 packetLen(0x0a3f, 9) +#endif // Packet: 0x0a40 packetLen(0x0a40, 11) @@ -4784,7 +5030,11 @@ packetLen(0x0a47, 3) // ZC_STYLE_CHANGE_RES packetLen(0x0a48, 2) // Packet: 0x0a49 +#if PACKETVER >= 20181121 +packetLen(0x0a49, 22) // CZ_PRIVATE_AIRSHIP_REQUEST +#elif PACKETVER >= 20180103 packetLen(0x0a49, 20) // CZ_PRIVATE_AIRSHIP_REQUEST +#endif // Packet: 0x0a4a packetLen(0x0a4a, 6) // ZC_PRIVATE_AIRSHIP_RESPONSE @@ -4799,7 +5049,11 @@ packetLen(0x0a4c, 28) // ZC_AIRSHIP_SERVERMOVE packetLen(0x0a4d, -1) // Packet: 0x0a4e +#if PACKETVER >= 20181121 +packetLen(0x0a4e, 6) +#elif PACKETVER >= 20180103 packetLen(0x0a4e, 4) +#endif // Packet: 0x0a4f packetLen(0x0a4f, -1) @@ -4940,7 +5194,11 @@ packetLen(0x0a87, -1) packetLen(0x0a88, 2) // Packet: 0x0a89 +#if PACKETVER >= 20181121 +packetLen(0x0a89, 61) // ZC_NOTIFY_OFFLINE_STORE +#elif PACKETVER >= 20180103 packetLen(0x0a89, 57) // ZC_NOTIFY_OFFLINE_STORE +#endif // Packet: 0x0a8a packetLen(0x0a8a, 6) // ZC_OFFLINE_STORE_VANISH @@ -4979,7 +5237,11 @@ packetLen(0x0a94, 2) packetLen(0x0a95, 4) // Packet: 0x0a96 +#if PACKETVER >= 20181121 +packetLen(0x0a96, 61) // ZC_ADD_EXCHANGE_ITEM4 +#elif PACKETVER >= 20180103 packetLen(0x0a96, 51) // ZC_ADD_EXCHANGE_ITEM4 +#endif // Packet: 0x0a97 packetLen(0x0a97, 8) // CZ_ALT_EQUIPMENT_EQUIP @@ -5018,7 +5280,11 @@ packetLen(0x0aa1, 4) // CZ_REFINE_ADD_ITEM packetLen(0x0aa2, -1) // ZC_REFINE_ADD_ITEM // Packet: 0x0aa3 +#if PACKETVER >= 20181121 +packetLen(0x0aa3, 9) // CZ_REFINE_ITEM_REQUEST +#elif PACKETVER >= 20180103 packetLen(0x0aa3, 7) // CZ_REFINE_ITEM_REQUEST +#endif // Packet: 0x0aa4 packetLen(0x0aa4, 2) // CZ_REFINE_WINDOW_CLOSE @@ -5069,13 +5335,21 @@ packetLen(0x0ab2, 7) // ZC_GROUP_ISALIVE packetLen(0x0ab3, 19) // Packet: 0x0ab4 +#if PACKETVER >= 20181121 +packetLen(0x0ab4, 6) +#elif PACKETVER >= 20180103 packetLen(0x0ab4, 4) +#endif // Packet: 0x0ab5 packetLen(0x0ab5, 2) // Packet: 0x0ab6 +#if PACKETVER >= 20181121 +packetLen(0x0ab6, 8) +#elif PACKETVER >= 20180103 packetLen(0x0ab6, 6) +#endif // Packet: 0x0ab7 packetLen(0x0ab7, 4) @@ -5084,7 +5358,11 @@ packetLen(0x0ab7, 4) packetLen(0x0ab8, 2) // Packet: 0x0ab9 +#if PACKETVER >= 20181121 +packetLen(0x0ab9, 47) // ZC_ITEM_PREVIEW +#elif PACKETVER >= 20180103 packetLen(0x0ab9, 39) // ZC_ITEM_PREVIEW +#endif // Packet: 0x0aba packetLen(0x0aba, 2) @@ -5153,7 +5431,7 @@ packetLen(0x0ace, 4) packetLen(0x0acf, 68) // CA_LOGIN_OTP // Packet: 0x0ad0 -packetLen(0x0ad0, 11) +packetLen(0x0ad0, 11) // CA_OTP_CODE // Packet: 0x0ad1 packetLen(0x0ad1, -1) @@ -5183,7 +5461,11 @@ packetLen(0x0ad8, 8) packetLen(0x0ad9, -1) // Packet: 0x0ada +#if PACKETVER >= 20181121 +packetLen(0x0ada, 32) // ZC_REFINE_STATUS +#elif PACKETVER >= 20180103 packetLen(0x0ada, 30) // ZC_REFINE_STATUS +#endif // Packet: 0x0adb packetLen(0x0adb, -1) @@ -5192,7 +5474,11 @@ packetLen(0x0adb, -1) packetLen(0x0adc, 6) // ZC_EQUIPWIN_OTHER // Packet: 0x0add +#if PACKETVER >= 20181121 +packetLen(0x0add, 24) // ZC_ITEM_FALL_ENTRY +#elif PACKETVER >= 20180103 packetLen(0x0add, 22) // ZC_ITEM_FALL_ENTRY +#endif // Packet: 0x0ade packetLen(0x0ade, 6) // ZC_OVERWEIGHT_PERCENT @@ -5375,7 +5661,9 @@ packetLen(0x0b04, 80) #endif // Packet: 0x0b05 -#if PACKETVER >= 20180829 +#if PACKETVER >= 20181121 +packetLen(0x0b05, 63) // ZC_OFFLINE_STORE_VISIBLE +#elif PACKETVER >= 20180829 packetLen(0x0b05, 59) // ZC_OFFLINE_STORE_VISIBLE #endif @@ -5439,12 +5727,12 @@ packetLen(0x0b0f, -1) // Packet: 0x0b10 #if PACKETVER >= 20181002 -packetLen(0x0b10, 10) +packetLen(0x0b10, 10) // CZ_START_USE_SKILL #endif // Packet: 0x0b11 #if PACKETVER >= 20181002 -packetLen(0x0b11, 4) +packetLen(0x0b11, 4) // CZ_STOP_USE_SKILL #endif // Packet: 0x0b12 @@ -5453,7 +5741,9 @@ packetLen(0x0b12, 2) #endif // Packet: 0x0b13 -#if PACKETVER >= 20181017 +#if PACKETVER >= 20181121 +packetLen(0x0b13, 48) // ZC_ITEM_PREVIEW +#elif PACKETVER >= 20181017 packetLen(0x0b13, 40) // ZC_ITEM_PREVIEW #endif @@ -5487,5 +5777,10 @@ packetLen(0x0b18, 4) packetLen(0x0b19, 2) #endif +// Packet: 0x0b1a +#if PACKETVER >= 20181212 +packetLen(0x0b1a, 29) +#endif + #endif /* COMMON_PACKETS2018_LEN_MAIN_H */ diff --git a/src/common/packets/packets2018_len_re.h b/src/common/packets/packets2018_len_re.h index d0db982ae..816dee241 100644 --- a/src/common/packets/packets2018_len_re.h +++ b/src/common/packets/packets2018_len_re.h @@ -5319,7 +5319,7 @@ packetLen(0x0ace, 4) packetLen(0x0acf, 68) // CA_LOGIN_OTP // Packet: 0x0ad0 -packetLen(0x0ad0, 11) +packetLen(0x0ad0, 11) // CA_OTP_CODE // Packet: 0x0ad1 packetLen(0x0ad1, -1) @@ -5613,12 +5613,12 @@ packetLen(0x0b0f, -1) // Packet: 0x0b10 #if PACKETVER >= 20181002 -packetLen(0x0b10, 10) +packetLen(0x0b10, 10) // CZ_START_USE_SKILL #endif // Packet: 0x0b11 #if PACKETVER >= 20181002 -packetLen(0x0b11, 4) +packetLen(0x0b11, 4) // CZ_STOP_USE_SKILL #endif // Packet: 0x0b12 @@ -5661,5 +5661,10 @@ packetLen(0x0b18, 4) packetLen(0x0b19, 2) #endif +// Packet: 0x0b1a +#if PACKETVER >= 20181212 +packetLen(0x0b1a, 29) +#endif + #endif /* COMMON_PACKETS2018_LEN_RE_H */ diff --git a/src/common/packets/packets2018_len_zero.h b/src/common/packets/packets2018_len_zero.h index 71a1ee51b..61b174600 100644 --- a/src/common/packets/packets2018_len_zero.h +++ b/src/common/packets/packets2018_len_zero.h @@ -5605,7 +5605,7 @@ packetLen(0x0ace, 4) packetLen(0x0acf, 68) // CA_LOGIN_OTP // Packet: 0x0ad0 -packetLen(0x0ad0, 11) +packetLen(0x0ad0, 11) // CA_OTP_CODE // Packet: 0x0ad1 packetLen(0x0ad1, -1) @@ -5899,12 +5899,12 @@ packetLen(0x0b0f, -1) // Packet: 0x0b10 #if PACKETVER >= 20181010 -packetLen(0x0b10, 10) +packetLen(0x0b10, 10) // CZ_START_USE_SKILL #endif // Packet: 0x0b11 #if PACKETVER >= 20181010 -packetLen(0x0b11, 4) +packetLen(0x0b11, 4) // CZ_STOP_USE_SKILL #endif // Packet: 0x0b12 @@ -5949,5 +5949,10 @@ packetLen(0x0b18, 4) packetLen(0x0b19, 2) #endif +// Packet: 0x0b1a +#if PACKETVER >= 20181212 +packetLen(0x0b1a, 29) +#endif + #endif /* COMMON_PACKETS2018_LEN_ZERO_H */ -- 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') 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') 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') 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') 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 1f7f90156632811bcf7f0102325ba504428bc44a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Nov 2018 03:27:40 +0300 Subject: Update packet AC_LOGIN_OTP. --- src/common/packetsstatic_len.h | 3 +++ src/login/login.c | 43 ++++++++++++++++-------------------------- src/login/packets_ac_struct.h | 31 ++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/common/packetsstatic_len.h b/src/common/packetsstatic_len.h index 31a3988e8..730516c27 100644 --- a/src/common/packetsstatic_len.h +++ b/src/common/packetsstatic_len.h @@ -29,6 +29,9 @@ (size_t)PACKET_LEN_##id, "Wrong size PACKET_"#name); \ enum { HEADER_##name = id }; +#define DEFINE_PACKET_ID(name, id) \ + enum { HEADER_##name = id }; + #define packetLen(id, len) PACKET_LEN_##id = (len), enum packet_lengths { #include "common/packets_len.h" diff --git a/src/login/login.c b/src/login/login.c index 67abd45af..4c40677fa 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1370,36 +1370,25 @@ static bool login_client_login(int fd, struct login_session_data *sd) static bool login_client_login_otp(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); static bool login_client_login_otp(int fd, struct login_session_data *sd) { +#if PACKETVER_MAIN_NUM >= 20170621 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO) // send ok response with fake token -#ifdef PACKETVER_ZERO -#if PACKETVER >= 20171127 - WFIFOHEAD(fd, 33); - WFIFOW(fd, 0) = 0x0ae3; - WFIFOW(fd, 2) = 33; // len - WFIFOL(fd, 4) = 0; // normal login - safestrncpy(WFIFOP(fd, 8), "S1000", 6); - safestrncpy(WFIFOP(fd, 28), "token", 6); - WFIFOSET(fd, 33); -#elif PACKETVER >= 20171123 - WFIFOHEAD(fd, 19); - WFIFOW(fd, 0) = 0x0ae3; - WFIFOW(fd, 2) = 19; // len - WFIFOL(fd, 4) = 0; // normal login - safestrncpy(WFIFOP(fd, 8), "S1000", 6); - safestrncpy(WFIFOP(fd, 14), "token", 6); - WFIFOSET(fd, 19); -#else - WFIFOHEAD(fd, 13); - WFIFOW(fd, 0) = 0x0ad1; - WFIFOW(fd, 2) = 13; // len - WFIFOL(fd, 4) = 0; // normal login - safestrncpy(WFIFOP(fd, 8), "token", 6); - WFIFOSET(fd, 13); -#endif + const int len = sizeof(struct PACKET_AC_LOGIN_OTP) + 6; // + "token" string + WFIFOHEAD(fd, len); + struct PACKET_AC_LOGIN_OTP *packet = WP2PTR(sd->fd); + memset(packet, 0, len); + packet->packet_id = HEADER_AC_LOGIN_OTP; + packet->packet_len = len; + packet->loginFlag = 0; // normal login +#if PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171123 + safestrncpy(packet->loginFlag2, "S1000", 6); +#endif // PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171123 + + safestrncpy(packet->token, "token", 6); + WFIFOSET(fd, len); return true; -#else // PACKETVER_ZERO +#else // PACKETVER_MAIN_NUM >= 20170621 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO) return false; -#endif // PACKETVER_ZERO +#endif // PACKETVER_MAIN_NUM >= 20170621 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO) } static void login_client_login_mobile_otp_request(int fd, struct login_session_data *sd) __attribute__((nonnull (2))); diff --git a/src/login/packets_ac_struct.h b/src/login/packets_ac_struct.h index 6ec92b38f..c9fb04f26 100644 --- a/src/login/packets_ac_struct.h +++ b/src/login/packets_ac_struct.h @@ -118,6 +118,37 @@ struct PACKET_AC_REQ_MOBILE_OTP { DEFINE_PACKET_HEADER(AC_REQ_MOBILE_OTP, 0x09a2); #endif +#if PACKETVER_MAIN_NUM >= 20171213 || PACKETVER_RE_NUM >= 20171213 || PACKETVER_ZERO_NUM >= 20171808 +// AC_LOGIN_OTP2 +struct PACKET_AC_LOGIN_OTP { + int16 packet_id; + int16 packet_len; + int32 loginFlag; + char loginFlag2[20]; + char token[]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(AC_LOGIN_OTP, 0x0ae3); +#elif PACKETVER_ZERO_NUM >= 20171123 +// AC_LOGIN_OTP2 +struct PACKET_AC_LOGIN_OTP { + int16 packet_id; + int16 packet_len; + int32 loginFlag; + char loginFlag2[6]; + char token[]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(AC_LOGIN_OTP, 0x0ae3); +#elif PACKETVER_MAIN_NUM >= 20170621 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO) +// AC_LOGIN_OTP1 +struct PACKET_AC_LOGIN_OTP { + int16 packet_id; + int16 packet_len; + int32 loginFlag; + char token[]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(AC_LOGIN_OTP, 0x0ad1); +#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 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 8303cb08c04564feb16993be4491c4904bd5b071 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 28 Nov 2018 20:54:24 +0300 Subject: Update HPM --- src/common/HPMDataCheck.h | 41 ++++++++------- src/plugins/HPMHooking/HPMHooking.Defs.inc | 8 ++- .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 8 +++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 2 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 59 ++++++++++++++++++++-- 5 files changed, 96 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index e24ec04b8..0e9be9b60 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -344,21 +344,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #define LOGIN_LCLIF_H #endif // LOGIN_LCLIF_H #ifdef LOGIN_LCLIF_P_H - { "PACKET_AC_ACCEPT_LOGIN", sizeof(struct PACKET_AC_ACCEPT_LOGIN), SERVER_TYPE_LOGIN }, - { "PACKET_AC_REFUSE_LOGIN", sizeof(struct PACKET_AC_REFUSE_LOGIN), SERVER_TYPE_LOGIN }, - { "PACKET_AC_REFUSE_LOGIN_R2", sizeof(struct PACKET_AC_REFUSE_LOGIN_R2), SERVER_TYPE_LOGIN }, - { "PACKET_CA_CHARSERVERCONNECT", sizeof(struct PACKET_CA_CHARSERVERCONNECT), SERVER_TYPE_LOGIN }, - { "PACKET_CA_CONNECT_INFO_CHANGED", sizeof(struct PACKET_CA_CONNECT_INFO_CHANGED), SERVER_TYPE_LOGIN }, - { "PACKET_CA_EXE_HASHCHECK", sizeof(struct PACKET_CA_EXE_HASHCHECK), SERVER_TYPE_LOGIN }, - { "PACKET_CA_LOGIN", sizeof(struct PACKET_CA_LOGIN), SERVER_TYPE_LOGIN }, - { "PACKET_CA_LOGIN2", sizeof(struct PACKET_CA_LOGIN2), SERVER_TYPE_LOGIN }, - { "PACKET_CA_LOGIN3", sizeof(struct PACKET_CA_LOGIN3), SERVER_TYPE_LOGIN }, - { "PACKET_CA_LOGIN4", sizeof(struct PACKET_CA_LOGIN4), SERVER_TYPE_LOGIN }, - { "PACKET_CA_LOGIN_HAN", sizeof(struct PACKET_CA_LOGIN_HAN), SERVER_TYPE_LOGIN }, - { "PACKET_CA_LOGIN_OTP", sizeof(struct PACKET_CA_LOGIN_OTP), SERVER_TYPE_LOGIN }, - { "PACKET_CA_LOGIN_PCBANG", sizeof(struct PACKET_CA_LOGIN_PCBANG), SERVER_TYPE_LOGIN }, - { "PACKET_CA_SSO_LOGIN_REQ", sizeof(struct PACKET_CA_SSO_LOGIN_REQ), SERVER_TYPE_LOGIN }, - { "PACKET_SC_NOTIFY_BAN", sizeof(struct PACKET_SC_NOTIFY_BAN), SERVER_TYPE_LOGIN }, { "lclif_interface_dbs", sizeof(struct lclif_interface_dbs), SERVER_TYPE_LOGIN }, { "lclif_interface_private", sizeof(struct lclif_interface_private), SERVER_TYPE_LOGIN }, #else @@ -383,6 +368,29 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define LOGIN_LOGIN_H #endif // LOGIN_LOGIN_H + #ifdef LOGIN_PACKETS_AC_STRUCT_H + { "PACKET_AC_ACCEPT_LOGIN", sizeof(struct PACKET_AC_ACCEPT_LOGIN), SERVER_TYPE_LOGIN }, + { "PACKET_AC_REFUSE_LOGIN", sizeof(struct PACKET_AC_REFUSE_LOGIN), SERVER_TYPE_LOGIN }, + { "PACKET_AC_REFUSE_LOGIN_R2", sizeof(struct PACKET_AC_REFUSE_LOGIN_R2), SERVER_TYPE_LOGIN }, + { "PACKET_SC_NOTIFY_BAN", sizeof(struct PACKET_SC_NOTIFY_BAN), SERVER_TYPE_LOGIN }, + #else + #define LOGIN_PACKETS_AC_STRUCT_H + #endif // LOGIN_PACKETS_AC_STRUCT_H + #ifdef LOGIN_PACKETS_CA_STRUCT_H + { "PACKET_CA_CHARSERVERCONNECT", sizeof(struct PACKET_CA_CHARSERVERCONNECT), SERVER_TYPE_LOGIN }, + { "PACKET_CA_CONNECT_INFO_CHANGED", sizeof(struct PACKET_CA_CONNECT_INFO_CHANGED), SERVER_TYPE_LOGIN }, + { "PACKET_CA_EXE_HASHCHECK", sizeof(struct PACKET_CA_EXE_HASHCHECK), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN", sizeof(struct PACKET_CA_LOGIN), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN2", sizeof(struct PACKET_CA_LOGIN2), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN3", sizeof(struct PACKET_CA_LOGIN3), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN4", sizeof(struct PACKET_CA_LOGIN4), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN_HAN", sizeof(struct PACKET_CA_LOGIN_HAN), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN_OTP", sizeof(struct PACKET_CA_LOGIN_OTP), SERVER_TYPE_LOGIN }, + { "PACKET_CA_LOGIN_PCBANG", sizeof(struct PACKET_CA_LOGIN_PCBANG), SERVER_TYPE_LOGIN }, + { "PACKET_CA_SSO_LOGIN_REQ", sizeof(struct PACKET_CA_SSO_LOGIN_REQ), SERVER_TYPE_LOGIN }, + #else + #define LOGIN_PACKETS_CA_STRUCT_H + #endif // LOGIN_PACKETS_CA_STRUCT_H #ifdef MAP_ACHIEVEMENT_H { "achievement_data", sizeof(struct achievement_data), SERVER_TYPE_MAP }, { "achievement_interface", sizeof(struct achievement_interface), SERVER_TYPE_MAP }, @@ -665,8 +673,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_ADD_ITEM_TO_MAIL", sizeof(struct PACKET_ZC_ADD_ITEM_TO_MAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_ADD_ITEM_TO_STORE", sizeof(struct PACKET_ZC_ADD_ITEM_TO_STORE), SERVER_TYPE_MAP }, { "PACKET_ZC_ADD_MEMBER_TO_GROUP", sizeof(struct PACKET_ZC_ADD_MEMBER_TO_GROUP), SERVER_TYPE_MAP }, - { "PACKET_ZC_AUTOSPELLLIST1", sizeof(struct PACKET_ZC_AUTOSPELLLIST1), SERVER_TYPE_MAP }, - { "PACKET_ZC_AUTOSPELLLIST2", sizeof(struct PACKET_ZC_AUTOSPELLLIST2), SERVER_TYPE_MAP }, + { "PACKET_ZC_AUTOSPELLLIST", sizeof(struct PACKET_ZC_AUTOSPELLLIST), SERVER_TYPE_MAP }, { "PACKET_ZC_CAMERA_INFO", sizeof(struct PACKET_ZC_CAMERA_INFO), SERVER_TYPE_MAP }, { "PACKET_ZC_CASH_ITEM_DELETE", sizeof(struct PACKET_ZC_CASH_ITEM_DELETE), SERVER_TYPE_MAP }, { "PACKET_ZC_CASH_TIME_COUNTER", sizeof(struct PACKET_ZC_CASH_TIME_COUNTER), SERVER_TYPE_MAP }, diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index eb81ed693..9b913331a 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -1572,6 +1572,8 @@ typedef void (*HPMHOOK_pre_clif_messagecolor_self) (int *fd, uint32 *color, cons typedef void (*HPMHOOK_post_clif_messagecolor_self) (int fd, uint32 color, const char *msg); typedef void (*HPMHOOK_pre_clif_messagecolor) (struct block_list **bl, uint32 *color, const char **msg); typedef void (*HPMHOOK_post_clif_messagecolor) (struct block_list *bl, uint32 color, const char *msg); +typedef void (*HPMHOOK_pre_clif_serviceMessageColor) (struct map_session_data **sd, uint32 *color, const char **msg); +typedef void (*HPMHOOK_post_clif_serviceMessageColor) (struct map_session_data *sd, uint32 color, const char *msg); typedef void (*HPMHOOK_pre_clif_disp_overhead) (struct block_list **bl, const char **mes, enum send_target *target, struct block_list **target_bl); typedef void (*HPMHOOK_post_clif_disp_overhead) (struct block_list *bl, const char *mes, enum send_target target, struct block_list *target_bl); typedef void (*HPMHOOK_pre_clif_notify_playerchat) (struct block_list **bl, const char **mes); @@ -2006,8 +2008,8 @@ typedef void (*HPMHOOK_pre_clif_npc_market_purchase_ack) (struct map_session_dat typedef void (*HPMHOOK_post_clif_npc_market_purchase_ack) (struct map_session_data *sd, const struct itemlist *item_list, unsigned char response); typedef bool (*HPMHOOK_pre_clif_parse_roulette_db) (void); typedef bool (*HPMHOOK_post_clif_parse_roulette_db) (bool retVal___); -typedef void (*HPMHOOK_pre_clif_roulette_generate_ack) (struct map_session_data **sd, unsigned char *result, short *stage, short *prizeIdx, int *bonusItemID); -typedef void (*HPMHOOK_post_clif_roulette_generate_ack) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID); +typedef void (*HPMHOOK_pre_clif_roulette_generate_ack) (struct map_session_data **sd, enum GENERATE_ROULETTE_ACK *result, short *stage, short *prizeIdx, int *bonusItemID); +typedef void (*HPMHOOK_post_clif_roulette_generate_ack) (struct map_session_data *sd, enum GENERATE_ROULETTE_ACK result, short stage, short prizeIdx, int bonusItemID); typedef void (*HPMHOOK_pre_clif_openmergeitem) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_openmergeitem) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_cancelmergeitem) (int *fd, struct map_session_data **sd); @@ -2632,6 +2634,8 @@ typedef void (*HPMHOOK_pre_clif_camera_change) (struct map_session_data **sd, fl typedef void (*HPMHOOK_post_clif_camera_change) (struct map_session_data *sd, float range, float rotation, float latitude, enum send_target target); typedef void (*HPMHOOK_pre_clif_item_preview) (struct map_session_data **sd, int *n); typedef void (*HPMHOOK_post_clif_item_preview) (struct map_session_data *sd, int n); +typedef bool (*HPMHOOK_pre_clif_enchant_equipment) (struct map_session_data **sd, enum equip_pos *pos, int *cardSlot, int *cardId); +typedef bool (*HPMHOOK_post_clif_enchant_equipment) (bool retVal___, struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId); #endif // MAP_CLIF_H #ifdef COMMON_CORE_H /* cmdline */ typedef void (*HPMHOOK_pre_cmdline_init) (void); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 4b0054b28..1a45e836c 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -1164,6 +1164,8 @@ struct { struct HPMHookPoint *HP_clif_messagecolor_self_post; struct HPMHookPoint *HP_clif_messagecolor_pre; struct HPMHookPoint *HP_clif_messagecolor_post; + struct HPMHookPoint *HP_clif_serviceMessageColor_pre; + struct HPMHookPoint *HP_clif_serviceMessageColor_post; struct HPMHookPoint *HP_clif_disp_overhead_pre; struct HPMHookPoint *HP_clif_disp_overhead_post; struct HPMHookPoint *HP_clif_notify_playerchat_pre; @@ -2224,6 +2226,8 @@ struct { struct HPMHookPoint *HP_clif_camera_change_post; struct HPMHookPoint *HP_clif_item_preview_pre; struct HPMHookPoint *HP_clif_item_preview_post; + struct HPMHookPoint *HP_clif_enchant_equipment_pre; + struct HPMHookPoint *HP_clif_enchant_equipment_post; struct HPMHookPoint *HP_cmdline_init_pre; struct HPMHookPoint *HP_cmdline_init_post; struct HPMHookPoint *HP_cmdline_final_pre; @@ -7785,6 +7789,8 @@ struct { int HP_clif_messagecolor_self_post; int HP_clif_messagecolor_pre; int HP_clif_messagecolor_post; + int HP_clif_serviceMessageColor_pre; + int HP_clif_serviceMessageColor_post; int HP_clif_disp_overhead_pre; int HP_clif_disp_overhead_post; int HP_clif_notify_playerchat_pre; @@ -8845,6 +8851,8 @@ struct { int HP_clif_camera_change_post; int HP_clif_item_preview_pre; int HP_clif_item_preview_post; + int HP_clif_enchant_equipment_pre; + int HP_clif_enchant_equipment_post; int HP_cmdline_init_pre; int HP_cmdline_init_post; int HP_cmdline_final_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index a900af716..2e7b73cf7 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -606,6 +606,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->broadcast2, HP_clif_broadcast2) }, { HP_POP(clif->messagecolor_self, HP_clif_messagecolor_self) }, { HP_POP(clif->messagecolor, HP_clif_messagecolor) }, + { HP_POP(clif->serviceMessageColor, HP_clif_serviceMessageColor) }, { HP_POP(clif->disp_overhead, HP_clif_disp_overhead) }, { HP_POP(clif->notify_playerchat, HP_clif_notify_playerchat) }, { HP_POP(clif->msgtable, HP_clif_msgtable) }, @@ -1136,6 +1137,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->camera_showWindow, HP_clif_camera_showWindow) }, { HP_POP(clif->camera_change, HP_clif_camera_change) }, { HP_POP(clif->item_preview, HP_clif_item_preview) }, + { HP_POP(clif->enchant_equipment, HP_clif_enchant_equipment) }, /* cmdline_interface */ { HP_POP(cmdline->init, HP_cmdline_init) }, { HP_POP(cmdline->final, HP_cmdline_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index af1f11fe2..2306d72aa 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -15184,6 +15184,32 @@ void HP_clif_messagecolor(struct block_list *bl, uint32 color, const char *msg) } return; } +void HP_clif_serviceMessageColor(struct map_session_data *sd, uint32 color, const char *msg) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_serviceMessageColor_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, uint32 *color, const char **msg); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_serviceMessageColor_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_serviceMessageColor_pre[hIndex].func; + preHookFunc(&sd, &color, &msg); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.serviceMessageColor(sd, color, msg); + } + if (HPMHooks.count.HP_clif_serviceMessageColor_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, uint32 color, const char *msg); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_serviceMessageColor_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_serviceMessageColor_post[hIndex].func; + postHookFunc(sd, color, msg); + } + } + return; +} void HP_clif_disp_overhead(struct block_list *bl, const char *mes, enum send_target target, struct block_list *target_bl) { int hIndex = 0; if (HPMHooks.count.HP_clif_disp_overhead_pre > 0) { @@ -20841,10 +20867,10 @@ bool HP_clif_parse_roulette_db(void) { } return retVal___; } -void HP_clif_roulette_generate_ack(struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID) { +void HP_clif_roulette_generate_ack(struct map_session_data *sd, enum GENERATE_ROULETTE_ACK result, short stage, short prizeIdx, int bonusItemID) { int hIndex = 0; if (HPMHooks.count.HP_clif_roulette_generate_ack_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, unsigned char *result, short *stage, short *prizeIdx, int *bonusItemID); + void (*preHookFunc) (struct map_session_data **sd, enum GENERATE_ROULETTE_ACK *result, short *stage, short *prizeIdx, int *bonusItemID); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_roulette_generate_ack_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_roulette_generate_ack_pre[hIndex].func; @@ -20859,7 +20885,7 @@ void HP_clif_roulette_generate_ack(struct map_session_data *sd, unsigned char re HPMHooks.source.clif.roulette_generate_ack(sd, result, stage, prizeIdx, bonusItemID); } if (HPMHooks.count.HP_clif_roulette_generate_ack_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, int bonusItemID); + void (*postHookFunc) (struct map_session_data *sd, enum GENERATE_ROULETTE_ACK result, short stage, short prizeIdx, int bonusItemID); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_roulette_generate_ack_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_roulette_generate_ack_post[hIndex].func; postHookFunc(sd, result, stage, prizeIdx, bonusItemID); @@ -28991,6 +29017,33 @@ void HP_clif_item_preview(struct map_session_data *sd, int n) { } return; } +bool HP_clif_enchant_equipment(struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_clif_enchant_equipment_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, enum equip_pos *pos, int *cardSlot, int *cardId); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_enchant_equipment_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_enchant_equipment_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &pos, &cardSlot, &cardId); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.clif.enchant_equipment(sd, pos, cardSlot, cardId); + } + if (HPMHooks.count.HP_clif_enchant_equipment_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_enchant_equipment_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_enchant_equipment_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, pos, cardSlot, cardId); + } + } + return retVal___; +} /* cmdline_interface */ void HP_cmdline_init(void) { int hIndex = 0; -- 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') 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 9a454fc1d03e7c3e1a39745742626e6f13b31378 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 30 Nov 2018 19:51:42 +0300 Subject: Fix issue with chars list if number of chars is 3*N chars. Also introduced header file with HC packet structs. --- src/char/Makefile.in | 2 +- src/char/char.c | 53 +++++++++++++++++++++++++++++--------------- src/char/char.h | 4 ++-- src/char/packets_hc_struct.h | 45 +++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 21 deletions(-) create mode 100644 src/char/packets_hc_struct.h (limited to 'src') diff --git a/src/char/Makefile.in b/src/char/Makefile.in index 95c8df813..f159a443f 100644 --- a/src/char/Makefile.in +++ b/src/char/Makefile.in @@ -46,7 +46,7 @@ CHAR_C = char.c HPMchar.c loginif.c mapif.c geoip.c inter.c int_achievement.c in CHAR_OBJ = $(addprefix obj_sql/, $(patsubst %.c,%.o,$(CHAR_C))) CHAR_H = char.h HPMchar.h loginif.h mapif.h geoip.h inter.h int_achievement.h int_auction.h int_clan.h int_elemental.h \ int_guild.h int_homun.h int_mail.h int_mercenary.h int_party.h int_pet.h \ - int_quest.h int_rodex.h int_storage.h pincode.h + int_quest.h int_rodex.h int_storage.h pincode.h packets_hc_struct.h CHAR_PH = HAVE_MYSQL=@HAVE_MYSQL@ diff --git a/src/char/char.c b/src/char/char.c index 023ab0ade..e08933f7b 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -41,6 +41,7 @@ #include "char/inter.h" #include "char/loginif.h" #include "char/mapif.h" +#include "char/packets_hc_struct.h" #include "char/pincode.h" #include "common/HPM.h" @@ -1051,7 +1052,7 @@ static int char_mmo_gender(const struct char_session_data *sd, const struct mmo_ //===================================================================================================== // Loads the basic character rooster for the given account. Returns total buffer used. -static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) +static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf, int *count) { struct SqlStmt *stmt; struct mmo_charstatus p; @@ -1060,6 +1061,9 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) time_t unban_time = 0; char sex[2]; + if (count) + *count = 0; + nullpo_ret(sd); nullpo_ret(buf); @@ -1131,7 +1135,8 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) return 0; } - for( i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->StmtNextRow(stmt); i++ ) { + int tmpCount = 0; + for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->StmtNextRow(stmt); i++) { if (p.slot >= MAX_CHARS) continue; p.last_point.map = mapindex->name2id(last_map); @@ -1139,11 +1144,14 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) sd->unban_time[p.slot] = unban_time; p.sex = chr->mmo_gender(sd, &p, sex[0]); j += chr->mmo_char_tobuf(WBUFP(buf, j), &p); + tmpCount ++; } - memset(sd->new_name,0,sizeof(sd->new_name)); + memset(sd->new_name, 0, sizeof(sd->new_name)); SQL->StmtFree(stmt); + if (count) + *count = tmpCount; return j; } @@ -2099,14 +2107,23 @@ static int char_mmo_char_tobuf(uint8 *buffer, struct mmo_charstatus *p) } /* Made Possible by Yommy~! <3 */ -static void char_mmo_char_send099d(int fd, struct char_session_data *sd) -{ -// support added for client between 20121010 and 20130320 -#if PACKETVER > 20120418 - WFIFOHEAD(fd,4 + (MAX_CHARS*MAX_CHAR_BUF)); - WFIFOW(fd,0) = 0x99d; - WFIFOW(fd,2) = chr->mmo_chars_fromsql(sd, WFIFOP(fd,4)) + 4; - WFIFOSET(fd,WFIFOW(fd,2)); +static void char_send_HC_ACK_CHARINFO_PER_PAGE(int fd, struct char_session_data *sd) +{ +#if PACKETVER_MAIN_NUM >= 20130522 || PACKETVER_RE_NUM >= 20130327 || defined(PACKETVER_ZERO) + WFIFOHEAD(fd, sizeof(struct PACKET_HC_ACK_CHARINFO_PER_PAGE) + (MAX_CHARS * MAX_CHAR_BUF)); + struct PACKET_HC_ACK_CHARINFO_PER_PAGE *p = WFIFOP(fd, 0); + int count = 0; + p->packetId = HEADER_HC_ACK_CHARINFO_PER_PAGE; + p->packetLen = chr->mmo_chars_fromsql(sd, WFIFOP(fd, 4), &count) + sizeof(struct PACKET_HC_ACK_CHARINFO_PER_PAGE); + WFIFOSET(fd, p->packetLen); + // send empty packet if chars count is 3*N, for trigger final code in client + if (count % 3 != 0) { + WFIFOHEAD(fd, sizeof(struct PACKET_HC_ACK_CHARINFO_PER_PAGE)); + p = WFIFOP(fd, 0); + p->packetId = HEADER_HC_ACK_CHARINFO_PER_PAGE; + p->packetLen = sizeof(struct PACKET_HC_ACK_CHARINFO_PER_PAGE); + WFIFOSET(fd, p->packetLen); + } #endif } @@ -2192,7 +2209,7 @@ static int char_mmo_char_send_characters(int fd, struct char_session_data *sd) WFIFOB(fd,6) = MAX_CHARS; // Premium slots. AKA any existent chars past sd->char_slots but within MAX_CHARS will show a 'Premium Service' in red #endif memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes - j+=chr->mmo_chars_fromsql(sd, WFIFOP(fd,j)); + j += chr->mmo_chars_fromsql(sd, WFIFOP(fd, j), NULL); WFIFOW(fd,2) = j; // packet len WFIFOSET(fd,j); @@ -4173,10 +4190,10 @@ static void char_delete2_accept_actual_ack(int fd, int char_id, uint32 result) /// Any (0x718): An unknown error has occurred. static void char_delete2_accept_ack(int fd, int char_id, uint32 result) {// HC: <082a>.W .L .L -#if PACKETVER >= 20130000 /* not sure the exact date -- must refresh or client gets stuck */ +#if PACKETVER_MAIN_NUM >= 20130522 || PACKETVER_RE_NUM >= 20130327 || defined(PACKETVER_ZERO) if( result == 1 ) { struct char_session_data* sd = (struct char_session_data*)sockt->session[fd]->session_data; - chr->mmo_char_send099d(fd, sd); + chr->send_HC_ACK_CHARINFO_PER_PAGE(fd, sd); } #endif chr->delete2_accept_actual_ack(fd, char_id, result); @@ -5009,7 +5026,7 @@ static void char_parse_char_pincode_first_pin(int fd, struct char_session_data * static void char_parse_char_request_chars(int fd, struct char_session_data *sd) { - chr->mmo_char_send099d(fd, sd); + chr->send_HC_ACK_CHARINFO_PER_PAGE(fd, sd); RFIFOSKIP(fd,2); } @@ -5029,8 +5046,8 @@ static void char_parse_char_move_character(int fd, struct char_session_data *sd) chr->change_character_slot_ack(fd, ret); /* for some stupid reason it requires the char data again (gravity -_-) */ if( ret ) -#if PACKETVER >= 20130000 - chr->mmo_char_send099d(fd, sd); +#if PACKETVER_MAIN_NUM >= 20130522 || PACKETVER_RE_NUM >= 20130327 || defined(PACKETVER_ZERO) + chr->send_HC_ACK_CHARINFO_PER_PAGE(fd, sd); #else chr->mmo_char_send_characters(fd, sd); #endif @@ -6427,7 +6444,7 @@ void char_defaults(void) chr->divorce_char_sql = char_divorce_char_sql; chr->count_users = char_count_users; chr->mmo_char_tobuf = char_mmo_char_tobuf; - chr->mmo_char_send099d = char_mmo_char_send099d; + chr->send_HC_ACK_CHARINFO_PER_PAGE = char_send_HC_ACK_CHARINFO_PER_PAGE; chr->mmo_char_send_ban_list = char_mmo_char_send_ban_list; chr->mmo_char_send_slots_info = char_mmo_char_send_slots_info; chr->mmo_char_send_characters = char_mmo_char_send_characters; diff --git a/src/char/char.h b/src/char/char.h index 81cab1eaf..914530537 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -142,7 +142,7 @@ struct char_interface { int (*getitemdata_from_sql) (struct item *items, int max, int guid, enum inventory_table_type table); int (*memitemdata_to_sql) (const struct item items[], int id, enum inventory_table_type table); int (*mmo_gender) (const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); - int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf); + int (*mmo_chars_fromsql) (struct char_session_data* sd, uint8* buf, int *count); int (*mmo_char_fromsql) (int char_id, struct mmo_charstatus* p, bool load_everything); int (*mmo_char_sql_init) (void); bool (*char_slotchange) (struct char_session_data *sd, int fd, unsigned short from, unsigned short to); @@ -153,7 +153,7 @@ struct char_interface { int (*divorce_char_sql) (int partner_id1, int partner_id2); int (*count_users) (void); int (*mmo_char_tobuf) (uint8* buffer, struct mmo_charstatus* p); - void (*mmo_char_send099d) (int fd, struct char_session_data *sd); + void (*send_HC_ACK_CHARINFO_PER_PAGE) (int fd, struct char_session_data *sd); void (*mmo_char_send_ban_list) (int fd, struct char_session_data *sd); void (*mmo_char_send_slots_info) (int fd, struct char_session_data* sd); int (*mmo_char_send_characters) (int fd, struct char_session_data* sd); diff --git a/src/char/packets_hc_struct.h b/src/char/packets_hc_struct.h new file mode 100644 index 000000000..196493cac --- /dev/null +++ b/src/char/packets_hc_struct.h @@ -0,0 +1,45 @@ +/** + * This file is part of Hercules. + * http://herc.ws - http://github.com/HerculesWS/Hercules + * + * Copyright (C) 2016-2018 Hercules Dev Team + * + * 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 . + */ +#ifndef CHAR_PACKETS_HC_STRUCT_H +#define CHAR_PACKETS_HC_STRUCT_H + +#include "common/hercules.h" +#include "common/mmo.h" +#include "common/packetsstatic_len.h" + +/* Packets Structs */ +#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute +#pragma pack(push, 1) +#endif // not NetBSD < 6 / Solaris + +#if PACKETVER_MAIN_NUM >= 20130522 || PACKETVER_RE_NUM >= 20130327 || defined(PACKETVER_ZERO) +struct PACKET_HC_ACK_CHARINFO_PER_PAGE { + int16 packetId; + int16 packetLen; + // chars list[] +} __attribute__((packed)); +DEFINE_PACKET_HEADER(HC_ACK_CHARINFO_PER_PAGE, 0x099d); +#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 + +#endif // CHAR_PACKETS_HC_STRUCT_H -- cgit v1.2.3-70-g09d2 From 14b5d3012cd46391ff6e3eca1cdb0009a9004f49 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 28 Nov 2018 22:08:52 +0300 Subject: Update HPM --- src/common/HPMDataCheck.h | 5 ++ src/plugins/HPMHooking/HPMHooking.Defs.inc | 48 ++++++++--------- .../HPMHooking/HPMHooking_char.HPMHooksCore.inc | 8 +-- .../HPMHooking/HPMHooking_char.HookingPoints.inc | 2 +- src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 28 +++++----- src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 60 +++++++++++----------- 6 files changed, 78 insertions(+), 73 deletions(-) (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 0e9be9b60..4bf396250 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -132,6 +132,11 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define CHAR_MAPIF_H #endif // CHAR_MAPIF_H + #ifdef CHAR_PACKETS_HC_STRUCT_H + { "PACKET_HC_ACK_CHARINFO_PER_PAGE", sizeof(struct PACKET_HC_ACK_CHARINFO_PER_PAGE), SERVER_TYPE_CHAR }, + #else + #define CHAR_PACKETS_HC_STRUCT_H + #endif // CHAR_PACKETS_HC_STRUCT_H #ifdef CHAR_PINCODE_H { "pincode_interface", sizeof(struct pincode_interface), SERVER_TYPE_CHAR }, #else diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 9b913331a..92a59475b 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -538,8 +538,8 @@ typedef int (*HPMHOOK_pre_chr_memitemdata_to_sql) (const struct item *items[], i typedef int (*HPMHOOK_post_chr_memitemdata_to_sql) (int retVal___, const struct item items[], int id, enum inventory_table_type table); typedef int (*HPMHOOK_pre_chr_mmo_gender) (const struct char_session_data **sd, const struct mmo_charstatus **p, char *sex); typedef int (*HPMHOOK_post_chr_mmo_gender) (int retVal___, const struct char_session_data *sd, const struct mmo_charstatus *p, char sex); -typedef int (*HPMHOOK_pre_chr_mmo_chars_fromsql) (struct char_session_data **sd, uint8 **buf); -typedef int (*HPMHOOK_post_chr_mmo_chars_fromsql) (int retVal___, struct char_session_data *sd, uint8 *buf); +typedef int (*HPMHOOK_pre_chr_mmo_chars_fromsql) (struct char_session_data **sd, uint8 **buf, int **count); +typedef int (*HPMHOOK_post_chr_mmo_chars_fromsql) (int retVal___, struct char_session_data *sd, uint8 *buf, int *count); typedef int (*HPMHOOK_pre_chr_mmo_char_fromsql) (int *char_id, struct mmo_charstatus **p, bool *load_everything); typedef int (*HPMHOOK_post_chr_mmo_char_fromsql) (int retVal___, int char_id, struct mmo_charstatus *p, bool load_everything); typedef int (*HPMHOOK_pre_chr_mmo_char_sql_init) (void); @@ -560,8 +560,8 @@ typedef int (*HPMHOOK_pre_chr_count_users) (void); typedef int (*HPMHOOK_post_chr_count_users) (int retVal___); typedef int (*HPMHOOK_pre_chr_mmo_char_tobuf) (uint8 **buffer, struct mmo_charstatus **p); typedef int (*HPMHOOK_post_chr_mmo_char_tobuf) (int retVal___, uint8 *buffer, struct mmo_charstatus *p); -typedef void (*HPMHOOK_pre_chr_mmo_char_send099d) (int *fd, struct char_session_data **sd); -typedef void (*HPMHOOK_post_chr_mmo_char_send099d) (int fd, struct char_session_data *sd); +typedef void (*HPMHOOK_pre_chr_send_HC_ACK_CHARINFO_PER_PAGE) (int *fd, struct char_session_data **sd); +typedef void (*HPMHOOK_post_chr_send_HC_ACK_CHARINFO_PER_PAGE) (int fd, struct char_session_data *sd); typedef void (*HPMHOOK_pre_chr_mmo_char_send_ban_list) (int *fd, struct char_session_data **sd); typedef void (*HPMHOOK_post_chr_mmo_char_send_ban_list) (int fd, struct char_session_data *sd); typedef void (*HPMHOOK_pre_chr_mmo_char_send_slots_info) (int *fd, struct char_session_data **sd); @@ -1160,12 +1160,12 @@ typedef void (*HPMHOOK_pre_clif_package_announce) (struct map_session_data **sd, typedef void (*HPMHOOK_post_clif_package_announce) (struct map_session_data *sd, int nameid, int containerid); typedef void (*HPMHOOK_pre_clif_item_drop_announce) (struct map_session_data **sd, int *nameid, char **monsterName); typedef void (*HPMHOOK_post_clif_item_drop_announce) (struct map_session_data *sd, int nameid, char *monsterName); -typedef void (*HPMHOOK_pre_clif_clearunit_single) (int *id, clr_type *type, int *fd); -typedef void (*HPMHOOK_post_clif_clearunit_single) (int id, clr_type type, int fd); -typedef void (*HPMHOOK_pre_clif_clearunit_area) (struct block_list **bl, clr_type *type); -typedef void (*HPMHOOK_post_clif_clearunit_area) (struct block_list *bl, clr_type type); -typedef void (*HPMHOOK_pre_clif_clearunit_delayed) (struct block_list **bl, clr_type *type, int64 *tick); -typedef void (*HPMHOOK_post_clif_clearunit_delayed) (struct block_list *bl, clr_type type, int64 tick); +typedef void (*HPMHOOK_pre_clif_clearunit_single) (int *id, enum clr_type *type, int *fd); +typedef void (*HPMHOOK_post_clif_clearunit_single) (int id, enum clr_type type, int fd); +typedef void (*HPMHOOK_pre_clif_clearunit_area) (struct block_list **bl, enum clr_type *type); +typedef void (*HPMHOOK_post_clif_clearunit_area) (struct block_list *bl, enum clr_type type); +typedef void (*HPMHOOK_pre_clif_clearunit_delayed) (struct block_list **bl, enum clr_type *type, int64 *tick); +typedef void (*HPMHOOK_post_clif_clearunit_delayed) (struct block_list *bl, enum clr_type type, int64 tick); typedef void (*HPMHOOK_pre_clif_walkok) (struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_walkok) (struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_move) (struct unit_data **ud); @@ -5858,8 +5858,8 @@ typedef int (*HPMHOOK_pre_pc_setrestartvalue) (struct map_session_data **sd, int typedef int (*HPMHOOK_post_pc_setrestartvalue) (int retVal___, struct map_session_data *sd, int type); typedef int (*HPMHOOK_pre_pc_makesavestatus) (struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_makesavestatus) (int retVal___, struct map_session_data *sd); -typedef void (*HPMHOOK_pre_pc_respawn) (struct map_session_data **sd, clr_type *clrtype); -typedef void (*HPMHOOK_post_pc_respawn) (struct map_session_data *sd, clr_type clrtype); +typedef void (*HPMHOOK_pre_pc_respawn) (struct map_session_data **sd, enum clr_type *clrtype); +typedef void (*HPMHOOK_post_pc_respawn) (struct map_session_data *sd, enum clr_type clrtype); typedef int (*HPMHOOK_pre_pc_setnewpc) (struct map_session_data **sd, int *account_id, int *char_id, int *login_id1, unsigned int *client_tick, int *sex, int *fd); typedef int (*HPMHOOK_post_pc_setnewpc) (int retVal___, struct map_session_data *sd, int account_id, int char_id, int login_id1, unsigned int client_tick, int sex, int fd); typedef bool (*HPMHOOK_pre_pc_authok) (struct map_session_data **sd, int *login_id2, time_t *expiration_time, int *group_id, const struct mmo_charstatus **st, bool *changing_mapservers); @@ -5894,12 +5894,12 @@ typedef int (*HPMHOOK_pre_pc_calc_skilltree_normalize_job) (struct map_session_d typedef int (*HPMHOOK_post_pc_calc_skilltree_normalize_job) (int retVal___, struct map_session_data *sd); typedef int (*HPMHOOK_pre_pc_clean_skilltree) (struct map_session_data **sd); typedef int (*HPMHOOK_post_pc_clean_skilltree) (int retVal___, struct map_session_data *sd); -typedef int (*HPMHOOK_pre_pc_setpos) (struct map_session_data **sd, unsigned short *map_index, int *x, int *y, clr_type *clrtype); -typedef int (*HPMHOOK_post_pc_setpos) (int retVal___, struct map_session_data *sd, unsigned short map_index, int x, int y, clr_type clrtype); +typedef int (*HPMHOOK_pre_pc_setpos) (struct map_session_data **sd, unsigned short *map_index, int *x, int *y, enum clr_type *clrtype); +typedef int (*HPMHOOK_post_pc_setpos) (int retVal___, struct map_session_data *sd, unsigned short map_index, int x, int y, enum clr_type clrtype); typedef int (*HPMHOOK_pre_pc_setsavepoint) (struct map_session_data **sd, short *map_index, int *x, int *y); typedef int (*HPMHOOK_post_pc_setsavepoint) (int retVal___, struct map_session_data *sd, short map_index, int x, int y); -typedef int (*HPMHOOK_pre_pc_randomwarp) (struct map_session_data **sd, clr_type *type); -typedef int (*HPMHOOK_post_pc_randomwarp) (int retVal___, struct map_session_data *sd, clr_type type); +typedef int (*HPMHOOK_pre_pc_randomwarp) (struct map_session_data **sd, enum clr_type *type); +typedef int (*HPMHOOK_post_pc_randomwarp) (int retVal___, struct map_session_data *sd, enum clr_type type); typedef int (*HPMHOOK_pre_pc_memo) (struct map_session_data **sd, int *pos); typedef int (*HPMHOOK_post_pc_memo) (int retVal___, struct map_session_data *sd, int pos); typedef int (*HPMHOOK_pre_pc_checkadditem) (struct map_session_data **sd, int *nameid, int *amount); @@ -8088,8 +8088,8 @@ typedef uint8 (*HPMHOOK_pre_unit_getdir) (struct block_list **bl); typedef uint8 (*HPMHOOK_post_unit_getdir) (uint8 retVal___, struct block_list *bl); typedef int (*HPMHOOK_pre_unit_blown) (struct block_list **bl, int *dx, int *dy, int *count, int *flag); typedef int (*HPMHOOK_post_unit_blown) (int retVal___, struct block_list *bl, int dx, int dy, int count, int flag); -typedef int (*HPMHOOK_pre_unit_warp) (struct block_list **bl, short *m, short *x, short *y, clr_type *type); -typedef int (*HPMHOOK_post_unit_warp) (int retVal___, struct block_list *bl, short m, short x, short y, clr_type type); +typedef int (*HPMHOOK_pre_unit_warp) (struct block_list **bl, short *m, short *x, short *y, enum clr_type *type); +typedef int (*HPMHOOK_post_unit_warp) (int retVal___, struct block_list *bl, short m, short x, short y, enum clr_type type); typedef int (*HPMHOOK_pre_unit_stop_walking) (struct block_list **bl, int *type); typedef int (*HPMHOOK_post_unit_stop_walking) (int retVal___, struct block_list *bl, int type); typedef int (*HPMHOOK_pre_unit_skilluse_id) (struct block_list **src, int *target_id, uint16 *skill_id, uint16 *skill_lv); @@ -8140,14 +8140,14 @@ typedef int (*HPMHOOK_pre_unit_fixdamage) (struct block_list **src, struct block typedef int (*HPMHOOK_post_unit_fixdamage) (int retVal___, struct block_list *src, struct block_list *target, int sdelay, int ddelay, int64 damage, short div, unsigned char type, int64 damage2); typedef int (*HPMHOOK_pre_unit_changeviewsize) (struct block_list **bl, short *size); typedef int (*HPMHOOK_post_unit_changeviewsize) (int retVal___, struct block_list *bl, short size); -typedef int (*HPMHOOK_pre_unit_remove_map) (struct block_list **bl, clr_type *clrtype, const char **file, int *line, const char **func); -typedef int (*HPMHOOK_post_unit_remove_map) (int retVal___, struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func); -typedef void (*HPMHOOK_pre_unit_remove_map_pc) (struct map_session_data **sd, clr_type *clrtype); -typedef void (*HPMHOOK_post_unit_remove_map_pc) (struct map_session_data *sd, clr_type clrtype); +typedef int (*HPMHOOK_pre_unit_remove_map) (struct block_list **bl, enum clr_type *clrtype, const char **file, int *line, const char **func); +typedef int (*HPMHOOK_post_unit_remove_map) (int retVal___, struct block_list *bl, enum clr_type clrtype, const char *file, int line, const char *func); +typedef void (*HPMHOOK_pre_unit_remove_map_pc) (struct map_session_data **sd, enum clr_type *clrtype); +typedef void (*HPMHOOK_post_unit_remove_map_pc) (struct map_session_data *sd, enum clr_type clrtype); typedef void (*HPMHOOK_pre_unit_free_pc) (struct map_session_data **sd); typedef void (*HPMHOOK_post_unit_free_pc) (struct map_session_data *sd); -typedef int (*HPMHOOK_pre_unit_free) (struct block_list **bl, clr_type *clrtype); -typedef int (*HPMHOOK_post_unit_free) (int retVal___, struct block_list *bl, clr_type clrtype); +typedef int (*HPMHOOK_pre_unit_free) (struct block_list **bl, enum clr_type *clrtype); +typedef int (*HPMHOOK_post_unit_free) (int retVal___, struct block_list *bl, enum clr_type clrtype); #endif // MAP_UNIT_H #ifdef MAP_VENDING_H /* vending */ typedef void (*HPMHOOK_pre_vending_init) (bool *minimal); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index d5babae97..3bbfc8670 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -90,8 +90,8 @@ struct { struct HPMHookPoint *HP_chr_count_users_post; struct HPMHookPoint *HP_chr_mmo_char_tobuf_pre; struct HPMHookPoint *HP_chr_mmo_char_tobuf_post; - struct HPMHookPoint *HP_chr_mmo_char_send099d_pre; - struct HPMHookPoint *HP_chr_mmo_char_send099d_post; + struct HPMHookPoint *HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_pre; + struct HPMHookPoint *HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_post; struct HPMHookPoint *HP_chr_mmo_char_send_ban_list_pre; struct HPMHookPoint *HP_chr_mmo_char_send_ban_list_post; struct HPMHookPoint *HP_chr_mmo_char_send_slots_info_pre; @@ -1725,8 +1725,8 @@ struct { int HP_chr_count_users_post; int HP_chr_mmo_char_tobuf_pre; int HP_chr_mmo_char_tobuf_post; - int HP_chr_mmo_char_send099d_pre; - int HP_chr_mmo_char_send099d_post; + int HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_pre; + int HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_post; int HP_chr_mmo_char_send_ban_list_pre; int HP_chr_mmo_char_send_ban_list_post; int HP_chr_mmo_char_send_slots_info_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 55f2df4ce..96f210386 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -60,7 +60,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(chr->divorce_char_sql, HP_chr_divorce_char_sql) }, { HP_POP(chr->count_users, HP_chr_count_users) }, { HP_POP(chr->mmo_char_tobuf, HP_chr_mmo_char_tobuf) }, - { HP_POP(chr->mmo_char_send099d, HP_chr_mmo_char_send099d) }, + { HP_POP(chr->send_HC_ACK_CHARINFO_PER_PAGE, HP_chr_send_HC_ACK_CHARINFO_PER_PAGE) }, { HP_POP(chr->mmo_char_send_ban_list, HP_chr_mmo_char_send_ban_list) }, { HP_POP(chr->mmo_char_send_slots_info, HP_chr_mmo_char_send_slots_info) }, { HP_POP(chr->mmo_char_send_characters, HP_chr_mmo_char_send_characters) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 5f20fd224..dc0256ff3 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -609,15 +609,15 @@ int HP_chr_mmo_gender(const struct char_session_data *sd, const struct mmo_chars } return retVal___; } -int HP_chr_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) { +int HP_chr_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf, int *count) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_chr_mmo_chars_fromsql_pre > 0) { - int (*preHookFunc) (struct char_session_data **sd, uint8 **buf); + int (*preHookFunc) (struct char_session_data **sd, uint8 **buf, int **count); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_chars_fromsql_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_chr_mmo_chars_fromsql_pre[hIndex].func; - retVal___ = preHookFunc(&sd, &buf); + retVal___ = preHookFunc(&sd, &buf, &count); } if (*HPMforce_return) { *HPMforce_return = false; @@ -625,13 +625,13 @@ int HP_chr_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) { } } { - retVal___ = HPMHooks.source.chr.mmo_chars_fromsql(sd, buf); + retVal___ = HPMHooks.source.chr.mmo_chars_fromsql(sd, buf, count); } if (HPMHooks.count.HP_chr_mmo_chars_fromsql_post > 0) { - int (*postHookFunc) (int retVal___, struct char_session_data *sd, uint8 *buf); + int (*postHookFunc) (int retVal___, struct char_session_data *sd, uint8 *buf, int *count); for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_chars_fromsql_post; hIndex++) { postHookFunc = HPMHooks.list.HP_chr_mmo_chars_fromsql_post[hIndex].func; - retVal___ = postHookFunc(retVal___, sd, buf); + retVal___ = postHookFunc(retVal___, sd, buf, count); } } return retVal___; @@ -906,13 +906,13 @@ int HP_chr_mmo_char_tobuf(uint8 *buffer, struct mmo_charstatus *p) { } return retVal___; } -void HP_chr_mmo_char_send099d(int fd, struct char_session_data *sd) { +void HP_chr_send_HC_ACK_CHARINFO_PER_PAGE(int fd, struct char_session_data *sd) { int hIndex = 0; - if (HPMHooks.count.HP_chr_mmo_char_send099d_pre > 0) { + if (HPMHooks.count.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_pre > 0) { void (*preHookFunc) (int *fd, struct char_session_data **sd); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send099d_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_chr_mmo_char_send099d_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_pre[hIndex].func; preHookFunc(&fd, &sd); } if (*HPMforce_return) { @@ -921,12 +921,12 @@ void HP_chr_mmo_char_send099d(int fd, struct char_session_data *sd) { } } { - HPMHooks.source.chr.mmo_char_send099d(fd, sd); + HPMHooks.source.chr.send_HC_ACK_CHARINFO_PER_PAGE(fd, sd); } - if (HPMHooks.count.HP_chr_mmo_char_send099d_post > 0) { + if (HPMHooks.count.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_post > 0) { void (*postHookFunc) (int fd, struct char_session_data *sd); - for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_mmo_char_send099d_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_chr_mmo_char_send099d_post[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_chr_send_HC_ACK_CHARINFO_PER_PAGE_post[hIndex].func; postHookFunc(fd, sd); } } diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 2306d72aa..cda212a38 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -9786,10 +9786,10 @@ void HP_clif_item_drop_announce(struct map_session_data *sd, int nameid, char *m } return; } -void HP_clif_clearunit_single(int id, clr_type type, int fd) { +void HP_clif_clearunit_single(int id, enum clr_type type, int fd) { int hIndex = 0; if (HPMHooks.count.HP_clif_clearunit_single_pre > 0) { - void (*preHookFunc) (int *id, clr_type *type, int *fd); + void (*preHookFunc) (int *id, enum clr_type *type, int *fd); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_clearunit_single_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_clearunit_single_pre[hIndex].func; @@ -9804,7 +9804,7 @@ void HP_clif_clearunit_single(int id, clr_type type, int fd) { HPMHooks.source.clif.clearunit_single(id, type, fd); } if (HPMHooks.count.HP_clif_clearunit_single_post > 0) { - void (*postHookFunc) (int id, clr_type type, int fd); + void (*postHookFunc) (int id, enum clr_type type, int fd); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_clearunit_single_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_clearunit_single_post[hIndex].func; postHookFunc(id, type, fd); @@ -9812,10 +9812,10 @@ void HP_clif_clearunit_single(int id, clr_type type, int fd) { } return; } -void HP_clif_clearunit_area(struct block_list *bl, clr_type type) { +void HP_clif_clearunit_area(struct block_list *bl, enum clr_type type) { int hIndex = 0; if (HPMHooks.count.HP_clif_clearunit_area_pre > 0) { - void (*preHookFunc) (struct block_list **bl, clr_type *type); + void (*preHookFunc) (struct block_list **bl, enum clr_type *type); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_clearunit_area_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_clearunit_area_pre[hIndex].func; @@ -9830,7 +9830,7 @@ void HP_clif_clearunit_area(struct block_list *bl, clr_type type) { HPMHooks.source.clif.clearunit_area(bl, type); } if (HPMHooks.count.HP_clif_clearunit_area_post > 0) { - void (*postHookFunc) (struct block_list *bl, clr_type type); + void (*postHookFunc) (struct block_list *bl, enum clr_type type); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_clearunit_area_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_clearunit_area_post[hIndex].func; postHookFunc(bl, type); @@ -9838,10 +9838,10 @@ void HP_clif_clearunit_area(struct block_list *bl, clr_type type) { } return; } -void HP_clif_clearunit_delayed(struct block_list *bl, clr_type type, int64 tick) { +void HP_clif_clearunit_delayed(struct block_list *bl, enum clr_type type, int64 tick) { int hIndex = 0; if (HPMHooks.count.HP_clif_clearunit_delayed_pre > 0) { - void (*preHookFunc) (struct block_list **bl, clr_type *type, int64 *tick); + void (*preHookFunc) (struct block_list **bl, enum clr_type *type, int64 *tick); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_clearunit_delayed_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_clif_clearunit_delayed_pre[hIndex].func; @@ -9856,7 +9856,7 @@ void HP_clif_clearunit_delayed(struct block_list *bl, clr_type type, int64 tick) HPMHooks.source.clif.clearunit_delayed(bl, type, tick); } if (HPMHooks.count.HP_clif_clearunit_delayed_post > 0) { - void (*postHookFunc) (struct block_list *bl, clr_type type, int64 tick); + void (*postHookFunc) (struct block_list *bl, enum clr_type type, int64 tick); for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_clearunit_delayed_post; hIndex++) { postHookFunc = HPMHooks.list.HP_clif_clearunit_delayed_post[hIndex].func; postHookFunc(bl, type, tick); @@ -58749,10 +58749,10 @@ int HP_pc_makesavestatus(struct map_session_data *sd) { } return retVal___; } -void HP_pc_respawn(struct map_session_data *sd, clr_type clrtype) { +void HP_pc_respawn(struct map_session_data *sd, enum clr_type clrtype) { int hIndex = 0; if (HPMHooks.count.HP_pc_respawn_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, clr_type *clrtype); + void (*preHookFunc) (struct map_session_data **sd, enum clr_type *clrtype); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_respawn_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_respawn_pre[hIndex].func; @@ -58767,7 +58767,7 @@ void HP_pc_respawn(struct map_session_data *sd, clr_type clrtype) { HPMHooks.source.pc.respawn(sd, clrtype); } if (HPMHooks.count.HP_pc_respawn_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, clr_type clrtype); + void (*postHookFunc) (struct map_session_data *sd, enum clr_type clrtype); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_respawn_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_respawn_post[hIndex].func; postHookFunc(sd, clrtype); @@ -59231,11 +59231,11 @@ int HP_pc_clean_skilltree(struct map_session_data *sd) { } return retVal___; } -int HP_pc_setpos(struct map_session_data *sd, unsigned short map_index, int x, int y, clr_type clrtype) { +int HP_pc_setpos(struct map_session_data *sd, unsigned short map_index, int x, int y, enum clr_type clrtype) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_pc_setpos_pre > 0) { - int (*preHookFunc) (struct map_session_data **sd, unsigned short *map_index, int *x, int *y, clr_type *clrtype); + int (*preHookFunc) (struct map_session_data **sd, unsigned short *map_index, int *x, int *y, enum clr_type *clrtype); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_setpos_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_setpos_pre[hIndex].func; @@ -59250,7 +59250,7 @@ int HP_pc_setpos(struct map_session_data *sd, unsigned short map_index, int x, i retVal___ = HPMHooks.source.pc.setpos(sd, map_index, x, y, clrtype); } if (HPMHooks.count.HP_pc_setpos_post > 0) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, unsigned short map_index, int x, int y, clr_type clrtype); + int (*postHookFunc) (int retVal___, struct map_session_data *sd, unsigned short map_index, int x, int y, enum clr_type clrtype); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_setpos_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_setpos_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, map_index, x, y, clrtype); @@ -59285,11 +59285,11 @@ int HP_pc_setsavepoint(struct map_session_data *sd, short map_index, int x, int } return retVal___; } -int HP_pc_randomwarp(struct map_session_data *sd, clr_type type) { +int HP_pc_randomwarp(struct map_session_data *sd, enum clr_type type) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_pc_randomwarp_pre > 0) { - int (*preHookFunc) (struct map_session_data **sd, clr_type *type); + int (*preHookFunc) (struct map_session_data **sd, enum clr_type *type); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_randomwarp_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_pc_randomwarp_pre[hIndex].func; @@ -59304,7 +59304,7 @@ int HP_pc_randomwarp(struct map_session_data *sd, clr_type type) { retVal___ = HPMHooks.source.pc.randomwarp(sd, type); } if (HPMHooks.count.HP_pc_randomwarp_post > 0) { - int (*postHookFunc) (int retVal___, struct map_session_data *sd, clr_type type); + int (*postHookFunc) (int retVal___, struct map_session_data *sd, enum clr_type type); for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_randomwarp_post; hIndex++) { postHookFunc = HPMHooks.list.HP_pc_randomwarp_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, type); @@ -87973,11 +87973,11 @@ int HP_unit_blown(struct block_list *bl, int dx, int dy, int count, int flag) { } return retVal___; } -int HP_unit_warp(struct block_list *bl, short m, short x, short y, clr_type type) { +int HP_unit_warp(struct block_list *bl, short m, short x, short y, enum clr_type type) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_unit_warp_pre > 0) { - int (*preHookFunc) (struct block_list **bl, short *m, short *x, short *y, clr_type *type); + int (*preHookFunc) (struct block_list **bl, short *m, short *x, short *y, enum clr_type *type); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_unit_warp_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_unit_warp_pre[hIndex].func; @@ -87992,7 +87992,7 @@ int HP_unit_warp(struct block_list *bl, short m, short x, short y, clr_type type retVal___ = HPMHooks.source.unit.warp(bl, m, x, y, type); } if (HPMHooks.count.HP_unit_warp_post > 0) { - int (*postHookFunc) (int retVal___, struct block_list *bl, short m, short x, short y, clr_type type); + int (*postHookFunc) (int retVal___, struct block_list *bl, short m, short x, short y, enum clr_type type); for (hIndex = 0; hIndex < HPMHooks.count.HP_unit_warp_post; hIndex++) { postHookFunc = HPMHooks.list.HP_unit_warp_post[hIndex].func; retVal___ = postHookFunc(retVal___, bl, m, x, y, type); @@ -88672,11 +88672,11 @@ int HP_unit_changeviewsize(struct block_list *bl, short size) { } return retVal___; } -int HP_unit_remove_map(struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func) { +int HP_unit_remove_map(struct block_list *bl, enum clr_type clrtype, const char *file, int line, const char *func) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_unit_remove_map_pre > 0) { - int (*preHookFunc) (struct block_list **bl, clr_type *clrtype, const char **file, int *line, const char **func); + int (*preHookFunc) (struct block_list **bl, enum clr_type *clrtype, const char **file, int *line, const char **func); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_unit_remove_map_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_unit_remove_map_pre[hIndex].func; @@ -88691,7 +88691,7 @@ int HP_unit_remove_map(struct block_list *bl, clr_type clrtype, const char *file retVal___ = HPMHooks.source.unit.remove_map(bl, clrtype, file, line, func); } if (HPMHooks.count.HP_unit_remove_map_post > 0) { - int (*postHookFunc) (int retVal___, struct block_list *bl, clr_type clrtype, const char *file, int line, const char *func); + int (*postHookFunc) (int retVal___, struct block_list *bl, enum clr_type clrtype, const char *file, int line, const char *func); for (hIndex = 0; hIndex < HPMHooks.count.HP_unit_remove_map_post; hIndex++) { postHookFunc = HPMHooks.list.HP_unit_remove_map_post[hIndex].func; retVal___ = postHookFunc(retVal___, bl, clrtype, file, line, func); @@ -88699,10 +88699,10 @@ int HP_unit_remove_map(struct block_list *bl, clr_type clrtype, const char *file } return retVal___; } -void HP_unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype) { +void HP_unit_remove_map_pc(struct map_session_data *sd, enum clr_type clrtype) { int hIndex = 0; if (HPMHooks.count.HP_unit_remove_map_pc_pre > 0) { - void (*preHookFunc) (struct map_session_data **sd, clr_type *clrtype); + void (*preHookFunc) (struct map_session_data **sd, enum clr_type *clrtype); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_unit_remove_map_pc_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_unit_remove_map_pc_pre[hIndex].func; @@ -88717,7 +88717,7 @@ void HP_unit_remove_map_pc(struct map_session_data *sd, clr_type clrtype) { HPMHooks.source.unit.remove_map_pc(sd, clrtype); } if (HPMHooks.count.HP_unit_remove_map_pc_post > 0) { - void (*postHookFunc) (struct map_session_data *sd, clr_type clrtype); + void (*postHookFunc) (struct map_session_data *sd, enum clr_type clrtype); for (hIndex = 0; hIndex < HPMHooks.count.HP_unit_remove_map_pc_post; hIndex++) { postHookFunc = HPMHooks.list.HP_unit_remove_map_pc_post[hIndex].func; postHookFunc(sd, clrtype); @@ -88751,11 +88751,11 @@ void HP_unit_free_pc(struct map_session_data *sd) { } return; } -int HP_unit_free(struct block_list *bl, clr_type clrtype) { +int HP_unit_free(struct block_list *bl, enum clr_type clrtype) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_unit_free_pre > 0) { - int (*preHookFunc) (struct block_list **bl, clr_type *clrtype); + int (*preHookFunc) (struct block_list **bl, enum clr_type *clrtype); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_unit_free_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_unit_free_pre[hIndex].func; @@ -88770,7 +88770,7 @@ int HP_unit_free(struct block_list *bl, clr_type clrtype) { retVal___ = HPMHooks.source.unit.free(bl, clrtype); } if (HPMHooks.count.HP_unit_free_post > 0) { - int (*postHookFunc) (int retVal___, struct block_list *bl, clr_type clrtype); + int (*postHookFunc) (int retVal___, struct block_list *bl, enum clr_type clrtype); for (hIndex = 0; hIndex < HPMHooks.count.HP_unit_free_post; hIndex++) { postHookFunc = HPMHooks.list.HP_unit_free_post[hIndex].func; retVal___ = postHookFunc(retVal___, bl, clrtype); -- 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') 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') 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') 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 8e1e7ee7fbf3785d77768ea36e63d4008293b0d0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 6 Dec 2018 01:19:59 +0300 Subject: Add ifdefs for packet limits defines in lclif.p.h --- src/login/lclif.p.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/login/lclif.p.h b/src/login/lclif.p.h index 4c444dbd1..cc9805ea8 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -31,11 +31,17 @@ /* Definitions and macros */ /// Maximum amount of packets processed at once from the same client +#ifndef MAX_PROCESSED_PACKETS #define MAX_PROCESSED_PACKETS (3) +#endif // Packet DB +#ifndef MIN_PACKET_DB #define MIN_PACKET_DB 0x0064 +#endif +#ifndef MAX_PACKET_LOGIN_DB #define MAX_PACKET_LOGIN_DB 0x0ad0 +#endif /** * Login Client Interface additional data -- 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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') 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 6f3eb860d7b82634736c3b35d827c4abb70e5ecb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 14 Dec 2018 23:16:30 +0300 Subject: Update HPM. --- src/common/HPMDataCheck.h | 1 + src/plugins/HPMHooking/HPMHooking.Defs.inc | 22 ++ .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 44 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 11 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 287 +++++++++++++++++++++ 5 files changed, 365 insertions(+) (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 4bf396250..96071acf9 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -644,6 +644,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_CZ_REQ_OPEN_WRITE_MAIL", sizeof(struct PACKET_CZ_REQ_OPEN_WRITE_MAIL), SERVER_TYPE_MAP }, { "PACKET_CZ_REQ_READ_MAIL", sizeof(struct PACKET_CZ_REQ_READ_MAIL), SERVER_TYPE_MAP }, { "PACKET_CZ_REQ_REFRESH_MAIL_LIST", sizeof(struct PACKET_CZ_REQ_REFRESH_MAIL_LIST), SERVER_TYPE_MAP }, + { "PACKET_CZ_REQ_REMAINTIME", sizeof(struct PACKET_CZ_REQ_REMAINTIME), SERVER_TYPE_MAP }, { "PACKET_CZ_REQ_REMOVE_ITEM_MAIL", sizeof(struct PACKET_CZ_REQ_REMOVE_ITEM_MAIL), SERVER_TYPE_MAP }, { "PACKET_CZ_REQ_STYLE_CHANGE", sizeof(struct PACKET_CZ_REQ_STYLE_CHANGE), SERVER_TYPE_MAP }, { "PACKET_CZ_REQ_STYLE_CHANGE2", sizeof(struct PACKET_CZ_REQ_STYLE_CHANGE2), SERVER_TYPE_MAP }, diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 92a59475b..7cca3ed6c 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -1338,6 +1338,18 @@ typedef void (*HPMHOOK_pre_clif_cartList) (struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_cartList) (struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_cartItems) (struct map_session_data **sd, enum inventory_type *type); typedef void (*HPMHOOK_post_clif_cartItems) (struct map_session_data *sd, enum inventory_type type); +typedef void (*HPMHOOK_pre_clif_inventoryExpansionInfo) (struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_inventoryExpansionInfo) (struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_inventoryExpandAck) (struct map_session_data **sd, enum expand_inventory *result, int *itemId); +typedef void (*HPMHOOK_post_clif_inventoryExpandAck) (struct map_session_data *sd, enum expand_inventory result, int itemId); +typedef void (*HPMHOOK_pre_clif_inventoryExpandResult) (struct map_session_data **sd, enum expand_inventory_result *result); +typedef void (*HPMHOOK_post_clif_inventoryExpandResult) (struct map_session_data *sd, enum expand_inventory_result result); +typedef void (*HPMHOOK_pre_clif_pInventoryExpansion) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pInventoryExpansion) (int fd, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_pInventoryExpansionConfirmed) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pInventoryExpansionConfirmed) (int fd, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_pInventoryExpansionRejected) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pInventoryExpansionRejected) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_favorite_item) (struct map_session_data **sd, unsigned short *index); typedef void (*HPMHOOK_post_clif_favorite_item) (struct map_session_data *sd, unsigned short index); typedef void (*HPMHOOK_pre_clif_clearcart) (int *fd); @@ -2128,8 +2140,14 @@ typedef void (*HPMHOOK_pre_clif_pStatusUp) (int *fd, struct map_session_data **s typedef void (*HPMHOOK_post_clif_pStatusUp) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_pSkillUp) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_pSkillUp) (int fd, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_useSkillToIdReal) (int *fd, struct map_session_data **sd, int *skill_id, int *skill_lv, int *target_id); +typedef void (*HPMHOOK_post_clif_useSkillToIdReal) (int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id); typedef void (*HPMHOOK_pre_clif_pUseSkillToId) (int *fd, struct map_session_data **sd); typedef void (*HPMHOOK_post_clif_pUseSkillToId) (int fd, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_pStartUseSkillToId) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pStartUseSkillToId) (int fd, struct map_session_data *sd); +typedef void (*HPMHOOK_pre_clif_pStopUseSkillToId) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pStopUseSkillToId) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_pUseSkillToId_homun) (struct homun_data **hd, struct map_session_data **sd, int64 *tick, uint16 *skill_id, uint16 *skill_lv, int *target_id); typedef void (*HPMHOOK_post_clif_pUseSkillToId_homun) (struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id); typedef void (*HPMHOOK_pre_clif_pUseSkillToId_mercenary) (struct mercenary_data **md, struct map_session_data **sd, int64 *tick, uint16 *skill_id, uint16 *skill_lv, int *target_id); @@ -2636,6 +2654,8 @@ typedef void (*HPMHOOK_pre_clif_item_preview) (struct map_session_data **sd, int typedef void (*HPMHOOK_post_clif_item_preview) (struct map_session_data *sd, int n); typedef bool (*HPMHOOK_pre_clif_enchant_equipment) (struct map_session_data **sd, enum equip_pos *pos, int *cardSlot, int *cardId); typedef bool (*HPMHOOK_post_clif_enchant_equipment) (bool retVal___, struct map_session_data *sd, enum equip_pos pos, int cardSlot, int cardId); +typedef void (*HPMHOOK_pre_clif_pReqRemainTime) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pReqRemainTime) (int fd, struct map_session_data *sd); #endif // MAP_CLIF_H #ifdef COMMON_CORE_H /* cmdline */ typedef void (*HPMHOOK_pre_cmdline_init) (void); @@ -6312,6 +6332,8 @@ typedef bool (*HPMHOOK_pre_pc_isDeathPenaltyJob) (uint16 *job); typedef bool (*HPMHOOK_post_pc_isDeathPenaltyJob) (bool retVal___, uint16 job); typedef bool (*HPMHOOK_pre_pc_has_second_costume) (struct map_session_data **sd); typedef bool (*HPMHOOK_post_pc_has_second_costume) (bool retVal___, struct map_session_data *sd); +typedef bool (*HPMHOOK_pre_pc_expandInventory) (struct map_session_data **sd, int *adjustSize); +typedef bool (*HPMHOOK_post_pc_expandInventory) (bool retVal___, struct map_session_data *sd, int adjustSize); #endif // MAP_PC_H #ifdef MAP_NPC_H /* libpcre */ typedef pcre* (*HPMHOOK_pre_libpcre_compile) (const char **pattern, int *options, const char ***errptr, int **erroffset, const unsigned char **tableptr); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 1a45e836c..0220a7956 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -930,6 +930,18 @@ struct { struct HPMHookPoint *HP_clif_cartList_post; struct HPMHookPoint *HP_clif_cartItems_pre; struct HPMHookPoint *HP_clif_cartItems_post; + struct HPMHookPoint *HP_clif_inventoryExpansionInfo_pre; + struct HPMHookPoint *HP_clif_inventoryExpansionInfo_post; + struct HPMHookPoint *HP_clif_inventoryExpandAck_pre; + struct HPMHookPoint *HP_clif_inventoryExpandAck_post; + struct HPMHookPoint *HP_clif_inventoryExpandResult_pre; + struct HPMHookPoint *HP_clif_inventoryExpandResult_post; + struct HPMHookPoint *HP_clif_pInventoryExpansion_pre; + struct HPMHookPoint *HP_clif_pInventoryExpansion_post; + struct HPMHookPoint *HP_clif_pInventoryExpansionConfirmed_pre; + struct HPMHookPoint *HP_clif_pInventoryExpansionConfirmed_post; + struct HPMHookPoint *HP_clif_pInventoryExpansionRejected_pre; + struct HPMHookPoint *HP_clif_pInventoryExpansionRejected_post; struct HPMHookPoint *HP_clif_favorite_item_pre; struct HPMHookPoint *HP_clif_favorite_item_post; struct HPMHookPoint *HP_clif_clearcart_pre; @@ -1720,8 +1732,14 @@ struct { struct HPMHookPoint *HP_clif_pStatusUp_post; struct HPMHookPoint *HP_clif_pSkillUp_pre; struct HPMHookPoint *HP_clif_pSkillUp_post; + struct HPMHookPoint *HP_clif_useSkillToIdReal_pre; + struct HPMHookPoint *HP_clif_useSkillToIdReal_post; struct HPMHookPoint *HP_clif_pUseSkillToId_pre; struct HPMHookPoint *HP_clif_pUseSkillToId_post; + struct HPMHookPoint *HP_clif_pStartUseSkillToId_pre; + struct HPMHookPoint *HP_clif_pStartUseSkillToId_post; + struct HPMHookPoint *HP_clif_pStopUseSkillToId_pre; + struct HPMHookPoint *HP_clif_pStopUseSkillToId_post; struct HPMHookPoint *HP_clif_pUseSkillToId_homun_pre; struct HPMHookPoint *HP_clif_pUseSkillToId_homun_post; struct HPMHookPoint *HP_clif_pUseSkillToId_mercenary_pre; @@ -2228,6 +2246,8 @@ struct { struct HPMHookPoint *HP_clif_item_preview_post; struct HPMHookPoint *HP_clif_enchant_equipment_pre; struct HPMHookPoint *HP_clif_enchant_equipment_post; + struct HPMHookPoint *HP_clif_pReqRemainTime_pre; + struct HPMHookPoint *HP_clif_pReqRemainTime_post; struct HPMHookPoint *HP_cmdline_init_pre; struct HPMHookPoint *HP_cmdline_init_post; struct HPMHookPoint *HP_cmdline_final_pre; @@ -4872,6 +4892,8 @@ struct { struct HPMHookPoint *HP_pc_isDeathPenaltyJob_post; struct HPMHookPoint *HP_pc_has_second_costume_pre; struct HPMHookPoint *HP_pc_has_second_costume_post; + struct HPMHookPoint *HP_pc_expandInventory_pre; + struct HPMHookPoint *HP_pc_expandInventory_post; struct HPMHookPoint *HP_libpcre_compile_pre; struct HPMHookPoint *HP_libpcre_compile_post; struct HPMHookPoint *HP_libpcre_study_pre; @@ -7555,6 +7577,18 @@ struct { int HP_clif_cartList_post; int HP_clif_cartItems_pre; int HP_clif_cartItems_post; + int HP_clif_inventoryExpansionInfo_pre; + int HP_clif_inventoryExpansionInfo_post; + int HP_clif_inventoryExpandAck_pre; + int HP_clif_inventoryExpandAck_post; + int HP_clif_inventoryExpandResult_pre; + int HP_clif_inventoryExpandResult_post; + int HP_clif_pInventoryExpansion_pre; + int HP_clif_pInventoryExpansion_post; + int HP_clif_pInventoryExpansionConfirmed_pre; + int HP_clif_pInventoryExpansionConfirmed_post; + int HP_clif_pInventoryExpansionRejected_pre; + int HP_clif_pInventoryExpansionRejected_post; int HP_clif_favorite_item_pre; int HP_clif_favorite_item_post; int HP_clif_clearcart_pre; @@ -8345,8 +8379,14 @@ struct { int HP_clif_pStatusUp_post; int HP_clif_pSkillUp_pre; int HP_clif_pSkillUp_post; + int HP_clif_useSkillToIdReal_pre; + int HP_clif_useSkillToIdReal_post; int HP_clif_pUseSkillToId_pre; int HP_clif_pUseSkillToId_post; + int HP_clif_pStartUseSkillToId_pre; + int HP_clif_pStartUseSkillToId_post; + int HP_clif_pStopUseSkillToId_pre; + int HP_clif_pStopUseSkillToId_post; int HP_clif_pUseSkillToId_homun_pre; int HP_clif_pUseSkillToId_homun_post; int HP_clif_pUseSkillToId_mercenary_pre; @@ -8853,6 +8893,8 @@ struct { int HP_clif_item_preview_post; int HP_clif_enchant_equipment_pre; int HP_clif_enchant_equipment_post; + int HP_clif_pReqRemainTime_pre; + int HP_clif_pReqRemainTime_post; int HP_cmdline_init_pre; int HP_cmdline_init_post; int HP_cmdline_final_pre; @@ -11497,6 +11539,8 @@ struct { int HP_pc_isDeathPenaltyJob_post; int HP_pc_has_second_costume_pre; int HP_pc_has_second_costume_post; + int HP_pc_expandInventory_pre; + int HP_pc_expandInventory_post; int HP_libpcre_compile_pre; int HP_libpcre_compile_post; int HP_libpcre_study_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 2e7b73cf7..c3fe751ad 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -489,6 +489,12 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->equipItems, HP_clif_equipItems) }, { HP_POP(clif->cartList, HP_clif_cartList) }, { HP_POP(clif->cartItems, HP_clif_cartItems) }, + { HP_POP(clif->inventoryExpansionInfo, HP_clif_inventoryExpansionInfo) }, + { HP_POP(clif->inventoryExpandAck, HP_clif_inventoryExpandAck) }, + { HP_POP(clif->inventoryExpandResult, HP_clif_inventoryExpandResult) }, + { HP_POP(clif->pInventoryExpansion, HP_clif_pInventoryExpansion) }, + { HP_POP(clif->pInventoryExpansionConfirmed, HP_clif_pInventoryExpansionConfirmed) }, + { HP_POP(clif->pInventoryExpansionRejected, HP_clif_pInventoryExpansionRejected) }, { HP_POP(clif->favorite_item, HP_clif_favorite_item) }, { HP_POP(clif->clearcart, HP_clif_clearcart) }, { HP_POP(clif->item_identify_list, HP_clif_item_identify_list) }, @@ -884,7 +890,10 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->pChangeCart, HP_clif_pChangeCart) }, { HP_POP(clif->pStatusUp, HP_clif_pStatusUp) }, { HP_POP(clif->pSkillUp, HP_clif_pSkillUp) }, + { HP_POP(clif->useSkillToIdReal, HP_clif_useSkillToIdReal) }, { HP_POP(clif->pUseSkillToId, HP_clif_pUseSkillToId) }, + { HP_POP(clif->pStartUseSkillToId, HP_clif_pStartUseSkillToId) }, + { HP_POP(clif->pStopUseSkillToId, HP_clif_pStopUseSkillToId) }, { HP_POP(clif->pUseSkillToId_homun, HP_clif_pUseSkillToId_homun) }, { HP_POP(clif->pUseSkillToId_mercenary, HP_clif_pUseSkillToId_mercenary) }, { HP_POP(clif->pUseSkillToPos, HP_clif_pUseSkillToPos) }, @@ -1138,6 +1147,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->camera_change, HP_clif_camera_change) }, { HP_POP(clif->item_preview, HP_clif_item_preview) }, { HP_POP(clif->enchant_equipment, HP_clif_enchant_equipment) }, + { HP_POP(clif->pReqRemainTime, HP_clif_pReqRemainTime) }, /* cmdline_interface */ { HP_POP(cmdline->init, HP_cmdline_init) }, { HP_POP(cmdline->final, HP_cmdline_final) }, @@ -2494,6 +2504,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->check_basicskill, HP_pc_check_basicskill) }, { HP_POP(pc->isDeathPenaltyJob, HP_pc_isDeathPenaltyJob) }, { HP_POP(pc->has_second_costume, HP_pc_has_second_costume) }, + { HP_POP(pc->expandInventory, HP_pc_expandInventory) }, /* pcre_interface */ { HP_POP(libpcre->compile, HP_libpcre_compile) }, { HP_POP(libpcre->study, HP_libpcre_study) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index cda212a38..6fab14490 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -12125,6 +12125,162 @@ void HP_clif_cartItems(struct map_session_data *sd, enum inventory_type type) { } return; } +void HP_clif_inventoryExpansionInfo(struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_inventoryExpansionInfo_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryExpansionInfo_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_inventoryExpansionInfo_pre[hIndex].func; + preHookFunc(&sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.inventoryExpansionInfo(sd); + } + if (HPMHooks.count.HP_clif_inventoryExpansionInfo_post > 0) { + void (*postHookFunc) (struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryExpansionInfo_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_inventoryExpansionInfo_post[hIndex].func; + postHookFunc(sd); + } + } + return; +} +void HP_clif_inventoryExpandAck(struct map_session_data *sd, enum expand_inventory result, int itemId) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_inventoryExpandAck_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, enum expand_inventory *result, int *itemId); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryExpandAck_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_inventoryExpandAck_pre[hIndex].func; + preHookFunc(&sd, &result, &itemId); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.inventoryExpandAck(sd, result, itemId); + } + if (HPMHooks.count.HP_clif_inventoryExpandAck_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, enum expand_inventory result, int itemId); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryExpandAck_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_inventoryExpandAck_post[hIndex].func; + postHookFunc(sd, result, itemId); + } + } + return; +} +void HP_clif_inventoryExpandResult(struct map_session_data *sd, enum expand_inventory_result result) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_inventoryExpandResult_pre > 0) { + void (*preHookFunc) (struct map_session_data **sd, enum expand_inventory_result *result); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryExpandResult_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_inventoryExpandResult_pre[hIndex].func; + preHookFunc(&sd, &result); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.inventoryExpandResult(sd, result); + } + if (HPMHooks.count.HP_clif_inventoryExpandResult_post > 0) { + void (*postHookFunc) (struct map_session_data *sd, enum expand_inventory_result result); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_inventoryExpandResult_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_inventoryExpandResult_post[hIndex].func; + postHookFunc(sd, result); + } + } + return; +} +void HP_clif_pInventoryExpansion(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pInventoryExpansion_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pInventoryExpansion_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pInventoryExpansion_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pInventoryExpansion(fd, sd); + } + if (HPMHooks.count.HP_clif_pInventoryExpansion_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pInventoryExpansion_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pInventoryExpansion_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} +void HP_clif_pInventoryExpansionConfirmed(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pInventoryExpansionConfirmed_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pInventoryExpansionConfirmed_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pInventoryExpansionConfirmed_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pInventoryExpansionConfirmed(fd, sd); + } + if (HPMHooks.count.HP_clif_pInventoryExpansionConfirmed_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pInventoryExpansionConfirmed_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pInventoryExpansionConfirmed_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} +void HP_clif_pInventoryExpansionRejected(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pInventoryExpansionRejected_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pInventoryExpansionRejected_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pInventoryExpansionRejected_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pInventoryExpansionRejected(fd, sd); + } + if (HPMHooks.count.HP_clif_pInventoryExpansionRejected_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pInventoryExpansionRejected_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pInventoryExpansionRejected_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} void HP_clif_favorite_item(struct map_session_data *sd, unsigned short index) { int hIndex = 0; if (HPMHooks.count.HP_clif_favorite_item_pre > 0) { @@ -22430,6 +22586,32 @@ void HP_clif_pSkillUp(int fd, struct map_session_data *sd) { } return; } +void HP_clif_useSkillToIdReal(int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_useSkillToIdReal_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd, int *skill_id, int *skill_lv, int *target_id); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_useSkillToIdReal_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_useSkillToIdReal_pre[hIndex].func; + preHookFunc(&fd, &sd, &skill_id, &skill_lv, &target_id); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.useSkillToIdReal(fd, sd, skill_id, skill_lv, target_id); + } + if (HPMHooks.count.HP_clif_useSkillToIdReal_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd, int skill_id, int skill_lv, int target_id); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_useSkillToIdReal_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_useSkillToIdReal_post[hIndex].func; + postHookFunc(fd, sd, skill_id, skill_lv, target_id); + } + } + return; +} void HP_clif_pUseSkillToId(int fd, struct map_session_data *sd) { int hIndex = 0; if (HPMHooks.count.HP_clif_pUseSkillToId_pre > 0) { @@ -22456,6 +22638,58 @@ void HP_clif_pUseSkillToId(int fd, struct map_session_data *sd) { } return; } +void HP_clif_pStartUseSkillToId(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pStartUseSkillToId_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pStartUseSkillToId_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pStartUseSkillToId_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pStartUseSkillToId(fd, sd); + } + if (HPMHooks.count.HP_clif_pStartUseSkillToId_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pStartUseSkillToId_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pStartUseSkillToId_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} +void HP_clif_pStopUseSkillToId(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pStopUseSkillToId_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pStopUseSkillToId_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pStopUseSkillToId_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pStopUseSkillToId(fd, sd); + } + if (HPMHooks.count.HP_clif_pStopUseSkillToId_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pStopUseSkillToId_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pStopUseSkillToId_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} void HP_clif_pUseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, int64 tick, uint16 skill_id, uint16 skill_lv, int target_id) { int hIndex = 0; if (HPMHooks.count.HP_clif_pUseSkillToId_homun_pre > 0) { @@ -29044,6 +29278,32 @@ bool HP_clif_enchant_equipment(struct map_session_data *sd, enum equip_pos pos, } return retVal___; } +void HP_clif_pReqRemainTime(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pReqRemainTime_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pReqRemainTime_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pReqRemainTime_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pReqRemainTime(fd, sd); + } + if (HPMHooks.count.HP_clif_pReqRemainTime_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pReqRemainTime_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pReqRemainTime_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} /* cmdline_interface */ void HP_cmdline_init(void) { int hIndex = 0; @@ -64857,6 +65117,33 @@ bool HP_pc_has_second_costume(struct map_session_data *sd) { } return retVal___; } +bool HP_pc_expandInventory(struct map_session_data *sd, int adjustSize) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_pc_expandInventory_pre > 0) { + bool (*preHookFunc) (struct map_session_data **sd, int *adjustSize); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_expandInventory_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pc_expandInventory_pre[hIndex].func; + retVal___ = preHookFunc(&sd, &adjustSize); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.expandInventory(sd, adjustSize); + } + if (HPMHooks.count.HP_pc_expandInventory_post > 0) { + bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, int adjustSize); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pc_expandInventory_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pc_expandInventory_post[hIndex].func; + retVal___ = postHookFunc(retVal___, sd, adjustSize); + } + } + return retVal___; +} /* pcre_interface */ pcre* HP_libpcre_compile(const char *pattern, int options, const char **errptr, int *erroffset, const unsigned char *tableptr) { int hIndex = 0; -- 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') 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 08d9a2d55e4e5fb067b3f615a6c203cbff77f44e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Dec 2018 00:46:07 +0300 Subject: Update HPM. --- src/common/HPMDataCheck.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 96071acf9..7cd73b9dd 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -715,6 +715,8 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_NOTIFY_UNREADMAIL", sizeof(struct PACKET_ZC_NOTIFY_UNREADMAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_NOTIFY_WEAPONITEMLIST", sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST), SERVER_TYPE_MAP }, { "PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub", sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub), SERVER_TYPE_MAP }, + { "PACKET_ZC_NPC_MARKET_OPEN", sizeof(struct PACKET_ZC_NPC_MARKET_OPEN), SERVER_TYPE_MAP }, + { "PACKET_ZC_NPC_MARKET_OPEN_sub", sizeof(struct PACKET_ZC_NPC_MARKET_OPEN_sub), SERVER_TYPE_MAP }, { "PACKET_ZC_OPEN_UI", sizeof(struct PACKET_ZC_OPEN_UI), SERVER_TYPE_MAP }, { "PACKET_ZC_OVERWEIGHT_PERCENT", sizeof(struct PACKET_ZC_OVERWEIGHT_PERCENT), SERVER_TYPE_MAP }, { "PACKET_ZC_PC_CASH_POINT_ITEMLIST", sizeof(struct PACKET_ZC_PC_CASH_POINT_ITEMLIST), SERVER_TYPE_MAP }, @@ -788,7 +790,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "packet_mission_info_sub", sizeof(struct packet_mission_info_sub), SERVER_TYPE_MAP }, { "packet_monster_hp", sizeof(struct packet_monster_hp), SERVER_TYPE_MAP }, { "packet_notify_bounditem", sizeof(struct packet_notify_bounditem), SERVER_TYPE_MAP }, - { "packet_npc_market_open", sizeof(struct packet_npc_market_open), SERVER_TYPE_MAP }, { "packet_npc_market_purchase", sizeof(struct packet_npc_market_purchase), SERVER_TYPE_MAP }, { "packet_npc_market_result_ack", sizeof(struct packet_npc_market_result_ack), SERVER_TYPE_MAP }, { "packet_package_item_announce", sizeof(struct packet_package_item_announce), SERVER_TYPE_MAP }, -- 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') 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') 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') 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') 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 From 4b2e8684a9874ba435197936a4a9220510ff671f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Dec 2018 08:59:03 +0300 Subject: Update HPM. --- src/common/HPMDataCheck.h | 2 +- src/plugins/HPMHooking/HPMHooking.Defs.inc | 2 ++ .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 ++++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 26 ++++++++++++++++++++++ 5 files changed, 34 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 7cd73b9dd..bfd01ec30 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -627,6 +627,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_CZ_CHECKNAME", sizeof(struct PACKET_CZ_CHECKNAME), SERVER_TYPE_MAP }, { "PACKET_CZ_MEMORIALDUNGEON_COMMAND", sizeof(struct PACKET_CZ_MEMORIALDUNGEON_COMMAND), SERVER_TYPE_MAP }, { "PACKET_CZ_OPEN_UI", sizeof(struct PACKET_CZ_OPEN_UI), SERVER_TYPE_MAP }, + { "PACKET_CZ_PARTY_CONFIG", sizeof(struct PACKET_CZ_PARTY_CONFIG), SERVER_TYPE_MAP }, { "PACKET_CZ_PC_BUY_CASH_POINT_ITEM", sizeof(struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM), SERVER_TYPE_MAP }, { "PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub", sizeof(struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub), SERVER_TYPE_MAP }, { "PACKET_CZ_PC_PURCHASE_ITEMLIST", sizeof(struct PACKET_CZ_PC_PURCHASE_ITEMLIST), SERVER_TYPE_MAP }, @@ -680,7 +681,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_ADD_ITEM_TO_STORE", sizeof(struct PACKET_ZC_ADD_ITEM_TO_STORE), SERVER_TYPE_MAP }, { "PACKET_ZC_ADD_MEMBER_TO_GROUP", sizeof(struct PACKET_ZC_ADD_MEMBER_TO_GROUP), SERVER_TYPE_MAP }, { "PACKET_ZC_AUTOSPELLLIST", sizeof(struct PACKET_ZC_AUTOSPELLLIST), SERVER_TYPE_MAP }, - { "PACKET_ZC_CAMERA_INFO", sizeof(struct PACKET_ZC_CAMERA_INFO), SERVER_TYPE_MAP }, { "PACKET_ZC_CASH_ITEM_DELETE", sizeof(struct PACKET_ZC_CASH_ITEM_DELETE), SERVER_TYPE_MAP }, { "PACKET_ZC_CASH_TIME_COUNTER", sizeof(struct PACKET_ZC_CASH_TIME_COUNTER), SERVER_TYPE_MAP }, { "PACKET_ZC_CHECKNAME", sizeof(struct PACKET_ZC_CHECKNAME), SERVER_TYPE_MAP }, diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 7cca3ed6c..9fdb68989 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -2650,6 +2650,8 @@ typedef void (*HPMHOOK_pre_clif_camera_showWindow) (struct map_session_data **sd typedef void (*HPMHOOK_post_clif_camera_showWindow) (struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_camera_change) (struct map_session_data **sd, float *range, float *rotation, float *latitude, enum send_target *target); typedef void (*HPMHOOK_post_clif_camera_change) (struct map_session_data *sd, float range, float rotation, float latitude, enum send_target target); +typedef void (*HPMHOOK_pre_clif_pCameraInfo) (int *fd, struct map_session_data **sd); +typedef void (*HPMHOOK_post_clif_pCameraInfo) (int fd, struct map_session_data *sd); typedef void (*HPMHOOK_pre_clif_item_preview) (struct map_session_data **sd, int *n); typedef void (*HPMHOOK_post_clif_item_preview) (struct map_session_data *sd, int n); typedef bool (*HPMHOOK_pre_clif_enchant_equipment) (struct map_session_data **sd, enum equip_pos *pos, int *cardSlot, int *cardId); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 0220a7956..d2c269bdd 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2242,6 +2242,8 @@ struct { struct HPMHookPoint *HP_clif_camera_showWindow_post; struct HPMHookPoint *HP_clif_camera_change_pre; struct HPMHookPoint *HP_clif_camera_change_post; + struct HPMHookPoint *HP_clif_pCameraInfo_pre; + struct HPMHookPoint *HP_clif_pCameraInfo_post; struct HPMHookPoint *HP_clif_item_preview_pre; struct HPMHookPoint *HP_clif_item_preview_post; struct HPMHookPoint *HP_clif_enchant_equipment_pre; @@ -8889,6 +8891,8 @@ struct { int HP_clif_camera_showWindow_post; int HP_clif_camera_change_pre; int HP_clif_camera_change_post; + int HP_clif_pCameraInfo_pre; + int HP_clif_pCameraInfo_post; int HP_clif_item_preview_pre; int HP_clif_item_preview_post; int HP_clif_enchant_equipment_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index c3fe751ad..050050ee1 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1145,6 +1145,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(clif->pMemorialDungeonCommand, HP_clif_pMemorialDungeonCommand) }, { HP_POP(clif->camera_showWindow, HP_clif_camera_showWindow) }, { HP_POP(clif->camera_change, HP_clif_camera_change) }, + { HP_POP(clif->pCameraInfo, HP_clif_pCameraInfo) }, { HP_POP(clif->item_preview, HP_clif_item_preview) }, { HP_POP(clif->enchant_equipment, HP_clif_enchant_equipment) }, { HP_POP(clif->pReqRemainTime, HP_clif_pReqRemainTime) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 6fab14490..32196d061 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -29225,6 +29225,32 @@ void HP_clif_camera_change(struct map_session_data *sd, float range, float rotat } return; } +void HP_clif_pCameraInfo(int fd, struct map_session_data *sd) { + int hIndex = 0; + if (HPMHooks.count.HP_clif_pCameraInfo_pre > 0) { + void (*preHookFunc) (int *fd, struct map_session_data **sd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pCameraInfo_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_clif_pCameraInfo_pre[hIndex].func; + preHookFunc(&fd, &sd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.clif.pCameraInfo(fd, sd); + } + if (HPMHooks.count.HP_clif_pCameraInfo_post > 0) { + void (*postHookFunc) (int fd, struct map_session_data *sd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_pCameraInfo_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_clif_pCameraInfo_post[hIndex].func; + postHookFunc(fd, sd); + } + } + return; +} void HP_clif_item_preview(struct map_session_data *sd, int n) { int hIndex = 0; if (HPMHooks.count.HP_clif_item_preview_pre > 0) { -- cgit v1.2.3-70-g09d2