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, 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 *)
 

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
1392 : GameObjectAI(go)
1393 {
1394 }
Definition: GameObjectAI.h:34

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.

1401 {
1402 if (reportUse)
1403 return false;
1404
1405 Unit* owner = me->GetOwner();
1406 if (!owner)
1407 return true;
1408
1409 uint32 stoneId = 0;
1410 uint32 stoneSpell = 0;
1411 switch (me->GetEntry())
1412 {
1413 case GO_SOUL_WELL_R1:
1415 if (Unit* owner = me->GetOwner())
1416 {
1418 {
1420 }
1422 {
1424 }
1425 }
1426 break;
1427 case GO_SOUL_WELL_R2:
1429 if (Unit* owner = me->GetOwner())
1430 {
1432 {
1434 }
1436 {
1438 }
1439 }
1440 break;
1441 }
1442
1443 if (!stoneSpell)
1444 {
1445 return true;
1446 }
1447
1448 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(stoneSpell);
1449 if (!spellInfo)
1450 {
1451 return true;
1452 }
1453
1454 stoneId = spellInfo->Effects[EFFECT_0].ItemType;
1455 if (!stoneId)
1456 {
1457 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(stoneSpell))
1458 {
1459 Spell::SendCastResult(player, spell, 0, SPELL_FAILED_ERROR);
1460 }
1461 return true;
1462 }
1463
1464 if (owner->GetTypeId() != TYPEID_PLAYER || !player->IsInSameRaidWith(owner->ToPlayer()))
1465 {
1466 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(stoneSpell))
1467 {
1469 }
1470 return true;
1471 }
1472
1473 // Don't try to add a stone if we already have one.
1474 if (player->HasItemCount(stoneId))
1475 {
1476 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(stoneSpell))
1477 {
1479 }
1480 return true;
1481 }
1482
1483 player->CastSpell(player, stoneSpell, false);
1484
1485 // Item has to actually be created to remove a charge on the well.
1486 if (player->HasItemCount(stoneId))
1487 {
1488 me->AddUse();
1489 }
1490
1491 return true;
1492 }
std::uint32_t uint32
Definition: Define.h:108
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
#define sSpellMgr
Definition: SpellMgr.h:825
@ GO_SOUL_WELL_R1
Definition: go_scripts.cpp:1370
@ SPELL_CREATE_FEL_HEALTH_STONE_R1
Definition: go_scripts.cpp:1381
@ SPELL_CREATE_MASTER_HEALTH_STONE_R1
Definition: go_scripts.cpp:1377
@ SPELL_IMPROVED_HEALTH_STONE_R1
Definition: go_scripts.cpp:1373
@ SPELL_CREATE_FEL_HEALTH_STONE_R2
Definition: go_scripts.cpp:1382
@ SPELL_CREATE_MASTER_HEALTH_STONE_R2
Definition: go_scripts.cpp:1378
@ SPELL_CREATE_MASTER_HEALTH_STONE_R0
Definition: go_scripts.cpp:1376
@ GO_SOUL_WELL_R2
Definition: go_scripts.cpp:1371
@ SPELL_CREATE_FEL_HEALTH_STONE_R0
Definition: go_scripts.cpp:1380
@ EFFECT_0
Definition: SharedDefines.h:31
@ SPELL_FAILED_ERROR
Definition: SharedDefines.h:981
@ SPELL_FAILED_TARGET_NOT_IN_RAID
Definition: SharedDefines.h:1088
@ SPELL_FAILED_TOO_MANY_OF_ITEM
Definition: SharedDefines.h:1078
GameObject *const me
Definition: GameObjectAI.h:36
Unit * GetOwner() const
Definition: GameObject.cpp:1236
void AddUse()
Definition: GameObject.h:241
Player * ToPlayer()
Definition: Object.h:195
TypeID GetTypeId() const
Definition: Object.h:121
uint32 GetEntry() const
Definition: Object.h:109
bool IsInSameRaidWith(Player const *p) const
Definition: Player.h:1849
bool HasItemCount(uint32 item, uint32 count=1, bool inBankAlso=false) const
Definition: PlayerStorage.cpp:683
Definition: Unit.h:1302
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5636
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:1169
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition: Spell.cpp:4645
Definition: SpellInfo.h:314
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:391

References GameObject::AddUse(), Unit::CastSpell(), EFFECT_0, SpellInfo::Effects, Object::GetEntry(), GameObject::GetOwner(), Object::GetTypeId(), GO_SOUL_WELL_R1, GO_SOUL_WELL_R2, Unit::HasAura(), Player::HasItemCount(), Player::IsInSameRaidWith(), 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, sSpellMgr, Object::ToPlayer(), and TYPEID_PLAYER.