AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
BattlegroundAB Class Reference

#include "BattlegroundAB.h"

Inheritance diagram for BattlegroundAB:
Battleground

Classes

struct  CapturePointInfo
 

Public Member Functions

 BattlegroundAB ()
 
 ~BattlegroundAB () override
 
void AddPlayer (Player *player) override
 
void StartingEventCloseDoors () override
 
void StartingEventOpenDoors () override
 
void RemovePlayer (Player *player) override
 
void HandleAreaTrigger (Player *player, uint32 trigger) override
 
bool SetupBattleground () override
 
void Init () override
 
void EndBattleground (TeamId winnerTeamId) override
 
GraveyardStruct const * GetClosestGraveyard (Player *player) override
 
bool UpdatePlayerScore (Player *player, uint32 type, uint32 value, bool doAddHonor=true) override
 
void FillInitialWorldStates (WorldPacket &data) override
 
void EventPlayerClickedOnFlag (Player *source, GameObject *gameObject) override
 
bool AllNodesConrolledByTeam (TeamId teamId) const override
 
bool IsTeamScores500Disadvantage (TeamId teamId) const
 
TeamId GetPrematureWinner () override
 
- Public Member Functions inherited from Battleground
 Battleground ()
 
virtual ~Battleground ()
 
void Update (uint32 diff)
 
virtual bool SetupBattleground ()
 
virtual void Init ()
 
virtual void StartingEventCloseDoors ()
 
virtual void StartingEventOpenDoors ()
 
virtual void ResetBGSubclass ()
 
virtual void DestroyGate (Player *, GameObject *)
 
virtual bool AllNodesConrolledByTeam (TeamId) const
 
void StartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
std::string GetName () const
 
BattlegroundTypeId GetBgTypeID (bool GetRandom=false) const
 
BattlegroundBracketId GetBracketId () const
 
uint32 GetInstanceID () const
 
BattlegroundStatus GetStatus () const
 
uint32 GetClientInstanceID () const
 
uint32 GetStartTime () const
 
uint32 GetEndTime () const
 
uint32 GetLastResurrectTime () const
 
uint32 GetMinLevel () const
 
uint32 GetMaxLevel () const
 
uint32 GetMaxPlayersPerTeam () const
 
uint32 GetMinPlayersPerTeam () const
 
int32 GetStartDelayTime () const
 
uint8 GetArenaType () const
 
PvPTeamId GetWinner () const
 
uint32 GetScriptId () const
 
uint32 GetBonusHonorFromKill (uint32 kills) const
 
bool SpiritofCompetitionEvent (PvPTeamId winnerTeamId)
 
bool IsRandom ()
 
void SetName (std::string_view name)
 
void SetBgTypeID (BattlegroundTypeId TypeID)
 
void SetRandomTypeID (BattlegroundTypeId TypeID)
 
void SetBracket (PvPDifficultyEntry const *bracketEntry)
 
void SetInstanceID (uint32 InstanceID)
 
void SetStatus (BattlegroundStatus Status)
 
void SetClientInstanceID (uint32 InstanceID)
 
void SetStartTime (uint32 Time)
 
void SetEndTime (uint32 Time)
 
void SetLastResurrectTime (uint32 Time)
 
void SetLevelRange (uint32 min, uint32 max)
 
void SetRated (bool state)
 
void SetArenaType (uint8 type)
 
void SetArenaorBGType (bool _isArena)
 
void SetWinner (PvPTeamId winner)
 
void SetScriptId (uint32 scriptId)
 
void SetRandom (bool isRandom)
 
void ModifyStartDelayTime (int32 diff)
 
void SetStartDelayTime (int32 Time)
 
void SetMaxPlayersPerTeam (uint32 MaxPlayers)
 
void SetMinPlayersPerTeam (uint32 MinPlayers)
 
void AddToBGFreeSlotQueue ()
 
void RemoveFromBGFreeSlotQueue ()
 
void DecreaseInvitedCount (TeamId teamId)
 
void IncreaseInvitedCount (TeamId teamId)
 
uint32 GetInvitedCount (TeamId teamId) const
 
bool HasFreeSlots () const
 
uint32 GetFreeSlotsForTeam (TeamId teamId) const
 
uint32 GetMaxFreeSlots () const
 
void AddSpectator (Player *p)
 
void RemoveSpectator (Player *p)
 
bool HaveSpectators ()
 
const SpectatorListGetSpectators () const
 
void AddToBeTeleported (ObjectGuid spectator, ObjectGuid participant)
 
void RemoveToBeTeleported (ObjectGuid spectator)
 
void SpectatorsSendPacket (WorldPacket &data)
 
bool isArena () const
 
bool isBattleground () const
 
bool isRated () const
 
BattlegroundPlayerMap const & GetPlayers () const
 
uint32 GetPlayersSize () const
 
void ReadyMarkerClicked (Player *p)
 
BattlegroundScoreMap const * GetPlayerScores () const
 
std::size_t GetPlayerScoresSize () const
 
uint32 GetReviveQueueSize () const
 
void AddPlayerToResurrectQueue (ObjectGuid npc_guid, ObjectGuid player_guid)
 
void RemovePlayerFromResurrectQueue (Player *player)
 
void RelocateDeadPlayers (ObjectGuid queueIndex)
 Relocate all players in ReviveQueue to the closest graveyard.
 
void StartBattleground ()
 
GameObjectGetBGObject (uint32 type)
 
CreatureGetBGCreature (uint32 type)
 
void SetMapId (uint32 MapID)
 
uint32 GetMapId () const
 
void SetBgMap (BattlegroundMap *map)
 
BattlegroundMapGetBgMap () const
 
BattlegroundMapFindBgMap () const
 
void SetTeamStartPosition (TeamId teamId, Position const &pos)
 
Position const * GetTeamStartPosition (TeamId teamId) const
 
void SetStartMaxDist (float startMaxDist)
 
float GetStartMaxDist () const
 
virtual void FillInitialWorldStates (WorldPacket &)
 
void SendPacketToTeam (TeamId teamId, WorldPacket const *packet, Player *sender=nullptr, bool self=true)
 
void SendPacketToAll (WorldPacket const *packet)
 
void YellToAll (Creature *creature, const char *text, uint32 language)
 
void SendChatMessage (Creature *source, uint8 textId, WorldObject *target=nullptr)
 
