AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_cork_gizelton::npc_cork_gizeltonAI Struct Reference
Inheritance diagram for npc_cork_gizelton::npc_cork_gizeltonAI:
npc_escortAI ScriptedAI CreatureAI UnitAI

Public Member Functions

 npc_cork_gizeltonAI (Creature *creature)
 
void Initialize ()
 
void JustRespawned () override
 
void InitializeAI () override
 
void JustDied (Unit *killer) override
 
void EnterEvadeMode (EvadeReason why) override
 
void CheckPlayer ()
 
void SetGUID (ObjectGuid playerGUID, int32 faction) override
 
void SetData (uint32 field, uint32 data) override
 
bool CheckCaravan ()
 
void RemoveSummons ()
 
void SummonHelpers ()
 
void SummonedCreatureDies (Creature *creature, Unit *) override
 
void SummonedCreatureDespawn (Creature *creature) override
 
void SummonsFollow ()
 
void RelocateSummons ()
 
void ImmuneFlagSet (bool remove, uint32 faction)
 
void WaypointReached (uint32 waypointId) override
 
void UpdateEscortAI (uint32 diff) override
 
- Public Member Functions inherited from npc_escortAI
 npc_escortAI (Creature *creature)
 
 ~npc_escortAI () override
 
void AttackStart (Unit *who) override
 
void MoveInLineOfSight (Unit *who) override
 
void JustDied (Unit *) override
 
void JustRespawned () override
 
void ReturnToLastPoint ()
 
void EnterEvadeMode (EvadeReason=EVADE_REASON_OTHER) override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void MovementInform (uint32, uint32) override
 
void AddWaypoint (uint32 id, float x, float y, float z, uint32 waitTime=0)
 
bool SetNextWaypoint (uint32 pointId, float x, float y, float z, float orientation)
 
bool SetNextWaypoint (uint32 pointId, bool setPosition=true)
 
bool GetWaypointPosition (uint32 pointId, float &x, float &y, float &z)
 
void GenerateWaypointArray (Movement::PointsArray *points)
 
virtual void WaypointStart (uint32)
 
void Start (bool isActiveAttacker=true, bool run=false, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
 
void SetRun (bool on=true)
 
void SetEscortPaused (bool on)
 
bool HasEscortState (uint32 escortState)
 
bool IsEscorted () override
 
void SetMaxPlayerDistance (float newMax)
 
float GetMaxPlayerDistance ()
 
void SetDespawnAtEnd (bool despawn)
 
void SetDespawnAtFar (bool despawn)
 
bool GetAttack ()
 
void SetCanAttack (bool attack)
 
ObjectGuid GetEventStarterGUID ()
 
void AddEscortState (uint32 escortState)
 
void RemoveEscortState (uint32 escortState)
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportPlayer (Unit *unit, Position pos)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
virtual bool CheckEvadeIfOutOfCombatArea () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
PlayerSelectTargetFromPlayerList (float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
 
void SetInvincibility (bool apply)
 
bool IsInvincible () const
 
void SetAutoAttackAllowed (bool allow)
 
bool IsAutoAttackAllowed () const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0s)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void AttackedBy (Unit *)
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ==================
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields =======================================
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
virtual void CalculateThreat (Unit *, float &, SpellInfo const *)
 
virtual bool OnTeleportUnreacheablePlayer (Player *)
 
virtual void OnAuraRemove (AuraApplication *, AuraRemoveMode)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 Select the best (up to) <num> targets (in <targetType> order) from the threat list that fulfill the following:
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 Called when the unit enters combat.
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage to any victim (before damage apply)
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal.
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates.
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals.
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations.
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 To specify the caster as target if the spell is self-cast.
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false, bool withTank=true)
 Cast the spell on a random unit from the threat list.
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not be the current victim.
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 Called when a summon reaches a waypoint or point movement finished.
 
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 sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Public Attributes

EventMap events
 
ObjectGuid summons [MAX_CARAVAN_SUMMONS]
 
bool headNorth
 
ObjectGuid _playerGUID
 
uint32 _faction
 
- Public Attributes inherited from ScriptedAI
Creatureme
 

Additional Inherited Members

