AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
OnlyOnceAreaTriggerScript Class Referenceabstract

#include "ScriptMgr.h"

Inheritance diagram for OnlyOnceAreaTriggerScript:
AreaTriggerScript ScriptObject at_twin_emperors at_zulgurub_bloodfire_pit_speech at_zulgurub_bridge_speech at_zulgurub_edge_of_madness_speech at_zulgurub_entrance_speech at_zulgurub_temple_speech

Public Member Functions

bool OnTrigger (Player *, AreaTrigger const *) override
 
- Public Member Functions inherited from AreaTriggerScript
bool IsDatabaseBound () const override
 
virtual bool OnTrigger (Player *, AreaTrigger const *)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 

Protected Member Functions

virtual bool _OnTrigger (Player *, AreaTrigger const *)=0
 
void ResetAreaTriggerDone (InstanceScript *, uint32)
 
void ResetAreaTriggerDone (Player const *, AreaTrigger const *)
 
- Protected Member Functions inherited from AreaTriggerScript
 AreaTriggerScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()=default
 

Private Member Functions

 AreaTriggerScript (const char *name)
 

Detailed Description

Member Function Documentation

◆ _OnTrigger()

virtual bool OnlyOnceAreaTriggerScript::_OnTrigger ( Player ,
AreaTrigger const *   
)
protectedpure virtual

◆ AreaTriggerScript()

AreaTriggerScript::AreaTriggerScript ( const char *  name)
private
378 : ScriptObject(name)
379{
381}
Definition: ScriptMgr.h:107
static void AddScript(TScript *const script)
Definition: ScriptMgr.h:2708

◆ OnTrigger()

bool OnlyOnceAreaTriggerScript::OnTrigger ( Player player,
AreaTrigger const *  trigger 
)
overridevirtual

Reimplemented from AreaTriggerScript.

384{
385 uint32 const triggerId = trigger->entry;
386 if (InstanceScript* instance = player->GetInstanceScript())
387 {
388 if (instance->IsAreaTriggerDone(triggerId))
389 {
390 return true;
391 }
392 else
393 {
394 instance->MarkAreaTriggerDone(triggerId);
395 }
396 }
397 return _OnTrigger(player, trigger);
398}
std::uint32_t uint32
Definition: Define.h:108
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1194
Definition: InstanceScript.h:140
virtual bool _OnTrigger(Player *, AreaTrigger const *)=0

References _OnTrigger(), AreaTrigger::entry, and WorldObject::GetInstanceScript().

◆ ResetAreaTriggerDone() [1/2]

void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone ( InstanceScript script,
uint32  triggerId 
)
protected
401{
402 script->ResetAreaTriggerDone(triggerId);
403}
void ResetAreaTriggerDone(uint32 id)
Definition: InstanceScript.h:252

References InstanceScript::ResetAreaTriggerDone().

Referenced by ResetAreaTriggerDone().

◆ ResetAreaTriggerDone() [2/2]

void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone ( Player const *  player,
AreaTrigger const *  trigger 
)
protected
406{
407 if (InstanceScript* instance = player->GetInstanceScript())
408 {
409 ResetAreaTriggerDone(instance, trigger->entry);
410 }
411}
void ResetAreaTriggerDone(InstanceScript *, uint32)
Definition: ScriptMgr.cpp:400

References AreaTrigger::entry, WorldObject::GetInstanceScript(), and ResetAreaTriggerDone().