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

Public Member Functions

 npc_fireworkAI (Creature *creature)
 
bool isCluster ()
 
GameObjectFindNearestLauncher ()
 
uint32 GetFireworkSpell (uint32 entry)
 
uint32 GetFireworkGameObjectId ()
 
void Reset () override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
virtual ~ScriptedAI ()
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &) override
 
virtual 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 OnPossess (bool)
 
void EnterCombat (Unit *) override
 
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 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 EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void IsSummonedBy (Unit *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted () const
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
void OnCharmed (bool apply) override
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false) const
 
virtual bool CheckInRoom ()
 
CreatureBoundary constGetBoundary () const
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
virtual void 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)
 

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 ()
 
- Public Attributes inherited from ScriptedAI
bool IsFleeing
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
CreatureDoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
bool CheckBoundary (Position const *who=nullptr) const
 
void SetBoundary (CreatureBoundary const *boundary)
 
virtual void MoveInLineOfSight (Unit *)
 
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

npc_firework::npc_fireworkAI::npc_fireworkAI ( Creature creature)
inline
2021 : ScriptedAI(creature) { }
ScriptedAI(Creature *creature)
Definition: ScriptedCreature.cpp:100

Member Function Documentation

GameObject* npc_firework::npc_fireworkAI::FindNearestLauncher ( )
inline
2059  {
2060  GameObject* launcher = NULL;
2061 
2062  if (isCluster())
2063  {
2068 
2069  if (launcher1)
2070  launcher = launcher1;
2071  else if (launcher2)
2072  launcher = launcher2;
2073  else if (launcher3)
2074  launcher = launcher3;
2075  else if (launcher4)
2076  launcher = launcher4;
2077  }
2078  else
2079  {
2083 
2084  if (launcher1)
2085  launcher = launcher1;
2086  else if (launcher2)
2087  launcher = launcher2;
2088  else if (launcher3)
2089  launcher = launcher3;
2090  }
2091 
2092  return launcher;
2093  }
Definition: npcs_special.cpp:1986
Definition: npcs_special.cpp:1988
Definition: npcs_special.cpp:1990
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: npcs_special.cpp:1992
Creature *const me
Definition: CreatureAI.h:71
Definition: npcs_special.cpp:1989
Definition: npcs_special.cpp:1987
Definition: GameObject.h:880
bool isCluster()
Definition: npcs_special.cpp:2023
Definition: npcs_special.cpp:1991
TC_GAME_API GameObject * GetClosestGameObjectWithEntry(WorldObject *source, uint32 entry, float maxSearchRange)
Definition: ScriptedCreature.cpp:616

+ Here is the call graph for this function:

uint32 npc_firework::npc_fireworkAI::GetFireworkGameObjectId ( )
inline
2129  {
2130  uint32 spellId = 0;
2131 
2132  switch (me->GetEntry())
2133  {
2134  case NPC_CLUSTER_BLUE:
2136  break;
2137  case NPC_CLUSTER_GREEN:
2139  break;
2140  case NPC_CLUSTER_PURPLE:
2142  break;
2143  case NPC_CLUSTER_RED:
2145  break;
2146  case NPC_CLUSTER_YELLOW:
2148  break;
2149  case NPC_CLUSTER_WHITE:
2151  break;
2152  case NPC_CLUSTER_BIG_BLUE:
2154  break;
2155  case NPC_CLUSTER_BIG_GREEN:
2157  break;
2160  break;
2161  case NPC_CLUSTER_BIG_RED:
2163  break;
2166  break;
2167  case NPC_CLUSTER_BIG_WHITE:
2169  break;
2170  case NPC_CLUSTER_ELUNE:
2172  break;
2173  }
2174 
2175  const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
2176 
2177  if (spellInfo && spellInfo->GetEffect(EFFECT_0)->Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD)
2178  return spellInfo->GetEffect(EFFECT_0)->MiscValue;
2179 
2180  return 0;
2181  }
int32 MiscValue
Definition: SpellInfo.h:253
Definition: npcs_special.cpp:1963
Definition: npcs_special.cpp:1965
Definition: npcs_special.cpp:1960
Definition: npcs_special.cpp:1964
Definition: npcs_special.cpp:1973
Definition: npcs_special.cpp:1977
Definition: SpellInfo.h:326
Definition: npcs_special.cpp:1961
Definition: npcs_special.cpp:1972
Definition: SharedDefines.h:28
Definition: npcs_special.cpp:1976
Definition: npcs_special.cpp:1968
Definition: npcs_special.cpp:1974
Creature *const me
Definition: CreatureAI.h:71
Definition: npcs_special.cpp:1966
Definition: SharedDefines.h:1086
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
Definition: npcs_special.cpp:1959
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
Definition: npcs_special.cpp:1982
Definition: npcs_special.cpp:1979
SpellEffectInfo const * GetEffect(uint32 difficulty, uint32 index) const
Definition: SpellInfo.cpp:3348
Definition: npcs_special.cpp:1984
Definition: npcs_special.cpp:1975
Definition: npcs_special.cpp:1962
Definition: npcs_special.cpp:1983
uint32 GetFireworkSpell(uint32 entry)
Definition: npcs_special.cpp:2095
uint32 GetEntry() const
Definition: Object.h:107
Definition: npcs_special.cpp:1969
uint32 Effect
Definition: SpellInfo.h:243
Definition: npcs_special.cpp:1970
Definition: npcs_special.cpp:1967
Definition: npcs_special.cpp:1980
Definition: npcs_special.cpp:1978
Definition: npcs_special.cpp:1981