- Public Types inherited from ScriptedAI
enum class  Axis {
  AXIS_X ,
  AXIS_Y
}
 
- Public Types inherited from CreatureAI
enum  EvadeReason {
  EVADE_REASON_NO_HOSTILES ,
  EVADE_REASON_BOUNDARY ,
  EVADE_REASON_SEQUENCE_BREAK ,
  EVADE_REASON_NO_PATH ,
  EVADE_REASON_OTHER
}
 
- Static Public Member Functions inherited from CreatureAI
static bool IsInBounds (CreatureBoundary const &boundary, Position const *who)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from npc_escortAI
PlayerGetPlayerForEscort ()
 
- 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 _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
EventMap events
 
TaskScheduler scheduler
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_cork_gizeltonAI()

npc_cork_gizelton::npc_cork_gizeltonAI::npc_cork_gizeltonAI ( Creature creature)
inline
76 : npc_escortAI(creature)
77 {
78 }
Definition ScriptedEscortAI.h:53

Member Function Documentation

◆ CheckCaravan()

bool npc_cork_gizelton::npc_cork_gizeltonAI::CheckCaravan ( )
inline
150 {
151 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
152 {
153 if (!summons[i])
154 {
156 return false;
157 }
158
160 if (!summon || me->GetDistance2d(summon) > 25.0f)
161 {
163 return false;
164 }
165 }
166 return true;
167 }
std::uint8_t uint8
Definition Define.h:109
Definition Creature.h:43
float GetDistance2d(WorldObject const *obj) const
Definition Object.cpp:1274
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition ObjectAccessor.cpp:210
Creature * me
Definition ScriptedCreature.h:280
void SummonHelpers()
Definition zone_desolace.cpp:180
ObjectGuid summons[MAX_CARAVAN_SUMMONS]
Definition zone_desolace.cpp:81
@ MAX_CARAVAN_SUMMONS
Definition zone_desolace.cpp:43

References ObjectAccessor::GetCreature(), WorldObject::GetDistance2d(), MAX_CARAVAN_SUMMONS, ScriptedAI::me, SummonHelpers(), and summons.

Referenced by UpdateEscortAI(), and WaypointReached().

◆ CheckPlayer()

void npc_cork_gizelton::npc_cork_gizeltonAI::CheckPlayer ( )
inline
121 {
122 if (_playerGUID)
124 if (me->IsWithinDist(player, 60.0f))
125 return;
126
128 _faction = 35;
129 ImmuneFlagSet(false, _faction);
130 }
void Clear()
Definition ObjectGuid.h:138
Definition Player.h:1082
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition Object.cpp:1327
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition ObjectAccessor.cpp:220
uint32 _faction
Definition zone_desolace.cpp:85
ObjectGuid _playerGUID
Definition zone_desolace.cpp:84
void ImmuneFlagSet(bool remove, uint32 faction)
Definition zone_desolace.cpp:242

References _faction, _playerGUID, ObjectGuid::Clear(), ObjectAccessor::GetPlayer(), ImmuneFlagSet(), WorldObject::IsWithinDist(), and ScriptedAI::me.

Referenced by WaypointReached().

◆ EnterEvadeMode()

void npc_cork_gizelton::npc_cork_gizeltonAI::EnterEvadeMode ( EvadeReason  why)
inlineoverridevirtual

Reimplemented from CreatureAI.

114 {
116 ImmuneFlagSet(false, 35);
118 }
void SummonsFollow()
Definition zone_desolace.cpp:222
void EnterEvadeMode(EvadeReason=EVADE_REASON_OTHER) override
Definition ScriptedEscortAI.cpp:194

References npc_escortAI::EnterEvadeMode(), ImmuneFlagSet(), and SummonsFollow().

◆ ImmuneFlagSet()

void npc_cork_gizelton::npc_cork_gizeltonAI::ImmuneFlagSet ( bool  remove,
uint32  faction 
)
inline
243 {
244 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
246 {
247 summon->SetFaction(faction);
248 if (remove)
249 summon->SetImmuneToNPC(false);
250 else
251 summon->SetImmuneToNPC(true);
252 }
253 if (remove)
254 me->SetImmuneToNPC(false);
255 else
256 me->SetImmuneToNPC(true);
257 me->SetFaction(faction);
258 }
void SetFaction(uint32 faction)
Definition Unit.cpp:10096
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition Unit.cpp:13661

