TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
VehicleAI Struct Reference

#include <CombatAI.h>

Public Member Functions

 VehicleAI (Creature *creature)
 
void UpdateAI (uint32 diff) override
 
void MoveInLineOfSight (Unit *) override
 
void AttackStart (Unit *) override
 
void OnCharmed (bool apply) override
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr)
 
 CreatureAI (Creature *creature)
 
virtual ~CreatureAI ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void EnterCombat (Unit *)
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted () const
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
void OnCharmed (bool apply) override
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary constGetBoundary () const
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectAggroTarget targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectAggroTarget targetType, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, PREDICATE const &predicate, uint32 maxTargets, SelectAggroTarget targetType)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void SpellInterrupted (uint32, uint32)
 
void AttackStartCaster (Unit *victim, float dist)
 
void DoCast (uint32 spellId)
 
void DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
void DoCastVictim (uint32 spellId, bool triggered=false)
 
void DoCastAOE (uint32 spellId, bool triggered=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spellId)
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual bool sOnDummyEffect (Unit *, uint32, SpellEffIndex)
 
virtual void sOnGameEvent (bool, uint16)
 

Static Public Member Functions

static int Permissible (Creature const *)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 

Private Member Functions

void LoadConditions ()
 
void CheckConditions (uint32 diff)
 

Private Attributes

bool m_HasConditions
 
uint32 m_ConditionsTimer
 
bool m_DoDismiss
 
uint32 m_DismissTimer
 

Additional Inherited Members

- Public Types inherited from CreatureAI
enum  EvadeReason { EVADE_REASON_NO_HOSTILES, EVADE_REASON_BOUNDARY, EVADE_REASON_SEQUENCE_BREAK, EVADE_REASON_OTHER }
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
CreatureDoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
bool CheckBoundary (Position const *who=nullptr) const
 
void SetBoundary (CreatureBoundary const *boundary)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
CreatureBoundary const_boundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Constructor & Destructor Documentation

VehicleAI::VehicleAI ( Creature creature)
explicit
263 {
264  LoadConditions();
265  m_DoDismiss = false;
267 }
bool m_DoDismiss
Definition: CombatAI.h:117
#define VEHICLE_DISMISS_TIME
Definition: CombatAI.h:98
#define VEHICLE_CONDITION_CHECK_TIME
Definition: CombatAI.h:97
uint32 m_DismissTimer
Definition: CombatAI.h:118
void LoadConditions()
Definition: CombatAI.cpp:298
bool m_HasConditions
Definition: CombatAI.h:115
CreatureAI(Creature *creature)
Definition: CreatureAI.h:95
uint32 m_ConditionsTimer
Definition: CombatAI.h:116

+ Here is the call graph for this function:

Member Function Documentation

void VehicleAI::AttackStart ( Unit )
inlineoverridevirtual

Reimplemented from UnitAI.

107 { }
void VehicleAI::CheckConditions ( uint32  diff)
private
304 {
305  if (m_ConditionsTimer < diff)
306  {
307  if (m_HasConditions)
308  {
309  if (Vehicle* vehicleKit = me->GetVehicleKit())
310  for (SeatMap::iterator itr = vehicleKit->Seats.begin(); itr != vehicleKit->Seats.end(); ++itr)
311  if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid))
312  {
313  if (Player* player = passenger->ToPlayer())
314  {
315  if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry(), player, me))
316  {
317  player->ExitVehicle();
318  return; // check other pessanger in next tick
319  }
320  }
321  }
322  }
324  }
325  else
326  m_ConditionsTimer -= diff;
327 }
Definition: Vehicle.h:32
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
#define VEHICLE_CONDITION_CHECK_TIME
Definition: CombatAI.h:97
Creature *const me
Definition: CreatureAI.h:71
bool m_HasConditions
Definition: CombatAI.h:115
#define sConditionMgr
Definition: ConditionMgr.h:307
uint32 GetEntry() const
Definition: Object.h:107
Definition: Unit.h:1305
uint32 m_ConditionsTimer
Definition: CombatAI.h:116
Vehicle * GetVehicleKit() const
Definition: Unit.h:2165

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void VehicleAI::LoadConditions ( )
private
299 {
301 }
Creature *const me
Definition: CreatureAI.h:71
bool m_HasConditions
Definition: CombatAI.h:115
#define sConditionMgr
Definition: ConditionMgr.h:307
uint32 GetEntry() const
Definition: Object.h:107

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void VehicleAI::MoveInLineOfSight ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

106 { }
void VehicleAI::OnCharmed ( bool  apply)
overridevirtual

Implements UnitAI.

Reimplemented in npc_king_jokkum_vehicle::npc_king_jokkum_vehicleAI.

287 {
288  if (!me->GetVehicleKit()->IsVehicleInUse() && !apply && m_HasConditions) // was used and has conditions
289  {
290  m_DoDismiss = true; // needs reset
291  }
292  else if (apply)
293  m_DoDismiss = false; // in use again
294 
295  m_DismissTimer = VEHICLE_DISMISS_TIME; // reset timer
296 }
bool m_DoDismiss
Definition: CombatAI.h:117
#define VEHICLE_DISMISS_TIME
Definition: CombatAI.h:98
uint32 m_DismissTimer
Definition: CombatAI.h:118
void apply(T *val)
Definition: ByteConverter.h:41
Creature *const me
Definition: CreatureAI.h:71
bool m_HasConditions
Definition: CombatAI.h:115
bool IsVehicleInUse() const
Returns information whether the vehicle is currently used by any unit.
Definition: Vehicle.cpp:551
Vehicle * GetVehicleKit() const
Definition: Unit.h:2165

+ Here is the call graph for this function:

static int VehicleAI::Permissible ( Creature const )
inlinestatic
110 { return PERMIT_BASE_NO; }
Definition: CreatureAI.h:207
void VehicleAI::UpdateAI ( uint32  diff)
overridevirtual

Implements UnitAI.

Reimplemented in npc_wyrmrest_skytalon::npc_wyrmrest_skytalonAI, npc_melee_hover_disk::npc_melee_hover_diskAI, npc_vics_flying_machine::npc_vics_flying_machineAI, npc_frostbrood_skytalon::npc_frostbrood_skytalonAI, npc_king_jokkum_vehicle::npc_king_jokkum_vehicleAI, npc_wyrmrest_defender::npc_wyrmrest_defenderAI, npc_ruby_emerald_amber_drake::npc_ruby_emerald_amber_drakeAI, and npc_freed_protodrake::npc_freed_protodrakeAI.

271 {
272  CheckConditions(diff);
273 
274  if (m_DoDismiss)
275  {
276  if (m_DismissTimer < diff)
277  {
278  m_DoDismiss = false;
280  }
281  else
282  m_DismissTimer -= diff;
283  }
284 }
bool m_DoDismiss
Definition: CombatAI.h:117
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
Definition: Creature.cpp:1774
void CheckConditions(uint32 diff)
Definition: CombatAI.cpp:303
uint32 m_DismissTimer
Definition: CombatAI.h:118
Creature *const me
Definition: CreatureAI.h:71

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

uint32 VehicleAI::m_ConditionsTimer
private
uint32 VehicleAI::m_DismissTimer
private
bool VehicleAI::m_DoDismiss
private
bool VehicleAI::m_HasConditions
private

The documentation for this struct was generated from the following files: