AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
hyjalAI Struct Reference

#include "hyjalAI.h"

Inheritance diagram for hyjalAI:
npc_escortAI ScriptedAI CreatureAI UnitAI

Classes

struct  Spell
 

Public Member Functions

 hyjalAI (Creature *creature)
 
void Reset () override
 
void EnterEvadeMode (EvadeReason=EVADE_REASON_OTHER) override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void UpdateAI (uint32 diff) override
 
void JustDied (Unit *) override
 
void SetFaction (uint32 _faction)
 
void Retreat ()
 
void SpawnVeins ()
 
void DeSpawnVeins ()
 
void JustSummoned (Creature *summoned) override
 
void SummonedCreatureDespawn (Creature *summoned) override
 
void HideNearPos (float x, float y)
 
void RespawnNearPos (float x, float y)
 
void WaypointReached (uint32 waypointId) override
 
void DoOverrun (uint32 faction, const uint32 diff)
 
void MoveInLineOfSight (Unit *who) override
 
void SummonCreature (uint32 entry, float Base[4][3])
 
void SummonNextWave (const Wave wave[18], uint32 Count, float Base[4][3])
 
void StartEvent (Player *player)
 
uint32 GetInstanceData (uint32 Event)
 
- 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
 
virtual void UpdateEscortAI (uint32 diff)
 
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 WaypointReached (uint32 pointId)=0
 
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
 
void UpdateAI (uint32 diff) override
 
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 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)
 
void SetCombatMovement (bool allowMovement)
 
bool IsCombatMovementAllowed () const
 
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
 
- 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)
 
 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 EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void JustEngagedWith (Unit *)
 Called for reaction when initially engaged.
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 
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 *)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void AttackStart (Unit *)
 
virtual void UpdateAI (uint32)=0
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 
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 (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)
 
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 (NOTE: Creature engage logic should NOT be here, but in JustEngagedWith, which happens once threat is established!)
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 
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)
 
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)
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the max threat target, which may not always 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)
 
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

InstanceScriptinstance
 
ObjectGuid PlayerGUID
 
ObjectGuid BossGUID [2]
 
ObjectGuid VeinGUID [14]
 
uint32 NextWaveTimer
 
uint32 WaveCount
 
uint32 CheckTimer
 
uint32 Faction
 
uint32 EnemyCount
 
uint32 RetreatTimer
 
bool EventBegun
 
bool FirstBossDead
 
bool SecondBossDead
 
bool Summon
 
bool bRetreat
 
bool Debug
 
bool VeinsSpawned [2]
 
uint8 InfernalCount
 
SummonList Summons
 
bool Overrun
 
bool Teleported
 
bool WaitForTeleport
 
uint32 TeleportTimer
 
uint32 OverrunCounter
 
uint32 OverrunCounter2
 
uint32 InfernalPoint
 
uint32 RespawnTimer
 
bool DoRespawn
 
bool DoHide
 
bool IsDummy
 
uint32 MassTeleportTimer
 
bool DoMassTeleport
 
ObjectGuid DummyGuid
 
struct hyjalAI::Spell Spells [HYJAL_AI_MAX_SPELLS]
 
- Public Attributes inherited from ScriptedAI
Creatureme
 
bool IsFleeing
 

Private Attributes

uint32 SpellTimer [3]
 

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)
 
virtual void MoveInLineOfSight (Unit *)
 
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

◆ hyjalAI()

hyjalAI::hyjalAI ( Creature creature)
316 : npc_escortAI(creature), Summons(me)
317{
318 instance = creature->GetInstanceScript();
319 VeinsSpawned[0] = false;
320 VeinsSpawned[1] = false;
321 InfernalCount = 0;
322 TeleportTimer = 1000;
323 Overrun = false;
324 Teleported = false;
325 WaitForTeleport = false;
326 OverrunCounter = 0;
327 OverrunCounter2 = 0;
328 InfernalPoint = 0;
329 RespawnTimer = 10000;
330 DoRespawn = false;
331 DoHide = false;
333 DoMassTeleport = false;
334}
Creature * me
Definition: ScriptedCreature.h:282
Definition: ScriptedEscortAI.h:53
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
bool WaitForTeleport
Definition: hyjalAI.h:184
uint32 RespawnTimer
Definition: hyjalAI.h:189
uint32 OverrunCounter2
Definition: hyjalAI.h:187
bool DoMassTeleport
Definition: hyjalAI.h:194
bool VeinsSpawned[2]
Definition: hyjalAI.h:179
bool DoRespawn
Definition: hyjalAI.h:190
uint8 InfernalCount
Definition: hyjalAI.h:180
uint32 InfernalPoint
Definition: hyjalAI.h:188
uint32 MassTeleportTimer
Definition: hyjalAI.h:193
SummonList Summons
Definition: hyjalAI.h:181
uint32 OverrunCounter
Definition: hyjalAI.h:186
uint32 TeleportTimer
Definition: hyjalAI.h:185
InstanceScript * instance
Definition: hyjalAI.h:160
bool Overrun
Definition: hyjalAI.h:182
bool Teleported
Definition: hyjalAI.h:183
bool DoHide
Definition: hyjalAI.h:191

References DoHide, DoMassTeleport, DoRespawn, WorldObject::GetInstanceScript(), InfernalCount, InfernalPoint, instance, MassTeleportTimer, Overrun, OverrunCounter, OverrunCounter2, RespawnTimer, Teleported, TeleportTimer, VeinsSpawned, and WaitForTeleport.

Member Function Documentation

◆ DeSpawnVeins()

void hyjalAI::DeSpawnVeins ( )
664{
665 if (Faction == 1)
666 {
668 if (!unit)return;
669 hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
670 if (!ai)return;
671 for (uint8 i = 0; i < 7; ++i)
672 {
674 gem->Delete();
675 }
676 }
677 else if (Faction)
678 {
680 if (!unit)return;
681 hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
682 if (!ai)return;
683 for (uint8 i = 7; i < 14; ++i)
684 {
686 gem->Delete();
687 }
688 }
689}
std::uint8_t uint8
Definition: Define.h:110
#define CAST_AI(a, b)
Definition: ScriptedCreature.h:28
@ DATA_THRALL
Definition: hyjal.h:48
@ DATA_JAINAPROUDMOORE
Definition: hyjal.h:43
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:213
Definition: Creature.h:46
CreatureAI * AI() const
Definition: Creature.h:136
Definition: GameObject.h:122
ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:94
Map * instance
Definition: InstanceScript.h:147
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3312
Definition: hyjalAI.h:120
ObjectGuid VeinGUID[14]
Definition: hyjalAI.h:164
uint32 Faction
Definition: hyjalAI.h:169

References Creature::AI(), CAST_AI, DATA_JAINAPROUDMOORE, DATA_THRALL, Faction, ObjectAccessor::GetCreature(), Map::GetGameObject(), InstanceScript::GetGuidData(), InstanceScript::instance, instance, ScriptedAI::me, and VeinGUID.

Referenced by npc_thrall::OnGossipSelect(), and StartEvent().

◆ DoOverrun()

void hyjalAI::DoOverrun ( uint32  faction,
const uint32  diff 
)
973{
975 if (WaitForTeleport)
976 {
977 if (TeleportTimer <= diff)
978 {
979 std::list<Creature*> creatures;
982 Cell::VisitGridObjects(me, creature_searcher, me->GetGridActivationRange());
983
984 if (!creatures.empty())
985 {
986 for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
987 {
988 if ((*itr) && (*itr)->IsAlive())
989 {
990 (*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
991 (*itr)->SetFaction(FACTION_FRIENDLY); // make them friendly so mobs won't attack them
992 (*itr)->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
993 }
994 }
996 bRetreat = true;
997 RetreatTimer = 1000;
998 }
999
1000 WaitForTeleport = false;
1001 Teleported = true;
1002 }
1003 TeleportTimer -= diff;
1004 }
1005 if (!Teleported)
1006 return;
1007 Overrun = false;//execute once
1008 switch (faction)
1009 {
1010 case 0://alliance
1011 for (uint8 i = 0; i < 92; ++i)//summon fires
1013
1014 for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
1015 {
1016 uint8 r = rand() % 4;
1017 Creature* unit = me->SummonCreature(GHOUL, AllianceBase[r][0] + irand(-15, 15), AllianceBase[r][1] + irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2 * 60 * 1000);
1018 if (unit)
1019 {
1020 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1021 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1022 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1023 unit->setActive(true);
1024 }
1025 }
1026 for (uint8 i = 0; i < 3; ++i)//summon 3 abominations
1027 {
1028 uint8 r = rand() % 4;
1029 Creature* unit = me->SummonCreature(ABOMINATION, AllianceBase[r][0] + irand(-15, 15), AllianceBase[r][1] + irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2 * 60 * 1000);
1030 if (unit)
1031 {
1032 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1033 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1034 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1035 unit->setActive(true);
1036 }
1037 }
1038 for (uint8 i = 0; i < 5; ++i)//summon 5 gargoyles
1039 {
1041 if (unit)
1042 {
1044 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1045 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1046 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1047 unit->setActive(true);
1048 }
1049 }
1050 break;
1051 case 1://horde
1052 for (uint8 i = 0; i < 65; ++i)//summon fires
1054
1055 for (uint8 i = 0; i < 26; ++i)//summon infernals
1056 {
1058 if (unit)
1059 {
1060 unit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]);
1061 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1062 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1063 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1064 unit->setActive(true);
1065 }
1066 }
1067 for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
1068 {
1069 uint8 r = rand() % 4;
1070 Creature* unit = me->SummonCreature(GHOUL, HordeBase[r][0] + irand(-15, 15), HordeBase[r][1] + irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2 * 60 * 1000);
1071 if (unit)
1072 {
1073 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1074 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1075 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1076 unit->setActive(true);
1077 }
1078 }
1079 for (uint8 i = 0; i < 5; ++i)//summon 5 abominations
1080 {
1081 uint8 r = rand() % 4;
1082 Creature* unit = me->SummonCreature(ABOMINATION, HordeBase[r][0] + irand(-15, 15), HordeBase[r][1] + irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2 * 60 * 1000);
1083 if (unit)
1084 {
1085 CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1086 CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1087 CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1088 unit->setActive(true);
1089 }
1090 }
1091 break;
1092 }
1093}
int32 irand(int32 min, int32 max)
Definition: Random.cpp:37
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: Object.h:49
@ UNIT_FLAG_NON_ATTACKABLE
Definition: Unit.h:449
creatures
Definition: boss_prince_malchezaar.cpp:51
@ GARGOYLE
Definition: hyjal.h:74
@ GIANT_INFERNAL
Definition: hyjal.h:76
@ ABOMINATION
Definition: hyjal.h:70
@ GHOUL
Definition: hyjal.h:71
@ GO_ROARING_FLAME
Definition: hyjal.h:98
float AllianceOverrunGargPos[5][4]
Definition: hyjalAI.cpp:142
float HordeBase[4][3]
Definition: hyjalAI.cpp:67
float InfernalSPWP[26][4]
Definition: hyjalAI.cpp:94
float HordeFirePos[65][8]
Definition: hyjalAI.cpp:247
float AllianceBase[4][3]
Definition: hyjalAI.cpp:52
float AllianceFirePos[92][8]
Definition: hyjalAI.cpp:151
@ SPELL_TELEPORT_VISUAL
Definition: hyjalAI.h:28
@ FACTION_FRIENDLY
Definition: SharedDefines.h:201
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:177
void UpdateAI(uint32 diff) override
Definition: ScriptedEscortAI.cpp:240
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:330
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:2343
float GetGridActivationRange() const
Definition: Object.cpp:1623
void setActive(bool isActiveObject)
Definition: Object.cpp:1085
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition: Object.cpp:2357
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
Definition: GridNotifiers.h:470
Definition: GridNotifiers.h:1425
Definition: hyjal_trash.h:27
uint32 RetreatTimer
Definition: hyjalAI.h:171
bool bRetreat
Definition: hyjalAI.h:177

