TrinityCore
Loading...
Searching...
No Matches
BattlefieldWG Class Reference

#include <BattlefieldWG.h>

+ Inheritance diagram for BattlefieldWG:

Public Member Functions

 ~BattlefieldWG ()
 
void OnBattleStart () override
 Called when the battle start.
 
void OnBattleEnd (bool endByTimer) override
 Called when battle end.
 
void OnStartGrouping () override
 Called when grouping starts (15 minutes before battlestart)
 
void OnPlayerJoinWar (Player *player) override
 Called when player accept invite to join battle.
 
void OnPlayerLeaveWar (Player *player) override
 Called when player left the battle.
 
void OnPlayerLeaveZone (Player *player) override
 Called when player left the WG zone.
 
void OnPlayerEnterZone (Player *player) override
 Called when player enters in WG zone.
 
bool Update (uint32 diff) override
 Called for update battlefield data.
 
void OnCreatureCreate (Creature *creature) override
 Called when a creature is created.
 
void OnCreatureRemove (Creature *creature) override
 Called when a creature is removed.
 
void OnGameObjectCreate (GameObject *go) override
 Called when a gameobject is created.
 
void BrokenWallOrTower (TeamId team, BfWGGameObjectBuilding *building)
 Called when a wall/tower is broken.
 
void UpdateDamagedTowerCount (TeamId team)
 Called when a tower is damaged.
 
void UpdatedDestroyedTowerCount (TeamId team)
 Called when tower is broken.
 
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.
 
GameObject * GetRelic ()
 Return pointer to relic object.
 
void SetRelic (ObjectGuid relicGUID)
 Define relic object.
 
bool CanInteractWithRelic ()
 Check if players can interact with the relic (Only if the last door has been broken)
 
void SetRelicInteractible (bool allow)
 Define if player can interact with the relic.
 
void UpdateVehicleCountWG ()
 
void UpdateCounterVehicle (bool init)
 
void SendInitWorldStatesToAll () override
 Send all worldstate data to all player in zone.
 
void FillInitialWorldStates (WorldPackets::WorldState::InitWorldStates &packet) override
 
void HandleKill (Player *killer, Unit *victim) override
 Called when a Unit is kill in battlefield zone.
 
void OnUnitDeath (Unit *unit) override
 
void HandlePromotion (Player *killer, Unit *killed)
 
void PromotePlayer (Player *killer)
 
void UpdateTenacity ()
 
void ProcessEvent (WorldObject *obj, uint32 eventId) override
 
bool FindAndRemoveVehicleFromList (Unit *vehicle)
 
uint8 GetSpiritGraveyardId (uint32 areaId) const
 
uint32 GetData (uint32 data) const override
 
- Public Member Functions inherited from Battlefield
 Battlefield ()
 Constructor.
 
 Battlefield (Battlefield const &)=delete
 
 Battlefield (Battlefield &&)=delete
 
Battlefield & operator= (Battlefield const &)=delete
 
Battlefield & operator= (Battlefield &&)=delete
 
virtual ~Battlefield ()
 Destructor.
 
void SendInitWorldStatesTo (Player *player)
 
void SendUpdateWorldState (uint32 variable, uint32 value)
 Update data of a worldstate to all players present in zone.
 
void InvitePlayersInZoneToQueue ()
 Invite all players in zone to join the queue, called x minutes before battle start in Update()
 
void InvitePlayersInQueueToWar ()
 Invite all players in queue to join battle on battle start.
 
void InvitePlayersInZoneToWar ()
 Invite all players in zone to join battle on battle start.
 
uint32 GetTypeId () const
 
uint32 GetZoneId () 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.
 
void ToggleBattlefield (bool enable)
 Enable or Disable battlefield.
 
bool IsEnabled () const
 Return if battlefield is enable.
 
void KickPlayerFromBattlefield (ObjectGuid guid)
 Kick player from battlefield and teleport him to kick-point location.
 
void HandlePlayerEnterZone (Player *player, uint32 zone)
 Called when player (player) enter in zone.
 
