summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/map/battle/player.conf9
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/pc.c6
-rw-r--r--src/map/pc.h8
-rw-r--r--src/map/unit.c10
6 files changed, 34 insertions, 2 deletions
diff --git a/conf/map/battle/player.conf b/conf/map/battle/player.conf
index 39e1d9287..de8ef6f69 100644
--- a/conf/map/battle/player.conf
+++ b/conf/map/battle/player.conf
@@ -140,6 +140,15 @@ max_cart_weight: 8000
// Prevent logout of players after being hit for how long (in ms, 0 disables)?
prevent_logout: 10000
+// When should the server prevent a player from logging out? Have no effect if prevent_logout is disabled. (Note 3)
+// Official servers prevent players from logging out after attacking, casting skills, and taking damage.
+// 0 = Players can always logout
+// 1 = Prevent logout on login
+// 2 = Prevent logout after attacking
+// 4 = Prevent logout after casting skill
+// 8 = Prevent logout after being hit
+prevent_logout_trigger: 14
+
// Display the drained hp/sp values from normal attacks? (Ie: Hunter Fly card)
show_hp_sp_drain: false
diff --git a/src/map/battle.c b/src/map/battle.c
index 63252caf7..fdea849fb 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -7333,6 +7333,7 @@ static const struct battle_data {
{ "max_summoner_parameter", &battle_config.max_summoner_parameter, 120, 10, 10000, },
{ "mvp_exp_reward_message", &battle_config.mvp_exp_reward_message, 0, 0, 1, },
{ "monster_eye_range_bonus", &battle_config.mob_eye_range_bonus, 0, 0, 10, },
+ { "prevent_logout_trigger", &battle_config.prevent_logout_trigger, 0xE, 0, 0xF, }
};
#ifndef STATS_OPT_OUT
/**
diff --git a/src/map/battle.h b/src/map/battle.h
index 806b07a20..b5846e457 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -552,6 +552,8 @@ struct Battle_Config {
int mvp_exp_reward_message;
int mob_eye_range_bonus; //Vulture's Eye and Snake's Eye range bonus
+
+ int prevent_logout_trigger;
};
/* criteria for battle_config.idletime_critera */
diff --git a/src/map/pc.c b/src/map/pc.c
index b4985dd5f..2887942db 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -741,7 +741,8 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo
sd->client_tick = client_tick;
sd->state.active = 0; //to be set to 1 after player is fully authed and loaded.
sd->bl.type = BL_PC;
- sd->canlog_tick = timer->gettick();
+ if (battle_config.prevent_logout_trigger & PLT_LOGIN)
+ sd->canlog_tick = timer->gettick();
//Required to prevent homunculus copuing a base speed of 0.
sd->battle_status.speed = sd->base_status.speed = DEFAULT_WALK_SPEED;
sd->state.warp_clean = 1;
@@ -7695,7 +7696,8 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
if( sd->status.ele_id > 0 )
elemental->set_target(sd,src);
- sd->canlog_tick = timer->gettick();
+ if (battle_config.prevent_logout_trigger & PLT_DAMAGE)
+ sd->canlog_tick = timer->gettick();
}
/*==========================================
diff --git a/src/map/pc.h b/src/map/pc.h
index 0e4f1affd..482e30c41 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -73,6 +73,14 @@ enum equip_index {
EQI_MAX
};
+enum prevent_logout_trigger {
+ PLT_NONE = 0x0,
+ PLT_LOGIN = 0x1,
+ PLT_ATTACK = 0x2,
+ PLT_SKILL = 0x4,
+ PLT_DAMAGE = 0x8
+};
+
enum pc_unequipitem_flag {
PCUNEQUIPITEM_NONE = 0x0, ///< Just unequip
PCUNEQUIPITEM_RECALC = 0x1, ///< Recalculate status after unequipping
diff --git a/src/map/unit.c b/src/map/unit.c
index 7d68bef66..79abb8c6a 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1667,6 +1667,9 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
} else
skill->castend_id(ud->skilltimer,tick,src->id,0);
+ if (sd != NULL && battle_config.prevent_logout_trigger & PLT_SKILL)
+ sd->canlog_tick = timer->gettick();
+
return 1;
}
@@ -1813,6 +1816,10 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
ud->skilltimer = INVALID_TIMER;
skill->castend_pos(ud->skilltimer,tick,src->id,0);
}
+
+ if (sd != NULL && battle_config.prevent_logout_trigger & PLT_SKILL)
+ sd->canlog_tick = timer->gettick();
+
return 1;
}
@@ -2253,6 +2260,9 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick)
ud->attacktimer = timer->add(ud->attackabletime,unit->attack_timer,src->id,0);
}
+ if (sd != NULL && battle_config.prevent_logout_trigger & PLT_ATTACK)
+ sd->canlog_tick = timer->gettick();
+
return 1;
}