AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
spell_pvp_trinket_wotf_shared_cd Class Reference
Inheritance diagram for spell_pvp_trinket_wotf_shared_cd:
SpellScript _SpellScript

Private Member Functions

 PrepareSpellScript (spell_pvp_trinket_wotf_shared_cd)
 
bool Load () override
 
bool Validate (SpellInfo const *) override
 
void HandleScript ()
 
void Register () override
 

Additional Inherited Members

- Public Member Functions inherited from SpellScript
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Spell *spell)
 
void _InitHit ()
 
bool _IsEffectPrevented (SpellEffIndex effIndex)
 
bool _IsDefaultEffectPrevented (SpellEffIndex effIndex)
 
void _PrepareScriptCall (SpellScriptHookType hookType)
 
void _FinishScriptCall ()
 
bool IsInCheckCastHook () const
 
bool IsInTargetHook () const
 
bool IsInHitPhase () const
 
bool IsInEffectHook () const
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObjectGetExplTargetWorldObject ()
 
UnitGetExplTargetUnit ()
 
GameObjectGetExplTargetGObj ()
 
ItemGetExplTargetItem ()
 
UnitGetHitUnit ()
 
CreatureGetHitCreature ()
 
PlayerGetHitPlayer ()
 
ItemGetHitItem ()
 
GameObjectGetHitGObj ()
 
WorldLocationGetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
SpellGetSpell ()
 
AuraGetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo const * GetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
void Cancel ()
 
void SetCustomCastResultMessage (SpellCustomErrors result)
 
- Public Member Functions inherited from _SpellScript
 _SpellScript ()
 
virtual ~_SpellScript ()
 
virtual void _Register ()
 
virtual void _Unload ()
 
virtual void _Init (std::string const *scriptname, uint32 spellId)
 
std::string const * _GetScriptName () const
 
virtual void Register ()=0
 
virtual bool Validate (SpellInfo const *)
 
virtual bool Load ()
 
virtual void Unload ()
 
- Static Public Member Functions inherited from _SpellScript
static bool ValidateSpellInfo (std::initializer_list< uint32 > spellIds)
 
template<class T >
static bool ValidateSpellInfo (T const &spellIds)
 
- Public Attributes inherited from SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
virtual bool _Validate (SpellInfo const *entry)
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ HandleScript()

void spell_pvp_trinket_wotf_shared_cd::HandleScript ( )
inlineprivate
1964 {
1965 Player* player = GetCaster()->ToPlayer();
1966 // This is only needed because spells cast from spell_linked_spell are triggered by default
1967 // Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
1968 player->AddSpellAndCategoryCooldowns(GetSpellInfo(), GetCastItem() ? GetCastItem()->GetEntry() : 0, GetSpell());
1969
1970 if (player->GetTeamId(true) == TEAM_HORDE)
1971 {
1973 {
1974 WorldPacket data;
1975 player->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_INCLUDE_GCD, 7744, GetSpellInfo()->CategoryRecoveryTime); // Will of the forsaken
1976 player->GetSession()->SendPacket(&data);
1977 }
1978 else
1979 {
1980 WorldPacket data(SMSG_INITIAL_SPELLS, (1 + 2 + 2 + 4 + 2 + 2 + 4 + 4));
1981 data << uint8(0);
1982 data << uint16(0);
1983 data << uint16(1);
1984 data << uint32(42292); // PvP Trinket spell
1985 data << uint16(0); // cast item id
1986 data << uint16(GetSpellInfo()->GetCategory()); // spell category
1987 data << uint32(0);
1988 data << uint32(GetSpellInfo()->CategoryRecoveryTime);
1989 player->GetSession()->SendPacket(&data);
1990
1991 WorldPacket data2;
1992 player->BuildCooldownPacket(data2, SPELL_COOLDOWN_FLAG_INCLUDE_GCD, SPELL_PVP_TRINKET, GetSpellInfo()->CategoryRecoveryTime); // PvP Trinket spell
1993 player->GetSession()->SendPacket(&data2);
1994 }
1995 }
1996 }
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
std::uint16_t uint16
Definition: Define.h:109
@ SPELL_COOLDOWN_FLAG_INCLUDE_GCD
Starts GCD in addition to normal cooldown specified in the packet.
Definition: Unit.h:1243
@ SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER
Definition: spell_generic.cpp:1939
@ SPELL_PVP_TRINKET
Definition: spell_generic.cpp:1941
@ TEAM_HORDE
Definition: SharedDefines.h:761
@ SMSG_INITIAL_SPELLS
Definition: Opcodes.h:328
Player * ToPlayer()
Definition: Object.h:195
Definition: Player.h:1056
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2072
WorldSession * GetSession() const
Definition: Player.h:1961
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition: Player.cpp:10826
void BuildCooldownPacket(WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
Definition: Unit.cpp:21266
Definition: WorldPacket.h:27
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:212
SpellInfo const * GetSpellInfo()
Definition: SpellScript.cpp:411
Item * GetCastItem()
Definition: SpellScript.cpp:620
Spell * GetSpell()
Definition: SpellScript.h:442
Unit * GetCaster()
Definition: SpellScript.cpp:401

References Player::AddSpellAndCategoryCooldowns(), Unit::BuildCooldownPacket(), SpellScript::GetCaster(), SpellScript::GetCastItem(), Player::GetSession(), SpellScript::GetSpell(), SpellScript::GetSpellInfo(), Player::GetTeamId(), WorldSession::SendPacket(), SMSG_INITIAL_SPELLS, SPELL_COOLDOWN_FLAG_INCLUDE_GCD, SPELL_PVP_TRINKET, SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER, TEAM_HORDE, and Object::ToPlayer().

Referenced by Register().

◆ Load()

bool spell_pvp_trinket_wotf_shared_cd::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

1951 {
1952 return GetCaster()->GetTypeId() == TYPEID_PLAYER;
1953 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
TypeID GetTypeId() const
Definition: Object.h:121

References SpellScript::GetCaster(), Object::GetTypeId(), and TYPEID_PLAYER.

◆ PrepareSpellScript()

spell_pvp_trinket_wotf_shared_cd::PrepareSpellScript ( spell_pvp_trinket_wotf_shared_cd  )
private

◆ Register()

void spell_pvp_trinket_wotf_shared_cd::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1999 {
2001 }
#define SpellCastFn(F)
Definition: SpellScript.h:324
HookList< CastHandler > AfterCast
Definition: SpellScript.h:323
void HandleScript()
Definition: spell_generic.cpp:1963

References SpellScript::AfterCast, HandleScript(), and SpellCastFn.

◆ Validate()

bool spell_pvp_trinket_wotf_shared_cd::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

1956 {
1957 return ValidateSpellInfo({
1961 }
@ SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF
Definition: spell_generic.cpp:1940
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:125

References SPELL_PVP_TRINKET, SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER, SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF, and _SpellScript::ValidateSpellInfo().