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

#include <hyjalAI.h>

Classes

struct  Spell
 

Public Member Functions

 hyjalAI (Creature *creature)
 
void Initialize ()
 
void Reset () override
 
void EnterEvadeMode (EvadeReason=EVADE_REASON_OTHER) override
 
void EnterCombat (Unit *) override
 
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 ()
 
void AttackStart (Unit *who) override
 
void JustRespawned () override
 
void ReturnToLastPoint ()
 
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 resetWaypointsOnFail=true)
 
bool GetWaypointPosition (uint32 pointId, float &x, float &y, float &z)
 
virtual void WaypointStart (uint32)
 
void Start (bool isActiveAttacker=true, bool run=false, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
 
void SetRun (bool on=true)
 
void SetEscortPaused (bool on)
 
bool HasEscortState (uint32 escortState)
 
virtual bool IsEscorted () const override
 
void SetMaxPlayerDistance (float newMax)
 
float GetMaxPlayerDistance () const
 
void SetDespawnAtEnd (bool despawn)
 
void SetDespawnAtFar (bool despawn)
 
bool GetAttack () const
 
void SetCanAttack (bool attack)
 
ObjectGuid GetEventStarterGUID () const
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
virtual ~ScriptedAI ()
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &) override
 
void KilledUnit (Unit *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void OnPossess (bool)
 
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 DoResetThreat ()
 
float DoGetThreat (Unit *unit)
 
void DoModifyThreatPercent (Unit *unit, int32 pct)
 
void DoTeleportTo (float x, float y, float z, uint32 time=0)
 
void DoTeleportTo (float const pos[4])
 
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 HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo constSelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, 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
 
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
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr)
 
 CreatureAI (Creature *creature)
 
virtual ~CreatureAI ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void AttackedBy (Unit *)
 
void OnCharmed (bool apply) override
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary constGetBoundary () const
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectAggroTarget targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectAggroTarget targetType, float dist=0.0f, bool playerOnly=false, int32 aura=0)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, PREDICATE const &predicate, uint32 maxTargets, SelectAggroTarget targetType)
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void SpellInterrupted (uint32, uint32)
 
void AttackStartCaster (Unit *victim, float dist)
 
void DoCast (uint32 spellId)
 
void DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
void DoCastVictim (uint32 spellId, bool triggered=false)
 
void DoCastAOE (uint32 spellId, bool triggered=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spellId)
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual bool sOnDummyEffect (Unit *, uint32, SpellEffIndex)
 
virtual void sOnGameEvent (bool, uint16)
 

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
bool IsFleeing
 

Private Attributes

uint32 SpellTimer [3]
 

Additional Inherited Members

- Public Types inherited from CreatureAI
enum  EvadeReason { EVADE_REASON_NO_HOSTILES, EVADE_REASON_BOUNDARY, EVADE_REASON_SEQUENCE_BREAK, EVADE_REASON_OTHER }
 
- Static Public 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 CheckBoundary (Position const *who=nullptr) const
 
void SetBoundary (CreatureBoundary const *boundary)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
CreatureBoundary const_boundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Constructor & Destructor Documentation

hyjalAI::hyjalAI ( Creature creature)
318  : npc_escortAI(creature), Summons(me)
319 {
320  Initialize();
321  instance = creature->GetInstanceScript();
322  VeinsSpawned[0] = false;
323  VeinsSpawned[1] = false;
324  InfernalCount = 0;
325  TeleportTimer = 1000;
326  Overrun = false;
327  Teleported = false;
328  WaitForTeleport = false;
329  OverrunCounter = 0;
330  OverrunCounter2 = 0;
331  InfernalPoint = 0;
332  RespawnTimer = 10000;
333  DoRespawn = false;
334  MassTeleportTimer = 0;
335  DoMassTeleport = false;
336 }
npc_escortAI(Creature *creature)
Definition: ScriptedEscortAI.cpp:37
uint32 RespawnTimer
Definition: hyjalAI.h:190
SummonList Summons
Definition: hyjalAI.h:182
uint32 TeleportTimer
Definition: hyjalAI.h:186
InstanceScript * instance
Definition: hyjalAI.h:161
InstanceScript * GetInstanceScript()
Definition: Object.cpp:1540
uint32 OverrunCounter2
Definition: hyjalAI.h:188
bool VeinsSpawned[2]
Definition: hyjalAI.h:180
uint32 MassTeleportTimer
Definition: hyjalAI.h:194
bool Overrun
Definition: hyjalAI.h:183
bool DoMassTeleport
Definition: hyjalAI.h:195
Creature *const me
Definition: CreatureAI.h:71
void Initialize()
Definition: hyjalAI.cpp:338
bool Teleported
Definition: hyjalAI.h:184
bool DoRespawn
Definition: hyjalAI.h:191
bool WaitForTeleport
Definition: hyjalAI.h:185
uint8 InfernalCount
Definition: hyjalAI.h:181
Definition: boss_prince_malchezaar.cpp:32
uint32 OverrunCounter
Definition: hyjalAI.h:187

+ Here is the call graph for this function:

Member Function Documentation

