AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
SmartGameObjectAI Class Reference

#include "SmartAI.h"

Inheritance diagram for SmartGameObjectAI:
GameObjectAI

Public Member Functions

 SmartGameObjectAI (GameObject *g)
 
 ~SmartGameObjectAI () override
 
void UpdateAI (uint32 diff) override
 
void InitializeAI () override
 
void Reset () override
 
SmartScriptGetScript ()
 
bool GossipHello (Player *player, bool reportUse) override
 
bool GossipSelect (Player *player, uint32 sender, uint32 action) override
 
bool GossipSelectCode (Player *, uint32, uint32, const char *) override
 
bool QuestAccept (Player *player, Quest const *quest) override
 
bool QuestReward (Player *player, Quest const *quest, uint32 opt) override
 
void Destroyed (Player *player, uint32 eventId) override
 
void SetData (uint32 id, uint32 value) override
 
void SetData (uint32 id, uint32 value, WorldObject *invoker)
 
void SetScript9 (SmartScriptHolder &e, uint32 entry, WorldObject *invoker)
 
void OnGameEvent (bool start, uint16 eventId) override
 
void OnStateChanged (uint32 state, Unit *unit) override
 
void EventInform (uint32 eventId) override
 
void SpellHit (Unit *unit, SpellInfo const *spellInfo) override
 
void JustSummoned (Creature *creature) override
 
void SummonedCreatureDespawn (Creature *unit) override
 
void SummonedCreatureDies (Creature *summon, Unit *killer) override
 
void SummonedCreatureEvade (Creature *summon) 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 *)
 

Static Public Member Functions

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

Protected Attributes

SmartScript mScript
 
- Protected Attributes inherited from GameObjectAI
GameObject *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ SmartGameObjectAI()

SmartGameObjectAI::SmartGameObjectAI ( GameObject g)
inline
266: GameObjectAI(g) {}
Definition: GameObjectAI.h:34

◆ ~SmartGameObjectAI()

SmartGameObjectAI::~SmartGameObjectAI ( )
inlineoverride
267{}

Member Function Documentation

◆ Destroyed()

void SmartGameObjectAI::Destroyed ( Player player,
uint32  eventId 
)
overridevirtual

Reimplemented from GameObjectAI.

1244{
1245 GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, player, eventId, 0, false, nullptr, me);
1246}
@ SMART_EVENT_DEATH
Definition: SmartScriptMgr.h:125
GameObject *const me
Definition: GameObjectAI.h:36
SmartScript * GetScript()
Definition: SmartAI.h:272
void ProcessEventsFor(SMART_EVENT e, Unit *unit=nullptr, uint32 var0=0, uint32 var1=0, bool bvar=false, SpellInfo const *spell=nullptr, GameObject *gob=nullptr)
Definition: SmartScript.cpp:134

References GetScript(), GameObjectAI::me, SmartScript::ProcessEventsFor(), and SMART_EVENT_DEATH.

◆ EventInform()

void SmartGameObjectAI::EventInform ( uint32  eventId)
overridevirtual

Reimplemented from GameObjectAI.

1281{
1283}
@ SMART_EVENT_GO_EVENT_INFORM
Definition: SmartScriptMgr.h:190

References GetScript(), SmartScript::ProcessEventsFor(), and SMART_EVENT_GO_EVENT_INFORM.

◆ GetScript()

◆ GossipHello()

bool SmartGameObjectAI::GossipHello ( Player player,
bool  reportUse 
)
overridevirtual

Reimplemented from GameObjectAI.

1209{
1210 LOG_DEBUG("sql.sql", "SmartGameObjectAI::GossipHello");
1211 GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_HELLO, player, (uint32)reportUse, 0, false, nullptr, me);
1212 return false;
1213}
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:168
std::uint32_t uint32
Definition: Define.h:107
@ SMART_EVENT_GOSSIP_HELLO
Definition: SmartScriptMgr.h:183

References GetScript(), LOG_DEBUG, GameObjectAI::me, SmartScript::ProcessEventsFor(), and SMART_EVENT_GOSSIP_HELLO.

◆ GossipSelect()

bool SmartGameObjectAI::GossipSelect ( Player player,
uint32  sender,
uint32  action 
)
overridevirtual

Reimplemented from GameObjectAI.

1217{
1218 GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_SELECT, player, sender, action, false, nullptr, me);
1219 return false;
1220}
@ SMART_EVENT_GOSSIP_SELECT
Definition: SmartScriptMgr.h:181