References ObjectAccessor::GetCreature(), MAX_CARAVAN_SUMMONS, ScriptedAI::me, Unit::SetFaction(), Unit::SetImmuneToNPC(), and summons.

Referenced by CheckPlayer(), EnterEvadeMode(), and WaypointReached().

◆ Initialize()

void npc_cork_gizelton::npc_cork_gizeltonAI::Initialize ( )
inline
88 {
89 _faction = 35;
90 headNorth = true;
91 me->setActive(true);
92 events.ScheduleEvent(EVENT_RESTART_ESCORT, 0ms);
93 }
events
Definition boss_sartura.cpp:43
void setActive(bool isActiveObject)
Definition Object.cpp:1094
bool headNorth
Definition zone_desolace.cpp:82
@ EVENT_RESTART_ESCORT
Definition zone_desolace.cpp:32

References _faction, EVENT_RESTART_ESCORT, headNorth, ScriptedAI::me, and WorldObject::setActive().

Referenced by InitializeAI(), and JustRespawned().

◆ InitializeAI()

void npc_cork_gizelton::npc_cork_gizeltonAI::InitializeAI ( )
inlineoverridevirtual

Reimplemented from UnitAI.

102 {
104 Initialize();
105 }
virtual void InitializeAI()
Definition UnitAI.h:208
void Initialize()
Definition zone_desolace.cpp:87

References Initialize(), and UnitAI::InitializeAI().

◆ JustDied()

void npc_cork_gizelton::npc_cork_gizeltonAI::JustDied ( Unit killer)
inlineoverridevirtual

Reimplemented from CreatureAI.

108 {
111 }
void RemoveSummons()
Definition zone_desolace.cpp:169
void JustDied(Unit *) override
Definition ScriptedEscortAI.cpp:148

References npc_escortAI::JustDied(), and RemoveSummons().

◆ JustRespawned()

void npc_cork_gizelton::npc_cork_gizeltonAI::JustRespawned ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

96 {
98 Initialize();
99 }
void JustRespawned() override
Definition ScriptedEscortAI.cpp:170

References Initialize(), and npc_escortAI::JustRespawned().

◆ RelocateSummons()

void npc_cork_gizelton::npc_cork_gizeltonAI::RelocateSummons ( )
inline
236 {
237 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
239 summon->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
240 }
float GetPositionZ() const
Definition Position.h:123
float GetOrientation() const
Definition Position.h:124
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References ObjectAccessor::GetCreature(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), MAX_CARAVAN_SUMMONS, ScriptedAI::me, and summons.

Referenced by WaypointReached().

◆ RemoveSummons()

void npc_cork_gizelton::npc_cork_gizeltonAI::RemoveSummons ( )
inline
170 {
171 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
172 {
174 summon->DespawnOrUnsummon();
175
176 summons[i].Clear();
177 }
178 }

References ObjectGuid::Clear(), ObjectAccessor::GetCreature(), MAX_CARAVAN_SUMMONS, ScriptedAI::me, and summons.

Referenced by JustDied(), and SummonHelpers().

◆ SetData()

void npc_cork_gizelton::npc_cork_gizeltonAI::SetData ( uint32  field,
uint32  data 
)
inlineoverridevirtual

Reimplemented from UnitAI.

143 {
144 if (field == 1 && data == 1)
145 if (Player* player = me->SelectNearestPlayer(50.0f))
146 SetGUID(player->GetGUID(), player->GetFaction());
147 }
Player * SelectNearestPlayer(float distance=0) const
Definition Object.cpp:2486
void SetGUID(ObjectGuid playerGUID, int32 faction) override
Definition zone_desolace.cpp:132

References ScriptedAI::me, WorldObject::SelectNearestPlayer(), and SetGUID().

◆ SetGUID()

void npc_cork_gizelton::npc_cork_gizeltonAI::SetGUID ( ObjectGuid  playerGUID,
int32  faction 
)
inlineoverridevirtual

Reimplemented from UnitAI.

