TrinityCore
BattlefieldWG Class Reference

#include <BattlefieldWG.h>

+ Inheritance diagram for BattlefieldWG:

Public Member Functions

 ~BattlefieldWG ()
 
void OnBattleStart () override
 Called when the battle start. More...
 
void OnBattleEnd (bool endByTimer) override
 Called when battle end. More...
 
void OnStartGrouping () override
 Called when grouping starts (15 minutes before battlestart) More...
 
void OnPlayerJoinWar (Player *player) override
 Called when player accept invite to join battle. More...
 
void OnPlayerLeaveWar (Player *player) override
 Called when player left the battle. More...
 
void OnPlayerLeaveZone (Player *player) override
 Called when player left the WG zone. More...
 
void OnPlayerEnterZone (Player *player) override
 Called when player enters in WG zone. More...
 
void OnCreatureCreate (Creature *creature) override
 Called when a creature is created. More...
 
void OnCreatureRemove (Creature *creature) override
 Called when a creature is removed. More...
 
void OnGameObjectCreate (GameObject *go) override
 Called when a gameobject is created. More...
 
void BrokenWallOrTower (TeamId team, BfWGGameObjectBuilding *building)
 Called when a wall/tower is broken. More...
 
void UpdateDamagedTowerCount (TeamId team)
 Called when a tower is damaged. More...
 
void UpdatedDestroyedTowerCount (TeamId team)
 Called when tower is broken. More...
 
void DoCompleteOrIncrementAchievement (uint32 achievement, Player *player, uint8 incrementNumber=1) override
 
void RemoveAurasFromPlayer (Player *player)
 
bool SetupBattlefield () override
 Called when battlefield is setup, at server start. More...
 
GameObjectGetRelic ()
 Return pointer to relic object. More...
 
void SetRelic (ObjectGuid relicGUID)
 Define relic object. More...
 
bool CanInteractWithRelic ()
 Check if players can interact with the relic (Only if the last door has been broken) More...
 
void SetRelicInteractible (bool allow)
 Define if player can interact with the relic. More...
 
void UpdateVehicleCountWG ()
 
void UpdateCounterVehicle (bool init)
 
void HandleKill (Player *killer, Unit *victim) override
 Called when a Unit is kill in battlefield zone. More...
 
void OnUnitDeath (Unit *unit) override
 
void HandlePromotion (Player *killer, Unit *killed)
 
void PromotePlayer (Player *killer)
 
void UpdateTenacity ()
 
void ProcessEvent (WorldObject *obj, uint32 eventId, WorldObject *invoker) override
 
bool FindAndRemoveVehicleFromList (Unit *vehicle)
 
uint8 GetSpiritGraveyardId (uint32 areaId) const
 
uint32 GetData (uint32 data) const override
 
 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 m_isRelicInteractible
 
WorkshopVect Workshops
 
GuidVector DefenderPortalList [PVP_TEAMS_COUNT]
 
GameObjectBuildingVect BuildingsInZone
 
GuidUnorderedSet m_vehicles [PVP_TEAMS_COUNT]
 
GuidVector CanonList
 
TeamId m_tenacityTeam
 
uint32 m_tenacityStack
 
ObjectGuid m_titansRelicGUID
 
- 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 200 of file BattlefieldWG.h.

Constructor & Destructor Documentation

◆ ~BattlefieldWG()

BattlefieldWG::~BattlefieldWG ( )

Definition at line 399 of file BattlefieldWG.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.

◆ BrokenWallOrTower()

void BattlefieldWG::BrokenWallOrTower ( TeamId  team,
BfWGGameObjectBuilding building 
)

Called when a wall/tower is broken.

  • Update quest

Definition at line 1138 of file BattlefieldWG.cpp.

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

◆ CanInteractWithRelic()

bool BattlefieldWG::CanInteractWithRelic ( )
inline

Check if players can interact with the relic (Only if the last door has been broken)

Definition at line 313 of file BattlefieldWG.h.

+ Here is the caller graph for this function:

◆ DoCompleteOrIncrementAchievement()

