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
263 : GameObjectAI(gameObject)
264 {
265 requireSummon = 2;
266 }
Definition: GameObjectAI.h:34
uint8 requireSummon
Definition: go_scripts.cpp:268

References requireSummon.

Member Function Documentation

◆ GossipHello()

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

Reimplemented from GameObjectAI.

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

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.

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

References GO_READY, and requireSummon.

◆ SummonTadpoles()

void go_tadpole_cage::go_tadpole_cageAI::SummonTadpoles ( )
inline
271 {
272 requireSummon = 0;
273 int8 count = urand(1, 3);
274 for (int8 i = 0; i < count; ++i)
275 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);
276 }
std::int8_t int8
Definition: Define.h:105
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: Object.h:50
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:2355
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118

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.

285 {
286 if (me->isSpawned() && requireSummon == 2)
288 }
bool isSpawned() const
Definition: GameObject.h:190
void SummonTadpoles()
Definition: go_scripts.cpp:270

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

Member Data Documentation

◆ requireSummon

uint8 go_tadpole_cage::go_tadpole_cageAI::requireSummon