void SendBroadcastText (uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
 
template<class Do >
void BroadcastWorker (Do &_do)
 
void PlaySoundToAll (uint32 soundId)
 
void CastSpellOnTeam (uint32 spellId, TeamId teamId)
 
void RemoveAuraOnTeam (uint32 spellId, TeamId teamId)
 
void RewardHonorToTeam (uint32 honor, TeamId teamId)
 
void RewardReputationToTeam (uint32 factionId, uint32 reputation, TeamId teamId)
 
uint32 GetRealRepFactionForPlayer (uint32 factionId, Player *player)
 
void UpdateWorldState (uint32 variable, uint32 value)
 
void EndBattleground (PvPTeamId winnerTeamId)
 
virtual void EndBattleground (TeamId winnerTeamId)
 
void BlockMovement (Player *player)
 
void SendWarningToAll (uint32 entry,...)
 
void SendMessageToAll (uint32 entry, ChatMsg type, Player const *source=nullptr)
 
void PSendMessageToAll (uint32 entry, ChatMsg type, Player const *source,...)
 
void SendMessage2ToAll (uint32 entry, ChatMsg type, Player const *source, uint32 strId1=0, uint32 strId2=0)
 
GroupGetBgRaid (TeamId teamId) const
 
void SetBgRaid (TeamId teamId, Group *bg_raid)
 
void BuildPvPLogDataPacket (WorldPacket &data)
 
virtual bool UpdatePlayerScore (Player *player, uint32 type, uint32 value, bool doAddHonor=true)
 
uint32 GetPlayersCountByTeam (TeamId teamId) const
 
uint32 GetAlivePlayersCountByTeam (TeamId teamId) const
 
void UpdatePlayersCountByTeam (TeamId teamId, bool remove)
 
virtual void CheckWinConditions ()
 
void SetArenaTeamIdForTeam (TeamId teamId, uint32 ArenaTeamId)
 
uint32 GetArenaTeamIdForTeam (TeamId teamId) const
 
void SetArenaMatchmakerRating (TeamId teamId, uint32 MMR)
 
uint32 GetArenaMatchmakerRating (TeamId teamId) const
 
virtual void HandleAreaTrigger (Player *, uint32)
 
virtual void HandleKillPlayer (Player *player, Player *killer)
 
virtual void HandleKillUnit (Creature *, Player *)
 
virtual void EventPlayerDroppedFlag (Player *)
 
virtual void EventPlayerClickedOnFlag (Player *, GameObject *)
 
virtual void EventPlayerDamagedGO (Player *, GameObject *, uint32)
 
virtual void EventPlayerUsedGO (Player *, GameObject *)
 
virtual void DoAction (uint32, ObjectGuid)
 
virtual void HandlePlayerResurrect (Player *)
 
virtual GraveyardStruct const * GetClosestGraveyard (Player *player)
 
virtual void AddPlayer (Player *player)
 
void AddOrSetPlayerToCorrectBgGroup (Player *player, TeamId teamId)
 
virtual void RemovePlayerAtLeave (Player *player)
 
void HandleTriggerBuff (GameObject *gameObject)
 
void SetHoliday (bool is_holiday)
 
void SpawnBGObject (uint32 type, uint32 respawntime, uint32 forceRespawnDelay=0)
 
bool AddObject (uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0, GOState goState=GO_STATE_READY)
 
CreatureAddCreature (uint32 entry, uint32 type, float x, float y, float z, float o, uint32 respawntime=0, MotionTransport *transport=nullptr)
 
bool DelCreature (uint32 type)
 
bool DelObject (uint32 type)
 
bool AddSpiritGuide (uint32 type, float x, float y, float z, float o, TeamId teamId)
 
int32 GetObjectType (ObjectGuid guid)
 
void DoorOpen (uint32 type)
 
void DoorClose (uint32 type)
 
const char * GetAcoreString (int32 entry)
 
virtual bool HandlePlayerUnderMap (Player *)
 
bool IsPlayerInBattleground (ObjectGuid guid) const
 
bool ToBeDeleted () const
 
void RewardXPAtKill (Player *killer, Player *victim)
 
virtual ObjectGuid GetFlagPickerGUID (TeamId=TEAM_NEUTRAL) const
 
virtual void SetDroppedFlagGUID (ObjectGuid, TeamId=TEAM_NEUTRAL)
 
uint32 GetTeamScore (TeamId teamId) const
 
virtual TeamId GetPrematureWinner ()
 
uint8 GetUniqueBracketId () const
 
BattlegroundAVToBattlegroundAV ()
 
BattlegroundAV const * ToBattlegroundAV () const
 
BattlegroundWSToBattlegroundWS ()
 
BattlegroundWS const * ToBattlegroundWS () const
 
BattlegroundABToBattlegroundAB ()
 
BattlegroundAB const * ToBattlegroundAB () const
 
BattlegroundNAToBattlegroundNA ()
 
BattlegroundNA const * ToBattlegroundNA () const
 
BattlegroundBEToBattlegroundBE ()
 
BattlegroundBE const * ToBattlegroundBE () const
 
BattlegroundEYToBattlegroundEY ()
 
BattlegroundEY const * ToBattlegroundEY () const
 
BattlegroundRLToBattlegroundRL ()
 
BattlegroundRL const * ToBattlegroundRL () const
 
BattlegroundSAToBattlegroundSA ()
 
BattlegroundSA const * ToBattlegroundSA () const
 
BattlegroundDSToBattlegroundDS ()
 
BattlegroundDS const * ToBattlegroundDS () const
 
BattlegroundRVToBattlegroundRV ()
 
BattlegroundRV const * ToBattlegroundRV () const
 
BattlegroundICToBattlegroundIC ()
 
BattlegroundIC const * ToBattlegroundIC () const
 

Private Member Functions

void PostUpdateImpl (uint32 diff) override
 Post-update hook.
 
void DeleteBanner (uint8 node)
 
void CreateBanner (uint8 node, bool delay)
 
void SendNodeUpdate (uint8 node)
 
void NodeOccupied (uint8 node)
 
void NodeDeoccupied (uint8 node)
 
void ApplyPhaseMask ()
 

Private Attributes

CapturePointInfo _capturePointInfo [BG_AB_DYNAMIC_NODES_COUNT]
 
EventMap _bgEvents
 
uint32 _honorTics
 
uint32 _reputationTics
 
uint8 _controlledPoints [PVP_TEAMS_COUNT] {}
 
bool _teamScores500Disadvantage [PVP_TEAMS_COUNT] {}
 

Additional Inherited Members

- Public Types inherited from Battleground
typedef std::set< Player * > SpectatorList
 
typedef std::map< ObjectGuid, ObjectGuidToBeTeleportedMap
 
typedef std::map< ObjectGuid, Player * > BattlegroundPlayerMap
 
typedef std::unordered_map< ObjectGuid::LowType, BattlegroundScore * > BattlegroundScoreMap
 
typedef std::unordered_map< ObjectGuid, ArenaLogEntryDataArenaLogEntryDataMap
 
typedef GuidVector BGObjects
 
typedef GuidVector BGCreatures
 
- Static Public Member Functions inherited from Battleground
static TeamId GetOtherTeamId (TeamId teamId)
 
- Public Attributes inherited from Battleground
GuidSet readyMarkerClickedSet
 
ArenaLogEntryDataMap ArenaLogEntries
 
BGObjects BgObjects
 
BGCreatures BgCreatures
 
- Protected Member Functions inherited from Battleground
void EndNow ()
 
void PlayerAddedToBGCheckIfBGIsRunning (Player *player)
 
void _ProcessResurrect (uint32 diff)
 
void _ProcessProgress (uint32 diff)
 
void _ProcessLeave (uint32 diff)
 
void _ProcessJoin (uint32 diff)
 
void _CheckSafePositions (uint32 diff)
 
virtual void RemovePlayer (Player *)
 
- Protected Attributes inherited from Battleground
BattlegroundScoreMap PlayerScores
 
BattlegroundPlayerMap m_Players
 
std::map< ObjectGuid, GuidVectorm_ReviveQueue
 
uint8 m_Events
 
BattlegroundStartTimeIntervals StartDelayTimes [BG_STARTING_EVENT_COUNT]
 
uint32 StartMessageIds [BG_STARTING_EVENT_COUNT]
 
bool m_BuffChange
 
bool m_IsRandom
 
BGHonorMode m_HonorMode
 
int32 m_TeamScores [PVP_TEAMS_COUNT]
 
ArenaTeamScore _arenaTeamScores [PVP_TEAMS_COUNT]
 
uint32 m_UpdateTimer
 
EventProcessor _reviveEvents
 

Detailed Description

Constructor & Destructor Documentation

◆ BattlegroundAB()

BattlegroundAB::BattlegroundAB ( )
35{
36 m_BuffChange = true;
38 BgCreatures.resize(BG_AB_ALL_NODES_COUNT + BG_AB_DYNAMIC_NODES_COUNT); // xinef: +BG_AB_DYNAMIC_NODES_COUNT buff triggers
39
44 _honorTics = 0;
46}
@ BG_AB_OBJECT_MAX
Definition: BattlegroundAB.h:134
@ BG_AB_ALL_NODES_COUNT
Definition: BattlegroundAB.h:148
@ BG_AB_DYNAMIC_NODES_COUNT
Definition: BattlegroundAB.h:144
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
BGObjects BgObjects
Definition: Battleground.h:539
bool m_BuffChange
Definition: Battleground.h:634
BGCreatures BgCreatures
Definition: Battleground.h:540
uint32 _honorTics
Definition: BattlegroundAB.h:340
uint32 _reputationTics
Definition: BattlegroundAB.h:341
uint8 _controlledPoints[PVP_TEAMS_COUNT]
Definition: BattlegroundAB.h:342
bool _teamScores500Disadvantage[PVP_TEAMS_COUNT]
Definition: BattlegroundAB.h:343

References _controlledPoints, _honorTics, _reputationTics, _teamScores500Disadvantage, BG_AB_ALL_NODES_COUNT, BG_AB_DYNAMIC_NODES_COUNT, BG_AB_OBJECT_MAX, Battleground::BgCreatures, Battleground::BgObjects, Battleground::m_BuffChange, TEAM_ALLIANCE, and TEAM_HORDE.

◆ ~BattlegroundAB()

BattlegroundAB::~BattlegroundAB ( )
overridedefault

Member Function Documentation

◆ AddPlayer()

void BattlegroundAB::AddPlayer ( Player player)
overridevirtual

Reimplemented from Battleground.

176{
178 PlayerScores.emplace(player->GetGUID().GetCounter(), new BattlegroundABScore(player->GetGUID()));
179}
virtual void AddPlayer(Player *player)
Definition: Battleground.cpp:1117
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:619
Definition: BattlegroundAB.h:258
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
LowType GetCounter() const
Definition: ObjectGuid.h:147

References Battleground::AddPlayer(), ObjectGuid::GetCounter(), Object::GetGUID(), and Battleground::PlayerScores.

◆ AllNodesConrolledByTeam()

bool BattlegroundAB::AllNodesConrolledByTeam ( TeamId  teamId) const
overridevirtual

Reimplemented from Battleground.

538{
540}

References _controlledPoints, and BG_AB_DYNAMIC_NODES_COUNT.

◆ ApplyPhaseMask()

void BattlegroundAB::ApplyPhaseMask ( )
private
543{
544 uint32 phaseMask = 1;
546 if (_capturePointInfo[i]._ownerTeamId != TEAM_NEUTRAL)
547 phaseMask |= 1 << (i * 2 + 1 + _capturePointInfo[i]._ownerTeamId);
548
549 const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
550
551 for (auto const& itr : bgPlayerMap)
552 {
553 itr.second->SetPhaseMask(phaseMask, false);
554 itr.second->UpdateObjectVisibility(true, false);
555 }
556}
std::uint32_t uint32
Definition: Define.h:108
@ BG_AB_NODE_STABLES
Definition: BattlegroundAB.h:139
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
std::map< ObjectGuid, Player * > BattlegroundPlayerMap
Definition: Battleground.h:400
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:401
CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:338
TeamId _ownerTeamId
Definition: BattlegroundAB.h:330

References _capturePointInfo, BattlegroundAB::CapturePointInfo::_ownerTeamId, BG_AB_DYNAMIC_NODES_COUNT, BG_AB_NODE_STABLES, Battleground::GetPlayers(), and TEAM_NEUTRAL.

Referenced by EventPlayerClickedOnFlag(), and NodeOccupied().

◆ CreateBanner()

void BattlegroundAB::CreateBanner ( uint8  node,
bool  delay 
)
private
219{
220 // Just put it into the queue
221 if (delay)
222 {
224 return;
225 }
226
229}
@ RESPAWN_IMMEDIATELY
Definition: Battleground.h:164
@ BG_AB_OBJECTS_PER_NODE
Definition: BattlegroundAB.h:114
@ BG_AB_OBJECT_AURA_ALLY
Definition: BattlegroundAB.h:111
@ BG_AB_EVENT_UPDATE_BANNER_STABLE
Definition: BattlegroundAB.h:27
@ BG_AB_BANNER_UPDATE_TIME
Definition: BattlegroundAB.h:215
void RescheduleEvent(uint32 eventId, uint32 time, uint32 groupId=0, uint32 phase=0)
Definition: EventMap.cpp:81
void SpawnBGObject(uint32 type, uint32 respawntime, uint32 forceRespawnDelay=0)
Definition: Battleground.cpp:1511
EventMap _bgEvents
Definition: BattlegroundAB.h:339

References _bgEvents, _capturePointInfo, BG_AB_BANNER_UPDATE_TIME, BG_AB_EVENT_UPDATE_BANNER_STABLE, BG_AB_OBJECT_AURA_ALLY, BG_AB_OBJECTS_PER_NODE, EventMap::RescheduleEvent(), RESPAWN_IMMEDIATELY, and Battleground::SpawnBGObject().

Referenced by EventPlayerClickedOnFlag(), and PostUpdateImpl().

◆ DeleteBanner()

void BattlegroundAB::DeleteBanner ( uint8  node)
private

◆ EndBattleground()

void BattlegroundAB::EndBattleground ( TeamId  winnerTeamId)
overridevirtual
Deprecated:
need delete

Reimplemented from Battleground.

484{
488 Battleground::EndBattleground(winnerTeamId);
490}
void Reset()
Definition: EventMap.cpp:21
void EndBattleground(PvPTeamId winnerTeamId)
Definition: Battleground.cpp:778
uint32 GetBonusHonorFromKill(uint32 kills) const
Definition: Battleground.cpp:962
void RewardHonorToTeam(uint32 honor, TeamId teamId)
Definition: Battleground.cpp:720

References _bgEvents, Battleground::EndBattleground(), Battleground::GetBonusHonorFromKill(), EventMap::Reset(), Battleground::RewardHonorToTeam(), TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by PostUpdateImpl().

◆ EventPlayerClickedOnFlag()

void BattlegroundAB::EventPlayerClickedOnFlag ( Player source,
GameObject gameObject 
)
overridevirtual

Reimplemented from Battleground.

305{
306 if (GetStatus() != STATUS_IN_PROGRESS || !player->IsWithinDistInMap(gameObject, 10.0f))
307 return;
308
310 for (; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
311 if (player->GetDistance2d(BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1]) < 10.0f)
312 break;
313
314 if (node == BG_AB_DYNAMIC_NODES_COUNT || _capturePointInfo[node]._ownerTeamId == player->GetTeamId() ||
315 (_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED && player->GetTeamId() == TEAM_ALLIANCE) ||
316 (_capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED && player->GetTeamId() == TEAM_HORDE))
317 return;
318
319 player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
320
321 uint32 sound = 0;
322 TeamId teamid = player->GetTeamId();
323
324 DeleteBanner(node);
325 CreateBanner(node, true);
326
328 {
329 player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node);
331 _capturePointInfo[node]._state = static_cast<uint8>(BG_AB_NODE_STATE_ALLY_CONTESTED) + player->GetTeamId();
335
336 if (teamid == TEAM_ALLIANCE)
337 {
338 SendBroadcastText(ABNodes[node].TextAllianceClaims, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
339 }
340 else
341 {
342 SendBroadcastText(ABNodes[node].TextHordeClaims, CHAT_MSG_BG_SYSTEM_HORDE, player);
343 }
344 }
346 {
347 if (!_capturePointInfo[node]._captured)
348 {
349 player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node);
351 _capturePointInfo[node]._state = static_cast<uint8>(BG_AB_NODE_STATE_ALLY_CONTESTED) + player->GetTeamId();
354
355 if (teamid == TEAM_ALLIANCE)
356 {
357 SendBroadcastText(ABNodes[node].TextAllianceAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
358 }
359 else
360 {
361 SendBroadcastText(ABNodes[node].TextHordeAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, player);
362 }
363 }
364 else
365 {
367 _capturePointInfo[node]._state = static_cast<uint8>(BG_AB_NODE_STATE_ALLY_OCCUPIED) + player->GetTeamId();
368 _capturePointInfo[node]._ownerTeamId = player->GetTeamId();
370 NodeOccupied(node); // after setting team owner
371
372 if (teamid == TEAM_ALLIANCE)
373 {
374 SendBroadcastText(ABNodes[node].TextAllianceDefended, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
375 }
376 else
377 {
378 SendBroadcastText(ABNodes[node].TextHordeDefended, CHAT_MSG_BG_SYSTEM_HORDE, player);
379 }
380 }
381
383 }
384 else
385 {
386 player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node);
388 NodeDeoccupied(node); // before setting team owner to neutral
389
390 _capturePointInfo[node]._state = static_cast<uint8>(BG_AB_NODE_STATE_ALLY_CONTESTED) + player->GetTeamId();
391
395
396 if (teamid == TEAM_ALLIANCE)
397 {
398 SendBroadcastText(ABNodes[node].TextAllianceAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
399 }
400 else
401 {
402 SendBroadcastText(ABNodes[node].TextHordeAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, player);
403 }
404 }
405
406 SendNodeUpdate(node);
407 PlaySoundToAll(sound);
408}
std::uint8_t uint8
Definition: Define.h:110
@ STATUS_IN_PROGRESS
Definition: Battleground.h:197
@ SCORE_BASES_ASSAULTED
Definition: BattlegroundScore.h:41
@ SCORE_BASES_DEFENDED
Definition: BattlegroundScore.h:42
@ BG_AB_NODE_STATE_NEUTRAL
Definition: BattlegroundAB.h:181
@ BG_AB_NODE_STATE_ALLY_OCCUPIED
Definition: BattlegroundAB.h:182
@ BG_AB_NODE_STATE_HORDE_CONTESTED
Definition: BattlegroundAB.h:185
@ BG_AB_NODE_STATE_ALLY_CONTESTED
Definition: BattlegroundAB.h:184
@ BG_AB_EVENT_CAPTURE_STABLE
Definition: BattlegroundAB.h:33
ABNodeInfo const ABNodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:170
@ BG_AB_FLAG_CAPTURING_TIME
Definition: BattlegroundAB.h:214
@ BG_AB_QUEST_CREDIT_BASE
Definition: BattlegroundAB.h:204
const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4]
Definition: BattlegroundAB.h:231
@ BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE
Definition: BattlegroundAB.h:193
@ BG_AB_SOUND_NODE_ASSAULTED_HORDE
Definition: BattlegroundAB.h:194
@ BG_AB_SOUND_NODE_CLAIMED
Definition: BattlegroundAB.h:190
@ AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT
Definition: SpellDefines.h:67
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
Definition: SharedDefines.h:3189
@ CHAT_MSG_BG_SYSTEM_HORDE
Definition: SharedDefines.h:3190
TeamId
Definition: SharedDefines.h:759
void CancelEvent(uint32 eventId)
Definition: EventMap.cpp:190
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
Definition: Battleground.cpp:678
BattlegroundStatus GetStatus() const
Definition: Battleground.h:327
void PlaySoundToAll(uint32 soundId)
Definition: Battleground.cpp:691
void ApplyPhaseMask()
Definition: BattlegroundAB.cpp:542
void NodeOccupied(uint8 node)
Definition: BattlegroundAB.cpp:267
void NodeDeoccupied(uint8 node)
Definition: BattlegroundAB.cpp:289
void DeleteBanner(uint8 node)
Definition: BattlegroundAB.cpp:231
bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true) override
Definition: BattlegroundAB.cpp:517
void CreateBanner(uint8 node, bool delay)
Definition: BattlegroundAB.cpp:218
void SendNodeUpdate(uint8 node)
Definition: BattlegroundAB.cpp:257
uint8 _state
Definition: BattlegroundAB.h:333

