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

Public Member Functions

 spell_gen_mount (uint32 mount0, uint32 mount60, uint32 mount100, uint32 mount150, uint32 mount280, uint32 mount310)
 
bool Validate (SpellInfo const *) override
 
void HandleMount (SpellEffIndex effIndex)
 
void Register () override
 
- 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 ()
 

Private Member Functions

 PrepareSpellScript (spell_gen_mount)
 

Private Attributes

uint32 _mount0
 
uint32 _mount60
 
uint32 _mount100
 
uint32 _mount150
 
uint32 _mount280
 
uint32 _mount310
 

Additional Inherited Members

- 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

Constructor & Destructor Documentation

◆ spell_gen_mount()

spell_gen_mount::spell_gen_mount ( uint32  mount0,
uint32  mount60,
uint32  mount100,
uint32  mount150,
uint32  mount280,
uint32  mount310 
)
inline
4017 : SpellScript(),
4018 _mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { }
Definition: SpellScript.h:182
uint32 _mount150
Definition: spell_generic.cpp:4114
uint32 _mount60
Definition: spell_generic.cpp:4112
uint32 _mount100
Definition: spell_generic.cpp:4113
uint32 _mount280
Definition: spell_generic.cpp:4115
uint32 _mount0
Definition: spell_generic.cpp:4111
uint32 _mount310
Definition: spell_generic.cpp:4116

Member Function Documentation

◆ HandleMount()

void spell_gen_mount::HandleMount ( SpellEffIndex  effIndex)
inline
4038 {
4039 PreventHitDefaultEffect(effIndex);
4040
4041 if (Player* target = GetHitPlayer())
4042 {
4043 uint32 petNumber = target->GetTemporaryUnsummonedPetNumber();
4044 target->SetTemporaryUnsummonedPetNumber(0);
4045
4046 // Prevent stacking of mounts and client crashes upon dismounting
4047 target->RemoveAurasByType(SPELL_AURA_MOUNTED, ObjectGuid::Empty, GetHitAura());
4048
4049 // Triggered spell id dependent on riding skill and zone
4050 bool canFly = false;
4051 uint32 map = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId());
4052 if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING)))
4053 canFly = true;
4054
4055 AreaTableEntry const* area = sAreaTableStore.LookupEntry(target->GetAreaId());
4056 // Xinef: add battlefield check
4057 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId());
4058 if ((area && canFly && (area->flags & AREA_FLAG_NO_FLY_ZONE)) || (Bf && !Bf->CanFlyIn()))
4059 canFly = false;
4060
4061 uint32 mount = 0;
4062 switch (target->GetBaseSkillValue(SKILL_RIDING))
4063 {
4064 case 0:
4065 mount = _mount0;
4066 break;
4067 case 75:
4068 mount = _mount60;
4069 break;
4070 case 150:
4071 mount = _mount100;
4072 break;
4073 case 225:
4074 if (canFly)
4075 mount = _mount150;
4076 else
4077 mount = _mount100;
4078 break;
4079 case 300:
4080 if (canFly)
4081 {
4082 if (_mount310 && target->Has310Flyer(false))
4083 mount = _mount310;
4084 else
4085 mount = _mount280;
4086 }
4087 else
4088 mount = _mount100;
4089 break;
4090 default:
4091 break;
4092 }
4093
4094 if (mount)
4095 {
4097 target->CastSpell(target, mount, true);
4098 }
4099
4100 if (petNumber)
4101 target->SetTemporaryUnsummonedPetNumber(petNumber);
4102 }
4103 }
std::uint32_t uint32
Definition: Define.h:108
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
Definition: DBCStores.cpp:699
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
@ SPELL_AURA_MOUNTED
Definition: SpellAuraDefines.h:141
@ SPELL_COLD_WEATHER_FLYING
Definition: spell_generic.cpp:3948
@ AREA_FLAG_NO_FLY_ZONE
Definition: DBCEnums.h:270
@ SKILL_RIDING
Definition: SharedDefines.h:2991
Definition: Battlefield.h:206
bool CanFlyIn()
Return if we can use mount in battlefield.
Definition: Battlefield.h:342
static ObjectGuid const Empty
Definition: ObjectGuid.h:122
Definition: Player.h:1056
Aura * GetHitAura()
Definition: SpellScript.cpp:554
Player * GetHitPlayer()
Definition: SpellScript.cpp:471
void PreventHitDefaultEffect(SpellEffIndex effIndex)
Definition: SpellScript.cpp:590
void PreventHitAura()
Definition: SpellScript.cpp:568
Definition: DBCStructure.h:519
uint32 flags
Definition: DBCStructure.h:524

References _mount0, _mount100, _mount150, _mount280, _mount310, _mount60, AREA_FLAG_NO_FLY_ZONE, Battlefield::CanFlyIn(), ObjectGuid::Empty, AreaTableEntry::flags, SpellScript::GetHitAura(), SpellScript::GetHitPlayer(), GetVirtualMapForMapAndZone(), SpellScript::PreventHitAura(), SpellScript::PreventHitDefaultEffect(), sAreaTableStore, sBattlefieldMgr, SKILL_RIDING, SPELL_AURA_MOUNTED, and SPELL_COLD_WEATHER_FLYING.

Referenced by Register().

◆ PrepareSpellScript()

spell_gen_mount::PrepareSpellScript ( spell_gen_mount  )
private

◆ Register()

void spell_gen_mount::Register ( )
inlineoverridevirtual

Implements _SpellScript.

4106 {
4108 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
@ EFFECT_2
Definition: SharedDefines.h:33
@ SPELL_EFFECT_SCRIPT_EFFECT
Definition: SharedDefines.h:855
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleMount(SpellEffIndex effIndex)
Definition: spell_generic.cpp:4037

References EFFECT_2, HandleMount(), SpellScript::OnEffectHitTarget, SPELL_EFFECT_SCRIPT_EFFECT, and SpellEffectFn.

◆ Validate()

bool spell_gen_mount::Validate ( SpellInfo const *  )
inlineoverridevirtual

Reimplemented from _SpellScript.

4021 {
4022 if (_mount0 && !sSpellMgr->GetSpellInfo(_mount0))
4023 return false;
4024 if (_mount60 && !sSpellMgr->GetSpellInfo(_mount60))
4025 return false;
4026 if (_mount100 && !sSpellMgr->GetSpellInfo(_mount100))
4027 return false;
4028 if (_mount150 && !sSpellMgr->GetSpellInfo(_mount150))
4029 return false;
4030 if (_mount280 && !sSpellMgr->GetSpellInfo(_mount280))
4031 return false;
4032 if (_mount310 && !sSpellMgr->GetSpellInfo(_mount310))
4033 return false;
4034 return true;
4035 }
#define sSpellMgr
Definition: SpellMgr.h:825

References _mount0, _mount100, _mount150, _mount280, _mount310, _mount60, and sSpellMgr.

Member Data Documentation

◆ _mount0

uint32 spell_gen_mount::_mount0
private

Referenced by HandleMount(), and Validate().

◆ _mount100

uint32 spell_gen_mount::_mount100
private

Referenced by HandleMount(), and Validate().

◆ _mount150

uint32 spell_gen_mount::_mount150
private

Referenced by HandleMount(), and Validate().

◆ _mount280

uint32 spell_gen_mount::_mount280
private

Referenced by HandleMount(), and Validate().

◆ _mount310

uint32 spell_gen_mount::_mount310
private

Referenced by HandleMount(), and Validate().

◆ _mount60

uint32 spell_gen_mount::_mount60
private

Referenced by HandleMount(), and Validate().