void hyjalAI::DeSpawnVeins ( )
674 {
675  if (Faction == 1)
676  {
678  if (!unit)return;
679  hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
680  if (!ai)return;
681  for (uint8 i = 0; i < 7; ++i)
682  {
683  if (GameObject* gem = instance->instance->GetGameObject(ai->VeinGUID[i]))
684  gem->Delete();
685  }
686  }
687  else if (Faction)
688  {
690  if (!unit)
691  return;
692  hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
693  if (!ai)
694  return;
695  for (uint8 i = 7; i < 14; ++i)
696  {
697  if (GameObject* gem = instance->instance->GetGameObject(ai->VeinGUID[i]))
698  gem->Delete();
699  }
700  }
701 }
InstanceScript * instance
Definition: hyjalAI.h:161
Definition: hyjal.h:34
Faction
Definition: boss_zum_rah.cpp:50
Definition: Creature.h:467
Creature *const me
Definition: CreatureAI.h:71
virtual ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:93
ObjectGuid VeinGUID[14]
Definition: hyjalAI.h:165
Definition: hyjalAI.h:118
#define CAST_AI(a, b)
Definition: ScriptedCreature.h:28
CreatureAI * AI() const
Definition: Creature.h:525
Map * instance
Definition: InstanceScript.h:148
Definition: GameObject.h:880
Definition: hyjal.h:39
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
uint8_t uint8
Definition: Define.h:152
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3545

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::DoOverrun ( uint32  faction,
const uint32  diff 
)
999 {
1000  npc_escortAI::UpdateAI(diff);
1001  if (WaitForTeleport)
1002  {
1003  if (TeleportTimer <= diff)
1004  {
1006  Cell cell(pair);
1007  cell.SetNoCreate();
1008 
1009  std::list<Creature*> creatures;
1010  Trinity::AllFriendlyCreaturesInGrid creature_check(me);
1011  Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
1014  GridTypeMapContainer> creature_visitor(creature_searcher);
1015 
1016  cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
1017 
1018  if (!creatures.empty())
1019  {
1020  for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
1021  {
1022  if ((*itr) && (*itr)->IsAlive())
1023  {
1024  (*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
1025  (*itr)->setFaction(35);//make them friendly so mobs won't attack them
1026  (*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
1027  }
1028  }
1030  bRetreat = true;
1031  RetreatTimer = 1000;
1032  }
1033 
1034  WaitForTeleport = false;
1035  Teleported = true;
1036  }TeleportTimer -= diff;
1037  }
1038  if (!Teleported)
1039  return;
1040  Overrun = false;//execute once
1041  switch (faction)
1042  {
1043  case 0://alliance
1044  for (uint8 i = 0; i < 92; ++i)//summon fires
1046 
1047  for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
1048  {
1049  uint8 r = rand32() % 4;
1050  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);
1051  if (unit)
1052  {
1053  ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1054  ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1055  ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1056  unit->setActive(true);
1057  }
1058  }
1059  for (uint8 i = 0; i < 3; ++i)//summon 3 abominations
1060  {
1061  uint8 r = rand32() % 4;
1062  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);
1063  if (unit)
1064  {
1065  ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1066  ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1067  ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1068  unit->setActive(true);
1069  }
1070  }
1071  for (uint8 i = 0; i < 5; ++i)//summon 5 gargoyles
1072  {
1074  if (unit)
1075  {
1077  ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1078  ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1079  ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1080  unit->setActive(true);
1081  }
1082  }
1083  break;
1084  case 1://horde
1085  for (uint8 i = 0; i < 65; ++i)//summon fires
1087 
1088  for (uint8 i = 0; i < 26; ++i)//summon infernals
1089  {
1091  if (unit)
1092  {
1093  unit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]);
1094  ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1095  ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1096  ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1097  unit->setActive(true);
1098  }
1099  }
1100  for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
1101  {
1102  uint8 r = rand32() % 4;
1103  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);
1104  if (unit)
1105  {
1106  ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1107  ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1108  ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1109  unit->setActive(true);
1110  }
1111  }
1112  for (uint8 i = 0; i < 5; ++i)//summon 5 abominations
1113  {
1114  uint8 r = rand32() % 4;
1115  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);
1116  if (unit)
1117  {
1118  ENSURE_AI(hyjal_trashAI, unit->AI())->faction = Faction;
1119  ENSURE_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
1120  ENSURE_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
1121  unit->setActive(true);
1122  }
1123  }
1124  break;
1125  }
1126 }
float GetGridActivationRange() const
Definition: Object.cpp:1902
Definition: hyjal.h:66
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
Definition: Object.cpp:2372
Definition: Object.h:61
uint32 TeleportTimer
Definition: hyjalAI.h:186
float AllianceFirePos[92][8]
Definition: hyjalAI.cpp:153
Definition: TypeContainerVisitor.h:32
Definition: Unit.h:674
Map * GetMap() const
Definition: Object.h:543
float InfernalSPWP[26][4]
Definition: hyjalAI.cpp:96
Faction
Definition: boss_zum_rah.cpp:50
void setActive(bool isActiveObject)
Definition: Object.cpp:1473
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
uint32 RetreatTimer
Definition: hyjalAI.h:172
Definition: hyjal.h:63
void SetHomePosition(float x, float y, float z, float o)
Definition: Creature.h:670
Definition: Creature.h:467
Definition: hyjal.h:62
Definition: TypeContainer.h:86
bool Overrun
Definition: hyjalAI.h:183
int32 irand(int32 min, int32 max)
Definition: Random.cpp:39
Creature *const me
Definition: CreatureAI.h:71
#define ENSURE_AI(a, b)
Definition: ScriptedCreature.h:29
void UpdateAI(uint32 diff) override
Definition: ScriptedEscortAI.cpp:227
float GetPositionY() const
Definition: Position.h:105
float AllianceBase[4][3]
Definition: hyjalAI.cpp:54
bool Teleported
Definition: hyjalAI.h:184
Definition: GridNotifiers.h:459
CreatureAI * AI() const
Definition: Creature.h:525
bool bRetreat
Definition: hyjalAI.h:178
Definition: GridNotifiers.h:1233
float HordeFirePos[65][8]
Definition: hyjalAI.cpp:249
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
bool WaitForTeleport
Definition: hyjalAI.h:185
Definition: Cell.h:49
Definition: hyjal.h:68
Definition: UpdateFields.h:109
Definition: hyjal_trash.h:24
float AllianceOverrunGargPos[5][4]
Definition: hyjalAI.cpp:144
uint32 rand32()
Definition: Random.cpp:64
uint8_t uint8
Definition: Define.h:152
float HordeBase[4][3]
Definition: hyjalAI.cpp:69
float GetPositionX() const
Definition: Position.h:104
Definition: chapter5.cpp:157
Definition: hyjal.h:91
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::EnterCombat ( Unit )
overridevirtual