void HandlePlayerLeaveZone (Player *player, uint32 zone)
 Called when player (player) leave the zone.
 
virtual uint64 GetData64 (uint32 dataId) const override
 
virtual void SetData64 (uint32 dataId, uint64 value) 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)
 
Group * GetFreeBfRaid (TeamId TeamId)
 Find a not full battlefield group, if there is no, create one.
 
Group * GetGroupPlayer (ObjectGuid guid, TeamId TeamId)
 Return battlefield group where player is.
 
bool AddOrSetPlayerToCorrectBfGroup (Player *player)
 Force player to join a battlefield group.
 
WorldSafeLocsEntry const * GetClosestGraveyard (Player *player)
 
virtual void AddPlayerToResurrectQueue (ObjectGuid npc_guid, ObjectGuid player_guid)
 
void RemovePlayerFromResurrectQueue (ObjectGuid player_guid)
 
void SetGraveyardNumber (uint32 number)
 
BfGraveyard * GetGraveyardById (uint32 id) const
 
Creature * SpawnCreature (uint32 entry, Position const &pos)
 
GameObject * SpawnGameObject (uint32 entry, Position const &pos, QuaternionData const &rot)
 
Creature * GetCreature (ObjectGuid guid)
 
GameObject * GetGameObject (ObjectGuid guid)
 
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)
 
bool CanFlyIn ()
 Return if we can use mount in battlefield.
 
void SendAreaSpiritHealerQueryOpcode (Player *player, ObjectGuid guid)
 
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)
 
- Public Member Functions inherited from ZoneScript
 ZoneScript ()
 
virtual ~ZoneScript ()
 
virtual uint32 GetCreatureEntry (ObjectGuid::LowType, CreatureData const *data)
 
virtual uint32 GetGameObjectEntry (ObjectGuid::LowType, uint32 entry)
 
virtual void OnGameObjectRemove (GameObject *)
 
virtual ObjectGuid GetGuidData (uint32) const
 
virtual void SetGuidData (uint32, ObjectGuid)
 

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
 
uint32 m_saveTimer
 
ObjectGuid m_titansRelicGUID
 
- Protected Attributes inherited from Battlefield
ObjectGuid StalkerGuid
 
uint32 m_Timer
 
bool m_IsEnabled
 
bool m_isActive
 
TeamId m_DefenderTeam
 
BfCapturePointMap m_capturePoints
 
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
 
Map * m_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_LastResurrectTimer
 
uint32 m_StartGroupingTimer
 
bool m_StartGrouping
 
GuidUnorderedSet m_Groups [PVP_TEAMS_COUNT]
 
std::vector< uint64 > m_Data64
 
std::vector< uint32 > m_Data32
 

Additional Inherited Members

- Public Types inherited from Battlefield
typedef std::map< ObjectGuid::LowType, BfCapturePoint * > BfCapturePointMap
 typedef of map witch store capturepoint and the associate gameobject entry
 
- 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 AddCapturePoint (BfCapturePoint *cp)
 
BfCapturePoint * GetCapturePoint (uint32 entry) const
 
void RegisterZone (uint32 zoneid)
 
bool HasPlayer (Player *player) const
 
void TeamCastSpell (TeamId team, int32 spellId)
 

Detailed Description

Definition at line 212 of file BattlefieldWG.h.

Constructor & Destructor Documentation

◆ ~BattlefieldWG()

BattlefieldWG::~BattlefieldWG ( )

Definition at line 402 of file BattlefieldWG.cpp.

References BuildingsInZone, and Workshops.

Member Function Documentation

◆ BrokenWallOrTower()

◆ CanInteractWithRelic()

bool BattlefieldWG::CanInteractWithRelic ( )
inline

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

Definition at line 332 of file BattlefieldWG.h.

References m_isRelicInteractible.

Referenced by ProcessEvent().

◆ DoCompleteOrIncrementAchievement()

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

Reimplemented from Battlefield.

Definition at line 764 of file BattlefieldWG.cpp.

References ACHIEVEMENTS_WIN_WG_100, Player::CompletedAchievement(), and sAchievementStore.