References GetScript(), GameObjectAI::me, SmartScript::ProcessEventsFor(), and SMART_EVENT_GOSSIP_SELECT.

◆ GossipSelectCode()

bool SmartGameObjectAI::GossipSelectCode ( Player ,
uint32  ,
uint32  ,
const char *   
)
overridevirtual

Reimplemented from GameObjectAI.

1224{
1225 return false;
1226}

◆ InitializeAI()

void SmartGameObjectAI::InitializeAI ( )
overridevirtual

Reimplemented from GameObjectAI.

1190{
1192
1193 // Xinef: do not call respawn event if go is not spawned
1194 if (me->isSpawned())
1196 //Reset();
1197}
@ SMART_EVENT_RESPAWN
Definition: SmartScriptMgr.h:130
void OnInitialize(WorldObject *obj, AreaTrigger const *at=nullptr)
Definition: SmartScript.cpp:5069
bool isSpawned() const
Definition: GameObject.h:190

References GetScript(), GameObject::isSpawned(), GameObjectAI::me, SmartScript::OnInitialize(), SmartScript::ProcessEventsFor(), and SMART_EVENT_RESPAWN.

◆ JustSummoned()

void SmartGameObjectAI::JustSummoned ( Creature creature)
overridevirtual

Reimplemented from GameObjectAI.

1291{
1293}
@ SMART_EVENT_SUMMONED_UNIT
Definition: SmartScriptMgr.h:136

References GetScript(), SmartScript::ProcessEventsFor(), and SMART_EVENT_SUMMONED_UNIT.

◆ OnGameEvent()

void SmartGameObjectAI::OnGameEvent ( bool  start,
uint16  eventId 
)
overridevirtual

Reimplemented from GameObjectAI.

1271{
1273}
@ SMART_EVENT_GAME_EVENT_START
Definition: SmartScriptMgr.h:187
@ SMART_EVENT_GAME_EVENT_END
Definition: SmartScriptMgr.h:188

References GetScript(), SmartScript::ProcessEventsFor(), SMART_EVENT_GAME_EVENT_END, and SMART_EVENT_GAME_EVENT_START.

◆ OnStateChanged()

void SmartGameObjectAI::OnStateChanged ( uint32  state,
Unit unit 
)
overridevirtual

Reimplemented from GameObjectAI.

1276{
1278}
@ SMART_EVENT_GO_STATE_CHANGED
Definition: SmartScriptMgr.h:189

References GetScript(), SmartScript::ProcessEventsFor(), and SMART_EVENT_GO_STATE_CHANGED.

◆ Permissible()

static int32 SmartGameObjectAI::Permissible ( GameObject const *  )
inlinestatic
273{ return PERMIT_BASE_NO; }
@ PERMIT_BASE_NO
Definition: CreatureAI.h:240

References PERMIT_BASE_NO.

◆ QuestAccept()

bool SmartGameObjectAI::QuestAccept ( Player player,
Quest const *  quest 
)
overridevirtual

Reimplemented from GameObjectAI.

1230{
1231 GetScript()->ProcessEventsFor(SMART_EVENT_ACCEPTED_QUEST, player, quest->GetQuestId(), 0, false, nullptr, me);
1232 return false;
1233}
@ SMART_EVENT_ACCEPTED_QUEST
Definition: SmartScriptMgr.h:138

References Quest::GetQuestId(), GetScript(), GameObjectAI::me, SmartScript::ProcessEventsFor(), and SMART_EVENT_ACCEPTED_QUEST.

◆ QuestReward()

bool SmartGameObjectAI::QuestReward ( Player player,
Quest const *  quest,
uint32  opt 
)
overridevirtual

Reimplemented from GameObjectAI.

1237{
1238 GetScript()->ProcessEventsFor(SMART_EVENT_REWARD_QUEST, player, quest->GetQuestId(), opt, false, nullptr, me);
1239 return false;
1240}
@ SMART_EVENT_REWARD_QUEST
Definition: SmartScriptMgr.h:139

References Quest::GetQuestId(), GetScript(), GameObjectAI::me, SmartScript::ProcessEventsFor(), and SMART_EVENT_REWARD_QUEST.

◆ Reset()

void SmartGameObjectAI::Reset ( )
overridevirtual

Reimplemented from GameObjectAI.

1200{
1201 // Xinef: call respawn event on reset
1203
1204 GetScript()->OnReset();
1205}
void OnReset()
Definition: SmartScript.cpp:108