References _bgEvents, _capturePointInfo, BattlegroundAB::CapturePointInfo::_ownerTeamId, BattlegroundAB::CapturePointInfo::_state, ABNodes, ApplyPhaseMask(), AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, BG_AB_DYNAMIC_NODES_COUNT, BG_AB_EVENT_CAPTURE_STABLE, BG_AB_FLAG_CAPTURING_TIME, BG_AB_NODE_STABLES, BG_AB_NODE_STATE_ALLY_CONTESTED, BG_AB_NODE_STATE_ALLY_OCCUPIED, BG_AB_NODE_STATE_HORDE_CONTESTED, BG_AB_NODE_STATE_NEUTRAL, BG_AB_NodePositions, BG_AB_QUEST_CREDIT_BASE, BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE, BG_AB_SOUND_NODE_ASSAULTED_HORDE, BG_AB_SOUND_NODE_CLAIMED, EventMap::CancelEvent(), CHAT_MSG_BG_SYSTEM_ALLIANCE, CHAT_MSG_BG_SYSTEM_HORDE, CreateBanner(), DeleteBanner(), WorldObject::GetDistance2d(), Battleground::GetStatus(), Player::GetTeamId(), WorldObject::IsWithinDistInMap(), Player::KilledMonsterCredit(), NodeDeoccupied(), NodeOccupied(), Battleground::PlaySoundToAll(), Unit::RemoveAurasWithInterruptFlags(), EventMap::RescheduleEvent(), SCORE_BASES_ASSAULTED, SCORE_BASES_DEFENDED, Battleground::SendBroadcastText(), SendNodeUpdate(), STATUS_IN_PROGRESS, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, and UpdatePlayerScore().

