feat(core): Ensure that all actions are compared to fixed point in time (#1236) (#1458)

i.e. world update start
This commit is contained in:
Viste(Кирилл)
2019-02-14 21:22:17 +03:00
committed by Francesco Borzì
parent 1b7522ff0e
commit 51b8773528
108 changed files with 933 additions and 509 deletions

View File

@@ -23,6 +23,7 @@
#include "Spell.h"
#include "DynamicObject.h"
#include "Group.h"
#include "GameTime.h"
#include "UpdateData.h"
#include "MapManager.h"
#include "ObjectAccessor.h"
@@ -2576,7 +2577,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
// Xinef: absorb delayed projectiles for 500ms
if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsTargetingArea() && !m_spellInfo->IsPositive() &&
(World::GetGameTimeMS() - target->timeDelay) <= effectUnit->m_lastSanctuaryTime && World::GetGameTimeMS() < (effectUnit->m_lastSanctuaryTime + 500) &&
(GameTime::GetGameTimeMS() - target->timeDelay) <= effectUnit->m_lastSanctuaryTime && GameTime::GetGameTimeMS() < (effectUnit->m_lastSanctuaryTime + 500) &&
effectUnit->FindMap() && !effectUnit->FindMap()->IsDungeon()
)
return; // No missinfo in that case
@@ -4517,7 +4518,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(World::GetGameTimeMS()); // timestamp
data << uint32(GameTime::GetGameTimeMS()); // timestamp
WriteSpellGoTargets(&data);
@@ -5000,7 +5001,7 @@ void Spell::TakePower()
// Set the five second timer
if (powerType == POWER_MANA && m_powerCost > 0)
m_caster->SetLastManaUse(World::GetGameTimeMS());
m_caster->SetLastManaUse(GameTime::GetGameTimeMS());
}
void Spell::TakeAmmo()
@@ -6022,7 +6023,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS;
// Xinef: Implement summon pending error
if (target->GetSummonExpireTimer() > time(NULL))
if (target->GetSummonExpireTimer() > GameTime::GetGameTime())
return SPELL_FAILED_SUMMON_PENDING;
// check if our map is dungeon
@@ -6062,7 +6063,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS;
// Xinef: Implement summon pending error
if (target->GetSummonExpireTimer() > time(NULL))
if (target->GetSummonExpireTimer() > GameTime::GetGameTime())
return SPELL_FAILED_SUMMON_PENDING;
break;