Core/Misc: Replace Time.UnixTime with GameTime.GetGameTime()
Port From (https://github.com/TrinityCore/TrinityCore/commit/e17e4e6f0700c7d950e1b2654c217ec8b28ae79e)
This commit is contained in:
@@ -71,7 +71,7 @@ namespace Game.Maps
|
||||
resetTime = GetResetTimeFor(mapId, difficulty);
|
||||
else
|
||||
{
|
||||
resetTime = Time.UnixTime + 2 * Time.Hour;
|
||||
resetTime = GameTime.GetGameTime() + 2 * Time.Hour;
|
||||
// normally this will be removed soon after in InstanceMap.Add, prevent error
|
||||
ScheduleReset(true, resetTime, new InstResetEvent(0, mapId, difficulty, instanceId));
|
||||
}
|
||||
@@ -179,7 +179,7 @@ namespace Game.Maps
|
||||
|
||||
void LoadResetTimes()
|
||||
{
|
||||
long now = Time.UnixTime;
|
||||
long now = GameTime.GetGameTime();
|
||||
long today = (now / Time.Day) * Time.Day;
|
||||
|
||||
// NOTE: Use DirectPExecute for tables that will be queried later
|
||||
@@ -375,12 +375,12 @@ namespace Game.Maps
|
||||
ScheduleReset(false, 0, new InstResetEvent(1, mapId, difficulty, 0));
|
||||
ScheduleReset(false, 0, new InstResetEvent(4, mapId, difficulty, 0));
|
||||
// force global reset on the instance
|
||||
_ResetOrWarnAll(mapId, difficulty, false, Time.UnixTime);
|
||||
_ResetOrWarnAll(mapId, difficulty, false, GameTime.GetGameTime());
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
long now = Time.UnixTime;
|
||||
long now = GameTime.GetGameTime();
|
||||
|
||||
while (!m_resetTimeQueue.Empty())
|
||||
{
|
||||
@@ -489,7 +489,7 @@ namespace Game.Maps
|
||||
return;
|
||||
|
||||
Log.outDebug(LogFilter.Misc, "InstanceSaveManager.ResetOrWarnAll: Processing map {0} ({1}) on difficulty {2} (warn? {3})", mapEntry.MapName[Global.WorldMgr.GetDefaultDbcLocale()], mapid, difficulty, warn);
|
||||
long now = Time.UnixTime;
|
||||
long now = GameTime.GetGameTime();
|
||||
|
||||
if (!warn)
|
||||
{
|
||||
|
||||
@@ -2393,7 +2393,7 @@ namespace Game.Maps
|
||||
long linkedTime = GetLinkedRespawnTime(thisGUID);
|
||||
if (linkedTime != 0)
|
||||
{
|
||||
long now = Time.UnixTime;
|
||||
long now = GameTime.GetGameTime();
|
||||
long respawnTime;
|
||||
if (linkedTime == long.MaxValue)
|
||||
respawnTime = linkedTime;
|
||||
@@ -2424,7 +2424,7 @@ namespace Game.Maps
|
||||
{
|
||||
if (!Global.ScriptMgr.CanSpawn(info.spawnId, info.entry, Global.ObjectMgr.GetCreatureData(info.spawnId), this))
|
||||
{ // if a script blocks our respawn, schedule next check in a little bit
|
||||
info.respawnTime = Time.UnixTime + RandomHelper.URand(4, 7);
|
||||
info.respawnTime = GameTime.GetGameTime() + RandomHelper.URand(4, 7);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2614,7 +2614,7 @@ namespace Game.Maps
|
||||
|
||||
void ProcessRespawns()
|
||||
{
|
||||
long now = Time.UnixTime;
|
||||
long now = GameTime.GetGameTime();
|
||||
while (!_respawnTimes.Empty())
|
||||
{
|
||||
RespawnInfo next = _respawnTimes.First();
|
||||
@@ -2715,7 +2715,7 @@ namespace Game.Maps
|
||||
}
|
||||
|
||||
long respawnTime = GetRespawnTime(data.type, data.spawnId);
|
||||
if (respawnTime != 0 && respawnTime > Time.UnixTime)
|
||||
if (respawnTime != 0 && respawnTime > GameTime.GetGameTime())
|
||||
{
|
||||
if (!force && !ignoreRespawn)
|
||||
continue;
|
||||
@@ -3351,7 +3351,7 @@ namespace Game.Maps
|
||||
|
||||
public void RemoveOldCorpses()
|
||||
{
|
||||
long now = Time.UnixTime;
|
||||
long now = GameTime.GetGameTime();
|
||||
|
||||
List<ObjectGuid> corpses = new();
|
||||
|
||||
@@ -5035,7 +5035,7 @@ namespace Game.Maps
|
||||
|
||||
// increase current instances (hourly limit)
|
||||
if (!group || !group.IsLFGGroup())
|
||||
player.AddInstanceEnterTime(GetInstanceId(), Time.UnixTime);
|
||||
player.AddInstanceEnterTime(GetInstanceId(), GameTime.GetGameTime());
|
||||
|
||||
// get or create an instance save for the map
|
||||
InstanceSave mapSave = Global.InstanceSaveMgr.GetInstanceSave(GetInstanceId());
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace Game.Maps
|
||||
// If script is blocking spawn, don't spawn but queue for a re-check in a little bit
|
||||
if (!group.flags.HasFlag(SpawnGroupFlags.CompatibilityMode) && !Global.ScriptMgr.CanSpawn(guid, cdata.Id, cdata, map))
|
||||
{
|
||||
map.SaveRespawnTime(SpawnObjectType.Creature, guid, cdata.Id, Time.UnixTime + RandomHelper.URand(4, 7), map.GetZoneId(PhasingHandler.EmptyPhaseShift, cdata.spawnPoint), GridDefines.ComputeGridCoord(cdata.spawnPoint.GetPositionX(), cdata.spawnPoint.GetPositionY()).GetId(), false);
|
||||
map.SaveRespawnTime(SpawnObjectType.Creature, guid, cdata.Id, GameTime.GetGameTime() + RandomHelper.URand(4, 7), map.GetZoneId(PhasingHandler.EmptyPhaseShift, cdata.spawnPoint), GridDefines.ComputeGridCoord(cdata.spawnPoint.GetPositionX(), cdata.spawnPoint.GetPositionY()).GetId(), false);
|
||||
obj.Dispose();
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user