Reimplemented from ScriptedAI.

435 {
436  if (IsDummy)return;
437  for (uint8 i = 0; i < HYJAL_AI_MAX_SPELLS; ++i)
438  if (Spells[i].Cooldown)
439  SpellTimer[i] = Spells[i].Cooldown;
440 
441  Talk(ATTACKED);
442 }
#define HYJAL_AI_MAX_SPELLS
Definition: hyjalAI.h:25
Spells
Definition: BattlegroundIC.h:707
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
uint32 SpellTimer[3]
Definition: hyjalAI.h:206
Definition: hyjalAI.h:109
bool IsDummy
Definition: hyjalAI.h:193
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

void hyjalAI::EnterEvadeMode ( EvadeReason  = EVADE_REASON_OTHER)
overridevirtual

Reimplemented from npc_escortAI.

421 {
422  if (me->GetEntry() != JAINA)
423  me->RemoveAllAuras();
424  me->DeleteThreatList();
425  me->CombatStop(true);
427 
428  if (me->IsAlive())
430 
432 }
void RemoveAllAuras()
Definition: Unit.cpp:3920
Definition: hyjal.h:71
MotionMaster * GetMotionMaster()
Definition: Unit.h:2101
void MoveTargetedHome()
Definition: MotionMaster.cpp:201
arena_t NULL
Definition: jemalloc_internal.h:624
void SetLootRecipient(Unit *unit)
Definition: Creature.cpp:993
Creature *const me
Definition: CreatureAI.h:71
bool IsAlive() const
Definition: Unit.h:1692
void DeleteThreatList()
Definition: Unit.cpp:10700
bool LoadCreaturesAddon()
Definition: Creature.cpp:2214
uint32 GetEntry() const
Definition: Object.h:107
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:7371

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 hyjalAI::GetInstanceData ( uint32  Event)
610 {
611  return instance->GetData(Event);
612 }
InstanceScript * instance
Definition: hyjalAI.h:161
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::HideNearPos ( float  x,
float  y 
)
908 {
910  Cell cell(pair);
911  cell.SetNoCreate();
912 
913  // First get all creatures.
914  std::list<Creature*> creatures;
915  Trinity::AllFriendlyCreaturesInGrid creature_check(me);
916  Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
917 
919  cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
920 
921  if (!creatures.empty())
922  {
923  for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
924  {
925  (*itr)->SetVisible(false);
926  (*itr)->setFaction(35);//make them friendly so mobs won't attack them
927  }
928  }
929 }
float GetGridActivationRange() const
Definition: Object.cpp:1902
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
Definition: TypeContainer.h:86
Creature *const me
Definition: CreatureAI.h:71
Definition: GridNotifiers.h:459
Definition: GridNotifiers.h:1233
G3D::int16 y
Definition: Vector2int16.h:38
Definition: Cell.h:49
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::Initialize ( void  )
339 {
340  IsDummy = false;
341 
342  // GUIDs
343  PlayerGUID.Clear();
344  BossGUID[0].Clear();
345  BossGUID[1].Clear();
346 
347  // Timers
348  NextWaveTimer = 10000;
349  CheckTimer = 0;
350  RetreatTimer = 1000;
351 
352  // Misc
353  WaveCount = 0;
354  EnemyCount = 0;
355 
356  //Bools
357  EventBegun = false;
358  FirstBossDead = false;
359  SecondBossDead = false;
360  Summon = false;
361  bRetreat = false;
362  Debug = false;
363 
364  //Visibility
365  DoHide = true;
366 
367  //Initialize spells
368  memset(Spells, 0, sizeof(Spell) * HYJAL_AI_MAX_SPELLS);
369 
370  Faction = 0;
371 }
bool EventBegun
Definition: hyjalAI.h:174
#define HYJAL_AI_MAX_SPELLS
Definition: hyjalAI.h:25
ObjectGuid BossGUID[2]
Definition: hyjalAI.h:164
bool SecondBossDead
Definition: hyjalAI.h:176
uint32 EnemyCount
Definition: hyjalAI.h:171
uint32 NextWaveTimer
Definition: hyjalAI.h:167
Spells
Definition: BattlegroundIC.h:707
Faction
Definition: boss_zum_rah.cpp:50
uint32 RetreatTimer
Definition: hyjalAI.h:172
bool FirstBossDead
Definition: hyjalAI.h:175
uint32 CheckTimer
Definition: hyjalAI.h:169
bool Debug
Definition: hyjalAI.h:179
bool bRetreat
Definition: hyjalAI.h:178
bool DoHide
Definition: hyjalAI.h:192
void Clear()
Definition: ObjectGuid.h:215
bool IsDummy
Definition: hyjalAI.h:193
bool Summon
Definition: hyjalAI.h:177
uint32 WaveCount
Definition: hyjalAI.h:168
ObjectGuid PlayerGUID
Definition: hyjalAI.h:163
Definition: Spell.h:294

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::JustDied ( Unit )
overridevirtual

Reimplemented from npc_escortAI.

887 {
888  if (IsDummy)return;
889  me->Respawn();
890  me->SetVisible(false);
891  DoRespawn = true;
892  RespawnTimer = 120000;
893  Talk(DEATH);
894  Summons.DespawnAll();//despawn all wave's summons
895  //reset encounter if boss is despawned (ex: thrall is killed, boss despawns, event stucks at inprogress)
904  instance->SetData(DATA_RESET_RAIDDAMAGE, 0);//reset damage on die
905 }
uint32 RespawnTimer
Definition: hyjalAI.h:190
InstanceScript * instance
Definition: hyjalAI.h:161
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51
Definition: hyjal.h:38
Creature *const me
Definition: CreatureAI.h:71
Definition: hyjal.h:46
Definition: InstanceScript.h:59
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52
Definition: hyjal.h:29
Definition: InstanceScript.h:58
void SetVisible(bool x)
Definition: Unit.cpp:10368
bool DoRespawn
Definition: hyjalAI.h:191
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
Definition: hyjal.h:33
void Respawn(bool force=false)
Definition: Creature.cpp:1697
Definition: hyjal.h:36
bool IsDummy
Definition: hyjalAI.h:193
Definition: hyjalAI.h:115
Definition: boss_urom.cpp:72

