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).
 
virtual void OnBattlefieldPlayerKill (Battlefield *, Player *, Player *)
 Called inside BattlefieldWG::HandleKill for every player-kills-player event, regardless of the victim's WG rank. Fired before the core's own lieutenant-gated quest-credit loop so modules may grant credit for non-lieutenant kills.
 
- 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
57 :
59{
60 // If empty - enable all available hooks.
61 if (enabledHooks.empty())
62 for (uint16 i = 0; i < BATTLEFIELDHOOK_END; ++i)
63 enabledHooks.emplace_back(i);
64
65 ScriptRegistry<BattlefieldScript>::AddScript(this, std::move(enabledHooks));
66}
@ BATTLEFIELDHOOK_END
Definition BattlefieldScript.h:33
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:769

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

Member Function Documentation

◆ IsDatabaseBound()

bool BattlefieldScript::IsDatabaseBound ( ) const
inlineoverridevirtual

Reimplemented from ScriptObject.

45{ 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
91{ }

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

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

Referenced by ScriptMgr::OnBattlefieldPlayerJoinWar().

◆ OnBattlefieldPlayerKill()

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

Called inside BattlefieldWG::HandleKill for every player-kills-player event, regardless of the victim's WG rank. Fired before the core's own lieutenant-gated quest-credit loop so modules may grant credit for non-lieutenant kills.

Parameters
bfThe Battlefield instance
killerThe player who landed the killing blow
victimThe player who was killed
113{ }

Referenced by ScriptMgr::OnBattlefieldPlayerKill().

◆ 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
79{ }

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

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

Referenced by ScriptMgr::OnBattlefieldWarEnd().


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