![]() |
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 |
void | WritePacket (WorldPackets::Spells::SendSpellHistory *sendSpellHistory) const |
void | WritePacket (WorldPackets::Spells::SendSpellCharges *sendSpellCharges) const |
void | WritePacket (WorldPackets::Pet::PetSpells *petSpells) 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<Trinity::invocable_r< bool, CooldownEntry const & > Predicate> | |
void | ModifyCoooldowns (Predicate &&predicate, Duration cooldownMod, bool withoutCategoryCooldown=false) |
template<Trinity::invocable_r< bool, CooldownEntry const & > Predicate> | |
void | UpdateCooldownRecoveryRate (Predicate &&predicate, float modChange, bool apply) |
void | ResetCooldown (uint32 spellId, bool update=false) |
template<Trinity::invocable_r< bool, CooldownEntry const & > 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 | UpdateChargeRecoveryRate (uint32 chargeCategoryId, float modChange, bool apply) |
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 () |
Static Public Member Functions | |
static void | GetCooldownDurations (SpellInfo const *spellInfo, uint32 itemId, Duration *cooldown, uint32 *categoryId, Duration *categoryCooldown) |
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 | UpdateCooldownRecoveryRate (CooldownStorageType::iterator &itr, float modChange, bool apply) |
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) const |
Definition at line 58 of file SpellHistory.h.
using SpellHistory::CategoryCooldownStorageType = std::unordered_map<uint32 , CooldownEntry*> |
Definition at line 87 of file SpellHistory.h.
using SpellHistory::ChargeEntryCollection = std::deque<ChargeEntry> |
Definition at line 85 of file SpellHistory.h.
using SpellHistory::ChargeStorageType = std::unordered_map<uint32 , ChargeEntryCollection> |
Definition at line 88 of file SpellHistory.h.
using SpellHistory::Clock = std::chrono::system_clock |
Definition at line 61 of file SpellHistory.h.
using SpellHistory::CooldownStorageType = std::unordered_map<uint32 , CooldownEntry> |
Definition at line 86 of file SpellHistory.h.
using SpellHistory::Duration = Milliseconds |
Definition at line 62 of file SpellHistory.h.
using SpellHistory::GlobalCooldownStorageType = std::unordered_map<uint32 , TimePoint> |
Definition at line 89 of file SpellHistory.h.
using SpellHistory::TimePoint = std::chrono::time_point<Clock, Duration> |
Definition at line 63 of file SpellHistory.h.
|
explicit |
Definition at line 141 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 576 of file SpellHistory.cpp.
void SpellHistory::CancelGlobalCooldown | ( | SpellInfo const * | spellInfo | ) |
bool SpellHistory::ConsumeCharge | ( | uint32 | chargeCategoryId | ) |
Definition at line 854 of file SpellHistory.cpp.
|
inlineprivate |
Definition at line 1005 of file SpellHistory.cpp.
|
static |
Definition at line 1128 of file SpellHistory.cpp.
Definition at line 994 of file SpellHistory.cpp.
|
private |
Definition at line 1098 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 740 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 245 of file SpellHistory.cpp.
bool SpellHistory::HasCharge | ( | uint32 | chargeCategoryId | ) | const |
Definition at line 980 of file SpellHistory.cpp.
Definition at line 716 of file SpellHistory.cpp.
bool SpellHistory::HasGlobalCooldown | ( | SpellInfo const * | spellInfo | ) | const |
|
inline |
Definition at line 201 of file SpellHistory.h.
Definition at line 280 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 784 of file SpellHistory.cpp.
Definition at line 879 of file SpellHistory.cpp.
void SpellHistory::ModifyCooldown | ( | uint32 | spellId, |
Duration | cooldownMod, | ||
bool | withoutCategoryCooldown = false |
||
) |
Definition at line 657 of file SpellHistory.cpp.
|
inline |
|
private |
|
private |
Definition at line 594 of file SpellHistory.cpp.
|
delete |
|
delete |
void SpellHistory::PauseCooldowns | ( | ) |
Definition at line 1074 of file SpellHistory.cpp.
void SpellHistory::ResetAllCharges | ( | ) |
Definition at line 968 of file SpellHistory.cpp.
void SpellHistory::ResetAllCooldowns | ( | ) |
Definition at line 700 of file SpellHistory.cpp.
void SpellHistory::ResetCharges | ( | uint32 | chargeCategoryId | ) |
Definition at line 951 of file SpellHistory.cpp.
|
private |
void SpellHistory::ResetCooldown | ( | uint32 | spellId, |
bool | update = false |
||
) |
Definition at line 674 of file SpellHistory.cpp.
|
inline |
void SpellHistory::RestoreCharge | ( | uint32 | chargeCategoryId | ) |
Definition at line 940 of file SpellHistory.cpp.
void SpellHistory::RestoreCooldownStateAfterDuel | ( | ) |
Definition at line 1174 of file SpellHistory.cpp.
void SpellHistory::ResumeCooldowns | ( | ) |
void SpellHistory::SaveCooldownStateBeforeDuel | ( | ) |
template void SpellHistory::SaveToDB< Pet > | ( | CharacterDatabaseTransaction | trans | ) |
|
private |
Definition at line 1103 of file SpellHistory.cpp.
void SpellHistory::SendCooldownEvent | ( | SpellInfo const * | spellInfo, |
uint32 | itemId = 0 , |
||
Spell * | spell = nullptr , |
||
bool | startCooldown = true |
||
) |
Definition at line 551 of file SpellHistory.cpp.
|
private |
Definition at line 1114 of file SpellHistory.cpp.
void SpellHistory::StartCooldown | ( | SpellInfo const * | spellInfo, |
uint32 | itemId, | ||
Spell * | spell = nullptr , |
||
bool | onHold = false , |
||
Optional< Duration > | forcedCooldown = {} |
||
) |
Definition at line 398 of file SpellHistory.cpp.
void SpellHistory::Update | ( | ) |
Definition at line 221 of file SpellHistory.cpp.
void SpellHistory::UpdateChargeRecoveryRate | ( | uint32 | chargeCategoryId, |
float | modChange, | ||
bool | apply | ||
) |
Definition at line 903 of file SpellHistory.cpp.
|
private |
|
inline |
Definition at line 143 of file SpellHistory.h.
void SpellHistory::WritePacket | ( | WorldPackets::Pet::PetSpells * | petSpells | ) | const |
Definition at line 351 of file SpellHistory.cpp.
void SpellHistory::WritePacket | ( | WorldPackets::Spells::SendSpellCharges * | sendSpellCharges | ) | const |
Definition at line 329 of file SpellHistory.cpp.
void SpellHistory::WritePacket | ( | WorldPackets::Spells::SendSpellHistory * | sendSpellHistory | ) | const |
|
private |
Definition at line 230 of file SpellHistory.h.
|
private |
Definition at line 228 of file SpellHistory.h.
|
private |
Definition at line 231 of file SpellHistory.h.
|
private |
Definition at line 225 of file SpellHistory.h.
Definition at line 232 of file SpellHistory.h.
|
private |
Definition at line 229 of file SpellHistory.h.
|
private |
Definition at line 226 of file SpellHistory.h.
|
private |
Definition at line 227 of file SpellHistory.h.
|
static |
Definition at line 116 of file SpellHistory.h.