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

Public Member Functions

 go_beaconAI (GameObject *gameObject)
 
void OnStateChanged (uint32 state, Unit *) 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 const &, 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 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 *)
 
virtual void SummonedCreatureEvade (Creature *)
 

Private Attributes

GuidList _whelpGUIDs
 

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_beaconAI()

go_beacon::go_beaconAI::go_beaconAI ( GameObject gameObject)
inlineexplicit
472: GameObjectAI(gameObject) { }
Definition GameObjectAI.h:33

Member Function Documentation

◆ OnStateChanged()

void go_beacon::go_beaconAI::OnStateChanged ( uint32  state,
Unit  
)
inlineoverridevirtual

Reimplemented from GameObjectAI.

475 {
476 if (state == GO_ACTIVATED)
477 {
478 std::list<Creature*> creatureList;
479
480 _whelpGUIDs.clear();
482
483 for (Creature* whelp : creatureList)
484 {
485 if (!whelp)
486 continue;
487
488 _whelpGUIDs.push_back(whelp->GetGUID());
489
490 MotionMaster* motionMaster = whelp->GetMotionMaster();
491 if (whelp->IsAlive() && !whelp->IsInCombat() && motionMaster && motionMaster->GetCurrentMovementGeneratorType() != HOME_MOTION_TYPE)
492 motionMaster->MovePoint(0, me->GetNearPosition(4.0f, whelp->GetOrientation()));
493 }
494 }
495 else if (state == GO_JUST_DEACTIVATED)
496 {
497 for (ObjectGuid const& guid : _whelpGUIDs)
498 {
499 if (Creature* whelp = ObjectAccessor::GetCreature(*me, guid))
500 {
501 MotionMaster* motionMaster = whelp->GetMotionMaster();
502 if (whelp->IsAlive() && !whelp->IsInCombat() && motionMaster && motionMaster->GetCurrentMovementGeneratorType() != HOME_MOTION_TYPE)
503 motionMaster->MoveTargetedHome();
504 }
505 }
506
507 _whelpGUIDs.clear();
508 }
509 else
510 {
511 _whelpGUIDs.clear();
512 }
513 }
@ GO_ACTIVATED
Definition GameObject.h:112
@ GO_JUST_DEACTIVATED
Definition GameObject.h:113
@ HOME_MOTION_TYPE
Definition MotionMaster.h:46
Definition Creature.h:47
GameObject *const me
Definition GameObjectAI.h:35
Definition MotionMaster.h:138
void MoveTargetedHome(bool walk=false)
The unit will return this initial position (owner for pets and summoned creatures)....
Definition MotionMaster.cpp:261
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition MotionMaster.cpp:961
void MovePoint(uint32 id, const Position &pos, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, float speed=0.f, bool generatePath=true, bool forceDestination=true, std::optional< AnimTier > animTier=std::nullopt)
Definition MotionMaster.h:240
Definition ObjectGuid.h:118
Position GetNearPosition(float dist, float angle)
Definition Object.cpp:2794
void GetCreaturesWithEntryInRange(std::list< Creature * > &creatureList, float radius, uint32 entry)
Definition Object.cpp:3060
Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:210
GuidList _whelpGUIDs
Definition zone_hellfire_peninsula.cpp:516
@ NPC_STONESCHYE_WHELP
Definition zone_hellfire_peninsula.cpp:462

References _whelpGUIDs, ObjectAccessor::GetCreature(), WorldObject::GetCreaturesWithEntryInRange(), MotionMaster::GetCurrentMovementGeneratorType(), WorldObject::GetNearPosition(), GO_ACTIVATED, GO_JUST_DEACTIVATED, HOME_MOTION_TYPE, GameObjectAI::me, MotionMaster::MovePoint(), MotionMaster::MoveTargetedHome(), and NPC_STONESCHYE_WHELP.

Member Data Documentation

◆ _whelpGUIDs

GuidList go_beacon::go_beaconAI::_whelpGUIDs
private

Referenced by OnStateChanged().


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