From 7567cafec84080d26ea513242a1f540a823b8f9d Mon Sep 17 00:00:00 2001 From: xinef1 Date: Thu, 2 Mar 2017 02:19:25 +0100 Subject: 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 --- src/server/game/Spells/Spell.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/server/game/Spells/Spell.cpp') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 0121db50ff5..be5b7531313 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -20,6 +20,7 @@ #include "DatabaseEnv.h" #include "WorldPacket.h" #include "WorldSession.h" +#include "GameTime.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "Opcodes.h" @@ -2224,7 +2225,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) if (unit->IsAlive() != target->alive) return; - if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsPositive() && (getMSTime() - target->timeDelay) <= unit->m_lastSanctuaryTime) + if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsPositive() && (GameTime::GetGameTimeMS() - target->timeDelay) <= unit->m_lastSanctuaryTime) return; // No missinfo in that case // Get original caster (if exist) and calculate damage/healing from him data @@ -3988,7 +3989,7 @@ void Spell::SendSpellGo() data << uint8(m_cast_count); // pending spell cast? data << uint32(m_spellInfo->Id); // spellId data << uint32(castFlags); // cast flags - data << uint32(getMSTime()); // timestamp + data << uint32(GameTime::GetGameTimeMS()); // timestamp WriteSpellGoTargets(&data); @@ -4473,7 +4474,7 @@ void Spell::TakePower() // Set the five second timer if (powerType == POWER_MANA && m_powerCost > 0) - m_caster->SetLastManaUse(getMSTime()); + m_caster->SetLastManaUse(GameTime::GetGameTimeMS()); } void Spell::TakeAmmo() -- cgit v1.2.3