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

@@ -21,6 +21,7 @@
#include "Formulas.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "GameTime.h"
#include "CellImpl.h"
#include "ScriptMgr.h"
#include "Vehicle.h"
@@ -2843,7 +2844,7 @@ void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode
// start fall from current height
if (!apply && target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->SetFallInformation(time(NULL), target->GetPositionZ());
target->ToPlayer()->SetFallInformation(GameTime::GetGameTime(), target->GetPositionZ());
}
void AuraEffect::HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool apply) const

View File

@@ -19,6 +19,7 @@
#include "Util.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "GameTime.h"
#include "CellImpl.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
@@ -395,7 +396,7 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID) :
m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
m_castItemGuid(castItem ? castItem->GetGUID() : 0),m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(time(NULL)),
m_castItemGuid(castItem ? castItem->GetGUID() : 0),m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(GameTime::GetGameTime()),
m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false)
@@ -2015,7 +2016,7 @@ bool Aura::IsProcOnCooldown() const
{
/*if (m_procCooldown)
{
if (m_procCooldown > time(NULL))
if (m_procCooldown > GameTime::GetGameTime())
return true;
}*/
return false;
@@ -2023,7 +2024,7 @@ bool Aura::IsProcOnCooldown() const
void Aura::AddProcCooldown(uint32 /*msec*/)
{
//m_procCooldown = time(NULL) + msec;
//m_procCooldown = GameTime::GetGameTime() + msec;
}
void Aura::PrepareProcToTrigger(AuraApplication* aurApp, ProcEventInfo& eventInfo)

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;

View File

@@ -21,6 +21,7 @@
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "Group.h"
#include "GameTime.h"
#include "UpdateData.h"
#include "MapManager.h"
#include "ObjectAccessor.h"
@@ -702,7 +703,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
case 17731:
case 69294:
{
if( !gameObjTarget || gameObjTarget->GetRespawnTime() > time(NULL) )
if( !gameObjTarget || gameObjTarget->GetRespawnTime() > GameTime::GetGameTime() )
return;
gameObjTarget->SetRespawnTime(10);
@@ -4210,7 +4211,7 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
}
// Xinef: Set last sanctuary time
unitTarget->m_lastSanctuaryTime = World::GetGameTimeMS();
unitTarget->m_lastSanctuaryTime = GameTime::GetGameTimeMS();
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
if (m_caster->GetTypeId() == TYPEID_PLAYER
@@ -4942,7 +4943,7 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
// charge changes fall time
if( m_caster->GetTypeId() == TYPEID_PLAYER )
m_caster->ToPlayer()->SetFallInformation(time(NULL), m_caster->GetPositionZ());
m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime(), m_caster->GetPositionZ());
if (m_pathFinder)
{
@@ -5063,7 +5064,7 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex)
// xinef: changes fall time
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetFallInformation(time(NULL), m_caster->GetPositionZ());
m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime(), m_caster->GetPositionZ());
}
void Spell::EffectQuestClear(SpellEffIndex effIndex)