References ABOMINATION, Creature::AI(), AllianceBase, AllianceFirePos, AllianceOverrunGargPos, bRetreat, CAST_AI, UnitAI::DoCast(), Faction, FACTION_FRIENDLY, GARGOYLE, WorldObject::GetGridActivationRange(), GHOUL, GIANT_INFERNAL, GO_ROARING_FLAME, HordeBase, HordeFirePos, InfernalSPWP, irand(), ScriptedAI::me, Overrun, RetreatTimer, WorldObject::setActive(), Creature::SetHomePosition(), SPELL_TELEPORT_VISUAL, WorldObject::SummonCreature(), WorldObject::SummonGameObject(), Teleported, TeleportTimer, TEMPSUMMON_MANUAL_DESPAWN, UNIT_FLAG_NON_ATTACKABLE, npc_escortAI::UpdateAI(), Cell::VisitGridObjects(), and WaitForTeleport.

Referenced by UpdateAI().

◆ EnterEvadeMode()

void hyjalAI::EnterEvadeMode ( EvadeReason  = EVADE_REASON_OTHER)
overridevirtual

Reimplemented from npc_escortAI.

410{
411 if (me->GetEntry() != JAINA)
414 me->CombatStop(true);
415 me->LoadCreaturesAddon(true);
416
417 if (me->IsAlive())
419
420 me->SetLootRecipient(nullptr);
421}
@ JAINA
Definition: hyjal.h:79
void ClearAllThreat()
Definition: ThreatMgr.cpp:417
bool LoadCreaturesAddon(bool reload=false)
Definition: Creature.cpp:2634
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition: Creature.cpp:1258
uint32 GetEntry() const
Definition: Object.h:109
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:10440
MotionMaster * GetMotionMaster()
Definition: Unit.h:2276
bool IsAlive() const
Definition: Unit.h:1822
void RemoveAllAuras()
Definition: Unit.cpp:5259
ThreatMgr & GetThreatMgr()
Definition: Unit.h:2159
void MoveTargetedHome(bool walk=false)
Definition: MotionMaster.cpp:252

References ThreatMgr::ClearAllThreat(), Unit::CombatStop(), Object::GetEntry(), Unit::GetMotionMaster(), Unit::GetThreatMgr(), Unit::IsAlive(), JAINA, Creature::LoadCreaturesAddon(), ScriptedAI::me, MotionMaster::MoveTargetedHome(), Unit::RemoveAllAuras(), and Creature::SetLootRecipient().

Referenced by npc_jaina_proudmoore::GetAI(), npc_thrall::GetAI(), and npc_tyrande_whisperwind::GetAI().

◆ GetInstanceData()

uint32 hyjalAI::GetInstanceData ( uint32  Event)
600{
601 return instance->GetData(Event);
602}
Event
Definition: boss_prince_taldaram.cpp:68
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:52

References ZoneScript::GetData(), and instance.

Referenced by npc_jaina_proudmoore::OnGossipHello(), npc_thrall::OnGossipHello(), and npc_tyrande_whisperwind::OnGossipHello().

◆ HideNearPos()

void hyjalAI::HideNearPos ( float  x,
float  y 
)
900{
901 // First get all creatures.
902 std::list<Creature*> creatures;
905
906 Cell::VisitGridObjects(x, y, me->GetMap(), creature_searcher, me->GetGridActivationRange());
907
908 if (!creatures.empty())
909 {
910 for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
911 {
912 (*itr)->SetVisible(false);
913 (*itr)->SetFaction(FACTION_FRIENDLY); // make them friendly so mobs won't attack them
914 }
915 }
916}
Map * GetMap() const
Definition: Object.h:517

References FACTION_FRIENDLY, WorldObject::GetGridActivationRange(), WorldObject::GetMap(), ScriptedAI::me, and Cell::VisitGridObjects().

Referenced by UpdateAI().

◆ JustDied()

void hyjalAI::JustDied ( Unit )
overridevirtual

Reimplemented from npc_escortAI.

879{
880 if (IsDummy)return;
881 me->Respawn();
882 me->SetVisible(false);
883 DoRespawn = true;
884 RespawnTimer = 120000;
885 Talk(DEATH);
886 Summons.DespawnAll();//despawn all wave's summons
887 //reset encounter if boss is despawned (ex: thrall is killed, boss despawns, event stucks at inprogress)
896 instance->SetData(DATA_RESET_RAIDDAMAGE, 0);//reset damage on die
897}
@ IN_PROGRESS
Definition: InstanceScript.h:58
@ NOT_STARTED
Definition: InstanceScript.h:57
Summons
Definition: boss_razorgore.cpp:55
@ DATA_RAGEWINTERCHILLEVENT
Definition: hyjal.h:47
@ DATA_RESET_RAIDDAMAGE
Definition: hyjal.h:55
@ DATA_KAZROGALEVENT
Definition: hyjal.h:45
@ DATA_AZGALOREVENT
Definition: hyjal.h:42
@ DATA_ANETHERONEVENT
Definition: hyjal.h:38
@ DEATH
Definition: hyjalAI.h:116
Talk
Definition: boss_fathomlord_karathress.cpp:25
void Respawn(bool force=false)
Definition: Creature.cpp:1974
void SetVisible(bool x)
Definition: Unit.cpp:14220
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:53
bool IsDummy
Definition: hyjalAI.h:192

References DATA_ANETHERONEVENT, DATA_AZGALOREVENT, DATA_KAZROGALEVENT, DATA_RAGEWINTERCHILLEVENT, DATA_RESET_RAIDDAMAGE, DEATH, DoRespawn, ZoneScript::GetData(), IN_PROGRESS, instance, IsDummy, ScriptedAI::me, NOT_STARTED, Creature::Respawn(), RespawnTimer, ZoneScript::SetData(), and Unit::SetVisible().

◆ JustEngagedWith()

void hyjalAI::JustEngagedWith ( Unit )
overridevirtual

Called for reaction when initially engaged.

Reimplemented from ScriptedAI.