◆ FillInitialWorldStates()

void BattlegroundAB::FillInitialWorldStates ( WorldPacket data)
overridevirtual

Reimplemented from Battleground.

238{
239 for (auto& node : _capturePointInfo)
240 {
241 if (node._state == BG_AB_NODE_STATE_NEUTRAL)
242 data << uint32(node._iconNone) << uint32(1);
243
245 data << uint32(node._iconCapture + i - 1) << uint32(node._state == i);
246 }
247
254 data << uint32(0x745) << uint32(0x2); // 37 1861 unk
255}
@ BG_AB_WARNING_NEAR_VICTORY_SCORE
Definition: BattlegroundAB.h:211
@ BG_AB_MAX_TEAM_SCORE
Definition: BattlegroundAB.h:212
@ BG_AB_OP_RESOURCES_ALLY
Definition: BattlegroundAB.h:47
@ BG_AB_OP_RESOURCES_MAX
Definition: BattlegroundAB.h:49
@ BG_AB_OP_OCCUPIED_BASES_HORDE
Definition: BattlegroundAB.h:45
@ BG_AB_OP_RESOURCES_HORDE
Definition: BattlegroundAB.h:48
@ BG_AB_OP_RESOURCES_WARNING
Definition: BattlegroundAB.h:50
@ BG_AB_OP_OCCUPIED_BASES_ALLY
Definition: BattlegroundAB.h:46
int32 m_TeamScores[PVP_TEAMS_COUNT]
Definition: Battleground.h:638

