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

Public Member Functions

 AreaTrigger_at_brewfest ()
 
bool OnTrigger (Player *player, AreaTriggerEntry const *areaTrigger, bool) override
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 

Private Attributes

std::map< uint32, time_t > _triggerTimes
 

Additional Inherited Members

- Protected Member Functions inherited from AreaTriggerScript
 AreaTriggerScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 

Constructor & Destructor Documentation

AreaTrigger_at_brewfest::AreaTrigger_at_brewfest ( )
inline
307  : AreaTriggerScript("at_brewfest")
308  {
309  // Initialize for cooldown
311  }
std::map< uint32, time_t > _triggerTimes
Definition: areatrigger_scripts.cpp:339
Definition: areatrigger_scripts.cpp:296
AreaTriggerScript(const char *name)
Definition: ScriptMgr.cpp:1598
Definition: areatrigger_scripts.cpp:297

Member Function Documentation

bool AreaTrigger_at_brewfest::OnTrigger ( Player player,
AreaTriggerEntry const areaTrigger,
bool   
)
inlineoverridevirtual

Reimplemented from AreaTriggerScript.

314  {
315  uint32 triggerId = areaTrigger->ID;
316  // Second trigger happened too early after first, skip for now
317  if (sWorld->GetGameTime() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
318  return false;
319 
320  switch (triggerId)
321  {
322  case AT_BREWFEST_DUROTAR:
323  if (Creature* tapper = player->FindNearestCreature(NPC_TAPPER_SWINDLEKEG, 20.0f))
324  tapper->AI()->Talk(SAY_WELCOME, player);
325  break;
327  if (Creature* ipfelkofer = player->FindNearestCreature(NPC_IPFELKOFER_IRONKEG, 20.0f))
328  ipfelkofer->AI()->Talk(SAY_WELCOME, player);
329  break;
330  default:
331  break;
332  }
333 
334  _triggerTimes[triggerId] = sWorld->GetGameTime();
335  return false;
336  }
std::map< uint32, time_t > _triggerTimes
Definition: areatrigger_scripts.cpp:339
Definition: areatrigger_scripts.cpp:301
Definition: areatrigger_scripts.cpp:293
Definition: Creature.h:467
Definition: areatrigger_scripts.cpp:296
#define sWorld
Definition: World.h:887
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2443
Definition: areatrigger_scripts.cpp:297
Definition: areatrigger_scripts.cpp:299
uint32_t uint32
Definition: Define.h:150
Definition: areatrigger_scripts.cpp:294

+ Here is the call graph for this function:

Member Data Documentation

std::map<uint32, time_t> AreaTrigger_at_brewfest::_triggerTimes
private

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