feat(Core/Player): implement Spell Queue (#20797)

This commit is contained in:
Jelle Meeus
2024-12-12 11:59:52 +01:00
committed by GitHub
parent f31bf723a0
commit 993bdcb84e
10 changed files with 227 additions and 1 deletions

View File

@@ -1060,6 +1060,18 @@ struct EntryPointData
[[nodiscard]] bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; }
};
struct PendingSpellCastRequest
{
uint32 spellId;
uint32 category;
WorldPacket requestPacket;
bool isItem = false;
bool cancelInProgress = false;
PendingSpellCastRequest(uint32 spellId, uint32 category, WorldPacket&& packet, bool item = false, bool cancel = false)
: spellId(spellId), category(category), requestPacket(std::move(packet)), isItem(item) , cancelInProgress(cancel) {}
};
class Player : public Unit, public GridObject<Player>
{
friend class WorldSession;
@@ -2615,7 +2627,21 @@ public:
std::string GetDebugInfo() const override;
protected:
/*********************************************************/
/*** SPELL QUEUE SYSTEM ***/
/*********************************************************/
protected:
uint32 GetSpellQueueWindow() const;
void ProcessSpellQueue();
public:
std::deque<PendingSpellCastRequest> SpellQueue;
const PendingSpellCastRequest* GetCastRequest(uint32 category) const;
bool CanExecutePendingSpellCastRequest(SpellInfo const* spellInfo);
void ExecuteOrCancelSpellCastRequest(PendingSpellCastRequest* castRequest, bool isCancel = false);
bool CanRequestSpellCast(SpellInfo const* spellInfo);
protected:
// Gamemaster whisper whitelist
WhisperListContainer WhisperList;