References _capturePointInfo, _controlledPoints, BG_AB_MAX_TEAM_SCORE, BG_AB_NODE_STATE_ALLY_OCCUPIED, BG_AB_NODE_STATE_HORDE_CONTESTED, BG_AB_NODE_STATE_NEUTRAL, BG_AB_OP_OCCUPIED_BASES_ALLY, BG_AB_OP_OCCUPIED_BASES_HORDE, BG_AB_OP_RESOURCES_ALLY, BG_AB_OP_RESOURCES_HORDE, BG_AB_OP_RESOURCES_MAX, BG_AB_OP_RESOURCES_WARNING, BG_AB_WARNING_NEAR_VICTORY_SCORE, Battleground::m_TeamScores, TEAM_ALLIANCE, and TEAM_HORDE.

◆ GetClosestGraveyard()

GraveyardStruct const * BattlegroundAB::GetClosestGraveyard ( Player player)
overridevirtual

Reimplemented from Battleground.

493{
494 GraveyardStruct const* entry = sGraveyard->GetGraveyard(BG_AB_GraveyardIds[static_cast<uint8>(BG_AB_SPIRIT_ALIANCE) + player->GetTeamId()]);
495 GraveyardStruct const* nearestEntry = entry;
496
497 float pX = player->GetPositionX();
498 float pY = player->GetPositionY();
499 float dist = (entry->x - pX) * (entry->x - pX) + (entry->y - pY) * (entry->y - pY);
500 float minDist = dist;
501
503 if (_capturePointInfo[i]._ownerTeamId == player->GetTeamId())
504 {
505 entry = sGraveyard->GetGraveyard(BG_AB_GraveyardIds[i]);
506 dist = (entry->x - pX) * (entry->x - pX) + (entry->y - pY) * (entry->y - pY);
507 if (dist < minDist)
508 {
509 minDist = dist;
510 nearestEntry = entry;
511 }
512 }
513
514 return nearestEntry;
515}
const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT]
Definition: BattlegroundAB.h:220
@ BG_AB_SPIRIT_ALIANCE
Definition: BattlegroundAB.h:146
#define sGraveyard
Definition: GameGraveyard.h:75
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2072
Definition: GameGraveyard.h:28
float x
Definition: GameGraveyard.h:31
float y
Definition: GameGraveyard.h:32

References _capturePointInfo, BG_AB_DYNAMIC_NODES_COUNT, BG_AB_GraveyardIds, BG_AB_NODE_STABLES, BG_AB_SPIRIT_ALIANCE, Position::GetPositionX(), Position::GetPositionY(), Player::GetTeamId(), sGraveyard, GraveyardStruct::x, and GraveyardStruct::y.

◆ GetPrematureWinner()

TeamId BattlegroundAB::GetPrematureWinner ( )
overridevirtual

◆ HandleAreaTrigger()

void BattlegroundAB::HandleAreaTrigger ( Player player,
uint32  trigger 
)
overridevirtual

Reimplemented from Battleground.

