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

#include "AreaTriggerScript.h"

Inheritance diagram for OnlyOnceAreaTriggerScript:
AreaTriggerScript ScriptObject at_icc_spire_frostwyrm at_karazhan_side_entrance at_rp_nethekurse at_twin_emperors at_underbog_ghazan 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
 
uint16 GetTotalAvailableHooks ()
 

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, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Private Member Functions

 AreaTriggerScript (const char *name)
 

Detailed Description

Member Function Documentation

◆ _OnTrigger()

◆ AreaTriggerScript()

AreaTriggerScript::AreaTriggerScript ( const char *  name)
private
44 : ScriptObject(name)
45{
47}
static void AddScript(TScript *const script, std::vector< uint16 > enabledHooks={})
Definition: ScriptMgr.h:737
Definition: ScriptObject.h:44

◆ OnTrigger()

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

Reimplemented from AreaTriggerScript.

50{
51 uint32 const triggerId = trigger->entry;
52
53 if (InstanceScript* instance = player->GetInstanceScript())
54 {
55 if (instance->IsAreaTriggerDone(triggerId))
56 {
57 return true;
58 }
59 else
60 {
61 instance->MarkAreaTriggerDone(triggerId);
62 }
63 }
64
65 return _OnTrigger(player, trigger);
66}
std::uint32_t uint32
Definition: Define.h:107
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
Definition: InstanceScript.h:142
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
69{
70 script->ResetAreaTriggerDone(triggerId);
71}
void ResetAreaTriggerDone(uint32 id)
Definition: InstanceScript.h:263

References InstanceScript::ResetAreaTriggerDone().

Referenced by ResetAreaTriggerDone().

◆ ResetAreaTriggerDone() [2/2]

void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone ( Player const *  player,
AreaTrigger const *  trigger 
)
protected
74{
75 if (InstanceScript* instance = player->GetInstanceScript())
76 {
77 ResetAreaTriggerDone(instance, trigger->entry);
78 }
79}
void ResetAreaTriggerDone(InstanceScript *, uint32)
Definition: AreaTriggerScript.cpp:68

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