Referenced by OnBattleEnd(), and UpdatedDestroyedTowerCount().

◆ FillInitialWorldStates()

◆ FindAndRemoveVehicleFromList()

bool BattlefieldWG::FindAndRemoveVehicleFromList ( Unit *  vehicle)

◆ GetData()

◆ GetRelic()

GameObject * BattlefieldWG::GetRelic ( )
inline

Return pointer to relic object.

Definition at line 326 of file BattlefieldWG.h.

References Battlefield::GetGameObject(), and m_titansRelicGUID.

Referenced by BfWGGameObjectBuilding::Destroyed(), and ProcessEvent().

◆ GetSpiritGraveyardId()

◆ 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 962 of file BattlefieldWG.cpp.

References Object::GetTypeId(), HandlePromotion(), Unit::SetUnitFlag(), TYPEID_PLAYER, and UNIT_FLAG_SKINNABLE.

◆ HandlePromotion()

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

◆ 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 650 of file BattlefieldWG.cpp.

References ACHIEVEMENTS_WIN_WG, ACHIEVEMENTS_WIN_WG_TIMER_10, BATTLEFIELD_WG_DATA_DEF_A, BATTLEFIELD_WG_DATA_DEF_H, BATTLEFIELD_WG_DATA_WON_A, BATTLEFIELD_WG_DATA_WON_H, BATTLEFIELD_WG_GY_HORDE, BATTLEFIELD_WG_TEXT_FORTRESS_CAPTURE_ALLIANCE, BATTLEFIELD_WG_TEXT_FORTRESS_CAPTURE_HORDE, BATTLEFIELD_WG_TEXT_FORTRESS_DEFEND_ALLIANCE, BATTLEFIELD_WG_TEXT_FORTRESS_DEFEND_HORDE, BuildingsInZone, CanonList, ObjectGuid::Clear(), DefenderPortalList, DoCompleteOrIncrementAchievement(), ObjectAccessor::FindPlayer(), Battlefield::GetAttackerTeam(), Battlefield::GetCreature(), Battlefield::GetDefenderTeam(), Battlefield::GetGameObject(), Battlefield::GetGraveyardById(), Battlefield::GetTimer(), Battlefield::HideNpc(), ObjectGuid::IsEmpty(), Battlefield::m_DefenderTeam, Battlefield::m_players, Battlefield::m_PlayersInWar, m_titansRelicGUID, m_vehicles, PVP_TEAMS_COUNT, QUEST_VICTORY_WINTERGRASP_A, QUEST_VICTORY_WINTERGRASP_H, RemoveAurasFromPlayer(), RESPAWN_IMMEDIATELY, RESPAWN_ONE_DAY, Battlefield::SendWarning(), SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, SPELL_DEFEAT_REWARD, SPELL_ESSENCE_OF_WINTERGRASP, SPELL_HORDE_CONTROL_PHASE_SHIFT, SPELL_VICTORY_REWARD, TEAM_ALLIANCE, TEAM_HORDE, WintergraspFaction, and Workshops.

◆ OnBattleStart()

◆ OnCreatureCreate()

◆ OnCreatureRemove()

void BattlefieldWG::OnCreatureRemove ( Creature *  creature)
overridevirtual

Called when a creature is removed.

  • Update vehicle count

Reimplemented from ZoneScript.

Definition at line 892 of file BattlefieldWG.cpp.

◆ OnGameObjectCreate()

◆ 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 1123 of file BattlefieldWG.cpp.

References Unit::AddAura(), Battlefield::m_DefenderTeam, Battlefield::m_isActive, RemoveAurasFromPlayer(), Battlefield::SendInitWorldStatesTo(), SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, SPELL_HORDE_CONTROL_PHASE_SHIFT, and TEAM_HORDE.

◆ OnPlayerJoinWar()

void BattlefieldWG::OnPlayerJoinWar ( Player *  player)
overridevirtual

◆ OnPlayerLeaveWar()

void BattlefieldWG::OnPlayerLeaveWar ( Player *  player)
overridevirtual

