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:
@@ -1449,7 +1449,7 @@ namespace Scripts.Northrend.IcecrownCitadel
|
||||
|
||||
GameObject trap = GetCaster().FindNearestGameObject(trapId, 5.0f);
|
||||
if (trap)
|
||||
trap.SetRespawnTime((int)trap.GetGoInfo().GetAutoCloseTime());
|
||||
trap.SetRespawnTime((int)trap.GetGoInfo().GetAutoCloseTime() / Time.InMilliseconds);
|
||||
|
||||
List<Creature> wards = new List<Creature>();
|
||||
GetCaster().GetCreatureListWithEntryInGrid(wards, CreatureIds.DeathboundWard, 150.0f);
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Scripts.Northrend.Nexus.Nexus
|
||||
while (time[i] != 0)
|
||||
++i;
|
||||
|
||||
time[i] = Global.WorldMgr.GetGameTime();
|
||||
time[i] = GameTime.GetGameTime();
|
||||
if (i == 2 && (time[2] - time[1] < 5) && (time[1] - time[0] < 5))
|
||||
++splitPersonality;
|
||||
}
|
||||
|
||||
@@ -2661,7 +2661,7 @@ namespace Scripts.Spells.Generic
|
||||
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
|
||||
{
|
||||
// store stack apply times, so we can pop them while they expire
|
||||
_applyTimes.Add(Time.GetMSTime());
|
||||
_applyTimes.Add(GameTime.GetGameTimeMS());
|
||||
Unit target = GetTarget();
|
||||
|
||||
// on stack 15 cast the achievement crediting spell
|
||||
@@ -2675,7 +2675,7 @@ namespace Scripts.Spells.Generic
|
||||
return;
|
||||
|
||||
// pop stack if it expired for us
|
||||
if (_applyTimes.First() + GetMaxDuration() < Time.GetMSTime())
|
||||
if (_applyTimes.First() + GetMaxDuration() < GameTime.GetGameTimeMS())
|
||||
ModStackAmount(-1, AuraRemoveMode.Expire);
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace Scripts.World
|
||||
{
|
||||
uint triggerId = trigger.Id;
|
||||
// Second trigger happened too early after first, skip for now
|
||||
if (Global.WorldMgr.GetGameTime() - _triggerTimes[triggerId] < AreaTriggerConst.AreatriggerTalkCooldown)
|
||||
if (GameTime.GetGameTime() - _triggerTimes[triggerId] < AreaTriggerConst.AreatriggerTalkCooldown)
|
||||
return false;
|
||||
|
||||
switch (triggerId)
|
||||
@@ -295,7 +295,7 @@ namespace Scripts.World
|
||||
break;
|
||||
}
|
||||
|
||||
_triggerTimes[triggerId] = Global.WorldMgr.GetGameTime();
|
||||
_triggerTimes[triggerId] = GameTime.GetGameTime();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace Scripts.World
|
||||
return false;
|
||||
|
||||
uint triggerId = trigger.Id;
|
||||
if (Global.WorldMgr.GetGameTime() - _triggerTimes[trigger.Id] < AreaTriggerConst.SummonCooldown)
|
||||
if (GameTime.GetGameTime() - _triggerTimes[trigger.Id] < AreaTriggerConst.SummonCooldown)
|
||||
return false;
|
||||
|
||||
switch (triggerId)
|
||||
@@ -347,7 +347,7 @@ namespace Scripts.World
|
||||
|
||||
player.SummonCreature(AreaTriggerConst.NpcSpotlight, x, y, z, 0.0f, TempSummonType.TimedDespawn, 5000);
|
||||
player.AddAura(AreaTriggerConst.SpellA52Neuralyzer, player);
|
||||
_triggerTimes[trigger.Id] = Global.WorldMgr.GetGameTime();
|
||||
_triggerTimes[trigger.Id] = GameTime.GetGameTime();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Scripts.World
|
||||
// remove cooldowns on spells that have < 10 min CD > 30 sec and has no onHold
|
||||
player.GetSpellHistory().ResetCooldowns(pair =>
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
DateTime now = GameTime.GetGameTimeSystemPoint();
|
||||
uint cooldownDuration = pair.Value.CooldownEnd > now ? (uint)(pair.Value.CooldownEnd - now).TotalMilliseconds : 0;
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key);
|
||||
return spellInfo.RecoveryTime < 10 * Time.Minute * Time.InMilliseconds
|
||||
|
||||
Reference in New Issue
Block a user