133 {
134 _playerGUID = playerGUID;
135 _faction = faction;
136 SetEscortPaused(false);
137 if (Creature* active = !headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0]))
138 active->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
139 events.CancelEvent(EVENT_WAIT_FOR_ASSIST);
140 }
@ UNIT_NPC_FLAG_QUESTGIVER
Definition UnitDefines.h:316
Definition ObjectAccessor.h:61
void SetEscortPaused(bool on)
Definition ScriptedEscortAI.cpp:516
@ EVENT_WAIT_FOR_ASSIST
Definition zone_desolace.cpp:31

References _faction, _playerGUID, EVENT_WAIT_FOR_ASSIST, ObjectAccessor::GetCreature(), headNorth, ScriptedAI::me, npc_escortAI::SetEscortPaused(), summons, and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by SetData().

◆ SummonedCreatureDespawn()

void npc_cork_gizelton::npc_cork_gizeltonAI::SummonedCreatureDespawn ( Creature creature)
inlineoverridevirtual

Reimplemented from CreatureAI.

213 {
214 if (creature->GetGUID() == summons[0])
215 summons[0].Clear();
216 else if (creature->GetGUID() == summons[1])
217 summons[1].Clear();
218 else if (creature->GetGUID() == summons[2])
219 summons[2].Clear();
220 }
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:113

References ObjectGuid::Clear(), Object::GetGUID(), and summons.

◆ SummonedCreatureDies()

void npc_cork_gizelton::npc_cork_gizeltonAI::SummonedCreatureDies ( Creature creature,
Unit  
)
inlineoverridevirtual

Reimplemented from CreatureAI.

203 {
204 if (creature->GetGUID() == summons[0])
205 summons[0].Clear();
206 else if (creature->GetGUID() == summons[1])
207 summons[1].Clear();
208 else if (creature->GetGUID() == summons[2])
209 summons[2].Clear();
210 }

References ObjectGuid::Clear(), Object::GetGUID(), and summons.

◆ SummonHelpers()

void npc_cork_gizelton::npc_cork_gizeltonAI::SummonHelpers ( )
inline
181 {
184
186 {
187 cr->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
188 summons[0] = cr->GetGUID();
189 }
191 {
192 summons[1] = cr->GetGUID();
193 }
195 {
196 summons[2] = cr->GetGUID();
197 }
198
200 }
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:720
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition Object.cpp:2368
@ NPC_RIGGER_GIZELTON
Definition zone_desolace.cpp:35
@ NPC_CARAVAN_KODO
Definition zone_desolace.cpp:36

References ScriptedAI::me, NPC_CARAVAN_KODO, NPC_RIGGER_GIZELTON, Unit::RemoveNpcFlag(), RemoveSummons(), WorldObject::SummonCreature(), summons, SummonsFollow(), and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by CheckCaravan().

◆ SummonsFollow()

void npc_cork_gizelton::npc_cork_gizeltonAI::SummonsFollow ( )
inline
223 {
224 float dist = 1.0f;
225 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
227 {
228 summon->GetMotionMaster()->Clear(false);
229 summon->StopMoving();
230 summon->GetMotionMaster()->MoveFollow(me, dist, M_PI, MOTION_SLOT_ACTIVE);
231 dist += (i == 1 ? 9.5f : 3.0f);
232 }
233 }
@ MOTION_SLOT_ACTIVE
Definition MotionMaster.h:64

References ObjectAccessor::GetCreature(), MAX_CARAVAN_SUMMONS, ScriptedAI::me, MOTION_SLOT_ACTIVE, and summons.

Referenced by EnterEvadeMode(), and SummonHelpers().

◆ UpdateEscortAI()

void npc_cork_gizelton::npc_cork_gizeltonAI::UpdateEscortAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from npc_escortAI.