+ Here is the call graph for this function:

uint32 npc_firework::npc_fireworkAI::GetFireworkSpell ( uint32  entry)
inline
2096  {
2097  switch (entry)
2098  {
2099  case NPC_FIREWORK_BLUE:
2100  return SPELL_ROCKET_BLUE;
2101  case NPC_FIREWORK_GREEN:
2102  return SPELL_ROCKET_GREEN;
2103  case NPC_FIREWORK_PURPLE:
2104  return SPELL_ROCKET_PURPLE;
2105  case NPC_FIREWORK_RED:
2106  return SPELL_ROCKET_RED;
2107  case NPC_FIREWORK_YELLOW:
2108  return SPELL_ROCKET_YELLOW;
2109  case NPC_FIREWORK_WHITE:
2110  return SPELL_ROCKET_WHITE;
2111  case NPC_FIREWORK_BIG_BLUE:
2112  return SPELL_ROCKET_BIG_BLUE;
2114  return SPELL_ROCKET_BIG_GREEN;
2116  return SPELL_ROCKET_BIG_PURPLE;
2117  case NPC_FIREWORK_BIG_RED:
2118  return SPELL_ROCKET_BIG_RED;
2120  return SPELL_ROCKET_BIG_YELLOW;
2122  return SPELL_ROCKET_BIG_WHITE;
2123  default:
2124  return 0;
2125  }
2126  }
Definition: npcs_special.cpp:1963
Definition: npcs_special.cpp:1965
Definition: npcs_special.cpp:1960
Definition: npcs_special.cpp:1964
Definition: npcs_special.cpp:1961
Definition: npcs_special.cpp:1997
Definition: npcs_special.cpp:2003
Definition: npcs_special.cpp:1968
Definition: npcs_special.cpp:1999
Definition: npcs_special.cpp:1994
Definition: npcs_special.cpp:1996
Definition: npcs_special.cpp:1966
Definition: npcs_special.cpp:1995
Definition: npcs_special.cpp:1959
Definition: npcs_special.cpp:2001
Definition: npcs_special.cpp:1998
Definition: npcs_special.cpp:2004
Definition: npcs_special.cpp:2005
Definition: npcs_special.cpp:1962
Definition: npcs_special.cpp:2000
Definition: npcs_special.cpp:1969
Definition: npcs_special.cpp:2002
Definition: npcs_special.cpp:1970
Definition: npcs_special.cpp:1967
bool npc_firework::npc_fireworkAI::isCluster ( )
inline
2024  {
2025  switch (me->GetEntry())
2026  {
2027  case NPC_FIREWORK_BLUE:
2028  case NPC_FIREWORK_GREEN:
2029  case NPC_FIREWORK_PURPLE:
2030  case NPC_FIREWORK_RED:
2031  case NPC_FIREWORK_YELLOW:
2032  case NPC_FIREWORK_WHITE:
2033  case NPC_FIREWORK_BIG_BLUE:
2036  case NPC_FIREWORK_BIG_RED:
2039  return false;
2040  case NPC_CLUSTER_BLUE:
2041  case NPC_CLUSTER_GREEN:
2042  case NPC_CLUSTER_PURPLE:
2043  case NPC_CLUSTER_RED:
2044  case NPC_CLUSTER_YELLOW:
2045  case NPC_CLUSTER_WHITE:
2046  case NPC_CLUSTER_BIG_BLUE:
2047  case NPC_CLUSTER_BIG_GREEN:
2049  case NPC_CLUSTER_BIG_RED:
2051  case NPC_CLUSTER_BIG_WHITE:
2052  case NPC_CLUSTER_ELUNE:
2053  default:
2054  return true;
2055  }
2056  }
Definition: npcs_special.cpp:1963
Definition: npcs_special.cpp:1965
Definition: npcs_special.cpp:1960
Definition: npcs_special.cpp:1964
Definition: npcs_special.cpp:1973
Definition: npcs_special.cpp:1977
Definition: npcs_special.cpp:1961
Definition: npcs_special.cpp:1972
Definition: npcs_special.cpp:1976
Definition: npcs_special.cpp:1968
Definition: npcs_special.cpp:1974
Creature *const me
Definition: CreatureAI.h:71
Definition: npcs_special.cpp:1966
Definition: npcs_special.cpp:1959
Definition: npcs_special.cpp:1982
Definition: npcs_special.cpp:1979
Definition: npcs_special.cpp:1984
Definition: npcs_special.cpp:1975
Definition: npcs_special.cpp:1962
Definition: npcs_special.cpp:1983
uint32 GetEntry() const
Definition: Object.h:107
Definition: npcs_special.cpp:1969
Definition: npcs_special.cpp:1970
Definition: npcs_special.cpp:1967
Definition: npcs_special.cpp:1980
Definition: npcs_special.cpp:1978
Definition: npcs_special.cpp:1981
void npc_firework::npc_fireworkAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

