Skip to content

Commit

Permalink
Player: Implement CONFIG_BOOL_DISABLE_INSTANCE_RELOCATE
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Nov 21, 2023
1 parent dbe5c2e commit 40574b6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/game/Entities/Player.cpp
Expand Up @@ -16558,14 +16558,17 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
// since last logout (in seconds)
uint32 time_diff = uint32(now - logoutTime);

// if the player is in an instance and it has been reset in the meantime teleport him to the entrance
if (GetInstanceId() && (!state || time_diff > 15 * MINUTE))
if (!sWorld.getConfig(CONFIG_BOOL_DISABLE_INSTANCE_RELOCATE))
{
AreaTrigger const* at = sObjectMgr.GetMapEntranceTrigger(GetMapId());
if (at)
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
else
sLog.outError("Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), GetMapId());
// if the player is in an instance and it has been reset in the meantime teleport him to the entrance
if (GetInstanceId() && (!state || time_diff > 15 * MINUTE))
{
AreaTrigger const* at = sObjectMgr.GetMapEntranceTrigger(GetMapId());
if (at)
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
else
sLog.outError("Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), GetMapId());
}
}

SaveRecallPosition();
Expand Down
1 change: 1 addition & 0 deletions src/game/World/World.cpp
Expand Up @@ -587,6 +587,7 @@ void World::LoadConfigSettings(bool reload)

setConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR, "Instance.ResetTimeHour", 4);
setConfig(CONFIG_UINT32_INSTANCE_UNLOAD_DELAY, "Instance.UnloadDelay", 30 * MINUTE * IN_MILLISECONDS);
setConfig(CONFIG_BOOL_DISABLE_INSTANCE_RELOCATE, "Instance.DisableRelocate", false);

setConfigMinMax(CONFIG_UINT32_MAX_PRIMARY_TRADE_SKILL, "MaxPrimaryTradeSkill", 2, 0, 10);

Expand Down
1 change: 1 addition & 0 deletions src/game/World/World.h
Expand Up @@ -400,6 +400,7 @@ enum eConfigBoolValues
CONFIG_BOOL_PATH_FIND_OPTIMIZE,
CONFIG_BOOL_PATH_FIND_NORMALIZE_Z,
CONFIG_BOOL_ALWAYS_SHOW_QUEST_GREETING,
CONFIG_BOOL_DISABLE_INSTANCE_RELOCATE,
CONFIG_BOOL_VALUE_COUNT
};

Expand Down
6 changes: 6 additions & 0 deletions src/mangosd/mangosd.conf.dist.in
Expand Up @@ -689,6 +689,11 @@ LogColors = ""
# Default: 1800000 (miliseconds 30 minutes)
# 0 (instance maps are kept in memory until they are reset)
#
# Instance.DisableRelocate
# Disables relocation of player upon entering instance after 15 minutes or instance reset
# Default: 0 - false - relocates player after being logged out in instance for more than 15 minutes or instance reset
# 1 - true - location is kept
#
# Quests.LowLevelHideDiff
# Quest level difference to hide for player low level quests:
# if player_level > quest_level + LowLevelQuestsHideDiff then quest "!" mark not show for quest giver
Expand Down Expand Up @@ -904,6 +909,7 @@ Instance.IgnoreRaid = 0
Instance.StrictCombatLockdown = 1
Instance.ResetTimeHour = 4
Instance.UnloadDelay = 1800000
Instance.DisableRelocate = 0
Quests.LowLevelHideDiff = 5
Quests.HighLevelHideDiff = 7
Quests.Daily.ResetHour = 6
Expand Down

0 comments on commit 40574b6

Please sign in to comment.