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 ()
 
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
88 : npc_escortAI(creature)
89 {
90 }
Definition ScriptedEscortAI.h:53

Member Function Documentation

◆ CheckCaravan()

bool npc_cork_gizelton::npc_cork_gizeltonAI::CheckCaravan ( )
inline
162 {
163 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
164 {
165 if (!summons[i])
166 {
168 return false;
169 }
170
172 if (!summon || me->GetDistance2d(summon) > 25.0f)
173 {
175 return false;
176 }
177 }
178 return true;
179 }
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:192
ObjectGuid summons[MAX_CARAVAN_SUMMONS]
Definition zone_desolace.cpp:93
@ MAX_CARAVAN_SUMMONS
Definition zone_desolace.cpp:55

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
133 {
134 if (_playerGUID)
136 if (me->IsWithinDist(player, 60.0f))
137 return;
138
140 _faction = 35;
141 ImmuneFlagSet(false, _faction);
142 }
void Clear()
Definition ObjectGuid.h:138
Definition Player.h:1081
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:97
ObjectGuid _playerGUID
Definition zone_desolace.cpp:96
void ImmuneFlagSet(bool remove, uint32 faction)
Definition zone_desolace.cpp:254

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.

126 {
128 ImmuneFlagSet(false, 35);
130 }
void SummonsFollow()
Definition zone_desolace.cpp:234
void EnterEvadeMode(EvadeReason=EVADE_REASON_OTHER) override
Definition ScriptedEscortAI.cpp:201

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

◆ ImmuneFlagSet()

void npc_cork_gizelton::npc_cork_gizeltonAI::ImmuneFlagSet ( bool  remove,
uint32  faction 
)
inline
255 {
256 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
258 {
259 summon->SetFaction(faction);
260 if (remove)
261 summon->SetImmuneToNPC(false);
262 else
263 summon->SetImmuneToNPC(true);
264 }
265 if (remove)
266 me->SetImmuneToNPC(false);
267 else
268 me->SetImmuneToNPC(true);
269 me->SetFaction(faction);
270 }
void SetFaction(uint32 faction)
Definition Unit.cpp:10097
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition Unit.cpp:13662

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
100 {
101 _faction = 35;
102 headNorth = true;
103 me->setActive(true);
104 events.ScheduleEvent(EVENT_RESTART_ESCORT, 0ms);
105 }
events
Definition boss_sartura.cpp:43
void setActive(bool isActiveObject)
Definition Object.cpp:1094
bool headNorth
Definition zone_desolace.cpp:94
@ EVENT_RESTART_ESCORT
Definition zone_desolace.cpp:44

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.

114 {
116 Initialize();
117 }
virtual void InitializeAI()
Definition UnitAI.h:204
void Initialize()
Definition zone_desolace.cpp:99

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

◆ JustDied()

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

Reimplemented from CreatureAI.

120 {
123 }
void RemoveSummons()
Definition zone_desolace.cpp:181
void JustDied(Unit *) override
Definition ScriptedEscortAI.cpp:155

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

◆ JustRespawned()

void npc_cork_gizelton::npc_cork_gizeltonAI::JustRespawned ( )
inlineoverridevirtual

Reimplemented from CreatureAI.

108 {
110 Initialize();
111 }
void JustRespawned() override
Definition ScriptedEscortAI.cpp:177

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

◆ RelocateSummons()

void npc_cork_gizelton::npc_cork_gizeltonAI::RelocateSummons ( )
inline
248 {
249 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
251 summon->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
252 }
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
182 {
183 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
184 {
186 summon->DespawnOrUnsummon();
187
188 summons[i].Clear();
189 }
190 }

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.

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

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

◆ SetGUID()

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

Reimplemented from UnitAI.

