diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/login/lclif.c | 2 | ||||
-rw-r--r-- | src/login/login.c | 104 | ||||
-rw-r--r-- | src/login/login.h | 20 | ||||
-rw-r--r-- | src/map/clif.c | 56 | ||||
-rw-r--r-- | src/map/map.c | 2 | ||||
-rw-r--r-- | src/map/map.h | 2 | ||||
-rw-r--r-- | src/map/mob.c | 2 | ||||
-rw-r--r-- | src/map/mob.h | 8 | ||||
-rw-r--r-- | src/map/npc.c | 26 | ||||
-rw-r--r-- | src/map/npc.h | 3 | ||||
-rw-r--r-- | src/map/packets.h | 74 | ||||
-rw-r--r-- | src/map/packets_keys.h | 14 | ||||
-rw-r--r-- | src/map/script.c | 132 | ||||
-rw-r--r-- | src/map/script.h | 2 | ||||
-rw-r--r-- | src/map/status.c | 12 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 28 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc | 52 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc | 13 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 347 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 1 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 26 |
22 files changed, 844 insertions, 86 deletions
diff --git a/src/login/lclif.c b/src/login/lclif.c index f32538610..47b2526c4 100644 --- a/src/login/lclif.c +++ b/src/login/lclif.c @@ -284,7 +284,7 @@ bool lclif_send_server_list(struct login_session_data *sd) packet->server_list[n].ip = htonl((subnet_char_ip) ? subnet_char_ip : server[i].ip); packet->server_list[n].port = sockt->ntows(htons(server[i].port)); // [!] LE byte order here [!] safestrncpy(packet->server_list[n].name, server[i].name, 20); - packet->server_list[n].usercount = server[i].users; + packet->server_list[n].usercount = login->convert_users_to_colors(server[i].users); if (server[i].type == CST_PAYING && sd->expiration_time > time(NULL)) packet->server_list[n].property = CST_NORMAL; diff --git a/src/login/login.c b/src/login/login.c index ae584206f..3db9558b8 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1604,7 +1604,7 @@ bool login_config_read_account(const char *filename, struct config_t *config, bo /** * Frees login->config->client_hash_nodes **/ -void clear_client_hash_nodes(void) +void login_clear_client_hash_nodes(void) { struct client_hash_node *node = login->config->client_hash_nodes; @@ -1618,7 +1618,7 @@ void clear_client_hash_nodes(void) } /** - * Reads information from login_configuration.permission.hash.md5_hashes. + * Reads information from login_configuration.permission.hash.md5_hashes (unused function) * * @param setting The setting to read from. */ @@ -1627,7 +1627,7 @@ void login_config_set_md5hash(struct config_setting_t *setting) int i; int count = libconfig->setting_length(setting); - clear_client_hash_nodes(); + login->clear_client_hash_nodes(); // There's no need to parse if it's disabled or if there's no list if (count <= 0 || !login->config->client_hash_check) @@ -1702,7 +1702,7 @@ bool login_config_read_permission_hash(const char *filename, struct config_t *co libconfig->setting_lookup_bool_real(setting, "enabled", &login->config->client_hash_check); if ((setting = libconfig->lookup(config, "login_configuration/permission/hash/MD5_hashes")) != NULL) - login_config_set_md5hash(setting); + login->config_set_md5hash(setting); return true; } @@ -1710,7 +1710,7 @@ bool login_config_read_permission_hash(const char *filename, struct config_t *co /** * Clears login->config->dnsbl_servers, freeing any allocated memory. */ -void clear_dnsbl_servers(void) +void login_clear_dnsbl_servers(void) { while (VECTOR_LENGTH(login->config->dnsbl_servers) > 0) { aFree(&VECTOR_POP(login->config->dnsbl_servers)); @@ -1728,7 +1728,7 @@ void login_config_set_dnsbl_servers(struct config_setting_t *setting) int i; int count = libconfig->setting_length(setting); - clear_dnsbl_servers(); + login->clear_dnsbl_servers(); // There's no need to parse if it's disabled if (count <= 0 || !login->config->use_dnsbl) @@ -1772,7 +1772,7 @@ bool login_config_read_permission_blacklist(const char *filename, struct config_ libconfig->setting_lookup_bool_real(setting, "enabled", &login->config->use_dnsbl); if ((setting = libconfig->lookup(config, "login_configuration/permission/DNS_blacklist/dnsbl_servers")) != NULL) - login_config_set_dnsbl_servers(setting); + login->config_set_dnsbl_servers(setting); return true; } @@ -1806,15 +1806,47 @@ bool login_config_read_permission(const char *filename, struct config_t *config, libconfig->setting_lookup_bool_real(setting, "check_client_version", &login->config->check_client_version); libconfig->setting_lookup_uint32(setting, "client_version_to_connect", &login->config->client_version_to_connect); - if (!login_config_read_permission_hash(filename, config, imported)) + if (!login->config_read_permission_hash(filename, config, imported)) retval = false; - if (!login_config_read_permission_blacklist(filename, config, imported)) + if (!login->config_read_permission_blacklist(filename, config, imported)) retval = false; return retval; } /** + * Reads 'login_configuration.users_count' and initializes required variables. + * + * @param filename Path to configuration file (used in error and warning messages). + * @param config The current config being parsed. + * @param imported Whether the current config is imported from another file. + * + * @retval false in case of error. + */ +bool login_config_read_users(const char *filename, struct config_t *config, bool imported) +{ + struct config_setting_t *setting = NULL; + bool retval = true; + + nullpo_retr(false, filename); + nullpo_retr(false, config); + + if ((setting = libconfig->lookup(config, "login_configuration/users_count")) == NULL) { + if (imported) + return true; + ShowError("login_config_read: login_configuration/users_count was not found in %s!\n", filename); + return false; + } + + libconfig->setting_lookup_bool_real(setting, "send_user_count_description", &login->config->send_user_count_description); + libconfig->setting_lookup_uint32(setting, "low", &login->config->users_low); + libconfig->setting_lookup_uint32(setting, "medium", &login->config->users_medium); + libconfig->setting_lookup_uint32(setting, "high", &login->config->users_high); + + return retval; +} + +/** * Reads the 'login-config' configuration file and initializes required variables. * * @param filename Path to configuration file. @@ -1833,15 +1865,17 @@ bool login_config_read(const char *filename, bool imported) if (!libconfig->load_file(&config, filename)) return false; // Error message is already shown by libconfig->load_file - if (!login_config_read_inter(filename, &config, imported)) + if (!login->config_read_inter(filename, &config, imported)) retval = false; - if (!login_config_read_console(filename, &config, imported)) + if (!login->config_read_console(filename, &config, imported)) retval = false; - if (!login_config_read_log(filename, &config, imported)) + if (!login->config_read_log(filename, &config, imported)) retval = false; - if (!login_config_read_account(filename, &config, imported)) + if (!login->config_read_account(filename, &config, imported)) retval = false; - if (!login_config_read_permission(filename, &config, imported)) + if (!login->config_read_permission(filename, &config, imported)) + retval = false; + if (!login->config_read_users(filename, &config, imported)) retval = false; if (!loginlog_config_read("conf/common/inter-server.conf", imported)) // Only inter-server @@ -1866,6 +1900,30 @@ bool login_config_read(const char *filename, bool imported) return retval; } +/** + * Convert users count to colors. + * + * @param users Actual users count. + * + * @retval users count or color id. + **/ +uint16 login_convert_users_to_colors(uint16 users) +{ +#if PACKETVER >= 20170726 + if (!login->config->send_user_count_description) + return 4; + if (users <= login->config->users_low) + return 0; + else if (users <= login->config->users_medium) + return 1; + else if (users <= login->config->users_high) + return 2; + return 3; +#else + return users; +#endif +} + //-------------------------------------- // Function called at exit of the server //-------------------------------------- @@ -1877,8 +1935,8 @@ int do_final(void) HPM->event(HPET_FINAL); - clear_client_hash_nodes(); - clear_dnsbl_servers(); + login->clear_client_hash_nodes(); + login->clear_dnsbl_servers(); login_log(0, "login server", 100, "login server shutdown"); @@ -2168,6 +2226,20 @@ void login_defaults(void) { login->config_set_defaults = login_config_set_defaults; login->config_read = login_config_read; + login->config_read_inter = login_config_read_inter; + login->config_read_console = login_config_read_console; + login->config_read_log = login_config_read_log; + login->config_read_account = login_config_read_account; + login->config_read_permission = login_config_read_permission; + login->config_read_permission_hash = login_config_read_permission_hash; + login->config_read_permission_blacklist = login_config_read_permission_blacklist; + login->config_read_users = login_config_read_users; + login->config_set_dnsbl_servers = login_config_set_dnsbl_servers; + + login->clear_dnsbl_servers = login_clear_dnsbl_servers; + login->clear_client_hash_nodes = login_clear_client_hash_nodes; + login->config_set_md5hash = login_config_set_md5hash; + login->convert_users_to_colors = login_convert_users_to_colors; login->LOGIN_CONF_NAME = NULL; login->NET_CONF_NAME = NULL; } diff --git a/src/login/login.h b/src/login/login.h index 5632e6529..d5c9972c0 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -32,6 +32,8 @@ struct mmo_account; struct AccountDB; +struct config_t; +struct config_setting_t; enum E_LOGINSERVER_ST { @@ -119,6 +121,11 @@ struct Login_Config { bool use_dnsbl; ///< dns blacklist blocking ? VECTOR_DECL(char *) dnsbl_servers; ///< dnsbl servers + bool send_user_count_description; + uint32 users_low; + uint32 users_medium; + uint32 users_high; + bool client_hash_check; ///< flags for checking client md5 // TODO: VECTOR candidate struct client_hash_node *client_hash_nodes; ///< linked list containg md5 hash for each gm group @@ -209,6 +216,19 @@ struct login_interface { void (*parse_request_connection) (int fd, struct login_session_data* sd, const char *ip, uint32 ipl); void (*config_set_defaults) (void); bool (*config_read) (const char *filename, bool included); + bool (*config_read_inter) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_console) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_log) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_account) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_permission) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_permission_hash) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_permission_blacklist) (const char *filename, struct config_t *config, bool imported); + bool (*config_read_users) (const char *filename, struct config_t *config, bool imported); + void (*clear_dnsbl_servers) (void); + void (*config_set_dnsbl_servers) (struct config_setting_t *setting); + void (*clear_client_hash_nodes) (void); + void (*config_set_md5hash) (struct config_setting_t *setting); + uint16 (*convert_users_to_colors) (uint16 users); char *LOGIN_CONF_NAME; char *NET_CONF_NAME; ///< Network configuration filename }; diff --git a/src/map/clif.c b/src/map/clif.c index 088c92ea8..4dc36be6d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -293,7 +293,11 @@ unsigned char clif_bl_type(struct block_list *bl) case BL_NPC: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); +#if PACKETVER >= 20170726 + return CLUT_EVENT; +#else return pc->db_checkid(vd->class) ? CLUT_PC : CLUT_EVENT; +#endif case BL_PET: vd = status->get_viewdata(bl); nullpo_retr(CLUT_NPC, vd); @@ -1067,14 +1071,17 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu #endif #if PACKETVER >= 20120221 if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) { - const struct mob_data *md = BL_UCCAST(BL_MOB, bl); p.maxHP = status_get_max_hp(bl); p.HP = status_get_hp(bl); - p.isBoss = (md->spawn != NULL && md->spawn->state.boss) ? 1 : 0; } else { p.maxHP = -1; p.HP = -1; - p.isBoss = 0; + } + if (bl->type == BL_MOB) { + const struct mob_data *md = BL_UCCAST(BL_MOB, bl); + p.isBoss = (md->spawn != NULL) ? md->spawn->state.boss : BTYPE_NONE; + } else { + p.isBoss = BTYPE_NONE; } #endif #if PACKETVER >= 20150513 @@ -1216,14 +1223,17 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { #endif #if PACKETVER >= 20120221 if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) { - const struct mob_data *md = BL_UCCAST(BL_MOB, bl); p.maxHP = status_get_max_hp(bl); p.HP = status_get_hp(bl); - p.isBoss = (md->spawn != NULL && md->spawn->state.boss) ? 1 : 0; } else { p.maxHP = -1; p.HP = -1; - p.isBoss = 0; + } + if (bl->type == BL_MOB) { + const struct mob_data *md = BL_UCCAST(BL_MOB, bl); + p.isBoss = (md->spawn != NULL) ? md->spawn->state.boss : BTYPE_NONE; + } else { + p.isBoss = BTYPE_NONE; } #endif #if PACKETVER >= 20150513 @@ -1315,14 +1325,17 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, #endif #if PACKETVER >= 20120221 if (battle_config.show_monster_hp_bar && bl->type == BL_MOB && status_get_hp(bl) < status_get_max_hp(bl)) { - const struct mob_data *md = BL_UCCAST(BL_MOB, bl); p.maxHP = status_get_max_hp(bl); p.HP = status_get_hp(bl); - p.isBoss = (md->spawn != NULL && md->spawn->state.boss) ? 1 : 0; } else { p.maxHP = -1; p.HP = -1; - p.isBoss = 0; + } + if (bl->type == BL_MOB) { + const struct mob_data *md = BL_UCCAST(BL_MOB, bl); + p.isBoss = (md->spawn != NULL) ? md->spawn->state.boss : BTYPE_NONE; + } else { + p.isBoss = BTYPE_NONE; } #endif #if PACKETVER >= 20150513 @@ -3332,17 +3345,22 @@ void clif_changelook(struct block_list *bl,int type,int val) #if PACKETVER < 4 clif->sendlook(bl, bl->id, type, val, 0, target); #else - if(type == LOOK_WEAPON || type == LOOK_SHIELD) { - nullpo_retv(vd); - type = LOOK_WEAPON; - val = vd->weapon; - val2 = vd->shield; - } - if (clif->isdisguised(bl)) { - clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); - clif->sendlook(bl, -bl->id, type, val, val2, SELF); + if (bl->type != BL_NPC) { + if(type == LOOK_WEAPON || type == LOOK_SHIELD) { + nullpo_retv(vd); + type = LOOK_WEAPON; + val = vd->weapon; + val2 = vd->shield; + } + if (clif->isdisguised(bl)) { + clif->sendlook(bl, bl->id, type, val, val2, AREA_WOS); + clif->sendlook(bl, -bl->id, type, val, val2, SELF); + } else { + clif->sendlook(bl, bl->id, type, val, val2, target); + } } else { - clif->sendlook(bl, bl->id, type, val, val2, target); + struct npc_data *nd = BL_UCAST(BL_NPC, bl); + npc->refresh(nd); } #endif } diff --git a/src/map/map.c b/src/map/map.c index ff5c2aafd..5a647625f 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1840,7 +1840,7 @@ void map_addiddb(struct block_list *bl) struct mob_data *md = BL_UCAST(BL_MOB, bl); idb_put(map->mobid_db,bl->id,bl); - if( md->state.boss ) + if (md->state.boss == BTYPE_MVP) idb_put(map->bossid_db, bl->id, bl); } diff --git a/src/map/map.h b/src/map/map.h index 3221c73cd..5835b5abc 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -519,7 +519,7 @@ struct spawn_data { //0: Normal mob | 1: Standard summon, attacks mobs //2: Alchemist Marine Sphere | 3: Alchemist Summon Flora | 4: Summon Zanzou unsigned int dynamic : 1; ///< Whether this data is indexed by a map's dynamic mob list - unsigned int boss : 1; ///< 0: Non-boss monster | 1: Boss monster + uint8 boss; ///< 0: Non-boss monster | 1: Boss monster | 2: MVP } state; char name[NAME_LENGTH], eventname[EVENT_NAME_LENGTH]; //Name/event }; diff --git a/src/map/mob.c b/src/map/mob.c index 822b84bf4..208617b5d 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2686,7 +2686,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { return 5; // Note: Actually, it's 4. Oh well... // MvP tomb [GreenBox] - if (battle_config.mvp_tomb_enabled && md->spawn->state.boss && map->list[md->bl.m].flag.notomb != 1) + if (battle_config.mvp_tomb_enabled && md->spawn->state.boss == BTYPE_MVP && map->list[md->bl.m].flag.notomb != 1) mob->mvptomb_create(md, mvp_sd ? mvp_sd->status.name : NULL, time(NULL)); if( !rebirth ) { diff --git a/src/map/mob.h b/src/map/mob.h index 7f2accedf..83e022899 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -69,6 +69,12 @@ struct hplugin_data_store; // Disable this to make monsters not do any path search when looking for a target (old behavior). #define ACTIVEPATHSEARCH +enum e_bosstype { + BTYPE_NONE = 0, + BTYPE_BOSS = 1, + BTYPE_MVP = 2, +}; + //Mob skill states. enum MobSkillState { MSS_ANY = -1, @@ -181,10 +187,10 @@ struct mob_data { unsigned int spotted: 1; unsigned int npc_killmonster: 1; //for new killmonster behavior unsigned int rebirth: 1; // NPC_Rebirth used - unsigned int boss : 1; enum MobSkillState skillstate; unsigned char steal_flag; //number of steal tries (to prevent steal exploit on mobs with few items) [Lupus] unsigned char attacked_count; //For rude attacked. + uint8 boss; int provoke_flag; // Celest } state; struct guardian_data* guardian_data; diff --git a/src/map/npc.c b/src/map/npc.c index ecf7f878f..0702b2525 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -114,6 +114,8 @@ bool npc_db_checkid(int id) return true; if (id >= MAX_NPC_CLASS2_START && id < MAX_NPC_CLASS2_END) // Second range return true; + if (pc->db_checkid(id)) + return true; // Anything else is invalid return false; } @@ -2706,6 +2708,7 @@ struct npc_data *npc_create_npc(enum npc_subtype subtype, int m, int x, int y, u nd->area_size = AREA_SIZE + 1; nd->class_ = class_; nd->speed = 200; + nd->vd.class = 0; return nd; } @@ -3656,6 +3659,18 @@ void npc_setclass(struct npc_data* nd, short class_) { clif->spawn(&nd->bl);// fade in } +void npc_refresh(struct npc_data* nd) +{ + nullpo_retv(nd); + + if (map->list[nd->bl.m].users) { + // using here CLR_TRICKDEAD because other flags show effects. + // probably need use other flag or other way to refresh npc. + clif->clearunit_area(&nd->bl, CLR_TRICKDEAD); // fade out + clif->spawn(&nd->bl); // fade in + } +} + // @commands (script based) int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const char* message, const char* eventname) { @@ -3843,7 +3858,12 @@ const char *npc_parse_mob(const char *w1, const char *w2, const char *w3, const memset(&mobspawn, 0, sizeof(struct spawn_data)); - mobspawn.state.boss = (strcmp(w2,"boss_monster") == 0 ? 1 : 0); + if (strcmp(w2, "boss_monster") == 0) + mobspawn.state.boss = BTYPE_MVP; + else if (strcmp(w2, "miniboss_monster") == 0) + mobspawn.state.boss = BTYPE_BOSS; + else + mobspawn.state.boss = BTYPE_NONE; // w1=<map name>,<x>,<y>,<xs>,<ys> // w3=<mob name>{,<mob level>} @@ -4662,7 +4682,7 @@ int npc_parsesrcfile(const char* filepath, bool runOnInit) { { p = npc->parse_duplicate(w1,w2,w3,w4, p, buffer, filepath, (runOnInit?NPO_ONINIT:NPO_NONE), &success); } - else if( (strcmp(w2,"monster") == 0 || strcmp(w2,"boss_monster") == 0) ) + else if (strcmp(w2,"monster") == 0 || strcmp(w2,"boss_monster") == 0 || strcmp(w2,"miniboss_monster") == 0) { p = npc->parse_mob(w1, w2, w3, w4, p, buffer, filepath, &success); } @@ -4994,7 +5014,6 @@ int do_init_npc(bool minimal) { npc_viewdb[i].class = i; for( i = MAX_NPC_CLASS2_START; i < MAX_NPC_CLASS2_END; i++ ) npc_viewdb2[i - MAX_NPC_CLASS2_START].class = i; - npc->ev_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, EVENT_NAME_LENGTH); npc->ev_label_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, NAME_LENGTH); npc->name_db = strdb_alloc(DB_OPT_BASE, NAME_LENGTH); @@ -5189,4 +5208,5 @@ void npc_defaults(void) { npc->market_delfromsql = npc_market_delfromsql; npc->market_delfromsql_sub = npc_market_delfromsql_sub; npc->db_checkid = npc_db_checkid; + npc->refresh = npc_refresh; } diff --git a/src/map/npc.h b/src/map/npc.h index 3bd11d536..8bb38f252 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -70,7 +70,7 @@ struct npc_parse; struct npc_data { struct block_list bl; struct unit_data *ud; - struct view_data *vd; + struct view_data vd; unsigned int option; struct npc_data *master_nd; short class_; @@ -309,6 +309,7 @@ struct npc_interface { void (*market_delfromsql) (struct npc_data *nd, unsigned short index); void (*market_delfromsql_sub) (const char *npcname, unsigned short index); bool (*db_checkid) (const int id); + void (*refresh) (struct npc_data* nd); /** * For the Secure NPC Timeout option (check config/Secure.h) [RR] **/ diff --git a/src/map/packets.h b/src/map/packets.h index e9d895440..3fcf1648a 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -10669,4 +10669,78 @@ packet(0x96e,-1,clif->ackmergeitems); packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME #endif +// 2017-10-25eRagexeRE +#if PACKETVER == 20171025 +// shuffle packets + packet(0x0202,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x022d,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x023b,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0281,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x035f,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0360,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0361,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0362,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x0363,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x0364,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x0365,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0368,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0369,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x0436,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0437,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND + packet(0x07e4,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x07ec,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0802,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x0817,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0835,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x083c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x08a2,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x096a,6,clif->pGetCharNameRequest,2); // CZ_REQNAME +#endif + +// 2017-11-01bRagexeRE +#if PACKETVER == 20171101 +// shuffle packets + packet(0x022d,36,clif->pStoragePassword,0); // CZ_ACK_STORE_PASSWORD + packet(0x0368,19,clif->pWantToConnection,2,6,10,14,18); // CZ_ENTER + packet(0x0369,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15); // CZ_SEARCH_STORE_INFO + packet(0x0438,6,clif->pTickSend,2); // CZ_REQUEST_TIME + packet(0x0835,6,clif->pDropItem,2,4); // CZ_ITEM_THROW + packet(0x085b,5,clif->pHomMenu,2,4); // CZ_COMMAND_MER + packet(0x0860,6,clif->pGetCharNameRequest,2); // CZ_REQNAME + packet(0x086c,10,clif->pUseSkillToId,2,4,6); // CZ_USE_SKILL + packet(0x0872,26,clif->pFriendsListAdd,2); // CZ_ADD_FRIENDS + packet(0x0876,5,clif->pChangeDir,2,4); // CZ_CHANGE_DIRECTION + packet(0x0886,8,clif->pDull/*,XXX*/); // CZ_JOIN_BATTLE_FIELD + packet(0x088e,6,clif->pReqClickBuyingStore,2); // CZ_REQ_CLICK_TO_BUYING_STORE + packet(0x0890,2,clif->pSearchStoreInfoNextPage,0); // CZ_SEARCH_STORE_INFO_NEXT_PAGE + packet(0x0895,4,clif->pDull/*,XXX*/); // CZ_GANGSI_RANK + packet(0x0899,26,clif->pPartyInvite2,2); // CZ_PARTY_JOIN_REQ + packet(0x089b,-1,clif->pReqOpenBuyingStore,2,4,8,9,89); // CZ_REQ_OPEN_BUYING_STORE + packet(0x089c,18,clif->pPartyBookingRegisterReq,2,4); // CZ_PARTY_BOOKING_REQ_REGISTER + packet(0x08a0,8,clif->pMoveFromKafra,2,4); // CZ_MOVE_ITEM_FROM_STORE_TO_BODY + packet(0x08ab,-1,clif->pItemListWindowSelected,2,4,8); // CZ_ITEMLISTWIN_RES + packet(0x08ad,12,clif->pSearchStoreInfoListItemClick,2,6,10); // CZ_SSILIST_ITEM_CLICK + packet(0x091b,8,clif->pMoveToKafra,2,4); // CZ_MOVE_ITEM_FROM_BODY_TO_STORE + packet(0x0939,5,clif->pWalkToXY,2); // CZ_REQUEST_MOVE + packet(0x094a,2,clif->pReqCloseBuyingStore,0); // CZ_REQ_CLOSE_BUYING_STORE + packet(0x094d,6,clif->pSolveCharName,2); // CZ_REQNAME_BYGID + packet(0x0952,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10); // CZ_USE_SKILL_TOGROUND_WITHTALKBOX + packet(0x0957,7,clif->pActionRequest,2,6); // CZ_REQUEST_ACT + packet(0x095a,-1,clif->pReqTradeBuyingStore,2,4,8,12); // CZ_REQ_TRADE_BUYING_STORE + packet(0x0962,6,clif->pTakeItem,2); // CZ_ITEM_PICKUP + packet(0x0966,10,clif->pUseSkillToPos,2,4,6,8); // CZ_USE_SKILL_TOGROUND +#endif + +// 2017-11-01bRagexeRE +#if PACKETVER >= 20171101 +// new packets + packet(0x0ae1,28); +#endif + #endif /* MAP_PACKETS_H */ diff --git a/src/map/packets_keys.h b/src/map/packets_keys.h index 85796813a..005c3790b 100644 --- a/src/map/packets_keys.h +++ b/src/map/packets_keys.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2013-2015 Hercules Dev Team + * Copyright (C) 2013-2017 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 @@ -2057,7 +2057,7 @@ packetKeys(0x03FA5A97,0x20B802D5,0x339F1977); #endif -// 2017-06-07bRagexeRE +// 2017-06-07bRagexeRE, 2017-06-07cRagexeRE #if PACKETVER == 20170607 packetKeys(0x50564ACD,0x79CA4E15,0x405F4894); #endif @@ -2152,6 +2152,16 @@ packetKeys(0x2CAA109C,0x158C1EC2,0x7A5E58F3); #endif +// 2017-10-25bRagexeRE, 2017-10-25cRagexeRE, 2017-10-25dRagexeRE, 2017-10-25eRagexeRE +#if PACKETVER == 20171025 + packetKeys(0x165C565C,0x565C565C,0x565C565C); +#endif + +// 2017-11-01bRagexeRE +#if PACKETVER == 20171101 + packetKeys(0x7056317F,0x7EEE0589,0x02672373); +#endif + #if defined(OBFUSCATIONKEY1) && defined(OBFUSCATIONKEY2) && defined(OBFUSCATIONKEY3) packetKeys(OBFUSCATIONKEY1,OBFUSCATIONKEY2,OBFUSCATIONKEY3); diff --git a/src/map/script.c b/src/map/script.c index d2101d21f..5773457a7 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14270,31 +14270,36 @@ BUILDIN(setequipoption) if (equip_index > 0 && equip_index <= ARRAYLENGTH(script->equip)) { if ((i = pc->checkequip(sd, script->equip[equip_index - 1])) == -1) { - ShowError("buildin_setequipoptioninfo: No equipment is equipped in the given index %d.\n", equip_index); + ShowError("buildin_setequipoption: No equipment is equipped in the given index %d.\n", equip_index); script_pushint(st, 0); return false; } } else { - ShowError("buildin_setequipoptioninfo: Invalid equipment index %d provided.\n", equip_index); + ShowError("buildin_setequipoption: Invalid equipment index %d provided.\n", equip_index); script_pushint(st, 0); return false; } if (sd->status.inventory[i].nameid != 0) { - - if ((ito = itemdb->option_exists(opt_index)) == NULL) { - script_pushint(st, 0); - ShowError("buildin_setequipotion: Option index %d does not exist!\n", opt_index); - return false; - } else if (value < -INT16_MAX || value > INT16_MAX) { - script_pushint(st, 0); - ShowError("buildin_setequipotion: Option value %d exceeds maximum limit (%d to %d) for type!\n", value, -INT16_MAX, INT16_MAX); - return false; + if (opt_index == 0) { + // Remove the option + sd->status.inventory[i].option[slot-1].index = 0; + sd->status.inventory[i].option[slot-1].value = 0; + } else { + if ((ito = itemdb->option_exists(opt_index)) == NULL) { + script_pushint(st, 0); + ShowError("buildin_setequipotion: Option index %d does not exist!\n", opt_index); + return false; + } else if (value < -INT16_MAX || value > INT16_MAX) { + script_pushint(st, 0); + ShowError("buildin_setequipotion: Option value %d exceeds maximum limit (%d to %d) for type!\n", value, -INT16_MAX, INT16_MAX); + return false; + } + /* Add Option Index */ + sd->status.inventory[i].option[slot-1].index = ito->index; + /* Add Option Value */ + sd->status.inventory[i].option[slot-1].value = value; } - /* Add Option Index */ - sd->status.inventory[i].option[slot-1].index = ito->index; - /* Add Option Value */ - sd->status.inventory[i].option[slot-1].value = value; /* Unequip and simulate deletion of the item. */ pc->unequipitem(sd, i, PCUNEQUIPITEM_FORCE); // status calc will happen in pc->equipitem() below @@ -15866,11 +15871,12 @@ enum logmes_type { /*========================================== * Allows player to write logs (i.e. Bank NPC, etc) [Lupus] *------------------------------------------*/ -BUILDIN(logmes) { +BUILDIN(logmes) +{ const char *str = script_getstr(st, 2); struct map_session_data *sd = script->rid2sd(st); enum logmes_type type = LOGMES_NPC; - nullpo_retr(sd, false); + nullpo_retr(false, sd); if (script_hasdata(st, 3)) { type = script_getnum(st, 3); @@ -18211,6 +18217,8 @@ BUILDIN(setunitdata) case UDT_INTIMACY: case UDT_LIFETIME: case UDT_MERC_KILLCOUNT: + case UDT_ROBE: + case UDT_BODY2: setunitdata_check_min(4, 0); break; case UDT_MASTERAID: @@ -19149,6 +19157,40 @@ BUILDIN(setunitdata) case UDT_DMOTION: nd->status.dmotion = (unsigned short) val; break; + case UDT_SEX: + nd->vd.sex = (char)val; + npc->refresh(nd); + break; + case UDT_HAIRSTYLE: + clif->changelook(bl, LOOK_HAIR, val); + break; + case UDT_HAIRCOLOR: + clif->changelook(bl, LOOK_HAIR_COLOR, val); + break; + case UDT_HEADBOTTOM: + clif->changelook(bl, LOOK_HEAD_BOTTOM, val); + break; + case UDT_HEADMIDDLE: + clif->changelook(bl, LOOK_HEAD_MID, val); + break; + case UDT_HEADTOP: + clif->changelook(bl, LOOK_HEAD_TOP, val); + break; + case UDT_CLOTHCOLOR: + clif->changelook(bl, LOOK_CLOTHES_COLOR, val); + break; + case UDT_SHIELD: + clif->changelook(bl, LOOK_SHIELD, val); + break; + case UDT_WEAPON: + clif->changelook(bl, LOOK_WEAPON, val); + break; + case UDT_ROBE: + clif->changelook(bl, LOOK_ROBE, val); + break; + case UDT_BODY2: + clif->changelook(bl, LOOK_BODY2, val); + break; default: ShowWarning("buildin_setunitdata: Invalid data type '%s' for NPC unit.\n", udtype); script_pushint(st, 0); @@ -19559,6 +19601,18 @@ BUILDIN(getunitdata) case UDT_AMOTION: script_pushint(st, nd->status.amotion); break; case UDT_ADELAY: script_pushint(st, nd->status.adelay); break; case UDT_DMOTION: script_pushint(st, nd->status.dmotion); break; + case UDT_SEX: script_pushint(st, nd->vd.sex); break; + case UDT_CLASS: script_pushint(st, nd->vd.class); break; + case UDT_HAIRSTYLE: script_pushint(st, nd->vd.hair_style); break; + case UDT_HAIRCOLOR: script_pushint(st, nd->vd.hair_color); break; + case UDT_HEADBOTTOM: script_pushint(st, nd->vd.head_bottom); break; + case UDT_HEADMIDDLE: script_pushint(st, nd->vd.head_mid); break; + case UDT_HEADTOP: script_pushint(st, nd->vd.head_top); break; + case UDT_CLOTHCOLOR: script_pushint(st, nd->vd.cloth_color); break; + case UDT_SHIELD: script_pushint(st, nd->vd.shield); break; + case UDT_WEAPON: script_pushint(st, nd->vd.weapon); break; + case UDT_ROBE: script_pushint(st, nd->vd.robe); break; + case UDT_BODY2: script_pushint(st, nd->vd.body_style); break; default: ShowWarning("buildin_getunitdata: Invalid data type '%s' for NPC unit.\n", udtype); script_pushint(st, 0); @@ -20446,15 +20500,18 @@ BUILDIN(questinfo) quest_id = script_getnum(st, 2); icon = script_getnum(st, 3); - #if PACKETVER >= 20120410 - if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) - icon = 9999; // Default to nothing if icon id is invalid. - #else - if(icon < 0 || icon > 7) - icon = 0; - else - icon = icon + 1; - #endif +#if PACKETVER >= 20170315 + if (icon < 0 || (icon > 10 && icon != 9999)) + icon = 9999; +#elif PACKETVER >= 20120410 + if (icon < 0 || (icon > 8 && icon != 9999) || icon == 7) + icon = 9999; // Default to nothing if icon id is invalid. +#else + if (icon < 0 || icon > 7) + icon = 0; + else + icon = icon + 1; +#endif qi.quest_id = quest_id; qi.icon = (unsigned char)icon; @@ -20648,15 +20705,18 @@ BUILDIN(showevent) } } - #if PACKETVER >= 20120410 - if(icon < 0 || (icon > 8 && icon != 9999) || icon == 7) - icon = 9999; // Default to nothing if icon id is invalid. - #else - if(icon < 0 || icon > 7) - icon = 0; - else - icon = icon + 1; - #endif +#if PACKETVER >= 20170315 + if (icon < 0 || (icon > 10 && icon != 9999)) + icon = 9999; +#elif PACKETVER >= 20120410 + if (icon < 0 || (icon > 8 && icon != 9999) || icon == 7) + icon = 9999; // Default to nothing if icon id is invalid. +#else + if (icon < 0 || icon > 7) + icon = 0; + else + icon = icon + 1; +#endif clif->quest_show_event(sd, &nd->bl, icon, color); return true; @@ -23505,7 +23565,7 @@ BUILDIN(dressroom) clif->dressroom_open(sd, 0); break; default: - ShowWarning("script:dressroom: unknown mode (%i).\n", mode); + ShowWarning("script:dressroom: unknown mode (%u).\n", mode); script_pushint(st, 0); return false; } diff --git a/src/map/script.h b/src/map/script.h index 283afa496..b2ab7510c 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -423,6 +423,8 @@ enum script_unit_data_types { UDT_LIFETIME, UDT_MERC_KILLCOUNT, UDT_STATPOINT, + UDT_ROBE, + UDT_BODY2, UDT_MAX }; diff --git a/src/map/status.c b/src/map/status.c index e0893aa36..ccd1e6b11 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6809,7 +6809,7 @@ struct view_data *status_get_viewdata(struct block_list *bl) case BL_PC: return &BL_UCAST(BL_PC, bl)->vd; case BL_MOB: return BL_UCAST(BL_MOB, bl)->vd; case BL_PET: return &BL_UCAST(BL_PET, bl)->vd; - case BL_NPC: return BL_UCAST(BL_NPC, bl)->vd; + case BL_NPC: return &BL_UCAST(BL_NPC, bl)->vd; case BL_HOM: return BL_UCAST(BL_HOM, bl)->vd; case BL_MER: return BL_UCAST(BL_MER, bl)->vd; case BL_ELEM: return BL_UCAST(BL_ELEM, bl)->vd; @@ -6927,10 +6927,14 @@ void status_set_viewdata(struct block_list *bl, int class_) case BL_NPC: { struct npc_data *nd = BL_UCAST(BL_NPC, bl); - if (vd != NULL) - nd->vd = vd; - else + if (vd != NULL) { + memcpy(&nd->vd, vd, sizeof(struct view_data)); + } else if (pc->db_checkid(class_)) { + memset(&nd->vd, 0, sizeof(struct view_data)); + nd->vd.class = class_; + } else { ShowError("status_set_viewdata (NPC): No view data for class %d (name=%s)\n", class_, nd->name); + } } break; case BL_HOM: //[blackhole89] diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index d6ce83912..9482e6c15 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -3848,6 +3848,32 @@ typedef void (*HPMHOOK_pre_login_config_set_defaults) (void); typedef void (*HPMHOOK_post_login_config_set_defaults) (void); typedef bool (*HPMHOOK_pre_login_config_read) (const char **filename, bool *included); typedef bool (*HPMHOOK_post_login_config_read) (bool retVal___, const char *filename, bool included); +typedef bool (*HPMHOOK_pre_login_config_read_inter) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_login_config_read_inter) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_login_config_read_console) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_login_config_read_console) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_login_config_read_log) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_login_config_read_log) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_login_config_read_account) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_login_config_read_account) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_login_config_read_permission) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_login_config_read_permission) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_login_config_read_permission_hash) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_login_config_read_permission_hash) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_login_config_read_permission_blacklist) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_login_config_read_permission_blacklist) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef bool (*HPMHOOK_pre_login_config_read_users) (const char **filename, struct config_t **config, bool *imported); +typedef bool (*HPMHOOK_post_login_config_read_users) (bool retVal___, const char *filename, struct config_t *config, bool imported); +typedef void (*HPMHOOK_pre_login_clear_dnsbl_servers) (void); +typedef void (*HPMHOOK_post_login_clear_dnsbl_servers) (void); +typedef void (*HPMHOOK_pre_login_config_set_dnsbl_servers) (struct config_setting_t **setting); +typedef void (*HPMHOOK_post_login_config_set_dnsbl_servers) (struct config_setting_t *setting); +typedef void (*HPMHOOK_pre_login_clear_client_hash_nodes) (void); +typedef void (*HPMHOOK_post_login_clear_client_hash_nodes) (void); +typedef void (*HPMHOOK_pre_login_config_set_md5hash) (struct config_setting_t **setting); +typedef void (*HPMHOOK_post_login_config_set_md5hash) (struct config_setting_t *setting); +typedef uint16 (*HPMHOOK_pre_login_convert_users_to_colors) (uint16 *users); +typedef uint16 (*HPMHOOK_post_login_convert_users_to_colors) (uint16 retVal___, uint16 users); #endif // LOGIN_LOGIN_H #ifdef CHAR_LOGINIF_H /* loginif */ typedef void (*HPMHOOK_pre_loginif_init) (void); @@ -5124,6 +5150,8 @@ typedef void (*HPMHOOK_pre_npc_market_delfromsql_sub) (const char **npcname, uns typedef void (*HPMHOOK_post_npc_market_delfromsql_sub) (const char *npcname, unsigned short index); typedef bool (*HPMHOOK_pre_npc_db_checkid) (const int *id); typedef bool (*HPMHOOK_post_npc_db_checkid) (bool retVal___, const int id); +typedef void (*HPMHOOK_pre_npc_refresh) (struct npc_data **nd); +typedef void (*HPMHOOK_post_npc_refresh) (struct npc_data *nd); typedef int (*HPMHOOK_pre_npc_secure_timeout_timer) (int *tid, int64 *tick, int *id, intptr_t *data); typedef int (*HPMHOOK_post_npc_secure_timeout_timer) (int retVal___, int tid, int64 tick, int id, intptr_t data); #endif // MAP_NPC_H diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index 57c1e0233..9c38c0c4c 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -376,6 +376,32 @@ struct { struct HPMHookPoint *HP_login_config_set_defaults_post; struct HPMHookPoint *HP_login_config_read_pre; struct HPMHookPoint *HP_login_config_read_post; + struct HPMHookPoint *HP_login_config_read_inter_pre; + struct HPMHookPoint *HP_login_config_read_inter_post; + struct HPMHookPoint *HP_login_config_read_console_pre; + struct HPMHookPoint *HP_login_config_read_console_post; + struct HPMHookPoint *HP_login_config_read_log_pre; + struct HPMHookPoint *HP_login_config_read_log_post; + struct HPMHookPoint *HP_login_config_read_account_pre; + struct HPMHookPoint *HP_login_config_read_account_post; + struct HPMHookPoint *HP_login_config_read_permission_pre; + struct HPMHookPoint *HP_login_config_read_permission_post; + struct HPMHookPoint *HP_login_config_read_permission_hash_pre; + struct HPMHookPoint *HP_login_config_read_permission_hash_post; + struct HPMHookPoint *HP_login_config_read_permission_blacklist_pre; + struct HPMHookPoint *HP_login_config_read_permission_blacklist_post; + struct HPMHookPoint *HP_login_config_read_users_pre; + struct HPMHookPoint *HP_login_config_read_users_post; + struct HPMHookPoint *HP_login_clear_dnsbl_servers_pre; + struct HPMHookPoint *HP_login_clear_dnsbl_servers_post; + struct HPMHookPoint *HP_login_config_set_dnsbl_servers_pre; + struct HPMHookPoint *HP_login_config_set_dnsbl_servers_post; + struct HPMHookPoint *HP_login_clear_client_hash_nodes_pre; + struct HPMHookPoint *HP_login_clear_client_hash_nodes_post; + struct HPMHookPoint *HP_login_config_set_md5hash_pre; + struct HPMHookPoint *HP_login_config_set_md5hash_post; + struct HPMHookPoint *HP_login_convert_users_to_colors_pre; + struct HPMHookPoint *HP_login_convert_users_to_colors_post; struct HPMHookPoint *HP_md5_string_pre; struct HPMHookPoint *HP_md5_string_post; struct HPMHookPoint *HP_md5_binary_pre; @@ -1049,6 +1075,32 @@ struct { int HP_login_config_set_defaults_post; int HP_login_config_read_pre; int HP_login_config_read_post; + int HP_login_config_read_inter_pre; + int HP_login_config_read_inter_post; + int HP_login_config_read_console_pre; + int HP_login_config_read_console_post; + int HP_login_config_read_log_pre; + int HP_login_config_read_log_post; + int HP_login_config_read_account_pre; + int HP_login_config_read_account_post; + int HP_login_config_read_permission_pre; + int HP_login_config_read_permission_post; + int HP_login_config_read_permission_hash_pre; + int HP_login_config_read_permission_hash_post; + int HP_login_config_read_permission_blacklist_pre; + int HP_login_config_read_permission_blacklist_post; + int HP_login_config_read_users_pre; + int HP_login_config_read_users_post; + int HP_login_clear_dnsbl_servers_pre; + int HP_login_clear_dnsbl_servers_post; + int HP_login_config_set_dnsbl_servers_pre; + int HP_login_config_set_dnsbl_servers_post; + int HP_login_clear_client_hash_nodes_pre; + int HP_login_clear_client_hash_nodes_post; + int HP_login_config_set_md5hash_pre; + int HP_login_config_set_md5hash_post; + int HP_login_convert_users_to_colors_pre; + int HP_login_convert_users_to_colors_post; int HP_md5_string_pre; int HP_md5_string_post; int HP_md5_binary_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 125c54a12..ba4b941a9 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -211,6 +211,19 @@ struct HookingPointData HookingPoints[] = { { HP_POP(login->parse_request_connection, HP_login_parse_request_connection) }, { HP_POP(login->config_set_defaults, HP_login_config_set_defaults) }, { HP_POP(login->config_read, HP_login_config_read) }, + { HP_POP(login->config_read_inter, HP_login_config_read_inter) }, + { HP_POP(login->config_read_console, HP_login_config_read_console) }, + { HP_POP(login->config_read_log, HP_login_config_read_log) }, + { HP_POP(login->config_read_account, HP_login_config_read_account) }, + { HP_POP(login->config_read_permission, HP_login_config_read_permission) }, + { HP_POP(login->config_read_permission_hash, HP_login_config_read_permission_hash) }, + { HP_POP(login->config_read_permission_blacklist, HP_login_config_read_permission_blacklist) }, + { HP_POP(login->config_read_users, HP_login_config_read_users) }, + { HP_POP(login->clear_dnsbl_servers, HP_login_clear_dnsbl_servers) }, + { HP_POP(login->config_set_dnsbl_servers, HP_login_config_set_dnsbl_servers) }, + { HP_POP(login->clear_client_hash_nodes, HP_login_clear_client_hash_nodes) }, + { HP_POP(login->config_set_md5hash, HP_login_config_set_md5hash) }, + { HP_POP(login->convert_users_to_colors, HP_login_convert_users_to_colors) }, /* md5_interface */ { HP_POP(md5->string, HP_md5_string) }, { HP_POP(md5->binary, HP_md5_binary) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 964d46b0a..0dbf2e5ae 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -4716,6 +4716,353 @@ bool HP_login_config_read(const char *filename, bool included) { } return retVal___; } +bool HP_login_config_read_inter(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_login_config_read_inter_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_inter_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_read_inter_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.login.config_read_inter(filename, config, imported); + } + if (HPMHooks.count.HP_login_config_read_inter_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_inter_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_read_inter_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_login_config_read_console(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_login_config_read_console_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_console_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_read_console_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.login.config_read_console(filename, config, imported); + } + if (HPMHooks.count.HP_login_config_read_console_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_console_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_read_console_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_login_config_read_log(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_login_config_read_log_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_log_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_read_log_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.login.config_read_log(filename, config, imported); + } + if (HPMHooks.count.HP_login_config_read_log_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_log_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_read_log_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_login_config_read_account(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_login_config_read_account_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_account_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_read_account_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.login.config_read_account(filename, config, imported); + } + if (HPMHooks.count.HP_login_config_read_account_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_account_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_read_account_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_login_config_read_permission(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_login_config_read_permission_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_permission_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_read_permission_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.login.config_read_permission(filename, config, imported); + } + if (HPMHooks.count.HP_login_config_read_permission_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_permission_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_read_permission_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_login_config_read_permission_hash(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_login_config_read_permission_hash_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_permission_hash_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_read_permission_hash_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.login.config_read_permission_hash(filename, config, imported); + } + if (HPMHooks.count.HP_login_config_read_permission_hash_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_permission_hash_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_read_permission_hash_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_login_config_read_permission_blacklist(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_login_config_read_permission_blacklist_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_permission_blacklist_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_read_permission_blacklist_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.login.config_read_permission_blacklist(filename, config, imported); + } + if (HPMHooks.count.HP_login_config_read_permission_blacklist_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_permission_blacklist_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_read_permission_blacklist_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +bool HP_login_config_read_users(const char *filename, struct config_t *config, bool imported) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_login_config_read_users_pre > 0) { + bool (*preHookFunc) (const char **filename, struct config_t **config, bool *imported); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_users_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_read_users_pre[hIndex].func; + retVal___ = preHookFunc(&filename, &config, &imported); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.login.config_read_users(filename, config, imported); + } + if (HPMHooks.count.HP_login_config_read_users_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *filename, struct config_t *config, bool imported); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_read_users_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_read_users_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename, config, imported); + } + } + return retVal___; +} +void HP_login_clear_dnsbl_servers(void) { + int hIndex = 0; + if (HPMHooks.count.HP_login_clear_dnsbl_servers_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_clear_dnsbl_servers_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_clear_dnsbl_servers_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.login.clear_dnsbl_servers(); + } + if (HPMHooks.count.HP_login_clear_dnsbl_servers_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_clear_dnsbl_servers_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_clear_dnsbl_servers_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_login_config_set_dnsbl_servers(struct config_setting_t *setting) { + int hIndex = 0; + if (HPMHooks.count.HP_login_config_set_dnsbl_servers_pre > 0) { + void (*preHookFunc) (struct config_setting_t **setting); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_set_dnsbl_servers_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_set_dnsbl_servers_pre[hIndex].func; + preHookFunc(&setting); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.login.config_set_dnsbl_servers(setting); + } + if (HPMHooks.count.HP_login_config_set_dnsbl_servers_post > 0) { + void (*postHookFunc) (struct config_setting_t *setting); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_set_dnsbl_servers_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_set_dnsbl_servers_post[hIndex].func; + postHookFunc(setting); + } + } + return; +} +void HP_login_clear_client_hash_nodes(void) { + int hIndex = 0; + if (HPMHooks.count.HP_login_clear_client_hash_nodes_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_clear_client_hash_nodes_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_clear_client_hash_nodes_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.login.clear_client_hash_nodes(); + } + if (HPMHooks.count.HP_login_clear_client_hash_nodes_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_clear_client_hash_nodes_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_clear_client_hash_nodes_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_login_config_set_md5hash(struct config_setting_t *setting) { + int hIndex = 0; + if (HPMHooks.count.HP_login_config_set_md5hash_pre > 0) { + void (*preHookFunc) (struct config_setting_t **setting); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_set_md5hash_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_config_set_md5hash_pre[hIndex].func; + preHookFunc(&setting); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.login.config_set_md5hash(setting); + } + if (HPMHooks.count.HP_login_config_set_md5hash_post > 0) { + void (*postHookFunc) (struct config_setting_t *setting); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_config_set_md5hash_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_config_set_md5hash_post[hIndex].func; + postHookFunc(setting); + } + } + return; +} +uint16 HP_login_convert_users_to_colors(uint16 users) { + int hIndex = 0; + uint16 retVal___ = 0; + if (HPMHooks.count.HP_login_convert_users_to_colors_pre > 0) { + uint16 (*preHookFunc) (uint16 *users); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_convert_users_to_colors_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_login_convert_users_to_colors_pre[hIndex].func; + retVal___ = preHookFunc(&users); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.login.convert_users_to_colors(users); + } + if (HPMHooks.count.HP_login_convert_users_to_colors_post > 0) { + uint16 (*postHookFunc) (uint16 retVal___, uint16 users); + for (hIndex = 0; hIndex < HPMHooks.count.HP_login_convert_users_to_colors_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_login_convert_users_to_colors_post[hIndex].func; + retVal___ = postHookFunc(retVal___, users); + } + } + return retVal___; +} /* md5_interface */ void HP_md5_string(const char *string, char *output) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 4bdc167f2..c3e6d5529 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3918,6 +3918,8 @@ struct { struct HPMHookPoint *HP_npc_market_delfromsql_sub_post; struct HPMHookPoint *HP_npc_db_checkid_pre; struct HPMHookPoint *HP_npc_db_checkid_post; + struct HPMHookPoint *HP_npc_refresh_pre; + struct HPMHookPoint *HP_npc_refresh_post; struct HPMHookPoint *HP_npc_secure_timeout_timer_pre; struct HPMHookPoint *HP_npc_secure_timeout_timer_post; struct HPMHookPoint *HP_nullpo_assert_report_pre; @@ -10117,6 +10119,8 @@ struct { int HP_npc_market_delfromsql_sub_post; int HP_npc_db_checkid_pre; int HP_npc_db_checkid_post; + int HP_npc_refresh_pre; + int HP_npc_refresh_post; int HP_npc_secure_timeout_timer_pre; int HP_npc_secure_timeout_timer_post; int HP_nullpo_assert_report_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 34b79bff8..15052b7f1 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2009,6 +2009,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(npc->market_delfromsql, HP_npc_market_delfromsql) }, { HP_POP(npc->market_delfromsql_sub, HP_npc_market_delfromsql_sub) }, { HP_POP(npc->db_checkid, HP_npc_db_checkid) }, + { HP_POP(npc->refresh, HP_npc_refresh) }, { HP_POP(npc->secure_timeout_timer, HP_npc_secure_timeout_timer) }, /* nullpo_interface */ { HP_POP(nullpo->assert_report, HP_nullpo_assert_report) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index d0d062f4e..69658949c 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -52089,6 +52089,32 @@ bool HP_npc_db_checkid(const int id) { } return retVal___; } +void HP_npc_refresh(struct npc_data *nd) { + int hIndex = 0; + if (HPMHooks.count.HP_npc_refresh_pre > 0) { + void (*preHookFunc) (struct npc_data **nd); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_refresh_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_npc_refresh_pre[hIndex].func; + preHookFunc(&nd); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.npc.refresh(nd); + } + if (HPMHooks.count.HP_npc_refresh_post > 0) { + void (*postHookFunc) (struct npc_data *nd); + for (hIndex = 0; hIndex < HPMHooks.count.HP_npc_refresh_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_npc_refresh_post[hIndex].func; + postHookFunc(nd); + } + } + return; +} int HP_npc_secure_timeout_timer(int tid, int64 tick, int id, intptr_t data) { int hIndex = 0; int retVal___ = 0; |