424{
425 if (IsDummy)return;
426 for (uint8 i = 0; i < HYJAL_AI_MAX_SPELLS; ++i)
427 if (Spells[i].Cooldown)
428 SpellTimer[i] = Spells[i].Cooldown;
429
430 Talk(ATTACKED);
431}
Spells
Definition: BattlegroundIC.h:711
@ ATTACKED
Definition: hyjalAI.h:110
#define HYJAL_AI_MAX_SPELLS
Definition: hyjalAI.h:24
uint32 SpellTimer[3]
Definition: hyjalAI.h:205

References ATTACKED, HYJAL_AI_MAX_SPELLS, IsDummy, and SpellTimer.

◆ JustSummoned()

void hyjalAI::JustSummoned ( Creature summoned)
overridevirtual

Reimplemented from ScriptedAI.

337{
338 Summons.Summon(summoned);
339}

◆ MoveInLineOfSight()

void hyjalAI::MoveInLineOfSight ( Unit who)
overridevirtual

Reimplemented from npc_escortAI.

434{
435 if (IsDummy)
436 return;
437
439}
void MoveInLineOfSight(Unit *who) override
Definition: ScriptedEscortAI.cpp:135

References IsDummy, and npc_escortAI::MoveInLineOfSight().

◆ Reset()

void hyjalAI::Reset ( )
overridevirtual

Reimplemented from ScriptedAI.

347{
348 IsDummy = false;
349 me->setActive(true);
350 // GUIDs
352 BossGUID[0].Clear();
353 BossGUID[1].Clear();
354
355 // Timers
356 NextWaveTimer = 10000;
357 CheckTimer = 0;
358 RetreatTimer = 1000;
359
360 // Misc
361 WaveCount = 0;
362 EnemyCount = 0;
363
364 // Set faction properly based on Creature entry
365 switch (me->GetEntry())
366 {
367 case JAINA:
368 Faction = 0;
370 break;
371
372 case THRALL:
373 Faction = 1;
374 break;
375
376 case TYRANDE:
377 Faction = 2;
378 break;
379 }
380
381 //Bools
382 EventBegun = false;
383 FirstBossDead = false;
384 SecondBossDead = false;
385 Summon = false;
386 bRetreat = false;
387 Debug = false;
388
389 //Flags
391
392 //Initialize spells
393 memset(Spells, 0, sizeof(Spell) * HYJAL_AI_MAX_SPELLS);
394
395 //Reset Instance Data for trash count
397 {
398 //Reset World States
403 }
404
405 //Visibility
406 DoHide = true;
407}
@ UNIT_NPC_FLAG_GOSSIP
Definition: Unit.h:516
@ WORLD_STATE_WAVES
Definition: hyjal.h:61
@ WORLD_STATE_ENEMY
Definition: hyjal.h:62
@ WORLD_STATE_ENEMYCOUNT
Definition: hyjal.h:63
@ TYRANDE
Definition: hyjal.h:81
@ THRALL
Definition: hyjal.h:80
@ DATA_ALLIANCE_RETREAT
Definition: hyjal.h:52
@ DATA_RESET_TRASH_COUNT
Definition: hyjal.h:51
@ SPELL_BRILLIANCE_AURA
Definition: hyjalAI.h:32
void Clear()
Definition: ObjectGuid.h:140
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:1661
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:576
Definition: Spell.h:284
bool Debug
Definition: hyjalAI.h:178
bool FirstBossDead
Definition: hyjalAI.h:174
bool Summon
Definition: hyjalAI.h:176
uint32 CheckTimer
Definition: hyjalAI.h:168
bool SecondBossDead
Definition: hyjalAI.h:175
ObjectGuid BossGUID[2]
Definition: hyjalAI.h:163
uint32 EnemyCount
Definition: hyjalAI.h:170
uint32 NextWaveTimer
Definition: hyjalAI.h:166
bool EventBegun
Definition: hyjalAI.h:173
ObjectGuid PlayerGUID
Definition: hyjalAI.h:162
uint32 WaveCount
Definition: hyjalAI.h:167

References BossGUID, bRetreat, CheckTimer, ObjectGuid::Clear(), DATA_ALLIANCE_RETREAT, DATA_RESET_TRASH_COUNT, Debug, UnitAI::DoCast(), DoHide, InstanceScript::DoUpdateWorldState(), EnemyCount, EventBegun, Faction, FirstBossDead, ZoneScript::GetData(), Object::GetEntry(), HYJAL_AI_MAX_SPELLS, instance, IsDummy, JAINA, ScriptedAI::me, NextWaveTimer, PlayerGUID, RetreatTimer, SecondBossDead, WorldObject::setActive(), ZoneScript::SetData(), Unit::SetNpcFlag(), SPELL_BRILLIANCE_AURA, Summon, THRALL, TYRANDE, UNIT_NPC_FLAG_GOSSIP, WaveCount, WORLD_STATE_ENEMY, WORLD_STATE_ENEMYCOUNT, and WORLD_STATE_WAVES.

Referenced by npc_jaina_proudmoore::GetAI(), npc_thrall::GetAI(), and npc_tyrande_whisperwind::GetAI().

◆ RespawnNearPos()

void hyjalAI::RespawnNearPos ( float  x,
float  y 
)
919{
920 Acore::RespawnDo u_do;
923}
Definition: GridNotifiers.h:257
Definition: GridNotifiers.h:642

References WorldObject::GetGridActivationRange(), WorldObject::GetMap(), ScriptedAI::me, and Cell::VisitGridObjects().

Referenced by UpdateAI().

◆ Retreat()

