TrinityCore
|
#include <SpellHistory.h>
Classes | |
struct | ChargeEntry |
struct | CooldownEntry |
struct | PersistenceHelper |
struct | PersistenceHelper< Pet > |
struct | PersistenceHelper< Player > |
Public Types | |
using | Clock = std::chrono::system_clock |
using | Duration = Milliseconds |
using | TimePoint = std::chrono::time_point< Clock, Duration > |
using | ChargeEntryCollection = std::deque< ChargeEntry > |
using | CooldownStorageType = std::unordered_map< uint32, CooldownEntry > |
using | CategoryCooldownStorageType = std::unordered_map< uint32, CooldownEntry * > |
using | ChargeStorageType = std::unordered_map< uint32, ChargeEntryCollection > |
using | GlobalCooldownStorageType = std::unordered_map< uint32, TimePoint > |
Public Member Functions | |
SpellHistory (Unit *owner) | |
~SpellHistory () | |
SpellHistory (SpellHistory const &)=delete | |
SpellHistory (SpellHistory &&)=delete | |
SpellHistory & | operator= (SpellHistory const &)=delete |
SpellHistory & | operator= (SpellHistory &&)=delete |
template<class OwnerType > | |
void | LoadFromDB (PreparedQueryResult cooldownsResult, PreparedQueryResult chargesResult) |
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) const |
template<class PacketType > | |
void | WritePacket (PacketType *packet) const |
void | StartCooldown (SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool onHold=false, Optional< Duration > forcedCooldown={}) |
void | SendCooldownEvent (SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool startCooldown=true) |
void | AddCooldown (uint32 spellId, uint32 itemId, Duration cooldownDuration) |
void | AddCooldown (uint32 spellId, uint32 itemId, TimePoint cooldownEnd, uint32 categoryId, TimePoint categoryEnd, bool onHold=false) |
void | ModifyCooldown (uint32 spellId, Duration cooldownMod, bool withoutCategoryCooldown=false) |
void | ModifyCooldown (SpellInfo const *spellInfo, Duration cooldownMod, bool withoutCategoryCooldown=false) |
template<typename Predicate > | |
void | ModifyCoooldowns (Predicate &&predicate, Duration cooldownMod, bool withoutCategoryCooldown=false) |
void | ResetCooldown (uint32 spellId, bool update=false) |
template<typename Predicate > | |
void | ResetCooldowns (Predicate predicate, bool update=false) |
void | ResetAllCooldowns () |
bool | HasCooldown (SpellInfo const *spellInfo, uint32 itemId=0) const |
bool | HasCooldown (uint32 spellId, uint32 itemId=0) const |
Duration | GetRemainingCooldown (SpellInfo const *spellInfo) const |
Duration | GetRemainingCategoryCooldown (uint32 categoryId) const |
Duration | GetRemainingCategoryCooldown (SpellInfo const *spellInfo) const |
void | LockSpellSchool (SpellSchoolMask schoolMask, Duration lockoutTime) |
bool | IsSchoolLocked (SpellSchoolMask schoolMask) const |
bool | ConsumeCharge (uint32 chargeCategoryId) |
void | ModifyChargeRecoveryTime (uint32 chargeCategoryId, Duration cooldownMod) |
void | RestoreCharge (uint32 chargeCategoryId) |
void | ResetCharges (uint32 chargeCategoryId) |
void | ResetAllCharges () |
bool | HasCharge (uint32 chargeCategoryId) const |
int32 | GetMaxCharges (uint32 chargeCategoryId) const |
int32 | GetChargeRecoveryTime (uint32 chargeCategoryId) const |
bool | HasGlobalCooldown (SpellInfo const *spellInfo) const |
void | AddGlobalCooldown (SpellInfo const *spellInfo, Duration duration) |
void | CancelGlobalCooldown (SpellInfo const *spellInfo) |
Duration | GetRemainingGlobalCooldown (SpellInfo const *spellInfo) const |
bool | IsPaused () const |
void | PauseCooldowns () |
void | ResumeCooldowns () |
void | SaveCooldownStateBeforeDuel () |
void | RestoreCooldownStateAfterDuel () |
template<> | |
void | WritePacket (WorldPackets::Spells::SendSpellHistory *sendSpellHistory) const |
template<> | |
void | WritePacket (WorldPackets::Spells::SendSpellCharges *sendSpellCharges) const |
template<> | |
void | WritePacket (WorldPackets::Pet::PetSpells *petSpells) const |
Static Public Attributes | |
static Duration const | InfinityCooldownDelay = Seconds(MONTH) |
Private Member Functions | |
Player * | GetPlayerOwner () const |
void | ModifySpellCooldown (uint32 spellId, Duration cooldownMod, bool withoutCategoryCooldown) |
void | ModifySpellCooldown (CooldownStorageType::iterator &itr, Duration cooldownMod, bool withoutCategoryCooldown) |
void | ResetCooldown (CooldownStorageType::iterator &itr, bool update=false) |
void | SendClearCooldowns (std::vector< int32 > const &cooldowns) const |
CooldownStorageType::iterator | EraseCooldown (CooldownStorageType::iterator itr) |
void | SendSetSpellCharges (uint32 chargeCategoryId, ChargeEntryCollection const &chargeCollection) |
Static Private Member Functions | |
static void | GetCooldownDurations (SpellInfo const *spellInfo, uint32 itemId, Duration *cooldown, uint32 *categoryId, Duration *categoryCooldown) |
Definition at line 46 of file SpellHistory.h.
using SpellHistory::CategoryCooldownStorageType = std::unordered_map<uint32 , CooldownEntry*> |
Definition at line 75 of file SpellHistory.h.
using SpellHistory::ChargeEntryCollection = std::deque<ChargeEntry> |
Definition at line 73 of file SpellHistory.h.
using SpellHistory::ChargeStorageType = std::unordered_map<uint32 , ChargeEntryCollection> |
Definition at line 76 of file SpellHistory.h.
using SpellHistory::Clock = std::chrono::system_clock |
Definition at line 49 of file SpellHistory.h.
using SpellHistory::CooldownStorageType = std::unordered_map<uint32 , CooldownEntry> |
Definition at line 74 of file SpellHistory.h.
using SpellHistory::Duration = Milliseconds |
Definition at line 50 of file SpellHistory.h.
using SpellHistory::GlobalCooldownStorageType = std::unordered_map<uint32 , TimePoint> |
Definition at line 77 of file SpellHistory.h.
using SpellHistory::TimePoint = std::chrono::time_point<Clock, Duration> |
Definition at line 51 of file SpellHistory.h.
|
explicit |
Definition at line 140 of file SpellHistory.cpp.
|
default |
|
delete |
|
delete |
void SpellHistory::AddCooldown | ( | uint32 | spellId, |
uint32 | itemId, | ||
TimePoint | cooldownEnd, | ||
uint32 | categoryId, | ||
TimePoint | categoryEnd, | ||
bool | onHold = false |
||
) |
Definition at line 551 of file SpellHistory.cpp.
void SpellHistory::CancelGlobalCooldown | ( | SpellInfo const * | spellInfo | ) |
bool SpellHistory::ConsumeCharge | ( | uint32 | chargeCategoryId | ) |
Definition at line 803 of file SpellHistory.cpp.
|
inlineprivate |
Definition at line 914 of file SpellHistory.cpp.
|
staticprivate |
Definition at line 1021 of file SpellHistory.cpp.
Definition at line 903 of file SpellHistory.cpp.
|
private |
Definition at line 991 of file SpellHistory.cpp.
SpellHistory::Duration SpellHistory::GetRemainingCategoryCooldown | ( | SpellInfo const * | spellInfo | ) | const |
SpellHistory::Duration SpellHistory::GetRemainingCategoryCooldown | ( | uint32 | categoryId | ) | const |
SpellHistory::Duration SpellHistory::GetRemainingCooldown | ( | SpellInfo const * | spellInfo | ) | const |
Definition at line 691 of file SpellHistory.cpp.
SpellHistory::Duration SpellHistory::GetRemainingGlobalCooldown | ( | SpellInfo const * | spellInfo | ) | const |
void SpellHistory::HandleCooldowns | ( | SpellInfo const * | spellInfo, |
Item const * | item, | ||
Spell * | spell = nullptr |
||
) |
Definition at line 244 of file SpellHistory.cpp.
bool SpellHistory::HasCharge | ( | uint32 | chargeCategoryId | ) | const |
Definition at line 889 of file SpellHistory.cpp.
Definition at line 667 of file SpellHistory.cpp.
bool SpellHistory::HasGlobalCooldown | ( | SpellInfo const * | spellInfo | ) | const |
|
inline |
Definition at line 177 of file SpellHistory.h.
Definition at line 276 of file SpellHistory.cpp.
bool SpellHistory::IsSchoolLocked | ( | SpellSchoolMask | schoolMask | ) | const |
template void SpellHistory::LoadFromDB< Pet > | ( | PreparedQueryResult | cooldownsResult, |
PreparedQueryResult | chargesResult | ||
) |
void SpellHistory::LockSpellSchool | ( | SpellSchoolMask | schoolMask, |
Duration | lockoutTime | ||
) |
Definition at line 736 of file SpellHistory.cpp.
Definition at line 825 of file SpellHistory.cpp.
void SpellHistory::ModifyCooldown | ( | uint32 | spellId, |
Duration | cooldownMod, | ||
bool | withoutCategoryCooldown = false |
||
) |
Definition at line 608 of file SpellHistory.cpp.
|
inline |
|
private |
|
private |
Definition at line 569 of file SpellHistory.cpp.
|
delete |
|
delete |
void SpellHistory::PauseCooldowns | ( | ) |
Definition at line 967 of file SpellHistory.cpp.
void SpellHistory::ResetAllCharges | ( | ) |
Definition at line 877 of file SpellHistory.cpp.
void SpellHistory::ResetAllCooldowns | ( | ) |
Definition at line 651 of file SpellHistory.cpp.
void SpellHistory::ResetCharges | ( | uint32 | chargeCategoryId | ) |
Definition at line 860 of file SpellHistory.cpp.
|
private |
void SpellHistory::ResetCooldown | ( | uint32 | spellId, |
bool | update = false |
||
) |
Definition at line 625 of file SpellHistory.cpp.
|
inline |
void SpellHistory::RestoreCharge | ( | uint32 | chargeCategoryId | ) |
Definition at line 849 of file SpellHistory.cpp.
void SpellHistory::RestoreCooldownStateAfterDuel | ( | ) |
Definition at line 1067 of file SpellHistory.cpp.
void SpellHistory::ResumeCooldowns | ( | ) |
void SpellHistory::SaveCooldownStateBeforeDuel | ( | ) |
template void SpellHistory::SaveToDB< Pet > | ( | CharacterDatabaseTransaction | trans | ) |
|
private |
Definition at line 996 of file SpellHistory.cpp.
void SpellHistory::SendCooldownEvent | ( | SpellInfo const * | spellInfo, |
uint32 | itemId = 0 , |
||
Spell * | spell = nullptr , |
||
bool | startCooldown = true |
||
) |
Definition at line 526 of file SpellHistory.cpp.
|
private |
Definition at line 1007 of file SpellHistory.cpp.
void SpellHistory::StartCooldown | ( | SpellInfo const * | spellInfo, |
uint32 | itemId, | ||
Spell * | spell = nullptr , |
||
bool | onHold = false , |
||
Optional< Duration > | forcedCooldown = {} |
||
) |
Definition at line 403 of file SpellHistory.cpp.
void SpellHistory::Update | ( | ) |
Definition at line 220 of file SpellHistory.cpp.
void SpellHistory::WritePacket | ( | PacketType * | packet | ) | const |
void SpellHistory::WritePacket | ( | WorldPackets::Pet::PetSpells * | petSpells | ) | const |
Definition at line 356 of file SpellHistory.cpp.
void SpellHistory::WritePacket | ( | WorldPackets::Spells::SendSpellCharges * | sendSpellCharges | ) | const |
Definition at line 333 of file SpellHistory.cpp.
void SpellHistory::WritePacket | ( | WorldPackets::Spells::SendSpellHistory * | sendSpellHistory | ) | const |
Definition at line 298 of file SpellHistory.cpp.
|
private |
Definition at line 205 of file SpellHistory.h.
|
private |
Definition at line 203 of file SpellHistory.h.
|
private |
Definition at line 206 of file SpellHistory.h.
|
private |
Definition at line 200 of file SpellHistory.h.
Definition at line 207 of file SpellHistory.h.
|
private |
Definition at line 204 of file SpellHistory.h.
|
private |
Definition at line 201 of file SpellHistory.h.
|
private |
Definition at line 202 of file SpellHistory.h.
|
static |
Definition at line 103 of file SpellHistory.h.