References GetScript(), SmartScript::OnReset(), SmartScript::ProcessEventsFor(), and SMART_EVENT_RESPAWN.

◆ SetData() [1/2]

void SmartGameObjectAI::SetData ( uint32  id,
uint32  value 
)
inlineoverridevirtual

Reimplemented from GameObjectAI.

281{ SetData(id, value, nullptr); }
void SetData(uint32 id, uint32 value) override
Definition: SmartAI.h:281

References SetData().

Referenced by SetData().

◆ SetData() [2/2]

void SmartGameObjectAI::SetData ( uint32  id,
uint32  value,
WorldObject invoker 
)
1249{
1250 Unit* unit = nullptr;
1251 GameObject* gob = nullptr;
1252
1253 if (invoker)
1254 {
1255 unit = invoker->ToUnit();
1256 if (!unit)
1257 gob = invoker->ToGameObject();
1258 }
1259
1260 GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, unit, id, value, false, nullptr, gob);
1261}
@ SMART_EVENT_DATA_SET
Definition: SmartScriptMgr.h:157
Definition: GameObject.h:121
GameObject * ToGameObject()
Definition: Object.h:210
Unit * ToUnit()
Definition: Object.h:206
Definition: Unit.h:630

References GetScript(), SmartScript::ProcessEventsFor(), SMART_EVENT_DATA_SET, Object::ToGameObject(), and Object::ToUnit().

◆ SetScript9()

void SmartGameObjectAI::SetScript9 ( SmartScriptHolder e,
uint32  entry,
WorldObject invoker 
)
1264{
1265 if (invoker)
1266 GetScript()->mLastInvoker = invoker->GetGUID();
1267 GetScript()->SetScript9(e, entry);
1268}
ObjectGuid mLastInvoker
Definition: SmartScript.h:190
void SetScript9(SmartScriptHolder &e, uint32 entry)
Definition: SmartScript.cpp:5224
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109

References Object::GetGUID(), GetScript(), SmartScript::mLastInvoker, and SmartScript::SetScript9().

◆ SpellHit()

void SmartGameObjectAI::SpellHit ( Unit unit,
SpellInfo const *  spellInfo 
)
overridevirtual

Reimplemented from GameObjectAI.

1286{
1287 GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, unit, 0, 0, false, spellInfo);
1288}
@ SMART_EVENT_SPELLHIT
Definition: SmartScriptMgr.h:127

References GetScript(), SmartScript::ProcessEventsFor(), and SMART_EVENT_SPELLHIT.

◆ SummonedCreatureDespawn()

void SmartGameObjectAI::SummonedCreatureDespawn ( Creature unit)
overridevirtual

Reimplemented from GameObjectAI.

1296{
1298}
@ SMART_EVENT_SUMMON_DESPAWNED
Definition: SmartScriptMgr.h:154
uint32 GetEntry() const
Definition: Object.h:112

References Object::GetEntry(), GetScript(), SmartScript::ProcessEventsFor(), and SMART_EVENT_SUMMON_DESPAWNED.

◆ SummonedCreatureDies()

void SmartGameObjectAI::SummonedCreatureDies ( Creature summon,
Unit killer 
)
overridevirtual

Reimplemented from GameObjectAI.

1175{
1177}
@ SMART_EVENT_SUMMONED_UNIT_DIES
Definition: SmartScriptMgr.h:203

References GetScript(), SmartScript::ProcessEventsFor(), and SMART_EVENT_SUMMONED_UNIT_DIES.

◆ SummonedCreatureEvade()

void SmartGameObjectAI::SummonedCreatureEvade ( Creature summon)
overridevirtual

Reimplemented from GameObjectAI.

1180{
1182}
@ SMART_EVENT_SUMMONED_UNIT_EVADE
Definition: SmartScriptMgr.h:216

References GetScript(), SmartScript::ProcessEventsFor(), and SMART_EVENT_SUMMONED_UNIT_EVADE.

◆ UpdateAI()

void SmartGameObjectAI::UpdateAI ( uint32  diff)
overridevirtual

Reimplemented from GameObjectAI.

1185{
1186 GetScript()->OnUpdate(diff);
1187}
void OnUpdate(const uint32 diff)
Definition: SmartScript.cpp:4905

References GetScript(), and SmartScript::OnUpdate().

Member Data Documentation

◆ mScript

SmartScript SmartGameObjectAI::mScript
protected

Referenced by GetScript().