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

Public Member Functions

 go_soulwellAI (GameObject *go)
 
bool GossipHello (Player *player, bool reportUse) 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 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 *)
 

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

go_soulwell::go_soulwellAI::go_soulwellAI ( GameObject *  go)
inline
1292 : GameObjectAI(go)
1293 {
1294 }
Definition GameObjectAI.h:33

Member Function Documentation

◆ GossipHello()

bool go_soulwell::go_soulwellAI::GossipHello ( Player *  player,
bool  reportUse 
)
inlineoverridevirtual

Due to the fact that this GameObject triggers CMSG_GAMEOBJECT_USE and CMSG_GAMEOBJECT_REPORT_USE, this GossipHello hook is called twice. The script's handling is fine as it won't remove two charges on the well. We have to find how to segregate REPORT_USE and USE.

Reimplemented from GameObjectAI.

1301 {
1302 if (reportUse)
1303 return false;
1304
1305 Unit* owner = me->GetOwner();
1306 if (!owner)
1307 return true;
1308
1309 uint32 stoneId = 0;
1310 uint32 stoneSpell = 0;
1311 switch (me->GetEntry())
1312 {
1313 case GO_SOUL_WELL_R1:
1315 if (Unit* owner = me->GetOwner())
1316 {
1318 {
1320 }
1321 else if (owner->HasAura(SPELL_IMPROVED_HEALTH_STONE_R2))
1322 {
1324 }
1325 }
1326 break;
1327 case GO_SOUL_WELL_R2:
1329 if (Unit* owner = me->GetOwner())
1330 {
1332 {
1334 }
1335 else if (owner->HasAura(SPELL_IMPROVED_HEALTH_STONE_R2))
1336 {
1338 }
1339 }
1340 break;
1341 }
1342
1343 if (!stoneSpell)
1344 {
1345 return true;
1346 }
1347
1348 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(stoneSpell);
1349 if (!spellInfo)
1350 {
1351 return true;
1352 }
1353
1354 stoneId = spellInfo->Effects[EFFECT_0].ItemType;
1355 if (!stoneId)
1356 {
1357 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(stoneSpell))
1358 {
1359 Spell::SendCastResult(player, spell, 0, SPELL_FAILED_ERROR);
1360 }
1361 return true;
1362 }
1363
1364 if (!owner->IsPlayer() || !player->IsInSameRaidWith(owner->ToPlayer()))
1365 {
1366 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(stoneSpell))
1367 {
1369 }
1370 return true;
1371 }
1372
1373 // Don't try to add a stone if we already have one.
1374 if (player->HasItemCount(stoneId))
1375 {
1376 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(stoneSpell))
1377 {
1379 }
1380 return true;
1381 }
1382
1383 // Cast as the warlock owner so the clicker's trinkets can't proc.
1384 owner->CastSpell(player, stoneSpell, true);
1385
1386 // Item has to actually be created to remove a charge on the well.
1387 if (player->HasItemCount(stoneId))
1388 {
1389 me->AddUse();
1390 }
1391
1392 return true;
1393 }
std::uint32_t uint32
Definition Define.h:107
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_FAILED_ERROR
Definition SharedDefines.h:969
@ SPELL_FAILED_TARGET_NOT_IN_RAID
Definition SharedDefines.h:1076
@ SPELL_FAILED_TOO_MANY_OF_ITEM
Definition SharedDefines.h:1066
#define sSpellMgr
Definition SpellMgr.h:851
GameObject *const me
Definition GameObjectAI.h:35
Unit * GetOwner() const
Definition GameObject.cpp:1338
void AddUse()
Definition GameObject.h:245
bool IsPlayer() const
Definition Object.h:207
Player * ToPlayer()
Definition Object.h:208
uint32 GetEntry() const
Definition Object.h:123
bool IsInSameRaidWith(Player const *p) const
Definition Player.h:1915
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
Definition PlayerStorage.cpp:659
Definition SpellInfo.h:340
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition SpellInfo.h:417
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition Spell.cpp:4832
Definition Unit.h:670
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5798
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1378
@ SPELL_IMPROVED_HEALTH_STONE_R2
Definition go_scripts.cpp:1274
@ GO_SOUL_WELL_R1
Definition go_scripts.cpp:1270
@ SPELL_CREATE_FEL_HEALTH_STONE_R1
Definition go_scripts.cpp:1281
@ SPELL_CREATE_MASTER_HEALTH_STONE_R1
Definition go_scripts.cpp:1277
@ SPELL_IMPROVED_HEALTH_STONE_R1
Definition go_scripts.cpp:1273
@ SPELL_CREATE_FEL_HEALTH_STONE_R2
Definition go_scripts.cpp:1282
@ SPELL_CREATE_MASTER_HEALTH_STONE_R2
Definition go_scripts.cpp:1278
@ SPELL_CREATE_MASTER_HEALTH_STONE_R0
Definition go_scripts.cpp:1276
@ GO_SOUL_WELL_R2
Definition go_scripts.cpp:1271
@ SPELL_CREATE_FEL_HEALTH_STONE_R0
Definition go_scripts.cpp:1280

References GameObject::AddUse(), Unit::CastSpell(), EFFECT_0, SpellInfo::Effects, Object::GetEntry(), GameObject::GetOwner(), GO_SOUL_WELL_R1, GO_SOUL_WELL_R2, Unit::HasAura(), Player::HasItemCount(), Player::IsInSameRaidWith(), Object::IsPlayer(), GameObjectAI::me, Spell::SendCastResult(), SPELL_CREATE_FEL_HEALTH_STONE_R0, SPELL_CREATE_FEL_HEALTH_STONE_R1, SPELL_CREATE_FEL_HEALTH_STONE_R2, SPELL_CREATE_MASTER_HEALTH_STONE_R0, SPELL_CREATE_MASTER_HEALTH_STONE_R1, SPELL_CREATE_MASTER_HEALTH_STONE_R2, SPELL_FAILED_ERROR, SPELL_FAILED_TARGET_NOT_IN_RAID, SPELL_FAILED_TOO_MANY_OF_ITEM, SPELL_IMPROVED_HEALTH_STONE_R1, SPELL_IMPROVED_HEALTH_STONE_R2, sSpellMgr, and Object::ToPlayer().


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