void BattlefieldWG::DoCompleteOrIncrementAchievement ( uint32  achievement,
Player player,
uint8  incrementNumber = 1 
)
overridevirtual

Reimplemented from Battlefield.

Definition at line 744 of file BattlefieldWG.cpp.

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

◆ FindAndRemoveVehicleFromList()

bool BattlefieldWG::FindAndRemoveVehicleFromList ( Unit vehicle)

Definition at line 965 of file BattlefieldWG.cpp.

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

◆ GetData()

uint32 BattlefieldWG::GetData ( uint32  data) const
overridevirtual

Reimplemented from Battlefield.

Definition at line 1117 of file BattlefieldWG.cpp.

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

◆ GetRelic()

GameObject * BattlefieldWG::GetRelic ( )
inline

Return pointer to relic object.

Definition at line 307 of file BattlefieldWG.h.

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

◆ GetSpiritGraveyardId()

uint8 BattlefieldWG::GetSpiritGraveyardId ( uint32  areaId) const

Definition at line 773 of file BattlefieldWG.cpp.

+ Here is the caller graph for this function:

◆ HandleKill()

void BattlefieldWG::HandleKill ( Player ,
Unit  
)
overridevirtual

Called when a Unit is kill in battlefield zone.

@todoRecent PvP activity worldstate

Reimplemented from Battlefield.

Definition at line 949 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ HandlePromotion()

void BattlefieldWG::HandlePromotion ( Player killer,
Unit killed 
)

Definition at line 993 of file BattlefieldWG.cpp.

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

◆ OnBattleEnd()

void BattlefieldWG::OnBattleEnd ( bool  endByTimer)
overridevirtual

Called when battle end.

  • Remove relic and turret
  • Change banner/npc in keep if it needed
  • Saving battlestate
  • Reward honor/mark to player
  • Remove vehicle
    Parameters
    endByTimer: true if battle ended when timer is at 00:00, false if battle ended by clicking on relic

Reimplemented from Battlefield.

Definition at line 626 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ OnBattleStart()

void BattlefieldWG::OnBattleStart ( )
overridevirtual

Called when the battle start.

  • Spawn relic and turret
  • Rebuild tower and wall
  • Invite player to war

Reimplemented from Battlefield.

Definition at line 538 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ OnCreatureCreate()

void BattlefieldWG::OnCreatureCreate ( Creature creature)
overridevirtual

Called when a creature is created.

  • Update vehicle count

Reimplemented from ZoneScript.

Definition at line 799 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ OnCreatureRemove()

void BattlefieldWG::OnCreatureRemove ( Creature creature)
overridevirtual

Called when a creature is removed.

  • Update vehicle count

Reimplemented from ZoneScript.

Definition at line 872 of file BattlefieldWG.cpp.

◆ OnGameObjectCreate()

void BattlefieldWG::OnGameObjectCreate ( GameObject go)
overridevirtual

Called when a gameobject is created.

Reimplemented from ZoneScript.

Definition at line 905 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ OnPlayerEnterZone()

void BattlefieldWG::OnPlayerEnterZone ( Player player)
overridevirtual

Called when player enters in WG zone.

  • Update aura
  • Update worldstate
    Parameters
    player: Player who enters the zone

Reimplemented from Battlefield.

Definition at line 1109 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ OnPlayerJoinWar()

void BattlefieldWG::OnPlayerJoinWar ( Player player)
overridevirtual

Called when player accept invite to join battle.

  • Update aura
  • Teleport if it needed
  • Update worldstate
  • Update tenacity
    Parameters
    player: Player who accepted invite

Reimplemented from Battlefield.

Definition at line 1047 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ OnPlayerLeaveWar()

void BattlefieldWG::OnPlayerLeaveWar ( Player player)
overridevirtual

Called when player left the battle.

  • Update player aura
    Parameters
    player: Player who left the battle

Reimplemented from Battlefield.

Definition at line 1080 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ OnPlayerLeaveZone()

void BattlefieldWG::OnPlayerLeaveZone ( Player player)
overridevirtual

Called when player left the WG zone.

Parameters
player: Player who left the zone

Reimplemented from Battlefield.

Definition at line 1098 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ OnStartGrouping()