◆ OnPlayerLeaveZone()

void BattlefieldWG::OnPlayerLeaveZone ( Player *  player)
overridevirtual

◆ 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 788 of file BattlefieldWG.cpp.

References BATTLEFIELD_WG_TEXT_START_GROUPING, and Battlefield::SendWarning().

◆ OnUnitDeath()

void BattlefieldWG::OnUnitDeath ( Unit *  unit)
overridevirtual

◆ ProcessEvent()

◆ PromotePlayer()

◆ RemoveAurasFromPlayer()

◆ SendInitWorldStatesToAll()

void BattlefieldWG::SendInitWorldStatesToAll ( )
overridevirtual

Send all worldstate data to all player in zone.

Implements Battlefield.

Definition at line 1182 of file BattlefieldWG.cpp.

References ObjectAccessor::FindPlayer(), Battlefield::m_players, PVP_TEAMS_COUNT, and Battlefield::SendInitWorldStatesTo().

Referenced by UpdatedDestroyedTowerCount().

◆ SetRelic()

void BattlefieldWG::SetRelic ( ObjectGuid  relicGUID)
inline

Define relic object.

Definition at line 329 of file BattlefieldWG.h.

References m_titansRelicGUID.

◆ SetRelicInteractible()

void BattlefieldWG::SetRelicInteractible ( bool  allow)
inline

Define if player can interact with the relic.

Definition at line 335 of file BattlefieldWG.h.

References m_isRelicInteractible.

Referenced by BfWGGameObjectBuilding::Destroyed().

◆ SetupBattlefield()

bool BattlefieldWG::SetupBattlefield ( )
overridevirtual

Called when battlefield is setup, at server start.

Reimplemented from Battlefield.

Definition at line 411 of file BattlefieldWG.cpp.

References WintergraspGameObjectData::AllianceEntry, AREA_WINTERGRASP, BATTLEFIELD_BATTLEID_WG, BATTLEFIELD_WG, BATTLEFIELD_WG_DATA_DEF_A, BATTLEFIELD_WG_DATA_DEF_H, BATTLEFIELD_WG_DATA_MAX, BATTLEFIELD_WG_DATA_WON_A, BATTLEFIELD_WG_DATA_WON_H, BATTLEFIELD_WG_GRAVEYARD_MAX, BATTLEFIELD_WG_MAPID, BATTLEFIELD_WG_NPC_STALKER, BATTLEFIELD_WG_WORKSHOP_NE, BuildingsInZone, CanonList, ClockWorldState, CONFIG_WINTERGRASP_BATTLETIME, CONFIG_WINTERGRASP_ENABLE, CONFIG_WINTERGRASP_NOBATTLETIME, CONFIG_WINTERGRASP_PLR_MAX, CONFIG_WINTERGRASP_PLR_MIN, CONFIG_WINTERGRASP_PLR_MIN_LVL, CONFIG_WINTERGRASP_RESTART_AFTER_CRASH, DefenderPortalList, Battlefield::GetAttackerTeam(), Battlefield::GetDefenderTeam(), Position::GetPosition(), WintergraspWorkshop::GiveControlTo(), GO_DESTRUCTIBLE_DESTROYED, GO_WINTERGRASP_VAULT_GATE, Battlefield::HideNpc(), WintergraspGameObjectData::HordeEntry, IN_MILLISECONDS, BfWGGameObjectBuilding::Init(), BfGraveyard::Initialize(), Battlefield::InitStalker(), Battlefield::IsEnabled(), Battlefield::KickPosition, Battlefield::m_BattleId, Battlefield::m_BattleTime, Battlefield::m_Data32, Battlefield::m_DefenderTeam, Battlefield::m_GraveyardList, Battlefield::m_isActive, Battlefield::m_IsEnabled, Battlefield::m_Map, Battlefield::m_MapId, WorldLocation::m_mapId, Battlefield::m_MaxPlayer, Battlefield::m_MinLevel, Battlefield::m_MinPlayer, Battlefield::m_NoWarBattleTime, Battlefield::m_RestartAfterCrash, m_saveTimer, Battlefield::m_StartGrouping, Battlefield::m_StartGroupingTimer, m_tenacityStack, m_tenacityTeam, Battlefield::m_TimeForAcceptInvite, Battlefield::m_Timer, Battlefield::m_TypeId, Battlefield::m_ZoneId, MINUTE, NPC_WINTERGRASP_TOWER_CANNON, WintergraspGameObjectData::Pos, Battlefield::RegisterZone(), Position::Relocate(), RESPAWN_IMMEDIATELY, RESPAWN_ONE_DAY, WintergraspGameObjectData::Rot, Battlefield::SetData(), Battlefield::SetGraveyardNumber(), BfGraveyardWG::SetTextId(), sMapMgr, Battlefield::SpawnCreature(), Battlefield::SpawnGameObject(), sWorld, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, UpdateCounterVehicle(), urand(), WG_MAX_OBJ, WG_MAX_TELEPORTER, WG_MAX_TURRET, WG_MAX_WORKSHOP, WGGameObjectBuilding, WGGraveyard, WGPortalDefenderData, WGTurret, WintergraspStalkerPos, Workshops, WS_BATTLEFIELD_WG_ACTIVE, WS_BATTLEFIELD_WG_ATTACKED_A, WS_BATTLEFIELD_WG_ATTACKED_H, WS_BATTLEFIELD_WG_DEFENDED_A, WS_BATTLEFIELD_WG_DEFENDED_H, and WS_BATTLEFIELD_WG_DEFENDER.

