AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
BattlefieldScript Class Reference

#include "BattlefieldScript.h"

Inheritance diagram for BattlefieldScript:
ScriptObject

Public Member Functions

bool IsDatabaseBound () const override
 
virtual void OnBattlefieldPlayerEnterZone (Battlefield *, Player *)
 Called when a player enters the battlefield zone, before team-based data assignment. This is the ideal place to reassign a player's team for cross-faction purposes.
 
virtual void OnBattlefieldPlayerLeaveZone (Battlefield *, Player *)
 Called when a player leaves the battlefield zone, after all cleanup. This is the ideal place to restore a player's original team/faction.
 
virtual void OnBattlefieldPlayerJoinWar (Battlefield *, Player *)
 Called after a player has been added to the active war (accepted the invitation).
 
virtual void OnBattlefieldPlayerLeaveWar (Battlefield *, Player *)
 Called after a player has been removed from the active war.
 
virtual void OnBattlefieldBeforeInvitePlayerToWar (Battlefield *, Player *)
 Called inside InvitePlayerToWar after the WillBeKick entry is erased (using the player's current team) and before the player is inserted into m_InvitedPlayers. This is the correct place to reassign a player's effective team for pre-war zone players: the invite bucket write that follows will use the newly assigned team, keeping all subsequent core operations consistent.
 
- Public Member Functions inherited from ScriptObject
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Protected Member Functions

 BattlefieldScript (const char *name, std::vector< uint16 > enabledHooks=std::vector< uint16 >())
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ BattlefieldScript()

BattlefieldScript::BattlefieldScript ( const char *  name,
std::vector< uint16 enabledHooks = std::vector<uint16>() 
)
protected
47 :
49{
50 // If empty - enable all available hooks.
51 if (enabledHooks.empty())
52 for (uint16 i = 0; i < BATTLEFIELDHOOK_END; ++i)
53 enabledHooks.emplace_back(i);
54
55 ScriptRegistry<BattlefieldScript>::AddScript(this, std::move(enabledHooks));
56}
@ BATTLEFIELDHOOK_END
Definition BattlefieldScript.h:31
std::uint16_t uint16
Definition Define.h:108
Definition ScriptObject.h:43
static void AddScript(TScript *const script, std::vector< uint16 > enabledHooks={})
Definition ScriptMgr.h:763

References ScriptRegistry< TScript >::AddScript(), and BATTLEFIELDHOOK_END.

Member Function Documentation

◆ IsDatabaseBound()

bool BattlefieldScript::IsDatabaseBound ( ) const
inlineoverridevirtual

Reimplemented from ScriptObject.

43{ return false; }

◆ OnBattlefieldBeforeInvitePlayerToWar()

virtual void BattlefieldScript::OnBattlefieldBeforeInvitePlayerToWar ( Battlefield ,
Player  
)
inlinevirtual

Called inside InvitePlayerToWar after the WillBeKick entry is erased (using the player's current team) and before the player is inserted into m_InvitedPlayers. This is the correct place to reassign a player's effective team for pre-war zone players: the invite bucket write that follows will use the newly assigned team, keeping all subsequent core operations consistent.

Parameters
bfThe Battlefield instance
playerThe player being invited to war
89{ }

Referenced by ScriptMgr::OnBattlefieldBeforeInvitePlayerToWar().

◆ OnBattlefieldPlayerEnterZone()

virtual void BattlefieldScript::OnBattlefieldPlayerEnterZone ( Battlefield ,
Player  
)
inlinevirtual

Called when a player enters the battlefield zone, before team-based data assignment. This is the ideal place to reassign a player's team for cross-faction purposes.

Parameters
bfThe Battlefield instance
playerThe player entering the zone
52{ }

Referenced by ScriptMgr::OnBattlefieldPlayerEnterZone().

◆ OnBattlefieldPlayerJoinWar()

virtual void BattlefieldScript::OnBattlefieldPlayerJoinWar ( Battlefield ,
Player  
)
inlinevirtual

Called after a player has been added to the active war (accepted the invitation).

Parameters
bfThe Battlefield instance
playerThe player joining the war
69{ }

Referenced by ScriptMgr::OnBattlefieldPlayerJoinWar().

◆ OnBattlefieldPlayerLeaveWar()

virtual void BattlefieldScript::OnBattlefieldPlayerLeaveWar ( Battlefield ,
Player  
)
inlinevirtual

Called after a player has been removed from the active war.

Parameters
bfThe Battlefield instance
playerThe player leaving the war
77{ }

Referenced by ScriptMgr::OnBattlefieldPlayerLeaveWar().

◆ OnBattlefieldPlayerLeaveZone()

virtual void BattlefieldScript::OnBattlefieldPlayerLeaveZone ( Battlefield ,
Player  
)
inlinevirtual

Called when a player leaves the battlefield zone, after all cleanup. This is the ideal place to restore a player's original team/faction.

Parameters
bfThe Battlefield instance
playerThe player leaving the zone
61{ }

Referenced by ScriptMgr::OnBattlefieldPlayerLeaveZone().


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