+ Here is the call graph for this function:

void hyjalAI::JustSummoned ( Creature summoned)
overridevirtual

Reimplemented from ScriptedAI.

374 {
375  Summons.Summon(summoned);
376 }
Definition: boss_urom.cpp:72
void hyjalAI::MoveInLineOfSight ( Unit who)
overridevirtual

Reimplemented from npc_escortAI.

445 {
446  if (IsDummy)
447  return;
448 
450 }
bool IsDummy
Definition: hyjalAI.h:193
void MoveInLineOfSight(Unit *who) override
Definition: ScriptedEscortAI.cpp:106

+ Here is the call graph for this function:

void hyjalAI::Reset ( )
overridevirtual

Reimplemented from ScriptedAI.

384 {
385  me->setActive(true);
386 
387  Initialize();
388 
389  // Set faction properly based on Creature entry
390  switch (me->GetEntry())
391  {
392  case JAINA:
393  Faction = 0;
395  break;
396 
397  case THRALL:
398  Faction = 1;
399  break;
400 
401  case TYRANDE:
402  Faction = 2;
403  break;
404  }
405 
406  //Flags
408 
409  //Reset Instance Data for trash count
411  {
412  //Reset World States
417  }
418 }
Definition: hyjal.h:43
Definition: Unit.h:735
Definition: hyjal.h:71
Definition: hyjal.h:72
InstanceScript * instance
Definition: hyjalAI.h:161
Definition: hyjal.h:54
Faction
Definition: boss_zum_rah.cpp:50
void setActive(bool isActiveObject)
Definition: Object.cpp:1473
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51
Definition: hyjalAI.h:33
Definition: hyjal.h:53
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
Creature *const me
Definition: CreatureAI.h:71
void Initialize()
Definition: hyjalAI.cpp:338
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:473
Definition: hyjal.h:55
Definition: UpdateFields.h:135
Definition: hyjal.h:73
uint32 GetEntry() const
Definition: Object.h:107
Definition: hyjal.h:42

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::RespawnNearPos ( float  x,
float  y 
)
932 {
934  Cell cell(p);
935  cell.SetNoCreate();
936 
937  Trinity::RespawnDo u_do;
940  cell.Visit(p, obj_worker, *me->GetMap(), *me, me->GetGridActivationRange());
941 }
float GetGridActivationRange() const
Definition: Object.cpp:1902
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
Definition: TypeContainer.h:86
Definition: GridNotifiers.h:613
Creature *const me
Definition: CreatureAI.h:71
G3D::int16 y
Definition: Vector2int16.h:38
Definition: Cell.h:49
Definition: GridNotifiers.h:239
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::Retreat ( )
615 {
617 
618  if (Faction == 0)
619  {
621  AddWaypoint(0, JainaWPs[0][0], JainaWPs[0][1], JainaWPs[0][2]);
622  AddWaypoint(1, JainaWPs[1][0], JainaWPs[1][1], JainaWPs[1][2]);
623  Start(false, false);
624  SetDespawnAtEnd(false);//move to center of alliance base
625  }
626  if (Faction == 1)
627  {
630  if (JainaDummy)
631  {
633  ENSURE_AI(hyjalAI, JainaDummy->AI())->IsDummy = true;
634  DummyGuid = JainaDummy->GetGUID();
635  }
637  Start(false, false);
638  SetDespawnAtEnd(false);//move to center of alliance base
639  }
640  SpawnVeins();
641  Overrun = true;
642  me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);//cant talk after overrun event started
643 }
void SetDespawnAtEnd(bool despawn)
Definition: ScriptedEscortAI.h:102
Definition: hyjal.h:43
Definition: Unit.h:735
Definition: hyjal.h:71
float JainaDummySpawn[2][4]
Definition: hyjalAI.cpp:62
InstanceScript * instance
Definition: hyjalAI.h:161
void Start(bool isActiveAttacker=true, bool run=false, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
Definition: ScriptedEscortAI.cpp:438
Faction
Definition: boss_zum_rah.cpp:50
void SpawnVeins()
Definition: hyjalAI.cpp:645
float JainaWPs[2][3]
Definition: hyjalAI.cpp:78
Definition: Creature.h:467
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime=0)
Definition: ScriptedEscortAI.cpp:385
bool Overrun
Definition: hyjalAI.h:183
Creature *const me
Definition: CreatureAI.h:71
#define ENSURE_AI(a, b)
Definition: ScriptedCreature.h:29
Definition: hyjalAI.h:118
Definition: Object.h:56
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52
CreatureAI * AI() const
Definition: Creature.h:525
Definition: InstanceScript.h:62
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool IsDummy
Definition: hyjalAI.h:193
Definition: UpdateFields.h:135
Definition: hyjal.h:44
ObjectGuid DummyGuid
Definition: hyjalAI.h:196
Definition: hyjal.h:47
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::SetFaction ( uint32  _faction)
inline
135  {
136  Faction = _faction;
137  }
Faction
Definition: boss_zum_rah.cpp:50
void hyjalAI::SpawnVeins ( )
646 {
647  if (Faction == 0)
648  {
649  if (VeinsSpawned[0])//prevent any buggers
650  return;
651  for (uint8 i = 0; i < 7; ++i)
652  {
653  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);
654  if (gem)
655  VeinGUID[i]=gem->GetGUID();
656  }
657  VeinsSpawned[0] = true;
658  }
659  else
660  {
661  if (VeinsSpawned[1])
662  return;
663  for (uint8 i = 7; i < 14; ++i)
664  {
665  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);
666  if (gem)
667  VeinGUID[i] = gem->GetGUID();
668  }
669  VeinsSpawned[1] = true;
670  }
671 }
Definition: hyjal.h:90
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
Definition: Object.cpp:2372
Faction
Definition: boss_zum_rah.cpp:50
bool VeinsSpawned[2]
Definition: hyjalAI.h:180
Creature *const me
Definition: CreatureAI.h:71
ObjectGuid VeinGUID[14]
Definition: hyjalAI.h:165
Definition: GameObject.h:880
float VeinPos[14][8]
Definition: hyjalAI.cpp:126
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::StartEvent ( Player player)
587 {
588  if (!player || IsDummy || !instance)
589  return;
590 
591  Talk(BEGIN);
592 
593  EventBegun = true;
594  Summon = true;
595 
596  NextWaveTimer = 15000;
597  CheckTimer = 5000;
598  PlayerGUID = player->GetGUID();
599 
601 
605 
606  DeSpawnVeins();
607 }
bool EventBegun
Definition: hyjalAI.h:174
Definition: Unit.h:735
InstanceScript * instance
Definition: hyjalAI.h:161
Definition: hyjal.h:54
uint32 NextWaveTimer
Definition: hyjalAI.h:167
Definition: hyjal.h:53
uint32 CheckTimer
Definition: hyjalAI.h:169
void DeSpawnVeins()
Definition: hyjalAI.cpp:673
Creature *const me
Definition: CreatureAI.h:71
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:473
Definition: hyjalAI.h:110
bool IsDummy
Definition: hyjalAI.h:193
bool Summon
Definition: hyjalAI.h:177
Definition: hyjal.h:55
Definition: UpdateFields.h:135
ObjectGuid PlayerGUID
Definition: hyjalAI.h:163

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::SummonCreature ( uint32  entry,
float  Base[4][3] 
)
453 {
454  uint32 random = rand32() % 4;
455  float SpawnLoc[3];
456 
457  for (uint8 i = 0; i < 3; ++i)
458  {
459  SpawnLoc[i] = Base[random][i];
460  }
461  Creature* creature = NULL;
462  switch (entry)
463  {
464  case 17906: //GARGOYLE
465 
466  if (!FirstBossDead && (WaveCount == 1 || WaveCount == 3))
467  {//summon at tower
469  if (creature)
470  ENSURE_AI(hyjal_trashAI, creature->AI())->useFlyPath = true;
471  }
472  else
473  {//summon at gate
475  }
476  break;
477  case 17907: //FROST_WYRM,
478  if (FirstBossDead && WaveCount == 1) //summon at gate
479  creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_WYRM_GATE][0], SpawnPointSpecial[SPAWN_WYRM_GATE][1], SpawnPointSpecial[SPAWN_WYRM_GATE][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
480  else
481  {
482  creature = me->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0], SpawnPointSpecial[SPAWN_NEAR_TOWER][1], SpawnPointSpecial[SPAWN_NEAR_TOWER][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
483  if (creature)
484  ENSURE_AI(hyjal_trashAI, creature->AI())->useFlyPath = true;
485  }
486  break;
487  case 17908: //GIANT_INFERNAL
488  ++InfernalCount;
489  if (InfernalCount > 7)
490  InfernalCount = 0;
491  creature = me->SummonCreature(entry, InfernalPos[InfernalCount][0], InfernalPos[InfernalCount][1], InfernalPos[InfernalCount][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
492  break;
493  default:
494  creature = me->SummonCreature(entry, SpawnLoc[0], SpawnLoc[1], SpawnLoc[2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
495  break;
496 
497  }
498 
499  if (creature)
500  {
501  // Increment Enemy Count to be used in World States and instance script
502  ++EnemyCount;
503 
504  creature->SetWalk(false);
505  creature->setActive(true);
506  switch (entry)
507  {
508  case NECROMANCER:
509  case ABOMINATION:
510  case GHOUL:
511  case BANSHEE:
512  case CRYPT_FIEND:
513  case GARGOYLE:
514  case FROST_WYRM:
515  case GIANT_INFERNAL:
516  case FEL_STALKER:
517  case RAGE_WINTERCHILL:
518  case ANETHERON:
519  case KAZROGAL:
520  case AZGALOR:
521  ENSURE_AI(hyjal_trashAI, creature->AI())->IsEvent = true;
522  break;
523  }
525  creature->SetDisableReputationGain(true);//no repu for solo farming
526  // Check if Creature is a boss.
527  if (creature->isWorldBoss())
528  {
529  if (!FirstBossDead) BossGUID[0] = creature->GetGUID();
530  else BossGUID[1] = creature->GetGUID();
531  CheckTimer = 5000;
532  }
533  }
534 }
Definition: hyjal.h:66
Definition: hyjal.h:69
ObjectGuid BossGUID[2]
Definition: hyjalAI.h:164
Definition: hyjal.h:76
Definition: hyjal.h:79
uint32 EnemyCount
Definition: hyjalAI.h:171
InstanceScript * instance
Definition: hyjalAI.h:161
Definition: hyjal.h:61
void setActive(bool isActiveObject)
Definition: Object.cpp:1473
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51
Definition: hyjal.h:63
arena_t NULL
Definition: jemalloc_internal.h:624
bool FirstBossDead
Definition: hyjalAI.h:175
Definition: Creature.h:467
void SetDisableReputationGain(bool disable)
Definition: Creature.h:692
Definition: hyjal.h:62
uint32 CheckTimer
Definition: hyjalAI.h:169
Definition: hyjalAI.cpp:39
int32 irand(int32 min, int32 max)
Definition: Random.cpp:39
Creature *const me
Definition: CreatureAI.h:71
#define ENSURE_AI(a, b)
Definition: ScriptedCreature.h:29
static Position SpawnLoc[]
Definition: boss_slad_ran.cpp:57
Definition: hyjalAI.cpp:38
Definition: hyjal.h:67
Definition: hyjal.h:77
CreatureAI * AI() const
Definition: Creature.h:525
Definition: hyjal.h:45
Definition: hyjalAI.cpp:40
uint32_t uint32
Definition: Define.h:150
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: hyjal.h:78
float SpawnPointSpecial[3][3]
Definition: hyjalAI.cpp:46
float InfernalPos[8][3]
Definition: hyjalAI.cpp:84
Definition: hyjal.h:68
uint8 InfernalCount
Definition: hyjalAI.h:181
uint32 WaveCount
Definition: hyjalAI.h:168
Definition: hyjal.h:65
Definition: hyjal_trash.h:24
bool SetWalk(bool enable)
Definition: Unit.cpp:15800
uint32 rand32()
Definition: Random.cpp:64
uint8_t uint8
Definition: Define.h:152
bool isWorldBoss() const
Definition: Creature.cpp:1833
#define MINRAIDDAMAGE
Definition: hyjal.h:94
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346
Definition: hyjal.h:64
Definition: Object.h:54

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::SummonedCreatureDespawn ( Creature summoned)
overridevirtual

Reimplemented from ScriptedAI.

379 {
380  Summons.Despawn(summoned);
381 }
Definition: boss_urom.cpp:72
void hyjalAI::SummonNextWave ( const Wave  wave[18],
uint32  Count,
float  Base[4][3] 
)
537 {
538  // 1 in 4 chance we give a rally yell. Not sure if the chance is offilike.
539  if (rand32() % 4 == 0)
540  Talk(RALLY);
541 
542  InfernalCount = 0;//reset infernal count every new wave
543 
545  for (uint8 i = 0; i < 18; ++i)
546  {
547  if (wave[Count].Mob[i])
548  SummonCreature(wave[Count].Mob[i], Base);
549  }
550 
551  if (!wave[Count].IsBoss)
552  {
553  uint32 stateValue = Count+1;
554  if (FirstBossDead)
555  stateValue -= 9; // Subtract 9 from it to give the proper wave number if we are greater than 8
556 
557  // Set world state to our current wave number
558  instance->DoUpdateWorldState(WORLD_STATE_WAVES, stateValue); // Set world state to our current wave number
559  // Enable world state
560  instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 1); // Enable world state
561 
562  instance->SetData(DATA_TRASH, EnemyCount); // Send data for instance script to update count
563 
564  if (!Debug)
565  NextWaveTimer = wave[Count].WaveTimer;
566  else
567  {
568  NextWaveTimer = 15000;
569  TC_LOG_DEBUG("scripts", "HyjalAI: debug mode is enabled. Next Wave in 15 seconds");
570  }
571  }
572  else
573  {
574  // Set world state for waves to 0 to disable it.
577 
578  // Set World State for enemies invading to 1.
580 
581  Summon = false;
582  }
583  CheckTimer = 5000;
584 }
uint32 EnemyCount
Definition: hyjalAI.h:171
InstanceScript * instance
Definition: hyjalAI.h:161
Definition: hyjal.h:54
uint32 NextWaveTimer
Definition: hyjalAI.h:167
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51
bool FirstBossDead
Definition: hyjalAI.h:175
Definition: hyjal.h:53
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: hyjal.h:41
uint32 CheckTimer
Definition: hyjalAI.h:169
bool Debug
Definition: hyjalAI.h:179
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:52
uint32_t uint32
Definition: Define.h:150
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:473
uint8 InfernalCount
Definition: hyjalAI.h:181
bool Summon
Definition: hyjalAI.h:177
uint32 WaveTimer
Definition: hyjalAI.h:46
Definition: hyjal.h:55
uint32 rand32()
Definition: Random.cpp:64
uint8_t uint8
Definition: Define.h:152
void SummonCreature(uint32 entry, float Base[4][3])
Definition: hyjalAI.cpp:452
Definition: hyjalAI.h:112

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hyjalAI::UpdateAI ( uint32  diff)
overridevirtual

Reimplemented from npc_escortAI.

704 {
705  if (IsDummy)
706  {
707  if (MassTeleportTimer < diff && DoMassTeleport)
708  {
709  DoCast(me, SPELL_MASS_TELEPORT, false);
710  DoMassTeleport = false;
711  }
712  else
713  MassTeleportTimer -= diff;
714  return;
715  }
716  if (DoHide)
717  {
718  DoHide = false;
719  switch (me->GetEntry())
720  {
721  case JAINA:
723  {
724  me->SetVisible(false);
726  HideNearPos(5037.76f, -1889.71f);
727  for (uint8 i = 0; i < 92; ++i)//summon fires
729 
730  }
731  else me->SetVisible(true);
732  break;
733  case THRALL: //thrall
735  {
736  me->SetVisible(false);
738  HideNearPos(5563, -2763.19f);
739  HideNearPos(5542.2f, -2629.36f);
740  for (uint8 i = 0; i < 65; ++i)//summon fires
742 
743  }
744  else me->SetVisible(true);
745  break;
746  }
747  }
748  if (DoRespawn)
749  {
750  if (RespawnTimer <= diff)
751  {
752  DoRespawn = false;
754  if (Faction == 0)
755  {
756  RespawnNearPos(5037.76f, -1889.71f);
757  } else if (Faction == 1)
758  {
759  RespawnNearPos(5563, -2763.19f);
760  RespawnNearPos(5542.2f, -2629.36f);
761  }
762  me->SetVisible(true);
763  }else{
764  RespawnTimer -= diff;
765  me->SetVisible(false);
766  }
767  return;
768  }
769  if (Overrun)
770  DoOverrun(Faction, diff);
771  if (bRetreat)
772  {
773  if (RetreatTimer <= diff)
774  {
775  IsDummy = true;
776  bRetreat = false;
778  switch (me->GetEntry())
779  {
780  case JAINA://jaina
781  HideNearPos(5037.76f, -1889.71f);
782  break;
783  case THRALL://thrall
784  HideNearPos(5563, -2763.19f);
785  HideNearPos(5542.2f, -2629.36f);
786  HideNearPos(5603.75f, -2853.12f);
787  break;
788  }
789  me->SetVisible(false);
790  } else RetreatTimer -= diff;
791  }
792 
793  if (!EventBegun)
794  return;
795 
796  if (Summon)
797  {
798  if (EnemyCount)
799  {
801  if (!EnemyCount)
802  NextWaveTimer = 5000;
803  }
804 
805  if (NextWaveTimer <= diff)
806  {
807  if (Faction == 0)
809  else if (Faction == 1)
811  ++WaveCount;
812  } else NextWaveTimer -= diff;
813  }
814 
815  if (CheckTimer <= diff)
816  {
817  for (uint8 i = 0; i < 2; ++i)
818  {
819  if (!BossGUID[i].IsEmpty())
820  {
821  Unit* unit = ObjectAccessor::GetUnit(*me, BossGUID[i]);
822  if (unit && (!unit->IsAlive()))
823  {
824  if (BossGUID[i] == BossGUID[0])
825  {
826  Talk(INCOMING);
827  FirstBossDead = true;
828  }
829  else if (BossGUID[i] == BossGUID[1])
830  {
831  Talk(SUCCESS);
832  SecondBossDead = true;
833  }
834  EventBegun = false;
835  CheckTimer = 0;
837  BossGUID[i].Clear();
838  instance->DoUpdateWorldState(WORLD_STATE_ENEMY, 0); // Reset world state for enemies to disable it
839  }
840  }
841  }
842  CheckTimer = 5000;
843  } else CheckTimer -= diff;
844 
845  if (!UpdateVictim())
846  return;
847 
848  for (uint8 i = 0; i < HYJAL_AI_MAX_SPELLS; ++i)
849  {
850  if (Spells[i].SpellId)
851  {
852  if (SpellTimer[i] <= diff)
853  {
854  if (me->IsNonMeleeSpellCast(false))
855  me->InterruptNonMeleeSpells(false);
856 
857  Unit* target = NULL;
858 
859  switch (Spells[i].TargetType)
860  {
861  case TARGETTYPE_SELF:
862  target = me;
863  break;
864 
865  case TARGETTYPE_RANDOM:
866  target = SelectTarget(SELECT_TARGET_RANDOM, 0);
867  break;
868 
869  case TARGETTYPE_VICTIM:
870  target = me->GetVictim();
871  break;
872  }
873 
874  if (target && target->IsAlive())
875  {
876  DoCast(target, Spells[i].SpellId);
877  SpellTimer[i] = Spells[i].Cooldown;
878  }
879  } else SpellTimer[i] -= diff;
880  }
881  }
882 
884 }
bool EventBegun
Definition: hyjalAI.h:174
#define HYJAL_AI_MAX_SPELLS
Definition: hyjalAI.h:25
uint32 RespawnTimer
Definition: hyjalAI.h:190
ObjectGuid BossGUID[2]
Definition: hyjalAI.h:164
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
Definition: Object.cpp:2372
Definition: hyjal.h:43
Definition: Unit.h:735
bool SecondBossDead
Definition: hyjalAI.h:176
float AllianceFirePos[92][8]
Definition: hyjalAI.cpp:153
Definition: hyjal.h:71
Definition: hyjal.h:72
bool UpdateVictim()
Definition: CreatureAI.cpp:233
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
uint32 EnemyCount
Definition: hyjalAI.h:171
InstanceScript * instance
Definition: hyjalAI.h:161
Definition: hyjal.h:54
uint32 NextWaveTimer
Definition: hyjalAI.h:167
Spells
Definition: BattlegroundIC.h:707
Faction
Definition: boss_zum_rah.cpp:50
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51
uint32 RetreatTimer
Definition: hyjalAI.h:172
arena_t NULL
Definition: jemalloc_internal.h:624
bool FirstBossDead
Definition: hyjalAI.h:175
const Wave AllianceWaves[]
Definition: hyjalAI.h:50
const Wave HordeWaves[]
Definition: hyjalAI.h:75
Definition: hyjal.h:41
void SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3])
Definition: hyjalAI.cpp:536
uint32 MassTeleportTimer
Definition: hyjalAI.h:194
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:2886
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
uint32 CheckTimer
Definition: hyjalAI.h:169
bool Overrun
Definition: hyjalAI.h:183
Definition: hyjalAI.h:114
bool DoMassTeleport
Definition: hyjalAI.h:195
Definition: hyjalAI.h:30
Creature *const me
Definition: CreatureAI.h:71
Definition: UnitAI.h:35
Definition: hyjalAI.h:103
bool IsAlive() const
Definition: Unit.h:1692
Unit * GetVictim() const
Definition: Unit.h:1379
float GetPositionY() const
Definition: Position.h:105
TargetType
Definition: hyjalAI.h:100
float AllianceBase[4][3]
Definition: hyjalAI.cpp:54
bool bRetreat
Definition: hyjalAI.h:178
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition: UnitAI.cpp:91
bool DoHide
Definition: hyjalAI.h:192
void SetVisible(bool x)
Definition: Unit.cpp:10368
bool DoRespawn
Definition: hyjalAI.h:191
float HordeFirePos[65][8]
Definition: hyjalAI.cpp:249
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:42
Definition: hyjalAI.h:111
void Clear()
Definition: ObjectGuid.h:215
uint32 SpellTimer[3]
Definition: hyjalAI.h:206
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:473
void DoOverrun(uint32 faction, const uint32 diff)
Definition: hyjalAI.cpp:998
bool IsDummy
Definition: hyjalAI.h:193
bool Summon
Definition: hyjalAI.h:177
uint32 WaveCount
Definition: hyjalAI.h:168
void RespawnNearPos(float x, float y)
Definition: hyjalAI.cpp:931
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:2916
Definition: hyjalAI.h:102
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:49
uint8_t uint8
Definition: Define.h:152
Definition: UpdateFields.h:135
uint32 GetEntry() const
Definition: Object.h:107
Definition: hyjal.h:44
float HordeBase[4][3]
Definition: hyjalAI.cpp:69
Definition: hyjalAI.h:104
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:1305
Definition: hyjal.h:91
void HideNearPos(float x, float y)
Definition: hyjalAI.cpp:907

+ Here is the call graph for this function:

void hyjalAI::WaypointReached ( uint32  waypointId)
overridevirtual

Implements npc_escortAI.

944 {
945  if (waypointId == 1 || (waypointId == 0 && me->GetEntry() == THRALL))
946  {
948  WaitForTeleport = true;
949  TeleportTimer = 20000;
950  if (me->GetEntry() == JAINA)
951  DoCast(me, SPELL_MASS_TELEPORT, false);
952  if (me->GetEntry() == THRALL && !DummyGuid.IsEmpty())
953  {
955  {
956  hyjalAI* ai = ENSURE_AI(hyjalAI, creature->AI());
957  ai->DoMassTeleport = true;
958  ai->MassTeleportTimer = 20000;
959  creature->CastSpell(me, SPELL_MASS_TELEPORT, false);
960  }
961  }
962  //do some talking
963  //all alive guards walk near here
965  Cell cell(pair);
966  cell.SetNoCreate();
967 
968  // First get all creatures.
969  std::list<Creature*> creatures;
970  Trinity::AllFriendlyCreaturesInGrid creature_check(me);
971  Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
974  GridTypeMapContainer> creature_visitor(creature_searcher);
975 
976  cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
977 
978  if (!creatures.empty())
979  {
980  for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
981  {
982  if ((*itr) && (*itr)->IsAlive() && (*itr) != me && (*itr)->GetEntry() != JAINA)
983  {
984  if (!(*itr)->IsWithinDist(me, 60))
985  (*itr)->SetWalk(false);
986  float x, y, z;
987  (*itr)->SetDefaultMovementType(IDLE_MOTION_TYPE);
988  (*itr)->GetMotionMaster()->Initialize();
989  float range = 10;
990  if (me->GetEntry() == THRALL)range = 20;
991  me->GetNearPoint(me, x, y, z, range, 0, me->GetAngle((*itr)));
992  (*itr)->GetMotionMaster()->MovePoint(0, x+irand(-5, 5), y+irand(-5, 5), me->GetPositionZ());
993  }
994  }
995  }
996  }
997 }
float GetGridActivationRange() const
Definition: Object.cpp:1902
Definition: MotionMaster.h:37
uint32 TeleportTimer
Definition: hyjalAI.h:186
Definition: TypeContainerVisitor.h:32
Definition: hyjal.h:71
Definition: SharedDefines.h:961
Definition: hyjal.h:72
Map * GetMap() const
Definition: Object.h:543
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
Definition: Creature.h:467
uint32 MassTeleportTimer
Definition: hyjalAI.h:194
Definition: TypeContainer.h:86
bool DoMassTeleport
Definition: hyjalAI.h:195
int32 irand(int32 min, int32 max)
Definition: Random.cpp:39
Definition: hyjalAI.h:30
Creature *const me
Definition: CreatureAI.h:71
#define YELL_HURRY
Definition: hyjalAI.cpp:43
#define ENSURE_AI(a, b)
Definition: ScriptedCreature.h:29
Definition: hyjalAI.h:118
float GetPositionY() const
Definition: Position.h:105
G3D::int16 z
Definition: Vector3int16.h:46
Definition: GridNotifiers.h:459
float GetPositionZ() const
Definition: Position.h:106
float GetAngle(Position const *pos) const
Definition: Position.cpp:63
Definition: GridNotifiers.h:1233
G3D::int16 y
Definition: Vector2int16.h:38
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
bool WaitForTeleport
Definition: hyjalAI.h:185
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
Definition: Cell.h:49
virtual void Yell(std::string const &text, Language language, WorldObject const *target=nullptr)
Definition: Unit.cpp:16398
uint32 GetEntry() const
Definition: Object.h:107
G3D::int16 x
Definition: Vector2int16.h:37
ObjectGuid DummyGuid
Definition: hyjalAI.h:196
float GetPositionX() const
Definition: Position.h:104
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const
Definition: Object.cpp:2587
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

Member Data Documentation

ObjectGuid hyjalAI::BossGUID[2]
bool hyjalAI::bRetreat
uint32 hyjalAI::CheckTimer
bool hyjalAI::Debug
bool hyjalAI::DoHide
bool hyjalAI::DoMassTeleport
bool hyjalAI::DoRespawn
ObjectGuid hyjalAI::DummyGuid
uint32 hyjalAI::EnemyCount
bool hyjalAI::EventBegun
uint32 hyjalAI::Faction
bool hyjalAI::FirstBossDead
uint8 hyjalAI::InfernalCount
uint32 hyjalAI::InfernalPoint
InstanceScript* hyjalAI::instance
bool hyjalAI::IsDummy
uint32 hyjalAI::MassTeleportTimer
uint32 hyjalAI::NextWaveTimer
bool hyjalAI::Overrun
uint32 hyjalAI::OverrunCounter
uint32 hyjalAI::OverrunCounter2
ObjectGuid hyjalAI::PlayerGUID
uint32 hyjalAI::RespawnTimer
uint32 hyjalAI::RetreatTimer
bool hyjalAI::SecondBossDead
struct hyjalAI::Spell hyjalAI::Spells[HYJAL_AI_MAX_SPELLS]
uint32 hyjalAI::SpellTimer[3]
private
bool hyjalAI::Summon
SummonList hyjalAI::Summons
bool hyjalAI::Teleported
uint32 hyjalAI::TeleportTimer
ObjectGuid hyjalAI::VeinGUID[14]
bool hyjalAI::VeinsSpawned[2]
bool hyjalAI::WaitForTeleport
uint32 hyjalAI::WaveCount

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