void hyjalAI::Retreat ( )
605{
607
608 if (Faction == 0)
609 {
611 AddWaypoint(0, JainaWPs[0][0], JainaWPs[0][1], JainaWPs[0][2]);
612 AddWaypoint(1, JainaWPs[1][0], JainaWPs[1][1], JainaWPs[1][2]);
613 Start(false, false);
614 SetDespawnAtEnd(false);//move to center of alliance base
615 }
616 if (Faction == 1)
617 {
620 if (JainaDummy)
621 {
623 CAST_AI(hyjalAI, JainaDummy->AI())->IsDummy = true;
624 DummyGuid = JainaDummy->GetGUID();
625 }
627 Start(false, false);
628 SetDespawnAtEnd(false);//move to center of alliance base
629 }
630 SpawnVeins();
631 Overrun = true;
632 me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);//cant talk after overrun event started
633}
@ TEMPSUMMON_TIMED_DESPAWN
Definition: Object.h:44
@ SPECIAL
Definition: InstanceScript.h:61
@ TYPE_RETREAT
Definition: hyjal.h:56
@ DATA_HORDE_RETREAT
Definition: hyjal.h:53
float JainaWPs[2][3]
Definition: hyjalAI.cpp:76
float JainaDummySpawn[2][4]
Definition: hyjalAI.cpp:60
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
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime=0)
Definition: ScriptedEscortAI.cpp:396
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:1662
void SpawnVeins()
Definition: hyjalAI.cpp:635
ObjectGuid DummyGuid
Definition: hyjalAI.h:195

References npc_escortAI::AddWaypoint(), Creature::AI(), CAST_AI, DATA_ALLIANCE_RETREAT, DATA_HORDE_RETREAT, DummyGuid, Faction, Object::GetGUID(), instance, JAINA, JainaDummySpawn, JainaWPs, ScriptedAI::me, Overrun, Unit::RemoveNpcFlag(), ZoneScript::SetData(), npc_escortAI::SetDespawnAtEnd(), SpawnVeins(), SPECIAL, npc_escortAI::Start(), WorldObject::SummonCreature(), TEMPSUMMON_TIMED_DESPAWN, TYPE_RETREAT, and UNIT_NPC_FLAG_GOSSIP.

Referenced by npc_jaina_proudmoore::OnGossipSelect(), and npc_thrall::OnGossipSelect().

◆ SetFaction()

void hyjalAI::SetFaction ( uint32  _faction)
inline
134 {
135 Faction = _faction;
136 }

References Faction.

◆ SpawnVeins()

void hyjalAI::SpawnVeins ( )
636{
637 if (Faction == 0)
638 {
639 if (VeinsSpawned[0])//prevent any buggers
640 return;
641 for (uint8 i = 0; i < 7; ++i)
642 {
643 GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7], 0);
644 if (gem)
645 VeinGUID[i] = gem->GetGUID();
646 }
647 VeinsSpawned[0] = true;
648 }
649 else
650 {
651 if (VeinsSpawned[1])
652 return;
653 for (uint8 i = 7; i < 14; ++i)
654 {
655 GameObject* gem = me->SummonGameObject(GO_ANCIENT_VEIN, VeinPos[i][0], VeinPos[i][1], VeinPos[i][2], VeinPos[i][3], VeinPos[i][4], VeinPos[i][5], VeinPos[i][6], VeinPos[i][7], 0);
656 if (gem)
657 VeinGUID[i] = gem->GetGUID();
658 }
659 VeinsSpawned[1] = true;
660 }
661}
@ GO_ANCIENT_VEIN
Definition: hyjal.h:97
float VeinPos[14][8]
Definition: hyjalAI.cpp:124

References Faction, Object::GetGUID(), GO_ANCIENT_VEIN, ScriptedAI::me, WorldObject::SummonGameObject(), VeinGUID, VeinPos, and VeinsSpawned.

Referenced by Retreat().

◆ StartEvent()

◆ SummonCreature()