187{
189 return;
190
191 switch (trigger)
192 {
193 case 3948: // Arathi Basin Alliance Exit.
194 if (player->GetTeamId() != TEAM_ALLIANCE)
195 player->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
196 else
197 player->LeaveBattleground();
198 break;
199 case 3949: // Arathi Basin Horde Exit.
200 if (player->GetTeamId() != TEAM_HORDE)
201 player->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
202 else
203 player->LeaveBattleground();
204 break;
205 case 3866: // Stables
206 case 3869: // Gold Mine
207 case 3867: // Farm
208 case 3868: // Lumber Mill
209 case 3870: // Black Smith
210 case 4020: // Unk1
211 case 4021: // Unk2
212 break;
213 default:
214 break;
215 }
216}
WorldSession * GetSession() const
Definition: Player.h:1961
void LeaveBattleground(Battleground *bg=nullptr)
Definition: Player.cpp:11237
void SendAreaTriggerMessage(const char *Text,...) ATTR_PRINTF(2
Definition: MiscHandler.cpp:691

References Player::GetSession(), Battleground::GetStatus(), Player::GetTeamId(), Player::LeaveBattleground(), WorldSession::SendAreaTriggerMessage(), STATUS_IN_PROGRESS, TEAM_ALLIANCE, and TEAM_HORDE.

◆ Init()

void BattlegroundAB::Init ( )
overridevirtual

Reimplemented from Battleground.

462{
463 //call parent's class reset
465
467
470
481}
@ BG_AB_REP_TICK_NORMAL
Definition: BattlegroundAB.h:208
@ BG_AB_REP_TICK_WEEKEND
Definition: BattlegroundAB.h:209
@ BG_AB_HONOR_TICK_NORMAL
Definition: BattlegroundAB.h:206
@ BG_AB_HONOR_TICK_WEEKEND
Definition: BattlegroundAB.h:207
@ BG_AB_NODE_BLACKSMITH
Definition: BattlegroundAB.h:140
@ BG_AB_NODE_LUMBER_MILL
Definition: BattlegroundAB.h:142
@ BG_AB_NODE_FARM
Definition: BattlegroundAB.h:141
@ BG_AB_NODE_GOLD_MINE
Definition: BattlegroundAB.h:143
@ BG_AB_OP_FARM_ICON
Definition: BattlegroundAB.h:58
@ BG_AB_OP_LUMBERMILL_STATE_ALIENCE
Definition: BattlegroundAB.h:71
@ BG_AB_OP_GOLDMINE_ICON
Definition: BattlegroundAB.h:76
@ BG_AB_OP_BLACKSMITH_ICON
Definition: BattlegroundAB.h:64
@ BG_AB_OP_STABLE_ICON
Definition: BattlegroundAB.h:52
@ BG_AB_OP_GOLDMINE_STATE_ALIENCE
Definition: BattlegroundAB.h:77
@ BG_AB_OP_LUMBERMILL_ICON
Definition: BattlegroundAB.h:70
@ BG_AB_OP_STABLE_STATE_ALIENCE
Definition: BattlegroundAB.h:53
@ BG_AB_OP_FARM_STATE_ALIENCE
Definition: BattlegroundAB.h:59
@ BG_AB_OP_BLACKSMITH_STATE_ALIENCE
Definition: BattlegroundAB.h:65
virtual void Init()
Definition: Battleground.cpp:1068
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition: Battleground.h:324
static bool IsBGWeekend(BattlegroundTypeId bgTypeId)
Definition: BattlegroundMgr.cpp:896
uint32 _iconNone
Definition: BattlegroundAB.h:331
uint32 _iconCapture
Definition: BattlegroundAB.h:332

References _bgEvents, _capturePointInfo, _honorTics, BattlegroundAB::CapturePointInfo::_iconCapture, BattlegroundAB::CapturePointInfo::_iconNone, _reputationTics, BG_AB_HONOR_TICK_NORMAL, BG_AB_HONOR_TICK_WEEKEND, BG_AB_NODE_BLACKSMITH, BG_AB_NODE_FARM, BG_AB_NODE_GOLD_MINE, BG_AB_NODE_LUMBER_MILL, BG_AB_NODE_STABLES, BG_AB_OP_BLACKSMITH_ICON, BG_AB_OP_BLACKSMITH_STATE_ALIENCE, BG_AB_OP_FARM_ICON, BG_AB_OP_FARM_STATE_ALIENCE, BG_AB_OP_GOLDMINE_ICON, BG_AB_OP_GOLDMINE_STATE_ALIENCE, BG_AB_OP_LUMBERMILL_ICON, BG_AB_OP_LUMBERMILL_STATE_ALIENCE, BG_AB_OP_STABLE_ICON, BG_AB_OP_STABLE_STATE_ALIENCE, BG_AB_REP_TICK_NORMAL, BG_AB_REP_TICK_WEEKEND, Battleground::GetBgTypeID(), Battleground::Init(), BattlegroundMgr::IsBGWeekend(), and EventMap::Reset().

◆ IsTeamScores500Disadvantage()

bool BattlegroundAB::IsTeamScores500Disadvantage ( TeamId  teamId) const
inline

◆ NodeDeoccupied()

void BattlegroundAB::NodeDeoccupied ( uint8  node)
private
290{
292
294
295 _reviveEvents.AddEventAtOffset([this, node]()
296 {
298 DelCreature(node); // Delete spirit healer
299 }, 500ms);
300
301 DelCreature(BG_AB_ALL_NODES_COUNT + node); // Delete aura trigger
302}
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
Definition: EventProcessor.h:108
bool DelCreature(uint32 type)
Definition: Battleground.cpp:1594
void RelocateDeadPlayers(ObjectGuid queueIndex)
Relocate all players in ReviveQueue to the closest graveyard.
Definition: Battleground.cpp:1385
EventProcessor _reviveEvents
Definition: Battleground.h:645

References _capturePointInfo, _controlledPoints, BattlegroundAB::CapturePointInfo::_ownerTeamId, Battleground::_reviveEvents, EventProcessor::AddEventAtOffset(), BG_AB_ALL_NODES_COUNT, Battleground::BgCreatures, Battleground::DelCreature(), Battleground::RelocateDeadPlayers(), and TEAM_NEUTRAL.

Referenced by EventPlayerClickedOnFlag().

◆ NodeOccupied()

void BattlegroundAB::NodeOccupied ( uint8  node)
private
268{
270 AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], _capturePointInfo[node]._ownerTeamId);
271
273 if (_controlledPoints[_capturePointInfo[node]._ownerTeamId] >= 5)
275 if (_controlledPoints[_capturePointInfo[node]._ownerTeamId] >= 4)
277
279 if (!trigger)
281
282 if (trigger)
283 {
285 trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
286 }
287}
@ SPELL_HONORABLE_DEFENDER_25Y
Definition: Battleground.h:141
@ SPELL_AB_QUEST_REWARD_4_BASES
Definition: Battleground.h:94
@ SPELL_AB_QUEST_REWARD_5_BASES
Definition: Battleground.h:95
const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4]
Definition: BattlegroundAB.h:246
#define WORLD_TRIGGER
Definition: Unit.h:36
@ FACTION_ALLIANCE_GENERIC
Definition: SharedDefines.h:206
@ FACTION_HORDE_GENERIC
Definition: SharedDefines.h:205
bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId)
Definition: Battleground.cpp:1633
BattlegroundMap * GetBgMap() const
Definition: Battleground.h:432
Creature * AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, uint32 respawntime=0, MotionTransport *transport=nullptr)
Definition: Battleground.cpp:1531
void CastSpellOnTeam(uint32 spellId, TeamId teamId)
Definition: Battleground.cpp:696
Definition: Creature.h:46
void SetFaction(uint32 faction)
Definition: Unit.cpp:10064
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3307

References _capturePointInfo, _controlledPoints, BattlegroundAB::CapturePointInfo::_ownerTeamId, Battleground::AddCreature(), Battleground::AddSpiritGuide(), ApplyPhaseMask(), BG_AB_ALL_NODES_COUNT, BG_AB_NodePositions, BG_AB_SpiritGuidePos, Battleground::BgCreatures, Unit::CastSpell(), Battleground::CastSpellOnTeam(), FACTION_ALLIANCE_GENERIC, FACTION_HORDE_GENERIC, Battleground::GetBgMap(), Map::GetCreature(), Unit::SetFaction(), SPELL_AB_QUEST_REWARD_4_BASES, SPELL_AB_QUEST_REWARD_5_BASES, SPELL_HONORABLE_DEFENDER_25Y, TEAM_ALLIANCE, and WORLD_TRIGGER.

Referenced by EventPlayerClickedOnFlag(), and PostUpdateImpl().

◆ PostUpdateImpl()

void BattlegroundAB::PostUpdateImpl ( uint32  )
overrideprivatevirtual

Post-update hook.

Will be called after battleground update has passed. May be used to implement custom update effects in subclasses.

Parameters
diffa time difference between two worldserver update loops in milliseconds.
See also
Update(), PreUpdateImpl().

Reimplemented from Battleground.

