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

Private Member Functions

 PrepareSpellScript (spell_vehicle_throw_passenger)
 
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 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
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ HandleScript()

void spell_vehicle_throw_passenger::HandleScript ( )
inlineprivate
1658 {
1659 Spell* baseSpell = GetSpell();
1660 SpellCastTargets targets = baseSpell->m_targets;
1661 if (Vehicle* vehicle = GetCaster()->GetVehicleKit())
1662 if (Unit* passenger = vehicle->GetPassenger(3))
1663 {
1664 // use 99 because it is 3d search
1665 std::list<WorldObject*> targetList;
1668 Cell::VisitAllObjects(GetCaster(), searcher, 99.0f);
1669 float minDist = 99 * 99;
1670 Unit* target = nullptr;
1671 for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
1672 {
1673 if (Unit* unit = (*itr)->ToUnit())
1674 if (unit->GetEntry() == NPC_SEAT)
1675 if (Vehicle* seat = unit->GetVehicleKit())
1676 if (!seat->GetPassenger(0))
1677 if (Unit* device = seat->GetPassenger(2))
1678 if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
1679 {
1680 float dist = unit->GetExactDistSq(targets.GetDstPos());
1681 if (dist < minDist)
1682 {
1683 minDist = dist;
1684 target = unit;
1685 }
1686 }
1687 }
1688 if (target && target->IsWithinDist2d(targets.GetDstPos(), GetSpellInfo()->Effects[EFFECT_0].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct
1689 {
1690 passenger->ExitVehicle();
1691 passenger->EnterVehicle(target, 0);
1692 }
1693 else
1694 {
1695 passenger->ExitVehicle();
1696 float x, y, z;
1697 targets.GetDstPos()->GetPosition(x, y, z);
1698 passenger->GetMotionMaster()->MoveJump(x, y, z, targets.GetSpeedXY(), targets.GetSpeedZ());
1699 }
1700 }
1701 }
@ EFFECT_0
Definition SharedDefines.h:31
@ TARGET_CHECK_DEFAULT
Definition SpellInfo.h:114
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:540
@ NPC_SEAT
Definition boss_flame_leviathan.cpp:92
Unit * ToUnit()
Definition Object.h:210
Definition Spell.h:111
float GetSpeedZ() const
Definition Spell.h:177
float GetSpeedXY() const
Definition Spell.h:176
WorldLocation const * GetDstPos() const
Definition Spell.cpp:401
WorldLocation const * GetExplTargetDest()
Definition SpellScript.cpp:416
SpellInfo const * GetSpellInfo()
Definition SpellScript.cpp:411
Spell * GetSpell()
Definition SpellScript.h:442
Unit * GetCaster()
Definition SpellScript.cpp:401
Definition Spell.h:287
SpellCastTargets m_targets
Definition Spell.h:530
Definition Unit.h:620
void ExitVehicle(Position const *exitPosition=nullptr)
Definition Unit.cpp:19515
Definition Vehicle.h:28
bool IsWithinDist2d(float x, float y, float dist) const
Definition Object.cpp:1316
Definition GridNotifiers.h:239
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:185
void GetPosition(float &x, float &y) const
Definition Position.h:126
float GetExactDistSq(float x, float y, float z) const
Definition Position.h:174

References CURRENT_CHANNELED_SPELL, EFFECT_0, Unit::ExitVehicle(), SpellCastTargets::GetDstPos(), Position::GetExactDistSq(), Position::GetPosition(), SpellCastTargets::GetSpeedXY(), SpellCastTargets::GetSpeedZ(), WorldObject::IsWithinDist2d(), Spell::m_targets, NPC_SEAT, TARGET_CHECK_DEFAULT, Object::ToUnit(), and Cell::VisitAllObjects().

Referenced by Register().

◆ PrepareSpellScript()

spell_vehicle_throw_passenger::PrepareSpellScript ( spell_vehicle_throw_passenger  )
private

◆ Register()

void spell_vehicle_throw_passenger::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1704 {
1706 }
#define SpellCastFn(F)
Definition SpellScript.h:324
HookList< CastHandler > AfterCast
Definition SpellScript.h:323
void HandleScript()
Definition boss_flame_leviathan.cpp:1657

References HandleScript(), and SpellCastFn.


The documentation for this class was generated from the following file: