summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.cpp41
-rw-r--r--src/map/atcommand.hpp2
-rw-r--r--src/map/battle.cpp162
-rw-r--r--src/map/battle.hpp107
-rw-r--r--src/map/chrif.cpp79
-rw-r--r--src/map/chrif.hpp6
-rw-r--r--src/map/clif.cpp27
-rw-r--r--src/map/clif.hpp7
-rw-r--r--src/map/map.cpp50
-rw-r--r--src/map/map.hpp17
-rw-r--r--src/map/mob.cpp12
-rw-r--r--src/map/pc.cpp22
-rw-r--r--src/map/script.cpp8
-rw-r--r--src/map/skill.cpp2
14 files changed, 161 insertions, 381 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 4b52d93..4b41c7b 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -418,14 +418,14 @@ void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd)
cmd);
}
-FString gm_logfile_name;
+FString gm_log;
/*==========================================
* Log a timestamped line to GM log file
*------------------------------------------
*/
FILE *get_gm_log()
{
- if (!gm_logfile_name)
+ if (!gm_log)
return NULL;
struct tm ctime = TimeT::now();
@@ -441,7 +441,7 @@ FILE *get_gm_log()
last_logfile_nr = logfile_nr;
FString fullname = STRPRINTF("%s.%04d-%02d",
- gm_logfile_name, year, month);
+ gm_log, year, month);
if (gm_logfile)
fclose(gm_logfile);
@@ -451,7 +451,7 @@ FILE *get_gm_log()
if (!gm_logfile)
{
perror("GM log file");
- gm_logfile_name = FString();
+ gm_log = FString();
}
return gm_logfile;
}
@@ -511,7 +511,7 @@ AtCommandInfo *atcommand(const int level, ZString message)
{
ZString p = message;
- if (battle_config.atc_gmonly != 0 && !level) // level = pc_isGM(sd)
+ if (battle_config.atcommand_gm_only != 0 && !level) // level = pc_isGM(sd)
return nullptr;
if (!p)
{
@@ -1466,8 +1466,8 @@ int atcommand_alive(const int fd, dumb_ptr<map_session_data> sd,
sd->status.hp = sd->status.max_hp;
sd->status.sp = sd->status.max_sp;
pc_setstand(sd);
- if (static_cast<interval_t>(battle_config.pc_invincible_time) > interval_t::zero())
- pc_setinvincibletimer(sd, static_cast<interval_t>(battle_config.pc_invincible_time));
+ if (static_cast<interval_t>(battle_config.player_invincible_time) > interval_t::zero())
+ pc_setinvincibletimer(sd, static_cast<interval_t>(battle_config.player_invincible_time));
clif_updatestatus(sd, SP::HP);
clif_updatestatus(sd, SP::SP);
clif_resurrection(sd, 1);
@@ -2081,9 +2081,9 @@ int atcommand_spawn(const int fd, dumb_ptr<map_session_data> sd,
number = 1;
// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
- if (battle_config.atc_spawn_quantity_limit >= 1
- && number > battle_config.atc_spawn_quantity_limit)
- number = battle_config.atc_spawn_quantity_limit;
+ if (battle_config.atcommand_spawn_quantity_limit >= 1
+ && number > battle_config.atcommand_spawn_quantity_limit)
+ number = battle_config.atcommand_spawn_quantity_limit;
if (battle_config.etc_log)
PRINTF("@spawn monster='%s' id=%d count=%d (%d,%d)\n",
@@ -2546,8 +2546,8 @@ int atcommand_revive(const int fd, dumb_ptr<map_session_data> sd,
{
pl_sd->status.hp = pl_sd->status.max_hp;
pc_setstand(pl_sd);
- if (static_cast<interval_t>(battle_config.pc_invincible_time) > interval_t::zero())
- pc_setinvincibletimer(sd, static_cast<interval_t>(battle_config.pc_invincible_time));
+ if (static_cast<interval_t>(battle_config.player_invincible_time) > interval_t::zero())
+ pc_setinvincibletimer(sd, static_cast<interval_t>(battle_config.player_invincible_time));
clif_updatestatus(pl_sd, SP::HP);
clif_updatestatus(pl_sd, SP::SP);
clif_resurrection(pl_sd, 1);
@@ -5917,10 +5917,7 @@ int atcommand_skill_learn(const int fd, dumb_ptr<map_session_data>,
int atcommand_ipcheck(const int fd, dumb_ptr<map_session_data>,
ZString message)
{
- struct sockaddr_in sai;
CharName character;
- socklen_t sa_len = sizeof(struct sockaddr);
- unsigned long ip;
if (!asplit(message, &character))
{
@@ -5935,14 +5932,7 @@ int atcommand_ipcheck(const int fd, dumb_ptr<map_session_data>,
return -1;
}
- if (getpeername(pl_sd->fd, reinterpret_cast<struct sockaddr *>(&sai), &sa_len))
- {
- clif_displaymessage(fd,
- "Guru Meditation Error: getpeername() failed");
- return -1;
- }
-
- ip = sai.sin_addr.s_addr;
+ IP4Address ip = pl_sd->get_ip();
// We now have the IP address of a character.
// Loop over all logged in sessions looking for matches.
@@ -5954,11 +5944,8 @@ int atcommand_ipcheck(const int fd, dumb_ptr<map_session_data>,
pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(session[i]->session_data.get()));
if (pl_sd && pl_sd->state.auth)
{
- if (getpeername(pl_sd->fd, reinterpret_cast<struct sockaddr *>(&sai), &sa_len))
- continue;
-
// Is checking GM levels really needed here?
- if (ip == sai.sin_addr.s_addr)
+ if (ip == pl_sd->get_ip())
{
FString output = STRPRINTF(
"Name: %s | Location: %s %d %d",
diff --git a/src/map/atcommand.hpp b/src/map/atcommand.hpp
index e07a264..280372e 100644
--- a/src/map/atcommand.hpp
+++ b/src/map/atcommand.hpp
@@ -13,6 +13,6 @@ int atcommand_config_read(ZString cfgName);
void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd);
// only used by map.cpp
-extern FString gm_logfile_name;
+extern FString gm_log;
#endif // ATCOMMAND_HPP
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 4045348..02ea370 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -2302,18 +2302,12 @@ int battle_config_read(ZString cfgName)
battle_config.enemy_critical_rate = 100;
battle_config.enemy_str = 1;
battle_config.enemy_perfect_flee = 0;
- battle_config.cast_rate = 100;
+ battle_config.casting_rate = 100;
battle_config.delay_rate = 100;
battle_config.delay_dependon_dex = 0;
- battle_config.sdelay_attack_enable = 0;
- battle_config.left_cardfix_to_right = 0;
- battle_config.pc_skill_add_range = 0;
- battle_config.skill_out_range_consume = 1;
- battle_config.mob_skill_add_range = 0;
- battle_config.pc_damage_delay = 1;
- battle_config.defnotenemy = 1;
- battle_config.random_monster_checklv = 1;
- battle_config.attr_recover = 1;
+ battle_config.skill_delay_attack_enable = 0;
+ battle_config.monster_skill_add_range = 0;
+ battle_config.player_damage_delay = 1;
battle_config.flooritem_lifetime = std::chrono::duration_cast<std::chrono::milliseconds>(LIFETIME_FLOORITEM).count();
battle_config.item_auto_get = 0;
battle_config.drop_pickup_safety_zone = 20;
@@ -2323,43 +2317,26 @@ int battle_config_read(ZString cfgName)
battle_config.base_exp_rate = 100;
battle_config.job_exp_rate = 100;
- battle_config.gtb_pvp_only = 0;
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.monster_hp_rate = 100;
battle_config.monster_max_aspd = 199;
- battle_config.atc_gmonly = 0;
- battle_config.gm_allskill = 0;
- battle_config.gm_allequip = 0;
- battle_config.gm_skilluncond = 0;
- battle_config.skillfree = 0;
- battle_config.skillup_limit = 0;
- battle_config.wp_rate = 100;
- battle_config.pp_rate = 100;
+ battle_config.atcommand_gm_only = 0;
+ battle_config.gm_all_equipment = 0;
battle_config.monster_active_enable = 1;
battle_config.mob_skill_use = 1;
battle_config.mob_count_rate = 100;
- battle_config.quest_skill_learn = 0;
- battle_config.quest_skill_reset = 1;
battle_config.basic_skill_check = 1;
- battle_config.pc_invincible_time = 5000;
+ battle_config.player_invincible_time = 5000;
battle_config.skill_min_damage = 0;
- battle_config.finger_offensive_type = 0;
- battle_config.heal_exp = 0;
- battle_config.resurrection_exp = 0;
- battle_config.shop_exp = 0;
- battle_config.combo_delay_rate = 100;
- battle_config.wedding_modifydisplay = 0;
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.itemheal_regeneration_factor = 1;
- battle_config.item_name_override_grffile = 1;
battle_config.arrow_decrement = 1;
battle_config.max_aspd = 199;
battle_config.max_hp = 32500;
@@ -2367,16 +2344,13 @@ int battle_config_read(ZString cfgName)
battle_config.max_lv = 99; // [MouseJstr]
battle_config.max_parameter = 99;
battle_config.max_cart_weight = 8000;
- battle_config.pc_skill_log = 0;
- battle_config.mob_skill_log = 0;
+ battle_config.monster_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.pc_auto_counter_type = 1;
- battle_config.monster_auto_counter_type = 1;
battle_config.agi_penaly_type = 0;
battle_config.agi_penaly_count = 3;
battle_config.agi_penaly_num = 0;
@@ -2385,53 +2359,22 @@ int battle_config_read(ZString cfgName)
battle_config.vit_penaly_count = 3;
battle_config.vit_penaly_num = 0;
battle_config.vit_penaly_count_lv = static_cast<int>(ATK::DEF); // FIXME
- battle_config.pc_skill_reiteration = 0;
- battle_config.monster_skill_reiteration = 0;
- battle_config.pc_skill_nofootset = 0;
- battle_config.monster_skill_nofootset = 0;
- battle_config.pc_cloak_check_type = 0;
- battle_config.monster_cloak_check_type = 0;
battle_config.mob_changetarget_byskill = 0;
- battle_config.pc_attack_direction_change = 1;
+ battle_config.player_attack_direction_change = 1;
battle_config.monster_attack_direction_change = 1;
- battle_config.pc_undead_nofreeze = 0;
- battle_config.pc_land_skill_limit = 1;
- battle_config.monster_land_skill_limit = 1;
- battle_config.party_skill_penaly = 1;
- battle_config.monster_class_change_full_recover = 0;
- battle_config.produce_item_name_input = 1;
- battle_config.produce_potion_name_input = 1;
- battle_config.making_arrow_name_input = 1;
- battle_config.holywater_name_input = 1;
battle_config.display_delay_skill_fail = 1;
- battle_config.chat_warpportal = 0;
- battle_config.mob_warpportal = 0;
battle_config.dead_branch_active = 0;
battle_config.show_steal_in_same_party = 0;
- battle_config.enable_upper_class = 0;
- battle_config.pc_attack_attr_none = 0;
- battle_config.mob_attack_attr_none = 1;
- battle_config.mob_ghostring_fix = 0;
- battle_config.gx_allhit = 0;
- battle_config.gx_cardfix = 0;
- battle_config.gx_dupele = 1;
- battle_config.gx_disptype = 1;
- battle_config.player_skill_partner_check = 1;
battle_config.hide_GM_session = 0;
- battle_config.unit_movement_type = 0;
battle_config.invite_request_check = 1;
- battle_config.skill_removetrap_type = 0;
battle_config.disp_experience = 0;
battle_config.prevent_logout = 1; // Added by RoVeRT
battle_config.maximum_level = 255; // Added by Valaris
battle_config.drops_by_luk = 0; // [Valaris]
battle_config.pk_mode = 0; // [Valaris]
battle_config.multi_level_up = 0; // [Valaris]
- battle_config.backstab_bow_penalty = 0; // Akaru
- battle_config.show_mob_hp = 0; // [Valaris]
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 = 63; // added by [Yor]
battle_config.min_hair_style = 0;
battle_config.max_hair_style = 20;
battle_config.min_hair_color = 0;
@@ -2469,9 +2412,7 @@ int battle_config_read(ZString cfgName)
FString line;
while (io::getline(in, line))
{
-#define BATTLE_CONFIG_VAR2(name, varname) {{name}, &battle_config.varname}
-#define BATTLE_CONFIG_VAR(name) BATTLE_CONFIG_VAR2(#name, name)
- // s/{"\([a-zA-Z_0-9]*\)", &battle_config.\1}/BATTLE_CONFIG_VAR(\1)/
+#define BATTLE_CONFIG_VAR(name) {{#name}, &battle_config.name}
const struct
{
ZString str;
@@ -2483,18 +2424,12 @@ int battle_config_read(ZString cfgName)
BATTLE_CONFIG_VAR(enemy_critical_rate),
BATTLE_CONFIG_VAR(enemy_str),
BATTLE_CONFIG_VAR(enemy_perfect_flee),
- BATTLE_CONFIG_VAR2("casting_rate", cast_rate),
+ BATTLE_CONFIG_VAR(casting_rate),
BATTLE_CONFIG_VAR(delay_rate),
BATTLE_CONFIG_VAR(delay_dependon_dex),
- BATTLE_CONFIG_VAR2("skill_delay_attack_enable", sdelay_attack_enable),
- BATTLE_CONFIG_VAR(left_cardfix_to_right),
- BATTLE_CONFIG_VAR2("player_skill_add_range", pc_skill_add_range),
- BATTLE_CONFIG_VAR(skill_out_range_consume),
- BATTLE_CONFIG_VAR2("monster_skill_add_range", mob_skill_add_range),
- BATTLE_CONFIG_VAR2("player_damage_delay", pc_damage_delay),
- BATTLE_CONFIG_VAR2("defunit_not_enemy", defnotenemy),
- BATTLE_CONFIG_VAR(random_monster_checklv),
- BATTLE_CONFIG_VAR2("attribute_recover", attr_recover),
+ BATTLE_CONFIG_VAR(skill_delay_attack_enable),
+ BATTLE_CONFIG_VAR(monster_skill_add_range),
+ BATTLE_CONFIG_VAR(player_damage_delay),
BATTLE_CONFIG_VAR(flooritem_lifetime),
BATTLE_CONFIG_VAR(item_auto_get),
BATTLE_CONFIG_VAR(drop_pickup_safety_zone),
@@ -2503,45 +2438,27 @@ int battle_config_read(ZString cfgName)
BATTLE_CONFIG_VAR(item_third_get_time),
BATTLE_CONFIG_VAR(base_exp_rate),
BATTLE_CONFIG_VAR(job_exp_rate),
- BATTLE_CONFIG_VAR(gtb_pvp_only),
BATTLE_CONFIG_VAR(death_penalty_type),
BATTLE_CONFIG_VAR(death_penalty_base),
BATTLE_CONFIG_VAR(death_penalty_job),
- BATTLE_CONFIG_VAR(zeny_penalty),
BATTLE_CONFIG_VAR(restart_hp_rate),
BATTLE_CONFIG_VAR(restart_sp_rate),
BATTLE_CONFIG_VAR(monster_hp_rate),
BATTLE_CONFIG_VAR(monster_max_aspd),
- BATTLE_CONFIG_VAR2("atcommand_gm_only", atc_gmonly),
- BATTLE_CONFIG_VAR2("atcommand_spawn_quantity_limit", atc_spawn_quantity_limit),
- BATTLE_CONFIG_VAR2("gm_all_skill", gm_allskill),
- BATTLE_CONFIG_VAR2("gm_all_skill_add_abra", gm_allskill_addabra),
- BATTLE_CONFIG_VAR2("gm_all_equipment", gm_allequip),
- BATTLE_CONFIG_VAR2("gm_skill_unconditional", gm_skilluncond),
- BATTLE_CONFIG_VAR2("player_skillfree", skillfree),
- BATTLE_CONFIG_VAR2("player_skillup_limit", skillup_limit),
- BATTLE_CONFIG_VAR2("weapon_produce_rate", wp_rate),
- BATTLE_CONFIG_VAR2("potion_produce_rate", pp_rate),
+ BATTLE_CONFIG_VAR(atcommand_gm_only),
+ BATTLE_CONFIG_VAR(atcommand_spawn_quantity_limit),
+ BATTLE_CONFIG_VAR(gm_all_equipment),
BATTLE_CONFIG_VAR(monster_active_enable),
BATTLE_CONFIG_VAR(mob_skill_use),
BATTLE_CONFIG_VAR(mob_count_rate),
- BATTLE_CONFIG_VAR(quest_skill_learn),
- BATTLE_CONFIG_VAR(quest_skill_reset),
BATTLE_CONFIG_VAR(basic_skill_check),
- BATTLE_CONFIG_VAR2("player_invincible_time", pc_invincible_time),
+ BATTLE_CONFIG_VAR(player_invincible_time),
BATTLE_CONFIG_VAR(skill_min_damage),
- BATTLE_CONFIG_VAR(finger_offensive_type),
- BATTLE_CONFIG_VAR(heal_exp),
- BATTLE_CONFIG_VAR(resurrection_exp),
- BATTLE_CONFIG_VAR(shop_exp),
- BATTLE_CONFIG_VAR(combo_delay_rate),
- BATTLE_CONFIG_VAR(wedding_modifydisplay),
BATTLE_CONFIG_VAR(natural_healhp_interval),
BATTLE_CONFIG_VAR(natural_healsp_interval),
BATTLE_CONFIG_VAR(natural_heal_skill_interval),
BATTLE_CONFIG_VAR(natural_heal_weight_rate),
BATTLE_CONFIG_VAR(itemheal_regeneration_factor),
- BATTLE_CONFIG_VAR(item_name_override_grffile),
BATTLE_CONFIG_VAR(arrow_decrement),
BATTLE_CONFIG_VAR(max_aspd),
BATTLE_CONFIG_VAR(max_hp),
@@ -2549,16 +2466,13 @@ int battle_config_read(ZString cfgName)
BATTLE_CONFIG_VAR(max_lv),
BATTLE_CONFIG_VAR(max_parameter),
BATTLE_CONFIG_VAR(max_cart_weight),
- BATTLE_CONFIG_VAR2("player_skill_log", pc_skill_log),
- BATTLE_CONFIG_VAR2("monster_skill_log", mob_skill_log),
+ BATTLE_CONFIG_VAR(monster_skill_log),
BATTLE_CONFIG_VAR(battle_log),
BATTLE_CONFIG_VAR(save_log),
BATTLE_CONFIG_VAR(error_log),
BATTLE_CONFIG_VAR(etc_log),
BATTLE_CONFIG_VAR(save_clothcolor),
BATTLE_CONFIG_VAR(undead_detect_type),
- BATTLE_CONFIG_VAR2("player_auto_counter_type", pc_auto_counter_type),
- BATTLE_CONFIG_VAR(monster_auto_counter_type),
BATTLE_CONFIG_VAR(agi_penaly_type),
BATTLE_CONFIG_VAR(agi_penaly_count),
BATTLE_CONFIG_VAR(agi_penaly_num),
@@ -2567,43 +2481,15 @@ int battle_config_read(ZString cfgName)
BATTLE_CONFIG_VAR(vit_penaly_count),
BATTLE_CONFIG_VAR(vit_penaly_num),
BATTLE_CONFIG_VAR(vit_penaly_count_lv),
- BATTLE_CONFIG_VAR2("player_skill_reiteration", pc_skill_reiteration),
- BATTLE_CONFIG_VAR(monster_skill_reiteration),
- BATTLE_CONFIG_VAR2("player_skill_nofootset", pc_skill_nofootset),
- BATTLE_CONFIG_VAR(monster_skill_nofootset),
- BATTLE_CONFIG_VAR2("player_cloak_check_type", pc_cloak_check_type),
- BATTLE_CONFIG_VAR(monster_cloak_check_type),
BATTLE_CONFIG_VAR(mob_changetarget_byskill),
- BATTLE_CONFIG_VAR2("player_attack_direction_change", pc_attack_direction_change),
+ BATTLE_CONFIG_VAR(player_attack_direction_change),
BATTLE_CONFIG_VAR(monster_attack_direction_change),
- BATTLE_CONFIG_VAR2("player_land_skill_limit", pc_land_skill_limit),
- BATTLE_CONFIG_VAR(monster_land_skill_limit),
- BATTLE_CONFIG_VAR(party_skill_penaly),
- BATTLE_CONFIG_VAR(monster_class_change_full_recover),
- BATTLE_CONFIG_VAR(produce_item_name_input),
- BATTLE_CONFIG_VAR(produce_potion_name_input),
- BATTLE_CONFIG_VAR(making_arrow_name_input),
- BATTLE_CONFIG_VAR(holywater_name_input),
BATTLE_CONFIG_VAR(display_delay_skill_fail),
- BATTLE_CONFIG_VAR(chat_warpportal),
- BATTLE_CONFIG_VAR(mob_warpportal),
BATTLE_CONFIG_VAR(dead_branch_active),
BATTLE_CONFIG_VAR(show_steal_in_same_party),
- BATTLE_CONFIG_VAR(enable_upper_class),
- BATTLE_CONFIG_VAR(mob_attack_attr_none),
- BATTLE_CONFIG_VAR(mob_ghostring_fix),
- BATTLE_CONFIG_VAR(pc_attack_attr_none),
- BATTLE_CONFIG_VAR(gx_allhit),
- BATTLE_CONFIG_VAR(gx_cardfix),
- BATTLE_CONFIG_VAR(gx_dupele),
- BATTLE_CONFIG_VAR(gx_disptype),
- BATTLE_CONFIG_VAR(player_skill_partner_check),
BATTLE_CONFIG_VAR(hide_GM_session),
- BATTLE_CONFIG_VAR(unit_movement_type),
BATTLE_CONFIG_VAR(invite_request_check),
- BATTLE_CONFIG_VAR(skill_removetrap_type),
BATTLE_CONFIG_VAR(disp_experience),
- BATTLE_CONFIG_VAR(riding_weight),
BATTLE_CONFIG_VAR(prevent_logout), // Added by RoVeRT
BATTLE_CONFIG_VAR(alchemist_summon_reward), // [Valaris]
BATTLE_CONFIG_VAR(maximum_level), // [Valaris]
@@ -2611,11 +2497,8 @@ int battle_config_read(ZString cfgName)
BATTLE_CONFIG_VAR(monsters_ignore_gm), // [Valaris]
BATTLE_CONFIG_VAR(pk_mode), // [Valaris]
BATTLE_CONFIG_VAR(multi_level_up), // [Valaris]
- BATTLE_CONFIG_VAR(backstab_bow_penalty),
- BATTLE_CONFIG_VAR(show_mob_hp), // [Valaris]
BATTLE_CONFIG_VAR(hack_info_GM_level), // added by [Yor]
BATTLE_CONFIG_VAR(any_warp_GM_min_level), // added by [Yor]
- BATTLE_CONFIG_VAR(packet_ver_flag), // added by [Yor]
BATTLE_CONFIG_VAR(min_hair_style), // added by [MouseJstr]
BATTLE_CONFIG_VAR(max_hair_style), // added by [MouseJstr]
BATTLE_CONFIG_VAR(min_hair_color), // added by [MouseJstr]
@@ -2771,11 +2654,6 @@ int battle_config_read(ZString cfgName)
battle_config.mask_ip_gms = 0;
else if (battle_config.mask_ip_gms > 1)
battle_config.mask_ip_gms = 1;
-
- // at least 1 client must be accepted
- if ((battle_config.packet_ver_flag & 63) == 0) // added by [Yor]
- battle_config.packet_ver_flag = 63; // accept all clients
-
}
return 0;
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index 6ed32fd..c933e28 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -96,16 +96,10 @@ extern struct Battle_Config
int enemy_critical_rate;
int enemy_str;
int enemy_perfect_flee;
- int cast_rate, delay_rate, delay_dependon_dex;
- int sdelay_attack_enable;
- int left_cardfix_to_right;
- int pc_skill_add_range;
- int skill_out_range_consume;
- int mob_skill_add_range;
- int pc_damage_delay;
- int defnotenemy;
- int random_monster_checklv;
- int attr_recover;
+ int casting_rate, delay_rate, delay_dependon_dex;
+ int skill_delay_attack_enable;
+ int monster_skill_add_range;
+ int player_damage_delay;
int flooritem_lifetime;
int item_auto_get;
int item_first_get_time;
@@ -114,41 +108,23 @@ extern struct Battle_Config
int base_exp_rate, job_exp_rate;
int death_penalty_type;
int death_penalty_base, death_penalty_job;
- int gtb_pvp_only; // [MouseJstr]
- int zeny_penalty;
int restart_hp_rate;
int restart_sp_rate;
int monster_hp_rate;
int monster_max_aspd;
- int atc_gmonly;
- int atc_spawn_quantity_limit;
- int gm_allskill;
- int gm_allskill_addabra;
- int gm_allequip;
- int gm_skilluncond;
- int skillfree;
- int skillup_limit;
- int wp_rate;
- int pp_rate;
+ int atcommand_gm_only;
+ int atcommand_spawn_quantity_limit;
+ int gm_all_equipment;
int monster_active_enable;
int mob_skill_use;
int mob_count_rate;
- int quest_skill_learn;
- int quest_skill_reset;
int basic_skill_check;
- int pc_invincible_time;
+ int player_invincible_time;
int skill_min_damage;
- int finger_offensive_type;
- int heal_exp;
- int resurrection_exp;
- int shop_exp;
- int combo_delay_rate;
- int wedding_modifydisplay;
int natural_healhp_interval;
int natural_healsp_interval;
int natural_heal_skill_interval;
int natural_heal_weight_rate;
- int item_name_override_grffile;
int arrow_decrement;
int max_aspd;
int max_hp;
@@ -156,89 +132,54 @@ extern struct Battle_Config
int max_lv;
int max_parameter;
int max_cart_weight;
- int pc_skill_log;
- int mob_skill_log;
+ int monster_skill_log;
int battle_log;
int save_log;
int error_log;
int etc_log;
int save_clothcolor;
int undead_detect_type;
- int pc_auto_counter_type;
- int monster_auto_counter_type;
int agi_penaly_type;
int agi_penaly_count;
int agi_penaly_num;
int vit_penaly_type;
int vit_penaly_count;
int vit_penaly_num;
- int pc_skill_reiteration;
- int monster_skill_reiteration;
- int pc_skill_nofootset;
- int monster_skill_nofootset;
- int pc_cloak_check_type;
- int monster_cloak_check_type;
int mob_changetarget_byskill;
- int pc_attack_direction_change;
+ int player_attack_direction_change;
int monster_attack_direction_change;
- int pc_undead_nofreeze;
- int pc_land_skill_limit;
- int monster_land_skill_limit;
- int party_skill_penaly;
- int monster_class_change_full_recover;
- int produce_item_name_input;
- int produce_potion_name_input;
- int making_arrow_name_input;
- int holywater_name_input;
int display_delay_skill_fail;
- int chat_warpportal;
- int mob_warpportal;
int dead_branch_active;
int show_steal_in_same_party;
- int enable_upper_class;
- int mob_attack_attr_none;
- int mob_ghostring_fix;
- int pc_attack_attr_none;
- int prevent_logout; // Added by RoVeRT
+ int prevent_logout;
- int alchemist_summon_reward; // [Valaris]
+ int alchemist_summon_reward;
int maximum_level;
int drops_by_luk;
int monsters_ignore_gm;
int multi_level_up;
int pk_mode;
- int show_mob_hp; // end additions [Valaris]
int agi_penaly_count_lv;
int vit_penaly_count_lv;
- int gx_allhit;
- int gx_cardfix;
- int gx_dupele;
- int gx_disptype;
- int player_skill_partner_check;
int hide_GM_session;
- int unit_movement_type;
int invite_request_check;
- int skill_removetrap_type;
int disp_experience;
- int riding_weight;
- int backstab_bow_penalty;
- int hack_info_GM_level; // added by [Yor]
- int any_warp_GM_min_level; // added by [Yor]
- int packet_ver_flag; // added by [Yor]
+ int hack_info_GM_level;
+ int any_warp_GM_min_level;
- 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 min_hair_style;
+ int max_hair_style;
+ int min_hair_color;
+ int max_hair_color;
+ int min_cloth_color;
+ int max_cloth_color;
- int castrate_dex_scale; // added by [MouseJstr]
- int area_size; // added by [MouseJstr]
+ int castrate_dex_scale;
+ int area_size;
int chat_lame_penalty;
int chat_spam_threshold;
@@ -253,8 +194,8 @@ extern struct Battle_Config
int mask_ip_gms;
- int drop_pickup_safety_zone; // [Fate] Max. distance to an object dropped by a kill by self in which dropsteal protection works
- int itemheal_regeneration_factor; // [Fate] itemheal speed factor
+ int drop_pickup_safety_zone;
+ int itemheal_regeneration_factor;
int mob_splash_radius;
} battle_config;
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 33a9879..c9020a3 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -32,9 +32,7 @@ const int packet_len_table[0x20] =
int char_fd;
static
-IP_String char_ip_str;
-static
-int char_ip;
+IP4Address char_ip;
static
int char_port = 6121;
static
@@ -72,10 +70,9 @@ AccountPass chrif_getpasswd(void)
*
*------------------------------------------
*/
-void chrif_setip(IP_String ip)
+void chrif_setip(IP4Address ip)
{
- char_ip_str = ip;
- char_ip = inet_addr(char_ip_str.c_str());
+ char_ip = ip;
}
/*==========================================
@@ -134,7 +131,7 @@ int chrif_connect(int fd)
WFIFO_STRING(fd, 2, userid, 24);
WFIFO_STRING(fd, 26, passwd, 24);
WFIFOL(fd, 50) = 0;
- WFIFOL(fd, 54) = clif_getip().s_addr;
+ WFIFOIP(fd, 54) = clif_getip();
WFIFOW(fd, 58) = clif_getport(); // [Valaris] thanks to fov
WFIFOSET(fd, 60);
@@ -172,21 +169,21 @@ int chrif_sendmap(int fd)
static
int chrif_recvmap(int fd)
{
- int i, j, port;
+ int i, j;
if (chrif_state < 2) // まだ準備中
return -1;
- struct in_addr ip;
- ip.s_addr = RFIFOL(fd, 4);
- port = RFIFOW(fd, 8);
+ IP4Address ip = RFIFOIP(fd, 4);
+ uint16_t port = RFIFOW(fd, 8);
for (i = 10, j = 0; i < RFIFOW(fd, 2); i += 16, j++)
{
MapName map = RFIFO_STRING<16>(fd, i);
map_setipport(map, ip, port);
}
if (battle_config.etc_log)
- PRINTF("recv map on %s:%d (%d maps)\n", ip2str(ip), port, j);
+ PRINTF("recv map on %s:%d (%d maps)\n",
+ ip, port, j);
return 0;
}
@@ -196,17 +193,16 @@ int chrif_recvmap(int fd)
*------------------------------------------
*/
int chrif_changemapserver(dumb_ptr<map_session_data> sd,
- MapName name, int x, int y, struct in_addr ip, short port)
+ MapName name, int x, int y, IP4Address ip, short port)
{
- int i, s_ip;
-
nullpo_retr(-1, sd);
- s_ip = 0;
- for (i = 0; i < fd_max; i++)
+ IP4Address s_ip;
+ for (int i = 0; i < fd_max; i++)
if (session[i] && dumb_ptr<map_session_data>(static_cast<map_session_data *>(session[i]->session_data.get())) == sd)
{
- s_ip = session[i]->client_addr.sin_addr.s_addr;
+ assert (i == sd->fd);
+ s_ip = session[i]->client_ip;
break;
}
@@ -218,10 +214,10 @@ int chrif_changemapserver(dumb_ptr<map_session_data> sd,
WFIFO_STRING(char_fd, 18, name, 16);
WFIFOW(char_fd, 34) = x;
WFIFOW(char_fd, 36) = y;
- WFIFOL(char_fd, 38) = ip.s_addr;
+ WFIFOIP(char_fd, 38) = ip;
WFIFOL(char_fd, 42) = port;
WFIFOB(char_fd, 44) = sd->status.sex;
- WFIFOL(char_fd, 45) = s_ip;
+ WFIFOIP(char_fd, 45) = s_ip;
WFIFOSET(char_fd, 49);
return 0;
@@ -249,7 +245,7 @@ int chrif_changemapserverack(int fd)
MapName mapname = RFIFO_STRING<16>(fd, 18);
uint16_t x = RFIFOW(fd, 34);
uint16_t y = RFIFOW(fd, 36);
- auto ip = in_addr{RFIFOL(fd, 38)};
+ IP4Address ip = RFIFOIP(fd, 38);
uint16_t port = RFIFOW(fd, 42);
clif_changemapserver(sd, mapname, x, y, ip, port);
@@ -311,22 +307,21 @@ int chrif_sendmapack(int fd)
*/
int chrif_authreq(dumb_ptr<map_session_data> sd)
{
- int i;
-
nullpo_retr(-1, sd);
if (!sd || !char_fd || !sd->bl_id || !sd->login_id1)
return -1;
- for (i = 0; i < fd_max; i++)
+ for (int i = 0; i < fd_max; i++)
if (session[i] && dumb_ptr<map_session_data>(static_cast<map_session_data *>(session[i]->session_data.get())) == sd)
{
+ assert (i == sd->fd);
WFIFOW(char_fd, 0) = 0x2afc;
WFIFOL(char_fd, 2) = sd->bl_id;
WFIFOL(char_fd, 6) = sd->char_id;
WFIFOL(char_fd, 10) = sd->login_id1;
WFIFOL(char_fd, 14) = sd->login_id2;
- WFIFOL(char_fd, 18) = session[i]->client_addr.sin_addr.s_addr;
+ WFIFOIP(char_fd, 18) = session[i]->client_ip;
WFIFOSET(char_fd, 22);
break;
}
@@ -340,18 +335,17 @@ int chrif_authreq(dumb_ptr<map_session_data> sd)
*/
int chrif_charselectreq(dumb_ptr<map_session_data> sd)
{
- int i, s_ip;
-
nullpo_retr(-1, sd);
if (!sd || !char_fd || !sd->bl_id || !sd->login_id1)
return -1;
- s_ip = 0;
- for (i = 0; i < fd_max; i++)
+ IP4Address s_ip;
+ for (int i = 0; i < fd_max; i++)
if (session[i] && dumb_ptr<map_session_data>(static_cast<map_session_data *>(session[i]->session_data.get())) == sd)
{
- s_ip = session[i]->client_addr.sin_addr.s_addr;
+ assert (i == sd->fd);
+ s_ip = session[i]->client_ip;
break;
}
@@ -359,29 +353,13 @@ int chrif_charselectreq(dumb_ptr<map_session_data> sd)
WFIFOL(char_fd, 2) = sd->bl_id;
WFIFOL(char_fd, 6) = sd->login_id1;
WFIFOL(char_fd, 10) = sd->login_id2;
- WFIFOL(char_fd, 14) = s_ip;
+ WFIFOIP(char_fd, 14) = s_ip;
WFIFOSET(char_fd, 18);
return 0;
}
/*==========================================
- * キャラ名問い合わせ
- *------------------------------------------
- */
-int chrif_searchcharid(int char_id)
-{
- if (!char_id)
- return -1;
-
- WFIFOW(char_fd, 0) = 0x2b08;
- WFIFOL(char_fd, 2) = char_id;
- WFIFOSET(char_fd, 6);
-
- return 0;
-}
-
-/*==========================================
* GMに変化要求
*------------------------------------------
*/
@@ -1108,13 +1086,6 @@ void chrif_parse(int fd)
case 0x2b06:
chrif_changemapserverack(fd);
break;
- case 0x2b09:
- {
- int charid = RFIFOL(fd, 2);
- CharName name = stringish<CharName>(RFIFO_STRING<24>(fd, 6));
- map_addchariddb(charid, name);
- }
- break;
case 0x2b0b:
chrif_changedgm(fd);
break;
diff --git a/src/map/chrif.hpp b/src/map/chrif.hpp
index 97760c3..dfcc12b 100644
--- a/src/map/chrif.hpp
+++ b/src/map/chrif.hpp
@@ -3,6 +3,7 @@
#include "../common/dumb_ptr.hpp"
#include "../common/human_time_diff.hpp"
+#include "../common/ip.hpp"
#include "map.hpp"
@@ -10,7 +11,7 @@ void chrif_setuserid(AccountName);
void chrif_setpasswd(AccountPass);
AccountPass chrif_getpasswd(void);
-void chrif_setip(IP_String);
+void chrif_setip(IP4Address);
void chrif_setport(int);
int chrif_isconnect(void);
@@ -21,9 +22,8 @@ int chrif_charselectreq(dumb_ptr<map_session_data>);
int chrif_changemapserver(dumb_ptr<map_session_data> sd,
MapName name, int x, int y,
- struct in_addr ip, short port);
+ IP4Address ip, short port);
-int chrif_searchcharid(int char_id);
void chrif_changegm(int id, ZString pass);
void chrif_changeemail(int id, AccountEmail actual_email, AccountEmail new_email);
void chrif_char_ask_name(int id, CharName character_name, short operation_type,
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index fa208be..e068249 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -107,9 +107,7 @@ void WFIFOPOS2(int fd, size_t pos, uint16_t x0, uint16_t y0, uint16_t x1, uint16
}
static
-IP_String map_ip_str;
-static
-struct in_addr map_ip;
+IP4Address map_ip;
static
int map_port = 5121;
@@ -121,10 +119,9 @@ int clif_changelook_towards(dumb_ptr<block_list> bl, LOOK type, int val,
* map鯖のip設定
*------------------------------------------
*/
-void clif_setip(IP_String ip)
+void clif_setip(IP4Address ip)
{
- map_ip_str = ip;
- map_ip.s_addr = inet_addr(map_ip_str.c_str());
+ map_ip = ip;
}
/*==========================================
@@ -140,7 +137,7 @@ void clif_setport(int port)
* map鯖のip読み出し
*------------------------------------------
*/
-struct in_addr clif_getip(void)
+IP4Address clif_getip(void)
{
return map_ip;
}
@@ -1114,7 +1111,7 @@ void clif_changemap(dumb_ptr<map_session_data> sd, MapName mapname, int x, int y
*------------------------------------------
*/
void clif_changemapserver(dumb_ptr<map_session_data> sd,
- MapName mapname, int x, int y, struct in_addr ip, int port)
+ MapName mapname, int x, int y, IP4Address ip, int port)
{
nullpo_retv(sd);
@@ -1123,7 +1120,7 @@ void clif_changemapserver(dumb_ptr<map_session_data> sd,
WFIFO_STRING(fd, 2, mapname, 16);
WFIFOW(fd, 18) = x;
WFIFOW(fd, 20) = y;
- WFIFOL(fd, 22) = ip.s_addr;
+ WFIFOIP(fd, 22) = ip;
WFIFOW(fd, 26) = port;
WFIFOSET(fd, clif_parse_func_table[0x92].len);
}
@@ -3526,9 +3523,9 @@ void clif_parse_LoadEndAck(int, dumb_ptr<map_session_data> sd)
// 119
// 78
- if (battle_config.pc_invincible_time > 0)
+ if (battle_config.player_invincible_time > 0)
{
- pc_setinvincibletimer(sd, static_cast<interval_t>(battle_config.pc_invincible_time));
+ pc_setinvincibletimer(sd, static_cast<interval_t>(battle_config.player_invincible_time));
}
map_addblock(sd); // ブロック登録
@@ -3735,15 +3732,15 @@ void clif_parse_GetCharNameRequest(int fd, dumb_ptr<map_session_data> sd)
if (pc_isGM(sd) >= battle_config.hack_info_GM_level)
{
- struct in_addr ip = ssd->ip;
+ IP4Address ip = ssd->get_ip();
WFIFOW(fd, 0) = 0x20C;
// Mask the IP using the char-server password
if (battle_config.mask_ip_gms)
- ip = MD5_ip(ssd->ip);
+ ip = MD5_ip(ip);
WFIFOL(fd, 2) = account_id;
- WFIFOL(fd, 6) = ip.s_addr;
+ WFIFOIP(fd, 6) = ip;
WFIFOSET(fd, clif_parse_func_table[0x20C].len);
}
@@ -3944,7 +3941,7 @@ void clif_parse_ActionRequest(int fd, dumb_ptr<map_session_data> sd)
case 0x07: // continuous attack
if (bool(sd->status.option & Option::HIDE))
return;
- if (!battle_config.sdelay_attack_enable)
+ if (!battle_config.skill_delay_attack_enable)
{
if (tick < sd->canact_tick)
{
diff --git a/src/map/clif.hpp b/src/map/clif.hpp
index 20f9912..fa68e23 100644
--- a/src/map/clif.hpp
+++ b/src/map/clif.hpp
@@ -6,6 +6,7 @@
#include <functional>
#include "../common/const_array.hpp"
+#include "../common/ip.hpp"
#include "../common/strings.hpp"
#include "../common/timer.t.hpp"
@@ -14,10 +15,10 @@
#include "pc.t.hpp"
#include "skill.t.hpp"
-void clif_setip(IP_String);
+void clif_setip(IP4Address);
void clif_setport(int);
-struct in_addr clif_getip(void);
+IP4Address clif_getip(void);
int clif_getport(void);
int clif_countusers(void);
void clif_setwaitclose(int);
@@ -39,7 +40,7 @@ int clif_walkok(dumb_ptr<map_session_data>); // self
int clif_movechar(dumb_ptr<map_session_data>); // area
int clif_movemob(dumb_ptr<mob_data>); //area
void clif_changemap(dumb_ptr<map_session_data>, MapName, int, int); //self
-void clif_changemapserver(dumb_ptr<map_session_data>, MapName, int, int, struct in_addr, int); //self
+void clif_changemapserver(dumb_ptr<map_session_data>, MapName, int, int, IP4Address, int); //self
void clif_fixpos(dumb_ptr<block_list>); // area
int clif_fixmobpos(dumb_ptr<mob_data> md);
int clif_fixpcpos(dumb_ptr<map_session_data> sd);
diff --git a/src/map/map.cpp b/src/map/map.cpp
index f2eefe5..25b70dc 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -64,7 +64,7 @@ dumb_ptr<block_list> object[MAX_FLOORITEM];
static
int first_free_object_id = 0, last_object_id = 0;
-interval_t autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
+interval_t autosave_time = DEFAULT_AUTOSAVE_INTERVAL;
int save_settings = 0xFFFF;
FString motd_txt = "conf/motd.txt";
@@ -1078,7 +1078,7 @@ map_local *map_mapname2mapid(MapName name)
* 他鯖map名からip,port変換
*------------------------------------------
*/
-int map_mapname2ipport(MapName name, struct in_addr *ip, int *port)
+int map_mapname2ipport(MapName name, IP4Address *ip, int *port)
{
map_abstract *md = maps_db.get(name);
if (md == NULL || md->gat)
@@ -1187,7 +1187,7 @@ void map_setcell(map_local *m, int x, int y, MapCell t)
* 他鯖管理のマップをdbに追加
*------------------------------------------
*/
-int map_setipport(MapName name, struct in_addr ip, int port)
+int map_setipport(MapName name, IP4Address ip, int port)
{
map_abstract *md = maps_db.get(name);
if (md == NULL)
@@ -1205,10 +1205,10 @@ int map_setipport(MapName name, struct in_addr ip, int port)
if (md->gat)
{
// local -> check data
- if (ip.s_addr != clif_getip().s_addr || port != clif_getport())
+ if (ip != clif_getip() || port != clif_getport())
{
- PRINTF("from char server : %s -> %s:%d\n", name, ip2str(ip),
- port);
+ PRINTF("from char server : %s -> %s:%d\n",
+ name, ip, port);
return 1;
}
}
@@ -1450,19 +1450,23 @@ int map_config_read(ZString cfgName)
else if (w1 == "char_ip")
{
h = gethostbyname(w2.c_str());
- IP_String w2ip;
+ IP4Address w2ip;
if (h != NULL)
{
- SNPRINTF(w2ip, 16, "%d.%d.%d.%d",
+ w2ip = IP4Address({
static_cast<uint8_t>(h->h_addr[0]),
static_cast<uint8_t>(h->h_addr[1]),
static_cast<uint8_t>(h->h_addr[2]),
- static_cast<uint8_t>(h->h_addr[3]));
+ static_cast<uint8_t>(h->h_addr[3]),
+ });
PRINTF("Character server IP address : %s -> %s\n",
w2, w2ip);
}
else
- w2ip = stringish<IP_String>(w2);
+ {
+ PRINTF("Bad IP value: %s\n", line);
+ abort();
+ }
chrif_setip(w2ip);
}
else if (w1 == "char_port")
@@ -1472,19 +1476,23 @@ int map_config_read(ZString cfgName)
else if (w1 == "map_ip")
{
h = gethostbyname(w2.c_str());
- IP_String w2ip;
+ IP4Address w2ip;
if (h != NULL)
{
- SNPRINTF(w2ip, 16, "%d.%d.%d.%d",
- static_cast<uint8_t>(h->h_addr[0]),
- static_cast<uint8_t>(h->h_addr[1]),
- static_cast<uint8_t>(h->h_addr[2]),
- static_cast<uint8_t>(h->h_addr[3]));
+ w2ip = IP4Address({
+ static_cast<uint8_t>(h->h_addr[0]),
+ static_cast<uint8_t>(h->h_addr[1]),
+ static_cast<uint8_t>(h->h_addr[2]),
+ static_cast<uint8_t>(h->h_addr[3]),
+ });
PRINTF("Map server IP address : %s -> %s\n",
w2, w2ip);
}
else
- w2ip = stringish<IP_String>(w2);
+ {
+ PRINTF("Bad IP value: %s\n", line);
+ abort();
+ }
clif_setip(w2ip);
}
else if (w1 == "map_port")
@@ -1511,9 +1519,9 @@ int map_config_read(ZString cfgName)
}
else if (w1 == "autosave_time")
{
- autosave_interval = std::chrono::seconds(atoi(w2.c_str()));
- if (autosave_interval <= interval_t::zero())
- autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
+ autosave_time = std::chrono::seconds(atoi(w2.c_str()));
+ if (autosave_time <= interval_t::zero())
+ autosave_time = DEFAULT_AUTOSAVE_INTERVAL;
}
else if (w1 == "motd_txt")
{
@@ -1529,7 +1537,7 @@ int map_config_read(ZString cfgName)
}
else if (w1 == "gm_log")
{
- gm_logfile_name = std::move(w2);
+ gm_log = std::move(w2);
}
else if (w1 == "log_file")
{
diff --git a/src/map/map.hpp b/src/map/map.hpp
index d98900d..4d5ac9d 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -165,7 +165,7 @@ struct map_session_data : block_list, SessionData
int weight, max_weight;
int cart_weight, cart_max_weight, cart_num, cart_max_num;
MapName mapname_;
- int fd, new_fd;
+ int fd; // use this, you idiots!
short to_x, to_y;
interval_t speed;
Opt1 opt1;
@@ -299,7 +299,10 @@ struct map_session_data : block_list, SessionData
TimeT packet_flood_reset_due;
int packet_flood_in;
- struct in_addr ip;
+ IP4Address get_ip()
+ {
+ return session[fd]->client_ip;
+ }
};
struct npc_timerevent_list
@@ -539,8 +542,8 @@ struct map_local : map_abstract
struct map_remote : map_abstract
{
- struct in_addr ip;
- unsigned int port;
+ IP4Address ip;
+ uint16_t port;
};
inline
@@ -558,7 +561,7 @@ struct flooritem_data : block_list
struct item item_data;
};
-extern interval_t autosave_interval;
+extern interval_t autosave_time;
extern int save_settings;
extern FString motd_txt;
@@ -708,8 +711,8 @@ dumb_ptr<invocation> map_id_is_spell(int id)
map_local *map_mapname2mapid(MapName);
-int map_mapname2ipport(MapName, struct in_addr *, int *);
-int map_setipport(MapName name, struct in_addr ip, int port);
+int map_mapname2ipport(MapName, IP4Address *, int *);
+int map_setipport(MapName name, IP4Address ip, int port);
void map_addiddb(dumb_ptr<block_list>);
void map_deliddb(dumb_ptr<block_list> bl);
void map_addnickdb(dumb_ptr<map_session_data>);
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index cd548a4..b8158af 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -3001,12 +3001,12 @@ void mobskill_castend_id(TimerData *, tick_t tick, int id)
range = skill_get_range(md->skillid, md->skilllv);
if (range < 0)
range = battle_get_range(md) - (range + 1);
- if (range + battle_config.mob_skill_add_range < distance(md->bl_x, md->bl_y, bl->bl_x, bl->bl_y))
+ if (range + battle_config.monster_skill_add_range < distance(md->bl_x, md->bl_y, bl->bl_x, bl->bl_y))
return;
md->skilldelayup[md->skillidx - &mob_db[md->mob_class].skills.front()] = tick;
- if (battle_config.mob_skill_log == 1)
+ if (battle_config.monster_skill_log == 1)
PRINTF("MOB skill castend skill=%d, mob_class = %d\n",
md->skillid, md->mob_class);
mob_stop_walking(md, 0);
@@ -3053,11 +3053,11 @@ void mobskill_castend_pos(TimerData *, tick_t tick, int id)
range = skill_get_range(md->skillid, md->skilllv);
if (range < 0)
range = battle_get_range(md) - (range + 1);
- if (range + battle_config.mob_skill_add_range < distance(md->bl_x, md->bl_y, md->skillx, md->skilly))
+ if (range + battle_config.monster_skill_add_range < distance(md->bl_x, md->bl_y, md->skillx, md->skilly))
return;
md->skilldelayup[md->skillidx - &mob_db[md->mob_class].skills.front()] = tick;
- if (battle_config.mob_skill_log == 1)
+ if (battle_config.monster_skill_log == 1)
PRINTF("MOB skill castend skill=%d, mob_class = %d\n",
md->skillid, md->mob_class);
mob_stop_walking(md, 0);
@@ -3107,7 +3107,7 @@ int mobskill_use_id(dumb_ptr<mob_data> md, dumb_ptr<block_list> target,
md->state.skillcastcancel = ms->cancel;
md->skilldelayup[ms - &mob_db[md->mob_class].skills.front()] = gettick();
- if (battle_config.mob_skill_log == 1)
+ if (battle_config.monster_skill_log == 1)
PRINTF("MOB skill use target_id=%d skill=%d lv=%d cast=%d, mob_class = %d\n",
target->bl_id, skill_id, skill_lv,
static_cast<uint32_t>(casttime.count()), md->mob_class);
@@ -3178,7 +3178,7 @@ int mobskill_use_pos(dumb_ptr<mob_data> md,
md->skilldelayup[ms - &mob_db[md->mob_class].skills.front()] = gettick();
md->state.skillcastcancel = ms->cancel;
- if (battle_config.mob_skill_log == 1)
+ if (battle_config.monster_skill_log == 1)
PRINTF("MOB skill use target_pos= (%d,%d) skill=%d lv=%d cast=%d, mob_class = %d\n",
skill_x, skill_y, skill_id, skill_lv,
static_cast<uint32_t>(casttime.count()), md->mob_class);
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 7b0af59..5fdb390 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -583,8 +583,8 @@ int pc_isequip(dumb_ptr<map_session_data> sd, int n)
item = sd->inventory_data[n];
sc_data = battle_get_sc_data(sd);
- if (battle_config.gm_allequip > 0
- && pc_isGM(sd) >= battle_config.gm_allequip)
+ if (battle_config.gm_all_equipment > 0
+ && pc_isGM(sd) >= battle_config.gm_all_equipment)
return 1;
if (item == NULL)
@@ -609,8 +609,6 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time,
struct party *p;
tick_t tick = gettick();
- struct sockaddr_in sai;
- socklen_t sa_len = sizeof(struct sockaddr);
sd = map_id2sd(id);
if (sd == NULL)
@@ -759,10 +757,6 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time,
sd->packet_flood_reset_due = TimeT();
sd->packet_flood_in = 0;
- // Obtain IP address (if they are still connected)
- if (!getpeername(sd->fd, reinterpret_cast<struct sockaddr *>(&sai), &sa_len))
- sd->ip = sai.sin_addr;
-
// message of the limited time of the account
if (connect_until_time)
{
@@ -2308,7 +2302,7 @@ int pc_setpos(dumb_ptr<map_session_data> sd,
{
if (sd->mapname_)
{
- struct in_addr ip;
+ IP4Address ip;
int port;
if (map_mapname2ipport(mapname_, &ip, &port) == 0)
{
@@ -2638,7 +2632,7 @@ int pc_stop_walking(dumb_ptr<map_session_data> sd, int type)
sd->to_y = sd->bl_y;
if (type & 0x01)
clif_fixpos(sd);
- if (type & 0x02 && battle_config.pc_damage_delay)
+ if (type & 0x02 && battle_config.player_damage_delay)
{
tick_t tick = gettick();
interval_t delay = battle_get_dmotion(sd);
@@ -2794,7 +2788,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id)
if (opt != NULL && bool(*opt & Option::REAL_ANY_HIDE))
return;
- if (!battle_config.sdelay_attack_enable)
+ if (!battle_config.skill_delay_attack_enable)
{
if (tick < sd->canact_tick)
{
@@ -2837,7 +2831,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id)
}
else
{
- if (battle_config.pc_attack_direction_change)
+ if (battle_config.player_attack_direction_change)
sd->dir = sd->head_dir = map_calc_dir(sd, bl->bl_x, bl->bl_y); // 向き設定
if (sd->walktimer)
@@ -5207,7 +5201,7 @@ void pc_autosave(TimerData *, tick_t)
if (save_flag == 0)
last_save_fd = 0;
- interval_t interval = autosave_interval / (clif_countusers() + 1);
+ interval_t interval = autosave_time / (clif_countusers() + 1);
if (interval <= interval_t::zero())
interval = std::chrono::milliseconds(1);
Timer(gettick() + interval,
@@ -5265,7 +5259,7 @@ int do_init_pc(void)
pc_natural_heal,
NATURAL_HEAL_INTERVAL
).detach();
- Timer(gettick() + autosave_interval,
+ Timer(gettick() + autosave_time,
pc_autosave
).detach();
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 5e96a9f..f7eecca 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -66,7 +66,7 @@ Map<ScriptLabel, int> scriptlabel_db;
UPMap<FString, const ScriptBuffer> userfunc_db;
static
-const char *pos[11] =
+const char *pos_str[11] =
{
"Head",
"Body",
@@ -2227,13 +2227,13 @@ void builtin_getequipname(ScriptState *st)
{
item = sd->inventory_data[i];
if (item)
- buf = STRPRINTF("%s-[%s]", pos[num - 1], item->jname);
+ buf = STRPRINTF("%s-[%s]", pos_str[num - 1], item->jname);
else
- buf = STRPRINTF("%s-[%s]", pos[num - 1], pos[10]);
+ buf = STRPRINTF("%s-[%s]", pos_str[num - 1], pos_str[10]);
}
else
{
- buf = STRPRINTF("%s-[%s]", pos[num - 1], pos[10]);
+ buf = STRPRINTF("%s-[%s]", pos_str[num - 1], pos_str[10]);
}
push_str(st->stack, ByteCode::STR, dumb_string::copys(buf));
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 7489731..f868b41 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -582,7 +582,7 @@ interval_t skill_castfix(dumb_ptr<block_list> bl, interval_t interval)
interval * castrate * (battle_config.castrate_dex_scale -
dex) / (battle_config.castrate_dex_scale *
100);
- interval = interval * battle_config.cast_rate / 100;
+ interval = interval * battle_config.casting_rate / 100;
}
return std::max(interval, interval_t::zero());