51{
53 {
54 _bgEvents.Update(diff);
55 while (uint32 eventId = _bgEvents.ExecuteEvent())
56 switch (eventId)
57 {
64 break;
70 {
71 uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE;
73 DeleteBanner(node);
74 _capturePointInfo[node]._ownerTeamId = teamId;
76 _capturePointInfo[node]._captured = true;
77
78 CreateBanner(node, false);
79 NodeOccupied(node);
80 SendNodeUpdate(node);
81
82 if (teamId == TEAM_ALLIANCE)
83 {
86 }
87 else
88 {
91 }
92
93 break;
94 }
97 {
98 auto teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK);
99 uint8 controlledPoints = _controlledPoints[teamId];
100 if (controlledPoints == 0)
101 {
102 _bgEvents.ScheduleEvent(eventId, 3000);
103 break;
104 }
105
106 auto honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
107 auto reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics);
108 auto information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE);
109 m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints];
112
113 if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics))
115 if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics))
116 RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId);
117 if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE))
118 {
119 if (teamId == TEAM_ALLIANCE)
120 {
123 }
124 else
125 {
128 }
129 }
130
132 if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500)
134 if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE)
135 EndBattleground(teamId);
136
137 _bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]);
138 break;
139 }
140 default:
141 break;
142 }
143 }
144}
@ BG_AB_TEXT_ALLIANCE_NEAR_VICTORY
Definition: BattlegroundAB.h:153
@ BG_AB_TEXT_HORDE_NEAR_VICTORY
Definition: BattlegroundAB.h:154
@ BG_AB_NODE_STATE_HORDE_OCCUPIED
Definition: BattlegroundAB.h:183
@ BG_AB_EVENT_UPDATE_BANNER_GOLDMINE
Definition: BattlegroundAB.h:31
@ BG_AB_EVENT_ALLIANCE_TICK
Definition: BattlegroundAB.h:39
@ BG_AB_EVENT_UPDATE_BANNER_FARM
Definition: BattlegroundAB.h:28
@ BG_AB_EVENT_CAPTURE_GOLDMINE
Definition: BattlegroundAB.h:37
@ BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL
Definition: BattlegroundAB.h:30
@ BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH
Definition: BattlegroundAB.h:29
@ BG_AB_EVENT_CAPTURE_LUMBERMILL
Definition: BattlegroundAB.h:36
@ BG_AB_EVENT_HORDE_TICK
Definition: BattlegroundAB.h:40
@ BG_AB_EVENT_CAPTURE_BLACKSMITH
Definition: BattlegroundAB.h:35
@ BG_AB_EVENT_CAPTURE_FARM
Definition: BattlegroundAB.h:34
const uint32 BG_AB_TickPoints[BG_AB_DYNAMIC_NODES_COUNT+1]
Definition: BattlegroundAB.h:219
const uint32 BG_AB_TickIntervals[BG_AB_DYNAMIC_NODES_COUNT+1]
Definition: BattlegroundAB.h:218
@ BG_AB_SOUND_NEAR_VICTORY_ALLIANCE
Definition: BattlegroundAB.h:195
@ BG_AB_SOUND_NODE_CAPTURED_HORDE
Definition: BattlegroundAB.h:192
@ BG_AB_SOUND_NEAR_VICTORY_HORDE
Definition: BattlegroundAB.h:196
@ BG_AB_SOUND_NODE_CAPTURED_ALLIANCE
Definition: BattlegroundAB.h:191
@ CHAT_MSG_BG_SYSTEM_NEUTRAL
Definition: SharedDefines.h:3188
uint32 ExecuteEvent()
Definition: EventMap.cpp:114
void Update(uint32 time)
Definition: EventMap.h:54
void ScheduleEvent(uint32 eventId, uint32 time, uint32 group=0, uint32 phase=0)
Definition: EventMap.cpp:56
void RewardReputationToTeam(uint32 factionId, uint32 reputation, TeamId teamId)
Definition: Battleground.cpp:727
static TeamId GetOtherTeamId(TeamId teamId)
Definition: Battleground.cpp:1813
void UpdateWorldState(uint32 variable, uint32 value)
Definition: Battleground.cpp:770
void EndBattleground(TeamId winnerTeamId) override
Definition: BattlegroundAB.cpp:483
bool _captured
Definition: BattlegroundAB.h:335

References _bgEvents, BattlegroundAB::CapturePointInfo::_captured, _capturePointInfo, _controlledPoints, _honorTics, BattlegroundAB::CapturePointInfo::_ownerTeamId, _reputationTics, BattlegroundAB::CapturePointInfo::_state, _teamScores500Disadvantage, ABNodes, BG_AB_EVENT_ALLIANCE_TICK, BG_AB_EVENT_CAPTURE_BLACKSMITH, BG_AB_EVENT_CAPTURE_FARM, BG_AB_EVENT_CAPTURE_GOLDMINE, BG_AB_EVENT_CAPTURE_LUMBERMILL, BG_AB_EVENT_CAPTURE_STABLE, BG_AB_EVENT_HORDE_TICK, BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH, BG_AB_EVENT_UPDATE_BANNER_FARM, BG_AB_EVENT_UPDATE_BANNER_GOLDMINE, BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL, BG_AB_EVENT_UPDATE_BANNER_STABLE, BG_AB_MAX_TEAM_SCORE, BG_AB_NODE_STATE_ALLY_CONTESTED, BG_AB_NODE_STATE_ALLY_OCCUPIED, BG_AB_NODE_STATE_HORDE_OCCUPIED, BG_AB_OP_RESOURCES_ALLY, BG_AB_OP_RESOURCES_HORDE, BG_AB_SOUND_NEAR_VICTORY_ALLIANCE, BG_AB_SOUND_NEAR_VICTORY_HORDE, BG_AB_SOUND_NODE_CAPTURED_ALLIANCE, BG_AB_SOUND_NODE_CAPTURED_HORDE, BG_AB_TEXT_ALLIANCE_NEAR_VICTORY, BG_AB_TEXT_HORDE_NEAR_VICTORY, BG_AB_TickIntervals, BG_AB_TickPoints, BG_AB_WARNING_NEAR_VICTORY_SCORE, CHAT_MSG_BG_SYSTEM_ALLIANCE, CHAT_MSG_BG_SYSTEM_HORDE, CHAT_MSG_BG_SYSTEM_NEUTRAL, CreateBanner(), DeleteBanner(), EndBattleground(), EventMap::ExecuteEvent(), Battleground::GetBonusHonorFromKill(), Battleground::GetOtherTeamId(), Battleground::GetStatus(), Battleground::m_TeamScores, NodeOccupied(), Battleground::PlaySoundToAll(), Battleground::RewardHonorToTeam(), Battleground::RewardReputationToTeam(), EventMap::ScheduleEvent(), Battleground::SendBroadcastText(), SendNodeUpdate(), STATUS_IN_PROGRESS, TEAM_ALLIANCE, TEAM_HORDE, EventMap::Update(), and Battleground::UpdateWorldState().

◆ RemovePlayer()

void BattlegroundAB::RemovePlayer ( Player player)
overridevirtual

Reimplemented from Battleground.

182{
183 player->SetPhaseMask(1, false);
184}
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:19313

References Unit::SetPhaseMask().

◆ SendNodeUpdate()

◆ SetupBattleground()

bool BattlegroundAB::SetupBattleground ( )
overridevirtual

Reimplemented from Battleground.

