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

Public Member Functions

 go_tadpole_cageAI (GameObject *gameObject)
 
void SummonTadpoles ()
 
void OnStateChanged (uint32 state, Unit *) override
 
void UpdateAI (uint32) override
 
bool GossipHello (Player *player, bool) 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 *)
 
virtual void SummonedCreatureEvade (Creature *)
 

Public Attributes

uint8 requireSummon
 

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

go_tadpole_cage::go_tadpole_cageAI::go_tadpole_cageAI ( GameObject gameObject)
inline
262 : GameObjectAI(gameObject)
263 {
264 requireSummon = 2;
265 }
Definition: GameObjectAI.h:33
uint8 requireSummon
Definition: go_scripts.cpp:267

References requireSummon.

Member Function Documentation

◆ GossipHello()

bool go_tadpole_cage::go_tadpole_cageAI::GossipHello ( Player player,
bool   
)
inlineoverridevirtual

Reimplemented from GameObjectAI.

290 {
291 if (requireSummon)
292 return false;
293
294 requireSummon = 1;
296 {
297 std::list<Creature*> cList;
299 for (std::list<Creature*>::const_iterator itr = cList.begin(); itr != cList.end(); ++itr)
300 {
302 (*itr)->DespawnOrUnsummon(urand(45000, 60000));
303 (*itr)->GetMotionMaster()->MoveFollow(player, 1.0f, frand(0.0f, 2 * M_PI), MOTION_SLOT_CONTROLLED);
304 }
305 }
306 return false;
307 }
float frand(float min, float max)
Definition: Random.cpp:57
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ NPC_WINTERFIN_TADPOLE
Definition: go_scripts.cpp:252
@ QUEST_OH_NOES_THE_TADPOLES
Definition: go_scripts.cpp:251
void GetCreatureListWithEntryInGrid(std::list< Creature * > &list, WorldObject *source, uint32 entry, float maxSearchRange)
Definition: ScriptedCreature.cpp:860
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
@ MOTION_SLOT_CONTROLLED
Definition: MotionMaster.h:65
GameObject *const me
Definition: GameObjectAI.h:35
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: PlayerQuest.cpp:1926
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1429

References frand(), GetCreatureListWithEntryInGrid(), Player::GetQuestStatus(), Player::KilledMonsterCredit(), GameObjectAI::me, MOTION_SLOT_CONTROLLED, NPC_WINTERFIN_TADPOLE, QUEST_OH_NOES_THE_TADPOLES, QUEST_STATUS_INCOMPLETE, requireSummon, and urand().

◆ OnStateChanged()

void go_tadpole_cage::go_tadpole_cageAI::OnStateChanged ( uint32  state,
Unit  
)
inlineoverridevirtual

Reimplemented from GameObjectAI.

278 {
279 if (requireSummon == 1 && state == GO_READY)
280 requireSummon = 2;
281 }
@ GO_READY
Definition: GameObject.h:111

References GO_READY, and requireSummon.

◆ SummonTadpoles()

void go_tadpole_cage::go_tadpole_cageAI::SummonTadpoles ( )
inline
270 {
271 requireSummon = 0;
272 int8 count = urand(1, 3);
273 for (int8 i = 0; i < count; ++i)
274 me->SummonCreature(NPC_WINTERFIN_TADPOLE, me->GetPositionX() + cos(2 * M_PI * i / 3.0f) * 0.60f, me->GetPositionY() + std::sin(2 * M_PI * i / 3.0f) * 0.60f, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
275 }
std::int8_t int8
Definition: Define.h:105
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: Object.h:51
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:2366
float GetPositionZ() const
Definition: Position.h:118
float GetOrientation() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GameObjectAI::me, NPC_WINTERFIN_TADPOLE, requireSummon, WorldObject::SummonCreature(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, and urand().

Referenced by UpdateAI().

◆ UpdateAI()

void go_tadpole_cage::go_tadpole_cageAI::UpdateAI ( uint32  )
inlineoverridevirtual

Reimplemented from GameObjectAI.

284 {
285 if (me->isSpawned() && requireSummon == 2)
287 }
bool isSpawned() const
Definition: GameObject.h:189
void SummonTadpoles()
Definition: go_scripts.cpp:269

References GameObject::isSpawned(), GameObjectAI::me, requireSummon, and SummonTadpoles().

Member Data Documentation

◆ requireSummon

uint8 go_tadpole_cage::go_tadpole_cageAI::requireSummon