145 {
146 _playerGUID = playerGUID;
147 _faction = faction;
148 SetEscortPaused(false);
149 if (Creature* active = !headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0]))
150 active->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
151 events.CancelEvent(EVENT_WAIT_FOR_ASSIST);
152 }
@ UNIT_NPC_FLAG_QUESTGIVER
Definition UnitDefines.h:316
Definition ObjectAccessor.h:61
void SetEscortPaused(bool on)
Definition ScriptedEscortAI.cpp:523
@ EVENT_WAIT_FOR_ASSIST
Definition zone_desolace.cpp:43

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.

225 {
226 if (creature->GetGUID() == summons[0])
227 summons[0].Clear();
228 else if (creature->GetGUID() == summons[1])
229 summons[1].Clear();
230 else if (creature->GetGUID() == summons[2])
231 summons[2].Clear();
232 }
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:112

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

◆ SummonedCreatureDies()

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

Reimplemented from CreatureAI.

215 {
216 if (creature->GetGUID() == summons[0])
217 summons[0].Clear();
218 else if (creature->GetGUID() == summons[1])
219 summons[1].Clear();
220 else if (creature->GetGUID() == summons[2])
221 summons[2].Clear();
222 }

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

◆ SummonHelpers()

void npc_cork_gizelton::npc_cork_gizeltonAI::SummonHelpers ( )
inline
193 {
196
198 {
199 cr->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
200 summons[0] = cr->GetGUID();
201 }
203 {
204 summons[1] = cr->GetGUID();
205 }
207 {
208 summons[2] = cr->GetGUID();
209 }
210
212 }
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:736
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:47
@ NPC_CARAVAN_KODO
Definition zone_desolace.cpp:48

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
235 {
236 float dist = 1.0f;
237 for (uint8 i = 0; i < MAX_CARAVAN_SUMMONS; ++i)
239 {
240 summon->GetMotionMaster()->Clear(false);
241 summon->StopMoving();
242 summon->GetMotionMaster()->MoveFollow(me, dist, M_PI, MOTION_SLOT_ACTIVE);
243 dist += (i == 1 ? 9.5f : 3.0f);
244 }
245 }
@ 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.

392 {
393 events.Update(diff);
394 switch (events.ExecuteEvent())
395 {
397 SetEscortPaused(false);
398 if (Creature* talker = headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0]))
399 talker->AI()->Talk(SAY_CARAVAN_LEAVE);
400
402 break;
404 SetEscortPaused(false);
405 if (Creature* active = !headNorth ? me : ObjectAccessor::GetCreature(*me, summons[0]))
406 active->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
407 break;
409 CheckCaravan();
410 SetDespawnAtEnd(false);
411 Start(true, true, ObjectGuid::Empty, 0, false, false, true);
412 break;
413 }
414
415 if (!UpdateVictim())
416 return;
417
419 }
bool UpdateVictim()
Definition CreatureAI.cpp:280
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:161
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:449
void SetDespawnAtEnd(bool despawn)
Definition ScriptedEscortAI.h:104
@ SAY_CARAVAN_LEAVE
Definition zone_desolace.cpp:52
@ EVENT_RESUME_PATH
Definition zone_desolace.cpp:42

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.

