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

Classes

struct  npc_wg_queueAI
 

Public Member Functions

 npc_wg_queue ()
 
CreatureAIGetAI (Creature *creature) const override
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnGossipSelect (Player *player, Creature *, uint32, uint32) 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_queue::npc_wg_queue ( )
inline
249 : CreatureScript("npc_wg_queue") { }
CreatureScript(const char *name)
Definition: ScriptMgr.cpp:1586

Member Function Documentation

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

Reimplemented from CreatureScript.

281  {
282  return new npc_wg_queueAI(creature);
283  }
bool npc_wg_queue::OnGossipHello ( Player player,
Creature creature 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

286  {
287  if (creature->IsQuestGiver())
288  player->PrepareQuestMenu(creature->GetGUID());
289 
290  Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
291  if (!wintergrasp)
292  return true;
293 
294  if (wintergrasp->IsWarTime())
295  {
296  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
297  player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID());
298  }
299  else
300  {
301  uint32 timer = wintergrasp->GetTimer() / 1000;
302  player->SendUpdateWorldState(4354, time(NULL) + timer);
303  if (timer < 15 * MINUTE)
304  {
305  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
306  player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID());
307  }
308  else
309  player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID());
310  }
311  return true;
312  }
Definition: ScriptedGossip.h:71
Definition: zone_wintergrasp.cpp:44
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: zone_wintergrasp.cpp:38
Definition: zone_wintergrasp.cpp:41
Definition: Common.h:97
Definition: zone_wintergrasp.cpp:42
Definition: zone_wintergrasp.cpp:43
uint32 GetTimer() const
Definition: Battlefield.h:347
Definition: zone_wintergrasp.cpp:40
bool IsQuestGiver() const
Definition: Unit.h:1566
uint32_t uint32
Definition: Define.h:150
bool IsWarTime() const
Return true if battle is start, false if battle is not started.
Definition: Battlefield.h:241
Definition: Battlefield.h:196
Definition: zone_wintergrasp.cpp:39
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
TeamId GetDefenderTeam() const
Definition: Battlefield.h:271

+ Here is the call graph for this function:

bool npc_wg_queue::OnGossipSelect ( Player player,
Creature ,
uint32  ,
uint32   
)
inlineoverridevirtual

Reimplemented from CreatureScript.

315  {
316  player->CLOSE_GOSSIP_MENU();
317 
318  Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
319  if (!wintergrasp)
320  return true;
321 
322  if (wintergrasp->IsWarTime())
323  wintergrasp->InvitePlayerToWar(player);
324  else
325  {
326  uint32 timer = wintergrasp->GetTimer() / 1000;
327  if (timer < 15 * MINUTE)
328  wintergrasp->InvitePlayerToQueue(player);
329  }
330  return true;
331  }
Definition: Common.h:97
uint32 GetTimer() const
Definition: Battlefield.h:347
uint32_t uint32
Definition: Define.h:150
bool IsWarTime() const
Return true if battle is start, false if battle is not started.
Definition: Battlefield.h:241
Definition: Battlefield.h:196
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
Definition: Battlefield.h:33
void InvitePlayerToWar(Player *player)
Definition: Battlefield.cpp:253
void InvitePlayerToQueue(Player *player)
Definition: Battlefield.cpp:207

+ Here is the call graph for this function:


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