diff options
| author | xinef1 <w.szyszko2@gmail.com> | 2017-03-02 02:19:25 +0100 |
|---|---|---|
| committer | ariel- <ariel-@users.noreply.github.com> | 2017-03-01 22:19:25 -0300 |
| commit | 7567cafec84080d26ea513242a1f540a823b8f9d (patch) | |
| tree | f6f37a7cc4d06db0dbb0e08a01f8a18cf47ac955 /src/server/scripts/Spells | |
| parent | 7011aabb56f061fc889ec42ce32b7605ceb35b53 (diff) | |
Ensure that all actions are compared to fixed point in time (ie. world update start) (#18910)
- Actions will not be dependent on processing moment
- Increased GameObjects cooldown resolution to milliseconds, fixes arming time of traps to be exactly one second and not something from range (1000, 1999)
- Created GameTime namespace and UpdateTime class and moved there some code out of world
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_druid.cpp | 9 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 5 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_paladin.cpp | 3 |
3 files changed, 10 insertions, 7 deletions
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 7e406b86635..812cc20a971 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -22,6 +22,7 @@ */ #include "Player.h" +#include "GameTime.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" @@ -234,7 +235,7 @@ class spell_dru_eclipse : public SpellScriptLoader if (!spellInfo || !(spellInfo->SpellFamilyFlags[0] & 4)) // Starfire return false; - return _solarProcCooldownEnd <= std::chrono::steady_clock::now(); + return _solarProcCooldownEnd <= GameTime::GetGameTimeSteadyPoint(); } bool CheckLunar(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) @@ -247,14 +248,14 @@ class spell_dru_eclipse : public SpellScriptLoader if (!roll_chance_i(60)) return false; - return _lunarProcCooldownEnd <= std::chrono::steady_clock::now(); + return _lunarProcCooldownEnd <= GameTime::GetGameTimeSteadyPoint(); } void ProcSolar(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - _solarProcCooldownEnd = std::chrono::steady_clock::now() + Seconds(30); + _solarProcCooldownEnd = GameTime::GetGameTimeSteadyPoint() + Seconds(30); eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_DRUID_ECLIPSE_SOLAR_PROC, TRIGGERED_FULL_MASK, nullptr, aurEff); } @@ -262,7 +263,7 @@ class spell_dru_eclipse : public SpellScriptLoader { PreventDefaultAction(); - _lunarProcCooldownEnd = std::chrono::steady_clock::now() + Seconds(30); + _lunarProcCooldownEnd = GameTime::GetGameTimeSteadyPoint() + Seconds(30); eventInfo.GetActor()->CastSpell(eventInfo.GetActor(), SPELL_DRUID_ECLIPSE_LUNAR_PROC, TRIGGERED_FULL_MASK, nullptr, aurEff); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index effb3fb9b5c..0a5890f4a5d 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -23,6 +23,7 @@ */ #include "ScriptMgr.h" +#include "GameTime.h" #include "Battleground.h" #include "Cell.h" #include "CellImpl.h" @@ -3570,7 +3571,7 @@ class spell_gen_turkey_marker : public SpellScriptLoader void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { // store stack apply times, so we can pop them while they expire - _applyTimes.push_back(getMSTime()); + _applyTimes.push_back(GameTime::GetGameTimeMS()); Unit* target = GetTarget(); // on stack 15 cast the achievement crediting spell @@ -3584,7 +3585,7 @@ class spell_gen_turkey_marker : public SpellScriptLoader return; // pop stack if it expired for us - if (_applyTimes.front() + GetMaxDuration() < getMSTime()) + if (_applyTimes.front() + GetMaxDuration() < GameTime::GetGameTimeMS()) ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE); } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 6dc6681a7a1..20d632b3c2a 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -22,6 +22,7 @@ */ #include "Player.h" +#include "GameTime.h" #include "ScriptMgr.h" #include "SpellScript.h" #include "SpellAuraEffects.h" @@ -1988,7 +1989,7 @@ class spell_pal_sacred_shield_dummy : public SpellScriptLoader if (!caster) return; - std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); + std::chrono::steady_clock::time_point now = GameTime::GetGameTimeSteadyPoint(); if (_cooldownEnd > now) return; |