void BattlefieldWG::OnStartGrouping ( )
overridevirtual

Called when grouping starts (15 minutes before battlestart)

  • Invite all player in zone to join queue

Reimplemented from Battlefield.

Definition at line 768 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ OnUnitDeath()

void BattlefieldWG::OnUnitDeath ( Unit unit)
overridevirtual

Reimplemented from ZoneScript.

Definition at line 985 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ ProcessEvent()

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

Reimplemented from Battlefield.

Definition at line 1195 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ PromotePlayer()

void BattlefieldWG::PromotePlayer ( Player killer)

Definition at line 1004 of file BattlefieldWG.cpp.

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

◆ RemoveAurasFromPlayer()

void BattlefieldWG::RemoveAurasFromPlayer ( Player player)

Definition at line 1035 of file BattlefieldWG.cpp.

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

◆ SetRelic()

void BattlefieldWG::SetRelic ( ObjectGuid  relicGUID)
inline

Define relic object.

Definition at line 310 of file BattlefieldWG.h.

◆ SetRelicInteractible()

void BattlefieldWG::SetRelicInteractible ( bool  allow)
inline

Define if player can interact with the relic.

Definition at line 316 of file BattlefieldWG.h.

+ Here is the caller graph for this function:

◆ SetupBattlefield()

bool BattlefieldWG::SetupBattlefield ( )
overridevirtual

Called when battlefield is setup, at server start.

Reimplemented from Battlefield.

Definition at line 408 of file BattlefieldWG.cpp.

+ Here is the call graph for this function:

◆ UpdateCounterVehicle()

void BattlefieldWG::UpdateCounterVehicle ( bool  init)

Definition at line 605 of file BattlefieldWG.cpp.

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

◆ UpdateDamagedTowerCount()

void BattlefieldWG::UpdateDamagedTowerCount ( TeamId  team)

Called when a tower is damaged.

  • Update tower count (for reward calcul)

Definition at line 1233 of file BattlefieldWG.cpp.

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

◆ UpdatedDestroyedTowerCount()

void BattlefieldWG::UpdatedDestroyedTowerCount ( TeamId  team)

Called when tower is broken.

  • Update tower buff
  • check if three south tower is down for remove 10 minutes to wg

Definition at line 1152 of file BattlefieldWG.cpp.

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

◆ UpdateTenacity()

void BattlefieldWG::UpdateTenacity ( )

Definition at line 1250 of file BattlefieldWG.cpp.

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

◆ UpdateVehicleCountWG()

void BattlefieldWG::UpdateVehicleCountWG ( )

Definition at line 1242 of file BattlefieldWG.cpp.

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

Member Data Documentation

◆ BuildingsInZone

GameObjectBuildingVect BattlefieldWG::BuildingsInZone
protected

Definition at line 342 of file BattlefieldWG.h.

◆ CanonList

GuidVector BattlefieldWG::CanonList
protected

Definition at line 345 of file BattlefieldWG.h.

◆ DefenderPortalList

GuidVector BattlefieldWG::DefenderPortalList[PVP_TEAMS_COUNT]
protected

Definition at line 341 of file BattlefieldWG.h.

◆ m_isRelicInteractible

bool BattlefieldWG::m_isRelicInteractible
protected

Definition at line 337 of file BattlefieldWG.h.

◆ m_tenacityStack

uint32 BattlefieldWG::m_tenacityStack
protected

Definition at line 348 of file BattlefieldWG.h.

◆ m_tenacityTeam

TeamId BattlefieldWG::m_tenacityTeam
protected

Definition at line 347 of file BattlefieldWG.h.

◆ m_titansRelicGUID

ObjectGuid BattlefieldWG::m_titansRelicGUID
protected

Definition at line 350 of file BattlefieldWG.h.

◆ m_vehicles

GuidUnorderedSet BattlefieldWG::m_vehicles[PVP_TEAMS_COUNT]
protected

Definition at line 344 of file BattlefieldWG.h.

◆ Workshops

WorkshopVect BattlefieldWG::Workshops
protected

Definition at line 339 of file BattlefieldWG.h.


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