AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI Struct Reference
Inheritance diagram for go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI:
GameObjectAI

Public Member Functions

 go_wg_vehicle_teleporterAI (GameObject *gameObject)
 
bool IsFriendly (Unit *passenger)
 
CreatureIsValidVehicle (Creature *cVeh)
 
void UpdateAI (uint32 diff) override
 
- Public Member Functions inherited from GameObjectAI
 GameObjectAI (GameObject *go)
 
virtual ~GameObjectAI ()
 
virtual void UpdateAI (uint32)
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void DoAction (int32)
 
virtual void SetGUID (ObjectGuid, int32)
 
virtual ObjectGuid GetGUID (int32) const
 
virtual bool GossipHello (Player *, bool)
 
virtual bool GossipSelect (Player *, uint32, uint32)
 
virtual bool GossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual bool QuestAccept (Player *, Quest const *)
 
virtual bool QuestReward (Player *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *)
 
virtual void Destroyed (Player *, uint32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void OnGameEvent (bool, uint16)
 
virtual void OnStateChanged (uint32, Unit *)
 
virtual void EventInform (uint32)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual void JustSummoned (Creature *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureEvade (Creature *)
 

Private Attributes

uint32 _checkTimer
 

Additional Inherited Members

- Static Public Member Functions inherited from GameObjectAI
static int32 Permissible (GameObject const *go)
 
- Protected Attributes inherited from GameObjectAI
GameObject *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ go_wg_vehicle_teleporterAI()

go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::go_wg_vehicle_teleporterAI ( GameObject gameObject)
inline
855 : GameObjectAI(gameObject),
856 _checkTimer(0)
857 {
858 }
Definition: GameObjectAI.h:34
uint32 _checkTimer
Definition: zone_wintergrasp.cpp:892

Member Function Documentation

◆ IsFriendly()

bool go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsFriendly ( Unit passenger)
inline
861 {
864 }
const uint32 WintergraspFaction[3]
Definition: BattlefieldWG.h:43
@ GAMEOBJECT_FACTION
Definition: UpdateFields.h:402
#define RACEMASK_HORDE
Definition: SharedDefines.h:107
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
#define RACEMASK_ALLIANCE
Definition: SharedDefines.h:103
GameObject *const me
Definition: GameObjectAI.h:36
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
uint32 getRaceMask() const
Definition: Unit.h:742

References GAMEOBJECT_FACTION, Unit::getRaceMask(), Object::GetUInt32Value(), GameObjectAI::me, RACEMASK_ALLIANCE, RACEMASK_HORDE, TEAM_ALLIANCE, TEAM_HORDE, and WintergraspFaction.

Referenced by IsValidVehicle().

◆ IsValidVehicle()

Creature * go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle ( Creature cVeh)
inline
867 {
869 if (Vehicle* vehicle = cVeh->GetVehicleKit())
870 if (Unit* passenger = vehicle->GetPassenger(0))
871 if (IsFriendly(passenger))
872 if (Creature* teleportTrigger = passenger->SummonTrigger(me->GetPositionX() - 60.0f, me->GetPositionY(), me->GetPositionZ() + 1.0f, cVeh->GetOrientation(), 1000))
873 return teleportTrigger;
874
875 return nullptr;
876 }
@ SPELL_VEHICLE_TELEPORT
Definition: zone_wintergrasp.cpp:61
Definition: Creature.h:46
Creature * SummonTrigger(float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
Definition: Object.cpp:2404
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
Definition: Unit.h:630
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5669
Vehicle * GetVehicleKit() const
Definition: Unit.h:1672
Definition: Vehicle.h:28
bool IsFriendly(Unit *passenger)
Definition: zone_wintergrasp.cpp:860

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::GetVehicleKit(), Unit::HasAura(), IsFriendly(), GameObjectAI::me, SPELL_VEHICLE_TELEPORT, and WorldObject::SummonTrigger().

Referenced by UpdateAI().

◆ UpdateAI()

void go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from GameObjectAI.

879 {
880 _checkTimer += diff;
881 if (_checkTimer >= 1000)
882 {
883 for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++)
884 if (Creature* vehicleCreature = me->FindNearestCreature(vehiclesList[i], 3.0f, true))
885 if (Creature* teleportTrigger = IsValidVehicle(vehicleCreature))
886 teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true);
887
888 _checkTimer = 0;
889 }
890 }
std::uint8_t uint8
Definition: Define.h:109
uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES]
Definition: zone_wintergrasp.cpp:118
uint8 const MAX_WINTERGRASP_VEHICLES
Definition: zone_wintergrasp.cpp:116
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2446
Creature * IsValidVehicle(Creature *cVeh)
Definition: zone_wintergrasp.cpp:866

References _checkTimer, WorldObject::FindNearestCreature(), IsValidVehicle(), MAX_WINTERGRASP_VEHICLES, GameObjectAI::me, SPELL_VEHICLE_TELEPORT, and vehiclesList.

Member Data Documentation

◆ _checkTimer

uint32 go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::_checkTimer
private

Referenced by UpdateAI().