AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_wg_spirit_guide Class Reference
Inheritance diagram for npc_wg_spirit_guide:
CreatureScript ScriptObject UpdatableScript< Creature >

Classes

struct  npc_wg_spirit_guideAI
 

Public Member Functions

 npc_wg_spirit_guide ()
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnGossipSelect (Player *player, Creature *, uint32, uint32 action) override
 
CreatureAIGetAI (Creature *creature) const override
 
- Public Member Functions inherited from CreatureScript
bool IsDatabaseBound () const override
 
virtual bool OnGossipHello (Player *, Creature *)
 
virtual bool OnGossipSelect (Player *, Creature *, uint32, uint32)
 
virtual bool OnGossipSelectCode (Player *, Creature *, uint32, uint32, const char *)
 
virtual bool OnQuestAccept (Player *, Creature *, Quest const *)
 
virtual bool OnQuestSelect (Player *, Creature *, Quest const *)
 
virtual bool OnQuestComplete (Player *, Creature *, Quest const *)
 
virtual bool OnQuestReward (Player *, Creature *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, Creature *)
 
virtual CreatureAIGetAI (Creature *) const
 
virtual void OnFfaPvpStateUpdate (Creature *, bool)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 
- Public Member Functions inherited from UpdatableScript< Creature >
virtual void OnUpdate (Creature *, uint32)
 

Additional Inherited Members

- Protected Member Functions inherited from CreatureScript
 CreatureScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_wg_spirit_guide()

npc_wg_spirit_guide::npc_wg_spirit_guide ( )
inline
214: CreatureScript("npc_wg_spirit_guide") { }
Definition: CreatureScript.h:25

Member Function Documentation

◆ GetAI()

CreatureAI * npc_wg_spirit_guide::GetAI ( Creature creature) const
inlineoverridevirtual

Reimplemented from CreatureScript.

265 {
266 return new npc_wg_spirit_guideAI(creature);
267 }

◆ OnGossipHello()

bool npc_wg_spirit_guide::OnGossipHello ( Player player,
Creature creature 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

217 {
218 if (creature->IsQuestGiver())
219 player->PrepareQuestMenu(creature->GetGUID());
220
221 Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
222 if (!wintergrasp)
223 return true;
224
225 GraveyardVect graveyard = wintergrasp->GetGraveyardVector();
226 for (uint8 i = 0; i < graveyard.size(); i++)
227 if (graveyard[i]->GetControlTeamId() == player->GetTeamId())
228 AddGossipItemFor(player, GOSSIP_ICON_CHAT, sObjectMgr->GetAcoreStringForDBCLocale(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i);
229
230 SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
231 return true;
232 }
std::uint8_t uint8
Definition: Define.h:109
std::vector< BfGraveyard * > GraveyardVect
Definition: Battlefield.h:74
@ BATTLEFIELD_BATTLEID_WG
Definition: Battlefield.h:35
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
#define sObjectMgr
Definition: ObjectMgr.h:1635
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const guid)
Definition: ScriptedGossip.cpp:45
void AddGossipItemFor(Player *player, uint32 icon, std::string const &text, uint32 sender, uint32 action)
Definition: ScriptedGossip.cpp:28
@ GOSSIP_SENDER_MAIN
Definition: ScriptedGossip.h:70
@ GOSSIP_ACTION_INFO_DEF
Definition: ScriptedGossip.h:68
@ GOSSIP_ICON_CHAT
Definition: GossipDef.h:61
Definition: Battlefield.h:204
GraveyardVect GetGraveyardVector()
Definition: Battlefield.h:350
Definition: BattlefieldWG.h:132
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2108
void PrepareQuestMenu(ObjectGuid guid)
Definition: PlayerQuest.cpp:39
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition: PlayerGossip.cpp:404
bool IsQuestGiver() const
Definition: Unit.h:762

References AddGossipItemFor(), BATTLEFIELD_BATTLEID_WG, Player::GetGossipTextId(), Battlefield::GetGraveyardVector(), Object::GetGUID(), Player::GetTeamId(), GOSSIP_ACTION_INFO_DEF, GOSSIP_ICON_CHAT, GOSSIP_SENDER_MAIN, Unit::IsQuestGiver(), Player::PrepareQuestMenu(), sBattlefieldMgr, SendGossipMenuFor(), and sObjectMgr.

◆ OnGossipSelect()

bool npc_wg_spirit_guide::OnGossipSelect ( Player player,
Creature ,
uint32  ,
uint32  action 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

235 {
236 CloseGossipMenuFor(player);
237
238 Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
239 if (wintergrasp)
240 {
241 GraveyardVect gy = wintergrasp->GetGraveyardVector();
242 for (uint8 i = 0; i < gy.size(); i++)
243 if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId())
244 if (GraveyardStruct const* safeLoc = sGraveyard->GetGraveyard(gy[i]->GetGraveyardId()))
245 player->TeleportTo(safeLoc->Map, safeLoc->x, safeLoc->y, safeLoc->z, 0);
246 }
247 return true;
248 }
void CloseGossipMenuFor(Player *player)
Definition: ScriptedGossip.cpp:56
#define sGraveyard
Definition: GameGraveyard.h:74
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition: Player.cpp:1334
Definition: GameGraveyard.h:27

References BATTLEFIELD_BATTLEID_WG, CloseGossipMenuFor(), Battlefield::GetGraveyardVector(), Player::GetTeamId(), GOSSIP_ACTION_INFO_DEF, sBattlefieldMgr, sGraveyard, and Player::TeleportTo().