TrinityCore
BattlefieldTB Class Reference

#include <BattlefieldTB.h>

+ Inheritance diagram for BattlefieldTB:

Public Member Functions

 ~BattlefieldTB ()
 
void OnStartGrouping () override
 Called x minutes before battle start when player in zone are invite to join queue. More...
 
void OnBattleStart () override
 Called on start. More...
 
void OnBattleEnd (bool endByTimer) override
 Called at the end of battle. More...
 
void OnPlayerEnterZone (Player *player) override
 Called when a player enter in battlefield zone. More...
 
void OnPlayerLeaveZone (Player *player) override
 Called when a player leave battlefield zone. More...
 
void OnPlayerJoinWar (Player *player) override
 Called when a player accept to join the battle. More...
 
void OnPlayerLeaveWar (Player *player) override
 Called when a player leave the battle. More...
 
bool Update (uint32 diff) override
 Called every time for update bf data and time. More...
 
void OnCreatureCreate (Creature *creature) override
 
void OnGameObjectCreate (GameObject *go) override
 
void UpdateCapturedBaseCount ()
 
bool SetupBattlefield () override
 Call this to init the Battlefield. More...
 
void HandleKill (Player *killer, Unit *victim) override
 Called when a Unit is kill in battlefield zone. More...
 
void PromotePlayer (Player *killer)
 
void RemoveAurasFromPlayer (Player *player)
 
void ProcessEvent (WorldObject *obj, uint32 eventId, WorldObject *invoker) override
 
void TowerDamaged (TBTowerId tbTowerId)
 
void TowerDestroyed (TBTowerId tbTowerId)
 
void UpdateNPCsAndGameObjects ()
 
void CreateCapturePoints ()
 
 Battlefield (Map *map)
 Constructor. More...
 
 Battlefield (Battlefield const &right)=delete
 
 Battlefield (Battlefield &&right)=delete
 
- Public Member Functions inherited from Battlefield
 Battlefield (Map *map)
 Constructor. More...
 
 Battlefield (Battlefield const &right)=delete
 
 Battlefield (Battlefield &&right)=delete
 
Battlefieldoperator= (Battlefield const &right)=delete
 
Battlefieldoperator= (Battlefield &&right)=delete
 
virtual ~Battlefield ()
 Destructor. More...
 
virtual bool SetupBattlefield ()
 Call this to init the Battlefield. More...
 
virtual bool Update (uint32 diff)
 Called every time for update bf data and time. More...
 
void InvitePlayersInZoneToQueue ()
 Invite all players in zone to join the queue, called x minutes before battle start in Update() More...
 
void InvitePlayersInQueueToWar ()
 Invite all players in queue to join battle on battle start. More...
 
void InvitePlayersInZoneToWar ()
 Invite all players in zone to join battle on battle start. More...
 
virtual void HandleKill (Player *, Unit *)
 Called when a Unit is kill in battlefield zone. More...
 
uint32 GetTypeId () const
 
uint32 GetZoneId () const
 
uint32 GetMapId () const
 
MapGetMap () const
 
uint64 GetQueueId () const
 
void TeamApplyBuff (TeamId team, uint32 spellId, uint32 spellId2=0)
 
bool IsWarTime () const
 Return true if battle is start, false if battle is not started. More...
 
int8 GetState () const
 
void ToggleBattlefield (bool enable)
 Enable or Disable battlefield. More...
 
bool IsEnabled () const
 Return if battlefield is enable. More...
 
void KickPlayerFromBattlefield (ObjectGuid guid)
 Kick player from battlefield and teleport him to kick-point location. More...
 
void HandlePlayerEnterZone (Player *player, uint32 zone)
 Called when player (player) enter in zone. More...
 
void HandlePlayerLeaveZone (Player *player, uint32 zone)
 Called when player (player) leave the zone. More...
 
virtual uint64 GetData64 (uint32 dataId) const override
 
virtual void SetData64 (uint32 dataId, uint64 value) override
 
virtual uint32 GetData (uint32 dataId) const override
 
virtual void SetData (uint32 dataId, uint32 value) override
 
virtual void UpdateData (uint32 index, int32 pad)
 
TeamId GetDefenderTeam () const
 
TeamId GetAttackerTeam () const
 
TeamId GetOtherTeam (TeamId team) const
 
void SetDefenderTeam (TeamId team)
 
GroupGetFreeBfRaid (TeamId TeamId)
 Find a not full battlefield group, if there is no, create one. More...
 
GroupGetGroupPlayer (ObjectGuid guid, TeamId TeamId)
 Return battlefield group where player is. More...
 
bool AddOrSetPlayerToCorrectBfGroup (Player *player)
 Force player to join a battlefield group. More...
 
WorldSafeLocsEntry const * GetClosestGraveyard (Player *player)
 
