mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-04 11:33:48 +00:00
feat(Core/Time): Implement saparated manager for game time (#8630)
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "Battleground.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Common.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Log.h"
|
||||
@@ -2944,7 +2945,7 @@ void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode
|
||||
|
||||
// start fall from current height
|
||||
if (!apply && target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->ToPlayer()->SetFallInformation(time(nullptr), target->GetPositionZ());
|
||||
target->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), target->GetPositionZ());
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "ArenaSpectator.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Common.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -407,7 +408,7 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
|
||||
|
||||
Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID, ObjectGuid itemGUID /*= ObjectGuid::Empty*/) :
|
||||
m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
|
||||
m_castItemGuid(itemGUID ? itemGUID : castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(time(nullptr)),
|
||||
m_castItemGuid(itemGUID ? itemGUID : castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(GameTime::GetGameTime().count()),
|
||||
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), m_triggeredByAuraSpellInfo(nullptr)
|
||||
@@ -2134,7 +2135,7 @@ bool Aura::IsProcOnCooldown() const
|
||||
{
|
||||
/*if (m_procCooldown)
|
||||
{
|
||||
if (m_procCooldown > time(nullptr))
|
||||
if (m_procCooldown > GameTime::GetGameTime().count())
|
||||
return true;
|
||||
}*/
|
||||
return false;
|
||||
@@ -2142,7 +2143,7 @@ bool Aura::IsProcOnCooldown() const
|
||||
|
||||
void Aura::AddProcCooldown(uint32 /*msec*/)
|
||||
{
|
||||
//m_procCooldown = time(nullptr) + msec;
|
||||
//m_procCooldown = GameTime::GetGameTime().count() + msec;
|
||||
}
|
||||
|
||||
void Aura::PrepareProcToTrigger(AuraApplication* aurApp, ProcEventInfo& eventInfo)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "DisableMgr.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
@@ -2440,7 +2441,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().count() - target->timeDelay) <= effectUnit->m_lastSanctuaryTime && GameTime::GetGameTimeMS().count() < (effectUnit->m_lastSanctuaryTime + 500) &&
|
||||
effectUnit->FindMap() && !effectUnit->FindMap()->IsDungeon()
|
||||
)
|
||||
return; // No missinfo in that case
|
||||
@@ -4461,7 +4462,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().count()); // timestamp
|
||||
|
||||
WriteSpellGoTargets(&data);
|
||||
|
||||
@@ -4961,7 +4962,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().count());
|
||||
}
|
||||
|
||||
void Spell::TakeAmmo()
|
||||
@@ -6030,7 +6031,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
// Xinef: Implement summon pending error
|
||||
if (target->GetSummonExpireTimer() > time(nullptr))
|
||||
if (target->GetSummonExpireTimer() > GameTime::GetGameTime().count())
|
||||
return SPELL_FAILED_SUMMON_PENDING;
|
||||
|
||||
// check if our map is dungeon
|
||||
@@ -6070,7 +6071,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
// Xinef: Implement summon pending error
|
||||
if (target->GetSummonExpireTimer() > time(nullptr))
|
||||
if (target->GetSummonExpireTimer() > GameTime::GetGameTime().count())
|
||||
return SPELL_FAILED_SUMMON_PENDING;
|
||||
|
||||
break;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Formulas.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Group.h"
|
||||
@@ -686,7 +687,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
|
||||
case 17731:
|
||||
case 69294:
|
||||
{
|
||||
if( !gameObjTarget || gameObjTarget->GetRespawnTime() > time(nullptr) )
|
||||
if( !gameObjTarget || gameObjTarget->GetRespawnTime() > GameTime::GetGameTime().count() )
|
||||
return;
|
||||
|
||||
gameObjTarget->SetRespawnTime(10);
|
||||
@@ -4305,7 +4306,7 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
|
||||
}
|
||||
|
||||
// Xinef: Set last sanctuary time
|
||||
unitTarget->m_lastSanctuaryTime = World::GetGameTimeMS();
|
||||
unitTarget->m_lastSanctuaryTime = GameTime::GetGameTimeMS().count();
|
||||
|
||||
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER
|
||||
@@ -5079,7 +5080,7 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
|
||||
|
||||
// charge changes fall time
|
||||
if( m_caster->GetTypeId() == TYPEID_PLAYER )
|
||||
m_caster->ToPlayer()->SetFallInformation(time(nullptr), m_caster->GetPositionZ());
|
||||
m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), m_caster->GetPositionZ());
|
||||
|
||||
ObjectGuid targetGUID = ObjectGuid::Empty;
|
||||
if (!m_spellInfo->IsPositive() && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetTarget() == unitTarget->GetGUID())
|
||||
@@ -5224,7 +5225,7 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex)
|
||||
|
||||
// xinef: changes fall time
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
m_caster->ToPlayer()->SetFallInformation(time(nullptr), m_caster->GetPositionZ());
|
||||
m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), m_caster->GetPositionZ());
|
||||
}
|
||||
|
||||
void Spell::EffectQuestClear(SpellEffIndex effIndex)
|
||||
|
||||
Reference in New Issue
Block a user