void hyjalAI::SummonCreature ( uint32  entry,
float  Base[4][3] 
)
442{
443 uint32 random = rand() % 4;
444 float SpawnLoc[3];
445
446 for (uint8 i = 0; i < 3; ++i)
447 {
448 SpawnLoc[i] = Base[random][i];
449 }
450 Creature* creature = nullptr;
451 switch (entry)
452 {
453 case 17906: //GARGOYLE
454
455 if (!FirstBossDead && (WaveCount == 1 || WaveCount == 3))
456 {
457 //summon at tower
459 if (creature)
460 CAST_AI(hyjal_trashAI, creature->AI())->useFlyPath = true;
461 }
462 else
463 {
464 //summon at gate
466 }
467 break;
468 case 17907: //FROST_WYRM,
469 if (FirstBossDead && WaveCount == 1) //summon at gate
471 else
472 {
474 if (creature)
475 CAST_AI(hyjal_trashAI, creature->AI())->useFlyPath = true;
476 }
477 break;
478 case 17908: //GIANT_INFERNAL
480 if (InfernalCount > 7)
481 InfernalCount = 0;
483 break;
484 default:
485 creature = me->SummonCreature(entry, SpawnLoc[0], SpawnLoc[1], SpawnLoc[2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
486 break;
487 }
488
489 if (creature)
490 {
491 // Increment Enemy Count to be used in World States and instance script
492 ++EnemyCount;
493
494 creature->SetWalk(false);
495 creature->setActive(true);
496 switch (entry)
497 {
498 case NECROMANCER:
499 case ABOMINATION:
500 case GHOUL:
501 case BANSHEE:
502 case CRYPT_FIEND:
503 case GARGOYLE:
504 case FROST_WYRM:
505 case GIANT_INFERNAL:
506 case FEL_STALKER:
507 case RAGE_WINTERCHILL:
508 case ANETHERON:
509 case KAZROGAL:
510 case AZGALOR:
511 CAST_AI(hyjal_trashAI, creature->AI())->IsEvent = true;
512 break;
513 }
515 creature->SetDisableReputationGain(true);//no repu for solo farming
516 // Check if Creature is a boss.
517 if (creature->isWorldBoss())
518 {
519 if (!FirstBossDead) BossGUID[0] = creature->GetGUID();
520 else BossGUID[1] = creature->GetGUID();
521 CheckTimer = 5000;
522 }
523 }
524}
std::uint32_t uint32
Definition: Define.h:108
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition: Object.h:42
@ KAZROGAL
Definition: hyjal.h:86
@ AZGALOR
Definition: hyjal.h:87
@ FEL_STALKER
Definition: hyjal.h:77
@ BANSHEE
Definition: hyjal.h:72
@ ANETHERON
Definition: hyjal.h:85
@ FROST_WYRM
Definition: hyjal.h:75
@ CRYPT_FIEND
Definition: hyjal.h:73
@ RAGE_WINTERCHILL
Definition: hyjal.h:84
@ NECROMANCER
Definition: hyjal.h:69
@ DATA_RAIDDAMAGE
Definition: hyjal.h:54
float InfernalPos[8][3]
Definition: hyjalAI.cpp:82
@ SPAWN_NEAR_TOWER
Definition: hyjalAI.cpp:38
@ SPAWN_GARG_GATE
Definition: hyjalAI.cpp:36
@ SPAWN_WYRM_GATE
Definition: hyjalAI.cpp:37
float SpawnPointSpecial[3][3]
Definition: hyjalAI.cpp:44
#define MINRAIDDAMAGE
Definition: hyjal_trash.h:24
const Position SpawnLoc[]
Definition: boss_slad_ran.cpp:63
bool isWorldBoss() const
Definition: Creature.h:116
void SetDisableReputationGain(bool disable)
Definition: Creature.h:353
bool SetWalk(bool enable) override
Definition: Creature.cpp:3098

References ABOMINATION, Creature::AI(), ANETHERON, AZGALOR, BANSHEE, BossGUID, CAST_AI, CheckTimer, CRYPT_FIEND, DATA_RAIDDAMAGE, EnemyCount, FEL_STALKER, FirstBossDead, FROST_WYRM, GARGOYLE, ZoneScript::GetData(), Object::GetGUID(), GHOUL, GIANT_INFERNAL, InfernalCount, InfernalPos, instance, irand(), Creature::isWorldBoss(), KAZROGAL, ScriptedAI::me, MINRAIDDAMAGE, NECROMANCER, RAGE_WINTERCHILL, WorldObject::setActive(), Creature::SetDisableReputationGain(), Creature::SetWalk(), SPAWN_GARG_GATE, SPAWN_NEAR_TOWER, SPAWN_WYRM_GATE, SpawnLoc, SpawnPointSpecial, WorldObject::SummonCreature(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, and WaveCount.

Referenced by SummonNextWave().

◆ SummonedCreatureDespawn()

void hyjalAI::SummonedCreatureDespawn ( Creature summoned)
overridevirtual

Reimplemented from ScriptedAI.

342{
343 Summons.Despawn(summoned);
344}

◆ SummonNextWave()

void hyjalAI::SummonNextWave ( const Wave  wave[18],
uint32  Count,
float  Base[4][3] 
)
527{
528 // 1 in 4 chance we give a rally yell. Not sure if the chance is offilike.
529 if (rand() % 4 == 0)
530 Talk(RALLY);
531
532 InfernalCount = 0;//reset infernal count every new wave
533
535 for (uint8 i = 0; i < 18; ++i)
536 {
537 if (wave[Count].Mob[i])
538 SummonCreature(wave[Count].Mob[i], Base);
539 }
540
541 if (!wave[Count].IsBoss)
542 {
543 uint32 stateValue = Count + 1;
544 if (FirstBossDead)
545 stateValue -= 9; // Subtract 9 from it to give the proper wave number if we are greater than 8
546
547 // Set world state to our current wave number
548 instance->DoUpdateWorldState(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number
549 // Enable world state
550 instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state
551
552 instance->SetData(DATA_TRASH, EnemyCount); // Send data for instance script to update count
553
554 if (!Debug)
556 else
557 {
558 NextWaveTimer = 15000;
559 //LOG_DEBUG("scripts", "HyjalAI: debug mode is enabled. Next Wave in 15 seconds");
560 }
561 }
562 else
563 {
564 // Set world state for waves to 0 to disable it.
567
568 // Set World State for enemies invading to 1.
570
571 Summon = false;
572 }
573 CheckTimer = 5000;
574}
@ DATA_TRASH
Definition: hyjal.h:50
@ RALLY
Definition: hyjalAI.h:113
size_t Count(const ContainerMapList< SPECIFIC_TYPE > &elements, SPECIFIC_TYPE *)
Definition: TypeContainerFunctions.h:162
uint32 WaveTimer
Definition: hyjalAI.h:45
void SummonCreature(uint32 entry, float Base[4][3])
Definition: hyjalAI.cpp:441

References CheckTimer, DATA_TRASH, Debug, InstanceScript::DoUpdateWorldState(), EnemyCount, FirstBossDead, ZoneScript::GetData(), InfernalCount, instance, NextWaveTimer, RALLY, ZoneScript::SetData(), Summon, SummonCreature(), Wave::WaveTimer, WORLD_STATE_ENEMY, WORLD_STATE_ENEMYCOUNT, and WORLD_STATE_WAVES.

Referenced by UpdateAI().

◆ UpdateAI()

void hyjalAI::UpdateAI ( uint32  diff)
overridevirtual

Reimplemented from npc_escortAI.

692{
693 if (IsDummy)
694 {
695 if (MassTeleportTimer < diff && DoMassTeleport)
696 {
698 DoMassTeleport = false;
699 }
700 else MassTeleportTimer -= diff;
701 return;
702 }
703 if (DoHide)
704 {
705 DoHide = false;
706 switch (me->GetEntry())
707 {
708 case JAINA:
710 {
711 me->SetVisible(false);
713 HideNearPos(5037.76f, -1889.71f);
714 for (uint8 i = 0; i < 92; ++i)//summon fires
716 }
717 else me->SetVisible(true);
718 break;
719 case THRALL: //thrall
721 {
722 me->SetVisible(false);
724 HideNearPos(5563, -2763.19f);
725 HideNearPos(5542.2f, -2629.36f);
726 for (uint8 i = 0; i < 65; ++i)//summon fires
728 }
729 else me->SetVisible(true);
730 break;
731 }
732 }
733 if (DoRespawn)
734 {
735 if (RespawnTimer <= diff)
736 {
737 DoRespawn = false;
739 if (Faction == 0)
740 {
741 RespawnNearPos(5037.76f, -1889.71f);
742 }
743 else if (Faction == 1)
744 {
745 RespawnNearPos(5563, -2763.19f);
746 RespawnNearPos(5542.2f, -2629.36f);
747 }
748 me->SetVisible(true);
749 }
750 else
751 {
752 RespawnTimer -= diff;
753 me->SetVisible(false);
754 }
755 return;
756 }
757 if (Overrun)
758 DoOverrun(Faction, diff);
759 if (bRetreat)
760 {
761 if (RetreatTimer <= diff)
762 {
763 IsDummy = true;
764 bRetreat = false;
766 switch (me->GetEntry())
767 {
768 case JAINA://jaina
769 HideNearPos(5037.76f, -1889.71f);
770 break;
771 case THRALL://thrall
772 HideNearPos(5563, -2763.19f);
773 HideNearPos(5542.2f, -2629.36f);
774 HideNearPos(5603.75f, -2853.12f);
775 break;
776 }
777 me->SetVisible(false);
778 }
779 else RetreatTimer -= diff;
780 }
781
782 if (!EventBegun)
783 return;
784
785 if (Summon)
786 {
787 if (EnemyCount)
788 {
790 if (!EnemyCount)
791 NextWaveTimer = 5000;
792 }
793
794 if (NextWaveTimer <= diff)
795 {
796 if (Faction == 0)
798 else if (Faction == 1)
800 ++WaveCount;
801 }
802 else NextWaveTimer -= diff;
803 }
804
805 if (CheckTimer <= diff)
806 {
807 for (uint8 i = 0; i < 2; ++i)
808 {
809 if (BossGUID[i])
810 {
812 if (unit && (!unit->IsAlive()))
813 {
814 if (BossGUID[i] == BossGUID[0])
815 {
816 Talk(INCOMING);
817 FirstBossDead = true;
818 }
819 else if (BossGUID[i] == BossGUID[1])
820 {
821 Talk(SUCCESS);
822 SecondBossDead = true;
823 }
824 EventBegun = false;
825 CheckTimer = 0;
827 BossGUID[i].Clear();
828 instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it
829 }
830 }
831 }
832 CheckTimer = 5000;
833 }
834 else CheckTimer -= diff;
835
836 if (!UpdateVictim())
837 return;
838
839 for (uint8 i = 0; i < HYJAL_AI_MAX_SPELLS; ++i)
840 {
841 if (Spells[i].SpellId)
842 {
843 if (SpellTimer[i] <= diff)
844 {
845 if (me->IsNonMeleeSpellCast(false))
847
848 Unit* target = nullptr;
849
850 switch (Spells[i].TargetType)
851 {
852 case TARGETTYPE_SELF:
853 target = me;
854 break;
855
857 target = SelectTarget(SelectTargetMethod::Random, 0);
858 break;
859
861 target = me->GetVictim();
862 break;
863 }
864
865 if (target && target->IsAlive())
866 {
867 DoCast(target, Spells[i].SpellId);
868 SpellTimer[i] = Spells[i].Cooldown;
869 }
870 }
871 else SpellTimer[i] -= diff;
872 }
873 }
874
876}
TargetType
Definition: hyjalAI.h:102
@ TARGETTYPE_RANDOM
Definition: hyjalAI.h:104
@ TARGETTYPE_SELF
Definition: hyjalAI.h:103
@ TARGETTYPE_VICTIM
Definition: hyjalAI.h:105
const Wave HordeWaves[]
Definition: hyjalAI.h:75
@ SPELL_MASS_TELEPORT
Definition: hyjalAI.h:29
const Wave AllianceWaves[]
Definition: hyjalAI.h:49
@ INCOMING
Definition: hyjalAI.h:112
@ SUCCESS
Definition: hyjalAI.h:115
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:39
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:110
bool UpdateVictim()
Definition: CreatureAI.cpp:268
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
Definition: Unit.h:1302
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4081
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:4051
Unit * GetVictim() const
Definition: Unit.h:1398
void RespawnNearPos(float x, float y)
Definition: hyjalAI.cpp:918
void SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3])
Definition: hyjalAI.cpp:526
void HideNearPos(float x, float y)
Definition: hyjalAI.cpp:899
void DoOverrun(uint32 faction, const uint32 diff)
Definition: hyjalAI.cpp:972

References AllianceBase, AllianceFirePos, AllianceWaves, BossGUID, bRetreat, CheckTimer, ObjectGuid::Clear(), DATA_ALLIANCE_RETREAT, DATA_HORDE_RETREAT, DATA_TRASH, UnitAI::DoCast(), DoHide, DoMassTeleport, UnitAI::DoMeleeAttackIfReady(), DoOverrun(), DoRespawn, InstanceScript::DoUpdateWorldState(), EnemyCount, EventBegun, Faction, FirstBossDead, ZoneScript::GetData(), Object::GetEntry(), Position::GetPositionX(), Position::GetPositionY(), ObjectAccessor::GetUnit(), Unit::GetVictim(), GO_ROARING_FLAME, HideNearPos(), HordeBase, HordeFirePos, HordeWaves, HYJAL_AI_MAX_SPELLS, INCOMING, instance, Unit::InterruptNonMeleeSpells(), Unit::IsAlive(), IsDummy, Unit::IsNonMeleeSpellCast(), JAINA, MassTeleportTimer, ScriptedAI::me, NextWaveTimer, Overrun, RespawnNearPos(), RespawnTimer, RetreatTimer, SecondBossDead, UnitAI::SelectTarget(), Unit::SetNpcFlag(), Unit::SetVisible(), SPELL_MASS_TELEPORT, SpellTimer, SUCCESS, Summon, WorldObject::SummonGameObject(), SummonNextWave(), TARGETTYPE_RANDOM, TARGETTYPE_SELF, TARGETTYPE_VICTIM, THRALL, UNIT_NPC_FLAG_GOSSIP, CreatureAI::UpdateVictim(), WaveCount, and WORLD_STATE_ENEMY.

◆ WaypointReached()

void hyjalAI::WaypointReached ( uint32  waypointId)
overridevirtual

Implements npc_escortAI.

926{
927 if (waypointId == 1 || (waypointId == 0 && me->GetEntry() == THRALL))
928 {
930 WaitForTeleport = true;
931 TeleportTimer = 20000;
932 if (me->GetEntry() == JAINA)
934 if (me->GetEntry() == THRALL && DummyGuid)
935 {
937 {
938 hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
939 ai->DoMassTeleport = true;
940 ai->MassTeleportTimer = 20000;
941 creature->CastSpell(me, SPELL_MASS_TELEPORT, false);
942 }
943 }
944 //do some talking
945 //all alive guards walk near here
946 // First get all creatures.
947 std::list<Creature*> creatures;
950 Cell::VisitGridObjects(me, creature_searcher, me->GetGridActivationRange());
951
952 if (!creatures.empty())
953 {
954 for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
955 {
956 if ((*itr) && (*itr)->IsAlive() && (*itr) != me && (*itr)->GetEntry() != JAINA)
957 {
958 if (!(*itr)->IsWithinDist(me, 60))
959 (*itr)->SetWalk(false);
960 float x, y, z;
961 (*itr)->SetDefaultMovementType(IDLE_MOTION_TYPE);
962 (*itr)->GetMotionMaster()->Initialize();
963 float range = 10;
964 if (me->GetEntry() == THRALL)range = 20;
965 me->GetNearPoint(me, x, y, z, range, 0, me->GetAngle((*itr)));
966 (*itr)->GetMotionMaster()->MovePoint(0, x + irand(-5, 5), y + irand(-5, 5), me->GetPositionZ());
967 }
968 }
969 }
970 }
971}
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:37
#define YELL_HURRY
Definition: hyjalAI.cpp:41
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
Definition: Object.cpp:2614
float GetPositionZ() const
Definition: Position.h:119
float GetAngle(const Position *pos) const
Definition: Position.cpp:77
virtual void Yell(std::string_view text, Language language, WorldObject const *target=nullptr)
Definition: Unit.cpp:21425

References CAST_AI, UnitAI::DoCast(), DoMassTeleport, DummyGuid, Position::GetAngle(), ObjectAccessor::GetCreature(), Object::GetEntry(), WorldObject::GetGridActivationRange(), WorldObject::GetNearPoint(), Position::GetPositionZ(), IDLE_MOTION_TYPE, irand(), JAINA, LANG_UNIVERSAL, MassTeleportTimer, ScriptedAI::me, SPELL_MASS_TELEPORT, TeleportTimer, THRALL, Cell::VisitGridObjects(), WaitForTeleport, Unit::Yell(), and YELL_HURRY.

Member Data Documentation

◆ BossGUID

ObjectGuid hyjalAI::BossGUID[2]

Referenced by Reset(), SummonCreature(), and UpdateAI().

◆ bRetreat

bool hyjalAI::bRetreat

Referenced by DoOverrun(), Reset(), and UpdateAI().

◆ CheckTimer

uint32 hyjalAI::CheckTimer

◆ Debug

◆ DoHide

bool hyjalAI::DoHide

Referenced by hyjalAI(), Reset(), and UpdateAI().

◆ DoMassTeleport

bool hyjalAI::DoMassTeleport

Referenced by hyjalAI(), UpdateAI(), and WaypointReached().

◆ DoRespawn

bool hyjalAI::DoRespawn

Referenced by hyjalAI(), JustDied(), and UpdateAI().

◆ DummyGuid

ObjectGuid hyjalAI::DummyGuid

Referenced by Retreat(), and WaypointReached().

◆ EnemyCount

uint32 hyjalAI::EnemyCount

◆ EventBegun

◆ Faction

◆ FirstBossDead

◆ InfernalCount

uint8 hyjalAI::InfernalCount

◆ InfernalPoint

uint32 hyjalAI::InfernalPoint

Referenced by hyjalAI().

◆ instance

◆ IsDummy

bool hyjalAI::IsDummy

◆ MassTeleportTimer

uint32 hyjalAI::MassTeleportTimer

Referenced by hyjalAI(), UpdateAI(), and WaypointReached().

◆ NextWaveTimer

uint32 hyjalAI::NextWaveTimer

◆ Overrun

bool hyjalAI::Overrun

Referenced by DoOverrun(), hyjalAI(), Retreat(), and UpdateAI().

◆ OverrunCounter

uint32 hyjalAI::OverrunCounter

Referenced by hyjalAI().

◆ OverrunCounter2

uint32 hyjalAI::OverrunCounter2

Referenced by hyjalAI().

◆ PlayerGUID

ObjectGuid hyjalAI::PlayerGUID

Referenced by Reset(), and StartEvent().

◆ RespawnTimer

uint32 hyjalAI::RespawnTimer

Referenced by hyjalAI(), JustDied(), and UpdateAI().

◆ RetreatTimer

uint32 hyjalAI::RetreatTimer

Referenced by DoOverrun(), Reset(), and UpdateAI().

◆ SecondBossDead

bool hyjalAI::SecondBossDead

Referenced by Reset(), and UpdateAI().

◆ Spells

◆ SpellTimer

uint32 hyjalAI::SpellTimer[3]
private

Referenced by JustEngagedWith(), and UpdateAI().

◆ Summon

bool hyjalAI::Summon

◆ Summons

SummonList hyjalAI::Summons

◆ Teleported

bool hyjalAI::Teleported

Referenced by DoOverrun(), and hyjalAI().

◆ TeleportTimer

uint32 hyjalAI::TeleportTimer

Referenced by DoOverrun(), hyjalAI(), and WaypointReached().

◆ VeinGUID

ObjectGuid hyjalAI::VeinGUID[14]

Referenced by DeSpawnVeins(), and SpawnVeins().

◆ VeinsSpawned

bool hyjalAI::VeinsSpawned[2]

Referenced by hyjalAI(), and SpawnVeins().

◆ WaitForTeleport

bool hyjalAI::WaitForTeleport

Referenced by DoOverrun(), hyjalAI(), and WaypointReached().

◆ WaveCount