void SetGraveyardNumber (uint32 number)
 
BfGraveyardGetGraveyardById (uint32 id) const
 
CreatureSpawnCreature (uint32 entry, Position const &pos)
 
GameObjectSpawnGameObject (uint32 entry, Position const &pos, QuaternionData const &rot)
 
CreatureGetCreature (ObjectGuid guid)
 
GameObjectGetGameObject (ObjectGuid guid)
 
virtual void OnBattleStart ()
 Called on start. More...
 
virtual void OnBattleEnd (bool)
 Called at the end of battle. More...
 
virtual void OnStartGrouping ()
 Called x minutes before battle start when player in zone are invite to join queue. More...
 
virtual void OnPlayerJoinWar (Player *)
 Called when a player accept to join the battle. More...
 
virtual void OnPlayerLeaveWar (Player *)
 Called when a player leave the battle. More...
 
virtual void OnPlayerLeaveZone (Player *)
 Called when a player leave battlefield zone. More...
 
virtual void OnPlayerEnterZone (Player *)
 Called when a player enter in battlefield zone. More...
 
void SendWarning (uint8 id, WorldObject const *target=nullptr)
 
void PlayerAcceptInviteToQueue (Player *player)
 
void PlayerAcceptInviteToWar (Player *player)
 
uint32 GetBattleId () const
 
void AskToLeaveQueue (Player *player)
 
void PlayerAskToLeave (Player *player)
 
virtual void DoCompleteOrIncrementAchievement (uint32, Player *, uint8)
 
bool CanFlyIn ()
 Return if we can use mount in battlefield. More...
 
void StartBattle ()
 
void EndBattle (bool endByTimer)
 
void HideNpc (Creature *creature)
 
void ShowNpc (Creature *creature, bool aggressive)
 
GraveyardVect GetGraveyardVector () const
 
uint32 GetTimer () const
 
void SetTimer (uint32 timer)
 
void DoPlaySoundToAll (uint32 SoundID)
 
void InvitePlayerToQueue (Player *player)
 
void InvitePlayerToWar (Player *player)
 
void InitStalker (uint32 entry, Position const &pos)
 
void ProcessEvent (WorldObject *target, uint32 eventId, WorldObject *invoker) override
 
- Public Member Functions inherited from ZoneScript
 ZoneScript ()
 
 ZoneScript (ZoneScript const &right)
 
 ZoneScript (ZoneScript &&right) noexcept
 
ZoneScriptoperator= (ZoneScript const &right)
 
ZoneScriptoperator= (ZoneScript &&right) noexcept
 
virtual ~ZoneScript ()
 
virtual uint32 GetCreatureEntry (ObjectGuid::LowType, CreatureData const *data)
 
virtual uint32 GetGameObjectEntry (ObjectGuid::LowType, uint32 entry)
 
virtual void OnCreatureCreate (Creature *)
 
virtual void OnCreatureRemove (Creature *)
 
virtual void OnGameObjectCreate (GameObject *)
 
virtual void OnGameObjectRemove (GameObject *)
 
virtual void OnAreaTriggerCreate (AreaTrigger *areaTrigger)
 
virtual void OnAreaTriggerRemove (AreaTrigger *areaTrigger)
 
virtual void OnUnitDeath (Unit *unit)
 
virtual ObjectGuid GetGuidData (uint32) const
 
virtual void SetGuidData (uint32, ObjectGuid)
 
virtual uint64 GetData64 (uint32) const
 
virtual void SetData64 (uint32, uint64)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void TriggerGameEvent (uint32 gameEventId, WorldObject *source=nullptr, WorldObject *target=nullptr)
 
virtual void ProcessEvent (WorldObject *, uint32, WorldObject *)
 
virtual void DoAction (uint32 actionId, WorldObject *source=nullptr, WorldObject *target=nullptr)
 
virtual void OnFlagStateChange (GameObject *flagInBase, FlagState oldValue, FlagState newValue, Player *player)
 
virtual bool CanCaptureFlag (AreaTrigger *areaTrigger, Player *player)
 
virtual void OnCaptureFlag (AreaTrigger *areaTrigger, Player *player)
 

Protected Attributes

bool warnedFiveMinutes
 
bool warnedTwoMinutes
 
bool warnedOneMinute
 
bool updatedNPCAndObjects
 
uint32 m_updateObjectsTimer
 
uint32 m_BonusTime
 
GuidSet BattleInactiveNPCs
 
GuidSet BattleInactiveGOs
 
GuidSet TemporaryNPCs
 
GuidSet TemporaryGOs
 
GuidSet Towers
 
uint8 m_iCellblockRandom
 
ObjectGuid TBGatesGUID
 
ObjectGuid TBDoorGUID
 
ObjectGuid m_gateToTheHoleGUID
 
