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.
 
virtual void OnBattlefieldWarEnd (Battlefield *, bool)
 Called in EndBattle() after OnBattleEnd() completes, before the timer is reset. All core PlayersInWar/InvitedPlayers structures have already been cleared. Modules that maintain their own per-war player tracking should use this hook to perform end-of-war cleanup (e.g. restoring cross-faction disguises).
 
- 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
52 :
54{
55 // If empty - enable all available hooks.
56 if (enabledHooks.empty())
57 for (uint16 i = 0; i < BATTLEFIELDHOOK_END; ++i)
58 enabledHooks.emplace_back(i);
59
60 ScriptRegistry<BattlefieldScript>::AddScript(this, std::move(enabledHooks));
61}
@ BATTLEFIELDHOOK_END
Definition BattlefieldScript.h:32
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:766

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

Member Function Documentation

◆ IsDatabaseBound()

bool BattlefieldScript::IsDatabaseBound ( ) const
inlineoverridevirtual

Reimplemented from ScriptObject.

44{ 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
90{ }

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
53{ }

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
70{ }

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
78{ }

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
62{ }

Referenced by ScriptMgr::OnBattlefieldPlayerLeaveZone().

◆ OnBattlefieldWarEnd()

virtual void BattlefieldScript::OnBattlefieldWarEnd ( Battlefield ,
bool   
)
inlinevirtual

Called in EndBattle() after OnBattleEnd() completes, before the timer is reset. All core PlayersInWar/InvitedPlayers structures have already been cleared. Modules that maintain their own per-war player tracking should use this hook to perform end-of-war cleanup (e.g. restoring cross-faction disguises).

Parameters
bfThe Battlefield instance
endByTimerTrue if the war ended by the countdown timer expiring
101{ }

Referenced by ScriptMgr::OnBattlefieldWarEnd().


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