![]() |
AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "SpellHistory.h"
Classes | |
| struct | CooldownEntry |
| struct | PersistenceHelper |
| struct | PersistenceHelper< Pet > |
| struct | PersistenceHelper< Player > |
Public Types | |
| typedef std::chrono::system_clock | Clock |
| typedef std::unordered_map< uint32, CooldownEntry > | CooldownStorageType |
| typedef std::unordered_map< uint64, CooldownEntry * > | CategoryCooldownStorageType |
| typedef std::unordered_map< uint32, Clock::time_point > | GlobalCooldownStorageType |
Public Member Functions | |
| SpellHistory (Unit *owner) | |
| template<class OwnerType > | |
| void | LoadFromDB (PreparedQueryResult cooldownsResult) |
| template<class OwnerType > | |
| void | SaveToDB (CharacterDatabaseTransaction trans) |
| void | Update () |
| void | HandleCooldowns (SpellInfo const *spellInfo, Item const *item, Spell *spell=nullptr) |
| void | HandleCooldowns (SpellInfo const *spellInfo, uint32 itemID, Spell *spell=nullptr) |
| bool | IsReady (SpellInfo const *spellInfo, uint32 itemId=0, bool ignoreCategoryCooldown=false) const |
| template<class OwnerType > | |
| void | WritePacket (WorldPacket &packet) const |
| void | StartCooldown (SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool onHold=false) |
| void | SendCooldownEvent (SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool startCooldown=true) |
| template<class Type , class Period > | |
| void | AddCooldown (uint32 spellId, uint32 itemId, std::chrono::duration< Type, Period > cooldownDuration) |
| void | AddCooldown (uint32 spellId, uint32 itemId, Clock::time_point cooldownEnd, uint32 categoryId, Clock::time_point categoryEnd, bool onHold=false) |
| void | AnnounceToSpectators (uint32 spellId, uint32 durationMs) |
| void | ModifyCooldown (uint32 spellId, int32 cooldownModMs) |
| void | ResetCooldown (uint32 spellId, bool update=false) |
| void | ResetCooldown (CooldownStorageType::iterator &itr, bool update=false) |
| template<typename Predicate > | |
| void | ResetCooldowns (Predicate predicate, bool update=false) |
| void | ResetAllCooldowns () |
| bool | HasCooldown (SpellInfo const *spellInfo, uint32 itemId=0, bool ignoreCategoryCooldown=false) const |
| bool | HasCooldown (uint32 spellId, uint32 itemId=0, bool ignoreCategoryCooldown=false) const |
| bool | HasItemCooldown (uint32 spellId, uint32 itemId) const |
| uint32 | GetRemainingCooldown (SpellInfo const *spellInfo, uint32 itemId=0) const |
| uint32 | GetRemainingCooldown (uint32 spellId) const |
| void | LockSpellSchool (SpellSchoolMask schoolMask, uint32 lockoutTime) |
| bool | IsSchoolLocked (SpellSchoolMask schoolMask) const |
| void | ResetSchoolLockouts () |
| bool | HasGlobalCooldown (SpellInfo const *spellInfo) const |
| uint32 | GetRemainingGlobalCooldown (SpellInfo const *spellInfo) const |
| void | AddGlobalCooldown (SpellInfo const *spellInfo, uint32 duration) |
| void | CancelGlobalCooldown (SpellInfo const *spellInfo) |
| CooldownStorageType const & | GetSpellCooldowns () const |
| CooldownStorageType::size_type | GetCooldownsSizeForPacket () const |
| void | SaveCooldownStateBeforeDuel () |
| void | RestoreCooldownStateAfterDuel () |
| template<> | |
| void | WritePacket (WorldPacket &packet) const |
| template<> | |
| void | WritePacket (WorldPacket &packet) const |
| template<> | |
| AC_GAME_API void | WritePacket (WorldPacket &packet) const |
| template<> | |
| AC_GAME_API void | WritePacket (WorldPacket &packet) const |
Static Public Member Functions | |
| static void | GetCooldownDurations (SpellInfo const *spellInfo, uint32 itemId, int32 *cooldown, uint32 *categoryId, int32 *categoryCooldown) |
Static Public Attributes | |
| static Clock::duration const | InfinityCooldownDelay = std::chrono::duration_cast<SpellHistory::Clock::duration>(std::chrono::seconds(MONTH)) |
Private Member Functions | |
| Player * | GetPlayerOwner () const |
| void | SendClearCooldowns (std::vector< int32 > const &cooldowns) const |
| void | SendCreatureCooldowns (SpellInfo const *spellInfo, uint32 categoryId) const |
| CooldownEntry const * | GetBlockingCategoryCooldown (SpellInfo const *spellInfo, uint32 itemId) const |
| void | LinkCategoryCooldown (CooldownEntry &entry) |
| void | UnlinkCategoryCooldown (CooldownEntry const &entry) |
| CooldownStorageType::iterator | EraseCooldown (CooldownStorageType::iterator itr) |
Static Private Member Functions | |
| static uint64 | CategoryKey (uint32 categoryId, uint32 spellId, uint32 itemId) |
Private Attributes | |
| Unit * | _owner |
| CooldownStorageType | _spellCooldowns |
| CooldownStorageType | _spellCooldownsBeforeDuel |
| CategoryCooldownStorageType | _categoryCooldowns |
| Clock::time_point | _schoolLockouts [MAX_SPELL_SCHOOL] |
| GlobalCooldownStorageType | _globalCooldowns |
| typedef std::unordered_map<uint64 , CooldownEntry*> SpellHistory::CategoryCooldownStorageType |
| typedef std::chrono::system_clock SpellHistory::Clock |
| typedef std::unordered_map<uint32 , CooldownEntry> SpellHistory::CooldownStorageType |
| typedef std::unordered_map<uint32 , Clock::time_point> SpellHistory::GlobalCooldownStorageType |
|
inlineexplicit |
| void SpellHistory::AddCooldown | ( | uint32 | spellId, |
| uint32 | itemId, | ||
| Clock::time_point | cooldownEnd, | ||
| uint32 | categoryId, | ||
| Clock::time_point | categoryEnd, | ||
| bool | onHold = false |
||
| ) |
References _spellCooldowns, SpellHistory::CooldownEntry::CategoryEnd, SpellHistory::CooldownEntry::CategoryId, SpellHistory::CooldownEntry::CooldownEnd, SpellHistory::CooldownEntry::ItemId, LinkCategoryCooldown(), SpellHistory::CooldownEntry::OnHold, SpellHistory::CooldownEntry::SpectatorDuration, SpellHistory::CooldownEntry::SpellId, and UnlinkCategoryCooldown().
|
inline |
References GameTime::GetSystemTime().
Referenced by spell_rog_cheat_death::Absorb(), Player::ApplyEquipCooldown(), Spell::DoSpellHitOnUnit(), Aura::HandleAuraSpecificMods(), debug_commandscript::HandleDebugCooldownCommand(), spell_chapter5_return_to_capital::HandleHit(), spell_dru_leader_of_the_pack::HandleProc(), spell_sha_earth_shield::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), spell_dk_wandering_plague_aura::HandleProc(), spell_hun_chimera_shot::HandleScriptEffect(), boss_zuljin::JustEngagedWith(), LockSpellSchool(), npc_sayge::OnGossipSelect(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_brewfest_keg_reciver::sGossipSelect(), StartCooldown(), TriggerBurningPitch(), and npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI().
References _globalCooldowns, GameTime::GetSystemTime(), and SpellInfo::StartRecoveryCategory.
Referenced by Player::EquipItem(), and Spell::TriggerGlobalCooldown().
References _owner, _spellCooldowns, WorldObject::FindMap(), Object::GetGUID(), Player::HasActiveSpell(), IN_MILLISECONDS, Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_Cooldown(), SPECTATOR_COOLDOWN_MAX, and Object::ToPlayer().
Referenced by Player::ApplyEquipCooldown(), and StartCooldown().
| void SpellHistory::CancelGlobalCooldown | ( | SpellInfo const * | spellInfo | ) |
References _globalCooldowns, and SpellInfo::StartRecoveryCategory.
Referenced by Spell::CancelGlobalCooldown().
References SpellInfo::SpellFamilyName, and sSpellMgr.
Referenced by GetBlockingCategoryCooldown(), LinkCategoryCooldown(), and UnlinkCategoryCooldown().
|
inlineprivate |
Referenced by ModifyCooldown(), ResetCooldown(), and Update().
|
private |
References _categoryCooldowns, CategoryKey(), GetCooldownDurations(), and SpellInfo::Id.
Referenced by GetRemainingCooldown(), HasCooldown(), and SendCooldownEvent().
|
static |
References ASSERT, SpellInfo::CategoryRecoveryTime, SpellInfo::GetCategory(), SpellInfo::Id, MAX_ITEM_SPELLS, SpellInfo::RecoveryTime, and sObjectMgr.
Referenced by GetBlockingCategoryCooldown(), misc_commandscript::HandleCooldownCommand(), Player::RemoveArenaSpellCooldowns(), and StartCooldown().
|
inline |
Referenced by Player::VehicleSpellInitialize().
|
private |
References _owner, and Unit::GetCharmerOrOwnerPlayerOrPlayerItself().
Referenced by LockSpellSchool(), ModifyCooldown(), ResetAllCooldowns(), ResetCooldown(), SendClearCooldowns(), SendCooldownEvent(), SendCreatureCooldowns(), and StartCooldown().
References _spellCooldowns, GetBlockingCategoryCooldown(), GameTime::GetSystemTime(), and SpellInfo::Id.
Referenced by GetRemainingCooldown(), Aura::HandleAuraSpecificMods(), LockSpellSchool(), npc_brewfest_keg_reciver::MoveInLineOfSight(), SendCreatureCooldowns(), and boss_twin_valkyrAI::UpdateAI().
References _spellCooldowns, GetRemainingCooldown(), GameTime::GetSystemTime(), and sSpellMgr.
References _globalCooldowns, GameTime::GetSystemTime(), and SpellInfo::StartRecoveryCategory.
|
inline |
Referenced by ArenaSpectator::HandleResetCommand().
| void SpellHistory::HandleCooldowns | ( | SpellInfo const * | spellInfo, |
| Item const * | item, | ||
| Spell * | spell = nullptr |
||
| ) |
References Object::GetEntry(), and HandleCooldowns().
Referenced by HandleCooldowns(), and Spell::SendSpellCooldown().
| void SpellHistory::HandleCooldowns | ( | SpellInfo const * | spellInfo, |
| uint32 | itemID, | ||
| Spell * | spell = nullptr |
||
| ) |
References _owner, Spell::HasTriggeredCastFlag(), SpellInfo::IsCooldownStartedOnEvent(), Spell::IsIgnoringCooldowns(), SpellInfo::IsPassive(), sObjectMgr, StartCooldown(), Object::ToPlayer(), and TRIGGERED_IGNORE_EFFECTS.
| bool SpellHistory::HasCooldown | ( | SpellInfo const * | spellInfo, |
| uint32 | itemId = 0, |
||
| bool | ignoreCategoryCooldown = false |
||
| ) | const |
References _spellCooldowns, SpellHistory::CooldownEntry::CategoryEnd, GetBlockingCategoryCooldown(), GameTime::GetSystemTime(), and SpellInfo::Id.
Referenced by spell_rog_cheat_death::Absorb(), Spell::CheckCast(), spell_sha_earth_shield::CheckProc(), spell_dk_wandering_plague_aura::CheckProc(), spell_warr_sweeping_strikes::CheckProc(), Spell::EffectCastButtons(), Spell::EffectStuck(), Aura::HandleAuraSpecificMods(), spell_chapter5_return_to_capital::HandleHit(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), spell_dru_leader_of_the_pack::HandleProc(), spell_gen_divine_storm_cd_reset::HandleScript(), spell_hun_chimera_shot::HandleScriptEffect(), HasCooldown(), boss_faction_championsAI::IsCCed(), IsReady(), boss_zuljin::JustEngagedWith(), npc_sayge::OnGossipHello(), TriggerBurningPitch(), PetAI::UpdateAI(), and npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI().
| bool SpellHistory::HasCooldown | ( | uint32 | spellId, |
| uint32 | itemId = 0, |
||
| bool | ignoreCategoryCooldown = false |
||
| ) | const |
References _spellCooldowns, GameTime::GetSystemTime(), HasCooldown(), and sSpellMgr.
| bool SpellHistory::HasGlobalCooldown | ( | SpellInfo const * | spellInfo | ) | const |
References _globalCooldowns, GameTime::GetSystemTime(), and SpellInfo::StartRecoveryCategory.
Referenced by Spell::CheckPetCast(), Spell::HasGlobalCooldown(), and PetAI::UpdateAI().
References _spellCooldowns, and GameTime::GetSystemTime().
Referenced by Spell::CheckCast().
| bool SpellHistory::IsReady | ( | SpellInfo const * | spellInfo, |
| uint32 | itemId = 0, |
||
| bool | ignoreCategoryCooldown = false |
||
| ) | const |
References SpellInfo::GetSchoolMask(), HasCooldown(), SpellInfo::Id, IsSchoolLocked(), SpellInfo::PreventionType, and SPELL_PREVENTION_TYPE_SILENCE.
Referenced by Spell::CheckCast().
| bool SpellHistory::IsSchoolLocked | ( | SpellSchoolMask | schoolMask | ) | const |
References _schoolLockouts, GameTime::GetSystemTime(), and MAX_SPELL_SCHOOL.
Referenced by Spell::CheckCast(), SmartAI::IsMainSpellPrevented(), IsReady(), and npc_pet_dk_ebon_gargoyle::UpdateAI().
|
private |
References _categoryCooldowns, SpellHistory::CooldownEntry::CategoryId, CategoryKey(), SpellHistory::CooldownEntry::ItemId, and SpellHistory::CooldownEntry::SpellId.
Referenced by AddCooldown(), LoadFromDB(), and RestoreCooldownStateAfterDuel().
| template void SpellHistory::LoadFromDB< Pet > | ( | PreparedQueryResult | cooldownsResult | ) |
References _spellCooldowns, and LinkCategoryCooldown().
Referenced by Player::LoadFromDB().
| void SpellHistory::LockSpellSchool | ( | SpellSchoolMask | schoolMask, |
| uint32 | lockoutTime | ||
| ) |
References _owner, _schoolLockouts, AddCooldown(), Unit::BuildCooldownPacket(), GetPlayerOwner(), GetRemainingCooldown(), SpellInfo::GetSchoolMask(), GameTime::GetSystemTime(), SpellInfo::IsCooldownStartedOnEvent(), MAX_CREATURE_SPELLS, MAX_SPELL_SCHOOL, PETSPELL_REMOVED, PLAYERSPELL_REMOVED, SpellInfo::PreventionType, SPELL_COOLDOWN_FLAG_NONE, SPELL_PREVENTION_TYPE_SILENCE, sSpellMgr, Object::ToCreature(), Unit::ToPet(), and Object::ToPlayer().
Referenced by Spell::EffectInterruptCast().
References _owner, _spellCooldowns, EraseCooldown(), Object::GetGUID(), GetPlayerOwner(), GameTime::GetSystemTime(), and SMSG_MODIFY_COOLDOWN.
| void SpellHistory::ResetAllCooldowns | ( | ) |
References _categoryCooldowns, _spellCooldowns, GetPlayerOwner(), and SendClearCooldowns().
Referenced by Spell::EffectSummonPet(), and misc_commandscript::HandleCooldownCommand().
| void SpellHistory::ResetCooldown | ( | CooldownStorageType::iterator & | itr, |
| bool | update = false |
||
| ) |
References _owner, EraseCooldown(), and GetPlayerOwner().
| void SpellHistory::ResetCooldown | ( | uint32 | spellId, |
| bool | update = false |
||
| ) |
References _spellCooldowns, and ResetCooldown().
Referenced by Spell::_cast(), Spell::cancel(), Spell::EffectTriggerMissileSpell(), Spell::EffectTriggerSpell(), Spell::finish(), spell_dru_berserk::HandleAfterCast(), Aura::HandleAuraSpecificMods(), debug_commandscript::HandleDebugCooldownCommand(), spell_hun_readiness::HandleDummy(), spell_item_rocket_boots::HandleDummy(), spell_rog_vanish::HandleEffect(), spell_the_flag_of_ownership::HandleFinish(), spell_dk_rime::HandleProc(), spell_mage_glyph_of_ice_block::HandleProc(), spell_dk_raise_dead::HandleRaiseDead(), spell_gen_divine_storm_cd_reset::HandleScript(), AuraEffect::HandleShapeshiftBoosts(), and ResetCooldown().
|
inline |
Referenced by misc_commandscript::HandleCooldownCommand(), spell_hun_readiness::HandleDummy(), spell_item_refocus::HandleDummy(), spell_mage_cold_snap::HandleDummy(), spell_rog_preparation::HandleDummy(), spell_warr_sword_and_board::HandleProc(), and Player::RemoveArenaSpellCooldowns().
| void SpellHistory::ResetSchoolLockouts | ( | ) |
References _schoolLockouts.
Referenced by boss_shade_of_aran::JustEngagedWith().
| void SpellHistory::RestoreCooldownStateAfterDuel | ( | ) |
References _owner, _spellCooldowns, _spellCooldownsBeforeDuel, Unit::BuildCooldownPacket(), SpellInfo::CategoryRecoveryTime, GameTime::GetSystemTime(), IN_MILLISECONDS, LinkCategoryCooldown(), MINUTE, SpellHistory::CooldownEntry::OnHold, SpellInfo::RecoveryTime, SPELL_COOLDOWN_FLAG_INCLUDE_EVENT_COOLDOWNS, sSpellMgr, Object::ToPlayer(), and UnlinkCategoryCooldown().
| void SpellHistory::SaveCooldownStateBeforeDuel | ( | ) |
References _spellCooldowns, and _spellCooldownsBeforeDuel.
| template void SpellHistory::SaveToDB< Pet > | ( | CharacterDatabaseTransaction | trans | ) |
References _owner, _spellCooldowns, and CharacterDatabase.
Referenced by Pet::SavePetToDB(), and Player::SaveToDB().
|
private |
References _owner, GetPlayerOwner(), and Player::SendClearCooldown().
Referenced by ResetAllCooldowns().
| void SpellHistory::SendCooldownEvent | ( | SpellInfo const * | spellInfo, |
| uint32 | itemId = 0, |
||
| Spell * | spell = nullptr, |
||
| bool | startCooldown = true |
||
| ) |
References _owner, GetBlockingCategoryCooldown(), Object::GetGUID(), GetPlayerOwner(), SpellInfo::Id, SMSG_COOLDOWN_EVENT, SpellHistory::CooldownEntry::SpellId, sSpellMgr, and StartCooldown().
Referenced by Aura::_UnapplyForTarget(), Spell::finish(), Unit::RemoveGameObject(), Unit::SetMinion(), and Player::UpdatePotionCooldown().
|
private |
References _owner, Unit::BuildCooldownPacket(), GetPlayerOwner(), GetRemainingCooldown(), Unit::HasSpell(), SpellInfo::Id, Player::SendDirectMessage(), SPELL_COOLDOWN_FLAG_NONE, sSpellMgr, and sSpellsByCategoryStore.
Referenced by StartCooldown().
| void SpellHistory::StartCooldown | ( | SpellInfo const * | spellInfo, |
| uint32 | itemId, | ||
| Spell * | spell = nullptr, |
||
| bool | onHold = false |
||
| ) |
References _owner, AddCooldown(), AnnounceToSpectators(), Unit::BuildCooldownPacket(), Unit::GetAttackTime(), GetCooldownDurations(), GetPlayerOwner(), Unit::GetSpellModOwner(), GameTime::GetSystemTime(), Unit::GetTotalAuraModifier(), SpellInfo::HasAttribute(), Player::HasSpell(), SpellInfo::Id, IN_MILLISECONDS, InfinityCooldownDelay, SpellInfo::IsAutoRepeatRangedSpell(), Object::IsPlayer(), RANGED_ATTACK, SendCreatureCooldowns(), SPELL_ATTR0_CU_FORCE_SEND_CATEGORY_COOLDOWNS, SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS, SPELL_AURA_MOD_COOLDOWN, SPELL_COOLDOWN_FLAG_NONE, SpellInfo::SpellFamilyName, SPELLMOD_COOLDOWN, sSpellMgr, and sSpellsByCategoryStore.
Referenced by Aura::_ApplyForTarget(), spell_yogg_saron_protective_gaze_aura::Absorb(), Unit::AddGameObject(), HandleCooldowns(), spell_valkyr_special_2_dummy_cooldown::HandleDummy(), spell_pvp_trinket_wotf_shared_cd::HandleScript(), boss_faction_championsAI::IsCCed(), SendCooldownEvent(), and Unit::SetMinion().
|
private |
References _categoryCooldowns, SpellHistory::CooldownEntry::CategoryId, CategoryKey(), SpellHistory::CooldownEntry::ItemId, and SpellHistory::CooldownEntry::SpellId.
Referenced by AddCooldown(), and RestoreCooldownStateAfterDuel().
| void SpellHistory::Update | ( | ) |
References _categoryCooldowns, _spellCooldowns, EraseCooldown(), and GameTime::GetSystemTime().
Referenced by Unit::Update().
| void SpellHistory::WritePacket | ( | WorldPacket & | packet | ) | const |
References _spellCooldowns, and GameTime::GetSystemTime().
| void SpellHistory::WritePacket | ( | WorldPacket & | packet | ) | const |
References _spellCooldowns, GameTime::GetSystemTime(), ByteBuffer::put(), and ByteBuffer::wpos().
| void SpellHistory::WritePacket | ( | WorldPacket & | packet | ) | const |
Referenced by Player::PetSpellInitialize(), Player::SendInitialSpells(), and Player::VehicleSpellInitialize().
| AC_GAME_API void SpellHistory::WritePacket | ( | WorldPacket & | packet | ) | const |
| AC_GAME_API void SpellHistory::WritePacket | ( | WorldPacket & | packet | ) | const |
|
private |
Referenced by GetBlockingCategoryCooldown(), LinkCategoryCooldown(), ResetAllCooldowns(), UnlinkCategoryCooldown(), and Update().
|
private |
Referenced by AddGlobalCooldown(), CancelGlobalCooldown(), GetRemainingGlobalCooldown(), and HasGlobalCooldown().
|
private |
|
private |
Referenced by IsSchoolLocked(), LockSpellSchool(), and ResetSchoolLockouts().
|
private |
Referenced by AddCooldown(), AnnounceToSpectators(), GetRemainingCooldown(), GetRemainingCooldown(), HasCooldown(), HasCooldown(), HasItemCooldown(), LoadFromDB(), ModifyCooldown(), ResetAllCooldowns(), ResetCooldown(), RestoreCooldownStateAfterDuel(), SaveCooldownStateBeforeDuel(), SaveToDB(), Update(), and WritePacket().
|
private |
Referenced by RestoreCooldownStateAfterDuel(), and SaveCooldownStateBeforeDuel().
|
static |
Referenced by StartCooldown().