ObjectGuid m_gateDBlockGUID
 
ObjectGuid m_gateCursedDepthsGUID
 
- Protected Attributes inherited from Battlefield
ObjectGuid StalkerGuid
 
uint32 m_Timer
 
bool m_IsEnabled
 
bool m_isActive
 
TeamId m_DefenderTeam
 
ControlZoneHandlerMap ControlZoneHandlers
 
GuidUnorderedSet m_players [PVP_TEAMS_COUNT]
 
GuidUnorderedSet m_PlayersInQueue [PVP_TEAMS_COUNT]
 
GuidUnorderedSet m_PlayersInWar [PVP_TEAMS_COUNT]
 
PlayerTimerMap m_InvitedPlayers [PVP_TEAMS_COUNT]
 
PlayerTimerMap m_PlayersWillBeKick [PVP_TEAMS_COUNT]
 
uint32 m_TypeId
 
uint32 m_BattleId
 
uint32 m_ZoneId
 
uint32 m_MapId
 
Mapm_Map
 
uint32 m_MaxPlayer
 
uint32 m_MinPlayer
 
uint32 m_MinLevel
 
uint32 m_BattleTime
 
uint32 m_NoWarBattleTime
 
uint32 m_RestartAfterCrash
 
uint32 m_TimeForAcceptInvite
 
uint32 m_uiKickDontAcceptTimer
 
WorldLocation KickPosition
 
uint32 m_uiKickAfkPlayersTimer
 
GraveyardVect m_GraveyardList
 
uint32 m_StartGroupingTimer
 
bool m_StartGrouping
 
GuidUnorderedSet m_Groups [PVP_TEAMS_COUNT]
 
std::vector< uint64m_Data64
 
std::vector< uint32m_Data32
 

Additional Inherited Members

- Public Types inherited from Battlefield
typedef std::unordered_map< uint32, std::unique_ptr< BattlefieldControlZoneHandler > > ControlZoneHandlerMap
 typedef of map witch store capturepoint and the associate gameobject entry More...
 
- Protected Member Functions inherited from Battlefield
void KickAfkPlayers ()
 
virtual void SendRemoveWorldStates (Player *)
 
void BroadcastPacketToZone (WorldPacket const *data) const
 
void BroadcastPacketToQueue (WorldPacket const *data) const
 
void BroadcastPacketToWar (WorldPacket const *data) const
 
void RegisterZone (uint32 zoneid)
 
bool HasPlayer (Player *player) const
 
void TeamCastSpell (TeamId team, int32 spellId)
 

Detailed Description

Definition at line 568 of file BattlefieldTB.h.

Constructor & Destructor Documentation

◆ ~BattlefieldTB()

BattlefieldTB::~BattlefieldTB ( )

Definition at line 40 of file BattlefieldTB.cpp.

Member Function Documentation

◆ Battlefield() [1/3]

Battlefield::Battlefield ( Battlefield &&  right)
delete

◆ Battlefield() [2/3]

Battlefield::Battlefield ( Battlefield const &  right)
delete

◆ Battlefield() [3/3]

Battlefield::Battlefield ( Map map)
explicit

Constructor.

Definition at line 146 of file Battlefield.cpp.

◆ CreateCapturePoints()

void BattlefieldTB::CreateCapturePoints ( )

◆ HandleKill()

void BattlefieldTB::HandleKill ( Player ,
Unit  
)
overridevirtual

Called when a Unit is kill in battlefield zone.

Reimplemented from Battlefield.

Definition at line 686 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ OnBattleEnd()

void BattlefieldTB::OnBattleEnd ( bool  )
overridevirtual

Called at the end of battle.

Reimplemented from Battlefield.

Definition at line 292 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ OnBattleStart()

void BattlefieldTB::OnBattleStart ( )
overridevirtual

Called on start.

Reimplemented from Battlefield.

Definition at line 254 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ OnCreatureCreate()

void BattlefieldTB::OnCreatureCreate ( Creature creature)
overridevirtual

Reimplemented from ZoneScript.

Definition at line 480 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ OnGameObjectCreate()

void BattlefieldTB::OnGameObjectCreate ( GameObject go)
overridevirtual

Reimplemented from ZoneScript.

Definition at line 536 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ OnPlayerEnterZone()

void BattlefieldTB::OnPlayerEnterZone ( Player )
overridevirtual

Called when a player enter in battlefield zone.

Reimplemented from Battlefield.

Definition at line 198 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ OnPlayerJoinWar()

void BattlefieldTB::OnPlayerJoinWar ( Player )
overridevirtual

Called when a player accept to join the battle.

Reimplemented from Battlefield.

Definition at line 210 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ OnPlayerLeaveWar()

void BattlefieldTB::OnPlayerLeaveWar ( Player )
overridevirtual

Called when a player leave the battle.