2184  {
2185  if (GameObject* launcher = FindNearestLauncher())
2186  {
2187  launcher->SendCustomAnim(ANIM_GO_LAUNCH_FIREWORK);
2188  me->SetOrientation(launcher->GetOrientation() + float(M_PI) / 2);
2189  }
2190  else
2191  return;
2192 
2193  if (isCluster())
2194  {
2195  // Check if we are near Elune'ara lake south, if so try to summon Omen or a minion
2196  if (me->GetZoneId() == ZONE_MOONGLADE)
2197  {
2199  {
2200  switch (urand(0, 9))
2201  {
2202  case 0:
2203  case 1:
2204  case 2:
2205  case 3:
2206  if (Creature* minion = me->SummonCreature(NPC_MINION_OF_OMEN, me->GetPositionX()+frand(-5.0f, 5.0f), me->GetPositionY()+frand(-5.0f, 5.0f), me->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000))
2207  minion->AI()->AttackStart(me->SelectNearestPlayer(20.0f));
2208  break;
2209  case 9:
2211  break;
2212  }
2213  }
2214  }
2215  if (me->GetEntry() == NPC_CLUSTER_ELUNE)
2217 
2218  float displacement = 0.7f;
2219  for (uint8 i = 0; i < 4; i++)
2220  me->SummonGameObject(GetFireworkGameObjectId(), me->GetPositionX() + (i%2 == 0 ? displacement : -displacement), me->GetPositionY() + (i > 1 ? displacement : -displacement), me->GetPositionZ() + 4.0f, me->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 1);
2221  }
2222  else
2223  //me->CastSpell(me, GetFireworkSpell(me->GetEntry()), true);
2225  }
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: npcs_special.cpp:2006
Definition: npcs_special.cpp:2009
#define M_PI
Definition: Common.h:163
void SetOrientation(float orientation)
Definition: Position.h:99
double frand()
Definition: Vector3.cpp:170
uint32 GetZoneId() const
Definition: Object.cpp:1525
Player * SelectNearestPlayer(float distance=0) const
Definition: Creature.cpp:1998
Position omenSummonPos
Definition: npcs_special.cpp:2012
Definition: Creature.h:467
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2443
GameObject * FindNearestLauncher()
Definition: npcs_special.cpp:2058
Creature *const me
Definition: CreatureAI.h:71
Definition: npcs_special.cpp:1957
float GetOrientation() const
Definition: Position.h:107
Definition: npcs_special.cpp:2008
float GetPositionY() const
Definition: Position.h:105
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
float GetPositionZ() const
Definition: Position.h:106
void DoCast(uint32 spellId)
Definition: UnitAI.cpp:101
Definition: GameObject.h:880
Definition: npcs_special.cpp:1984
float GetDistance2d(WorldObject const *obj) const
Definition: Object.cpp:1612
Definition: Object.h:59
uint8_t uint8
Definition: Define.h:152
uint32 GetFireworkSpell(uint32 entry)
Definition: npcs_special.cpp:2095
bool isCluster()
Definition: npcs_special.cpp:2023
uint32 GetEntry() const
Definition: Object.h:107
float GetPositionX() const
Definition: Position.h:104
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: npcs_special.cpp:1958
uint32 GetFireworkGameObjectId()
Definition: npcs_special.cpp:2128
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:


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