Ensure that all actions are compared to fixed point in time (ie. world update start)

Port From (https://github.com/TrinityCore/TrinityCore/commit/60663d1374beef3103f4787152654034fa4a8897)
This commit is contained in:
hondacrx
2019-09-01 10:37:14 -04:00
parent dccded6a96
commit 87d30caa49
38 changed files with 302 additions and 169 deletions
+3 -3
View File
@@ -694,10 +694,10 @@ namespace Game.Entities
{
AddTimedQuest(quest_id);
if (quest_time <= Global.WorldMgr.GetGameTime())
if (quest_time <= GameTime.GetGameTime())
questStatusData.Timer = 1;
else
questStatusData.Timer = (uint)((quest_time - Global.WorldMgr.GetGameTime()) * Time.InMilliseconds);
questStatusData.Timer = (uint)((quest_time - GameTime.GetGameTime()) * Time.InMilliseconds);
}
else
quest_time = 0;
@@ -1824,7 +1824,7 @@ namespace Game.Entities
stmt.AddValue(0, GetGUID().GetCounter());
stmt.AddValue(1, save.Key);
stmt.AddValue(2, data.Status);
stmt.AddValue(3, data.Timer / Time.InMilliseconds + Global.WorldMgr.GetGameTime());
stmt.AddValue(3, data.Timer / Time.InMilliseconds + GameTime.GetGameTime());
trans.Append(stmt);
// Save objectives
+1 -1
View File
@@ -4309,7 +4309,7 @@ namespace Game.Entities
if (proto.GetFlags().HasAnyFlag(ItemFlags.NoEquipCooldown))
return;
DateTime now = DateTime.Now;
DateTime now = GameTime.GetGameTimeSteadyPoint();
for (byte i = 0; i < proto.Effects.Count; ++i)
{
var effectData = proto.Effects[i];
@@ -446,7 +446,7 @@ namespace Game.Entities
return 10 * MoneyConstants.Gold;
else
{
ulong months = (ulong)(Global.WorldMgr.GetGameTime() - GetTalentResetTime()) / Time.Month;
ulong months = (ulong)(GameTime.GetGameTime() - GetTalentResetTime()) / Time.Month;
if (months > 0)
{
// This cost will be reduced by a rate of 5 gold per month
+7 -5
View File
@@ -72,6 +72,8 @@ namespace Game.Entities
m_logintime = Time.UnixTime;
m_Last_tick = m_logintime;
m_timeSyncServer = GameTime.GetGameTimeMS();
m_dungeonDifficulty = Difficulty.Normal;
m_raidDifficulty = Difficulty.NormalRaid;
m_legacyRaidDifficulty = Difficulty.Raid10N;
@@ -451,7 +453,7 @@ namespace Game.Entities
_cinematicMgr.m_cinematicDiff += diff;
if (_cinematicMgr.m_activeCinematicCameraId != 0 && Time.GetMSTimeDiffToNow(_cinematicMgr.m_lastCinematicCheck) > 500)
{
_cinematicMgr.m_lastCinematicCheck = Time.GetMSTime();
_cinematicMgr.m_lastCinematicCheck = GameTime.GetGameTimeMS();
_cinematicMgr.UpdateCinematicLocation(diff);
}
@@ -951,7 +953,7 @@ namespace Game.Entities
{
m_timeSyncTimer = 0;
m_timeSyncClient = 0;
m_timeSyncServer = Time.GetMSTime();
m_timeSyncServer = GameTime.GetGameTimeMS();
}
void SendTimeSync()
{
@@ -963,7 +965,7 @@ namespace Game.Entities
// Schedule next sync in 10 sec
m_timeSyncTimer = 10000;
m_timeSyncServer = Time.GetMSTime();
m_timeSyncServer = GameTime.GetGameTimeMS();
if (m_timeSyncQueue.Count > 3)
Log.outError(LogFilter.Network, "Not received CMSG_TIME_SYNC_RESP for over 30 seconds from player {0} ({1}), possible cheater", GetGUID().ToString(), GetName());
@@ -5640,8 +5642,8 @@ namespace Game.Entities
float TimeSpeed = 0.01666667f;
LoginSetTimeSpeed loginSetTimeSpeed = new LoginSetTimeSpeed();
loginSetTimeSpeed.NewSpeed = TimeSpeed;
loginSetTimeSpeed.GameTime = (uint)Global.WorldMgr.GetGameTime();
loginSetTimeSpeed.ServerTime = (uint)Global.WorldMgr.GetGameTime();
loginSetTimeSpeed.GameTime = (uint)GameTime.GetGameTime();
loginSetTimeSpeed.ServerTime = (uint)GameTime.GetGameTime();
loginSetTimeSpeed.GameTimeHolidayOffset = 0; // @todo
loginSetTimeSpeed.ServerTimeHolidayOffset = 0; // @todo
SendPacket(loginSetTimeSpeed);