AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
go_flames::go_flamesAI Struct Reference
Inheritance diagram for go_flames::go_flamesAI:
GameObjectAI

Public Member Functions

 go_flamesAI (GameObject *gameObject)
 
void UpdateAI (uint32 diff) override
 
- Public Member Functions inherited from GameObjectAI
 GameObjectAI (GameObject *go)
 
virtual ~GameObjectAI ()
 
virtual void UpdateAI (uint32)
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void DoAction (int32)
 
virtual void SetGUID (ObjectGuid, int32)
 
virtual ObjectGuid GetGUID (int32) const
 
virtual bool GossipHello (Player *, bool)
 
virtual bool GossipSelect (Player *, uint32, uint32)
 
virtual bool GossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual bool QuestAccept (Player *, Quest const *)
 
virtual bool QuestReward (Player *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *)
 
virtual void Destroyed (Player *, uint32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void OnGameEvent (bool, uint16)
 
virtual void OnStateChanged (uint32, Unit *)
 
virtual void EventInform (uint32)
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual void JustSummoned (Creature *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 

Private Attributes

uint32 timer
 

Additional Inherited Members

- Static Public Member Functions inherited from GameObjectAI
static int32 Permissible (GameObject const *go)
 
- Protected Attributes inherited from GameObjectAI
GameObject *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ go_flamesAI()

go_flames::go_flamesAI::go_flamesAI ( GameObject gameObject)
inline
328 : GameObjectAI(gameObject),
329 timer { 0 }
330 { }
Definition: GameObjectAI.h:34
uint32 timer
Definition: go_scripts.cpp:354

Member Function Documentation

◆ UpdateAI()

void go_flames::go_flamesAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from GameObjectAI.

333 {
334 timer += diff;
335 if (timer > 3000)
336 {
337 timer = 0;
338 std::list<Player*> players;
341 Cell::VisitWorldObjects(me, searcher, 0.3f);
342
343 if (players.size() > 0)
344 {
345 std::list<Player*>::iterator itr = players.begin();
346 std::advance(itr, urand(0, players.size() - 1));
347 if (Creature* trigger = me->SummonTrigger((*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ(), 0, 2000, true))
348 trigger->CastSpell(trigger, SPELL_FLAMES);
349 }
350 }
351 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ SPELL_FLAMES
Definition: go_scripts.cpp:318
GameObject *const me
Definition: GameObjectAI.h:36
Definition: Creature.h:46
Creature * SummonTrigger(float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
Definition: Object.cpp:2392
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:193
Definition: GridNotifiers.h:522

References GameObjectAI::me, SPELL_FLAMES, WorldObject::SummonTrigger(), timer, urand(), and Cell::VisitWorldObjects().

Member Data Documentation

◆ timer

uint32 go_flames::go_flamesAI::timer
private

Referenced by UpdateAI().