aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp12
-rw-r--r--src/server/game/Entities/Creature/Creature.h2
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp25
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h2
-rw-r--r--src/server/game/Entities/Object/Object.h1
-rw-r--r--src/server/game/Grids/ObjectGridLoader.cpp3
-rw-r--r--src/server/game/Maps/Map.cpp10
-rw-r--r--src/server/game/Pools/PoolMgr.cpp4
-rw-r--r--src/server/game/World/World.cpp7
-rw-r--r--src/server/game/World/World.h1
-rw-r--r--src/server/worldserver/worldserver.conf.dist8
11 files changed, 16 insertions, 59 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 1661789062a..98e68cc0e65 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -414,7 +414,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool destroyForNearbyPlayers)
uint32 respawnDelay = m_respawnDelay;
m_respawnTime = std::max<time_t>(GameTime::GetGameTime() + respawnDelay, m_respawnTime);
- SaveRespawnTime(0, false);
+ SaveRespawnTime();
}
if (TempSummon* summon = ToTempSummon())
@@ -1940,11 +1940,7 @@ void Creature::setDeathState(DeathState s)
m_respawnTime = GameTime::GetGameTime() + respawnDelay;
}
- // always save boss respawn time at death to prevent crash cheating
- if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss())
- SaveRespawnTime();
- else if (!m_respawnCompatibilityMode)
- SaveRespawnTime(0, false);
+ SaveRespawnTime();
ReleaseFocus(nullptr, false); // remove spellcast focus
DoNotReacquireTarget(); // cancel delayed re-target
@@ -2395,7 +2391,7 @@ bool Creature::_IsTargetAcceptable(Unit const* target) const
return false;
}
-void Creature::SaveRespawnTime(uint32 forceDelay, bool savetodb)
+void Creature::SaveRespawnTime(uint32 forceDelay)
{
if (IsSummon() || !m_spawnId || (m_creatureData && !m_creatureData->dbData))
return;
@@ -2407,7 +2403,7 @@ void Creature::SaveRespawnTime(uint32 forceDelay, bool savetodb)
}
time_t thisRespawnTime = forceDelay ? GameTime::GetGameTime() + forceDelay : m_respawnTime;
- GetMap()->SaveRespawnTime(SPAWN_TYPE_CREATURE, m_spawnId, GetEntry(), thisRespawnTime, GetMap()->GetZoneId(GetHomePosition()), Trinity::ComputeGridCoord(GetHomePosition().GetPositionX(), GetHomePosition().GetPositionY()).GetId(), savetodb && m_creatureData && m_creatureData->dbData);
+ GetMap()->SaveRespawnTime(SPAWN_TYPE_CREATURE, m_spawnId, GetEntry(), thisRespawnTime, GetMap()->GetZoneId(GetHomePosition()), Trinity::ComputeGridCoord(GetHomePosition().GetPositionX(), GetHomePosition().GetPositionY()).GetId());
}
// this should not be called by petAI or
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 92285145126..55386730641 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -252,7 +252,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
time_t GetRespawnTimeEx() const;
void SetRespawnTime(uint32 respawn);
void Respawn(bool force = false);
- void SaveRespawnTime(uint32 forceDelay = 0, bool savetodb = true) override;
+ void SaveRespawnTime(uint32 forceDelay = 0);
uint32 GetRespawnDelay() const { return m_respawnDelay; }
void SetRespawnDelay(uint32 delay) { m_respawnDelay = delay; }
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 40a56400e19..4c1feb8be5b 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -546,7 +546,7 @@ void GameObject::Update(uint32 diff)
SetRespawnTime(WEEK);
else
m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
- SaveRespawnTime(); // also save to DB immediately
+ SaveRespawnTime();
return;
}
@@ -608,7 +608,7 @@ void GameObject::Update(uint32 diff)
// Set respawn timer
if (!m_respawnCompatibilityMode && m_respawnTime > 0)
- SaveRespawnTime(0, false);
+ SaveRespawnTime();
if (isSpawned())
{
@@ -842,22 +842,13 @@ void GameObject::Update(uint32 diff)
// if option not set then object will be saved at grid unload
// Otherwise just save respawn time to map object memory
- if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
- SaveRespawnTime();
-
- if (!m_respawnCompatibilityMode)
- {
- // Respawn time was just saved if set to save to DB
- // If not, we save only to map memory
- if (!sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
- SaveRespawnTime(0, false);
+ SaveRespawnTime();
- // Then despawn
+ if (m_respawnCompatibilityMode)
+ DestroyForNearbyPlayers();
+ else
AddObjectToRemoveList();
- return;
- }
- DestroyForNearbyPlayers(); // old UpdateObjectVisibility()
break;
}
}
@@ -1235,7 +1226,7 @@ bool GameObject::IsDestructibleBuilding() const
return gInfo->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING;
}
-void GameObject::SaveRespawnTime(uint32 forceDelay, bool savetodb)
+void GameObject::SaveRespawnTime(uint32 forceDelay)
{
if (m_goData && (forceDelay || m_respawnTime > GameTime::GetGameTime()) && m_spawnedByDefault)
{
@@ -1246,7 +1237,7 @@ void GameObject::SaveRespawnTime(uint32 forceDelay, bool savetodb)
}
uint32 thisRespawnTime = forceDelay ? GameTime::GetGameTime() + forceDelay : m_respawnTime;
- GetMap()->SaveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData->dbData ? savetodb : false);
+ GetMap()->SaveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()).GetId());
}
}
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 7abf6223cf5..8ce3d8ee2fc 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -204,7 +204,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
uint32 GetUseCount() const { return m_usetimes; }
uint32 GetUniqueUseCount() const { return m_unique_users.size(); }
- void SaveRespawnTime(uint32 forceDelay = 0, bool savetodb = true) override;
+ void SaveRespawnTime(uint32 forceDelay = 0);
Loot loot;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 74aedaee912..20b5a3a806e 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -370,7 +370,6 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
void SendObjectDeSpawnAnim(ObjectGuid guid);
- virtual void SaveRespawnTime(uint32 /*forceDelay*/ = 0, bool /*saveToDB*/ = true) { }
void AddObjectToRemoveList();
float GetGridActivationRange() const;
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index 2c17aaa4b1a..ea973df374c 100644
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -233,9 +233,6 @@ void ObjectGridUnloader::Visit(GridRefManager<T> &m)
while (!m.isEmpty())
{
T *obj = m.getFirst()->GetSource();
- // if option set then object already saved at this moment
- if (!sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
- obj->SaveRespawnTime();
//Some creatures may summon other temp summons in CleanupsBeforeDelete()
//So we need this even after cleaner (maybe we can remove cleaner)
//Example: Flame Leviathan Turret 33139 is summoned when a creature is deleted
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 0fc84d4b446..b55ce4dd3e5 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -1009,12 +1009,7 @@ void Map::RemoveFromMap(T *obj, bool remove)
obj->ResetMap();
if (remove)
- {
- // if option set then object already saved at this moment
- if (!sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
- obj->SaveRespawnTime();
DeleteFromWorld(obj);
- }
}
template<>
@@ -1049,12 +1044,7 @@ void Map::RemoveFromMap(Transport* obj, bool remove)
obj->ResetMap();
if (remove)
- {
- // if option set then object already saved at this moment
- if (!sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
- obj->SaveRespawnTime();
DeleteFromWorld(obj);
- }
}
void Map::PlayerRelocation(Player* player, float x, float y, float z, float orientation)
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 4d4a30b391b..9ed22889d2e 100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -204,7 +204,7 @@ void PoolGroup<Creature>::Despawn1Object(ObjectGuid::LowType guid)
++itr;
// For dynamic spawns, save respawn time here
if (!creature->GetRespawnCompatibilityMode())
- creature->SaveRespawnTime(0, false);
+ creature->SaveRespawnTime();
creature->AddObjectToRemoveList();
}
}
@@ -230,7 +230,7 @@ void PoolGroup<GameObject>::Despawn1Object(ObjectGuid::LowType guid)
// For dynamic spawns, save respawn time here
if (!go->GetRespawnCompatibilityMode())
- go->SaveRespawnTime(0, false);
+ go->SaveRespawnTime();
go->AddObjectToRemoveList();
}
}
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 6c08313665f..0b3aecbad5a 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1050,13 +1050,6 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2;
}
- m_bool_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY] = sConfigMgr->GetBoolDefault("SaveRespawnTimeImmediately", true);
- if (!m_bool_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY])
- {
- TC_LOG_WARN("server.loading", "SaveRespawnTimeImmediately triggers assertions when disabled, overridden to Enabled");
- m_bool_configs[CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY] = true;
- }
-
m_bool_configs[CONFIG_WEATHER] = sConfigMgr->GetBoolDefault("ActivateWeather", true);
m_int_configs[CONFIG_DISABLE_BREATHING] = sConfigMgr->GetIntDefault("DisableWaterBreath", SEC_CONSOLE);
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 440bfe299de..cef6fd39d77 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -108,7 +108,6 @@ enum WorldBoolConfigs
CONFIG_GM_LOWER_SECURITY,
CONFIG_SKILL_PROSPECTING,
CONFIG_SKILL_MILLING,
- CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY,
CONFIG_WEATHER,
CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL,
CONFIG_QUEST_IGNORE_RAID,
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 1a5af28ab1a..d7c8efe1c4d 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -262,14 +262,6 @@ Compression = 1
PlayerLimit = 0
#
-# SaveRespawnTimeImmediately
-# Description: Save respawn time for creatures at death and gameobjects at use/open.
-# Default: 1 - (Enabled, Save respawn time immediately)
-# 0 - (Disabled, Save respawn time at grid unloading)
-
-SaveRespawnTimeImmediately = 1
-
-#
# MaxOverspeedPings
# Description: Maximum overspeed ping count before character is disconnected.
# Default: 2 - (Enabled, Minimum value)