diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/plugins.c | 3 | ||||
-rw-r--r-- | src/common/timer.c | 6 | ||||
-rw-r--r-- | src/common/timer.h | 4 | ||||
-rw-r--r-- | src/map/atcommand.c | 85 | ||||
-rw-r--r-- | src/map/battle.c | 1330 | ||||
-rw-r--r-- | src/map/battle.h | 622 | ||||
-rw-r--r-- | src/map/charcommand.c | 11 | ||||
-rw-r--r-- | src/map/chat.c | 49 | ||||
-rw-r--r-- | src/map/chat.h | 26 | ||||
-rw-r--r-- | src/map/clif.c | 17 | ||||
-rw-r--r-- | src/map/map.c | 4 | ||||
-rw-r--r-- | src/map/map.h | 42 | ||||
-rw-r--r-- | src/map/mob.c | 11 | ||||
-rw-r--r-- | src/map/npc.c | 175 | ||||
-rw-r--r-- | src/map/party.c | 53 | ||||
-rw-r--r-- | src/map/party.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 2 | ||||
-rw-r--r-- | src/map/skill.c | 2 | ||||
-rw-r--r-- | src/map/status.c | 5 |
19 files changed, 919 insertions, 1530 deletions
diff --git a/src/common/plugins.c b/src/common/plugins.c index 76dfc5956..a2d4de73e 100644 --- a/src/common/plugins.c +++ b/src/common/plugins.c @@ -348,8 +348,7 @@ void plugins_init(void) export_symbol(addr_, SYMBOL_ADDR); // timers export_symbol(get_uptime, SYMBOL_GET_UPTIME); -// export_symbol(delete_timer, SYMBOL_DELETE_TIMER); - export_symbol(delete_timer_sub, SYMBOL_DELETE_TIMER); + export_symbol(delete_timer, SYMBOL_DELETE_TIMER); export_symbol(add_timer_func_list, SYMBOL_ADD_TIMER_FUNC_LIST); export_symbol(add_timer_interval, SYMBOL_ADD_TIMER_INTERVAL); export_symbol(add_timer, SYMBOL_ADD_TIMER); diff --git a/src/common/timer.c b/src/common/timer.c index 2a7dba676..15e50a05d 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -269,12 +269,10 @@ int add_timer_interval(unsigned int tick, TimerFunc func, int id, int data, int return tid; } -//int delete_timer(int id, TimerFunc func) -int delete_timer_sub(int id, TimerFunc func, const char* file, int line) +int delete_timer(int id, TimerFunc func) { if (id <= 0 || id >= timer_data_num) { - //ShowError("delete_timer error : no such timer %d (%08x(%s))\n", id, (int)func, search_timer_func_list(func)); - ShowError("delete_timer error : no such timer %d (%08x(%s)), invoked from %s:%d\n", id, (int)func, search_timer_func_list(func), file, line); + ShowError("delete_timer error : no such timer %d (%08x(%s))\n", id, (int)func, search_timer_func_list(func)); return -1; } if (timer_data[id].func != func) { diff --git a/src/common/timer.h b/src/common/timer.h index 24534de2a..b75cc6641 100644 --- a/src/common/timer.h +++ b/src/common/timer.h @@ -46,9 +46,7 @@ unsigned int gettick(void); int add_timer(unsigned int,TimerFunc f,int,int); int add_timer_interval(unsigned int tick, TimerFunc func, int id, int data, int interval); -//int delete_timer(int,TimerFunc f); -int delete_timer_sub(int,TimerFunc f, const char* file, int line); -#define delete_timer(id, f) delete_timer_sub(id, f, __FILE__, __LINE__) +int delete_timer(int,TimerFunc f); int addtick_timer(int tid,unsigned int tick); int settick_timer(int tid,unsigned int tick); diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 5b512a85c..c179451d8 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1977,23 +1977,13 @@ int atcommand_speed(const int fd, struct map_session_data* sd, const char* comma memset(atcmd_output, '\0', sizeof(atcmd_output)); - if (!message || !*message) { + if (!message || !*message || sscanf(message, "%d", &speed) < 1) { sprintf(atcmd_output, "Please, enter a speed value (usage: @speed <%d-%d>).", MIN_WALK_SPEED, MAX_WALK_SPEED); clif_displaymessage(fd, atcmd_output); return -1; } - speed = atoi(message); - if (speed < MIN_WALK_SPEED) - { - speed = MIN_WALK_SPEED; - } - else if (speed > MAX_WALK_SPEED) - { - speed = MAX_WALK_SPEED; - } - - sd->base_status.speed = speed; + sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED); status_calc_bl(&sd->bl, SCB_SPEED); clif_displaymessage(fd, msg_txt(8)); // Speed changed. return 0; @@ -2101,11 +2091,12 @@ int atcommand_hide(const int fd, struct map_session_data* sd, const char* comman *------------------------------------------*/ int atcommand_jobchange(const int fd, struct map_session_data* sd, const char* command, const char* message) { + //FIXME: redundancy, potentially wrong code, should use job_name() or similar instead of hardcoding the table int job = 0, upper = 0; nullpo_retr(-1, sd); - if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) { - + if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) + { int i, found = 0; const struct { char name[16]; int id; } jobs[] = { { "novice", 0 }, @@ -5073,37 +5064,35 @@ int atcommand_reloadbattleconf(const int fd, struct map_session_data* sd, const battle_config_read(BATTLE_CONF_FILENAME); - if (memcmp(&prev_config.item_rate_mvp, - &battle_config.item_rate_mvp, - sizeof(battle_config.item_rate_mvp)+ - sizeof(battle_config.item_rate_common)+ - sizeof(battle_config.item_rate_common_boss)+ - sizeof(battle_config.item_rate_card)+ - sizeof(battle_config.item_rate_card_boss)+ - sizeof(battle_config.item_rate_equip)+ - sizeof(battle_config.item_rate_equip_boss)+ - sizeof(battle_config.item_rate_heal)+ - sizeof(battle_config.item_rate_heal_boss)+ - sizeof(battle_config.item_rate_use)+ - sizeof(battle_config.item_rate_use_boss)+ - sizeof(battle_config.item_rate_treasure)+ - sizeof(battle_config.item_rate_adddrop)+ - sizeof(battle_config.logarithmic_drops)+ - sizeof(battle_config.item_drop_common_min)+ - sizeof(battle_config.item_drop_common_max)+ - sizeof(battle_config.item_drop_card_min)+ - sizeof(battle_config.item_drop_card_max)+ - sizeof(battle_config.item_drop_equip_min)+ - sizeof(battle_config.item_drop_equip_max)+ - sizeof(battle_config.item_drop_mvp_min)+ - sizeof(battle_config.item_drop_mvp_max)+ - sizeof(battle_config.item_drop_heal_min)+ - sizeof(battle_config.item_drop_heal_max)+ - sizeof(battle_config.item_drop_use_min)+ - sizeof(battle_config.item_drop_use_max)+ - sizeof(battle_config.item_drop_treasure_min)+ - sizeof(battle_config.item_drop_treasure_max) - ) != 0) + if( prev_config.item_rate_mvp != battle_config.item_rate_mvp + || prev_config.item_rate_common != battle_config.item_rate_common + || prev_config.item_rate_common_boss != battle_config.item_rate_common_boss + || prev_config.item_rate_card != battle_config.item_rate_card + || prev_config.item_rate_card_boss != battle_config.item_rate_card_boss + || prev_config.item_rate_equip != battle_config.item_rate_equip + || prev_config.item_rate_equip_boss != battle_config.item_rate_equip_boss + || prev_config.item_rate_heal != battle_config.item_rate_heal + || prev_config.item_rate_heal_boss != battle_config.item_rate_heal_boss + || prev_config.item_rate_use != battle_config.item_rate_use + || prev_config.item_rate_use_boss != battle_config.item_rate_use_boss + || prev_config.item_rate_treasure != battle_config.item_rate_treasure + || prev_config.item_rate_adddrop != battle_config.item_rate_adddrop + || prev_config.logarithmic_drops != battle_config.logarithmic_drops + || prev_config.item_drop_common_min != battle_config.item_drop_common_min + || prev_config.item_drop_common_max != battle_config.item_drop_common_max + || prev_config.item_drop_card_min != battle_config.item_drop_card_min + || prev_config.item_drop_card_max != battle_config.item_drop_card_max + || prev_config.item_drop_equip_min != battle_config.item_drop_equip_min + || prev_config.item_drop_equip_max != battle_config.item_drop_equip_max + || prev_config.item_drop_mvp_min != battle_config.item_drop_mvp_min + || prev_config.item_drop_mvp_max != battle_config.item_drop_mvp_max + || prev_config.item_drop_heal_min != battle_config.item_drop_heal_min + || prev_config.item_drop_heal_max != battle_config.item_drop_heal_max + || prev_config.item_drop_use_min != battle_config.item_drop_use_min + || prev_config.item_drop_use_max != battle_config.item_drop_use_max + || prev_config.item_drop_treasure_min != battle_config.item_drop_treasure_min + || prev_config.item_drop_treasure_max != battle_config.item_drop_treasure_max + ) { //Drop rates changed. mob_reload(); //Needed as well so rate changes take effect. #ifndef TXT_ONLY @@ -7372,7 +7361,7 @@ int atcommand_pettalk(const int fd, struct map_session_data* sd, const char* com } } - snprintf(temp, sizeof temp ,"%s: %s",pd->pet.name,mes); + snprintf(temp, sizeof temp ,"%s : %s", pd->pet.name, mes); clif_message(&pd->bl, temp); return 0; @@ -8324,7 +8313,7 @@ int atcommand_homevolution(const int fd, struct map_session_data* sd, const char return 0; } - clif_displaymessage(fd, "Your homunculus doesn't evove."); + clif_displaymessage(fd, "Your homunculus doesn't evolve."); return -1; } @@ -8441,7 +8430,7 @@ int atcommand_homtalk(const int fd, struct map_session_data* sd, const char* com return -1; } - snprintf(temp, sizeof temp ,"%s: %s",sd->hd->homunculus.name,mes); + snprintf(temp, sizeof temp ,"%s : %s", sd->hd->homunculus.name, mes); clif_message(&sd->hd->bl, temp); return 0; diff --git a/src/map/battle.c b/src/map/battle.c index 82cd85615..00b7b64db 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3286,13 +3286,9 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f if ( (sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE || (sd2->class_&MAPID_UPPERMASK) == MAPID_NOVICE || - sd->status.base_level < battle_config.pk_min_level || - sd2->status.base_level < battle_config.pk_min_level || - (battle_config.pk_level_range && ( - sd->status.base_level > sd2->status.base_level ? - sd->status.base_level - sd2->status.base_level : - sd2->status.base_level - sd->status.base_level ) - > battle_config.pk_level_range) + (int)sd->status.base_level < battle_config.pk_min_level || + (int)sd2->status.base_level < battle_config.pk_min_level || + (battle_config.pk_level_range && abs((int)sd->status.base_level - (int)sd2->status.base_level) > battle_config.pk_level_range) ) state&=~BCT_ENEMY; } @@ -3339,974 +3335,441 @@ int battle_check_range(struct block_list *src,struct block_list *bl,int range) return path_search_long(NULL,src->m,src->x,src->y,bl->x,bl->y); } -static const struct battle_data_short { - const char *str; - unsigned short *val; -} battle_data_short[] = { //List here battle_athena options which are type unsigned short! - { "warp_point_debug", &battle_config.warp_point_debug }, - { "enable_critical", &battle_config.enable_critical }, - { "mob_critical_rate", &battle_config.mob_critical_rate }, - { "critical_rate", &battle_config.critical_rate }, - { "enable_baseatk", &battle_config.enable_baseatk }, - { "enable_perfect_flee", &battle_config.enable_perfect_flee }, - { "casting_rate", &battle_config.cast_rate }, - { "delay_rate", &battle_config.delay_rate }, - { "delay_dependon_dex", &battle_config.delay_dependon_dex }, - { "delay_dependon_agi", &battle_config.delay_dependon_agi }, - { "skill_delay_attack_enable", &battle_config.sdelay_attack_enable }, - { "left_cardfix_to_right", &battle_config.left_cardfix_to_right }, - { "skill_add_range", &battle_config.skill_add_range }, - { "skill_out_range_consume", &battle_config.skill_out_range_consume }, - { "skillrange_by_distance", &battle_config.skillrange_by_distance }, - { "skillrange_from_weapon", &battle_config.use_weapon_skill_range }, - { "player_damage_delay_rate", &battle_config.pc_damage_delay_rate }, - { "defunit_not_enemy", &battle_config.defnotenemy }, - { "gvg_traps_target_all", &battle_config.vs_traps_bctall }, - { "traps_setting", &battle_config.traps_setting }, - { "summon_flora_setting", &battle_config.summon_flora }, - { "clear_skills_on_death", &battle_config.clear_unit_ondeath }, - { "clear_skills_on_warp", &battle_config.clear_unit_onwarp }, - { "random_monster_checklv", &battle_config.random_monster_checklv }, - { "attribute_recover", &battle_config.attr_recover }, - { "item_auto_get", &battle_config.item_auto_get }, - { "drop_rate0item", &battle_config.drop_rate0item }, - { "pvp_exp", &battle_config.pvp_exp }, - { "gtb_sc_immunity", &battle_config.gtb_sc_immunity }, - { "guild_max_castles", &battle_config.guild_max_castles }, - { "emergency_call", &battle_config.emergency_call }, - { "guild_aura", &battle_config.guild_aura }, - { "death_penalty_type", &battle_config.death_penalty_type }, - { "death_penalty_base", &battle_config.death_penalty_base }, - { "death_penalty_job", &battle_config.death_penalty_job }, - { "restart_hp_rate", &battle_config.restart_hp_rate }, - { "restart_sp_rate", &battle_config.restart_sp_rate }, - { "mvp_hp_rate", &battle_config.mvp_hp_rate }, - { "monster_hp_rate", &battle_config.monster_hp_rate }, - { "monster_max_aspd", &battle_config.monster_max_aspd }, - { "view_range_rate", &battle_config.view_range_rate }, - { "chase_range_rate", &battle_config.chase_range_rate }, - { "atcommand_gm_only", &battle_config.atc_gmonly }, - { "atcommand_spawn_quantity_limit", &battle_config.atc_spawn_quantity_limit }, - { "atcommand_slave_clone_limit", &battle_config.atc_slave_clone_limit }, - { "partial_name_scan", &battle_config.partial_name_scan }, - { "gm_all_skill", &battle_config.gm_allskill }, - { "gm_all_equipment", &battle_config.gm_allequip }, - { "gm_skill_unconditional", &battle_config.gm_skilluncond }, - { "gm_join_chat", &battle_config.gm_join_chat }, - { "gm_kick_chat", &battle_config.gm_kick_chat }, - { "player_skillfree", &battle_config.skillfree }, - { "player_skillup_limit", &battle_config.skillup_limit }, - { "weapon_produce_rate", &battle_config.wp_rate }, - { "potion_produce_rate", &battle_config.pp_rate }, - { "monster_active_enable", &battle_config.monster_active_enable }, - { "monster_damage_delay_rate", &battle_config.monster_damage_delay_rate }, - { "monster_loot_type", &battle_config.monster_loot_type }, -// { "mob_skill_use", &battle_config.mob_skill_use }, //Deprecated - { "mob_skill_rate", &battle_config.mob_skill_rate }, - { "mob_skill_delay", &battle_config.mob_skill_delay }, - { "mob_count_rate", &battle_config.mob_count_rate }, - { "mob_spawn_delay", &battle_config.mob_spawn_delay }, - { "no_spawn_on_player", &battle_config.no_spawn_on_player }, - { "force_random_spawn", &battle_config.force_random_spawn }, - { "plant_spawn_delay", &battle_config.plant_spawn_delay }, - { "boss_spawn_delay", &battle_config.boss_spawn_delay }, - { "slaves_inherit_mode", &battle_config.slaves_inherit_mode }, - { "slaves_inherit_speed", &battle_config.slaves_inherit_speed }, - { "summons_trigger_autospells", &battle_config.summons_trigger_autospells }, - { "pc_damage_walk_delay_rate", &battle_config.pc_walk_delay_rate }, - { "damage_walk_delay_rate", &battle_config.walk_delay_rate }, - { "multihit_delay", &battle_config.multihit_delay }, - { "quest_skill_learn", &battle_config.quest_skill_learn }, - { "quest_skill_reset", &battle_config.quest_skill_reset }, - { "basic_skill_check", &battle_config.basic_skill_check }, - { "guild_emperium_check", &battle_config.guild_emperium_check }, - { "guild_exp_limit", &battle_config.guild_exp_limit }, - { "player_invincible_time", &battle_config.pc_invincible_time }, - { "pet_catch_rate", &battle_config.pet_catch_rate }, - { "pet_rename", &battle_config.pet_rename }, - { "pet_friendly_rate", &battle_config.pet_friendly_rate }, - { "pet_hungry_delay_rate", &battle_config.pet_hungry_delay_rate }, - { "pet_hungry_friendly_decrease", &battle_config.pet_hungry_friendly_decrease }, - { "pet_status_support", &battle_config.pet_status_support }, - { "pet_attack_support", &battle_config.pet_attack_support }, - { "pet_damage_support", &battle_config.pet_damage_support }, - { "pet_support_min_friendly", &battle_config.pet_support_min_friendly }, - { "pet_support_rate", &battle_config.pet_support_rate }, - { "pet_attack_exp_to_master", &battle_config.pet_attack_exp_to_master }, - { "pet_attack_exp_rate", &battle_config.pet_attack_exp_rate }, - { "pet_lv_rate", &battle_config.pet_lv_rate }, //Skotlex - { "pet_max_stats", &battle_config.pet_max_stats }, //Skotlex - { "pet_max_atk1", &battle_config.pet_max_atk1 }, //Skotlex - { "pet_max_atk2", &battle_config.pet_max_atk2 }, //Skotlex - { "pet_disable_in_gvg", &battle_config.pet_no_gvg }, //Skotlex - { "skill_min_damage", &battle_config.skill_min_damage }, - { "finger_offensive_type", &battle_config.finger_offensive_type }, - { "heal_exp", &battle_config.heal_exp }, - { "max_heal_lv", &battle_config.max_heal_lv }, - { "resurrection_exp", &battle_config.resurrection_exp }, - { "shop_exp", &battle_config.shop_exp }, - { "combo_delay_rate", &battle_config.combo_delay_rate }, - { "item_check", &battle_config.item_check }, - { "item_use_interval", &battle_config.item_use_interval }, - { "wedding_modifydisplay", &battle_config.wedding_modifydisplay }, - { "wedding_ignorepalette", &battle_config.wedding_ignorepalette }, //[Skotlex] - { "xmas_ignorepalette", &battle_config.xmas_ignorepalette }, // [Valaris] - { "natural_heal_weight_rate", &battle_config.natural_heal_weight_rate }, - { "arrow_decrement", &battle_config.arrow_decrement }, - { "max_aspd", &battle_config.max_aspd }, - { "max_walk_speed", &battle_config.max_walk_speed }, - { "max_lv", &battle_config.max_lv }, - { "aura_lv", &battle_config.aura_lv }, - { "max_parameter", &battle_config.max_parameter }, - { "max_baby_parameter", &battle_config.max_baby_parameter }, - { "max_def", &battle_config.max_def }, - { "over_def_bonus", &battle_config.over_def_bonus }, - { "skill_log", &battle_config.skill_log }, - { "battle_log", &battle_config.battle_log }, - { "save_log", &battle_config.save_log }, - { "error_log", &battle_config.error_log }, - { "etc_log", &battle_config.etc_log }, - { "save_clothcolor", &battle_config.save_clothcolor }, - { "undead_detect_type", &battle_config.undead_detect_type }, - { "auto_counter_type", &battle_config.auto_counter_type }, - { "min_hitrate", &battle_config.min_hitrate }, - { "max_hitrate", &battle_config.max_hitrate }, - { "agi_penalty_target", &battle_config.agi_penalty_target }, - { "agi_penalty_type", &battle_config.agi_penalty_type }, - { "agi_penalty_count", &battle_config.agi_penalty_count }, - { "agi_penalty_num", &battle_config.agi_penalty_num }, - { "agi_penalty_count_lv", &battle_config.agi_penalty_count_lv }, - { "vit_penalty_target", &battle_config.vit_penalty_target }, - { "vit_penalty_type", &battle_config.vit_penalty_type }, - { "vit_penalty_count", &battle_config.vit_penalty_count }, - { "vit_penalty_num", &battle_config.vit_penalty_num }, - { "vit_penalty_count_lv", &battle_config.vit_penalty_count_lv }, - { "weapon_defense_type", &battle_config.weapon_defense_type }, - { "magic_defense_type", &battle_config.magic_defense_type }, - { "skill_reiteration", &battle_config.skill_reiteration }, - { "skill_nofootset", &battle_config.skill_nofootset }, - { "player_cloak_check_type", &battle_config.pc_cloak_check_type }, - { "monster_cloak_check_type", &battle_config.monster_cloak_check_type }, - { "sense_type", &battle_config.estimation_type }, - { "gvg_short_attack_damage_rate", &battle_config.gvg_short_damage_rate }, - { "gvg_long_attack_damage_rate", &battle_config.gvg_long_damage_rate }, - { "gvg_weapon_attack_damage_rate", &battle_config.gvg_weapon_damage_rate }, - { "gvg_magic_attack_damage_rate", &battle_config.gvg_magic_damage_rate }, - { "gvg_misc_attack_damage_rate", &battle_config.gvg_misc_damage_rate }, - { "gvg_flee_penalty", &battle_config.gvg_flee_penalty }, - { "pk_short_attack_damage_rate", &battle_config.pk_short_damage_rate }, - { "pk_long_attack_damage_rate", &battle_config.pk_long_damage_rate }, - { "pk_weapon_attack_damage_rate", &battle_config.pk_weapon_damage_rate }, - { "pk_magic_attack_damage_rate", &battle_config.pk_magic_damage_rate }, - { "pk_misc_attack_damage_rate", &battle_config.pk_misc_damage_rate }, - { "mob_changetarget_byskill", &battle_config.mob_changetarget_byskill }, - { "attack_direction_change", &battle_config.attack_direction_change }, - { "land_skill_limit", &battle_config.land_skill_limit }, - { "party_skill_penalty", &battle_config.party_skill_penalty }, - { "monster_class_change_full_recover", &battle_config.monster_class_change_full_recover}, - { "produce_item_name_input", &battle_config.produce_item_name_input }, - { "display_skill_fail", &battle_config.display_skill_fail }, - { "chat_warpportal", &battle_config.chat_warpportal }, - { "mob_warp", &battle_config.mob_warp }, - { "dead_branch_active", &battle_config.dead_branch_active }, - { "show_steal_in_same_party", &battle_config.show_steal_in_same_party }, - { "party_hp_mode", &battle_config.party_hp_mode }, - { "show_party_share_picker", &battle_config.party_show_share_picker }, - { "party_update_interval", &battle_config.party_update_interval }, - { "party_item_share_type", &battle_config.party_share_type }, - { "attack_attr_none", &battle_config.attack_attr_none }, - { "gx_allhit", &battle_config.gx_allhit }, - { "gx_disptype", &battle_config.gx_disptype }, - { "devotion_level_difference", &battle_config.devotion_level_difference }, - { "player_skill_partner_check", &battle_config.player_skill_partner_check }, - { "hide_GM_session", &battle_config.hide_GM_session }, - { "invite_request_check", &battle_config.invite_request_check }, - { "skill_removetrap_type", &battle_config.skill_removetrap_type }, - { "disp_experience", &battle_config.disp_experience }, - { "disp_zeny", &battle_config.disp_zeny }, - { "castle_defense_rate", &battle_config.castle_defense_rate }, - { "hp_rate", &battle_config.hp_rate }, - { "sp_rate", &battle_config.sp_rate }, - { "gm_cant_drop_min_lv", &battle_config.gm_cant_drop_min_lv }, - { "gm_cant_drop_max_lv", &battle_config.gm_cant_drop_max_lv }, - { "disp_hpmeter", &battle_config.disp_hpmeter }, - { "bone_drop", &battle_config.bone_drop }, - { "buyer_name", &battle_config.buyer_name }, - { "skill_wall_check", &battle_config.skill_wall_check }, - { "cell_stack_limit", &battle_config.cell_stack_limit }, +static const struct _battle_data { + const char* str; + int* val; + int defval; + int min; + int max; +} battle_data[] = { + { "warp_point_debug", &battle_config.warp_point_debug, 0, 0, 1, }, + { "enable_critical", &battle_config.enable_critical, BL_PC, BL_NUL, BL_ALL, }, + { "mob_critical_rate", &battle_config.mob_critical_rate, 100, 0, INT_MAX, }, + { "critical_rate", &battle_config.critical_rate, 100, 0, INT_MAX, }, + { "enable_baseatk", &battle_config.enable_baseatk, BL_PC|BL_HOM, BL_NUL, BL_ALL, }, + { "enable_perfect_flee", &battle_config.enable_perfect_flee, BL_PC|BL_PET, BL_NUL, BL_ALL, }, + { "casting_rate", &battle_config.cast_rate, 100, 0, INT_MAX, }, + { "delay_rate", &battle_config.delay_rate, 100, 0, INT_MAX, }, + { "delay_dependon_dex", &battle_config.delay_dependon_dex, 0, 0, 1, }, + { "delay_dependon_agi", &battle_config.delay_dependon_agi, 0, 0, 1, }, + { "skill_delay_attack_enable", &battle_config.sdelay_attack_enable, 0, 0, 1, }, + { "left_cardfix_to_right", &battle_config.left_cardfix_to_right, 0, 0, 1, }, + { "skill_add_range", &battle_config.skill_add_range, 0, 0, INT_MAX, }, + { "skill_out_range_consume", &battle_config.skill_out_range_consume, 1, 0, 1, }, + { "skillrange_by_distance", &battle_config.skillrange_by_distance, ~BL_PC, BL_NUL, BL_ALL, }, + { "skillrange_from_weapon", &battle_config.use_weapon_skill_range, ~BL_PC, BL_NUL, BL_ALL, }, + { "player_damage_delay_rate", &battle_config.pc_damage_delay_rate, 100, 0, INT_MAX, }, + { "defunit_not_enemy", &battle_config.defnotenemy, 0, 0, 1, }, + { "gvg_traps_target_all", &battle_config.vs_traps_bctall, BL_PC, BL_NUL, BL_ALL, }, + { "traps_setting", &battle_config.traps_setting, 0, 0, 1, }, + { "summon_flora_setting", &battle_config.summon_flora, 1|2, 0, 1|2, }, + { "clear_skills_on_death", &battle_config.clear_unit_ondeath, BL_NUL, BL_NUL, BL_ALL, }, + { "clear_skills_on_warp", &battle_config.clear_unit_onwarp, BL_ALL, BL_NUL, BL_ALL, }, + { "random_monster_checklv", &battle_config.random_monster_checklv, 1, 0, 1, }, + { "attribute_recover", &battle_config.attr_recover, 1, 0, 1, }, + { "flooritem_lifetime", &battle_config.flooritem_lifetime, 60000, 1000, INT_MAX, }, + { "item_auto_get", &battle_config.item_auto_get, 0, 0, 1, }, + { "item_first_get_time", &battle_config.item_first_get_time, 3000, 0, INT_MAX, }, + { "item_second_get_time", &battle_config.item_second_get_time, 1000, 0, INT_MAX, }, + { "item_third_get_time", &battle_config.item_third_get_time, 1000, 0, INT_MAX, }, + { "mvp_item_first_get_time", &battle_config.mvp_item_first_get_time, 10000, 0, INT_MAX, }, + { "mvp_item_second_get_time", &battle_config.mvp_item_second_get_time, 10000, 0, INT_MAX, }, + { "mvp_item_third_get_time", &battle_config.mvp_item_third_get_time, 2000, 0, INT_MAX, }, + { "drop_rate0item", &battle_config.drop_rate0item, 0, 0, 1, }, + { "base_exp_rate", &battle_config.base_exp_rate, 100, 0, INT_MAX, }, + { "job_exp_rate", &battle_config.job_exp_rate, 100, 0, INT_MAX, }, + { "pvp_exp", &battle_config.pvp_exp, 1, 0, 1, }, + { "death_penalty_type", &battle_config.death_penalty_type, 0, 0, 2, }, + { "death_penalty_base", &battle_config.death_penalty_base, 0, 0, INT_MAX, }, + { "death_penalty_job", &battle_config.death_penalty_job, 0, 0, INT_MAX, }, + { "zeny_penalty", &battle_config.zeny_penalty, 0, 0, INT_MAX, }, + { "hp_rate", &battle_config.hp_rate, 100, 1, INT_MAX, }, + { "sp_rate", &battle_config.sp_rate, 100, 1, INT_MAX, }, + { "restart_hp_rate", &battle_config.restart_hp_rate, 0, 0, 100, }, + { "restart_sp_rate", &battle_config.restart_sp_rate, 0, 0, 100, }, + { "guild_aura", &battle_config.guild_aura, 31, 0, 31, }, + { "mvp_hp_rate", &battle_config.mvp_hp_rate, 100, 1, INT_MAX, }, + { "mvp_exp_rate", &battle_config.mvp_exp_rate, 100, 0, INT_MAX, }, + { "monster_hp_rate", &battle_config.monster_hp_rate, 100, 1, INT_MAX, }, + { "monster_max_aspd", &battle_config.monster_max_aspd, 199, 100, 199, }, + { "view_range_rate", &battle_config.view_range_rate, 100, 0, INT_MAX, }, + { "chase_range_rate", &battle_config.chase_range_rate, 100, 0, INT_MAX, }, + { "gtb_sc_immunity", &battle_config.gtb_sc_immunity, 50, 0, INT_MAX, }, + { "guild_max_castles", &battle_config.guild_max_castles, 0, 0, INT_MAX, }, + { "emergency_call", &battle_config.emergency_call, 11, 0, 31, }, + { "atcommand_gm_only", &battle_config.atc_gmonly, 0, 0, 1, }, + { "atcommand_spawn_quantity_limit", &battle_config.atc_spawn_quantity_limit, 100, 0, INT_MAX, }, + { "atcommand_slave_clone_limit", &battle_config.atc_slave_clone_limit, 25, 0, INT_MAX, }, + { "partial_name_scan", &battle_config.partial_name_scan, 0, 0, 1, }, + { "gm_all_skill", &battle_config.gm_allskill, 0, 0, 100, }, + { "gm_all_equipment", &battle_config.gm_allequip, 0, 0, 100, }, + { "gm_skill_unconditional", &battle_config.gm_skilluncond, 0, 0, 100, }, + { "gm_join_chat", &battle_config.gm_join_chat, 0, 0, 100, }, + { "gm_kick_chat", &battle_config.gm_kick_chat, 0, 0, 100, }, + { "player_skillfree", &battle_config.skillfree, 0, 0, 1, }, + { "player_skillup_limit", &battle_config.skillup_limit, 1, 0, 1, }, + { "weapon_produce_rate", &battle_config.wp_rate, 100, 0, INT_MAX, }, + { "potion_produce_rate", &battle_config.pp_rate, 100, 0, INT_MAX, }, + { "monster_active_enable", &battle_config.monster_active_enable, 1, 0, 1, }, + { "monster_damage_delay_rate", &battle_config.monster_damage_delay_rate, 100, 0, INT_MAX, }, + { "monster_loot_type", &battle_config.monster_loot_type, 0, 0, 1, }, +// { "mob_skill_use", &battle_config.mob_skill_use, 1, 0, 1, }, //Deprecated + { "mob_skill_rate", &battle_config.mob_skill_rate, 100, 0, INT_MAX, }, + { "mob_skill_delay", &battle_config.mob_skill_delay, 100, 0, INT_MAX, }, + { "mob_count_rate", &battle_config.mob_count_rate, 100, 0, INT_MAX, }, + { "mob_spawn_delay", &battle_config.mob_spawn_delay, 100, 0, INT_MAX, }, + { "plant_spawn_delay", &battle_config.plant_spawn_delay, 100, 0, INT_MAX, }, + { "boss_spawn_delay", &battle_config.boss_spawn_delay, 100, 0, INT_MAX, }, + { "no_spawn_on_player", &battle_config.no_spawn_on_player, 0, 0, 100, }, + { "force_random_spawn", &battle_config.force_random_spawn, 0, 0, 1, }, + { "slaves_inherit_mode", &battle_config.slaves_inherit_mode, 2, 0, 3, }, + { "slaves_inherit_speed", &battle_config.slaves_inherit_speed, 3, 0, 3, }, + { "summons_trigger_autospells", &battle_config.summons_trigger_autospells, 1, 0, 1, }, + { "pc_damage_walk_delay_rate", &battle_config.pc_walk_delay_rate, 20, 0, INT_MAX, }, + { "damage_walk_delay_rate", &battle_config.walk_delay_rate, 100, 0, INT_MAX, }, + { "multihit_delay", &battle_config.multihit_delay, 80, 0, INT_MAX, }, + { "quest_skill_learn", &battle_config.quest_skill_learn, 0, 0, 1, }, + { "quest_skill_reset", &battle_config.quest_skill_reset, 0, 0, 1, }, + { "basic_skill_check", &battle_config.basic_skill_check, 1, 0, 1, }, + { "guild_emperium_check", &battle_config.guild_emperium_check, 1, 0, 1, }, + { "guild_exp_limit", &battle_config.guild_exp_limit, 50, 0, 99, }, + { "player_invincible_time", &battle_config.pc_invincible_time, 5000, 0, INT_MAX, }, + { "pet_catch_rate", &battle_config.pet_catch_rate, 100, 0, INT_MAX, }, + { "pet_rename", &battle_config.pet_rename, 0, 0, 1, }, + { "pet_friendly_rate", &battle_config.pet_friendly_rate, 100, 0, INT_MAX, }, + { "pet_hungry_delay_rate", &battle_config.pet_hungry_delay_rate, 100, 10, INT_MAX, }, + { "pet_hungry_friendly_decrease", &battle_config.pet_hungry_friendly_decrease, 5, 0, INT_MAX, }, + { "pet_status_support", &battle_config.pet_status_support, 0, 0, 1, }, + { "pet_attack_support", &battle_config.pet_attack_support, 0, 0, 1, }, + { "pet_damage_support", &battle_config.pet_damage_support, 0, 0, 1, }, + { "pet_support_min_friendly", &battle_config.pet_support_min_friendly, 900, 0, 950, }, + { "pet_support_rate", &battle_config.pet_support_rate, 100, 0, INT_MAX, }, + { "pet_attack_exp_to_master", &battle_config.pet_attack_exp_to_master, 0, 0, 1, }, + { "pet_attack_exp_rate", &battle_config.pet_attack_exp_rate, 100, 0, INT_MAX, }, + { "pet_lv_rate", &battle_config.pet_lv_rate, 0, 0, INT_MAX, }, + { "pet_max_stats", &battle_config.pet_max_stats, 99, 0, INT_MAX, }, + { "pet_max_atk1", &battle_config.pet_max_atk1, 750, 0, INT_MAX, }, + { "pet_max_atk2", &battle_config.pet_max_atk2, 1000, 0, INT_MAX, }, + { "pet_disable_in_gvg", &battle_config.pet_no_gvg, 0, 0, 1, }, + { "skill_min_damage", &battle_config.skill_min_damage, 2|4, 0, 1|2|4, }, + { "finger_offensive_type", &battle_config.finger_offensive_type, 0, 0, 1, }, + { "heal_exp", &battle_config.heal_exp, 0, 0, INT_MAX, }, + { "resurrection_exp", &battle_config.resurrection_exp, 0, 0, INT_MAX, }, + { "shop_exp", &battle_config.shop_exp, 0, 0, INT_MAX, }, + { "max_heal_lv", &battle_config.max_heal_lv, 11, 1, INT_MAX, }, + { "max_heal", &battle_config.max_heal, 9999, 0, INT_MAX, }, + { "combo_delay_rate", &battle_config.combo_delay_rate, 100, 0, INT_MAX, }, + { "item_check", &battle_config.item_check, 0, 0, 1, }, + { "item_use_interval", &battle_config.item_use_interval, 100, 0, INT_MAX, }, + { "wedding_modifydisplay", &battle_config.wedding_modifydisplay, 0, 0, 1, }, + { "wedding_ignorepalette", &battle_config.wedding_ignorepalette, 0, 0, 1, }, + { "xmas_ignorepalette", &battle_config.xmas_ignorepalette, 0, 0, 1, }, + { "natural_healhp_interval", &battle_config.natural_healhp_interval, 6000, NATURAL_HEAL_INTERVAL, INT_MAX, }, + { "natural_healsp_interval", &battle_config.natural_healsp_interval, 8000, NATURAL_HEAL_INTERVAL, INT_MAX, }, + { "natural_heal_skill_interval", &battle_config.natural_heal_skill_interval, 10000, NATURAL_HEAL_INTERVAL, INT_MAX, }, + { "natural_heal_weight_rate", &battle_config.natural_heal_weight_rate, 50, 50, 101 }, + { "arrow_decrement", &battle_config.arrow_decrement, 1, 0, 2, }, + { "max_aspd", &battle_config.max_aspd, 199, 100, 199, }, + { "max_walk_speed", &battle_config.max_walk_speed, 300, 100, 100*DEFAULT_WALK_SPEED, }, + { "max_lv", &battle_config.max_lv, 99, 0, 127, }, + { "aura_lv", &battle_config.aura_lv, 99, 0, INT_MAX, }, + { "max_hp", &battle_config.max_hp, 32500, 100, 1000000000, }, + { "max_sp", &battle_config.max_sp, 32500, 100, 1000000000, }, + { "max_cart_weight", &battle_config.max_cart_weight, 8000, 100, 1000000, }, + { "max_parameter", &battle_config.max_parameter, 99, 10, 10000, }, + { "max_baby_parameter", &battle_config.max_baby_parameter, 80, 10, 10000, }, + { "max_def", &battle_config.max_def, 99, 0, INT_MAX, }, + { "over_def_bonus", &battle_config.over_def_bonus, 0, 0, 1000, }, + { "skill_log", &battle_config.skill_log, BL_NUL, BL_NUL, BL_ALL, }, + { "battle_log", &battle_config.battle_log, 0, 0, 1, }, + { "save_log", &battle_config.save_log, 0, 0, 1, }, + { "error_log", &battle_config.error_log, 1, 0, 1, }, + { "etc_log", &battle_config.etc_log, 1, 0, 1, }, + { "save_clothcolor", &battle_config.save_clothcolor, 1, 0, 1, }, + { "undead_detect_type", &battle_config.undead_detect_type, 0, 0, 2, }, + { "auto_counter_type", &battle_config.auto_counter_type, BL_ALL, BL_NUL, BL_ALL, }, + { "min_hitrate", &battle_config.min_hitrate, 5, 0, 100, }, + { "max_hitrate", &battle_config.max_hitrate, 100, 0, 100, }, + { "agi_penalty_target", &battle_config.agi_penalty_target, BL_PC, BL_NUL, BL_ALL, }, + { "agi_penalty_type", &battle_config.agi_penalty_type, 1, 0, 2, }, + { "agi_penalty_count", &battle_config.agi_penalty_count, 3, 2, INT_MAX, }, + { "agi_penalty_num", &battle_config.agi_penalty_num, 10, 0, INT_MAX, }, + { "agi_penalty_count_lv", &battle_config.agi_penalty_count_lv, ATK_FLEE, 0, INT_MAX, }, + { "vit_penalty_target", &battle_config.vit_penalty_target, BL_PC, BL_NUL, BL_ALL, }, + { "vit_penalty_type", &battle_config.vit_penalty_type, 1, 0, 2, }, + { "vit_penalty_count", &battle_config.vit_penalty_count, 3, 2, INT_MAX, }, + { "vit_penalty_num", &battle_config.vit_penalty_num, 5, 0, INT_MAX, }, + { "vit_penalty_count_lv", &battle_config.vit_penalty_count_lv, ATK_DEF, 0, INT_MAX, }, + { "weapon_defense_type", &battle_config.weapon_defense_type, 0, 0, INT_MAX, }, + { "magic_defense_type", &battle_config.magic_defense_type, 0, 0, INT_MAX, }, + { "skill_reiteration", &battle_config.skill_reiteration, BL_NUL, BL_NUL, BL_ALL, }, + { "skill_nofootset", &battle_config.skill_nofootset, BL_PC, BL_NUL, BL_ALL, }, + { "player_cloak_check_type", &battle_config.pc_cloak_check_type, 1, 0, 1|2|4, }, + { "monster_cloak_check_type", &battle_config.monster_cloak_check_type, 4, 0, 1|2|4, }, + { "sense_type", &battle_config.estimation_type, 1|2, 0, 1|2, }, + { "gvg_eliminate_time", &battle_config.gvg_eliminate_time, 7000, 0, INT_MAX, }, + { "gvg_short_attack_damage_rate", &battle_config.gvg_short_damage_rate, 80, 0, INT_MAX, }, + { "gvg_long_attack_damage_rate", &battle_config.gvg_long_damage_rate, 80, 0, INT_MAX, }, + { "gvg_weapon_attack_damage_rate", &battle_config.gvg_weapon_damage_rate, 60, 0, INT_MAX, }, + { "gvg_magic_attack_damage_rate", &battle_config.gvg_magic_damage_rate, 60, 0, INT_MAX, }, + { "gvg_misc_attack_damage_rate", &battle_config.gvg_misc_damage_rate, 60, 0, INT_MAX, }, + { "gvg_flee_penalty", &battle_config.gvg_flee_penalty, 20, 0, INT_MAX, }, + { "pk_short_attack_damage_rate", &battle_config.pk_short_damage_rate, 80, 0, INT_MAX, }, + { "pk_long_attack_damage_rate", &battle_config.pk_long_damage_rate, 70, 0, INT_MAX, }, + { "pk_weapon_attack_damage_rate", &battle_config.pk_weapon_damage_rate, 60, 0, INT_MAX, }, + { "pk_magic_attack_damage_rate", &battle_config.pk_magic_damage_rate, 60, 0, INT_MAX, }, + { "pk_misc_attack_damage_rate", &battle_config.pk_misc_damage_rate, 60, 0, INT_MAX, }, + { "mob_changetarget_byskill", &battle_config.mob_changetarget_byskill, 0, 0, 1, }, + { "attack_direction_change", &battle_config.attack_direction_change, BL_ALL, BL_NUL, BL_ALL, }, + { "land_skill_limit", &battle_config.land_skill_limit, BL_ALL, BL_NUL, BL_ALL, }, + { "monster_class_change_full_recover", &battle_config.monster_class_change_recover, 1, 0, 1, }, + { "produce_item_name_input", &battle_config.produce_item_name_input, 0x1|0x2, 0, 0x9F, }, + { "display_skill_fail", &battle_config.display_skill_fail, 2, 0, 1|2|4|8, }, + { "chat_warpportal", &battle_config.chat_warpportal, 0, 0, 1, }, + { "mob_warp", &battle_config.mob_warp, 0, 0, 1|2|4, }, + { "dead_branch_active", &battle_config.dead_branch_active, 1, 0, 1, }, + { "vending_max_value", &battle_config.vending_max_value, 10000000, 1, MAX_ZENY, }, + { "show_steal_in_same_party", &battle_config.show_steal_in_same_party, 0, 0, 1, }, + { "party_hp_mode", &battle_config.party_hp_mode, 0, 0, 1, }, + { "show_party_share_picker", &battle_config.party_show_share_picker, 0, 0, 1, }, + { "party_update_interval", &battle_config.party_update_interval, 1000, 100, INT_MAX, }, + { "party_item_share_type", &battle_config.party_share_type, 0, 0, 1|2|3, }, + { "attack_attr_none", &battle_config.attack_attr_none, ~BL_PC, BL_NUL, BL_ALL, }, + { "gx_allhit", &battle_config.gx_allhit, 0, 0, 1, }, + { "gx_disptype", &battle_config.gx_disptype, 1, 0, 1, }, + { "devotion_level_difference", &battle_config.devotion_level_difference, 10, 0, INT_MAX, }, + { "player_skill_partner_check", &battle_config.player_skill_partner_check, 1, 0, 1, }, + { "hide_GM_session", &battle_config.hide_GM_session, 0, 0, 1, }, + { "invite_request_check", &battle_config.invite_request_check, 1, 0, 1, }, + { "skill_removetrap_type", &battle_config.skill_removetrap_type, 0, 0, 1, }, + { "disp_experience", &battle_config.disp_experience, 0, 0, 1, }, + { "disp_zeny", &battle_config.disp_zeny, 0, 0, 1, }, + { "castle_defense_rate", &battle_config.castle_defense_rate, 100, 0, 100, }, + { "gm_cant_drop_min_lv", &battle_config.gm_cant_drop_min_lv, 1, 0, 100, }, + { "gm_cant_drop_max_lv", &battle_config.gm_cant_drop_max_lv, 0, 0, 100, }, + { "disp_hpmeter", &battle_config.disp_hpmeter, 0, 0, 100, }, + { "bone_drop", &battle_config.bone_drop, 0, 0, 2, }, + { "buyer_name", &battle_config.buyer_name, 1, 0, 1, }, + { "skill_wall_check", &battle_config.skill_wall_check, 1, 0, 1, }, + { "cell_stack_limit", &battle_config.cell_stack_limit, 1, 1, 255, }, // eAthena additions - { "item_logarithmic_drops", &battle_config.logarithmic_drops }, - { "item_drop_common_min", &battle_config.item_drop_common_min }, // Added by TyrNemesis^ - { "item_drop_common_max", &battle_config.item_drop_common_max }, - { "item_drop_equip_min", &battle_config.item_drop_equip_min }, - { "item_drop_equip_max", &battle_config.item_drop_equip_max }, - { "item_drop_card_min", &battle_config.item_drop_card_min }, - { "item_drop_card_max", &battle_config.item_drop_card_max }, - { "item_drop_mvp_min", &battle_config.item_drop_mvp_min }, - { "item_drop_mvp_max", &battle_config.item_drop_mvp_max }, // End Addition - { "item_drop_heal_min", &battle_config.item_drop_heal_min }, - { "item_drop_heal_max", &battle_config.item_drop_heal_max }, - { "item_drop_use_min", &battle_config.item_drop_use_min }, - { "item_drop_use_max", &battle_config.item_drop_use_max }, - { "item_drop_add_min", &battle_config.item_drop_adddrop_min }, - { "item_drop_add_max", &battle_config.item_drop_adddrop_max }, - { "item_drop_treasure_min", &battle_config.item_drop_treasure_min }, - { "item_drop_treasure_max", &battle_config.item_drop_treasure_max }, - { "prevent_logout", &battle_config.prevent_logout }, // Added by RoVeRT - { "alchemist_summon_reward", &battle_config.alchemist_summon_reward }, // [Valaris] - { "drops_by_luk", &battle_config.drops_by_luk }, // [Valaris] - { "drops_by_luk2", &battle_config.drops_by_luk2 }, // [Skotlex] - { "equip_natural_break_rate", &battle_config.equip_natural_break_rate }, - { "equip_self_break_rate", &battle_config.equip_self_break_rate }, - { "equip_skill_break_rate", &battle_config.equip_skill_break_rate }, - { "pk_mode", &battle_config.pk_mode }, // [Valaris] - { "pk_level_range", &battle_config.pk_level_range }, - { "manner_system", &battle_config.manner_system }, // [Komurka] - { "pet_equip_required", &battle_config.pet_equip_required }, // [Valaris] - { "multi_level_up", &battle_config.multi_level_up }, // [Valaris] - { "max_exp_gain_rate", &battle_config.max_exp_gain_rate }, // [Skotlex] - { "backstab_bow_penalty", &battle_config.backstab_bow_penalty }, - { "night_at_start", &battle_config.night_at_start }, // added by [Yor] - { "show_mob_info", &battle_config.show_mob_info }, // [Valaris] - { "hack_info_GM_level", &battle_config.hack_info_GM_level }, // added by [Yor] - { "any_warp_GM_min_level", &battle_config.any_warp_GM_min_level }, // added by [Yor] - { "packet_ver_flag", &battle_config.packet_ver_flag }, // added by [Yor] - { "min_hair_style", &battle_config.min_hair_style }, // added by [MouseJstr] - { "max_hair_style", &battle_config.max_hair_style }, // added by [MouseJstr] - { "min_hair_color", &battle_config.min_hair_color }, // added by [MouseJstr] - { "max_hair_color", &battle_config.max_hair_color }, // added by [MouseJstr] - { "min_cloth_color", &battle_config.min_cloth_color }, // added by [MouseJstr] - { "max_cloth_color", &battle_config.max_cloth_color }, // added by [MouseJstr] - { "pet_hair_style", &battle_config.pet_hair_style }, // added by [Skotlex] - { "castrate_dex_scale", &battle_config.castrate_dex_scale }, // added by [MouseJstr] - { "area_size", &battle_config.area_size }, // added by [MouseJstr] - { "zeny_from_mobs", &battle_config.zeny_from_mobs }, // [Valaris] - { "mobs_level_up", &battle_config.mobs_level_up }, // [Valaris] - { "mobs_level_up_exp_rate", &battle_config.mobs_level_up_exp_rate }, // [Valaris] - { "pk_min_level", &battle_config.pk_min_level }, // [celest] - { "skill_steal_type", &battle_config.skill_steal_type }, // [celest] - { "skill_steal_rate", &battle_config.skill_steal_rate }, // [celest] - { "skill_steal_max_tries", &battle_config.skill_steal_max_tries }, // [Lupus] - { "motd_type", &battle_config.motd_type }, // [celest] - { "finding_ore_rate", &battle_config.finding_ore_rate }, // [celest] - { "exp_calc_type", &battle_config.exp_calc_type }, // [celest] - { "exp_bonus_attacker", &battle_config.exp_bonus_attacker }, // [Skotlex] - { "exp_bonus_max_attacker", &battle_config.exp_bonus_max_attacker }, // [Skotlex] - { "min_skill_delay_limit", &battle_config.min_skill_delay_limit }, // [celest] - { "default_skill_delay", &battle_config.default_skill_delay }, // [Skotlex] - { "no_skill_delay", &battle_config.no_skill_delay }, // [Skotlex] - { "attack_walk_delay", &battle_config.attack_walk_delay }, // [Skotlex] - { "require_glory_guild", &battle_config.require_glory_guild }, // [celest] - { "idle_no_share", &battle_config.idle_no_share }, // [celest], for a feature by [MouseJstr] - { "party_even_share_bonus", &battle_config.party_even_share_bonus }, - { "delay_battle_damage", &battle_config.delay_battle_damage }, // [celest] - { "hide_woe_damage", &battle_config.hide_woe_damage }, // [Skotlex] - { "display_version", &battle_config.display_version }, // [Ancyker], for a feature by...? - { "who_display_aid", &battle_config.who_display_aid }, // [Ancyker], for a feature by...? - { "display_hallucination", &battle_config.display_hallucination }, // [Skotlex] - { "use_statpoint_table", &battle_config.use_statpoint_table }, // [Skotlex] - { "ignore_items_gender", &battle_config.ignore_items_gender }, // [Lupus] - { "copyskill_restrict", &battle_config.copyskill_restrict }, // [Aru] - { "berserk_cancels_buffs", &battle_config.berserk_cancels_buffs }, // [Aru] - { "debuff_on_logout", &battle_config.debuff_on_logout }, - { "monster_ai", &battle_config.mob_ai }, - { "hom_setting", &battle_config.hom_setting }, - { "dynamic_mobs", &battle_config.dynamic_mobs }, - { "mob_remove_damaged", &battle_config.mob_remove_damaged }, - { "show_hp_sp_drain", &battle_config.show_hp_sp_drain }, // [Skotlex] - { "show_hp_sp_gain", &battle_config.show_hp_sp_gain }, // [Skotlex] - { "mob_npc_event_type", &battle_config.mob_npc_event_type }, - { "mob_clear_delay", &battle_config.mob_clear_delay }, // [Valaris] - { "character_size", &battle_config.character_size }, // [Lupus] - { "mob_max_skilllvl", &battle_config.mob_max_skilllvl }, // [Lupus] - { "retaliate_to_master", &battle_config.retaliate_to_master }, // [Skotlex] - { "rare_drop_announce", &battle_config.rare_drop_announce }, // [Lupus] - { "firewall_hits_on_undead", &battle_config.firewall_hits_on_undead }, // [Skotlex] - { "title_lvl1", &battle_config.title_lvl1 }, // [Lupus] - { "title_lvl2", &battle_config.title_lvl2 }, // [Lupus] - { "title_lvl3", &battle_config.title_lvl3 }, // [Lupus] - { "title_lvl4", &battle_config.title_lvl4 }, // [Lupus] - { "title_lvl5", &battle_config.title_lvl5 }, // [Lupus] - { "title_lvl6", &battle_config.title_lvl6 }, // [Lupus] - { "title_lvl7", &battle_config.title_lvl7 }, // [Lupus] - { "title_lvl8", &battle_config.title_lvl8 }, // [Lupus] - { "duel_allow_pvp", &battle_config.duel_allow_pvp }, // [LuzZza] - { "duel_allow_gvg", &battle_config.duel_allow_gvg }, // [LuzZza] - { "duel_allow_teleport", &battle_config.duel_allow_teleport }, // [LuzZza] - { "duel_autoleave_when_die", &battle_config.duel_autoleave_when_die }, //[LuzZza] - { "duel_time_interval", &battle_config.duel_time_interval }, // [LuzZza] - { "duel_only_on_same_map", &battle_config.duel_only_on_same_map }, // [Toms] - { "skip_teleport_lv1_menu", &battle_config.skip_teleport_lv1_menu }, // [LuzZza] - { "allow_skill_without_day", &battle_config.allow_skill_without_day }, // [Komurka] - { "allow_es_magic_player", &battle_config.allow_es_magic_pc }, - { "skill_caster_check", &battle_config.skill_caster_check }, - { "status_cast_cancel", &battle_config.sc_castcancel }, - { "pc_status_def_rate", &battle_config.pc_sc_def_rate }, - { "mob_status_def_rate", &battle_config.mob_sc_def_rate }, - { "pc_luk_status_def", &battle_config.pc_luk_sc_def }, - { "mob_luk_status_def", &battle_config.mob_luk_sc_def }, - { "pc_max_status_def", &battle_config.pc_max_sc_def }, - { "mob_max_status_def", &battle_config.mob_max_sc_def }, - { "sg_miracle_skill_ratio", &battle_config.sg_miracle_skill_ratio }, - { "sg_angel_skill_ratio", &battle_config.sg_angel_skill_ratio }, - { "autospell_stacking", &battle_config.autospell_stacking }, - { "override_mob_names", &battle_config.override_mob_names }, - { "min_chat_delay", &battle_config.min_chat_delay }, - { "friend_auto_add", &battle_config.friend_auto_add }, - { "hom_rename", &battle_config.hom_rename }, - { "homunculus_show_growth", &battle_config.homunculus_show_growth }, //[orn] - { "homunculus_friendly_rate", &battle_config.homunculus_friendly_rate }, - { "vending_tax", &battle_config.vending_tax }, + { "item_logarithmic_drops", &battle_config.logarithmic_drops, 0, 0, 1, }, + { "item_drop_common_min", &battle_config.item_drop_common_min, 1, 1, 10000, }, + { "item_drop_common_max", &battle_config.item_drop_common_max, 10000, 1, 10000, }, + { "item_drop_equip_min", &battle_config.item_drop_equip_min, 1, 1, 10000, }, + { "item_drop_equip_max", &battle_config.item_drop_equip_max, 10000, 1, 10000, }, + { "item_drop_card_min", &battle_config.item_drop_card_min, 1, 1, 10000, }, + { "item_drop_card_max", &battle_config.item_drop_card_max, 10000, 1, 10000, }, + { "item_drop_mvp_min", &battle_config.item_drop_mvp_min, 1, 1, 10000, }, + { "item_drop_mvp_max", &battle_config.item_drop_mvp_max, 10000, 1, 10000, }, + { "item_drop_heal_min", &battle_config.item_drop_heal_min, 1, 1, 10000, }, + { "item_drop_heal_max", &battle_config.item_drop_heal_max, 10000, 1, 10000, }, + { "item_drop_use_min", &battle_config.item_drop_use_min, 1, 1, 10000, }, + { "item_drop_use_max", &battle_config.item_drop_use_max, 10000, 1, 10000, }, + { "item_drop_add_min", &battle_config.item_drop_adddrop_min, 1, 1, 10000, }, + { "item_drop_add_max", &battle_config.item_drop_adddrop_max, 10000, 1, 10000, }, + { "item_drop_treasure_min", &battle_config.item_drop_treasure_min, 1, 1, 10000, }, + { "item_drop_treasure_max", &battle_config.item_drop_treasure_max, 10000, 1, 10000, }, + { "item_rate_mvp", &battle_config.item_rate_mvp, 100, 0, INT_MAX, }, + { "item_rate_common", &battle_config.item_rate_common, 100, 0, INT_MAX, }, + { "item_rate_common_boss", &battle_config.item_rate_common_boss, 100, 0, INT_MAX, }, + { "item_rate_equip", &battle_config.item_rate_equip, 100, 0, INT_MAX, }, + { "item_rate_equip_boss", &battle_config.item_rate_equip_boss, 100, 0, INT_MAX, }, + { "item_rate_card", &battle_config.item_rate_card, 100, 0, INT_MAX, }, + { "item_rate_card_boss", &battle_config.item_rate_card_boss, 100, 0, INT_MAX, }, + { "item_rate_heal", &battle_config.item_rate_heal, 100, 0, INT_MAX, }, + { "item_rate_heal_boss", &battle_config.item_rate_heal_boss, 100, 0, INT_MAX, }, + { "item_rate_use", &battle_config.item_rate_use, 100, 0, INT_MAX, }, + { "item_rate_use_boss", &battle_config.item_rate_use_boss, 100, 0, INT_MAX, }, + { "item_rate_adddrop", &battle_config.item_rate_adddrop, 100, 0, INT_MAX, }, + { "item_rate_treasure", &battle_config.item_rate_treasure, 100, 0, INT_MAX, }, + { "prevent_logout", &battle_config.prevent_logout, 10000, 0, 60000, }, + { "alchemist_summon_reward", &battle_config.alchemist_summon_reward, 1, 0, 2, }, + { "drops_by_luk", &battle_config.drops_by_luk, 0, 0, INT_MAX, }, + { "drops_by_luk2", &battle_config.drops_by_luk2, 0, 0, INT_MAX, }, + { "equip_natural_break_rate", &battle_config.equip_natural_break_rate, 0, 0, INT_MAX, }, + { "equip_self_break_rate", &battle_config.equip_self_break_rate, 100, 0, INT_MAX, }, + { "equip_skill_break_rate", &battle_config.equip_skill_break_rate, 100, 0, INT_MAX, }, + { "pk_mode", &battle_config.pk_mode, 0, 0, 1, }, + { "pk_level_range", &battle_config.pk_level_range, 0, 0, INT_MAX, }, + { "manner_system", &battle_config.manner_system, 0xFFF, 0, 0xFFF, }, + { "pet_equip_required", &battle_config.pet_equip_required, 0, 0, 1, }, + { "multi_level_up", &battle_config.multi_level_up, 0, 0, 1, }, + { "max_exp_gain_rate", &battle_config.max_exp_gain_rate, 0, 0, INT_MAX, }, + { "backstab_bow_penalty", &battle_config.backstab_bow_penalty, 0, 0, 1, }, + { "night_at_start", &battle_config.night_at_start, 0, 0, 1, }, + { "show_mob_info", &battle_config.show_mob_info, 0, 0, 1|2|4, }, + { "ban_hack_trade", &battle_config.ban_hack_trade, 0, 0, INT_MAX, }, + { "hack_info_GM_level", &battle_config.hack_info_GM_level, 60, 0, 100, }, + { "any_warp_GM_min_level", &battle_config.any_warp_GM_min_level, 20, 0, 100, }, + { "who_display_aid", &battle_config.who_display_aid, 40, 0, 100, }, + { "packet_ver_flag", &battle_config.packet_ver_flag, 0xFFFF, 0x0000, 0xFFFF, }, + { "min_hair_style", &battle_config.min_hair_style, 0, 0, INT_MAX, }, + { "max_hair_style", &battle_config.max_hair_style, 23, 0, INT_MAX, }, + { "min_hair_color", &battle_config.min_hair_color, 0, 0, INT_MAX, }, + { "max_hair_color", &battle_config.max_hair_color, 9, 0, INT_MAX, }, + { "min_cloth_color", &battle_config.min_cloth_color, 0, 0, INT_MAX, }, + { "max_cloth_color", &battle_config.max_cloth_color, 4, 0, INT_MAX, }, + { "pet_hair_style", &battle_config.pet_hair_style, 100, 0, INT_MAX, }, + { "castrate_dex_scale", &battle_config.castrate_dex_scale, 150, 1, INT_MAX, }, + { "area_size", &battle_config.area_size, 14, 0, INT_MAX, }, + { "zeny_from_mobs", &battle_config.zeny_from_mobs, 0, 0, 1, }, + { "mobs_level_up", &battle_config.mobs_level_up, 0, 0, 1, }, + { "mobs_level_up_exp_rate", &battle_config.mobs_level_up_exp_rate, 1, 1, INT_MAX, }, + { "pk_min_level", &battle_config.pk_min_level, 55, 1, INT_MAX, }, + { "skill_steal_type", &battle_config.skill_steal_type, 1, 0, 1, }, + { "skill_steal_max_tries", &battle_config.skill_steal_max_tries, 0, 0, UCHAR_MAX, }, + { "motd_type", &battle_config.motd_type, 0, 0, 1, }, + { "finding_ore_rate", &battle_config.finding_ore_rate, 100, 0, INT_MAX, }, + { "exp_calc_type", &battle_config.exp_calc_type, 0, 0, 1, }, + { "exp_bonus_attacker", &battle_config.exp_bonus_attacker, 25, 0, INT_MAX, }, + { "exp_bonus_max_attacker", &battle_config.exp_bonus_max_attacker, 12, 2, INT_MAX, }, + { "min_skill_delay_limit", &battle_config.min_skill_delay_limit, 100, 10, INT_MAX, }, + { "default_skill_delay", &battle_config.default_skill_delay, 300, 0, INT_MAX, }, + { "no_skill_delay", &battle_config.no_skill_delay, BL_MOB, BL_NUL, BL_ALL, }, + { "attack_walk_delay", &battle_config.attack_walk_delay, 0, 0, INT_MAX, }, + { "require_glory_guild", &battle_config.require_glory_guild, 0, 0, 1, }, + { "idle_no_share", &battle_config.idle_no_share, 0, 0, INT_MAX, }, + { "party_even_share_bonus", &battle_config.party_even_share_bonus, 0, 0, INT_MAX, }, + { "delay_battle_damage", &battle_config.delay_battle_damage, 1, 0, 1, }, + { "hide_woe_damage", &battle_config.hide_woe_damage, 0, 0, 1, }, + { "display_version", &battle_config.display_version, 1, 0, 1, }, + { "display_hallucination", &battle_config.display_hallucination, 1, 0, 1, }, + { "use_statpoint_table", &battle_config.use_statpoint_table, 1, 0, 1, }, + { "ignore_items_gender", &battle_config.ignore_items_gender, 1, 0, 1, }, + { "copyskill_restrict", &battle_config.copyskill_restrict, 2, 0, 2, }, + { "berserk_cancels_buffs", &battle_config.berserk_cancels_buffs, 0, 0, 1, }, + { "debuff_on_logout", &battle_config.debuff_on_logout, 1|2, 0, 1|2, }, + { "monster_ai", &battle_config.mob_ai, 0x000, 0x000, 0x77F, }, + { "hom_setting", &battle_config.hom_setting, 0xFFFF, 0x0000, 0xFFFF, }, + { "dynamic_mobs", &battle_config.dynamic_mobs, 1, 0, 1, }, + { "mob_remove_damaged", &battle_config.mob_remove_damaged, 1, 0, 1, }, + { "show_hp_sp_drain", &battle_config.show_hp_sp_drain, 0, 0, 1, }, + { "show_hp_sp_gain", &battle_config.show_hp_sp_gain, 1, 0, 1, }, + { "mob_npc_event_type", &battle_config.mob_npc_event_type, 1, 0, 1, }, + { "mob_clear_delay", &battle_config.mob_clear_delay, 0, 0, INT_MAX, }, + { "character_size", &battle_config.character_size, 1|2, 0, 1|2, }, + { "mob_max_skilllvl", &battle_config.mob_max_skilllvl, MAX_SKILL_LEVEL, 1, MAX_SKILL_LEVEL, }, + { "retaliate_to_master", &battle_config.retaliate_to_master, 1, 0, 1, }, + { "rare_drop_announce", &battle_config.rare_drop_announce, 0, 0, 10000, }, + { "firewall_hits_on_undead", &battle_config.firewall_hits_on_undead, 1, 1, 255, }, + { "title_lvl1", &battle_config.title_lvl1, 1, 0, 100, }, + { "title_lvl2", &battle_config.title_lvl2, 10, 0, 100, }, + { "title_lvl3", &battle_config.title_lvl3, 20, 0, 100, }, + { "title_lvl4", &battle_config.title_lvl4, 40, 0, 100, }, + { "title_lvl5", &battle_config.title_lvl5, 50, 0, 100, }, + { "title_lvl6", &battle_config.title_lvl6, 60, 0, 100, }, + { "title_lvl7", &battle_config.title_lvl7, 80, 0, 100, }, + { "title_lvl8", &battle_config.title_lvl8, 99, 0, 100, }, + { "duel_allow_pvp", &battle_config.duel_allow_pvp, 0, 0, 1, }, + { "duel_allow_gvg", &battle_config.duel_allow_gvg, 0, 0, 1, }, + { "duel_allow_teleport", &battle_config.duel_allow_teleport, 0, 0, 1, }, + { "duel_autoleave_when_die", &battle_config.duel_autoleave_when_die, 1, 0, 1, }, + { "duel_time_interval", &battle_config.duel_time_interval, 60, 1, INT_MAX, }, + { "duel_only_on_same_map", &battle_config.duel_only_on_same_map, 0, 0, 1, }, + { "skip_teleport_lv1_menu", &battle_config.skip_teleport_lv1_menu, 0, 0, 1, }, + { "allow_skill_without_day", &battle_config.allow_skill_without_day, 0, 0, 1, }, + { "allow_es_magic_player", &battle_config.allow_es_magic_pc, 0, 0, 1, }, + { "skill_caster_check", &battle_config.skill_caster_check, 1, 0, 1, }, + { "status_cast_cancel", &battle_config.sc_castcancel, BL_NUL, BL_NUL, BL_ALL, }, + { "pc_status_def_rate", &battle_config.pc_sc_def_rate, 100, 0, INT_MAX, }, + { "mob_status_def_rate", &battle_config.mob_sc_def_rate, 100, 0, INT_MAX, }, + { "pc_luk_status_def", &battle_config.pc_luk_sc_def, 300, 1, INT_MAX, }, + { "mob_luk_status_def", &battle_config.mob_luk_sc_def, 300, 1, INT_MAX, }, + { "pc_max_status_def", &battle_config.pc_max_sc_def, 100, 0, INT_MAX, }, + { "mob_max_status_def", &battle_config.mob_max_sc_def, 100, 0, INT_MAX, }, + { "sg_miracle_skill_ratio", &battle_config.sg_miracle_skill_ratio, 1, 0, 10000, }, + { "sg_angel_skill_ratio", &battle_config.sg_angel_skill_ratio, 10, 0, 10000, }, + { "autospell_stacking", &battle_config.autospell_stacking, 0, 0, 1, }, + { "override_mob_names", &battle_config.override_mob_names, 0, 0, 2, }, + { "min_chat_delay", &battle_config.min_chat_delay, 0, 0, INT_MAX, }, + { "friend_auto_add", &battle_config.friend_auto_add, 1, 0, 1, }, + { "hom_rename", &battle_config.hom_rename, 0, 0, 1, }, + { "homunculus_show_growth", &battle_config.homunculus_show_growth, 0, 0, 1, }, + { "homunculus_friendly_rate", &battle_config.homunculus_friendly_rate, 100, 0, INT_MAX, }, + { "vending_tax", &battle_config.vending_tax, 0, 0, 10000, }, + { "day_duration", &battle_config.day_duration, 0, 0, INT_MAX, }, + { "night_duration", &battle_config.night_duration, 0, 0, INT_MAX, }, + { "mob_remove_delay", &battle_config.mob_remove_delay, 60000, 15000, INT_MAX, }, + { "sg_miracle_skill_duration", &battle_config.sg_miracle_skill_duration, 3600000, 0, INT_MAX, }, + { "hvan_explosion_intimate", &battle_config.hvan_explosion_intimate, 45000, 0, 100000, }, }; -static const struct battle_data_int { - const char *str; - int *val; -} battle_data_int[] = { //List here battle_athena options which are type int! - { "flooritem_lifetime", &battle_config.flooritem_lifetime }, - { "item_first_get_time", &battle_config.item_first_get_time }, - { "item_second_get_time", &battle_config.item_second_get_time }, - { "item_third_get_time", &battle_config.item_third_get_time }, - { "mvp_item_first_get_time", &battle_config.mvp_item_first_get_time }, - { "mvp_item_second_get_time", &battle_config.mvp_item_second_get_time }, - { "mvp_item_third_get_time", &battle_config.mvp_item_third_get_time }, - { "base_exp_rate", &battle_config.base_exp_rate }, - { "job_exp_rate", &battle_config.job_exp_rate }, - { "zeny_penalty", &battle_config.zeny_penalty }, - { "mvp_exp_rate", &battle_config.mvp_exp_rate }, - { "natural_healhp_interval", &battle_config.natural_healhp_interval }, - { "natural_healsp_interval", &battle_config.natural_healsp_interval }, - { "natural_heal_skill_interval", &battle_config.natural_heal_skill_interval }, - { "max_hp", &battle_config.max_hp }, - { "max_sp", &battle_config.max_sp }, - { "max_cart_weight", &battle_config.max_cart_weight }, - { "gvg_eliminate_time", &battle_config.gvg_eliminate_time }, - { "vending_max_value", &battle_config.vending_max_value }, -// eAthena additions - { "item_rate_mvp", &battle_config.item_rate_mvp }, - { "item_rate_common", &battle_config.item_rate_common }, // Added by RoVeRT - { "item_rate_common_boss", &battle_config.item_rate_common_boss }, // [Reddozen] - { "item_rate_equip", &battle_config.item_rate_equip }, - { "item_rate_equip_boss", &battle_config.item_rate_equip_boss }, // [Reddozen] - { "item_rate_card", &battle_config.item_rate_card }, // End Addition - { "item_rate_card_boss", &battle_config.item_rate_card_boss }, // [Reddozen] - { "item_rate_heal", &battle_config.item_rate_heal }, // Added by Valaris - { "item_rate_heal_boss", &battle_config.item_rate_heal_boss }, // [Reddozen] - { "item_rate_use", &battle_config.item_rate_use }, // End - { "item_rate_use_boss", &battle_config.item_rate_use_boss }, // [Reddozen] - { "item_rate_adddrop", &battle_config.item_rate_adddrop }, // End - { "item_rate_treasure", &battle_config.item_rate_treasure }, // End - { "day_duration", &battle_config.day_duration }, // added by [Yor] - { "night_duration", &battle_config.night_duration }, // added by [Yor] - { "max_heal", &battle_config.max_heal }, - { "mob_remove_delay", &battle_config.mob_remove_delay }, - { "sg_miracle_skill_duration", &battle_config.sg_miracle_skill_duration }, - { "hvan_explosion_intimate", &battle_config.hvan_explosion_intimate }, //[orn] -}; int battle_set_value(const char* w1, const char* w2) { + int val = config_switch(w2); + int i; - for(i = 0; i < sizeof(battle_data_short) / (sizeof(battle_data_short[0])); i++) - if (strcmpi(w1, battle_data_short[i].str) == 0) { - *battle_data_short[i].val = config_switch(w2); - return 1; - } - for(i = 0; i < sizeof(battle_data_int) / (sizeof(battle_data_int[0])); i++) - if (strcmpi(w1, battle_data_int[i].str) == 0) { - *battle_data_int[i].val = config_switch(w2); - return 1; - } - return 0; + ARR_FIND(0, ARRAYLENGTH(battle_data), i, strcmpi(w1, battle_data[i].str) == 0); + if (i == ARRAYLENGTH(battle_data)) + return 0; // not found + + if (val < battle_data[i].min || val > battle_data[i].max) + { + ShowWarning("Value for setting '%s': %s is invalid (min:%i max:%i)! Defaulting to %i...\n", w1, w2, battle_data[i].min, battle_data[i].max, battle_data[i].defval); + val = battle_data[i].defval; + } + + *battle_data[i].val = val; + return 1; } int battle_get_value(const char* w1) { int i; - for(i = 0; i < sizeof(battle_data_short) / (sizeof(battle_data_short[0])); i++) - if (strcmpi(w1, battle_data_short[i].str) == 0) { - return *battle_data_short[i].val; - } - for(i = 0; i < sizeof(battle_data_int) / (sizeof(battle_data_int[0])); i++) - if (strcmpi(w1, battle_data_int[i].str) == 0) { - return *battle_data_int[i].val; - } - return 0; + ARR_FIND(0, ARRAYLENGTH(battle_data), i, strcmpi(w1, battle_data[i].str) == 0); + if (i == ARRAYLENGTH(battle_data)) + return 0; // not found + else + return *battle_data[i].val; } void battle_set_defaults() { - battle_config.warp_point_debug=0; - battle_config.enable_critical=BL_PC; - battle_config.mob_critical_rate=100; - battle_config.critical_rate=100; - battle_config.enable_baseatk = BL_PC|BL_HOM; - battle_config.enable_perfect_flee = BL_PC|BL_PET; - battle_config.cast_rate=100; - battle_config.delay_rate=100; - battle_config.delay_dependon_dex=0; - battle_config.delay_dependon_agi=0; - battle_config.sdelay_attack_enable=0; - battle_config.left_cardfix_to_right=0; - battle_config.skill_add_range=0; - battle_config.skill_out_range_consume=1; - battle_config.skillrange_by_distance=~BL_PC; - battle_config.use_weapon_skill_range=~BL_PC; - battle_config.pc_damage_delay_rate=100; - battle_config.defnotenemy=0; - battle_config.vs_traps_bctall=BL_PC; - battle_config.traps_setting=0; - battle_config.summon_flora=3; - battle_config.clear_unit_ondeath=BL_ALL; - battle_config.clear_unit_onwarp=BL_ALL; - battle_config.random_monster_checklv=1; - battle_config.attr_recover=1; - battle_config.flooritem_lifetime=LIFETIME_FLOORITEM*1000; - battle_config.item_auto_get=0; - battle_config.item_first_get_time=3000; - battle_config.item_second_get_time=1000; - battle_config.item_third_get_time=1000; - battle_config.mvp_item_first_get_time=10000; - battle_config.mvp_item_second_get_time=10000; - battle_config.mvp_item_third_get_time=2000; - - battle_config.drop_rate0item=0; - battle_config.base_exp_rate=100; - battle_config.job_exp_rate=100; - battle_config.pvp_exp=1; - battle_config.gtb_sc_immunity=50; - battle_config.death_penalty_type=0; - battle_config.death_penalty_base=0; - battle_config.death_penalty_job=0; - battle_config.zeny_penalty=0; - battle_config.restart_hp_rate=0; - battle_config.restart_sp_rate=0; - battle_config.mvp_exp_rate=100; - battle_config.mvp_hp_rate=100; - battle_config.monster_hp_rate=100; - battle_config.monster_max_aspd=199; - battle_config.view_range_rate=100; - battle_config.chase_range_rate=100; - battle_config.atc_gmonly=0; - battle_config.atc_spawn_quantity_limit=0; - battle_config.atc_slave_clone_limit=0; - battle_config.partial_name_scan=0; - battle_config.gm_allskill=0; - battle_config.gm_allequip=0; - battle_config.gm_skilluncond=0; - battle_config.gm_join_chat=0; - battle_config.gm_kick_chat=0; - battle_config.guild_max_castles=0; - battle_config.emergency_call=15; - battle_config.guild_aura=31; - battle_config.skillfree = 0; - battle_config.skillup_limit = 0; - battle_config.wp_rate=100; - battle_config.pp_rate=100; - battle_config.monster_active_enable=1; - battle_config.monster_damage_delay_rate=100; - battle_config.monster_loot_type=0; - battle_config.mob_skill_rate=100; - battle_config.mob_skill_delay=100; - battle_config.mob_count_rate=100; - battle_config.mob_spawn_delay=100; - battle_config.no_spawn_on_player=0; - battle_config.force_random_spawn=0; - battle_config.plant_spawn_delay=100; - battle_config.boss_spawn_delay=100; - battle_config.slaves_inherit_mode=2; - battle_config.slaves_inherit_speed=3; - battle_config.summons_trigger_autospells=1; - battle_config.pc_walk_delay_rate=20; - battle_config.walk_delay_rate=100; - battle_config.multihit_delay=80; - battle_config.quest_skill_learn=0; - battle_config.quest_skill_reset=1; - battle_config.basic_skill_check=1; - battle_config.guild_emperium_check=1; - battle_config.guild_exp_limit=50; - battle_config.pc_invincible_time = 5000; - battle_config.pet_catch_rate=100; - battle_config.pet_rename=0; - battle_config.pet_friendly_rate=100; - battle_config.pet_hungry_delay_rate=100; - battle_config.pet_hungry_friendly_decrease=5; - battle_config.pet_status_support=0; - battle_config.pet_attack_support=0; - battle_config.pet_damage_support=0; - battle_config.pet_support_min_friendly=900; - battle_config.pet_support_rate=100; - battle_config.pet_attack_exp_to_master=0; - battle_config.pet_attack_exp_rate=100; - battle_config.pet_lv_rate=0; //Skotlex - battle_config.pet_max_stats=99; //Skotlex - battle_config.pet_max_atk1=750; //Skotlex - battle_config.pet_max_atk2=1000; //Skotlex - battle_config.pet_no_gvg=0; //Skotlex - battle_config.skill_min_damage=6; //Ishizu claims that magic and misc attacks always do at least div_ damage. [Skotlex] - battle_config.finger_offensive_type=0; - battle_config.heal_exp=0; - battle_config.max_heal=9999; - battle_config.max_heal_lv=11; - battle_config.resurrection_exp=0; - battle_config.shop_exp=0; - battle_config.combo_delay_rate=100; - battle_config.item_check=1; - battle_config.item_use_interval=100; //Use some very low value that won't bother players, but should cap bots. - battle_config.wedding_modifydisplay=0; - battle_config.wedding_ignorepalette=0; - battle_config.xmas_ignorepalette=0; // [Valaris] - battle_config.natural_healhp_interval=6000; - battle_config.natural_healsp_interval=8000; - battle_config.natural_heal_skill_interval=10000; - battle_config.natural_heal_weight_rate=50; - battle_config.arrow_decrement=1; - battle_config.max_aspd = 199; - battle_config.max_walk_speed = 300; - battle_config.max_hp = 32500; - battle_config.max_sp = 32500; - battle_config.max_lv = 99; // [MouseJstr] - battle_config.aura_lv = 99; // [Skotlex] - battle_config.max_parameter = 99; - battle_config.max_baby_parameter = 80; - battle_config.max_cart_weight = 8000; - battle_config.max_def = 99; // [Skotlex] - battle_config.over_def_bonus = 0; // [Skotlex] - battle_config.skill_log = 0; - battle_config.battle_log = 0; - battle_config.save_log = 0; - battle_config.error_log = 1; - battle_config.etc_log = 1; - battle_config.save_clothcolor = 0; - battle_config.undead_detect_type = 0; - battle_config.auto_counter_type = BL_ALL; - battle_config.min_hitrate = 5; - battle_config.max_hitrate = 100; - battle_config.agi_penalty_target = BL_PC; - battle_config.agi_penalty_type = 1; - battle_config.agi_penalty_count = 3; - battle_config.agi_penalty_num = 10; - battle_config.agi_penalty_count_lv = ATK_FLEE; - battle_config.vit_penalty_target = BL_PC; - battle_config.vit_penalty_type = 1; - battle_config.vit_penalty_count = 3; - battle_config.vit_penalty_num = 5; - battle_config.vit_penalty_count_lv = ATK_DEF; - battle_config.weapon_defense_type = 0; - battle_config.magic_defense_type = 0; - battle_config.skill_reiteration = 0; - battle_config.skill_nofootset = BL_PC; - battle_config.pc_cloak_check_type = 1; - battle_config.monster_cloak_check_type = 0; - battle_config.estimation_type = 3; - battle_config.gvg_short_damage_rate = 80; - battle_config.gvg_long_damage_rate = 80; - battle_config.gvg_weapon_damage_rate = 60; - battle_config.gvg_magic_damage_rate = 60; - battle_config.gvg_misc_damage_rate = 60; - battle_config.gvg_flee_penalty = 20; - battle_config.gvg_eliminate_time = 7000; - - battle_config.pk_short_damage_rate = 80; - battle_config.pk_long_damage_rate = 70; - battle_config.pk_weapon_damage_rate = 60; - battle_config.pk_magic_damage_rate = 60; - battle_config.pk_misc_damage_rate = 60; - - battle_config.mob_changetarget_byskill = 0; - battle_config.attack_direction_change = BL_ALL; - battle_config.land_skill_limit = BL_ALL; - battle_config.party_skill_penalty = 1; - battle_config.monster_class_change_full_recover = 1; - battle_config.produce_item_name_input = 0x3; - battle_config.display_skill_fail = 0; - battle_config.chat_warpportal = 0; - battle_config.mob_warp = 0; - battle_config.dead_branch_active = 0; - battle_config.vending_max_value = 10000000; - battle_config.vending_tax = 0; - battle_config.show_steal_in_same_party = 0; - battle_config.party_update_interval = 1000; - battle_config.party_share_type = 0; - battle_config.party_hp_mode = 0; - battle_config.party_show_share_picker = 0; - battle_config.attack_attr_none = ~BL_PC; - battle_config.gx_allhit = 1; - battle_config.gx_disptype = 1; - battle_config.devotion_level_difference = 10; - battle_config.player_skill_partner_check = 1; - battle_config.hide_GM_session = 0; - battle_config.invite_request_check = 1; - battle_config.skill_removetrap_type = 0; - battle_config.disp_experience = 0; - battle_config.disp_zeny = 0; - battle_config.castle_defense_rate = 100; - battle_config.hp_rate = 100; - battle_config.sp_rate = 100; - battle_config.gm_cant_drop_min_lv = 1; - battle_config.gm_cant_drop_max_lv = 0; - battle_config.disp_hpmeter = 60; - battle_config.skill_wall_check = 1; - battle_config.cell_stack_limit = 1; - battle_config.bone_drop = 0; - battle_config.buyer_name = 1; - -// eAthena additions - battle_config.item_rate_mvp=100; - battle_config.item_rate_common = 100; - battle_config.item_rate_common_boss = 100; // [Reddozen] - battle_config.item_rate_equip = 100; - battle_config.item_rate_equip_boss = 100; // [Reddozen] - battle_config.item_rate_card = 100; - battle_config.item_rate_card_boss = 100; // [Reddozen] - battle_config.item_rate_heal = 100; // Added by Valaris - battle_config.item_rate_heal_boss = 100; // [Reddozen] - battle_config.item_rate_use = 100; // End - battle_config.item_rate_use_boss = 100; // [Reddozen] - battle_config.item_rate_adddrop = 100; - battle_config.item_rate_treasure = 100; - battle_config.logarithmic_drops = 0; - battle_config.item_drop_common_min=1; // Added by TyrNemesis^ - battle_config.item_drop_common_max=10000; - battle_config.item_drop_equip_min=1; - battle_config.item_drop_equip_max=10000; - battle_config.item_drop_card_min=1; - battle_config.item_drop_card_max=10000; - battle_config.item_drop_mvp_min=1; - battle_config.item_drop_mvp_max=10000; // End Addition - battle_config.item_drop_heal_min=1; // Added by Valaris - battle_config.item_drop_heal_max=10000; - battle_config.item_drop_use_min=1; - battle_config.item_drop_use_max=10000; // End - battle_config.item_drop_adddrop_min=1; - battle_config.item_drop_adddrop_max=10000; - battle_config.item_drop_treasure_min=1; - battle_config.item_drop_treasure_max=10000; - battle_config.prevent_logout = 10000; // Added by RoVeRT - battle_config.drops_by_luk = 0; // [Valaris] - battle_config.drops_by_luk2 = 0; - battle_config.equip_natural_break_rate = 1; - battle_config.equip_self_break_rate = 100; // [Valaris], adapted by [Skotlex] - battle_config.equip_skill_break_rate = 100; // [Valaris], adapted by [Skotlex] - battle_config.pk_mode = 0; // [Valaris] - battle_config.pk_level_range = 0; // [Skotlex] - battle_config.manner_system = 0xFFF; // [Valaris] - battle_config.pet_equip_required = 0; // [Valaris] - battle_config.multi_level_up = 0; // [Valaris] - battle_config.max_exp_gain_rate = 0; // [Skotlex] - battle_config.backstab_bow_penalty = 0; // Akaru - battle_config.night_at_start = 0; // added by [Yor] - battle_config.day_duration = 2*60*60*1000; // added by [Yor] (2 hours) - battle_config.night_duration = 30*60*1000; // added by [Yor] (30 minutes) - battle_config.show_mob_info = 0; - battle_config.hack_info_GM_level = 60; // added by [Yor] (default: 60, GM level) - battle_config.any_warp_GM_min_level = 20; // added by [Yor] - battle_config.packet_ver_flag = 1023; // added by [Yor] - battle_config.min_hair_style = 0; - battle_config.max_hair_style = 23; - battle_config.min_hair_color = 0; - battle_config.max_hair_color = 9; - battle_config.min_cloth_color = 0; - battle_config.max_cloth_color = 4; - battle_config.pet_hair_style = 100; - battle_config.zeny_from_mobs = 0; - battle_config.mobs_level_up = 0; // [Valaris] - battle_config.mobs_level_up_exp_rate = 1; // [Valaris] - battle_config.pk_min_level = 55; - battle_config.skill_steal_type = 1; - battle_config.skill_steal_rate = 100; - battle_config.skill_steal_max_tries = 0; //Default: unlimited tries. - battle_config.motd_type = 0; - battle_config.finding_ore_rate = 100; - battle_config.castrate_dex_scale = 150; - battle_config.area_size = 14; - battle_config.exp_calc_type = 1; - battle_config.exp_bonus_attacker = 25; - battle_config.exp_bonus_max_attacker = 12; - battle_config.min_skill_delay_limit = 100; - battle_config.default_skill_delay = 300; //Default skill delay according to official servers. - battle_config.no_skill_delay = BL_MOB; - battle_config.attack_walk_delay = 0; - battle_config.require_glory_guild = 0; - battle_config.idle_no_share = 0; - battle_config.party_even_share_bonus = 0; - battle_config.delay_battle_damage = 1; - battle_config.hide_woe_damage = 0; - battle_config.display_version = 1; - battle_config.who_display_aid = 0; - battle_config.display_hallucination = 1; - battle_config.ignore_items_gender = 1; - battle_config.copyskill_restrict = 2; - battle_config.berserk_cancels_buffs = 1; - battle_config.debuff_on_logout = 1; - battle_config.use_statpoint_table = 1; - battle_config.mob_ai = 0; - battle_config.hom_setting = 0xFFFF; - battle_config.dynamic_mobs = 1; // use Dynamic Mobs [Wizputer] - battle_config.mob_remove_damaged = 1; // Dynamic Mobs - Remove mobs even if damaged [Wizputer] - battle_config.mob_remove_delay = 60000; - battle_config.show_hp_sp_drain = 0; //Display drained hp/sp from attacks - battle_config.show_hp_sp_gain = 1; //Display gained hp/sp from mob-kills - battle_config.mob_npc_event_type = 1; //Execute npc-event on player that delivered final blow. - battle_config.mob_clear_delay = 0; - battle_config.character_size = 3; //3: Peco riders Size=2, Baby Class Riders Size=1 [Lupus] - battle_config.mob_max_skilllvl = MAX_SKILL_LEVEL; //max possible level of monsters skills [Lupus] - battle_config.retaliate_to_master = 1; //Make mobs retaliate against the master rather than the mob that attacked them. [Skotlex] - battle_config.rare_drop_announce = 1; //show global announces for rare items drops (<= 0.01% chance) [Lupus] - battle_config.firewall_hits_on_undead = 1; - battle_config.title_lvl1 = 1; //Players Titles for @who, etc commands [Lupus] - battle_config.title_lvl2 = 10; - battle_config.title_lvl3 = 20; - battle_config.title_lvl4 = 40; - battle_config.title_lvl5 = 50; - battle_config.title_lvl6 = 60; - battle_config.title_lvl7 = 80; - battle_config.title_lvl8 = 99; - - battle_config.duel_allow_pvp = 0; - battle_config.duel_allow_gvg = 0; - battle_config.duel_allow_teleport = 0; - battle_config.duel_autoleave_when_die = 1; - battle_config.duel_time_interval = 60; - battle_config.duel_only_on_same_map = 0; - - battle_config.skip_teleport_lv1_menu = 0; - battle_config.allow_skill_without_day = 0; - battle_config.allow_es_magic_pc = 0; - - battle_config.skill_caster_check = 1; - battle_config.sc_castcancel = BL_NUL; - battle_config.pc_sc_def_rate = 100; - battle_config.mob_sc_def_rate = 100; - battle_config.pc_luk_sc_def = 300; - battle_config.mob_luk_sc_def = 300; - battle_config.pc_max_sc_def = 100; - battle_config.mob_max_sc_def = 100; - battle_config.sg_miracle_skill_ratio=1; - battle_config.sg_angel_skill_ratio=1; - battle_config.sg_miracle_skill_duration=3600000; - battle_config.autospell_stacking = 0; - battle_config.override_mob_names = 0; - battle_config.min_chat_delay = 0; - battle_config.friend_auto_add = 1; - battle_config.hvan_explosion_intimate = 45000; //[orn] - battle_config.hom_rename=0; - battle_config.homunculus_show_growth = 0; //[orn] - battle_config.homunculus_friendly_rate = 100; + int i; + for (i = 0; i < ARRAYLENGTH(battle_data); i++) + *battle_data[i].val = battle_data[i].defval; } -void battle_validate_conf() { - if(battle_config.flooritem_lifetime < 1000) - battle_config.flooritem_lifetime = LIFETIME_FLOORITEM*1000; -/* if(battle_config.restart_hp_rate < 0) - battle_config.restart_hp_rate = 0; - else*/ if(battle_config.restart_hp_rate > 100) - battle_config.restart_hp_rate = 100; -/* if(battle_config.restart_sp_rate < 0) - battle_config.restart_sp_rate = 0; - else*/ if(battle_config.restart_sp_rate > 100) - battle_config.restart_sp_rate = 100; - if(battle_config.natural_healhp_interval < NATURAL_HEAL_INTERVAL) - battle_config.natural_healhp_interval=NATURAL_HEAL_INTERVAL; - if(battle_config.natural_healsp_interval < NATURAL_HEAL_INTERVAL) - battle_config.natural_healsp_interval=NATURAL_HEAL_INTERVAL; - if(battle_config.natural_heal_skill_interval < NATURAL_HEAL_INTERVAL) - battle_config.natural_heal_skill_interval=NATURAL_HEAL_INTERVAL; - if(battle_config.natural_heal_weight_rate < 50) - battle_config.natural_heal_weight_rate = 50; - if(battle_config.natural_heal_weight_rate > 101) - battle_config.natural_heal_weight_rate = 101; +void battle_adjust_conf() +{ battle_config.monster_max_aspd = 2000 - battle_config.monster_max_aspd*10; - if(battle_config.monster_max_aspd < 10) - battle_config.monster_max_aspd = 10; - if(battle_config.monster_max_aspd > 1000) - battle_config.monster_max_aspd = 1000; battle_config.max_aspd = 2000 - battle_config.max_aspd*10; - if(battle_config.max_aspd < 10) - battle_config.max_aspd = 10; - if(battle_config.max_aspd > 1000) - battle_config.max_aspd = 1000; - - if (battle_config.max_walk_speed < 100) - battle_config.max_walk_speed = 100; - battle_config.max_walk_speed = 100*DEFAULT_WALK_SPEED/battle_config.max_walk_speed; - if (battle_config.max_walk_speed < 1) - battle_config.max_walk_speed = 1; - - if(battle_config.hp_rate < 1) - battle_config.hp_rate = 1; - if(battle_config.sp_rate < 1) - battle_config.sp_rate = 1; - if(battle_config.max_hp > 1000000000) - battle_config.max_hp = 1000000000; - if(battle_config.max_hp < 100) - battle_config.max_hp = 100; - if(battle_config.max_sp > 1000000000) - battle_config.max_sp = 1000000000; - if(battle_config.max_sp < 100) - battle_config.max_sp = 100; - if(battle_config.max_parameter < 10) - battle_config.max_parameter = 10; - if(battle_config.max_parameter > 10000) - battle_config.max_parameter = 10000; - if(battle_config.max_baby_parameter < 10) - battle_config.max_baby_parameter = 10; - if(battle_config.max_baby_parameter > 10000) - battle_config.max_baby_parameter = 10000; - if(battle_config.max_cart_weight > 1000000) - battle_config.max_cart_weight = 1000000; - if(battle_config.max_cart_weight < 100) - battle_config.max_cart_weight = 100; + battle_config.max_walk_speed = 100*DEFAULT_WALK_SPEED/battle_config.max_walk_speed; battle_config.max_cart_weight *= 10; if(battle_config.max_def > 100 && !battle_config.weapon_defense_type) // added by [Skotlex] battle_config.max_def = 100; - if(battle_config.over_def_bonus > 1000) - battle_config.over_def_bonus = 1000; if(battle_config.min_hitrate > battle_config.max_hitrate) battle_config.min_hitrate = battle_config.max_hitrate; - if(battle_config.agi_penalty_count < 2) - battle_config.agi_penalty_count = 2; - if(battle_config.vit_penalty_count < 2) - battle_config.vit_penalty_count = 2; - - if(battle_config.party_update_interval < 100) - battle_config.party_update_interval = 100; - - if(battle_config.guild_exp_limit > 99) - battle_config.guild_exp_limit = 99; -/* if(battle_config.guild_exp_limit < 0) - battle_config.guild_exp_limit = 0;*/ - - if(battle_config.pet_support_min_friendly > 950) //Capped to 950/1000 [Skotlex] - battle_config.pet_support_min_friendly = 950; - - if(battle_config.pet_hungry_delay_rate < 10) - battle_config.pet_hungry_delay_rate=10; - if(battle_config.pet_max_atk1 > battle_config.pet_max_atk2) //Skotlex battle_config.pet_max_atk1 = battle_config.pet_max_atk2; -// if(battle_config.castle_defense_rate < 0) -// battle_config.castle_defense_rate = 0; - if(battle_config.castle_defense_rate > 100) - battle_config.castle_defense_rate = 100; - if(battle_config.item_drop_common_min < 1) // Added by TyrNemesis^ - battle_config.item_drop_common_min = 1; - if(battle_config.item_drop_common_max > 10000) - battle_config.item_drop_common_max = 10000; - if(battle_config.item_drop_equip_min < 1) - battle_config.item_drop_equip_min = 1; - if(battle_config.item_drop_equip_max > 10000) - battle_config.item_drop_equip_max = 10000; - if(battle_config.item_drop_card_min < 1) - battle_config.item_drop_card_min = 1; - if(battle_config.item_drop_card_max > 10000) - battle_config.item_drop_card_max = 10000; - if(battle_config.item_drop_mvp_min < 1) - battle_config.item_drop_mvp_min = 1; - if(battle_config.item_drop_mvp_max > 10000) - battle_config.item_drop_mvp_max = 10000; // End Addition - if(battle_config.item_drop_heal_min < 1) - battle_config.item_drop_heal_min = 1; - if(battle_config.item_drop_heal_max > 10000) - battle_config.item_drop_heal_max = 10000; - if(battle_config.item_drop_use_min < 1) - battle_config.item_drop_use_min = 1; - if(battle_config.item_drop_use_max > 10000) - battle_config.item_drop_use_max = 10000; - if(battle_config.item_drop_adddrop_min < 1) - battle_config.item_drop_adddrop_min = 1; - if(battle_config.item_drop_adddrop_max > 10000) - battle_config.item_drop_adddrop_max = 10000; - if(battle_config.item_drop_treasure_min < 1) - battle_config.item_drop_treasure_min = 1; - if(battle_config.item_drop_treasure_max > 10000) - battle_config.item_drop_treasure_max = 10000; - if (battle_config.day_duration && battle_config.day_duration < 60000) // added by [Yor] battle_config.day_duration = 60000; if (battle_config.night_duration && battle_config.night_duration < 60000) // added by [Yor] battle_config.night_duration = 60000; - if (battle_config.hack_info_GM_level > 100) - battle_config.hack_info_GM_level = 100; - - if (battle_config.any_warp_GM_min_level > 100) - battle_config.any_warp_GM_min_level = 100; - - if (battle_config.vending_max_value > MAX_ZENY || battle_config.vending_max_value <= 0) - battle_config.vending_max_value = MAX_ZENY; - - if (battle_config.vending_tax > 10000) - battle_config.vending_tax = 10000; - - if (battle_config.min_skill_delay_limit < 10) - battle_config.min_skill_delay_limit = 10; // minimum delay of 10ms - - if (battle_config.exp_bonus_max_attacker < 2) - battle_config.exp_bonus_max_attacker = 2; - - if (battle_config.no_spawn_on_player > 100) - battle_config.no_spawn_on_player = 100; - if (battle_config.mob_remove_delay < 15000) //Min 15 sec - battle_config.mob_remove_delay = 15000; - if (battle_config.dynamic_mobs > 1) - battle_config.dynamic_mobs = 1; //The flag will be used in assignations - if (battle_config.mob_max_skilllvl> MAX_SKILL_LEVEL || battle_config.mob_max_skilllvl<1 ) - battle_config.mob_max_skilllvl = MAX_SKILL_LEVEL; - - if (battle_config.firewall_hits_on_undead < 1) - battle_config.firewall_hits_on_undead = 1; - else if (battle_config.firewall_hits_on_undead > 255) //The flag passed to battle_calc_damage is limited to 0xff - battle_config.firewall_hits_on_undead = 255; - - if (battle_config.prevent_logout > 60000) - battle_config.prevent_logout = 60000; - - if (battle_config.mobs_level_up_exp_rate < 1) // [Valaris] - battle_config.mobs_level_up_exp_rate = 1; - - if (battle_config.pc_luk_sc_def < 1) - battle_config.pc_luk_sc_def = 1; - if (battle_config.mob_luk_sc_def < 1) - battle_config.mob_luk_sc_def = 1; - - if (battle_config.sg_miracle_skill_ratio > 10000) - battle_config.sg_miracle_skill_ratio = 10000; - - if (battle_config.skill_steal_max_tries >= UCHAR_MAX) - battle_config.skill_steal_max_tries = UCHAR_MAX; - -#ifdef CELL_NOSTACK - if (battle_config.cell_stack_limit < 1) - battle_config.cell_stack_limit = 1; - else - if (battle_config.cell_stack_limit > 255) - battle_config.cell_stack_limit = 255; -#else +#ifndef CELL_NOSTACK if (battle_config.cell_stack_limit != 1) ShowWarning("Battle setting 'cell_stack_limit' takes no effect as this server was compiled without Cell Stack Limit support.\n"); #endif - - if(battle_config.hvan_explosion_intimate > 100000) //[orn] - battle_config.hvan_explosion_intimate = 100000; } -/*========================================== - * ?ン定ファイルを読み?桙゙ - *------------------------------------------*/ -int battle_config_read(const char *cfgName) +int battle_config_read(const char* cfgName) { char line[1024], w1[1024], w2[1024]; - FILE *fp; + FILE* fp; static int count = 0; - if ((count++) == 0) + if (count == 0) battle_set_defaults(); + count++; + fp = fopen(cfgName,"r"); if (fp == NULL) { ShowError("File not found: %s\n", cfgName); @@ -4316,17 +3779,20 @@ int battle_config_read(const char *cfgName) { if (line[0] == '/' && line[1] == '/') continue; - if (sscanf(line, "%[^:]:%s", w1, w2) != 2) + if (sscanf(line, "%1023[^:]:%1023s", w1, w2) != 2) continue; if (strcmpi(w1, "import") == 0) battle_config_read(w2); else - battle_set_value(w1, w2); + if (battle_set_value(w1, w2) == 0) + ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName); } fclose(fp); - if (--count == 0) - battle_validate_conf(); + count--; + + if (count == 0) + battle_adjust_conf(); return 0; } diff --git a/src/map/battle.h b/src/map/battle.h index ff4270bce..1bd781f2b 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -87,31 +87,32 @@ int battle_check_range(struct block_list *src,struct block_list *bl,int range); void battle_consume_ammo(struct map_session_data* sd, int skill, int lv); // 設定 -extern struct Battle_Config { - unsigned short warp_point_debug; - unsigned short enable_critical; - unsigned short mob_critical_rate; - unsigned short critical_rate; - unsigned short enable_baseatk; - unsigned short enable_perfect_flee; - unsigned short cast_rate, delay_rate; - unsigned short delay_dependon_dex, delay_dependon_agi; - unsigned short sdelay_attack_enable; - unsigned short left_cardfix_to_right; - unsigned short skill_add_range; - unsigned short skill_out_range_consume; - unsigned short skillrange_by_distance; //[Skotlex] - unsigned short use_weapon_skill_range; //[Skotlex] - unsigned short pc_damage_delay_rate; - unsigned short defnotenemy; - unsigned short vs_traps_bctall; - unsigned short traps_setting; - unsigned short summon_flora; //[Skotlex] - unsigned short clear_unit_ondeath; //[Skotlex] - unsigned short clear_unit_onwarp; //[Skotlex] - unsigned short random_monster_checklv; - unsigned short attr_recover; - unsigned short item_auto_get; +extern struct Battle_Config +{ + int warp_point_debug; + int enable_critical; + int mob_critical_rate; + int critical_rate; + int enable_baseatk; + int enable_perfect_flee; + int cast_rate, delay_rate; + int delay_dependon_dex, delay_dependon_agi; + int sdelay_attack_enable; + int left_cardfix_to_right; + int skill_add_range; + int skill_out_range_consume; + int skillrange_by_distance; //[Skotlex] + int use_weapon_skill_range; //[Skotlex] + int pc_damage_delay_rate; + int defnotenemy; + int vs_traps_bctall; + int traps_setting; + int summon_flora; //[Skotlex] + int clear_unit_ondeath; //[Skotlex] + int clear_unit_onwarp; //[Skotlex] + int random_monster_checklv; + int attr_recover; + int item_auto_get; int flooritem_lifetime; int item_first_get_time; int item_second_get_time; @@ -120,321 +121,320 @@ extern struct Battle_Config { int mvp_item_second_get_time; int mvp_item_third_get_time; int base_exp_rate,job_exp_rate; - unsigned short drop_rate0item; - unsigned short death_penalty_type; - unsigned short death_penalty_base,death_penalty_job; - unsigned short pvp_exp; // [MouseJstr] - unsigned short gtb_sc_immunity; + int drop_rate0item; + int death_penalty_type; + int death_penalty_base,death_penalty_job; + int pvp_exp; // [MouseJstr] + int gtb_sc_immunity; int zeny_penalty; - unsigned short restart_hp_rate; - unsigned short restart_sp_rate; + int restart_hp_rate; + int restart_sp_rate; int mvp_exp_rate; - unsigned short mvp_hp_rate; - unsigned short monster_hp_rate; - unsigned short monster_max_aspd; - unsigned short view_range_rate; - unsigned short chase_range_rate; - unsigned short atc_gmonly; - unsigned short atc_spawn_quantity_limit; - unsigned short atc_slave_clone_limit; - unsigned short partial_name_scan; - unsigned short gm_allskill; - unsigned short gm_allequip; - unsigned short gm_skilluncond; - unsigned short gm_join_chat; - unsigned short gm_kick_chat; - unsigned short skillfree; - unsigned short skillup_limit; - unsigned short wp_rate; - unsigned short pp_rate; - unsigned short monster_active_enable; - unsigned short monster_damage_delay_rate; - unsigned short monster_loot_type; - unsigned short mob_skill_rate; //[Skotlex] - unsigned short mob_skill_delay; //[Skotlex] - unsigned short mob_count_rate; - unsigned short no_spawn_on_player; //[Skotlex] - unsigned short force_random_spawn; //[Skotlex] - unsigned short mob_spawn_delay, plant_spawn_delay, boss_spawn_delay; // [Skotlex] - unsigned short slaves_inherit_mode; - unsigned short slaves_inherit_speed; - unsigned short summons_trigger_autospells; - unsigned short pc_walk_delay_rate; //Adjusts can't walk delay after being hit for players. [Skotlex] - unsigned short walk_delay_rate; //Adjusts can't walk delay after being hit. [Skotlex] - unsigned short multihit_delay; //Adjusts can't walk delay per hit on multi-hitting skills. [Skotlex] - unsigned short quest_skill_learn; - unsigned short quest_skill_reset; - unsigned short basic_skill_check; - unsigned short guild_emperium_check; - unsigned short guild_exp_limit; - unsigned short guild_max_castles; - unsigned short emergency_call; - unsigned short guild_aura; - unsigned short pc_invincible_time; - unsigned short pet_catch_rate; - unsigned short pet_rename; - unsigned short pet_friendly_rate; - unsigned short pet_hungry_delay_rate; - unsigned short pet_hungry_friendly_decrease; - unsigned short pet_status_support; - unsigned short pet_attack_support; - unsigned short pet_damage_support; - unsigned short pet_support_min_friendly; //[Skotlex] - unsigned short pet_support_rate; - unsigned short pet_attack_exp_to_master; - unsigned short pet_attack_exp_rate; - unsigned short pet_lv_rate; //[Skotlex] - unsigned short pet_max_stats; //[Skotlex] - unsigned short pet_max_atk1; //[Skotlex] - unsigned short pet_max_atk2; //[Skotlex] - unsigned short pet_no_gvg; //Disables pets in gvg. [Skotlex] - unsigned short skill_min_damage; - unsigned short finger_offensive_type; - unsigned short heal_exp; - unsigned short max_heal_lv; + int mvp_hp_rate; + int monster_hp_rate; + int monster_max_aspd; + int view_range_rate; + int chase_range_rate; + int atc_gmonly; + int atc_spawn_quantity_limit; + int atc_slave_clone_limit; + int partial_name_scan; + int gm_allskill; + int gm_allequip; + int gm_skilluncond; + int gm_join_chat; + int gm_kick_chat; + int skillfree; + int skillup_limit; + int wp_rate; + int pp_rate; + int monster_active_enable; + int monster_damage_delay_rate; + int monster_loot_type; + int mob_skill_rate; //[Skotlex] + int mob_skill_delay; //[Skotlex] + int mob_count_rate; + int no_spawn_on_player; //[Skotlex] + int force_random_spawn; //[Skotlex] + int mob_spawn_delay, plant_spawn_delay, boss_spawn_delay; // [Skotlex] + int slaves_inherit_mode; + int slaves_inherit_speed; + int summons_trigger_autospells; + int pc_walk_delay_rate; //Adjusts can't walk delay after being hit for players. [Skotlex] + int walk_delay_rate; //Adjusts can't walk delay after being hit. [Skotlex] + int multihit_delay; //Adjusts can't walk delay per hit on multi-hitting skills. [Skotlex] + int quest_skill_learn; + int quest_skill_reset; + int basic_skill_check; + int guild_emperium_check; + int guild_exp_limit; + int guild_max_castles; + int emergency_call; + int guild_aura; + int pc_invincible_time; + int pet_catch_rate; + int pet_rename; + int pet_friendly_rate; + int pet_hungry_delay_rate; + int pet_hungry_friendly_decrease; + int pet_status_support; + int pet_attack_support; + int pet_damage_support; + int pet_support_min_friendly; //[Skotlex] + int pet_support_rate; + int pet_attack_exp_to_master; + int pet_attack_exp_rate; + int pet_lv_rate; //[Skotlex] + int pet_max_stats; //[Skotlex] + int pet_max_atk1; //[Skotlex] + int pet_max_atk2; //[Skotlex] + int pet_no_gvg; //Disables pets in gvg. [Skotlex] + int skill_min_damage; + int finger_offensive_type; + int heal_exp; + int max_heal_lv; int max_heal; //Mitternacht - unsigned short resurrection_exp; - unsigned short shop_exp; - unsigned short combo_delay_rate; - unsigned short item_check; - unsigned short item_use_interval; //[Skotlex] - unsigned short wedding_modifydisplay; - unsigned short wedding_ignorepalette; //[Skotlex] - unsigned short xmas_ignorepalette; // [Valaris] + int resurrection_exp; + int shop_exp; + int combo_delay_rate; + int item_check; + int item_use_interval; //[Skotlex] + int wedding_modifydisplay; + int wedding_ignorepalette; //[Skotlex] + int xmas_ignorepalette; // [Valaris] int natural_healhp_interval; int natural_healsp_interval; int natural_heal_skill_interval; - unsigned short natural_heal_weight_rate; - unsigned short arrow_decrement; - unsigned short max_aspd; - unsigned short max_walk_speed; //Maximum walking speed after buffs [Skotlex] + int natural_heal_weight_rate; + int arrow_decrement; + int max_aspd; + int max_walk_speed; //Maximum walking speed after buffs [Skotlex] int max_hp; int max_sp; - unsigned short max_lv, aura_lv; - unsigned short max_parameter, max_baby_parameter; + int max_lv, aura_lv; + int max_parameter, max_baby_parameter; int max_cart_weight; - unsigned short skill_log; - unsigned short battle_log; - unsigned short save_log; - unsigned short error_log; - unsigned short etc_log; - unsigned short save_clothcolor; - unsigned short undead_detect_type; - unsigned short auto_counter_type; - unsigned short min_hitrate; //[Skotlex] - unsigned short max_hitrate; //[Skotlex] - unsigned short agi_penalty_target; - unsigned short agi_penalty_type; - unsigned short agi_penalty_count; - unsigned short agi_penalty_num; - unsigned short vit_penalty_target; - unsigned short vit_penalty_type; - unsigned short vit_penalty_count; - unsigned short vit_penalty_num; - unsigned short weapon_defense_type; - unsigned short magic_defense_type; - unsigned short skill_reiteration; - unsigned short skill_nofootset; - unsigned short pc_cloak_check_type; - unsigned short monster_cloak_check_type; - unsigned short estimation_type; - unsigned short gvg_short_damage_rate; - unsigned short gvg_long_damage_rate; - unsigned short gvg_weapon_damage_rate; - unsigned short gvg_magic_damage_rate; - unsigned short gvg_misc_damage_rate; - unsigned short gvg_flee_penalty; + int skill_log; + int battle_log; + int save_log; + int error_log; + int etc_log; + int save_clothcolor; + int undead_detect_type; + int auto_counter_type; + int min_hitrate; //[Skotlex] + int max_hitrate; //[Skotlex] + int agi_penalty_target; + int agi_penalty_type; + int agi_penalty_count; + int agi_penalty_num; + int vit_penalty_target; + int vit_penalty_type; + int vit_penalty_count; + int vit_penalty_num; + int weapon_defense_type; + int magic_defense_type; + int skill_reiteration; + int skill_nofootset; + int pc_cloak_check_type; + int monster_cloak_check_type; + int estimation_type; + int gvg_short_damage_rate; + int gvg_long_damage_rate; + int gvg_weapon_damage_rate; + int gvg_magic_damage_rate; + int gvg_misc_damage_rate; + int gvg_flee_penalty; int gvg_eliminate_time; - unsigned short pk_short_damage_rate; - unsigned short pk_long_damage_rate; - unsigned short pk_weapon_damage_rate; - unsigned short pk_magic_damage_rate; - unsigned short pk_misc_damage_rate; - unsigned short mob_changetarget_byskill; - unsigned short attack_direction_change; - unsigned short land_skill_limit; - unsigned short party_skill_penalty; - unsigned short monster_class_change_full_recover; - unsigned short produce_item_name_input; - unsigned short display_skill_fail; - unsigned short chat_warpportal; - unsigned short mob_warp; - unsigned short dead_branch_active; + int pk_short_damage_rate; + int pk_long_damage_rate; + int pk_weapon_damage_rate; + int pk_magic_damage_rate; + int pk_misc_damage_rate; + int mob_changetarget_byskill; + int attack_direction_change; + int land_skill_limit; + int party_skill_penalty; + int monster_class_change_recover; + int produce_item_name_input; + int display_skill_fail; + int chat_warpportal; + int mob_warp; + int dead_branch_active; int vending_max_value; - unsigned short vending_tax; - unsigned short show_steal_in_same_party; - unsigned short party_share_type; - unsigned short party_hp_mode; - unsigned short party_show_share_picker; - unsigned short attack_attr_none; - int item_rate_mvp, item_rate_common, item_rate_common_boss, item_rate_card, item_rate_card_boss, // added support for MVP drops [Reddozen] + int vending_tax; + int show_steal_in_same_party; + int party_share_type; + int party_hp_mode; + int party_show_share_picker; + int attack_attr_none; + int item_rate_mvp, item_rate_common, item_rate_common_boss, item_rate_card, item_rate_card_boss, item_rate_equip, item_rate_equip_boss, item_rate_heal, item_rate_heal_boss, item_rate_use, - item_rate_use_boss, item_rate_treasure, // Added by RoVeRT, Additional Heal and Usable item rate by Val - item_rate_adddrop; + item_rate_use_boss, item_rate_treasure, item_rate_adddrop; - unsigned short logarithmic_drops; - unsigned short item_drop_common_min,item_drop_common_max; // Added by TyrNemesis^ - unsigned short item_drop_card_min,item_drop_card_max; - unsigned short item_drop_equip_min,item_drop_equip_max; - unsigned short item_drop_mvp_min,item_drop_mvp_max; // End Addition - unsigned short item_drop_heal_min,item_drop_heal_max; // Added by Valatris - unsigned short item_drop_use_min,item_drop_use_max; //End - unsigned short item_drop_treasure_min,item_drop_treasure_max; //by [Skotlex] - unsigned short item_drop_adddrop_min,item_drop_adddrop_max; //[Skotlex] - unsigned short prevent_logout; // Added by RoVeRT - - unsigned short alchemist_summon_reward; // [Valaris] - unsigned short drops_by_luk; - unsigned short drops_by_luk2; - unsigned short equip_natural_break_rate; //Base Natural break rate for attacks. - unsigned short equip_self_break_rate; //Natural & Penalty skills break rate - unsigned short equip_skill_break_rate; //Offensive skills break rate - unsigned short pet_equip_required; - unsigned short multi_level_up; - unsigned short max_exp_gain_rate; //Max amount of exp bar % you can get in one go. - unsigned short pk_mode; - unsigned short pk_level_range; - - unsigned short manner_system; // end additions [Valaris] - unsigned short show_mob_info; - - unsigned short agi_penalty_count_lv; - unsigned short vit_penalty_count_lv; - - unsigned short gx_allhit; - unsigned short gx_disptype; - unsigned short devotion_level_difference; - unsigned short player_skill_partner_check; - unsigned short hide_GM_session; - unsigned short invite_request_check; - unsigned short skill_removetrap_type; - unsigned short disp_experience; - unsigned short disp_zeny; - unsigned short castle_defense_rate; - unsigned short backstab_bow_penalty; - unsigned short hp_rate; - unsigned short sp_rate; - unsigned short gm_cant_drop_min_lv; - unsigned short gm_cant_drop_max_lv; - unsigned short disp_hpmeter; - unsigned short bone_drop; - unsigned short buyer_name; + int logarithmic_drops; + int item_drop_common_min,item_drop_common_max; // Added by TyrNemesis^ + int item_drop_card_min,item_drop_card_max; + int item_drop_equip_min,item_drop_equip_max; + int item_drop_mvp_min,item_drop_mvp_max; // End Addition + int item_drop_heal_min,item_drop_heal_max; // Added by Valatris + int item_drop_use_min,item_drop_use_max; //End + int item_drop_treasure_min,item_drop_treasure_max; //by [Skotlex] + int item_drop_adddrop_min,item_drop_adddrop_max; //[Skotlex] + int prevent_logout; // Added by RoVeRT + + int alchemist_summon_reward; // [Valaris] + int drops_by_luk; + int drops_by_luk2; + int equip_natural_break_rate; //Base Natural break rate for attacks. + int equip_self_break_rate; //Natural & Penalty skills break rate + int equip_skill_break_rate; //Offensive skills break rate + int pet_equip_required; + int multi_level_up; + int max_exp_gain_rate; //Max amount of exp bar % you can get in one go. + int pk_mode; + int pk_level_range; + + int manner_system; // end additions [Valaris] + int show_mob_info; + + int agi_penalty_count_lv; + int vit_penalty_count_lv; + + int gx_allhit; + int gx_disptype; + int devotion_level_difference; + int player_skill_partner_check; + int hide_GM_session; + int invite_request_check; + int skill_removetrap_type; + int disp_experience; + int disp_zeny; + int castle_defense_rate; + int backstab_bow_penalty; + int hp_rate; + int sp_rate; + int gm_cant_drop_min_lv; + int gm_cant_drop_max_lv; + int disp_hpmeter; + int bone_drop; + int buyer_name; // eAthena additions - unsigned short night_at_start; // added by [Yor] + int night_at_start; // added by [Yor] int day_duration; // added by [Yor] int night_duration; // added by [Yor] - short ban_hack_trade; // added by [Yor] - unsigned short hack_info_GM_level; // added by [Yor] - unsigned short any_warp_GM_min_level; // added by [Yor] - unsigned short packet_ver_flag; // added by [Yor] + int ban_hack_trade; // added by [Yor] + int hack_info_GM_level; // added by [Yor] + int any_warp_GM_min_level; // added by [Yor] + int packet_ver_flag; // added by [Yor] - unsigned short min_hair_style; // added by [MouseJstr] - unsigned short max_hair_style; // added by [MouseJstr] - unsigned short min_hair_color; // added by [MouseJstr] - unsigned short max_hair_color; // added by [MouseJstr] - unsigned short min_cloth_color; // added by [MouseJstr] - unsigned short max_cloth_color; // added by [MouseJstr] - unsigned short pet_hair_style; // added by [Skotlex] - - unsigned short castrate_dex_scale; // added by [MouseJstr] - unsigned short area_size; // added by [MouseJstr] - - unsigned short max_def, over_def_bonus; //added by [Skotlex] + int min_hair_style; // added by [MouseJstr] + int max_hair_style; // added by [MouseJstr] + int min_hair_color; // added by [MouseJstr] + int max_hair_color; // added by [MouseJstr] + int min_cloth_color; // added by [MouseJstr] + int max_cloth_color; // added by [MouseJstr] + int pet_hair_style; // added by [Skotlex] + + int castrate_dex_scale; // added by [MouseJstr] + int area_size; // added by [MouseJstr] + + int max_def, over_def_bonus; //added by [Skotlex] - unsigned short zeny_from_mobs; // [Valaris] - unsigned short mobs_level_up; // [Valaris] - unsigned short mobs_level_up_exp_rate; // [Valaris] - unsigned short pk_min_level; // [celest] - unsigned short skill_steal_type; // [celest] - unsigned short skill_steal_rate; // [celest] - unsigned short skill_steal_max_tries; //max steal skill tries on a mob. if 0, then w/o limit [Lupus] - unsigned short motd_type; // [celest] - unsigned short finding_ore_rate; // orn - unsigned short exp_calc_type; - unsigned short exp_bonus_attacker; - unsigned short exp_bonus_max_attacker; - unsigned short min_skill_delay_limit; - unsigned short default_skill_delay; - unsigned short no_skill_delay; - unsigned short attack_walk_delay; - unsigned short require_glory_guild; - unsigned short idle_no_share; - unsigned short party_update_interval; - unsigned short party_even_share_bonus; - unsigned short delay_battle_damage; - unsigned short hide_woe_damage; - unsigned short display_version; - unsigned short who_display_aid; - - unsigned short display_hallucination; // [Skotlex] - unsigned short use_statpoint_table; // [Skotlex] - - unsigned short ignore_items_gender; //[Lupus] - - unsigned short copyskill_restrict; // [Aru] - unsigned short berserk_cancels_buffs; // [Aru] - unsigned short debuff_on_logout; // Removes a few "official" negative Scs on logout. [Skotlex] - unsigned short mob_ai; //Configures various mob_ai settings to make them smarter or dumber(official). [Skotlex] - unsigned short hom_setting; //Configures various homunc settings which make them behave unlike normal characters.. [Skotlex] - unsigned short dynamic_mobs; // Dynamic Mobs [Wizputer] - battle_athena flag implemented by [random] - unsigned short mob_remove_damaged; // Dynamic Mobs - Remove mobs even if damaged [Wizputer] + int zeny_from_mobs; // [Valaris] + int mobs_level_up; // [Valaris] + int mobs_level_up_exp_rate; // [Valaris] + int pk_min_level; // [celest] + int skill_steal_type; // [celest] + int skill_steal_rate; // [celest] + int skill_steal_max_tries; //max steal skill tries on a mob. if 0, then w/o limit [Lupus] + int motd_type; // [celest] + int finding_ore_rate; // orn + int exp_calc_type; + int exp_bonus_attacker; + int exp_bonus_max_attacker; + int min_skill_delay_limit; + int default_skill_delay; + int no_skill_delay; + int attack_walk_delay; + int require_glory_guild; + int idle_no_share; + int party_update_interval; + int party_even_share_bonus; + int delay_battle_damage; + int hide_woe_damage; + int display_version; + int who_display_aid; + + int display_hallucination; // [Skotlex] + int use_statpoint_table; // [Skotlex] + + int ignore_items_gender; //[Lupus] + + int copyskill_restrict; // [Aru] + int berserk_cancels_buffs; // [Aru] + int debuff_on_logout; // Removes a few "official" negative Scs on logout. [Skotlex] + int mob_ai; //Configures various mob_ai settings to make them smarter or dumber(official). [Skotlex] + int hom_setting; //Configures various homunc settings which make them behave unlike normal characters.. [Skotlex] + int dynamic_mobs; // Dynamic Mobs [Wizputer] - battle_athena flag implemented by [random] + int mob_remove_damaged; // Dynamic Mobs - Remove mobs even if damaged [Wizputer] int mob_remove_delay; // Dynamic Mobs - delay before removing mobs from a map [Skotlex] - unsigned short show_hp_sp_drain, show_hp_sp_gain; //[Skotlex] + int show_hp_sp_drain, show_hp_sp_gain; //[Skotlex] - unsigned short mob_npc_event_type; //Determines on who the npc_event is executed. [Skotlex] - unsigned short mob_clear_delay; // [Valaris] + int mob_npc_event_type; //Determines on who the npc_event is executed. [Skotlex] + int mob_clear_delay; // [Valaris] - unsigned short character_size; // if riders have size=2, and baby class riders size=1 [Lupus] - unsigned short mob_max_skilllvl; // Max possible skill level [Lupus] - unsigned short rare_drop_announce; // chance <= to show rare drops global announces + int character_size; // if riders have size=2, and baby class riders size=1 [Lupus] + int mob_max_skilllvl; // Max possible skill level [Lupus] + int rare_drop_announce; // chance <= to show rare drops global announces - unsigned short retaliate_to_master; //Whether when a mob is attacked by another mob, it will retaliate versus the mob or the mob's master. [Skotlex] - unsigned short firewall_hits_on_undead; //Number of hits firewall does at a time on undead. [Skotlex] + int retaliate_to_master; //Whether when a mob is attacked by another mob, it will retaliate versus the mob or the mob's master. [Skotlex] + int firewall_hits_on_undead; //Number of hits firewall does at a time on undead. [Skotlex] - unsigned short title_lvl1; // Players titles [Lupus] - unsigned short title_lvl2; // Players titles [Lupus] - unsigned short title_lvl3; // Players titles [Lupus] - unsigned short title_lvl4; // Players titles [Lupus] - unsigned short title_lvl5; // Players titles [Lupus] - unsigned short title_lvl6; // Players titles [Lupus] - unsigned short title_lvl7; // Players titles [Lupus] - unsigned short title_lvl8; // Players titles [Lupus] + int title_lvl1; // Players titles [Lupus] + int title_lvl2; // Players titles [Lupus] + int title_lvl3; // Players titles [Lupus] + int title_lvl4; // Players titles [Lupus] + int title_lvl5; // Players titles [Lupus] + int title_lvl6; // Players titles [Lupus] + int title_lvl7; // Players titles [Lupus] + int title_lvl8; // Players titles [Lupus] - unsigned short duel_allow_pvp; // [LuzZza] - unsigned short duel_allow_gvg; // [LuzZza] - unsigned short duel_allow_teleport; // [LuzZza] - unsigned short duel_autoleave_when_die; // [LuzZza] - unsigned short duel_time_interval; // [LuzZza] - unsigned short duel_only_on_same_map; // [Toms] + int duel_allow_pvp; // [LuzZza] + int duel_allow_gvg; // [LuzZza] + int duel_allow_teleport; // [LuzZza] + int duel_autoleave_when_die; // [LuzZza] + int duel_time_interval; // [LuzZza] + int duel_only_on_same_map; // [Toms] - unsigned short skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza] - - unsigned short allow_skill_without_day; // [Komurka] - unsigned short allow_es_magic_pc; // [Skotlex] - unsigned short skill_wall_check; // [Skotlex] - unsigned short cell_stack_limit; // [Skotlex] - unsigned short skill_caster_check; // [Skotlex] - unsigned short sc_castcancel; // [Skotlex] - unsigned short pc_sc_def_rate; // [Skotlex] - unsigned short mob_sc_def_rate; - unsigned short pc_luk_sc_def; - unsigned short mob_luk_sc_def; - unsigned short pc_max_sc_def; - unsigned short mob_max_sc_def; - - unsigned short sg_angel_skill_ratio; - unsigned short sg_miracle_skill_ratio; + int skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza] + + int allow_skill_without_day; // [Komurka] + int allow_es_magic_pc; // [Skotlex] + int skill_wall_check; // [Skotlex] + int cell_stack_limit; // [Skotlex] + int skill_caster_check; // [Skotlex] + int sc_castcancel; // [Skotlex] + int pc_sc_def_rate; // [Skotlex] + int mob_sc_def_rate; + int pc_luk_sc_def; + int mob_luk_sc_def; + int pc_max_sc_def; + int mob_max_sc_def; + + int sg_angel_skill_ratio; + int sg_miracle_skill_ratio; int sg_miracle_skill_duration; - unsigned short autospell_stacking; //Enables autospell cards to stack. [Skotlex] - unsigned short override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex] - unsigned short min_chat_delay; //Minimum time between client messages. [Skotlex] - unsigned short friend_auto_add; //When accepting friends, both get friended. [Skotlex] + int autospell_stacking; //Enables autospell cards to stack. [Skotlex] + int override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex] + int min_chat_delay; //Minimum time between client messages. [Skotlex] + int friend_auto_add; //When accepting friends, both get friended. [Skotlex] int hvan_explosion_intimate; // fix [albator] - unsigned short hom_rename; - unsigned short homunculus_show_growth ; //[orn] - unsigned short homunculus_friendly_rate; + int hom_rename; + int homunculus_show_growth ; //[orn] + int homunculus_friendly_rate; } battle_config; void do_init_battle(void); diff --git a/src/map/charcommand.c b/src/map/charcommand.c index cee5f995e..008c01a5d 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -1950,16 +1950,7 @@ int charcommand_speed(const int fd, struct map_session_data* sd, const char* com return -1; } - if (speed < MIN_WALK_SPEED) - { - speed = MIN_WALK_SPEED; - } - else if (speed > MAX_WALK_SPEED) - { - speed = MAX_WALK_SPEED; - } - - pl_sd->base_status.speed = speed; + pl_sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED); status_calc_bl(&pl_sd->bl, SCB_SPEED); clif_displaymessage(pl_sd->fd, msg_txt(8)); // Speed changed. if (pl_sd->fd != fd) diff --git a/src/map/chat.c b/src/map/chat.c index 4a7bdeedd..b5b16f28c 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -2,14 +2,15 @@ // For more information, see LICENCE in the main folder #include "../common/cbasetypes.h" -#include "../common/nullpo.h" #include "../common/malloc.h" -#include "battle.h" -#include "map.h" +#include "../common/nullpo.h" +#include "../common/strlib.h" +#include "atcommand.h" // msg_txt() +#include "battle.h" // struct battle_config #include "clif.h" +#include "map.h" +#include "npc.h" // npc_event_do() #include "pc.h" -#include "npc.h" -#include "atcommand.h" #include "chat.h" #include <stdio.h> @@ -20,7 +21,7 @@ int chat_triggerevent(struct chat_data *cd); /*========================================== * chatroom creation *------------------------------------------*/ -int chat_createchat(struct map_session_data* sd,int limit, int pub, char* pass, char* title, int titlelen) +int chat_createchat(struct map_session_data* sd, int limit, bool pub, char* pass, char* title, int titlelen) { struct chat_data *cd; @@ -40,9 +41,9 @@ int chat_createchat(struct map_session_data* sd,int limit, int pub, char* pass, cd->pub = pub; cd->users = 1; titlelen = cap_value(titlelen, 0, sizeof(cd->title)-1); // empty string achievable by using custom client - // the following two input strings aren't zero terminated, have to handle it manually - memcpy(cd->pass, pass, 8); cd->pass[8]= '\0'; - memcpy(cd->title, title, titlelen); cd->title[titlelen] = '\0'; + // the following two input strings aren't zero terminated and need to be handled carefully + safestrncpy(cd->title, title, min(titlelen+1,CHATROOM_TITLE_SIZE)); + safestrncpy(cd->pass, pass, CHATROOM_PASS_SIZE); cd->owner = (struct block_list **)(&cd->usersd[0]); cd->usersd[0] = sd; @@ -84,7 +85,7 @@ int chat_joinchat(struct map_session_data* sd, int chatid, char* pass) return 0; } //Allows Gm access to protected room with any password they want by valaris - if ((cd->pub == 0 && strncmp(pass, (char *)cd->pass, 8) && (pc_isGM(sd) < battle_config.gm_join_chat || !battle_config.gm_join_chat)) || + if ((!cd->pub && strncmp(pass, (char *)cd->pass, 8) && (pc_isGM(sd) < battle_config.gm_join_chat || !battle_config.gm_join_chat)) || chatid == (int)sd->chatID) //Double Chat fix by Alex14, thx CHaNGeTe { clif_joinchatfail(sd,1); @@ -172,7 +173,7 @@ int chat_leavechat(struct map_session_data* sd) /*========================================== * チャットルームの持ち主を譲る *------------------------------------------*/ -int chat_changechatowner(struct map_session_data *sd,char *nextownername) +int chat_changechatowner(struct map_session_data* sd, char* nextownername) { struct chat_data *cd; struct map_session_data *tmp_sd; @@ -217,7 +218,7 @@ int chat_changechatowner(struct map_session_data *sd,char *nextownername) /*========================================== * チャットの状態(タイトル等)を変更 *------------------------------------------*/ -int chat_changechatstatus(struct map_session_data *sd,int limit,int pub,char* pass,char* title,int titlelen) +int chat_changechatstatus(struct map_session_data* sd, char* title, char* pass, int limit, bool pub) { struct chat_data *cd; @@ -227,13 +228,10 @@ int chat_changechatstatus(struct map_session_data *sd,int limit,int pub,char* pa if(cd==NULL || (struct block_list *)sd != (*cd->owner)) return 1; + safestrncpy(cd->title, title, CHATROOM_TITLE_SIZE); + safestrncpy(cd->pass, pass, CHATROOM_PASS_SIZE); cd->limit = limit; cd->pub = pub; - memcpy(cd->pass,pass,8); - cd->pass[7]= '\0'; //Overflow check... [Skotlex] - if(titlelen>=sizeof(cd->title)-1) titlelen=sizeof(cd->title)-1; - memcpy(cd->title,title,titlelen); - cd->title[titlelen]=0; clif_changechatstatus(cd); clif_dispchat(cd,0); @@ -244,7 +242,7 @@ int chat_changechatstatus(struct map_session_data *sd,int limit,int pub,char* pa /*========================================== * チャットルームから蹴り出す *------------------------------------------*/ -int chat_kickchat(struct map_session_data *sd,char *kickusername) +int chat_kickchat(struct map_session_data* sd,char* kickusername) { struct chat_data *cd; int i; @@ -270,7 +268,7 @@ int chat_kickchat(struct map_session_data *sd,char *kickusername) } /// Creates a chat room for the npc. -int chat_createnpcchat(struct npc_data* nd,int limit,int pub,int trigger,const char* title,int titlelen,const char *ev) +int chat_createnpcchat(struct npc_data* nd, int limit, bool pub, int trigger, const char* title, const char* ev) { struct chat_data *cd; @@ -283,21 +281,16 @@ int chat_createnpcchat(struct npc_data* nd,int limit,int pub,int trigger,const c cd->trigger = trigger; cd->pub = pub; cd->users = 0; - cd->pass[0] = '\0'; - if( titlelen > sizeof(cd->title) - 1 ) - titlelen = sizeof(cd->title) - 1; - memcpy(cd->title, title, titlelen); - cd->title[titlelen] = '\0'; + safestrncpy(cd->title, title, CHATROOM_TITLE_SIZE); + memset(cd->pass, '\0', CHATROOM_PASS_SIZE); cd->bl.m = nd->bl.m; cd->bl.x = nd->bl.x; cd->bl.y = nd->bl.y; cd->bl.type = BL_CHAT; cd->bl.prev = cd->bl.next = NULL; - cd->owner_ = (struct block_list *)nd; - cd->owner = &cd->owner_; - strncpy(cd->npc_event, ev, ARRAYLENGTH(cd->npc_event)); - cd->npc_event[ARRAYLENGTH(cd->npc_event)-1] = '\0'; + cd->owner = &(struct block_list *)nd; + safestrncpy(cd->npc_event, ev, ARRAYLENGTH(cd->npc_event)); cd->bl.id = map_addobject(&cd->bl); if( cd->bl.id == 0) { diff --git a/src/map/chat.h b/src/map/chat.h index db7b21b15..e6a0c819e 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -4,19 +4,21 @@ #ifndef _CHAT_H_ #define _CHAT_H_ -#include "map.h" +//#include "map.h" +struct map_session_data; +struct chat_data; -int chat_createchat(struct map_session_data *,int,int,char*,char*,int); -int chat_joinchat(struct map_session_data *,int,char*); -int chat_leavechat(struct map_session_data* ); -int chat_changechatowner(struct map_session_data *,char *); -int chat_changechatstatus(struct map_session_data *,int,int,char*,char*,int); -int chat_kickchat(struct map_session_data *,char *); +int chat_createchat(struct map_session_data* sd, int limit, bool pub, char* pass, char* title, int titlelen); +int chat_joinchat(struct map_session_data* sd, int chatid, char* pass); +int chat_leavechat(struct map_session_data* sd); +int chat_changechatowner(struct map_session_data* sd, char* nextownername); +int chat_changechatstatus(struct map_session_data* sd, char* title, char* pass, int limit, bool pub); +int chat_kickchat(struct map_session_data* sd, char* kickusername); -int chat_createnpcchat(struct npc_data *nd,int limit,int pub,int trigger,const char* title,int titlelen,const char *ev); -int chat_deletenpcchat(struct npc_data *nd); -int chat_enableevent(struct chat_data *cd); -int chat_disableevent(struct chat_data *cd); -int chat_npckickall(struct chat_data *cd); +int chat_createnpcchat(struct npc_data* nd, int limit, bool pub, int trigger, const char* title, const char* ev); +int chat_deletenpcchat(struct npc_data* nd); +int chat_enableevent(struct chat_data* cd); +int chat_disableevent(struct chat_data* cd); +int chat_npckickall(struct chat_data* cd); #endif /* _CHAT_H_ */ diff --git a/src/map/clif.c b/src/map/clif.c index 2c54e0787..30646a5b3 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9236,11 +9236,22 @@ void clif_parse_ChatAddMember(int fd,struct map_session_data *sd) } /*========================================== - * + * S 00de <len>.w <limit>.w <pub>.B <passwd>.8B <title>.?B *------------------------------------------*/ -void clif_parse_ChatRoomStatusChange(int fd,struct map_session_data *sd) +void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data* sd) { - chat_changechatstatus(sd,RFIFOW(fd,4),RFIFOB(fd,6),(char*)RFIFOP(fd,7),(char*)RFIFOP(fd,15),RFIFOW(fd,2)-15); + int len = RFIFOW(fd,2)-15; + int limit = RFIFOW(fd,4); + bool public = (bool)RFIFOB(fd,6); + const char* password = (char*)RFIFOP(fd,7); //not zero-terminated + const char* title = (char*)RFIFOP(fd,15); // not zero-terminated + + char s_title[CHATROOM_TITLE_SIZE]; + char s_password[CHATROOM_PASS_SIZE]; + safestrncpy(s_title, title, min(len+1,CHATROOM_TITLE_SIZE)); + safestrncpy(s_password, password, CHATROOM_PASS_SIZE); + + chat_changechatstatus(sd, s_title, s_password, limit, public); } /*========================================== diff --git a/src/map/map.c b/src/map/map.c index ebc0f403a..82a557109 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2505,10 +2505,10 @@ int map_waterheight(char* mapname) char *rsw, *found; //Look up for the rsw - sprintf(fn,"data\\%s.rsw", mapname); + sprintf(fn, "data\\%s.rsw", mapname); found = grfio_find_file(fn); - if (found) strcpy(fn, found); + if (found) strcpy(fn, found); // replace with real name // read & convert fn rsw = (char *) grfio_read (fn); diff --git a/src/map/map.h b/src/map/map.h index f63e2b10c..7d5340373 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -35,7 +35,6 @@ #define MAX_NPC_PER_MAP 512 #define BLOCK_SIZE 8 #define AREA_SIZE battle_config.area_size -#define LIFETIME_FLOORITEM 60 #define DAMAGELOG_SIZE 30 #define LOOTITEM_SIZE 10 //Quick defines to know which are the min-max common ailments. [Skotlex] @@ -169,7 +168,10 @@ enum { //String length you can write in the 'talking box' #define CHATBOX_SIZE 70 //Talk max size: <name> : <message of 70> [Skotlex] -#define CHAT_SIZE (NAME_LENGTH + 3 + CHATBOX_SIZE) +#define CHAT_SIZE (NAME_LENGTH + 3 + CHATBOX_SIZE) +//Chatroom-related string sizes +#define CHATROOM_TITLE_SIZE (36 + 1) +#define CHATROOM_PASS_SIZE (8 + 1) #define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000 @@ -188,7 +190,7 @@ enum bl_type { BL_PC = 0x001, BL_MOB = 0x002, BL_PET = 0x004, - BL_HOM = 0x008, //[blackhole89] + BL_HOM = 0x008, BL_ITEM = 0x010, BL_SKILL = 0x020, BL_NPC = 0x040, @@ -1108,16 +1110,18 @@ struct map_data { struct spawn_data *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer] int mob_delete_timer; // [Skotlex] - int zone; // [Komurka] + int zone; // zone number (for item/skill restrictions) int jexp; // map experience multiplicator int bexp; // map experience multiplicator int nocommand; //Blocks @/# commands for non-gms. [Skotlex] }; +/// Stores information about a remote map (for multi-mapserver setups). +/// Beginning of data structure matches 'map_data', to allow typecasting. struct map_data_other_server { char name[MAP_NAME_LENGTH]; unsigned short index; //Index is the map index used by the mapindex* functions. - unsigned char *gat; // NULL固定にして判断 + unsigned char *gat; // If this is NULL the map is not on this map-server uint32 ip; uint16 port; }; @@ -1131,6 +1135,19 @@ struct flooritem_data { struct item item_data; }; +struct chat_data { + struct block_list bl; // data for this map object + char title[CHATROOM_TITLE_SIZE]; // room title + char pass[CHATROOM_PASS_SIZE]; // password + bool pub; // private/public flag + unsigned char users; // current users + unsigned char limit; // join limit + unsigned char trigger; // number of users needed to trigger event + struct map_session_data *usersd[20]; + struct block_list **owner; + char npc_event[50]; +}; + enum _sp { SP_SPEED,SP_BASEEXP,SP_JOBEXP,SP_KARMA,SP_MANNER,SP_HP,SP_MAXHP,SP_SP, // 0-7 SP_MAXSP,SP_STATUSPOINT,SP_0a,SP_BASELEVEL,SP_SKILLPOINT,SP_STR,SP_AGI,SP_VIT, // 8-15 @@ -1249,21 +1266,6 @@ enum { CELL_CLRICEWALL, }; -struct chat_data { - struct block_list bl; - - char pass[8+1]; /* password */ - char title[60+1]; /* room title */ - unsigned char limit; /* join limit */ - unsigned char trigger; - unsigned char users; /* current users */ - unsigned char pub; /* room attribute */ - struct map_session_data *usersd[20]; - struct block_list *owner_; - struct block_list **owner; - char npc_event[50]; -}; - extern struct map_data map[]; extern int map_num; extern int autosave_interval; diff --git a/src/map/mob.c b/src/map/mob.c index d15a50a27..89642430e 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1495,11 +1495,8 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str && check_distance_blxy(&dlist->first_sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE) #endif ) { //Autoloot. - if (party_share_loot( - dlist->first_sd->status.party_id? - party_search(dlist->first_sd->status.party_id): - NULL, - dlist->first_sd,&ditem->item_data,dlist->first_sd->bl.id) == 0 + if (party_share_loot(party_search(dlist->first_sd->status.party_id), + dlist->first_sd, &ditem->item_data, dlist->first_sd->bl.id) == 0 ) { ers_free(item_drop_ers, ditem); return; @@ -2344,7 +2341,7 @@ int mob_class_change (struct mob_data *md, int class_) clif_mob_class_change(md,class_); status_calc_mob(md, 3); - if (battle_config.monster_class_change_full_recover) { + if (battle_config.monster_class_change_recover) { memset(md->dmglog, 0, sizeof(md->dmglog)); md->tdmg = 0; } else { @@ -2465,7 +2462,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id) amount+=k; //Increase final value by same amount to preserve total number to summon. } - if (!battle_config.monster_class_change_full_recover && + if (!battle_config.monster_class_change_recover && (skill_id == NPC_TRANSFORMATION || skill_id == NPC_METAMORPHOSIS)) hp_rate = 100*md2->status.hp/md2->status.max_hp; diff --git a/src/map/npc.c b/src/map/npc.c index f8b095b4f..f991f14d1 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2227,6 +2227,19 @@ void npc_movenpc(struct npc_data* nd, int x, int y) map_foreachinrange(clif_insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl); npc_setcells(nd); } + +int npc_changename(const char* name, const char* newname, short look) +{ + struct npc_data* nd = (struct npc_data *) strdb_remove(npcname_db, name); + if (nd == NULL) + return 0; + npc_enable(name, 0); + strcpy(nd->name, newname); + nd->class_ = look; + npc_enable(newname, 1); + return 0; +} + /*========================================== * function行解析 *------------------------------------------*/ @@ -2472,16 +2485,15 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4) m = map_mapname2mapid(mapname); if (m < 0) return 1; - if (w4 && strcmpi(w4, "off") == 0) + if (w4 && !strcmpi(w4, "off")) state = 0; //Disable mapflag rather than enable it. [Skotlex] -//マップフラグ - if (strcmpi(w3, "nosave") == 0) { + if (!strcmpi(w3, "nosave")) { char savemap[MAP_NAME_LENGTH_EXT]; int savex, savey; if (state == 0) ; //Map flag disabled. - else if (strcmp(w4, "SavePoint") == 0) { + else if (!strcmpi(w4, "SavePoint")) { map[m].save.map = 0; map[m].save.x = -1; map[m].save.y = -1; @@ -2497,32 +2509,25 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4) } map[m].flag.nosave = state; } - else if (strcmpi(w3,"nomemo")==0) { + else if (!strcmpi(w3,"nomemo")) map[m].flag.nomemo=state; - } - else if (strcmpi(w3,"noteleport")==0) { + else if (!strcmpi(w3,"noteleport")) map[m].flag.noteleport=state; - } - else if (strcmpi(w3,"nowarp")==0) { + else if (!strcmpi(w3,"nowarp")) map[m].flag.nowarp=state; - } - else if (strcmpi(w3,"nowarpto")==0) { + else if (!strcmpi(w3,"nowarpto")) map[m].flag.nowarpto=state; - } - else if (strcmpi(w3,"noreturn")==0) { + else if (!strcmpi(w3,"noreturn")) map[m].flag.noreturn=state; - } - else if (strcmpi(w3,"monster_noteleport")==0) { + else if (!strcmpi(w3,"monster_noteleport")) map[m].flag.monster_noteleport=state; - } - else if (strcmpi(w3,"nobranch")==0) { + else if (!strcmpi(w3,"nobranch")) map[m].flag.nobranch=state; - } - else if (strcmpi(w3,"nopenalty")==0) { + else if (!strcmpi(w3,"nopenalty")) { map[m].flag.noexppenalty=state; map[m].flag.nozenypenalty=state; } - else if (strcmpi(w3,"pvp")==0) { + else if (!strcmpi(w3,"pvp")) { map[m].flag.pvp=state; if (state) { if (map[m].flag.gvg || map[m].flag.gvg_dungeon || map[m].flag.gvg_castle) @@ -2532,26 +2537,24 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4) map[m].flag.gvg_castle=0; } } - else if (strcmpi(w3,"pvp_noparty")==0) { + else if (!strcmpi(w3,"pvp_noparty")) map[m].flag.pvp_noparty=state; - } - else if (strcmpi(w3,"pvp_noguild")==0) { + else if (!strcmpi(w3,"pvp_noguild")) map[m].flag.pvp_noguild=state; - } - else if (strcmpi(w3, "pvp_nightmaredrop") == 0) { + else if (!strcmpi(w3, "pvp_nightmaredrop")) { char drop_arg1[16], drop_arg2[16]; int drop_id = 0, drop_type = 0, drop_per = 0; if (sscanf(w4, "%[^,],%[^,],%d", drop_arg1, drop_arg2, &drop_per) == 3) { int i; - if (strcmp(drop_arg1, "random") == 0) + if (!strcmpi(drop_arg1, "random")) drop_id = -1; else if (itemdb_exists((drop_id = atoi(drop_arg1))) == NULL) drop_id = 0; - if (strcmp(drop_arg2, "inventory") == 0) + if (!strcmpi(drop_arg2, "inventory")) drop_type = 1; - else if (strcmp(drop_arg2,"equip") == 0) + else if (!strcmpi(drop_arg2,"equip")) drop_type = 2; - else if (strcmp(drop_arg2,"all") == 0) + else if (!strcmpi(drop_arg2,"all")) drop_type = 3; if (drop_id != 0){ @@ -2568,10 +2571,9 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4) } else if (!state) //Disable map[m].flag.pvp_nightmaredrop = 0; } - else if (strcmpi(w3,"pvp_nocalcrank")==0) { + else if (!strcmpi(w3,"pvp_nocalcrank")) map[m].flag.pvp_nocalcrank=state; - } - else if (strcmpi(w3,"gvg")==0) { + else if (!strcmpi(w3,"gvg")) { map[m].flag.gvg=state; if (state && map[m].flag.pvp) { @@ -2579,92 +2581,69 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4) ShowWarning("You can't set PvP and GvG flags for the same map! Removing PvP flag from %s\n", map[m].name); } } - else if (strcmpi(w3,"gvg_noparty")==0) { + else if (!strcmpi(w3,"gvg_noparty")) map[m].flag.gvg_noparty=state; - } - else if (strcmpi(w3,"gvg_dungeon")==0) { + else if (!strcmpi(w3,"gvg_dungeon")) { map[m].flag.gvg_dungeon=state; if (state) map[m].flag.pvp=0; } - else if (strcmpi(w3,"gvg_castle")==0) { + else if (!strcmpi(w3,"gvg_castle")) { map[m].flag.gvg_castle=state; if (state) map[m].flag.pvp=0; } - else if (strcmpi(w3,"noexppenalty")==0) { + else if (!strcmpi(w3,"noexppenalty")) map[m].flag.noexppenalty=state; - } - else if (strcmpi(w3,"nozenypenalty")==0) { + else if (!strcmpi(w3,"nozenypenalty")) map[m].flag.nozenypenalty=state; - } - else if (strcmpi(w3,"notrade")==0) { + else if (!strcmpi(w3,"notrade")) map[m].flag.notrade=state; - } - else if (strcmpi(w3,"novending")==0) { + else if (!strcmpi(w3,"novending")) map[m].flag.novending=state; - } - else if (strcmpi(w3,"nodrop")==0) { + else if (!strcmpi(w3,"nodrop")) map[m].flag.nodrop=state; - } - else if (strcmpi(w3,"noskill")==0) { + else if (!strcmpi(w3,"noskill")) map[m].flag.noskill=state; - } - else if (strcmpi(w3,"noicewall")==0) { // noicewall [Valaris] + else if (!strcmpi(w3,"noicewall")) map[m].flag.noicewall=state; - } - else if (strcmpi(w3,"snow")==0) { // snow [Valaris] + else if (!strcmpi(w3,"snow")) map[m].flag.snow=state; - } - else if (strcmpi(w3,"clouds")==0) { + else if (!strcmpi(w3,"clouds")) map[m].flag.clouds=state; - } - else if (strcmpi(w3,"clouds2")==0) { // clouds2 [Valaris] + else if (!strcmpi(w3,"clouds2")) map[m].flag.clouds2=state; - } - else if (strcmpi(w3,"fog")==0) { // fog [Valaris] + else if (!strcmpi(w3,"fog")) map[m].flag.fog=state; - } - else if (strcmpi(w3,"fireworks")==0) { + else if (!strcmpi(w3,"fireworks")) map[m].flag.fireworks=state; - } - else if (strcmpi(w3,"sakura")==0) { // sakura [Valaris] + else if (!strcmpi(w3,"sakura")) map[m].flag.sakura=state; - } - else if (strcmpi(w3,"leaves")==0) { // leaves [Valaris] + else if (!strcmpi(w3,"leaves")) map[m].flag.leaves=state; - } - else if (strcmpi(w3,"rain")==0) { // rain [Valaris] + else if (!strcmpi(w3,"rain")) map[m].flag.rain=state; - } - else if (strcmpi(w3,"indoors")==0) { // celest + else if (!strcmpi(w3,"indoors")) map[m].flag.indoors=state; - } - else if (strcmpi(w3,"nightenabled")==0) { // Skotlex + else if (!strcmpi(w3,"nightenabled")) map[m].flag.nightenabled=state; - } - else if (strcmpi(w3,"nogo")==0) { // celest + else if (!strcmpi(w3,"nogo")) map[m].flag.nogo=state; - } - else if (strcmpi(w3,"noexp")==0) { // Lorky + else if (!strcmpi(w3,"noexp")) { map[m].flag.nobaseexp=state; map[m].flag.nojobexp=state; } - else if (strcmpi(w3,"nobaseexp")==0) { // Lorky + else if (!strcmpi(w3,"nobaseexp")) map[m].flag.nobaseexp=state; - } - else if (strcmpi(w3,"nojobexp")==0) { // Lorky + else if (!strcmpi(w3,"nojobexp")) map[m].flag.nojobexp=state; - } - else if (strcmpi(w3,"noloot")==0) { // Lorky + else if (!strcmpi(w3,"noloot")) { map[m].flag.nomobloot=state; map[m].flag.nomvploot=state; } - else if (strcmpi(w3,"nomobloot")==0) { // Lorky + else if (!strcmpi(w3,"nomobloot")) map[m].flag.nomobloot=state; - } - else if (strcmpi(w3,"nomvploot")==0) { // Lorky + else if (!strcmpi(w3,"nomvploot")) map[m].flag.nomvploot=state; - } - else if (strcmpi(w3,"nocommand")==0) { // Skotlex + else if (!strcmpi(w3,"nocommand")) { if (state) { if (sscanf(w4, "%d", &state) == 1) map[m].nocommand =state; @@ -2673,7 +2652,7 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4) } else map[m].nocommand=0; } - else if (strcmpi(w3,"restricted")==0) { // Komurka + else if (!strcmpi(w3,"restricted")) { if (state) { map[m].flag.restricted=1; sscanf(w4, "%d", &state); @@ -2683,28 +2662,24 @@ static int npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4) map[m].zone = 0; } } - else if (strcmpi(w3,"jexp")==0) { + else if (!strcmpi(w3,"jexp")) { map[m].jexp = (state) ? atoi(w4) : 100; if( map[m].jexp < 0 ) map[m].jexp = 100; map[m].flag.nojobexp = (map[m].jexp==0)?1:0; } - else if (strcmpi(w3,"bexp")==0) { + else if (!strcmpi(w3,"bexp")) { map[m].bexp = (state) ? atoi(w4) : 100; if( map[m].bexp < 0 ) map[m].bexp = 100; map[m].flag.nobaseexp = (map[m].bexp==0)?1:0; } - else if (strcmpi(w3,"loadevent")==0) { // Skotlex + else if (!strcmpi(w3,"loadevent")) map[m].flag.loadevent=state; - } - else if (strcmpi(w3,"nochat")==0) { // Skotlex + else if (!strcmpi(w3,"nochat")) map[m].flag.nochat=state; - } - else if (strcmpi(w3,"partylock")==0) { // Skotlex + else if (!strcmpi(w3,"partylock")) map[m].flag.partylock=state; - } - else if (strcmpi(w3,"guildlock")==0) { // Skotlex + else if (!strcmpi(w3,"guildlock")) map[m].flag.guildlock=state; - } return 0; } @@ -3167,15 +3142,3 @@ int do_init_npc(void) return 0; } -// [Lance] -int npc_changename(const char* name, const char* newname, short look) -{ - struct npc_data* nd = (struct npc_data *) strdb_remove(npcname_db, name); - if (nd == NULL) - return 0; - npc_enable(name, 0); - strcpy(nd->name, newname); - nd->class_ = look; - npc_enable(newname, 1); - return 0; -} diff --git a/src/map/party.c b/src/map/party.c index 5117ce5ed..2427dab98 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -702,20 +702,20 @@ int party_send_xy_clear(struct party_data *p) } // exp share and added zeny share [Valaris] -int party_exp_share(struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny) +int party_exp_share(struct party_data* p, struct block_list* src, unsigned int base_exp, unsigned int job_exp, int zeny) { struct map_session_data* sd[MAX_PARTY]; - int i; - unsigned short c; + unsigned int i, c; nullpo_retr(0, p); - for (i = c = 0; i < MAX_PARTY; i++) - if ((sd[c] = p->data[i].sd)!=NULL && sd[c]->bl.m == src->m && !pc_isdead(sd[c])) { - if (battle_config.idle_no_share && (sd[c]->chatID || sd[c]->vender_id || (sd[c]->idletime < (last_tick - battle_config.idle_no_share)))) - continue; - c++; - } + // count the number of players eligible for exp sharing + for (i = c = 0; i < MAX_PARTY; i++) { + if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || + battle_config.idle_no_share && (sd[c]->chatID || sd[c]->vender_id || sd[c]->idletime < last_tick - battle_config.idle_no_share) ) + continue; + c++; + } if (c < 1) return 0; @@ -723,32 +723,15 @@ int party_exp_share(struct party_data *p,struct block_list *src,unsigned int bas job_exp/=c; zeny/=c; - if (battle_config.party_even_share_bonus && c > 1) { - unsigned short bonus =100 + battle_config.party_even_share_bonus*(c-1); - if (base_exp) { - if (base_exp/100 > UINT_MAX/bonus) - base_exp= UINT_MAX; //Exp overflow - else if (base_exp > 10000) - base_exp = (base_exp/100)*bonus; //Calculation overflow protection - else - base_exp = base_exp*bonus/100; - } - if (job_exp) { - if (job_exp/100 > UINT_MAX/bonus) - job_exp = UINT_MAX; - else if (job_exp > 10000) - job_exp = (job_exp/100)*bonus; - else - job_exp = job_exp*bonus/100; - } - if (zeny) { - if (zeny/100 > INT_MAX/bonus) - zeny = INT_MAX; - else if (zeny > 10000) - zeny = (zeny/100)*bonus; - else - zeny = zeny*bonus/100; - } + if (battle_config.party_even_share_bonus && c > 1) + { + double bonus = 100 + battle_config.party_even_share_bonus*(c-1); + if (base_exp) + base_exp = (unsigned int) cap_value(base_exp * bonus/100, 0, UINT_MAX); + if (job_exp) + job_exp = (unsigned int) cap_value(job_exp * bonus/100, 0, UINT_MAX); + if (zeny) + zeny = (unsigned int) cap_value(zeny * bonus/100, INT_MIN, INT_MAX); } for (i = 0; i < c; i++) diff --git a/src/map/party.h b/src/map/party.h index f8ceb67f8..ac08e8cf2 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -41,7 +41,7 @@ int party_check_conflict(struct map_session_data *sd); int party_skill_check(struct map_session_data *sd, int party_id, int skillid, int skilllv); int party_send_xy_clear(struct party_data *p); int party_exp_share(struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny); -int party_share_loot(struct party_data *p, TBL_PC *sd, struct item *item_data, int type); +int party_share_loot(struct party_data* p, TBL_PC* sd, struct item* item_data, int first); int party_send_dot_remove(struct map_session_data *sd); int party_sub_count(struct block_list *bl, va_list ap); int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_session_data *sd,int type,...); diff --git a/src/map/script.c b/src/map/script.c index 99a3434f5..d689463cf 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8965,7 +8965,7 @@ BUILDIN_FUNC(waitingroom) ev = script_getstr(st, 4); } if( (nd=(struct npc_data *)map_id2bl(st->oid)) != NULL ) - chat_createnpcchat(nd, limit, pub, trigger, title, (int)strlen(title), ev); + chat_createnpcchat(nd, limit, pub, trigger, title, ev); return 0; } diff --git a/src/map/skill.c b/src/map/skill.c index 3f58a891c..b18572d79 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -8680,7 +8680,7 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t } break; case ST_RECOV_WEIGHT_RATE: - if(battle_config.natural_heal_weight_rate <= 100 && sd->weight*100/sd->max_weight >= battle_config.natural_heal_weight_rate) { + if(battle_config.natural_heal_weight_rate <= 100 && sd->weight*100/sd->max_weight >= (unsigned int)battle_config.natural_heal_weight_rate) { clif_skill_fail(sd,skill,0,0); return 0; } diff --git a/src/map/status.c b/src/map/status.c index 37d37b3bf..717aaa993 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -5640,10 +5640,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val break; case SC_ADRENALINE2: case SC_ADRENALINE: - if (val2 || !battle_config.party_skill_penalty) - val3 = 300; - else - val3 = 200; + val3 = (val2) ? 300 : 200; // aspd increase case SC_WEAPONPERFECTION: case SC_OVERTHRUST: if(sd && pc_checkskill(sd,BS_HILTBINDING)>0) |