◆ Update()

bool BattlefieldWG::Update ( uint32  diff)
overridevirtual

◆ UpdateCounterVehicle()

◆ UpdateDamagedTowerCount()

void BattlefieldWG::UpdateDamagedTowerCount ( TeamId  team)

Called when a tower is damaged.

  • Update tower count (for reward calcul)

Definition at line 1283 of file BattlefieldWG.cpp.

References BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, and Battlefield::GetAttackerTeam().

Referenced by BfWGGameObjectBuilding::Damaged().

◆ UpdatedDestroyedTowerCount()

◆ UpdateTenacity()

◆ UpdateVehicleCountWG()

Member Data Documentation

◆ BuildingsInZone

GameObjectBuildingVect BattlefieldWG::BuildingsInZone
protected

◆ CanonList

GuidVector BattlefieldWG::CanonList
protected

Definition at line 367 of file BattlefieldWG.h.

Referenced by OnBattleEnd(), OnBattleStart(), and SetupBattlefield().

◆ DefenderPortalList

GuidVector BattlefieldWG::DefenderPortalList[PVP_TEAMS_COUNT]
protected

Definition at line 363 of file BattlefieldWG.h.

Referenced by OnBattleEnd(), and SetupBattlefield().

◆ m_isRelicInteractible

bool BattlefieldWG::m_isRelicInteractible
protected

Definition at line 359 of file BattlefieldWG.h.

Referenced by CanInteractWithRelic(), and SetRelicInteractible().

◆ m_saveTimer

uint32 BattlefieldWG::m_saveTimer
protected

Definition at line 371 of file BattlefieldWG.h.

Referenced by SetupBattlefield(), and Update().

◆ m_tenacityStack

uint32 BattlefieldWG::m_tenacityStack
protected

Definition at line 370 of file BattlefieldWG.h.

Referenced by SetupBattlefield(), and UpdateTenacity().

◆ m_tenacityTeam

TeamId BattlefieldWG::m_tenacityTeam
protected

Definition at line 369 of file BattlefieldWG.h.

Referenced by SetupBattlefield(), and UpdateTenacity().

◆ m_titansRelicGUID

ObjectGuid BattlefieldWG::m_titansRelicGUID
protected

Definition at line 373 of file BattlefieldWG.h.

Referenced by GetRelic(), OnBattleEnd(), OnBattleStart(), and SetRelic().

◆ m_vehicles

GuidUnorderedSet BattlefieldWG::m_vehicles[PVP_TEAMS_COUNT]
protected

◆ Workshops


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