273 {
275 switch (waypointId)
276 {
277 // Finished north path
278 case 52:
279 me->SummonCreature(NPC_VENDOR_TRON, -694.61f, 1460.7f, 90.794f, 2.4f, TEMPSUMMON_TIMED_DESPAWN, TIME_SHOP_STOP + 15 * IN_MILLISECONDS);
280 SetEscortPaused(true);
282 CheckCaravan();
283 break;
284 // Finished south path
285 case 193:
287 SetEscortPaused(true);
289 CheckCaravan();
290 break;
291 // North -> South - hire
292 case 77:
293 SetEscortPaused(true);
297 break;
298 // Sout -> North - hire
299 case 208:
300 SetEscortPaused(true);
302 {
303 rigger->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
304 rigger->AI()->Talk(SAY_CARAVAN_HIRE);
305 }
307 break;
308 // North -> South - complete
309 case 103:
311 {
312 if (CheckCaravan())
313 player->GroupEventHappens(QUEST_BODYGUARD_FOR_HIRE, player);
314 else
315 player->FailQuest(QUEST_BODYGUARD_FOR_HIRE);
316 }
318 CheckPlayer();
319 break;
320 // South -> North - complete
321 case 235:
323 {
324 if (CheckCaravan())
325 player->GroupEventHappens(QUEST_GIZELTON_CARAVAN, player);
326 else
327 player->FailQuest(QUEST_GIZELTON_CARAVAN);
328 }
330 CheckPlayer();
331 break;
332 // North -> South - spawn attackers
333 case 83:
334 case 93:
335 case 100:
336 {
337 if (!_playerGUID)
338 return;
339 ImmuneFlagSet(true, _faction);
340 Creature* cr = nullptr;
341 for (uint8 i = 0; i < 4; ++i)
342 {
343 float o = (i * M_PI / 2) + (M_PI / 4);
344 float x = me->GetPositionX() + cos(o) * 15.0f;
345 float y = me->GetPositionY() + std::sin(o) * 15.0f;
346 if ((cr = me->SummonCreature((i % 2 == 0 ? NPC_KOLKAR_WAYLAYER : NPC_KOLKAR_AMBUSHER),
347 x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)))
348 cr->AI()->AttackStart(me);
349 }
350 if (cr)
351 {
352 AttackStart(cr);
353 me->CallForHelp(50.0f);
354 }
355 break;
356 }
357 // South -> North - spawn attackers
358 case 221:
359 case 228:
360 case 233:
361 {
362 if (!_playerGUID)
363 return;
364 ImmuneFlagSet(true, _faction);
365 Creature* cr = nullptr;
366 for (uint8 i = 0; i < 3; ++i)
367 {
368 float o = i * 2 * M_PI / 3;
369 float x = me->GetPositionX() + cos(o) * 10.0f;
370 float y = me->GetPositionY() + std::sin(o) * 10.0f;
372 if (i)
373 entry = i == 1 ? NPC_DOOMWARDER : NPC_NETHER;
374
375 if ((cr = me->SummonCreature(entry, x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)))
376 cr->AI()->AttackStart(me);
377 }
378 if (cr)
379 {
380 AttackStart(cr);
381 me->CallForHelp(50.0f);
382 }
383 break;
384 }
385 case 282:
386 events.ScheduleEvent(EVENT_RESTART_ESCORT, 1s);
387 break;
388 }
389 }
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:48
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:49
void CallForHelp(float fRadius, Unit *target=nullptr)
Definition Creature.cpp:2474
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:735
Map * GetMap() const
Definition Object.h:536
void RelocateSummons()
Definition zone_desolace.cpp:247
void CheckPlayer()
Definition zone_desolace.cpp:132
void AttackStart(Unit *who) override
Definition ScriptedEscortAI.cpp:52
@ QUEST_BODYGUARD_FOR_HIRE
Definition zone_desolace.cpp:39
@ NPC_KOLKAR_AMBUSHER
Definition zone_desolace.cpp:62
@ NPC_SUPER_SELLER
Definition zone_desolace.cpp:50
@ TIME_HIRE_STOP
Definition zone_desolace.cpp:58
@ NPC_LESSER_INFERNAL
Definition zone_desolace.cpp:63
@ SAY_CARAVAN_HIRE
Definition zone_desolace.cpp:53
@ TIME_SHOP_STOP
Definition zone_desolace.cpp:57
@ NPC_NETHER
Definition zone_desolace.cpp:65
@ NPC_VENDOR_TRON
Definition zone_desolace.cpp:49
@ NPC_DOOMWARDER
Definition zone_desolace.cpp:64
@ QUEST_GIZELTON_CARAVAN
Definition zone_desolace.cpp:40
@ NPC_KOLKAR_WAYLAYER
Definition zone_desolace.cpp:61

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: