TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BattlegroundAB Class Reference

#include <BattlegroundAB.h>

Public Member Functions

 BattlegroundAB ()
 
 ~BattlegroundAB ()
 
void AddPlayer (Player *player) override
 
void StartingEventCloseDoors () override
 
void StartingEventOpenDoors () override
 
void RemovePlayer (Player *player, ObjectGuid guid, uint32 team) override
 
void HandleAreaTrigger (Player *source, uint32 trigger, bool entered) override
 
bool SetupBattleground () override
 
void Reset () override
 
void EndBattleground (uint32 winner) override
 
WorldSafeLocsEntry constGetClosestGraveYard (Player *player) override
 
bool UpdatePlayerScore (Player *player, uint32 type, uint32 value, bool doAddHonor=true) override
 
void FillInitialWorldStates (WorldPackets::WorldState::InitWorldStates &packet) override
 
void EventPlayerClickedOnFlag (Player *source, GameObject *target_obj) override
 
bool IsAllNodesControlledByTeam (uint32 team) const override
 
bool CheckAchievementCriteriaMeet (uint32, Player const *, Unit const *=nullptr, uint32=0) override
 
uint32 GetPrematureWinner () override
 
- Public Member Functions inherited from Battleground
 Battleground ()
 
virtual ~Battleground ()
 
void Update (uint32 diff)
 
virtual void ResetBGSubclass ()
 
virtual void DestroyGate (Player *, GameObject *)
 
void StartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
std::string constGetName () const
 
uint64 GetQueueId () const
 
BattlegroundTypeId GetTypeID (bool GetRandom=false) const
 
BattlegroundBracketId GetBracketId () const
 
uint32 GetInstanceID () const
 
BattlegroundStatus GetStatus () const
 
uint32 GetClientInstanceID () const
 
uint32 GetElapsedTime () const
 
uint32 GetRemainingTime () const
 
uint32 GetLastResurrectTime () const
 
uint32 GetMaxPlayers () const
 
uint32 GetMinPlayers () const
 
uint32 GetMinLevel () const
 
uint32 GetMaxLevel () const
 
uint32 GetMaxPlayersPerTeam () const
 
uint32 GetMinPlayersPerTeam () const
 
int32 GetStartDelayTime () const
 
uint8 GetArenaType () const
 
BattlegroundTeamId GetWinner () const
 
uint32 GetScriptId () const
 
uint32 GetBonusHonorFromKill (uint32 kills) const
 
bool IsRandom () const
 
void SetQueueId (uint64 queueId)
 
void SetName (std::string const &name)
 
void SetTypeID (BattlegroundTypeId TypeID)
 
void SetRandomTypeID (BattlegroundTypeId TypeID)
 
void SetBracket (PvPDifficultyEntry const *bracketEntry)
 
void SetInstanceID (uint32 InstanceID)
 
void SetStatus (BattlegroundStatus Status)
 
void SetClientInstanceID (uint32 InstanceID)
 
void SetElapsedTime (uint32 Time)
 
void SetRemainingTime (uint32 Time)
 
void SetLastResurrectTime (uint32 Time)
 
void SetMaxPlayers (uint32 MaxPlayers)
 
void SetMinPlayers (uint32 MinPlayers)
 
void SetLevelRange (uint32 min, uint32 max)
 
void SetRated (bool state)
 
void SetArenaType (uint8 type)
 
void SetArenaorBGType (bool _isArena)
 
void SetWinner (BattlegroundTeamId winnerTeamId)
 
void SetScriptId (uint32 scriptId)
 
void ModifyStartDelayTime (int diff)
 
void SetStartDelayTime (int Time)
 
void SetMaxPlayersPerTeam (uint32 MaxPlayers)
 
void SetMinPlayersPerTeam (uint32 MinPlayers)
 
void AddToBGFreeSlotQueue ()
 
void RemoveFromBGFreeSlotQueue ()
 
void DecreaseInvitedCount (uint32 team)
 
void IncreaseInvitedCount (uint32 team)
 
void SetRandom (bool isRandom)
 
uint32 GetInvitedCount (uint32 team) const
 
bool HasFreeSlots () const
 
uint32 GetFreeSlotsForTeam (uint32 Team) const
 
bool isArena () const
 
bool isBattleground () const
 
bool isRated () const
 
BattlegroundPlayerMap constGetPlayers () const
 
uint32 GetPlayersSize () const
 
uint32 GetPlayerScoresSize () const
 
uint32 GetReviveQueueSize () const
 
void AddPlayerToResurrectQueue (ObjectGuid npc_guid, ObjectGuid player_guid)
 
void RemovePlayerFromResurrectQueue (ObjectGuid player_guid)
 
void RelocateDeadPlayers (ObjectGuid guideGuid)
 Relocate all players in ReviveQueue to the closest graveyard. More...
 
void StartBattleground ()
 
GameObjectGetBGObject (uint32 type, bool logError=true)
 
CreatureGetBGCreature (uint32 type, bool logError=true)
 
void SetMapId (uint32 MapID)
 
uint32 GetMapId () const
 
void SetBgMap (BattlegroundMap *map)
 
BattlegroundMapGetBgMap () const
 
BattlegroundMapFindBgMap () const
 
void SetTeamStartPosition (TeamId teamId, Position const &pos)
 
Position constGetTeamStartPosition (TeamId teamId) const
 
void SetStartMaxDist (float startMaxDist)
 
float GetStartMaxDist () const
 
void SendPacketToTeam (uint32 TeamID, WorldPacket const *packet, Player *sender=NULL, bool self=true) const
 
void SendPacketToAll (WorldPacket const *packet) const
 
void SendChatMessage (Creature *source, uint8 textId, WorldObject *target=NULL)
 
template<class Do >
void BroadcastWorker (Do &_do)
 
void PlaySoundToTeam (uint32 SoundID, uint32 TeamID)
 
void PlaySoundToAll (uint32 SoundID)
 
void CastSpellOnTeam (uint32 SpellID, uint32 TeamID)
 
void RemoveAuraOnTeam (uint32 SpellID, uint32 TeamID)
 
void RewardHonorToTeam (uint32 Honor, uint32 TeamID)
 
void RewardReputationToTeam (uint32 faction_id, uint32 Reputation, uint32 TeamID)
 
void UpdateWorldState (uint32 variable, uint32 value, bool hidden=false)
 
void BlockMovement (Player *player)
 
void SendMessageToAll (uint32 entry, ChatMsg type, Player const *source=NULL)
 
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 (uint32 TeamID) const
 
void SetBgRaid (uint32 TeamID, Group *bg_raid)
 
void BuildPvPLogDataPacket (WorldPackets::Battleground::PVPLogData &pvpLogData)
 
uint32 GetPlayersCountByTeam (uint32 Team) const
 
uint32 GetAlivePlayersCountByTeam (uint32 Team) const
 
void UpdatePlayersCountByTeam (uint32 Team, bool remove)
 
virtual void CheckWinConditions ()
 
void SetArenaTeamIdForTeam (uint32 Team, uint32 ArenaTeamId)
 
uint32 GetArenaTeamIdForTeam (uint32 Team) const
 
uint32 GetArenaTeamIdByIndex (uint32 index) const
 
void SetArenaMatchmakerRating (uint32 Team, uint32 MMR)
 
uint32 GetArenaMatchmakerRating (uint32 Team) const
 
virtual void HandleKillPlayer (Player *player, Player *killer)
 
virtual void HandleKillUnit (Creature *, Player *)
 
virtual void EventPlayerDroppedFlag (Player *)
 
void EventPlayerLoggedIn (Player *player)
 
void EventPlayerLoggedOut (Player *player)
 
virtual void ProcessEvent (WorldObject *, uint32, WorldObject *=NULL)
 
virtual void DoAction (uint32, ObjectGuid)
 
virtual void HandlePlayerResurrect (Player *)
 
void AddOrSetPlayerToCorrectBgGroup (Player *player, uint32 team)
 
virtual void RemovePlayerAtLeave (ObjectGuid guid, bool Transport, bool SendPacket)
 
void HandleTriggerBuff (ObjectGuid go_guid)
 
void SetHoliday (bool is_holiday)
 
void SpawnBGObject (uint32 type, uint32 respawntime)
 
virtual 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)
 
bool AddObject (uint32 type, uint32 entry, Position const &pos, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0, GOState goState=GO_STATE_READY)
 
virtual CreatureAddCreature (uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=NULL)
 
CreatureAddCreature (uint32 entry, uint32 type, Position const &pos, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=NULL)
 
bool DelCreature (uint32 type)
 
bool DelObject (uint32 type)
 
virtual bool AddSpiritGuide (uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL)
 
bool AddSpiritGuide (uint32 type, Position const &pos, TeamId teamId=TEAM_NEUTRAL)
 
int32 GetObjectType (ObjectGuid guid)
 
void DoorOpen (uint32 type)
 
void DoorClose (uint32 type)
 
virtual bool HandlePlayerUnderMap (Player *)
 
uint32 GetPlayerTeam (ObjectGuid guid) const
 
uint32 GetOtherTeam (uint32 teamId) const
 
bool IsPlayerInBattleground (ObjectGuid guid) const
 
bool ToBeDeleted () const
 
void SetDeleteThis ()
 
void RewardXPAtKill (Player *killer, Player *victim)
 
bool CanAwardArenaPoints () const
 
virtual ObjectGuid GetFlagPickerGUID (int32=-1) const
 
virtual void SetDroppedFlagGUID (ObjectGuid, int32=-1)
 
virtual void HandleQuestComplete (uint32, Player *)
 
virtual bool CanActivateGO (int32, uint32) const
 
virtual bool IsSpellAllowed (uint32, Player const *) const
 
uint32 GetTeamScore (uint32 TeamID) const
 
uint8 GetUniqueBracketId () const
 

Private Member Functions

void PostUpdateImpl (uint32 diff) override
 Post-update hook. More...
 
void _CreateBanner (uint8 node, uint8 type, uint8 teamIndex, bool delay)
 
void _DelBanner (uint8 node, uint8 type, uint8 teamIndex)
 
void _SendNodeUpdate (uint8 node)
 
void _NodeOccupied (uint8 node, Team team)
 
void _NodeDeOccupied (uint8 node)
 
int32 _GetNodeNameId (uint8 node)
 

Private Attributes

uint8 m_Nodes [BG_AB_DYNAMIC_NODES_COUNT]
 
uint8 m_prevNodes [BG_AB_DYNAMIC_NODES_COUNT]
 
BG_AB_BannerTimer m_BannerTimers [BG_AB_DYNAMIC_NODES_COUNT]
 
uint32 m_NodeTimers [BG_AB_DYNAMIC_NODES_COUNT]
 
uint32 m_lastTick [BG_TEAMS_COUNT]
 
uint32 m_HonorScoreTics [BG_TEAMS_COUNT]
 
uint32 m_ReputationScoreTics [BG_TEAMS_COUNT]
 
bool m_IsInformedNearVictory
 
uint32 m_HonorTics
 
uint32 m_ReputationTics
 
bool m_TeamScores500Disadvantage [BG_TEAMS_COUNT]
 

Additional Inherited Members

- Public Types inherited from Battleground
typedef std::map< ObjectGuid,
BattlegroundPlayer
BattlegroundPlayerMap
 
typedef std::map< ObjectGuid,
BattlegroundScore * > 
BattlegroundScoreMap
 
- Static Public Member Functions inherited from Battleground
static TeamId GetTeamIndexByTeamId (uint32 Team)
 
- Public Attributes inherited from Battleground
GuidVector BgObjects
 
GuidVector BgCreatures
 
- Protected Member Functions inherited from Battleground
void EndNow ()
 
void PlayerAddedToBGCheckIfBGIsRunning (Player *player)
 
Player_GetPlayer (ObjectGuid guid, bool offlineRemove, const char *context) const
 
Player_GetPlayer (BattlegroundPlayerMap::iterator itr, const char *context)
 
Player_GetPlayer (BattlegroundPlayerMap::const_iterator itr, const char *context) const
 
Player_GetPlayerForTeam (uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char *context) const
 
virtual bool PreUpdateImpl (uint32)
 Pre-update hook. More...
 
void _ProcessOfflineQueue ()
 
void _ProcessResurrect (uint32 diff)
 
void _ProcessProgress (uint32 diff)
 
void _ProcessLeave (uint32 diff)
 
void _ProcessJoin (uint32 diff)
 
void _CheckSafePositions (uint32 diff)
 
void _ProcessPlayerPositionBroadcast (uint32 diff)
 
virtual void GetPlayerPositionData (std::vector< WorldPackets::Battleground::BattlegroundPlayerPosition > *) const
 
- 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 [BG_TEAMS_COUNT]
 
ArenaTeamScore _arenaTeamScores [BG_TEAMS_COUNT]
 

Constructor & Destructor Documentation

BattlegroundAB::BattlegroundAB ( )
29 {
31  m_BuffChange = true;
33  BgCreatures.resize(BG_AB_ALL_NODES_COUNT + 5);//+5 for aura triggers
34 
35  for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
36  {
37  m_Nodes[i] = 0;
38  m_prevNodes[i] = 0;
39  m_NodeTimers[i] = 0;
40  m_BannerTimers[i].timer = 0;
41  m_BannerTimers[i].type = 0;
43  }
44 
45  for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
46  {
47  m_lastTick[i] = 0;
48  m_HonorScoreTics[i] = 0;
49  m_ReputationScoreTics[i] = 0;
50  m_TeamScores500Disadvantage[i] = false;
51  }
52 
53  m_HonorTics = 0;
54  m_ReputationTics = 0;
55 
60 }
uint8 type
Definition: BattlegroundAB.h:236
Definition: Battleground.h:199
bool m_BuffChange
Definition: Battleground.h:558
Definition: Battleground.h:200
bool m_IsInformedNearVictory
Definition: BattlegroundAB.h:332
uint32 m_HonorTics
Definition: BattlegroundAB.h:333
Definition: Battleground.h:198
Definition: BattlegroundAB.h:147
#define BG_TEAMS_COUNT
Definition: SharedDefines.h:4555
uint32 m_lastTick[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:329
uint32 timer
Definition: BattlegroundAB.h:235
Definition: Language.h:670
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:336
GuidVector BgObjects
Definition: Battleground.h:452
uint8 teamIndex
Definition: BattlegroundAB.h:237
GuidVector BgCreatures
Definition: Battleground.h:453
Definition: Language.h:671
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:327
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:556
Definition: BattlegroundAB.h:152
uint32 m_ReputationScoreTics[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:331
uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:328
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:326
uint32 m_ReputationTics
Definition: BattlegroundAB.h:334
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
Definition: Language.h:673
uint8_t uint8
Definition: Define.h:152
uint32 m_HonorScoreTics[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:330
Definition: BattlegroundAB.h:108
Definition: Battleground.h:197
Definition: Language.h:672
BattlegroundAB::~BattlegroundAB ( )
62 { }

Member Function Documentation

void BattlegroundAB::_CreateBanner ( uint8  node,
uint8  type,
uint8  teamIndex,
bool  delay 
)
private
269 {
270  // Just put it into the queue
271  if (delay)
272  {
273  m_BannerTimers[node].timer = 2000;
274  m_BannerTimers[node].type = type;
275  m_BannerTimers[node].teamIndex = teamIndex;
276  return;
277  }
278 
279  uint8 obj = node*8 + type + teamIndex;
280 
282 
283  // handle aura with banner
284  if (!type)
285  return;
286  obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
288 }
Definition: Battleground.h:129
uint8 type
Definition: BattlegroundAB.h:236
void SpawnBGObject(uint32 type, uint32 respawntime)
Definition: Battleground.cpp:1564
uint32 timer
Definition: BattlegroundAB.h:235
uint8 teamIndex
Definition: BattlegroundAB.h:237
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:327
uint8_t uint8
Definition: Define.h:152
Definition: BattlegroundAB.h:161

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundAB::_DelBanner ( uint8  node,
uint8  type,
uint8  teamIndex 
)
private
291 {
292  uint8 obj = node*8 + type + teamIndex;
294 
295  // handle aura with banner
296  if (!type)
297  return;
298  obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
300 }
void SpawnBGObject(uint32 type, uint32 respawntime)
Definition: Battleground.cpp:1564
Definition: Battleground.h:128
uint8_t uint8
Definition: Define.h:152
Definition: BattlegroundAB.h:161

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 BattlegroundAB::_GetNodeNameId ( uint8  node)
private
303 {
304  switch (node)
305  {
311  default:
312  ABORT();
313  }
314  return 0;
315 }
Definition: Language.h:664
Definition: BattlegroundAB.h:143
Definition: Language.h:660
Definition: BattlegroundAB.h:144
Definition: BattlegroundAB.h:141
Definition: Language.h:661
Definition: Language.h:662
Definition: Language.h:663
#define ABORT
Definition: Errors.h:56
Definition: BattlegroundAB.h:145
Definition: BattlegroundAB.h:142

+ Here is the caller graph for this function:

void BattlegroundAB::_NodeDeOccupied ( uint8  node)
private
408 {
409  if (node >= BG_AB_DYNAMIC_NODES_COUNT)
410  return;
411 
412  //remove bonus honor aura trigger creature when node is lost
413  if (node < BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points
414  DelCreature(node+7);//NULL checks are in DelCreature! 0-6 spirit guides
415 
417 
418  DelCreature(node);
419 
420  // buff object isn't despawned
421 }
void RelocateDeadPlayers(ObjectGuid guideGuid)
Relocate all players in ReviveQueue to the closest graveyard.
Definition: Battleground.cpp:1423
Definition: BattlegroundAB.h:147
GuidVector BgCreatures
Definition: Battleground.h:453
bool DelCreature(uint32 type)
Definition: Battleground.cpp:1640

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundAB::_NodeOccupied ( uint8  node,
Team  team 
)
private
Todo:
working, scripted peons spawning
376 {
378  TC_LOG_ERROR("bg.battleground", "Failed to spawn spirit guide! point: %u, team: %u, ", node, team);
379 
380  if (node >= BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points
381  return;
382 
383  uint8 capturedNodes = 0;
384  for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
386  ++capturedNodes;
387 
388  if (capturedNodes >= 5)
390  if (capturedNodes >= 4)
392 
393  Creature* trigger = !BgCreatures[node + 7] ? GetBGCreature(node + 7) : NULL; // 0-6 spirit guides
394  if (!trigger)
395  trigger = AddCreature(WORLD_TRIGGER, node+7, BG_AB_NodePositions[node], GetTeamIndexByTeamId(team));
396 
397  //add bonus honor aura trigger creature when node is accupied
398  //cast bonus aura (+50% honor in 25yards)
399  //aura should only apply to players who have accupied the node, set correct faction for trigger
400  if (trigger)
401  {
402  trigger->setFaction(team == ALLIANCE ? 84 : 83);
403  trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
404  }
405 }
virtual bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL)
Definition: Battleground.cpp:1676
#define WORLD_TRIGGER
Definition: Unit.h:33
virtual Creature * AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, TeamId teamId=TEAM_NEUTRAL, uint32 respawntime=0, Transport *transport=NULL)
Definition: Battleground.cpp:1580
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
Definition: BattlegroundAB.h:147
static TeamId GetTeamIndexByTeamId(uint32 Team)
Definition: Battleground.h:399
Definition: SharedDefines.h:1000
void setFaction(uint32 faction)
Definition: Unit.h:1467
Definition: Battleground.h:72
void CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
Definition: Battleground.cpp:695
GuidVector BgCreatures
Definition: Battleground.h:453
uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:328
Definition: Battleground.h:115
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
Position const BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT]
Definition: BattlegroundAB.h:222
uint8_t uint8
Definition: Define.h:152
Definition: BattlegroundAB.h:161
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Position const BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:189
Creature * GetBGCreature(uint32 type, bool logError=true)
Definition: Battleground.cpp:1549
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
Definition: Battleground.h:71

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundAB::_SendNodeUpdate ( uint8  node)
private
352 {
353  // Send node owner state update to refresh map icons on client
354  const uint8 plusArray[] = {0, 2, 3, 0, 1};
355 
356  if (m_prevNodes[node])
357  UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0);
358  else
360 
361  UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], 1);
362 
363  // How many bases each team owns
364  uint8 ally = 0, horde = 0;
365  for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
367  ++ally;
369  ++horde;
370 
373 }
Definition: BattlegroundAB.h:28
const uint32 BG_AB_OP_NODESTATES[5]
Definition: BattlegroundAB.h:64
Definition: BattlegroundAB.h:147
const uint32 BG_AB_OP_NODEICONS[5]
Definition: BattlegroundAB.h:66
Definition: BattlegroundAB.h:163
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:326
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
Definition: BattlegroundAB.h:162
uint8_t uint8
Definition: Define.h:152
void UpdateWorldState(uint32 variable, uint32 value, bool hidden=false)
Definition: Battleground.cpp:735
Definition: BattlegroundAB.h:29

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BattlegroundAB::AddPlayer ( Player player)
overridevirtual

Reimplemented from Battleground.

223 {
224  Battleground::AddPlayer(player);
225  PlayerScores[player->GetGUID()] = new BattlegroundABScore(player->GetGUID(), player->GetBGTeam());
226 }
Definition: BattlegroundAB.h:240
virtual void AddPlayer(Player *player)
Definition: Battleground.cpp:1079
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:543

+ Here is the call graph for this function:

bool BattlegroundAB::CheckAchievementCriteriaMeet ( uint32  criteriaId,
Player const player,
Unit const target = nullptr,
uint32  miscvalue = 0 
)
overridevirtual

Reimplemented from Battleground.

724 {
725  switch (criteriaId)
726  {
728  return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(player->GetTeam())];
729  }
730 
731  return Battleground::CheckAchievementCriteriaMeet(criteriaId, player, target, miscvalue);
732 }
static TeamId GetTeamIndexByTeamId(uint32 Team)
Definition: Battleground.h:399
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:336
virtual bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=NULL, uint32=0)
Definition: Battleground.cpp:1939
Definition: Battleground.h:47

+ Here is the call graph for this function:

void BattlegroundAB::EndBattleground ( uint32  winner)
overridevirtual

Reimplemented from Battleground.

641 {
642  // Win reward
643  if (winner == ALLIANCE)
645  if (winner == HORDE)
647  // Complete map_end rewards (even if no team wins)
650 
652 }
uint32 GetBonusHonorFromKill(uint32 kills) const
Definition: Battleground.cpp:907
Definition: SharedDefines.h:1000
void RewardHonorToTeam(uint32 Honor, uint32 TeamID)
Definition: Battleground.cpp:709
Definition: SharedDefines.h:999
virtual void EndBattleground(uint32 winner)
Definition: Battleground.cpp:744

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from Battleground.

425 {
426  if (GetStatus() != STATUS_IN_PROGRESS)
427  return;
428 
429  uint8 node = BG_AB_NODE_STABLES;
430  GameObject* obj = GetBgMap()->GetGameObject(BgObjects[node*8+7]);
431  while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj, 10))))
432  {
433  ++node;
435  }
436 
437  if (node == BG_AB_DYNAMIC_NODES_COUNT)
438  {
439  // this means our player isn't close to any of banners - maybe cheater ??
440  return;
441  }
442 
443  TeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam());
444 
445  // Check if player really could use this banner, not cheated
446  if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
447  return;
448 
449  source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
450  uint32 sound = 0;
451  // If node is neutral, change to contested
452  if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL)
453  {
455  m_prevNodes[node] = m_Nodes[node];
456  m_Nodes[node] = teamIndex + 1;
457  // burn current neutral banner
459  // create new contested banner
460  _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
461  _SendNodeUpdate(node);
463 
464  // FIXME: team and node names not localized
465  if (teamIndex == 0)
467  else
469 
470  sound = BG_AB_SOUND_NODE_CLAIMED;
471  }
472  // If node is contested
474  {
475  // If last state is NOT occupied, change node to enemy-contested
477  {
479  m_prevNodes[node] = m_Nodes[node];
480  m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
481  // burn current contested banner
482  _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
483  // create new contested banner
484  _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
485  _SendNodeUpdate(node);
487 
488  // FIXME: node names not localized
489  if (teamIndex == TEAM_ALLIANCE)
491  else
493  }
494  // If contested, change back to occupied
495  else
496  {
498  m_prevNodes[node] = m_Nodes[node];
499  m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED;
500  // burn current contested banner
501  _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
502  // create new occupied banner
503  _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
504  _SendNodeUpdate(node);
505  m_NodeTimers[node] = 0;
506  _NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE:HORDE);
507 
508  // FIXME: node names not localized
509  if (teamIndex == TEAM_ALLIANCE)
511  else
513  }
515  }
516  // If node is occupied, change to enemy-contested
517  else
518  {
520  m_prevNodes[node] = m_Nodes[node];
521  m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
522  // burn current occupied banner
523  _DelBanner(node, BG_AB_NODE_TYPE_OCCUPIED, !teamIndex);
524  // create new contested banner
525  _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
526  _SendNodeUpdate(node);
527  _NodeDeOccupied(node);
529 
530  // FIXME: node names not localized
531  if (teamIndex == TEAM_ALLIANCE)
533  else
535 
537  }
538 
539  // If node is occupied again, send "X has taken the Y" msg.
540  if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
541  {
542  // FIXME: team and node names not localized
543  if (teamIndex == TEAM_ALLIANCE)
545  else
547  }
548  PlaySoundToAll(sound);
549 }
Definition: Battleground.h:159
Definition: Language.h:665
void _NodeDeOccupied(uint8 node)
Definition: BattlegroundAB.cpp:407
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex)
Definition: BattlegroundAB.cpp:290
Definition: Language.h:658
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266
Definition: BattlegroundAB.h:171
Definition: Language.h:668
arena_t NULL
Definition: jemalloc_internal.h:624
BattlegroundMap * GetBgMap() const
Definition: Battleground.h:356
Definition: Language.h:659
Definition: BattlegroundAB.h:147
static TeamId GetTeamIndexByTeamId(uint32 Team)
Definition: Battleground.h:399
Definition: SharedDefines.h:1000
int32 _GetNodeNameId(uint8 node)
Definition: BattlegroundAB.cpp:302
Definition: BattlegroundAB.h:141
void PlaySoundToAll(uint32 SoundID)
Definition: Battleground.cpp:681
GuidVector BgObjects
Definition: Battleground.h:452
Definition: BattlegroundScore.h:39
uint32_t uint32
Definition: Define.h:150
void _NodeOccupied(uint8 node, Team team)
Definition: BattlegroundAB.cpp:375
Definition: SharedDefines.h:992
Definition: GameObject.h:880
uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:328
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:326
TeamId
Definition: SharedDefines.h:990
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
Definition: Language.h:667
Definition: SharedDefines.h:999
Definition: SharedDefines.h:4268
bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true) override
Definition: BattlegroundAB.cpp:693
Definition: SharedDefines.h:4269
Definition: BattlegroundAB.h:160
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
Definition: BattlegroundAB.cpp:268
uint8_t uint8
Definition: Define.h:152
Definition: BattlegroundAB.h:161
Definition: BattlegroundAB.h:158
void _SendNodeUpdate(uint8 node)
Definition: BattlegroundAB.cpp:351
Definition: Language.h:666
Definition: BattlegroundAB.h:157
Definition: BattlegroundAB.h:172
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3545
Definition: BattlegroundAB.h:168
Definition: BattlegroundAB.h:88
Definition: BattlegroundAB.h:129
Definition: BattlegroundScore.h:40
void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const *source, uint32 strId1=0, uint32 strId2=0)
Definition: Battleground.cpp:1731
Definition: BattlegroundAB.h:159

+ Here is the call graph for this function:

void BattlegroundAB::FillInitialWorldStates ( WorldPackets::WorldState::InitWorldStates packet)
overridevirtual

Reimplemented from Battleground.

318 {
319  const uint8 plusArray[] = {0, 2, 3, 0, 1};
320 
321  // Node icons
322  for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
323  packet.Worldstates.emplace_back(uint32(BG_AB_OP_NODEICONS[node]), int32((m_Nodes[node] == 0) ? 1 : 0));
324 
325  // Node occupied states
326  for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
327  for (uint8 i = 1; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
328  packet.Worldstates.emplace_back(uint32(BG_AB_OP_NODESTATES[node] + plusArray[i]), int32((m_Nodes[node] == i) ? 1 : 0));
329 
330  // How many bases each team owns
331  uint8 ally = 0, horde = 0;
332  for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
334  ++ally;
335  else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
336  ++horde;
337 
338  packet.Worldstates.emplace_back(uint32(BG_AB_OP_OCCUPIED_BASES_ALLY), int32(ally));
339  packet.Worldstates.emplace_back(uint32(BG_AB_OP_OCCUPIED_BASES_HORDE), int32(horde));
340 
341  // Team scores
346 
347  // other unknown
348  packet.Worldstates.emplace_back(uint32(0x745), 0x2);
349 }
Definition: BattlegroundAB.h:28
Definition: BattlegroundAB.h:30
int32 m_TeamScores[BG_TEAMS_COUNT]
Definition: Battleground.h:562
Definition: BattlegroundAB.h:135
Definition: BattlegroundAB.h:32
std::list< WorldStateInfo > Worldstates
Definition: WorldStatePackets.h:47
const uint32 BG_AB_OP_NODESTATES[5]
Definition: BattlegroundAB.h:64
Definition: BattlegroundAB.h:147
const uint32 BG_AB_OP_NODEICONS[5]
Definition: BattlegroundAB.h:66
Definition: BattlegroundAB.h:163
uint32_t uint32
Definition: Define.h:150
Definition: BattlegroundAB.h:134
Definition: SharedDefines.h:992
Definition: BattlegroundAB.h:31
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
Definition: BattlegroundAB.h:162
Definition: BattlegroundAB.h:33
int32_t int32
Definition: g3dmath.h:167
uint8_t uint8
Definition: Define.h:152
uint32_t uint32
Definition: g3dmath.h:168
Definition: SharedDefines.h:993
Definition: BattlegroundAB.h:29
WorldSafeLocsEntry const * BattlegroundAB::GetClosestGraveYard ( Player player)
overridevirtual

Reimplemented from Battleground.

655 {
656  TeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
657 
658  // Is there any occupied node for this team?
659  std::vector<uint8> nodes;
660  for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
661  if (m_Nodes[i] == teamIndex + 3)
662  nodes.push_back(i);
663 
664  WorldSafeLocsEntry const* good_entry = NULL;
665  // If so, select the closest node to place ghost on
666  if (!nodes.empty())
667  {
668  float plr_x = player->GetPositionX();
669  float plr_y = player->GetPositionY();
670 
671  float mindist = 999999.0f;
672  for (uint8 i = 0; i < nodes.size(); ++i)
673  {
674  WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[nodes[i]]);
675  if (!entry)
676  continue;
677  float dist = (entry->Loc.X - plr_x)*(entry->Loc.X - plr_x)+(entry->Loc.Y - plr_y)*(entry->Loc.Y - plr_y);
678  if (mindist > dist)
679  {
680  mindist = dist;
681  good_entry = entry;
682  }
683  }
684  nodes.clear();
685  }
686  // If not, place ghost on starting location
687  if (!good_entry)
688  good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex+5]);
689 
690  return good_entry;
691 }
float Y
Definition: DBCEnums.h:35
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
Definition: DBCStructure.h:1434
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: BattlegroundAB.h:147
const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT]
Definition: BattlegroundAB.h:210
static TeamId GetTeamIndexByTeamId(uint32 Team)
Definition: Battleground.h:399
float X
Definition: DBCEnums.h:34
DBCPosition3D Loc
Definition: DBCStructure.h:1438
TeamId
Definition: SharedDefines.h:990
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

uint32 BattlegroundAB::GetPrematureWinner ( )
overridevirtual

Reimplemented from Battleground.

552 {
553  // How many bases each team owns
554  uint8 ally = 0, horde = 0;
555  for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
557  ++ally;
559  ++horde;
560 
561  if (ally > horde)
562  return ALLIANCE;
563  else if (horde > ally)
564  return HORDE;
565 
566  // If the values are equal, fall back to the original result (based on number of players on each team)
568 }
virtual uint32 GetPrematureWinner()
Definition: Battleground.cpp:405
Definition: BattlegroundAB.h:147
Definition: SharedDefines.h:1000
Definition: BattlegroundAB.h:163
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
Definition: SharedDefines.h:999
Definition: BattlegroundAB.h:162
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

void BattlegroundAB::HandleAreaTrigger ( Player source,
uint32  trigger,
bool  entered 
)
overridevirtual

Reimplemented from Battleground.

233 {
234  if (GetStatus() != STATUS_IN_PROGRESS)
235  return;
236 
237  switch (trigger)
238  {
239  case 3948: // Arathi Basin Alliance Exit.
240  if (player->GetTeam() != ALLIANCE)
241  player->GetSession()->SendNotification("Only The Alliance can use that portal");
242  else
243  player->LeaveBattleground();
244  break;
245  case 3949: // Arathi Basin Horde Exit.
246  if (player->GetTeam() != HORDE)
247  player->GetSession()->SendNotification("Only The Horde can use that portal");
248  else
249  player->LeaveBattleground();
250  break;
251  case 3866: // Stables
252  case 3869: // Gold Mine
253  case 3867: // Farm
254  case 3868: // Lumber Mill
255  case 3870: // Black Smith
256  case 4020: // Unk1
257  case 4021: // Unk2
258  case 4674: // Unk3
259  //break;
260  default:
261  Battleground::HandleAreaTrigger(player, trigger, entered);
262  break;
263  }
264 }
Definition: Battleground.h:159
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266
Definition: SharedDefines.h:1000
Definition: SharedDefines.h:999
virtual void HandleAreaTrigger(Player *, uint32, bool)
Definition: Battleground.cpp:1933

+ Here is the call graph for this function:

bool BattlegroundAB::IsAllNodesControlledByTeam ( uint32  team) const
overridevirtual

Reimplemented from Battleground.

713 {
714  uint32 count = 0;
715  for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
716  if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) ||
718  ++count;
719 
720  return count == BG_AB_DYNAMIC_NODES_COUNT;
721 }
Definition: BattlegroundAB.h:147
Definition: SharedDefines.h:1000
Definition: BattlegroundAB.h:163
uint32_t uint32
Definition: Define.h:150
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
Definition: SharedDefines.h:999
Definition: BattlegroundAB.h:162
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.

65 {
67  {
68  int team_points[BG_TEAMS_COUNT] = { 0, 0 };
69 
70  for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
71  {
72  // 3 sec delay to spawn new banner instead previous despawned one
73  if (m_BannerTimers[node].timer)
74  {
75  if (m_BannerTimers[node].timer > diff)
76  m_BannerTimers[node].timer -= diff;
77  else
78  {
79  m_BannerTimers[node].timer = 0;
80  _CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
81  }
82  }
83 
84  // 1-minute to occupy a node from contested state
85  if (m_NodeTimers[node])
86  {
87  if (m_NodeTimers[node] > diff)
88  m_NodeTimers[node] -= diff;
89  else
90  {
91  m_NodeTimers[node] = 0;
92  // Change from contested to occupied !
93  uint8 teamIndex = m_Nodes[node]-1;
94  m_prevNodes[node] = m_Nodes[node];
95  m_Nodes[node] += 2;
96  // burn current contested banner
97  _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex);
98  // create new occupied banner
99  _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
100  _SendNodeUpdate(node);
101  _NodeOccupied(node, (teamIndex == 0) ? ALLIANCE:HORDE);
102  // Message to chatlog
103 
104  if (teamIndex == 0)
105  {
106  // FIXME: team and node names not localized
109  }
110  else
111  {
112  // FIXME: team and node names not localized
115  }
116  }
117  }
118 
119  for (int team = 0; team < BG_TEAMS_COUNT; ++team)
120  if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
121  ++team_points[team];
122  }
123 
124  // Accumulate points
125  for (int team = 0; team < BG_TEAMS_COUNT; ++team)
126  {
127  int points = team_points[team];
128  if (!points)
129  continue;
130 
131  m_lastTick[team] += diff;
132 
133  if (m_lastTick[team] > BG_AB_TickIntervals[points])
134  {
135  m_lastTick[team] -= BG_AB_TickIntervals[points];
136  m_TeamScores[team] += BG_AB_TickPoints[points];
137  m_HonorScoreTics[team] += BG_AB_TickPoints[points];
138  m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
139 
141  {
144  }
145 
146  if (m_HonorScoreTics[team] >= m_HonorTics)
147  {
149  m_HonorScoreTics[team] -= m_HonorTics;
150  }
151 
153  {
154  if (team == TEAM_ALLIANCE)
156  else
160  }
161 
164 
165  if (team == TEAM_ALLIANCE)
167  else if (team == TEAM_HORDE)
169  // update achievement flags
170  // we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
171  uint8 otherTeam = (team + 1) % BG_TEAMS_COUNT;
172  if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
173  m_TeamScores500Disadvantage[otherTeam] = true;
174  }
175  }
176 
177  // Test win condition
182  }
183 }
Definition: Battleground.h:159
Definition: BattlegroundAB.h:30
int32 m_TeamScores[BG_TEAMS_COUNT]
Definition: Battleground.h:562
Definition: Language.h:665
Definition: BattlegroundAB.h:135
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID)
Definition: Battleground.cpp:716
uint32 GetBonusHonorFromKill(uint32 kills) const
Definition: Battleground.cpp:907
const uint32 BG_AB_TickIntervals[6]
Definition: BattlegroundAB.h:206
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex)
Definition: BattlegroundAB.cpp:290
Definition: Language.h:658
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266
bool m_IsInformedNearVictory
Definition: BattlegroundAB.h:332
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 m_HonorTics
Definition: BattlegroundAB.h:333
Definition: Language.h:659
Definition: Language.h:674
Definition: BattlegroundAB.h:169
Definition: BattlegroundAB.h:147
#define BG_TEAMS_COUNT
Definition: SharedDefines.h:4555
void EndBattleground(uint32 winner) override
Definition: BattlegroundAB.cpp:640
uint32 m_lastTick[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:329
Definition: SharedDefines.h:1000
uint32 timer
Definition: BattlegroundAB.h:235
Definition: Language.h:675
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:336
void SendMessageToAll(uint32 entry, ChatMsg type, Player const *source=NULL)
Definition: Battleground.cpp:1706
int32 _GetNodeNameId(uint8 node)
Definition: BattlegroundAB.cpp:302
void PlaySoundToAll(uint32 SoundID)
Definition: Battleground.cpp:681
Definition: SharedDefines.h:4267
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:327
const uint32 BG_AB_TickPoints[6]
Definition: BattlegroundAB.h:207
Definition: BattlegroundAB.h:134
void _NodeOccupied(uint8 node, Team team)
Definition: BattlegroundAB.cpp:375
uint32 m_ReputationScoreTics[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:331
Definition: SharedDefines.h:992
uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:328
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:326
Definition: BattlegroundAB.h:173
Definition: BattlegroundAB.h:31
uint32 m_ReputationTics
Definition: BattlegroundAB.h:334
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
void RewardHonorToTeam(uint32 Honor, uint32 TeamID)
Definition: Battleground.cpp:709
Definition: SharedDefines.h:999
Definition: SharedDefines.h:4268
Definition: SharedDefines.h:4269
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
Definition: BattlegroundAB.cpp:268
uint8_t uint8
Definition: Define.h:152
Definition: BattlegroundAB.h:161
void UpdateWorldState(uint32 variable, uint32 value, bool hidden=false)
Definition: Battleground.cpp:735
Definition: BattlegroundAB.h:158
void _SendNodeUpdate(uint8 node)
Definition: BattlegroundAB.cpp:351
uint32 m_HonorScoreTics[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:330
Definition: SharedDefines.h:993
Definition: BattlegroundAB.h:170
void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const *source, uint32 strId1=0, uint32 strId2=0)
Definition: Battleground.cpp:1731

+ Here is the call graph for this function:

void BattlegroundAB::RemovePlayer ( Player player,
ObjectGuid  guid,
uint32  team 
)
overridevirtual

Reimplemented from Battleground.

229 {
230 }
void BattlegroundAB::Reset ( )
overridevirtual

Reimplemented from Battleground.

608 {
609  //call parent's class reset
611 
615  m_lastTick[TEAM_HORDE] = 0;
620  m_IsInformedNearVictory = false;
621  bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
626 
627  for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
628  {
629  m_Nodes[i] = 0;
630  m_prevNodes[i] = 0;
631  m_NodeTimers[i] = 0;
632  m_BannerTimers[i].timer = 0;
633  }
634 
635  for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT + 5; ++i)//+5 for aura triggers
636  if (!BgCreatures[i].IsEmpty())
637  DelCreature(i);
638 }
int32 m_TeamScores[BG_TEAMS_COUNT]
Definition: Battleground.h:562
bool m_IsInformedNearVictory
Definition: BattlegroundAB.h:332
uint32 m_HonorTics
Definition: BattlegroundAB.h:333
Definition: BattlegroundAB.h:147
uint32 m_lastTick[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:329
uint32 timer
Definition: BattlegroundAB.h:235
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:336
GuidVector BgCreatures
Definition: Battleground.h:453
#define BG_AB_NotABBGWeekendReputationTicks
Definition: BattlegroundAB.h:184
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:327
Definition: BattlegroundAB.h:152
virtual void Reset()
Definition: Battleground.cpp:1034
uint32 m_ReputationScoreTics[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:331
Definition: SharedDefines.h:992
uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:328
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:326
#define BG_AB_NotABBGWeekendHonorTicks
Definition: BattlegroundAB.h:182
uint32 m_ReputationTics
Definition: BattlegroundAB.h:334
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:325
bool DelCreature(uint32 type)
Definition: Battleground.cpp:1640
#define BG_AB_ABBGWeekendHonorTicks
Definition: BattlegroundAB.h:183
#define sBattlegroundMgr
Definition: BattlegroundMgr.h:181
uint8_t uint8
Definition: Define.h:152
BattlegroundTypeId GetTypeID(bool GetRandom=false) const
Definition: Battleground.h:263
uint32 m_HonorScoreTics[BG_TEAMS_COUNT]
Definition: BattlegroundAB.h:330
#define BG_AB_ABBGWeekendReputationTicks
Definition: BattlegroundAB.h:185
Definition: SharedDefines.h:993

+ Here is the call graph for this function:

bool BattlegroundAB::SetupBattleground ( )
overridevirtual

Reimplemented from Battleground.

571 {
572  for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
573  {
574  if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY)
575  || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY)
576  || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY)
577  || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY)
578  || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY)
579  || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY)
580  || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY)
581  || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i], 0, 0, std::sin(BG_AB_NodePositions[i].GetOrientation()/2), std::cos(BG_AB_NodePositions[i].GetOrientation()/2), RESPAWN_ONE_DAY))
582  {
583  TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn some object Battleground not created!");
584  return false;
585  }
586  }
587 
590  {
591  TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn door object Battleground not created!");
592  return false;
593  }
594 
595  //buffs
596  for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
597  {
601  TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn buff object!");
602  }
603 
604  return true;
605 }
Definition: BattlegroundAB.h:93
Definition: Battleground.h:129
virtual 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:1446
Definition: BattlegroundAB.h:84
Definition: BattlegroundAB.h:121
Definition: BattlegroundAB.h:114
Definition: BattlegroundAB.h:115
Definition: BattlegroundAB.h:116
Definition: BattlegroundAB.h:147
Definition: BattlegroundAB.h:81
Definition: BattlegroundAB.h:82
Definition: BattlegroundAB.h:124
Definition: BattlegroundAB.h:87
Definition: BattlegroundAB.h:119
Definition: Battleground.h:128
Definition: BattlegroundAB.h:120
const float BG_AB_DoorPositions[2][8]
Definition: BattlegroundAB.h:199
Definition: BattlegroundAB.h:90
Definition: BattlegroundAB.h:83
Definition: BattlegroundAB.h:85
Definition: BattlegroundAB.h:86
uint32 const Buff_Entries[3]
Definition: Battleground.h:152
const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4]
Definition: BattlegroundAB.h:213
Definition: BattlegroundAB.h:91
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Position const BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT]
Definition: BattlegroundAB.h:189
Definition: BattlegroundAB.h:71
Definition: BattlegroundAB.h:117
Definition: BattlegroundAB.h:88
Definition: BattlegroundAB.h:123

+ Here is the call graph for this function:

void BattlegroundAB::StartingEventCloseDoors ( )
overridevirtual

Reimplemented from Battleground.

186 {
187  // despawn banners, auras and buffs
188  for (int obj = BG_AB_OBJECT_BANNER_NEUTRAL; obj < BG_AB_DYNAMIC_NODES_COUNT * 8; ++obj)
190  for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT * 3; ++i)
192 
193  // Starting doors
198 
199  // Starting base spirit guides
202 }
Definition: BattlegroundAB.h:93
Definition: Battleground.h:129
void SpawnBGObject(uint32 type, uint32 respawntime)
Definition: Battleground.cpp:1564
Definition: BattlegroundAB.h:147
Definition: BattlegroundAB.h:81
Definition: SharedDefines.h:1000
Definition: BattlegroundAB.h:149
void _NodeOccupied(uint8 node, Team team)
Definition: BattlegroundAB.cpp:375
Definition: Battleground.h:128
Definition: SharedDefines.h:999
Definition: BattlegroundAB.h:90
Definition: BattlegroundAB.h:150
Definition: BattlegroundAB.h:91
void DoorClose(uint32 type)
Definition: Battleground.cpp:1506

+ Here is the call graph for this function:

void BattlegroundAB::StartingEventOpenDoors ( )
overridevirtual

Reimplemented from Battleground.

205 {
206  // spawn neutral banners
207  for (int banner = BG_AB_OBJECT_BANNER_NEUTRAL, i = 0; i < 5; banner += 8, ++i)
209  for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
210  {
211  //randomly select buff to spawn
212  uint8 buff = urand(0, 2);
214  }
217 
218  // Achievement: Let's Get This Done
220 }
Definition: BattlegroundAB.h:93
Definition: Battleground.h:129
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: Battleground.cpp:1905
#define AB_EVENT_START_BATTLE
Definition: BattlegroundAB.h:187
Definition: DBCEnums.h:183
void SpawnBGObject(uint32 type, uint32 respawntime)
Definition: Battleground.cpp:1564
Definition: BattlegroundAB.h:147
Definition: BattlegroundAB.h:81
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
void DoorOpen(uint32 type)
Definition: Battleground.cpp:1522
Definition: BattlegroundAB.h:90
uint8_t uint8
Definition: Define.h:152
Definition: BattlegroundAB.h:91

+ Here is the call graph for this function:

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

Reimplemented from Battleground.

694 {
695  if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
696  return false;
697 
698  switch (type)
699  {
702  break;
705  break;
706  default:
707  break;
708  }
709  return true;
710 }
virtual bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
Definition: Battleground.cpp:1381
Definition: BattlegroundScore.h:39
Definition: BattlegroundAB.h:178
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: BattlegroundAB.h:179
Definition: BattlegroundScore.h:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

BG_AB_BannerTimer BattlegroundAB::m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT]
private
uint32 BattlegroundAB::m_HonorScoreTics[BG_TEAMS_COUNT]
private
uint32 BattlegroundAB::m_HonorTics
private
bool BattlegroundAB::m_IsInformedNearVictory
private
uint32 BattlegroundAB::m_lastTick[BG_TEAMS_COUNT]
private
uint8 BattlegroundAB::m_Nodes[BG_AB_DYNAMIC_NODES_COUNT]
private
uint32 BattlegroundAB::m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT]
private
uint8 BattlegroundAB::m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT]
private
uint32 BattlegroundAB::m_ReputationScoreTics[BG_TEAMS_COUNT]
private
uint32 BattlegroundAB::m_ReputationTics
private
bool BattlegroundAB::m_TeamScores500Disadvantage[BG_TEAMS_COUNT]
private

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