TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
npc_wg_spirit_guide Class Reference

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
virtual bool OnDummyEffect (Unit *, uint32, SpellEffIndex, Creature *)
 
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 OnQuestReward (Player *, Creature *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, Creature *)
 
- Public Member Functions inherited from UnitScript
virtual void OnHeal (Unit *, Unit *, uint32 &)
 
virtual void OnDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifyPeriodicDamageAurasTick (Unit *, Unit *, uint32 &)
 
virtual void ModifyMeleeDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifySpellDamageTaken (Unit *, Unit *, int32 &)
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 
- 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 UnitScript
 UnitScript (const char *name, bool addToScripts=true)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()
 
virtual ~UpdatableScript ()
 

Constructor & Destructor Documentation

npc_wg_spirit_guide::npc_wg_spirit_guide ( )
inline
188 : CreatureScript("npc_wg_spirit_guide") { }
CreatureScript(const char *name)
Definition: ScriptMgr.cpp:1586

Member Function Documentation

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

Reimplemented from CreatureScript.

236  {
237  return new npc_wg_spirit_guideAI(creature);
238  }
bool npc_wg_spirit_guide::OnGossipHello ( Player player,
Creature creature 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

191  {
192  if (creature->IsQuestGiver())
193  player->PrepareQuestMenu(creature->GetGUID());
194 
195  Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
196  if (!wintergrasp)
197  return true;
198 
199  GraveyardVect graveyard = wintergrasp->GetGraveyardVector();
200  for (uint8 i = 0; i < graveyard.size(); i++)
201  if (graveyard[i]->GetControlTeamId() == player->GetTeamId())
202  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i);
203 
204  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
205  return true;
206  }
Definition: ScriptedGossip.h:71
std::vector< BfGraveyard * > GraveyardVect
Definition: Battlefield.h:76
bool IsQuestGiver() const
Definition: Unit.h:1566
Definition: Battlefield.h:196
GraveyardVect GetGraveyardVector() const
Definition: Battlefield.h:345
Definition: ScriptedGossip.h:73
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Battlefield.h:33
Definition: GossipDef.h:59
uint8_t uint8
Definition: Define.h:152
Definition: BattlefieldWG.h:146

+ Here is the call graph for this function:

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

Reimplemented from CreatureScript.

209  {
210  player->CLOSE_GOSSIP_MENU();
211 
212  Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
213  if (wintergrasp)
214  {
215  GraveyardVect gy = wintergrasp->GetGraveyardVector();
216  for (uint8 i = 0; i < gy.size(); i++)
217  if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId())
218  if (WorldSafeLocsEntry const* safeLoc = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveyardId()))
219  player->TeleportTo(safeLoc->MapID, safeLoc->Loc.X, safeLoc->Loc.Y, safeLoc->Loc.Z, 0);
220  }
221  return true;
222  }
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
Definition: ScriptedGossip.h:71
Definition: DBCStructure.h:1434
std::vector< BfGraveyard * > GraveyardVect
Definition: Battlefield.h:76
Definition: Battlefield.h:196
GraveyardVect GetGraveyardVector() const
Definition: Battlefield.h:345
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
Definition: Battlefield.h:33
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:


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