Core/Spawn: Limit saved/stored respawn time. - Limit to long maximum, for the compiled-for architecture.

Port From (https://github.com/TrinityCore/TrinityCore/commit/f3ac10f36fcc46c5e1537d69544a9294fc719ad2)
This commit is contained in:
hondacrx
2021-02-09 13:15:12 -05:00
parent e04769852a
commit 9a14cfe807
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -2213,7 +2213,7 @@ namespace Game.Entities
return;
}
uint thisRespawnTime = (uint)(forceDelay != 0 ? Time.UnixTime + forceDelay : m_respawnTime);
long thisRespawnTime = forceDelay != 0 ? Time.UnixTime + forceDelay : m_respawnTime;
GetMap().SaveRespawnTime(SpawnObjectType.Creature, m_spawnId, GetEntry(), thisRespawnTime, GetMap().GetZoneId(GetPhaseShift(), GetHomePosition()), GridDefines.ComputeGridCoord(GetHomePosition().GetPositionX(), GetHomePosition().GetPositionY()).GetId(), saveToDb && m_creatureData != null && m_creatureData.dbData);
}
@@ -1148,7 +1148,7 @@ namespace Game.Entities
return;
}
uint thisRespawnTime = (uint)(forceDelay != 0 ? Time.UnixTime + forceDelay : m_respawnTime);
long thisRespawnTime = forceDelay != 0 ? Time.UnixTime + forceDelay : m_respawnTime;
GetMap().SaveRespawnTime(SpawnObjectType.GameObject, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), GridDefines.ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData.dbData ? savetodb : false);
}
}
+3 -1
View File
@@ -2536,7 +2536,9 @@ namespace Game.Maps
{
long now = Time.UnixTime;
long respawnTime;
if (Global.ObjectMgr.GetLinkedRespawnGuid(thisGUID) == thisGUID) // never respawn, save "something" in DB
if (linkedTime == long.MaxValue)
respawnTime = linkedTime;
else if (Global.ObjectMgr.GetLinkedRespawnGuid(thisGUID) == thisGUID) // never respawn, save "something" in DB
respawnTime = now + Time.Week;
else // set us to check again shortly after linked unit
respawnTime = Math.Max(now, linkedTime) + RandomHelper.URand(5, 15);