Reimplemented from Battlefield.

Definition at line 225 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ OnPlayerLeaveZone()

void BattlefieldTB::OnPlayerLeaveZone ( Player )
overridevirtual

Called when a player leave battlefield zone.

Reimplemented from Battlefield.

Definition at line 204 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ OnStartGrouping()

void BattlefieldTB::OnStartGrouping ( )
overridevirtual

Called x minutes before battle start when player in zone are invite to join queue.

Reimplemented from Battlefield.

Definition at line 238 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ ProcessEvent()

void BattlefieldTB::ProcessEvent ( WorldObject obj,
uint32  eventId,
WorldObject invoker 
)
overridevirtual

Reimplemented from Battlefield.

Definition at line 577 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ PromotePlayer()

void BattlefieldTB::PromotePlayer ( Player killer)

Definition at line 698 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveAurasFromPlayer()

void BattlefieldTB::RemoveAurasFromPlayer ( Player player)

Definition at line 230 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetupBattlefield()

bool BattlefieldTB::SetupBattlefield ( )
overridevirtual

Call this to init the Battlefield.

Reimplemented from Battlefield.

Definition at line 42 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ TowerDamaged()

void BattlefieldTB::TowerDamaged ( TBTowerId  tbTowerId)

Definition at line 618 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ TowerDestroyed()

void BattlefieldTB::TowerDestroyed ( TBTowerId  tbTowerId)

Definition at line 633 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Update()

bool BattlefieldTB::Update ( uint32  diff)
overridevirtual

Called every time for update bf data and time.

  • Update timer for start/end battle
  • Invite player in zone to queue m_StartGroupingTimer minutes before start
  • Kick Afk players
    Parameters
    diff: time ellapsed since last call (in ms)

Reimplemented from Battlefield.

Definition at line 158 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:

◆ UpdateCapturedBaseCount()

void BattlefieldTB::UpdateCapturedBaseCount ( )

Definition at line 660 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateNPCsAndGameObjects()

void BattlefieldTB::UpdateNPCsAndGameObjects ( )

Definition at line 346 of file BattlefieldTB.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ BattleInactiveGOs

GuidSet BattlefieldTB::BattleInactiveGOs
protected

Definition at line 626 of file BattlefieldTB.h.

◆ BattleInactiveNPCs

GuidSet BattlefieldTB::BattleInactiveNPCs
protected

Definition at line 625 of file BattlefieldTB.h.

◆ m_BonusTime

uint32 BattlefieldTB::m_BonusTime
protected

Definition at line 623 of file BattlefieldTB.h.

◆ m_gateCursedDepthsGUID

ObjectGuid BattlefieldTB::m_gateCursedDepthsGUID
protected

Definition at line 640 of file BattlefieldTB.h.

◆ m_gateDBlockGUID

ObjectGuid BattlefieldTB::m_gateDBlockGUID
protected

Definition at line 639 of file BattlefieldTB.h.

◆ m_gateToTheHoleGUID

ObjectGuid BattlefieldTB::m_gateToTheHoleGUID
protected

Definition at line 638 of file BattlefieldTB.h.

◆ m_iCellblockRandom

uint8 BattlefieldTB::m_iCellblockRandom
protected

Definition at line 633 of file BattlefieldTB.h.

◆ m_updateObjectsTimer

uint32 BattlefieldTB::m_updateObjectsTimer
protected

Definition at line 621 of file BattlefieldTB.h.

◆ TBDoorGUID

ObjectGuid BattlefieldTB::TBDoorGUID
protected

Definition at line 636 of file BattlefieldTB.h.

◆ TBGatesGUID

ObjectGuid BattlefieldTB::TBGatesGUID
protected

Definition at line 635 of file BattlefieldTB.h.

◆ TemporaryGOs

GuidSet BattlefieldTB::TemporaryGOs
protected

Definition at line 629 of file BattlefieldTB.h.

◆ TemporaryNPCs

GuidSet BattlefieldTB::TemporaryNPCs
protected

Definition at line 628 of file BattlefieldTB.h.

◆ Towers

GuidSet BattlefieldTB::Towers
protected

Definition at line 631 of file BattlefieldTB.h.

◆ updatedNPCAndObjects

bool BattlefieldTB::updatedNPCAndObjects
protected

Definition at line 620 of file BattlefieldTB.h.

◆ warnedFiveMinutes

bool BattlefieldTB::warnedFiveMinutes
protected

Definition at line 616 of file BattlefieldTB.h.

◆ warnedOneMinute

bool BattlefieldTB::warnedOneMinute
protected

Definition at line 618 of file BattlefieldTB.h.

◆ warnedTwoMinutes

bool BattlefieldTB::warnedTwoMinutes
protected

Definition at line 617 of file BattlefieldTB.h.


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