diff options
Diffstat (limited to 'src')
63 files changed, 2805 insertions, 908 deletions
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 a09eccd8a..0546e49df 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" @@ -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" @@ -53,6 +54,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" @@ -477,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 ) @@ -496,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, @@ -509,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); @@ -1050,7 +1059,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; @@ -1059,6 +1068,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); @@ -1080,7 +1092,7 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) "`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) @@ -1124,25 +1136,36 @@ static int char_mmo_chars_fromsql(struct char_session_data *sd, uint8 *buf) || 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); 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; + 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; 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; } @@ -1170,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); @@ -1189,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) @@ -1257,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); @@ -1288,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 @@ -1987,7 +2019,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,18 +2124,29 @@ 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 */ -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 } @@ -2189,7 +2232,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); @@ -4170,10 +4213,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 <char id>.L <Msg:0-5>.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); @@ -5006,7 +5049,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); } @@ -5026,8 +5069,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 @@ -6424,7 +6467,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 <http://www.gnu.org/licenses/>. + */ +#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 diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index d92591501..bfd01ec30 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 @@ -346,21 +351,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #ifdef LOGIN_LCLIF_P_H { "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 @@ -383,6 +373,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 }, @@ -614,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 }, @@ -631,6 +645,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 }, @@ -665,9 +680,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_CAMERA_INFO", sizeof(struct PACKET_ZC_CAMERA_INFO), SERVER_TYPE_MAP }, + { "PACKET_ZC_AUTOSPELLLIST", sizeof(struct PACKET_ZC_AUTOSPELLLIST), 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 }, @@ -702,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 }, @@ -775,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 }, diff --git a/src/common/mmo.h b/src/common/mmo.h index 9bcf82cc7..4b8f49fa2 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -165,7 +165,22 @@ #endif #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 // PACKETVER_ZERO_NUM >= 20181212 +#endif // MAX_INVENTORY + +#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 @@ -710,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/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 */ diff --git a/src/common/packetsstatic_len.h b/src/common/packetsstatic_len.h index 9ccc4a673..730516c27 100644 --- a/src/common/packetsstatic_len.h +++ b/src/common/packetsstatic_len.h @@ -24,6 +24,14 @@ #error packetLen already defined #endif +#define DEFINE_PACKET_HEADER(name, id) \ + 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 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/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); } 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 1cb8bfdbd..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" @@ -49,10 +51,10 @@ 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 = PACKET_ID_SC_NOTIFY_BAN; + packet->packet_id = HEADER_SC_NOTIFY_BAN; packet->error_code = error; WFIFOSET(fd, sizeof(*packet)); } @@ -68,7 +70,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 +80,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 +99,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 +115,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 +133,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 +151,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 +173,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 +196,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,11 +222,27 @@ 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; } +/// @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_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) @@ -255,7 +273,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)) @@ -272,9 +290,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; @@ -312,14 +330,14 @@ 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; - int packet_id = PACKET_ID_AC_REFUSE_LOGIN_R3; + 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; - int packet_id = PACKET_ID_AC_REFUSE_LOGIN_R2; + struct PACKET_AC_REFUSE_LOGIN_R2 *packet = NULL; + int packet_id = HEADER_AC_REFUSE_LOGIN_R2; #else - struct packet_AC_REFUSE_LOGIN *packet = NULL; - int packet_id = PACKET_ID_AC_REFUSE_LOGIN; + struct PACKET_AC_REFUSE_LOGIN *packet = NULL; + int packet_id = HEADER_AC_REFUSE_LOGIN; #endif WFIFOHEAD(fd, sizeof(*packet)); packet = WP2PTR(fd); @@ -335,10 +353,10 @@ 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 = 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)); @@ -348,12 +366,12 @@ 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); 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); @@ -476,7 +494,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) @@ -503,8 +521,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), @@ -515,6 +533,12 @@ 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 +#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 #undef packet_def2 @@ -531,7 +555,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; } @@ -579,6 +603,8 @@ 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_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.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 a80caafa2..cc9805ea8 100644 --- a/src/login/lclif.p.h +++ b/src/login/lclif.p.h @@ -31,279 +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 -#define MAX_PACKET_LOGIN_DB 0x0acf - -/* Enums */ - -/// 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 */ - - // 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, -}; - -/* 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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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)); - -/** - * Packet structure for CA_LOGIN_OTP. - */ -struct packet_CA_LOGIN_OTP { - int16 packet_id; ///< Packet ID (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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 (#PACKET_ID_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; +#ifndef MAX_PACKET_LOGIN_DB +#define MAX_PACKET_LOGIN_DB 0x0ad0 #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 (#PACKET_ID_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 @@ -332,18 +70,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_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 diff --git a/src/login/login.c b/src/login/login.c index c1844cb25..4c40677fa 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" @@ -35,6 +36,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" @@ -1368,36 +1370,37 @@ 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))); +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))); @@ -2275,6 +2278,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); diff --git a/src/login/packets_ac_struct.h b/src/login/packets_ac_struct.h new file mode 100644 index 000000000..c9fb04f26 --- /dev/null +++ b/src/login/packets_ac_struct.h @@ -0,0 +1,156 @@ +/** + * 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 <http://www.gnu.org/licenses/>. + */ +#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 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 + +#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 <http://www.gnu.org/licenses/>. + */ +#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/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;i<MAX_INVENTORY;i++) { + for (int i = 0; i < sd->status.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 7d539b3cd..9166c83ea 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 @@ -890,7 +891,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 +908,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 +937,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; @@ -1116,7 +1117,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_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 p.shield = vd->shield; #endif p.accessory2 = vd->head_top; @@ -1273,7 +1274,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_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 p.shield = vd->shield; #endif p.accessory2 = vd->head_top; @@ -1382,7 +1383,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_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 p.shield = vd->shield; #endif p.accessory2 = vd->head_top; @@ -1627,6 +1628,7 @@ static bool clif_spawn(struct block_list *bl) /// 022e <name>.24B <modified>.B <level>.W <hunger>.W <intimacy>.W <equip id>.W <atk>.W <matk>.W <hit>.W <crit>.W <def>.W <mdef>.W <flee>.W <aspd>.W <hp>.W <max hp>.W <sp>.W <max sp>.W <exp>.L <max exp>.L <skill points>.W <atk range>.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 +1640,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 +1706,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). @@ -2160,14 +2163,14 @@ static void clif_buylist(struct map_session_data *sd, struct npc_data *nd) /// 00c7 <packet len>.W { <index>.W <price>.L <overcharge price>.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] ) { @@ -2582,7 +2585,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) @@ -2804,7 +2807,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; @@ -2838,7 +2841,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; @@ -2866,7 +2869,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; @@ -2886,7 +2889,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; @@ -3062,6 +3065,121 @@ 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->status.inventorySize - FIXED_INVENTORY_SIZE; + WFIFOSET(fd, sizeof(struct PACKET_ZC_INVENTORY_EXPANSION_INFO)); +#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 +} + +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 +} + +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 + 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; + + 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 +} + +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 + 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; + + 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 +} + +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 +} + +// 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: @@ -3824,6 +3942,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 < sd->status.inventorySize); if (result == EIA_SUCCESS && sd->inventory_data[n]->equip&EQP_VISIBLE) p.wItemSpriteNumber = sd->inventory_data[n]->view_sprite; else @@ -3965,7 +4084,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; @@ -4314,7 +4433,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 @@ -6377,10 +6496,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; @@ -6424,9 +6543,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;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){ WFIFOW(fd,c*2+4)=i+2; c++; @@ -6471,11 +6590,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; @@ -6551,11 +6670,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 @@ -7017,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)); } @@ -7385,9 +7504,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; @@ -7509,10 +7628,11 @@ static void clif_pet_food(struct map_session_data *sd, int foodid, int fail) /// 01cd { <skill id>.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 @@ -7520,7 +7640,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) @@ -7538,7 +7658,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 @@ -7548,6 +7668,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). @@ -8968,6 +9089,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 * @@ -11270,7 +11419,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. @@ -11291,7 +11440,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 ) { @@ -11415,6 +11564,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; @@ -11966,33 +12117,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 <skill lv>.W <skill id>.W <target id>.L (CZ_USE_SKILL) -/// 0438 <skill lv>.W <skill id>.W <target id>.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; } @@ -12009,51 +12151,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; @@ -12062,22 +12205,56 @@ 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 <skill lv>.W <skill id>.W <target id>.L (CZ_USE_SKILL) +/// 0438 <skill lv>.W <skill id>.W <target id>.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 +} + +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 *------------------------------------------*/ @@ -12454,7 +12631,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 && @@ -12474,7 +12651,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_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 itemId = RFIFOL(fd, 2); #else itemId = RFIFOW(fd, 2); @@ -12604,7 +12781,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) @@ -14255,10 +14432,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; } @@ -16243,7 +16420,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; } @@ -16318,7 +16495,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); @@ -16825,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] @@ -17798,8 +17975,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); @@ -18552,7 +18729,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) ) { @@ -18592,7 +18769,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 ++; @@ -18629,7 +18806,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 ++; @@ -18770,7 +18947,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 ) @@ -19695,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; + + 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(i = 0, c = 0; i < shop_size; i++) { + 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 } @@ -19776,7 +19953,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); @@ -19823,7 +20000,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; @@ -20082,7 +20259,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; @@ -20114,7 +20291,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) @@ -20175,7 +20352,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; @@ -20189,7 +20366,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]; @@ -20239,7 +20416,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; @@ -20358,21 +20535,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 +20560,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 ++; } } @@ -20795,7 +20975,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; @@ -20848,7 +21028,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; @@ -21631,7 +21811,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 +21831,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); @@ -21945,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; @@ -21959,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; @@ -21968,12 +22148,27 @@ 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) { #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; @@ -21988,6 +22183,24 @@ 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 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_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 +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -22447,6 +22660,12 @@ void clif_defaults(void) clif->equipItems = clif_equipItems; clif->cartList = clif_cartList; clif->cartItems = clif_cartItems; + clif->inventoryExpansionInfo = clif_inventoryExpansionInfo; + clif->inventoryExpandAck = clif_inventoryExpandAck; + 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; @@ -22568,6 +22787,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; @@ -22892,6 +23112,9 @@ 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->pStopUseSkillToId = clif_parse_stopUseSkillToId; + clif->useSkillToIdReal = clif_useSkillToIdReal; clif->pUseSkillToPos = clif_parse_UseSkillToPos; clif->pUseSkillToPosSub = clif_parse_UseSkillToPosSub; clif->pUseSkillToPos_homun = clif_parse_UseSkillToPos_homun; @@ -23153,11 +23376,14 @@ 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; // -- Pet Evolution clif->pPetEvolution = clif_parse_pet_evolution; 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 593dc15c1..91a91b5d3 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, @@ -493,13 +493,17 @@ 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{ +enum OPEN_ROULETTE_ACK { OPEN_ROULETTE_SUCCESS = 0x0, OPEN_ROULETTE_FAILED = 0x1, }; @@ -583,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 }; @@ -673,6 +677,22 @@ 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 +}; + +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 **/ @@ -752,9 +772,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); @@ -847,6 +867,12 @@ 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 (*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 (*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); @@ -968,6 +994,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); @@ -1219,7 +1246,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); @@ -1285,7 +1312,10 @@ 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 (*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); @@ -1553,7 +1583,10 @@ 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); }; #ifdef HERCULES_CORE diff --git a/src/map/itemdb.h b/src/map/itemdb.h index d92940445..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 +#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 -#error "For clients before 20180704 RE, 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/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/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 */ diff --git a/src/map/npc.c b/src/map/npc.c index 7f57a9c50..fd11b6c5f 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); @@ -2231,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.h b/src/map/packets.h index 036fd4f2a..81b861f78 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); @@ -1788,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 @@ -1875,4 +1881,45 @@ 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 + +// 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 + +#if PACKETVER_MAIN_NUM >= 20181002 || PACKETVER_RE_NUM >= 20181002 || PACKETVER_ZERO_NUM >= 20181010 + packet(0x0b10,clif->pStartUseSkillToId); + packet(0x0b11,clif->pStopUseSkillToId); +#endif + +#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_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 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 diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index cd3a3b989..f9b5fab0d 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 }; - /** * **/ @@ -375,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 @@ -425,12 +418,6 @@ enum packet_headers { #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? reqNameAllType = 0xA30, @@ -454,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 @@ -469,7 +451,7 @@ enum packet_headers { * structs for data */ struct EQUIPSLOTINFO { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 card[4]; #else uint16 card[4]; @@ -478,7 +460,7 @@ struct EQUIPSLOTINFO { struct NORMALITEM_INFO { int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -516,7 +498,7 @@ struct ItemOptions { struct EQUIPITEM_INFO { int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -593,7 +575,7 @@ struct packet_additem { int16 PacketType; uint16 Index; uint16 count; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 nameid; #else uint16 nameid; @@ -627,7 +609,7 @@ struct packet_additem { struct packet_dropflooritem { int16 PacketType; uint32 ITAID; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -739,7 +721,7 @@ struct packet_spawn_unit { #else uint32 weapon; #endif -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 shield; #endif uint16 accessory; @@ -812,7 +794,7 @@ struct packet_unit_walking { #else uint32 weapon; #endif -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 shield; #endif uint16 accessory; @@ -884,7 +866,7 @@ struct packet_idle_unit { #else uint32 weapon; #endif -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 shield; #endif uint16 accessory; @@ -1047,7 +1029,7 @@ struct packet_package_item_announce { int16 PacketType; int16 PacketLength; uint8 type; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ItemID; #else uint16 ItemID; @@ -1055,7 +1037,7 @@ struct packet_package_item_announce { int8 len; char Name[NAME_LENGTH]; int8 unknown; // probably unused -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 BoxItemID; #else uint16 BoxItemID; @@ -1067,7 +1049,7 @@ struct packet_item_drop_announce { int16 PacketType; int16 PacketLength; uint8 type; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ItemID; #else uint16 ItemID; @@ -1122,7 +1104,7 @@ struct packet_roulette_open_ack { int32 Serial; int8 Step; int8 Idx; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 AdditionItemID; #else uint16 AdditionItemID; @@ -1160,7 +1142,7 @@ struct packet_roulette_generate_ack { uint8 Result; uint16 Step; uint16 Idx; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 AdditionItemID; #else uint16 AdditionItemID; @@ -1178,7 +1160,7 @@ struct packet_roulette_itemrecv_req { struct packet_roulette_itemrecv_ack { int16 PacketType; uint8 Result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 AdditionItemID; #else uint16 AdditionItemID; @@ -1303,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)); @@ -1383,7 +1366,7 @@ struct packet_npc_market_purchase { int16 PacketType; int16 PacketLength; struct { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -1397,36 +1380,40 @@ struct packet_npc_market_result_ack { int16 PacketLength; uint8 result; struct { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; #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)); -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_RE_NUM >= 20180704 - uint32 nameid; +#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; #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; @@ -1537,7 +1524,7 @@ struct PACKET_ZC_ADD_ITEM_TO_MAIL { int8 result; int16 index; int16 count; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -1555,7 +1542,7 @@ struct PACKET_ZC_ADD_ITEM_TO_MAIL { struct mail_item { int16 count; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ITID; #else uint16 ITID; @@ -1804,6 +1791,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; @@ -1814,6 +1802,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; @@ -1965,7 +1955,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_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 ItemID; #else uint16 ItemID; @@ -2011,7 +2001,7 @@ struct pet_evolution_items { struct PACKET_CZ_PET_EVOLUTION { int16 PacketType; uint16 PacketLength; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 EvolvedPetEggID; #else uint16 EvolvedPetEggID; @@ -2045,7 +2035,7 @@ struct PACKET_ZC_NOTIFY_PLAYERCHAT { struct PACKET_ZC_ITEM_ENTRY { int16 packetType; uint32 AID; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2062,7 +2052,7 @@ struct PACKET_ZC_ADD_ITEM_TO_STORE { int16 packetType; int16 index; int32 amount; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2081,7 +2071,7 @@ struct PACKET_ZC_ADD_ITEM_TO_STORE { struct PACKET_ZC_MVP_GETTING_ITEM { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2091,7 +2081,7 @@ struct PACKET_ZC_MVP_GETTING_ITEM { struct PACKET_ZC_ACK_TOUSESKILL { int16 packetType; uint16 skillId; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 int32 btype; uint32 itemId; #else @@ -2106,7 +2096,7 @@ struct PACKET_ZC_ADD_ITEM_TO_CART { int16 packetType; int16 index; int32 amount; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2125,7 +2115,7 @@ struct PACKET_ZC_ADD_ITEM_TO_CART { struct PACKET_CZ_REQMAKINGITEM { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint32 material[3]; #else @@ -2137,7 +2127,7 @@ struct PACKET_CZ_REQMAKINGITEM { struct PACKET_ZC_ACK_REQMAKINGITEM { int16 packetType; int16 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2147,7 +2137,7 @@ struct PACKET_ZC_ACK_REQMAKINGITEM { struct PACKET_ZC_FEED_PET { int16 packetType; uint8 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2157,7 +2147,7 @@ struct PACKET_ZC_FEED_PET { struct PACKET_ZC_FEED_MER { int16 packetType; uint8 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2167,7 +2157,7 @@ struct PACKET_ZC_FEED_MER { struct PACKET_ZC_USE_ITEM_ACK { int16 packetType; int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint32 AID; #elif PACKETVER >= 3 @@ -2182,7 +2172,7 @@ struct PACKET_ZC_SPRITE_CHANGE { int16 packetType; uint32 AID; uint8 type; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 val; uint32 val2; #elif PACKETVER >= 4 @@ -2195,7 +2185,7 @@ struct PACKET_ZC_SPRITE_CHANGE { struct PACKET_ZC_ADD_EXCHANGE_ITEM { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint8 itemType; int32 amount; @@ -2218,7 +2208,7 @@ struct PACKET_ZC_ADD_EXCHANGE_ITEM { struct PACKET_ZC_CASH_TIME_COUNTER { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2229,7 +2219,7 @@ struct PACKET_ZC_CASH_TIME_COUNTER { struct PACKET_ZC_CASH_ITEM_DELETE { int16 packetType; uint16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2239,7 +2229,7 @@ struct PACKET_ZC_CASH_ITEM_DELETE { struct PACKET_ZC_ITEM_PICKUP_PARTY { int16 packetType; uint32 AID; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2254,7 +2244,7 @@ struct PACKET_ZC_ITEM_PICKUP_PARTY { struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE { int16 packetType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2273,13 +2263,15 @@ struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE { struct PACKET_ZC_ACK_WEAPONREFINE { int16 packetType; int32 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; #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]; @@ -2288,7 +2280,7 @@ struct PACKET_ZC_PROPERTY_HOMUN { uint16 level; uint16 hunger; uint16 intimacy; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2301,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; @@ -2315,11 +2335,13 @@ 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; uint16 result; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2329,7 +2351,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_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2341,7 +2363,7 @@ struct PACKET_CZ_REQ_ITEMREPAIR { struct PACKET_CZ_REQ_MAKINGITEM { int16 packetType; int16 type; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2352,7 +2374,7 @@ struct PACKET_CZ_SSILIST_ITEM_CLICK { int16 packetType; uint32 AID; uint32 storeId; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2360,7 +2382,7 @@ struct PACKET_CZ_SSILIST_ITEM_CLICK { } __attribute__((packed)); struct PACKET_ZC_ACK_SCHEDULER_CASHITEM_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2381,7 +2403,7 @@ struct PACKET_ZC_PC_PURCHASE_MYITEMLIST_sub { int16 index; int16 amount; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2406,7 +2428,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST_sub { uint32 price; uint32 discountPrice; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2421,7 +2443,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST { struct PACKET_CZ_PC_PURCHASE_ITEMLIST_sub { uint16 amount; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2435,7 +2457,7 @@ struct PACKET_CZ_PC_PURCHASE_ITEMLIST { } __attribute__((packed)); struct PACKET_CZ_REQ_OPEN_BUYING_STORE_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2457,7 +2479,7 @@ struct PACKET_ZC_MYITEMLIST_BUYING_STORE_sub { uint32 price; uint16 amount; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2477,7 +2499,7 @@ struct PACKET_ZC_PC_PURCHASE_ITEMLIST_FROMMC_sub { uint16 amount; int16 index; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2510,7 +2532,7 @@ struct PACKET_ZC_ACK_ITEMLIST_BUYING_STORE_sub { uint32 price; uint16 amount; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2528,7 +2550,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_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2545,7 +2567,7 @@ struct PACKET_CZ_REQ_TRADE_BUYING_STORE { } __attribute__((packed)); struct PACKET_ZC_MAKABLEITEMLIST_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; uint32 material[3]; #else @@ -2561,7 +2583,7 @@ struct PACKET_ZC_MAKABLEITEMLIST { } __attribute__((packed)); struct PACKET_ZC_MAKINGARROW_LIST_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2576,7 +2598,7 @@ struct PACKET_ZC_MAKINGARROW_LIST { struct PACKET_ZC_REPAIRITEMLIST_sub { int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2593,7 +2615,7 @@ struct PACKET_ZC_REPAIRITEMLIST { struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub { int16 index; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2609,7 +2631,7 @@ struct PACKET_ZC_NOTIFY_WEAPONITEMLIST { } __attribute__((packed)); struct PACKET_ZC_MAKINGITEM_LIST_sub { -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2619,7 +2641,7 @@ struct PACKET_ZC_MAKINGITEM_LIST_sub { struct PACKET_ZC_MAKINGITEM_LIST { int16 packetType; int16 packetLength; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 makeItem; #else uint16 makeItem; @@ -2631,7 +2653,7 @@ struct PACKET_ZC_PC_CASH_POINT_ITEMLIST_sub { uint32 price; uint32 discountPrice; uint8 itemType; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2650,7 +2672,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_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2674,7 +2696,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_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2699,7 +2721,7 @@ struct PACKET_ZC_SEARCH_STORE_INFO_ACK_sub { uint32 storeId; uint32 AID; char shopName[MESSAGE_SIZE]; -#if PACKETVER_RE_NUM >= 20180704 +#if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114 uint32 itemId; #else uint16 itemId; @@ -2874,6 +2896,7 @@ struct PACKET_ZC_REMOVE_EFFECT { uint32 effectId; } __attribute__((packed)); +#if PACKETVER >= 20160525 struct PACKET_ZC_CAMERA_INFO { int16 packetType; int8 action; @@ -2881,23 +2904,36 @@ struct PACKET_ZC_CAMERA_INFO { float rotation; float latitude; } __attribute__((packed)); - -#if PACKETVER_RE_NUM >= 20181031 -#define PACKET_ZC_AUTOSPELLLIST PACKET_ZC_AUTOSPELLLIST2 -#else -#define PACKET_ZC_AUTOSPELLLIST PACKET_ZC_AUTOSPELLLIST1 +DEFINE_PACKET_HEADER(ZC_CAMERA_INFO, 0x0a78); #endif -struct PACKET_ZC_AUTOSPELLLIST1 { +#if PACKETVER >= 20160525 +struct PACKET_CZ_CAMERA_INFO { int16 packetType; - int skills[7]; + int8 action; + float range; + float rotation; + float latitude; } __attribute__((packed)); +DEFINE_PACKET_HEADER(CZ_CAMERA_INFO, 0x0a77); +#endif -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 @@ -2923,6 +2959,104 @@ 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 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 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); + +struct PACKET_CZ_STOP_USE_SKILL { + int16 packetType; + int16 skillId; +} __attribute__((packed)); +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 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 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 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 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 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 + +struct PACKET_CZ_REQ_REMAINTIME { + int16 packetType; +} __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 diff --git a/src/map/pc.c b/src/map/pc.c index fcd36a233..94d8cd0c6 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 @@ -782,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; @@ -838,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; } @@ -902,7 +900,7 @@ static int pc_setequipindex(struct map_session_data *sd) for(i=0;i<EQI_MAX;i++) sd->equip_index[i] = -1; - for(i=0;i<MAX_INVENTORY;i++) { + for (i = 0; i < sd->status.inventorySize; i++) { if(sd->status.inventory[i].nameid <= 0) continue; if(sd->status.inventory[i].equip) { @@ -1073,6 +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 < sd->status.inventorySize); item = sd->inventory_data[n]; @@ -1379,6 +1378,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); @@ -4308,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 @@ -4342,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 @@ -4438,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); @@ -4454,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;i<MAX_INVENTORY;i++){ + for(int i = 0; i < sd->status.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 ) ) @@ -4472,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;i<MAX_INVENTORY;i++){ + for (int i = 0; i < sd->status.inventorySize; i++) { if(sd->status.inventory[i].nameid==0) b++; } @@ -4673,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; } /*========================================== @@ -4736,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 && @@ -4755,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; @@ -4815,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].amount<amount || sd->inventory_data[n] == NULL) return 1; @@ -4849,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) @@ -4960,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; @@ -5196,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 @@ -5433,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; @@ -5467,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]; @@ -5537,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? } @@ -5549,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); @@ -5706,7 +5704,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; @@ -5946,7 +5944,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; @@ -7945,7 +7943,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 @@ -8290,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;i<MAX_INVENTORY;i++){ + for(i = 0; i < sd->status.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++; @@ -8314,7 +8312,7 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src) } } else if(id > 0){ - for(i=0;i<MAX_INVENTORY;i++){ + for( i = 0; i < sd->status.inventorySize; i++) { if(sd->status.inventory[i].nameid == id && rnd()%10000 < per && ((type == 1 && !sd->status.inventory[i].equip) @@ -10145,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; } @@ -10353,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; } @@ -10505,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; @@ -10585,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; @@ -10759,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); } @@ -12337,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) { @@ -12739,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 8302279b1..bc2fd5a62 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); @@ -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/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 41f21cd72..3d3fba867 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; i<MAX_INVENTORY; i++) { + for (int 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) { @@ -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; i<MAX_INVENTORY; i++) { + int num = script_getnum(st, 2); + for(int 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) { @@ -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;i<MAX_INVENTORY;i++) { + for (int i = 0;i < sd->status.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; i<MAX_INVENTORY; i++) { + for (int i = 0; i < sd->status.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; i<MAX_INVENTORY; i++) { + for (int i = 0; i < sd->status.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;n<sd->inventory_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; @@ -15678,6 +15674,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("<message>"{, "<npc name>"{, <show_name>}}); @@ -16447,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; } @@ -16507,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; } @@ -23635,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) @@ -23643,7 +23662,7 @@ static BUILDIN(countbound) type = script_hasdata(st,2)?script_getnum(st,2):0; - for(i=0;i<MAX_INVENTORY;i++) { + for (int i = 0; i < sd->status.inventorySize; i++) { if(sd->status.inventory[i].nameid > 0 && ( (!type && sd->status.inventory[i].bound > 0) || (type && sd->status.inventory[i].bound == type) @@ -23689,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; } @@ -24790,6 +24810,100 @@ 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; +} + +// 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; +} + +// 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; +} + +// 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; +} + +// 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. * @@ -25194,6 +25308,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"), @@ -25528,6 +25643,11 @@ static void script_parse_builtin(void) BUILDIN_DEF(changecamera, "iii?"), BUILDIN_DEF(itempreview, "i"), + BUILDIN_DEF(enchantitem, "iii"), + 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 @@ -25567,8 +25687,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); @@ -25950,6 +26071,19 @@ 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("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 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;y<MAX_INVENTORY;y++) + int x = 0; + for (int y = 0; y < sd->status.inventorySize; y++) if( sd->status.inventory[y].nameid == id ) x+=sd->status.inventory[y].amount; if(x<qty*skill->dbs->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;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; 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; 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 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" diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index ea1aa85a4..9fdb68989 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); @@ -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); @@ -1572,6 +1584,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 +2020,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); @@ -2126,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); @@ -2630,8 +2650,14 @@ 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); +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); @@ -4072,6 +4098,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 +4384,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); @@ -5848,8 +5880,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); @@ -5884,12 +5916,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); @@ -6302,6 +6334,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); @@ -8078,8 +8112,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); @@ -8130,14 +8164,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_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) { diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 4b0054b28..d2c269bdd 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; @@ -1164,6 +1176,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; @@ -1718,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; @@ -2222,8 +2242,14 @@ 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; + 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; @@ -4868,6 +4894,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; @@ -7551,6 +7579,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; @@ -7785,6 +7825,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; @@ -8339,8 +8381,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; @@ -8843,8 +8891,14 @@ 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; + 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; @@ -11489,6 +11543,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 a900af716..050050ee1 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) }, @@ -606,6 +612,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) }, @@ -883,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) }, @@ -1135,7 +1145,10 @@ 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) }, /* cmdline_interface */ { HP_POP(cmdline->init, HP_cmdline_init) }, { HP_POP(cmdline->final, HP_cmdline_final) }, @@ -2492,6 +2505,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 af1f11fe2..32196d061 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); @@ -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) { @@ -15184,6 +15340,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 +21023,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 +21041,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); @@ -22404,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) { @@ -22430,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) { @@ -28965,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) { @@ -28991,6 +29277,59 @@ 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___; +} +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; @@ -58696,10 +59035,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; @@ -58714,7 +59053,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); @@ -59178,11 +59517,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; @@ -59197,7 +59536,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); @@ -59232,11 +59571,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; @@ -59251,7 +59590,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); @@ -64804,6 +65143,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; @@ -87920,11 +88286,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; @@ -87939,7 +88305,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); @@ -88619,11 +88985,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; @@ -88638,7 +89004,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); @@ -88646,10 +89012,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; @@ -88664,7 +89030,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); @@ -88698,11 +89064,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; @@ -88717,7 +89083,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); |