418{
419 for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
420 {
429 }
430
433
434 for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
435 {
439 }
440
443
445 if (!BgObjects[i])
446 {
447 LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn some object Battleground not created!");
448 return false;
449 }
450
452 if (!BgCreatures[i])
453 {
454 LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn spirit guides Battleground not created!");
455 return false;
456 }
457
458 return true;
459}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
const uint32 Buff_Entries[3]
Definition: Battleground.h:190
@ BG_AB_OBJECTID_BANNER_CONT_A
Definition: BattlegroundAB.h:92
@ BG_AB_OBJECTID_BANNER_A
Definition: BattlegroundAB.h:91
@ BG_AB_OBJECTID_AURA_A
Definition: BattlegroundAB.h:96
@ BG_AB_OBJECTID_BANNER_H
Definition: BattlegroundAB.h:93
@ BG_AB_OBJECTID_AURA_C
Definition: BattlegroundAB.h:98
@ BG_AB_OBJECTID_AURA_H
Definition: BattlegroundAB.h:97
@ BG_AB_OBJECTID_GATE_A
Definition: BattlegroundAB.h:100
@ BG_AB_OBJECTID_NODE_BANNER_0
Definition: BattlegroundAB.h:85
@ BG_AB_OBJECTID_BANNER_CONT_H
Definition: BattlegroundAB.h:94
@ BG_AB_OBJECTID_GATE_H
Definition: BattlegroundAB.h:101
@ BG_AB_OBJECT_BANNER_HORDE
Definition: BattlegroundAB.h:108
@ BG_AB_OBJECT_BANNER_ALLY
Definition: BattlegroundAB.h:107
@ BG_AB_OBJECT_GATE_A
Definition: BattlegroundAB.h:116
@ BG_AB_OBJECT_AURA_HORDE
Definition: BattlegroundAB.h:112
@ BG_AB_OBJECT_GATE_H
Definition: BattlegroundAB.h:117
@ BG_AB_OBJECT_BANNER_NEUTRAL
Definition: BattlegroundAB.h:106
@ BG_AB_OBJECT_BANNER_CONT_H
Definition: BattlegroundAB.h:110
@ BG_AB_OBJECT_SPEEDBUFF_STABLES
Definition: BattlegroundAB.h:119
@ BG_AB_OBJECT_BANNER_CONT_A
Definition: BattlegroundAB.h:109
@ BG_AB_OBJECT_AURA_CONTESTED
Definition: BattlegroundAB.h:113
const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4]
Definition: BattlegroundAB.h:222
const float BG_AB_DoorPositions[2][8]
Definition: BattlegroundAB.h:240
@ BG_AB_SPIRIT_HORDE
Definition: BattlegroundAB.h:147
bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0, GOState goState=GO_STATE_READY)
Definition: Battleground.cpp:1409

References Battleground::AddObject(), Battleground::AddSpiritGuide(), BG_AB_BuffPositions, BG_AB_DoorPositions, BG_AB_DYNAMIC_NODES_COUNT, BG_AB_NodePositions, BG_AB_OBJECT_AURA_ALLY, BG_AB_OBJECT_AURA_CONTESTED, BG_AB_OBJECT_AURA_HORDE, BG_AB_OBJECT_BANNER_ALLY, BG_AB_OBJECT_BANNER_CONT_A, BG_AB_OBJECT_BANNER_CONT_H, BG_AB_OBJECT_BANNER_HORDE, BG_AB_OBJECT_BANNER_NEUTRAL, BG_AB_OBJECT_GATE_A, BG_AB_OBJECT_GATE_H, BG_AB_OBJECT_MAX, BG_AB_OBJECT_SPEEDBUFF_STABLES, BG_AB_OBJECTID_AURA_A, BG_AB_OBJECTID_AURA_C, BG_AB_OBJECTID_AURA_H, BG_AB_OBJECTID_BANNER_A, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_OBJECTID_BANNER_H, BG_AB_OBJECTID_GATE_A, BG_AB_OBJECTID_GATE_H, BG_AB_OBJECTID_NODE_BANNER_0, BG_AB_OBJECTS_PER_NODE, BG_AB_SPIRIT_ALIANCE, BG_AB_SPIRIT_HORDE, BG_AB_SpiritGuidePos, Battleground::BgCreatures, Battleground::BgObjects, Buff_Entries, LOG_ERROR, RESPAWN_IMMEDIATELY, RESPAWN_ONE_DAY, TEAM_ALLIANCE, and TEAM_HORDE.

◆ StartingEventCloseDoors()

◆ StartingEventOpenDoors()

void BattlegroundAB::StartingEventOpenDoors ( )
overridevirtual

Reimplemented from Battleground.

161{
164
165 for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
167
173}
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ BG_AB_EVENT_START_BATTLE
Definition: BattlegroundAB.h:203
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition: DBCEnums.h:118
void DoorOpen(uint32 type)
Definition: Battleground.cpp:1481
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: Battleground.cpp:1889

References _bgEvents, ACHIEVEMENT_TIMED_TYPE_EVENT, BG_AB_DYNAMIC_NODES_COUNT, BG_AB_EVENT_ALLIANCE_TICK, BG_AB_EVENT_HORDE_TICK, BG_AB_EVENT_START_BATTLE, BG_AB_OBJECT_BANNER_NEUTRAL, BG_AB_OBJECT_GATE_A, BG_AB_OBJECT_GATE_H, BG_AB_OBJECT_SPEEDBUFF_STABLES, BG_AB_OBJECTS_PER_NODE, Battleground::DoorOpen(), RESPAWN_IMMEDIATELY, EventMap::ScheduleEvent(), Battleground::SpawnBGObject(), Battleground::StartTimedAchievement(), and urand().

◆ UpdatePlayerScore()

bool BattlegroundAB::UpdatePlayerScore ( Player player,
uint32  type,
uint32  value,
bool  doAddHonor = true 
)
overridevirtual

Reimplemented from Battleground.

518{
519 if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
520 return false;
521
522 switch (type)
523 {
526 break;
529 break;
530 default:
531 break;
532 }
533
534 return true;
535}
@ BG_AB_OBJECTIVE_ASSAULT_BASE
Definition: BattlegroundAB.h:201
@ BG_AB_OBJECTIVE_DEFEND_BASE
Definition: BattlegroundAB.h:202
@ ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE
Definition: DBCEnums.h:152
virtual bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
Definition: Battleground.cpp:1348
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2131

References ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, BG_AB_OBJECTIVE_ASSAULT_BASE, BG_AB_OBJECTIVE_DEFEND_BASE, SCORE_BASES_ASSAULTED, SCORE_BASES_DEFENDED, Player::UpdateAchievementCriteria(), and Battleground::UpdatePlayerScore().

Referenced by EventPlayerClickedOnFlag().

Member Data Documentation

◆ _bgEvents

◆ _capturePointInfo

◆ _controlledPoints

◆ _honorTics

uint32 BattlegroundAB::_honorTics
private

◆ _reputationTics

uint32 BattlegroundAB::_reputationTics
private

◆ _teamScores500Disadvantage

bool BattlegroundAB::_teamScores500Disadvantage[PVP_TEAMS_COUNT] {}
private

Referenced by BattlegroundAB(), and PostUpdateImpl().