380 {
381 events.Update(diff);
382 switch (events.ExecuteEvent())
383 {
385 SetEscortPaused(false);
386 if (Creature* talker = headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0]))
387 talker->AI()->Talk(SAY_CARAVAN_LEAVE);
388
390 break;
392 SetEscortPaused(false);
393 if (Creature* active = !headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0]))
394 active->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
395 break;
397 CheckCaravan();
398 SetDespawnAtEnd(false);
399 Start(true, true, ObjectGuid::Empty, 0, false, false, true);
400 break;
401 }
402
403 if (!UpdateVictim())
404 return;
405
407 }
bool UpdateVictim()
Definition CreatureAI.cpp:282
static ObjectGuid const Empty
Definition ObjectGuid.h:120
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:39
Talk
Definition hyjal.cpp:82
bool CheckCaravan()
Definition zone_desolace.cpp:149
void Start(bool isActiveAttacker=true, bool run=false, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
Definition ScriptedEscortAI.cpp:442
void SetDespawnAtEnd(bool despawn)
Definition ScriptedEscortAI.h:104
@ SAY_CARAVAN_LEAVE
Definition zone_desolace.cpp:40
@ EVENT_RESUME_PATH
Definition zone_desolace.cpp:30

References CheckCaravan(), UnitAI::DoMeleeAttackIfReady(), ObjectGuid::Empty, EVENT_RESTART_ESCORT, EVENT_RESUME_PATH, EVENT_WAIT_FOR_ASSIST, ObjectAccessor::GetCreature(), headNorth, ScriptedAI::me, SAY_CARAVAN_LEAVE, npc_escortAI::SetDespawnAtEnd(), npc_escortAI::SetEscortPaused(), npc_escortAI::Start(), summons, UNIT_NPC_FLAG_QUESTGIVER, and CreatureAI::UpdateVictim().

◆ WaypointReached()

void npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached ( uint32  waypointId)
inlineoverridevirtual

Implements npc_escortAI.

261 {
263 switch (waypointId)
264 {
265 // Finished north path
266 case 52:
267 me->SummonCreature(NPC_VENDOR_TRON, -694.61f, 1460.7f, 90.794f, 2.4f, TEMPSUMMON_TIMED_DESPAWN, TIME_SHOP_STOP + 15 * IN_MILLISECONDS);
268 SetEscortPaused(true);
270 CheckCaravan();
271 break;
272 // Finished south path
273 case 193:
275 SetEscortPaused(true);
277 CheckCaravan();
278 break;
279 // North -> South - hire
280 case 77:
281 SetEscortPaused(true);
285 break;
286 // Sout -> North - hire
287 case 208:
288 SetEscortPaused(true);
290 {
291 rigger->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
292 rigger->AI()->Talk(SAY_CARAVAN_HIRE);
293 }
295 break;
296 // North -> South - complete
297 case 103:
299 {
300 if (CheckCaravan())
301 player->GroupEventHappens(QUEST_BODYGUARD_FOR_HIRE, player);
302 else
303 player->FailQuest(QUEST_BODYGUARD_FOR_HIRE);
304 }
306 CheckPlayer();
307 break;
308 // South -> North - complete
309 case 235:
311 {
312 if (CheckCaravan())
313 player->GroupEventHappens(QUEST_GIZELTON_CARAVAN, player);
314 else
315 player->FailQuest(QUEST_GIZELTON_CARAVAN);
316 }
318 CheckPlayer();
319 break;
320 // North -> South - spawn attackers
321 case 83:
322 case 93:
323 case 100:
324 {
325 if (!_playerGUID)
326 return;
327 ImmuneFlagSet(true, _faction);
328 Creature* cr = nullptr;
329 for (uint8 i = 0; i < 4; ++i)
330 {
331 float o = (i * M_PI / 2) + (M_PI / 4);
332 float x = me->GetPositionX() + cos(o) * 15.0f;
333 float y = me->GetPositionY() + std::sin(o) * 15.0f;
334 if ((cr = me->SummonCreature((i % 2 == 0 ? NPC_KOLKAR_WAYLAYER : NPC_KOLKAR_AMBUSHER),
335 x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)))
336 cr->AI()->AttackStart(me);
337 }
338 if (cr)
339 {
340 AttackStart(cr);
341 me->CallForHelp(50.0f);
342 }
343 break;
344 }
345 // South -> North - spawn attackers
346 case 221:
347 case 228:
348 case 233:
349 {
350 if (!_playerGUID)
351 return;
352 ImmuneFlagSet(true, _faction);
353 Creature* cr = nullptr;
354 for (uint8 i = 0; i < 3; ++i)
355 {
356 float o = i * 2 * M_PI / 3;
357 float x = me->GetPositionX() + cos(o) * 10.0f;
358 float y = me->GetPositionY() + std::sin(o) * 10.0f;
360 if (i)
361 entry = i == 1 ? NPC_DOOMWARDER : NPC_NETHER;
362
363 if ((cr = me->SummonCreature(entry, x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)))
364 cr->AI()->AttackStart(me);
365 }
366 if (cr)
367 {
368 AttackStart(cr);
369 me->CallForHelp(50.0f);
370 }
371 break;
372 }
373 case 282:
374 events.ScheduleEvent(EVENT_RESTART_ESCORT, 1s);
375 break;
376 }
377 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
std::uint32_t uint32
Definition Define.h:107
#define MAX_HEIGHT
Definition GridTerrainData.h:26
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:49
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:50
void CallForHelp(float fRadius, Unit *target=nullptr)
Definition Creature.cpp:2468
CreatureAI * AI() const
Definition Creature.h:141
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition Map.cpp:1194
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:27
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:719
Map * GetMap() const
Definition Object.h:537
void RelocateSummons()
Definition zone_desolace.cpp:235
void CheckPlayer()
Definition zone_desolace.cpp:120
void AttackStart(Unit *who) override
Definition ScriptedEscortAI.cpp:45
@ QUEST_BODYGUARD_FOR_HIRE
Definition zone_desolace.cpp:27
@ NPC_KOLKAR_AMBUSHER
Definition zone_desolace.cpp:50
@ NPC_SUPER_SELLER
Definition zone_desolace.cpp:38
@ TIME_HIRE_STOP
Definition zone_desolace.cpp:46
@ NPC_LESSER_INFERNAL
Definition zone_desolace.cpp:51
@ SAY_CARAVAN_HIRE
Definition zone_desolace.cpp:41
@ TIME_SHOP_STOP
Definition zone_desolace.cpp:45
@ NPC_NETHER
Definition zone_desolace.cpp:53
@ NPC_VENDOR_TRON
Definition zone_desolace.cpp:37
@ NPC_DOOMWARDER
Definition zone_desolace.cpp:52
@ QUEST_GIZELTON_CARAVAN
Definition zone_desolace.cpp:28
@ NPC_KOLKAR_WAYLAYER
Definition zone_desolace.cpp:49

References _faction, _playerGUID, Creature::AI(), UnitAI::AttackStart(), npc_escortAI::AttackStart(), Creature::CallForHelp(), CheckCaravan(), CheckPlayer(), ObjectGuid::Clear(), EVENT_RESTART_ESCORT, EVENT_RESUME_PATH, EVENT_WAIT_FOR_ASSIST, ObjectAccessor::GetCreature(), Map::GetHeight(), WorldObject::GetMap(), ObjectAccessor::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), ImmuneFlagSet(), IN_MILLISECONDS, MAX_HEIGHT, ScriptedAI::me, NPC_DOOMWARDER, NPC_KOLKAR_AMBUSHER, NPC_KOLKAR_WAYLAYER, NPC_LESSER_INFERNAL, NPC_NETHER, NPC_SUPER_SELLER, NPC_VENDOR_TRON, QUEST_BODYGUARD_FOR_HIRE, QUEST_GIZELTON_CARAVAN, RelocateSummons(), SAY_CARAVAN_HIRE, npc_escortAI::SetEscortPaused(), Unit::SetNpcFlag(), WorldObject::SummonCreature(), summons, TEMPSUMMON_TIMED_DESPAWN, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, TIME_HIRE_STOP, TIME_SHOP_STOP, and UNIT_NPC_FLAG_QUESTGIVER.

Member Data Documentation

◆ _faction

uint32 npc_cork_gizelton::npc_cork_gizeltonAI::_faction

◆ _playerGUID

ObjectGuid npc_cork_gizelton::npc_cork_gizeltonAI::_playerGUID

◆ events

EventMap npc_cork_gizelton::npc_cork_gizeltonAI::events

◆ headNorth

bool npc_cork_gizelton::npc_cork_gizeltonAI::headNorth

Referenced by Initialize(), SetGUID(), and UpdateEscortAI().

◆ summons


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