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

#include "BattlegroundAV.h"

Inheritance diagram for BattlegroundAV:
Battleground

Public Member Functions

 BattlegroundAV ()
 
 ~BattlegroundAV () override=default
 
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 ResetBGSubclass () override
 
void UpdateScore (TeamId teamId, int16 points)
 
bool UpdatePlayerScore (Player *player, uint32 type, uint32 value, bool doAddHonor=true) override
 
void EventPlayerClickedOnFlag (Player *source, GameObject *gameObject) override
 
void HandleKillPlayer (Player *player, Player *killer) override
 
void HandleKillUnit (Creature *unit, Player *killer) override
 
void HandleQuestComplete (uint32 questid, Player *player)
 
bool PlayerCanDoMineQuest (int32 GOId, TeamId teamId)
 
void EndBattleground (TeamId winnerTeamId) override
 
GraveyardStruct const * GetClosestGraveyard (Player *player) override
 
bool IsBothMinesControlledByTeam (TeamId teamId) const
 
bool IsAllTowersControlledAndCaptainAlive (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
 
bool isTemplate () const
 
bool isMaxLevel () const
 
uint32 GetMaxPlayersPerTeam () const
 
uint32 GetMinPlayersPerTeam () const
 
int32 GetStartDelayTime () const
 
uint8 GetArenaType () const
 
PvPTeamId GetWinner () const
 
uint32 GetScriptId () const
 
uint32 GetBonusHonorFromKill (uint32 kills) const
 
void SpiritOfCompetitionEvent (PvPTeamId winnerTeamId) const
 
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. More...
 
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)
 
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. More...
 
void EventPlayerAssaultsPoint (Player *player, uint32 object)
 
void EventPlayerDefendsPoint (Player *player, uint32 object)
 
void EventPlayerDestroyedPoint (BG_AV_Nodes node)
 
void AssaultNode (BG_AV_Nodes node, TeamId teamId)
 
void DestroyNode (BG_AV_Nodes node)
 
void InitNode (BG_AV_Nodes node, TeamId teamId, bool tower)
 
void DefendNode (BG_AV_Nodes node, TeamId teamId)
 
void PopulateNode (BG_AV_Nodes node)
 
void DePopulateNode (BG_AV_Nodes node, bool ignoreSpiritGuid=false)
 
BG_AV_Nodes GetNodeThroughObject (uint32 object)
 
uint32 GetObjectThroughNode (BG_AV_Nodes node)
 
bool IsTower (BG_AV_Nodes node)
 
uint8 GetAttackString (BG_AV_Nodes node, TeamId teamId)
 
uint8 GetDefendString (BG_AV_Nodes node, TeamId teamId)
 
uint8 GetMineString (uint8 mine, TeamId teamId)
 
void ChangeMineOwner (uint8 mine, TeamId teamId, bool initial=false)
 
void FillInitialWorldStates (WorldPacket &data) override
 
uint8 GetWorldStateType (uint8 state, TeamId teamId)
 
void SendMineWorldStates (uint32 mine)
 
void UpdateNodeWorldState (BG_AV_Nodes node)
 
CreatureAddAVCreature (uint16 cinfoid, uint16 type)
 

Private Attributes

int32 m_Team_Scores [2] {}
 
uint32 m_Team_QuestStatus [2][9] {}
 
BG_AV_NodeInfo m_Nodes [BG_AV_NODES_MAX] {}
 
TeamId m_Mine_Owner [2] {}
 
int32 m_Mine_Timer
 
uint32 m_Mine_Reclaim_Timer [2] {}
 
uint32 m_CaptainBuffTimer [2] {}
 
bool m_CaptainAlive [2] {}
 
bool m_IsInformedNearVictory [2] {}
 

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

◆ BattlegroundAV()

BattlegroundAV::BattlegroundAV ( )
40{
43
44 for (uint8 i = 0; i < 2; i++)
45 {
46 for (uint8 j = 0; j < 9; j++)
47 m_Team_QuestStatus[i][j] = 0;
48 m_Team_Scores[i] = 0;
49 m_IsInformedNearVictory[i] = false;
50 m_CaptainAlive[i] = true;
51 m_CaptainBuffTimer[i] = 0;
54 }
55
56 m_Mine_Timer = 0;
57
59 InitNode(i, TEAM_NEUTRAL, false);
60
64}
std::uint8_t uint8
Definition: Define.h:109
std::uint16_t uint16
Definition: Define.h:108
@ BG_STARTING_EVENT_THIRD
Definition: Battleground.h:241
@ BG_STARTING_EVENT_SECOND
Definition: Battleground.h:240
@ BG_STARTING_EVENT_FOURTH
Definition: Battleground.h:242
BG_AV_Nodes
Definition: BattlegroundAV.h:174
@ BG_AV_NODES_FIRSTAID_STATION
Definition: BattlegroundAV.h:175
@ BG_AV_NODES_MAX
Definition: BattlegroundAV.h:191
@ BG_AV_OBJECT_MAX
Definition: BattlegroundAV.h:330
@ AV_STATICCPLACE_MAX
Definition: BattlegroundAV.h:110
@ AV_CPLACE_MAX
Definition: BattlegroundAV.h:754
@ BG_AV_TEXT_START_HALF_MINUTE
Definition: BattlegroundAV.h:54
@ BG_AV_TEXT_START_ONE_MINUTE
Definition: BattlegroundAV.h:53
@ BG_AV_TEXT_BATTLE_HAS_BEGUN
Definition: BattlegroundAV.h:55
@ TEAM_NEUTRAL
Definition: SharedDefines.h:762
BGObjects BgObjects
Definition: Battleground.h:549
BGCreatures BgCreatures
Definition: Battleground.h:550
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:642
int32 m_Mine_Timer
Definition: BattlegroundAV.h:1862
void InitNode(BG_AV_Nodes node, TeamId teamId, bool tower)
Definition: BattlegroundAV.cpp:1711
int32 m_Team_Scores[2]
Definition: BattlegroundAV.h:1856
bool m_IsInformedNearVictory[2]
Definition: BattlegroundAV.h:1867
uint32 m_CaptainBuffTimer[2]
Definition: BattlegroundAV.h:1864
uint32 m_Mine_Reclaim_Timer[2]
Definition: BattlegroundAV.h:1863
uint32 m_Team_QuestStatus[2][9]
Definition: BattlegroundAV.h:1857
TeamId m_Mine_Owner[2]
Definition: BattlegroundAV.h:1861
bool m_CaptainAlive[2]
Definition: BattlegroundAV.h:1865

References AV_CPLACE_MAX, AV_STATICCPLACE_MAX, BG_AV_NODES_FIRSTAID_STATION, BG_AV_NODES_MAX, BG_AV_OBJECT_MAX, BG_AV_TEXT_BATTLE_HAS_BEGUN, BG_AV_TEXT_START_HALF_MINUTE, BG_AV_TEXT_START_ONE_MINUTE, BG_STARTING_EVENT_FOURTH, BG_STARTING_EVENT_SECOND, BG_STARTING_EVENT_THIRD, Battleground::BgCreatures, Battleground::BgObjects, InitNode(), m_CaptainAlive, m_CaptainBuffTimer, m_IsInformedNearVictory, m_Mine_Owner, m_Mine_Reclaim_Timer, m_Mine_Timer, m_Team_QuestStatus, m_Team_Scores, Battleground::StartMessageIds, and TEAM_NEUTRAL.

◆ ~BattlegroundAV()

BattlegroundAV::~BattlegroundAV ( )
overridedefault

Member Function Documentation

◆ AddAVCreature()

Creature * BattlegroundAV::AddAVCreature ( uint16  cinfoid,
uint16  type 
)
private
Todo:
: look if this can be done by database + also add this for the wingcommanders
297{
298 bool isStatic = false;
299 Creature* creature = nullptr;
300 ASSERT(type <= static_cast<uint16>(AV_CPLACE_MAX) + AV_STATICCPLACE_MAX);
301 if (type >= AV_CPLACE_MAX) //static
302 {
303 type -= AV_CPLACE_MAX;
304 cinfoid = uint16(BG_AV_StaticCreaturePos[type][4]);
305 creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid],
306 type + AV_CPLACE_MAX,
310 BG_AV_StaticCreaturePos[type][3]);
311 isStatic = true;
312 }
313 else
314 {
315 creature = AddCreature(BG_AV_CreatureInfo[cinfoid],
316 type,
317 BG_AV_CreaturePos[type][0],
318 BG_AV_CreaturePos[type][1],
319 BG_AV_CreaturePos[type][2],
320 BG_AV_CreaturePos[type][3]);
321 }
322 if (!creature)
323 return nullptr;
326
329
330 if ((isStatic && cinfoid >= 10 && cinfoid <= 14) || (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3) ||
331 (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))))
332 {
333 if (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3)
334 || (cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3)))
335 {
336 CreatureData& data = sObjectMgr->NewOrExistCreatureData(creature->GetSpawnId());
337 data.wander_distance = 5;
338 }
339 //else wander_distance will be 15, so creatures move maximum=10
340 //creature->SetDefaultMovementType(RANDOM_MOTION_TYPE);
341 creature->GetMotionMaster()->Initialize();
342 creature->setDeathState(DeathState::JustDied);
343 creature->Respawn();
344 //TODO: find a way to add a motionmaster without killing the creature (i
345 //just copied this code from a gm-command
346 }
347
348 uint32 triggerSpawnID = 0;
349 uint32 newFaction = 0;
350 if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN])
351 {
352 triggerSpawnID = AV_CPLACE_TRIGGER16;
353 newFaction = 84;
354 }
355 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS])
356 {
357 triggerSpawnID = AV_CPLACE_TRIGGER17;
358 newFaction = 84;
359 }
360 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN])
361 {
362 triggerSpawnID = AV_CPLACE_TRIGGER18;
363 newFaction = 83;
364 }
365 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS])
366 {
367 triggerSpawnID = AV_CPLACE_TRIGGER19;
368 newFaction = 83;
369 }
370 if (triggerSpawnID && newFaction)
371 {
372 if (Creature* trigger = AddCreature(WORLD_TRIGGER,
373 triggerSpawnID,
374 BG_AV_CreaturePos[triggerSpawnID][0],
375 BG_AV_CreaturePos[triggerSpawnID][1],
376 BG_AV_CreaturePos[triggerSpawnID][2],
377 BG_AV_CreaturePos[triggerSpawnID][3]))
378 {
379 trigger->SetFaction(newFaction);
380 trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
381 }
382 }
383
384 return creature;
385}
std::uint32_t uint32
Definition: Define.h:107
#define ASSERT
Definition: Errors.h:68
#define sObjectMgr
Definition: ObjectMgr.h:1632
#define WORLD_TRIGGER
Definition: Unit.h:37
@ UNIT_FLAG_DISABLE_MOVE
Definition: UnitDefines.h:231
bool isStatic(MovementGenerator *movement)
Definition: MotionMaster.cpp:68
@ RESPAWN_ONE_DAY
Definition: Battleground.h:168
@ SPELL_HONORABLE_DEFENDER_25Y
Definition: Battleground.h:146
const uint32 BG_AV_StaticCreatureInfo[51]
Definition: BattlegroundAV.h:1362
const float BG_AV_CreaturePos[AV_CPLACE_MAX][4]
Definition: BattlegroundAV.h:761
const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5]
Definition: BattlegroundAV.h:1234
@ AV_NPC_H_TOWERDEFENSE
Definition: BattlegroundAV.h:1133
@ AV_NPC_A_GRAVEDEFENSE3
Definition: BattlegroundAV.h:1124
@ AV_NPC_H_GRAVEDEFENSE0
Definition: BattlegroundAV.h:1129
@ AV_NPC_H_CAPTAIN
Definition: BattlegroundAV.h:1134
@ AV_NPC_A_TOWERDEFENSE
Definition: BattlegroundAV.h:1125
@ AV_NPC_A_GRAVEDEFENSE0
Definition: BattlegroundAV.h:1121
@ AV_NPC_H_BOSS
Definition: BattlegroundAV.h:1135
@ AV_NPC_A_BOSS
Definition: BattlegroundAV.h:1127
@ AV_NPC_H_GRAVEDEFENSE3
Definition: BattlegroundAV.h:1132
@ AV_NPC_A_CAPTAIN
Definition: BattlegroundAV.h:1126
const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX]
Definition: BattlegroundAV.h:1174
@ AV_CPLACE_TRIGGER18
Definition: BattlegroundAV.h:751
@ AV_CPLACE_TRIGGER19
Definition: BattlegroundAV.h:752
@ AV_CPLACE_TRIGGER17
Definition: BattlegroundAV.h:750
@ AV_CPLACE_TRIGGER16
Definition: BattlegroundAV.h:749
Creature * AddCreature(uint32 entry, uint32 type, float x, float y, float z, float o, uint32 respawntime=0, MotionTransport *transport=nullptr)
Definition: Battleground.cpp:1529
Definition: Creature.h:45
void setDeathState(DeathState s, bool despawn=false) override
A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned....
Definition: Creature.cpp:1963
void Respawn(bool force=false)
Definition: Creature.cpp:2033
void SetRespawnDelay(uint32 delay)
Definition: Creature.h:294
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:67
Definition: CreatureData.h:370
float wander_distance
Definition: CreatureData.h:384
uint32 GetEntry() const
Definition: Object.h:112
MotionMaster * GetMotionMaster()
Definition: Unit.h:1622
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:713
void Initialize()
Definition: MotionMaster.cpp:73

References Battleground::AddCreature(), ASSERT, AV_CPLACE_MAX, AV_CPLACE_TRIGGER16, AV_CPLACE_TRIGGER17, AV_CPLACE_TRIGGER18, AV_CPLACE_TRIGGER19, AV_NPC_A_BOSS, AV_NPC_A_CAPTAIN, AV_NPC_A_GRAVEDEFENSE0, AV_NPC_A_GRAVEDEFENSE3, AV_NPC_A_TOWERDEFENSE, AV_NPC_H_BOSS, AV_NPC_H_CAPTAIN, AV_NPC_H_GRAVEDEFENSE0, AV_NPC_H_GRAVEDEFENSE3, AV_NPC_H_TOWERDEFENSE, AV_STATICCPLACE_MAX, BG_AV_CreatureInfo, BG_AV_CreaturePos, BG_AV_StaticCreatureInfo, BG_AV_StaticCreaturePos, Object::GetEntry(), Unit::GetMotionMaster(), Creature::GetSpawnId(), MotionMaster::Initialize(), isStatic(), Creature::Respawn(), RESPAWN_ONE_DAY, Creature::setDeathState(), Creature::SetRespawnDelay(), Unit::SetUnitFlag(), sObjectMgr, SPELL_HONORABLE_DEFENDER_25Y, UNIT_FLAG_DISABLE_MOVE, CreatureData::wander_distance, and WORLD_TRIGGER.

Referenced by ChangeMineOwner(), PopulateNode(), and SetupBattleground().

◆ AddPlayer()

void BattlegroundAV::AddPlayer ( Player player)
overridevirtual

Reimplemented from Battleground.

488{
490 PlayerScores.emplace(player->GetGUID().GetCounter(), new BattlegroundAVScore(player->GetGUID()));
491}
virtual void AddPlayer(Player *player)
Definition: Battleground.cpp:1115
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:629
Definition: BattlegroundAV.h:1734
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
LowType GetCounter() const
Definition: ObjectGuid.h:145

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

◆ AssaultNode()

void BattlegroundAV::AssaultNode ( BG_AV_Nodes  node,
TeamId  teamId 
)
private
1671{
1672 if (m_Nodes[node].TotalOwnerId == teamId)
1673 {
1674 LOG_FATAL("bg.battleground", "Assaulting team is TotalOwner of node");
1675 ABORT();
1676 }
1677 if (m_Nodes[node].OwnerId == teamId)
1678 {
1679 LOG_FATAL("bg.battleground", "Assaulting team is owner of node");
1680 ABORT();
1681 }
1682 if (m_Nodes[node].State == POINT_DESTROYED)
1683 {
1684 LOG_FATAL("bg.battleground", "Destroyed node is being assaulted");
1685 ABORT();
1686 }
1687 if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwnerId != TEAM_NEUTRAL) //only assault an assaulted node if no totalowner exists
1688 {
1689 LOG_FATAL("bg.battleground", "Assault on an not assaulted node with total owner");
1690 ABORT();
1691 }
1692 //the timer gets another time, if the previous owner was 0 == Neutral
1694 m_Nodes[node].PrevOwnerId = m_Nodes[node].OwnerId;
1695 m_Nodes[node].OwnerId = teamId;
1696 m_Nodes[node].PrevState = m_Nodes[node].State;
1698}
#define LOG_FATAL(filterType__,...)
Definition: Log.h:153
#define ABORT
Definition: Errors.h:76
@ POINT_DESTROYED
Definition: BattlegroundAV.h:1455
@ POINT_ASSAULTED
Definition: BattlegroundAV.h:1454
#define BG_AV_SNOWFALL_FIRSTCAP
Definition: BattlegroundAV.h:25
#define BG_AV_CAPTIME
Definition: BattlegroundAV.h:24
BG_AV_States State
Definition: BattlegroundAV.h:1722
TeamId PrevOwnerId
Definition: BattlegroundAV.h:1727
uint32 Timer
Definition: BattlegroundAV.h:1724
BG_AV_States PrevState
Definition: BattlegroundAV.h:1723
TeamId OwnerId
Definition: BattlegroundAV.h:1726
BG_AV_NodeInfo m_Nodes[BG_AV_NODES_MAX]
Definition: BattlegroundAV.h:1859

References ABORT, BG_AV_CAPTIME, BG_AV_SNOWFALL_FIRSTCAP, LOG_FATAL, m_Nodes, BG_AV_NodeInfo::OwnerId, POINT_ASSAULTED, POINT_DESTROYED, BG_AV_NodeInfo::PrevOwnerId, BG_AV_NodeInfo::PrevState, BG_AV_NodeInfo::State, TEAM_NEUTRAL, and BG_AV_NodeInfo::Timer.

Referenced by EventPlayerAssaultsPoint().

◆ ChangeMineOwner()

void BattlegroundAV::ChangeMineOwner ( uint8  mine,
TeamId  teamId,
bool  initial = false 
)
private
655{
656 // mine=0 northmine mine=1 southmin
657 // changing the owner results in setting respawntim to infinite for current creatures,
658 // spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
659
660 ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
661 if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE)
663
664 if (m_Mine_Owner[mine] == teamId && !initial)
665 return;
666 m_Mine_Owner[mine] = teamId;
667
668 if (!initial)
669 {
670 LOG_DEBUG("bg.battleground", "bg_av depopulating mine {} (0=north, 1=south)", mine);
671 if (mine == AV_SOUTH_MINE)
673 if (BgCreatures[i])
674 DelCreature(i); //TODO just set the respawntime to 999999
676 if (BgCreatures[i])
677 DelCreature(i); //TODO here also
678 }
680
681 LOG_DEBUG("bg.battleground", "bg_av populating mine {} (0=north, 1=south)", mine);
682 uint16 miner;
683 //also neutral team exists.. after a big time, the neutral team tries to conquer the mine
684 if (mine == AV_NORTH_MINE)
685 {
686 if (teamId == TEAM_ALLIANCE)
687 miner = AV_NPC_N_MINE_A_1;
688 else if (teamId == TEAM_HORDE)
689 miner = AV_NPC_N_MINE_H_1;
690 else
691 miner = AV_NPC_N_MINE_N_1;
692 }
693 else
694 {
695 uint16 cinfo;
696 if (teamId == TEAM_ALLIANCE)
697 miner = AV_NPC_S_MINE_A_1;
698 else if (teamId == TEAM_HORDE)
699 miner = AV_NPC_S_MINE_H_1;
700 else
701 miner = AV_NPC_S_MINE_N_1;
702 //vermin
703 LOG_DEBUG("bg.battleground", "spawning vermin");
704 if (teamId == TEAM_ALLIANCE)
705 cinfo = AV_NPC_S_MINE_A_3;
706 else if (teamId == TEAM_HORDE)
707 cinfo = AV_NPC_S_MINE_H_3;
708 else
709 cinfo = AV_NPC_S_MINE_N_S;
711 AddAVCreature(cinfo, i);
712 }
714 AddAVCreature(miner, i);
715 //the next chooses randomly between 2 cretures
717 AddAVCreature(miner + (urand(1, 2)), i);
719
720 if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE)
721 {
723 if (Creature* creature = GetBGCreature(AV_CPLACE_HERALD))
724 creature->AI()->Talk(GetMineString(mine, teamId));
725 }
726 else
727 {
728 if (mine == AV_SOUTH_MINE) //i think this gets called all the time
729 {
731 {
732 std::string creatureText = sCreatureTextMgr->GetLocalizedChatString(creature->GetEntry(), creature->getGender(), 0, 0, DEFAULT_LOCALE);
733 YellToAll(creature, creatureText.c_str(), LANG_UNIVERSAL);
734 }
735 }
736 }
737}
#define DEFAULT_LOCALE
Definition: Common.h:79
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:169
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
#define sCreatureTextMgr
Definition: CreatureTextMgr.h:118
@ AV_SOUND_HORDE_GOOD
Definition: BattlegroundAV.h:101
@ AV_SOUND_ALLIANCE_GOOD
Definition: BattlegroundAV.h:100
@ AV_MINE_RECLAIM_TIMER
Definition: BattlegroundAV.h:114
@ AV_NORTH_MINE
Definition: BattlegroundAV.h:111
@ AV_SOUTH_MINE
Definition: BattlegroundAV.h:112
@ AV_NPC_N_MINE_H_1
Definition: BattlegroundAV.h:1153
@ AV_NPC_S_MINE_N_S
Definition: BattlegroundAV.h:1161
@ AV_NPC_S_MINE_N_1
Definition: BattlegroundAV.h:1157
@ AV_NPC_N_MINE_N_1
Definition: BattlegroundAV.h:1145
@ AV_NPC_S_MINE_H_1
Definition: BattlegroundAV.h:1166
@ AV_NPC_N_MINE_A_1
Definition: BattlegroundAV.h:1149
@ AV_NPC_S_MINE_H_3
Definition: BattlegroundAV.h:1168
@ AV_NPC_S_MINE_A_3
Definition: BattlegroundAV.h:1164
@ AV_NPC_S_MINE_A_1
Definition: BattlegroundAV.h:1162
@ AV_CPLACE_MINE_S_2_MAX
Definition: BattlegroundAV.h:721
@ AV_CPLACE_MINE_N_1_MIN
Definition: BattlegroundAV.h:708
@ AV_CPLACE_MINE_S_S_MIN
Definition: BattlegroundAV.h:723
@ AV_CPLACE_MINE_S_2_MIN
Definition: BattlegroundAV.h:720
@ AV_CPLACE_MINE_S_1_MIN
Definition: BattlegroundAV.h:717
@ AV_CPLACE_MINE_S_S_MAX
Definition: BattlegroundAV.h:724
@ AV_CPLACE_MINE_N_2_MAX
Definition: BattlegroundAV.h:712
@ AV_CPLACE_MINE_N_1_MAX
Definition: BattlegroundAV.h:709
@ AV_CPLACE_MINE_S_3
Definition: BattlegroundAV.h:726
@ AV_CPLACE_MINE_S_1_MAX
Definition: BattlegroundAV.h:718
@ AV_CPLACE_MINE_N_3
Definition: BattlegroundAV.h:714
@ AV_CPLACE_HERALD
Definition: BattlegroundAV.h:729
@ AV_CPLACE_MINE_N_2_MIN
Definition: BattlegroundAV.h:711
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
bool DelCreature(uint32 type)
Definition: Battleground.cpp:1592
void YellToAll(Creature *creature, const char *text, uint32 language)
Definition: Battleground.cpp:719
Creature * GetBGCreature(uint32 type)
Definition: Battleground.cpp:1500
void PlaySoundToAll(uint32 soundId)
Definition: Battleground.cpp:700
uint8 GetMineString(uint8 mine, TeamId teamId)
Definition: BattlegroundAV.cpp:1646
Creature * AddAVCreature(uint16 cinfoid, uint16 type)
Definition: BattlegroundAV.cpp:296
void SendMineWorldStates(uint32 mine)
Definition: BattlegroundAV.cpp:1161

References AddAVCreature(), ASSERT, AV_CPLACE_HERALD, AV_CPLACE_MINE_N_1_MAX, AV_CPLACE_MINE_N_1_MIN, AV_CPLACE_MINE_N_2_MAX, AV_CPLACE_MINE_N_2_MIN, AV_CPLACE_MINE_N_3, AV_CPLACE_MINE_S_1_MAX, AV_CPLACE_MINE_S_1_MIN, AV_CPLACE_MINE_S_2_MAX, AV_CPLACE_MINE_S_2_MIN, AV_CPLACE_MINE_S_3, AV_CPLACE_MINE_S_S_MAX, AV_CPLACE_MINE_S_S_MIN, AV_MINE_RECLAIM_TIMER, AV_NORTH_MINE, AV_NPC_N_MINE_A_1, AV_NPC_N_MINE_H_1, AV_NPC_N_MINE_N_1, AV_NPC_S_MINE_A_1, AV_NPC_S_MINE_A_3, AV_NPC_S_MINE_H_1, AV_NPC_S_MINE_H_3, AV_NPC_S_MINE_N_1, AV_NPC_S_MINE_N_S, AV_SOUND_ALLIANCE_GOOD, AV_SOUND_HORDE_GOOD, AV_SOUTH_MINE, Battleground::BgCreatures, DEFAULT_LOCALE, Battleground::DelCreature(), Battleground::GetBGCreature(), GetMineString(), LANG_UNIVERSAL, LOG_DEBUG, m_Mine_Owner, m_Mine_Reclaim_Timer, Battleground::PlaySoundToAll(), sCreatureTextMgr, SendMineWorldStates(), TEAM_ALLIANCE, TEAM_HORDE, urand(), and Battleground::YellToAll().

Referenced by HandleKillUnit(), PostUpdateImpl(), and StartingEventOpenDoors().

◆ DefendNode()

void BattlegroundAV::DefendNode ( BG_AV_Nodes  node,
TeamId  teamId 
)
private
1723{
1724 ASSERT(m_Nodes[node].TotalOwnerId == teamId);
1725 ASSERT(m_Nodes[node].OwnerId != teamId);
1726 ASSERT(m_Nodes[node].State != POINT_CONTROLED && m_Nodes[node].State != POINT_DESTROYED);
1727 m_Nodes[node].PrevOwnerId = m_Nodes[node].OwnerId;
1728 m_Nodes[node].OwnerId = teamId;
1729 m_Nodes[node].PrevState = m_Nodes[node].State;
1731 m_Nodes[node].Timer = 0;
1732}
@ POINT_CONTROLED
Definition: BattlegroundAV.h:1456

References ASSERT, m_Nodes, BG_AV_NodeInfo::OwnerId, POINT_CONTROLED, POINT_DESTROYED, BG_AV_NodeInfo::PrevOwnerId, BG_AV_NodeInfo::PrevState, BG_AV_NodeInfo::State, and BG_AV_NodeInfo::Timer.

Referenced by EventPlayerDefendsPoint().

◆ DePopulateNode()

void BattlegroundAV::DePopulateNode ( BG_AV_Nodes  node,
bool  ignoreSpiritGuid = false 
)
private
803{
804 uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
805 for (uint8 i = 0; i < 4; i++)
806 {
807 if (BgCreatures[c_place + i])
808 {
809 DelCreature(c_place + i);
810 }
811 }
812
813 //spiritguide
814 if (!ignoreSpiritGuide && !IsTower(node))
815 {
816 DelCreature(node);
817 }
818
819 //remove bonus honor aura trigger creature when node is lost
820 if (node < BG_AV_NODES_MAX)//fail safe
821 DelCreature(node + 302);//nullptr checks are in DelCreature! 0-302 spirit guides
822}
@ AV_CPLACE_DEFENSE_STORM_AID
Definition: BattlegroundAV.h:681
bool IsTower(BG_AV_Nodes node)
Definition: BattlegroundAV.h:1837

References AV_CPLACE_DEFENSE_STORM_AID, BG_AV_NODES_MAX, Battleground::BgCreatures, Battleground::DelCreature(), and IsTower().

Referenced by EventPlayerAssaultsPoint(), and HandleQuestComplete().

◆ DestroyNode()

void BattlegroundAV::DestroyNode ( BG_AV_Nodes  node)
private

◆ EndBattleground()

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

Reimplemented from Battleground.

494{
495 //calculate bonuskills for both teams:
496 //first towers:
497 uint8 kills[2] = {0, 0}; // 0 = Alliance 1 = Horde
498 uint8 rep[2] = {0, 0}; // 0 = Alliance 1 = Horde
500 {
501 if (m_Nodes[i].State == POINT_CONTROLED)
502 {
503 if (m_Nodes[i].OwnerId == TEAM_ALLIANCE)
504 {
506 kills[0] += BG_AV_KILL_SURVIVING_TOWER;
507 }
508 else
509 {
511 kills[1] += BG_AV_KILL_SURVIVING_TOWER;
512 }
513 }
514 }
515
516 for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId + 1))
517 {
518 if (m_CaptainAlive[iTeamId])
519 {
520 kills[iTeamId] += BG_AV_KILL_SURVIVING_CAPTAIN;
521 rep[iTeamId] += BG_AV_REP_SURVIVING_CAPTAIN;
522 }
523 if (rep[iTeamId] != 0)
524 RewardReputationToTeam(iTeamId == TEAM_ALLIANCE ? 730 : 729, rep[iTeamId], iTeamId);
525 if (kills[iTeamId] != 0)
526 RewardHonorToTeam(GetBonusHonorFromKill(kills[iTeamId]), iTeamId);
527 }
528
529 //TODO add enterevademode for all attacking creatures
530 Battleground::EndBattleground(winnerTeamId);
531}
@ BG_AV_NODES_FROSTWOLF_WTOWER
Definition: BattlegroundAV.h:189
@ BG_AV_NODES_DUNBALDAR_SOUTH
Definition: BattlegroundAV.h:182
#define BG_AV_KILL_SURVIVING_TOWER
Definition: BattlegroundAV.h:43
#define BG_AV_REP_SURVIVING_CAPTAIN
Definition: BattlegroundAV.h:47
#define BG_AV_REP_SURVIVING_TOWER
Definition: BattlegroundAV.h:44
#define BG_AV_KILL_SURVIVING_CAPTAIN
Definition: BattlegroundAV.h:46
TeamId
Definition: SharedDefines.h:759
void RewardReputationToTeam(uint32 factionId, uint32 reputation, TeamId teamId)
Definition: Battleground.cpp:736
void EndBattleground(PvPTeamId winnerTeamId)
Definition: Battleground.cpp:787
uint32 GetBonusHonorFromKill(uint32 kills) const
Definition: Battleground.cpp:959
void RewardHonorToTeam(uint32 honor, TeamId teamId)
Definition: Battleground.cpp:729

References BG_AV_KILL_SURVIVING_CAPTAIN, BG_AV_KILL_SURVIVING_TOWER, BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_FROSTWOLF_WTOWER, BG_AV_REP_SURVIVING_CAPTAIN, BG_AV_REP_SURVIVING_TOWER, Battleground::EndBattleground(), Battleground::GetBonusHonorFromKill(), m_CaptainAlive, m_Nodes, POINT_CONTROLED, Battleground::RewardHonorToTeam(), Battleground::RewardReputationToTeam(), TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by HandleKillUnit(), and UpdateScore().

◆ EventPlayerAssaultsPoint()

void BattlegroundAV::EventPlayerAssaultsPoint ( Player player,
uint32  object 
)
private
981{
983
984 BG_AV_Nodes node = GetNodeThroughObject(object);
985 TeamId prevOwnerId = m_Nodes[node].OwnerId;
986 TeamId teamId = player->GetTeamId();
987 LOG_DEBUG("bg.battleground", "bg_av: player assaults point object {} node {}", object, node);
988 if (prevOwnerId == teamId || teamId == m_Nodes[node].TotalOwnerId)
989 return; //surely a gm used this object
990
991 if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall is a bit special in capping + it gets eyecandy stuff
992 {
993 if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) //initial capping
994 {
995 if (!(prevOwnerId == TEAM_NEUTRAL && m_Nodes[node].TotalOwnerId == TEAM_NEUTRAL))
996 return;
997
998 if (teamId == TEAM_ALLIANCE)
1000 else
1003 }
1004 else if (m_Nodes[node].TotalOwnerId == TEAM_NEUTRAL) //recapping, when no team owns this node realy
1005 {
1006 if (!(m_Nodes[node].State != POINT_CONTROLED))
1007 return;
1008
1009 if (teamId == TEAM_ALLIANCE)
1010 SpawnBGObject(object - 11, RESPAWN_IMMEDIATELY);
1011 else
1012 SpawnBGObject(object + 11, RESPAWN_IMMEDIATELY);
1013 }
1014 //eyecandy
1015 uint32 spawn, despawn;
1016 if (teamId == TEAM_ALLIANCE)
1017 {
1020 }
1021 else
1022 {
1025 }
1026 for (uint8 i = 0; i < 4; i++)
1027 {
1028 SpawnBGObject(despawn + i, RESPAWN_ONE_DAY);
1030 }
1031 }
1032
1033 // xinef: moved here, assure that no call to m_Nodes is used in IF statement bellow as it is modified
1034 AssaultNode(node, teamId);
1035
1036 //if snowfall gots capped it can be handled like all other graveyards
1037 if (m_Nodes[node].TotalOwnerId != TEAM_NEUTRAL)
1038 {
1039 ASSERT(prevOwnerId != TEAM_NEUTRAL);
1040 if (teamId == TEAM_ALLIANCE)
1041 SpawnBGObject(object - 22, RESPAWN_IMMEDIATELY);
1042 else
1043 SpawnBGObject(object + 22, RESPAWN_IMMEDIATELY);
1044
1045 bool ignoreSpiritGuide = false;
1046 if (IsTower(node))
1047 {
1048 //spawning/despawning of bigflag+aura
1053 }
1054 else
1055 {
1056 //spawning/despawning of aura
1058 SpawnBGObject(static_cast<uint8>(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION) + prevOwnerId + 3 * node, RESPAWN_ONE_DAY); //teeamaura despawn
1059
1060 ignoreSpiritGuide = true;
1061
1062 _reviveEvents.AddEventAtOffset([this, node]()
1063 {
1065
1066 if (!IsTower(node))
1067 DelCreature(node); // Delete spirit healer
1068 }, 500ms);
1069 }
1070
1071 DePopulateNode(node, ignoreSpiritGuide);
1072 }
1073
1074 SpawnBGObject(object, RESPAWN_ONE_DAY); //delete old banner
1075 // xinef: change here is too late, AssaultNode(node, team);
1077
1078 if (Creature* creature = GetBGCreature(AV_CPLACE_HERALD))
1079 creature->AI()->Talk(GetAttackString(node, teamId));
1080
1081 //update the statistic for the assaulting player
1083
1085}
@ RESPAWN_IMMEDIATELY
Definition: Battleground.h:169
@ STATUS_IN_PROGRESS
Definition: Battleground.h:202
@ BG_AV_NODES_SNOWFALL_GRAVE
Definition: BattlegroundAV.h:178
@ BG_AV_OBJECT_AURA_N_FIRSTAID_STATION
Definition: BattlegroundAV.h:249
@ BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE
Definition: BattlegroundAV.h:223
@ BG_AV_OBJECT_AURA_A_FIRSTAID_STATION
Definition: BattlegroundAV.h:250
@ BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE
Definition: BattlegroundAV.h:211
@ BG_AV_OBJECT_SNOW_EYECANDY_A
Definition: BattlegroundAV.h:315
@ BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH
Definition: BattlegroundAV.h:289
@ BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE
Definition: BattlegroundAV.h:244
@ BG_AV_OBJECT_SNOW_EYECANDY_PH
Definition: BattlegroundAV.h:318
@ BG_AV_OBJECT_SNOW_EYECANDY_H
Definition: BattlegroundAV.h:317
@ BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH
Definition: BattlegroundAV.h:272
@ BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH
Definition: BattlegroundAV.h:288
@ BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH
Definition: BattlegroundAV.h:273
@ BG_AV_OBJECT_SNOW_EYECANDY_PA
Definition: BattlegroundAV.h:316
@ BG_AV_QUEST_CREDIT_TOWER
Definition: BattlegroundAV.h:116
@ BG_AV_QUEST_CREDIT_GRAVEYARD
Definition: BattlegroundAV.h:117
@ SCORE_GRAVEYARDS_ASSAULTED
Definition: BattlegroundScore.h:44
@ SCORE_TOWERS_ASSAULTED
Definition: BattlegroundScore.h:46
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
Definition: EventProcessor.h:107
void SpawnBGObject(uint32 type, uint32 respawntime, uint32 forceRespawnDelay=0)
Definition: Battleground.cpp:1509
void RelocateDeadPlayers(ObjectGuid queueIndex)
Relocate all players in ReviveQueue to the closest graveyard.
Definition: Battleground.cpp:1383
EventProcessor _reviveEvents
Definition: Battleground.h:655
BattlegroundStatus GetStatus() const
Definition: Battleground.h:332
BG_AV_Nodes GetNodeThroughObject(uint32 object)
Definition: BattlegroundAV.cpp:824
bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true) override
Definition: BattlegroundAV.cpp:575
uint8 GetAttackString(BG_AV_Nodes node, TeamId teamId)
Definition: BattlegroundAV.cpp:1448
void DePopulateNode(BG_AV_Nodes node, bool ignoreSpiritGuid=false)
Definition: BattlegroundAV.cpp:802
void UpdateNodeWorldState(BG_AV_Nodes node)
Definition: BattlegroundAV.cpp:1152
void AssaultNode(BG_AV_Nodes node, TeamId teamId)
Definition: BattlegroundAV.cpp:1670
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: PlayerQuest.cpp:1921
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2090

References Battleground::_reviveEvents, EventProcessor::AddEventAtOffset(), AssaultNode(), ASSERT, AV_CPLACE_HERALD, BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_OBJECT_AURA_A_FIRSTAID_STATION, BG_AV_OBJECT_AURA_N_FIRSTAID_STATION, BG_AV_OBJECT_FLAG_C_A_SNOWFALL_GRAVE, BG_AV_OBJECT_FLAG_C_H_SNOWFALL_GRAVE, BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECT_SNOW_EYECANDY_A, BG_AV_OBJECT_SNOW_EYECANDY_H, BG_AV_OBJECT_SNOW_EYECANDY_PA, BG_AV_OBJECT_SNOW_EYECANDY_PH, BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH, BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH, BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH, BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH, BG_AV_QUEST_CREDIT_GRAVEYARD, BG_AV_QUEST_CREDIT_TOWER, Battleground::BgCreatures, Battleground::DelCreature(), DePopulateNode(), GetAttackString(), Battleground::GetBGCreature(), GetNodeThroughObject(), Battleground::GetStatus(), Player::GetTeamId(), IsTower(), Player::KilledMonsterCredit(), LOG_DEBUG, m_Nodes, BG_AV_NodeInfo::OwnerId, POINT_ASSAULTED, POINT_CONTROLED, Battleground::RelocateDeadPlayers(), RESPAWN_IMMEDIATELY, RESPAWN_ONE_DAY, SCORE_GRAVEYARDS_ASSAULTED, SCORE_TOWERS_ASSAULTED, Battleground::SpawnBGObject(), BG_AV_NodeInfo::State, STATUS_IN_PROGRESS, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, UpdateNodeWorldState(), and UpdatePlayerScore().

Referenced by EventPlayerClickedOnFlag(), and EventPlayerDefendsPoint().

◆ EventPlayerClickedOnFlag()

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

Reimplemented from Battleground.

888{
890 return;
891 int32 object = GetObjectType(gameObject->GetGUID());
892 if (object < 0)
893 return;
894 switch (gameObject->GetEntry())
895 {
901 EventPlayerAssaultsPoint(source, object);
902 break;
907 EventPlayerDefendsPoint(source, object);
908 break;
909 default:
910 break;
911 }
912}
std::int32_t int32
Definition: Define.h:103
@ BG_AV_OBJECTID_BANNER_H
Definition: BattlegroundAV.h:126
@ BG_AV_OBJECTID_BANNER_CONT_A
Definition: BattlegroundAV.h:127
@ BG_AV_OBJECTID_BANNER_H_B
Definition: BattlegroundAV.h:131
@ BG_AV_OBJECTID_BANNER_A_B
Definition: BattlegroundAV.h:130
@ BG_AV_OBJECTID_BANNER_SNOWFALL_N
Definition: BattlegroundAV.h:134
@ BG_AV_OBJECTID_BANNER_A
Definition: BattlegroundAV.h:125
@ BG_AV_OBJECTID_BANNER_CONT_H
Definition: BattlegroundAV.h:128
@ BG_AV_OBJECTID_BANNER_CONT_H_B
Definition: BattlegroundAV.h:133
@ BG_AV_OBJECTID_BANNER_CONT_A_B
Definition: BattlegroundAV.h:132
int32 GetObjectType(ObjectGuid guid)
Definition: Battleground.cpp:1797
void EventPlayerAssaultsPoint(Player *player, uint32 object)
Definition: BattlegroundAV.cpp:980
void EventPlayerDefendsPoint(Player *player, uint32 object)
Definition: BattlegroundAV.cpp:914

References BG_AV_OBJECTID_BANNER_A, BG_AV_OBJECTID_BANNER_A_B, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_OBJECTID_BANNER_H, BG_AV_OBJECTID_BANNER_H_B, BG_AV_OBJECTID_BANNER_SNOWFALL_N, EventPlayerAssaultsPoint(), EventPlayerDefendsPoint(), Object::GetEntry(), Object::GetGUID(), Battleground::GetObjectType(), Battleground::GetStatus(), and STATUS_IN_PROGRESS.

◆ EventPlayerDefendsPoint()

void BattlegroundAV::EventPlayerDefendsPoint ( Player player,
uint32  object 
)
private
915{
917 BG_AV_Nodes node = GetNodeThroughObject(object);
918
919 TeamId ownerId = m_Nodes[node].OwnerId; //maybe should name it prevowner
920 TeamId teamId = player->GetTeamId();
921
922 if (ownerId == player->GetTeamId() || m_Nodes[node].State != POINT_ASSAULTED)
923 return;
924 if (m_Nodes[node].TotalOwnerId == TEAM_NEUTRAL)
925 {
926 //until snowfall doesn't belong to anyone it is better handled in assault-code
927 ASSERT(node == BG_AV_NODES_SNOWFALL_GRAVE); //currently the only neutral grave
928 EventPlayerAssaultsPoint(player, object);
929 return;
930 }
931 LOG_DEBUG("bg.battleground", "player defends point object: {} node: {}", object, node);
932 if (m_Nodes[node].PrevOwnerId != teamId)
933 {
934 LOG_ERROR("bg.battleground", "BG_AV: player defends point which doesn't belong to his team {}", node);
935 return;
936 }
937
938 //spawn new go :)
939 if (m_Nodes[node].OwnerId == TEAM_ALLIANCE)
940 SpawnBGObject(object + 22, RESPAWN_IMMEDIATELY); //spawn horde banner
941 else
942 SpawnBGObject(object - 22, RESPAWN_IMMEDIATELY); //spawn alliance banner
943
944 if (!IsTower(node))
945 {
948 }
949 // despawn old go
951
952 DefendNode(node, teamId);
953 PopulateNode(node);
955
956 if (IsTower(node))
957 {
958 //spawn big flag+aura on top of tower
963 }
964 else if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
965 {
966 for (uint8 i = 0; i < 4; i++)
967 {
970 }
971 }
972
973 if (Creature* creature = GetBGCreature(AV_CPLACE_HERALD))
974 creature->AI()->Talk(GetDefendString(node, teamId));
975
976 //update the statistic for the defending player
978}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
@ SCORE_TOWERS_DEFENDED
Definition: BattlegroundScore.h:47
@ SCORE_GRAVEYARDS_DEFENDED
Definition: BattlegroundScore.h:45
void PopulateNode(BG_AV_Nodes node)
Definition: BattlegroundAV.cpp:748
void DefendNode(BG_AV_Nodes node, TeamId teamId)
Definition: BattlegroundAV.cpp:1722
uint8 GetDefendString(BG_AV_Nodes node, TeamId teamId)
Definition: BattlegroundAV.cpp:1547

References ASSERT, AV_CPLACE_HERALD, BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_OBJECT_AURA_A_FIRSTAID_STATION, BG_AV_OBJECT_AURA_N_FIRSTAID_STATION, BG_AV_OBJECT_SNOW_EYECANDY_A, BG_AV_OBJECT_SNOW_EYECANDY_H, BG_AV_OBJECT_SNOW_EYECANDY_PA, BG_AV_OBJECT_SNOW_EYECANDY_PH, BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH, BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH, BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH, BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH, DefendNode(), EventPlayerAssaultsPoint(), Battleground::GetBGCreature(), GetDefendString(), GetNodeThroughObject(), Battleground::GetStatus(), Player::GetTeamId(), IsTower(), LOG_DEBUG, LOG_ERROR, m_Nodes, BG_AV_NodeInfo::OwnerId, POINT_ASSAULTED, PopulateNode(), RESPAWN_IMMEDIATELY, RESPAWN_ONE_DAY, SCORE_GRAVEYARDS_DEFENDED, SCORE_TOWERS_DEFENDED, Battleground::SpawnBGObject(), BG_AV_NodeInfo::State, STATUS_IN_PROGRESS, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, UpdateNodeWorldState(), and UpdatePlayerScore().

Referenced by EventPlayerClickedOnFlag().

◆ EventPlayerDestroyedPoint()

void BattlegroundAV::EventPlayerDestroyedPoint ( BG_AV_Nodes  node)
private
602{
603 uint32 object = GetObjectThroughNode(node);
604 LOG_DEBUG("bg.battleground", "bg_av: player destroyed point node {} object {}", node, object);
605
606 //despawn banner
608 DestroyNode(node);
610
611 TeamId ownerId = m_Nodes[node].OwnerId;
612 if (IsTower(node))
613 {
615 //despawn marshal
618 else
619 LOG_ERROR("bg.battleground", "BG_AV: playerdestroyedpoint: marshal {} doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
620 //spawn destroyed aura
621 for (uint8 i = 0; i <= 9; i++)
623
625 RewardReputationToTeam(ownerId == TEAM_ALLIANCE ? 730 : 729, BG_AV_REP_TOWER, ownerId);
627
628 SpawnBGObject(static_cast<uint8>(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH) + ownerId + (2 * tmp), RESPAWN_ONE_DAY);
629 SpawnBGObject(static_cast<uint8>(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH) + ownerId + (2 * tmp), RESPAWN_ONE_DAY);
630 }
631 else
632 {
633 if (ownerId == TEAM_ALLIANCE)
635 else
639 PopulateNode(node);
640 if (node == BG_AV_NODES_SNOWFALL_GRAVE) //snowfall eyecandy
641 {
642 for (uint8 i = 0; i < 4; i++)
643 {
646 }
647 }
648 }
649
650 if (Creature* creature = GetBGCreature(AV_CPLACE_HERALD))
651 creature->AI()->Talk(GetDefendString(node, ownerId));
652}
#define BG_AV_RES_TOWER
Definition: BattlegroundAV.h:39
#define BG_AV_REP_TOWER
Definition: BattlegroundAV.h:38
@ BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH
Definition: BattlegroundAV.h:305
@ AV_CPLACE_A_MARSHAL_SOUTH
Definition: BattlegroundAV.h:698
#define BG_AV_KILL_TOWER
Definition: BattlegroundAV.h:37
uint32 GetObjectThroughNode(BG_AV_Nodes node)
Definition: BattlegroundAV.cpp:846
void UpdateScore(TeamId teamId, int16 points)
Definition: BattlegroundAV.cpp:266
void DestroyNode(BG_AV_Nodes node)
Definition: BattlegroundAV.cpp:1700

References AV_CPLACE_A_MARSHAL_SOUTH, AV_CPLACE_HERALD, BG_AV_KILL_TOWER, BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_OBJECT_AURA_A_FIRSTAID_STATION, BG_AV_OBJECT_AURA_N_FIRSTAID_STATION, BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH, BG_AV_OBJECT_SNOW_EYECANDY_A, BG_AV_OBJECT_SNOW_EYECANDY_H, BG_AV_OBJECT_SNOW_EYECANDY_PA, BG_AV_OBJECT_SNOW_EYECANDY_PH, BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH, BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH, BG_AV_REP_TOWER, BG_AV_RES_TOWER, Battleground::BgCreatures, Battleground::DelCreature(), DestroyNode(), Battleground::GetBGCreature(), Battleground::GetBonusHonorFromKill(), GetDefendString(), GetObjectThroughNode(), IsTower(), LOG_DEBUG, LOG_ERROR, m_Nodes, BG_AV_NodeInfo::OwnerId, PopulateNode(), RESPAWN_IMMEDIATELY, RESPAWN_ONE_DAY, Battleground::RewardHonorToTeam(), Battleground::RewardReputationToTeam(), Battleground::SpawnBGObject(), TEAM_ALLIANCE, TEAM_HORDE, UpdateNodeWorldState(), and UpdateScore().

Referenced by PostUpdateImpl().

◆ FillInitialWorldStates()

void BattlegroundAV::FillInitialWorldStates ( WorldPacket data)
overrideprivatevirtual

Reimplemented from Battleground.

1088{
1089 bool stateok;
1090 //graveyards
1092 {
1093 for (uint8 j = 1; j <= 3; j += 2)
1094 {
1095 //j=1=assaulted j=3=controled
1096 stateok = (m_Nodes[i].State == j);
1097 data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)]) << uint32((m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok) ? 1 : 0);
1098 data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)]) << uint32((m_Nodes[i].OwnerId == TEAM_HORDE && stateok) ? 1 : 0);
1099 }
1100 }
1101
1102 //towers
1104 for (uint8 j = 1; j <= 3; j += 2)
1105 {
1106 //j=1=assaulted j=3=controled //i dont have j=2=destroyed cause destroyed is the same like enemy-team controll
1107 stateok = (m_Nodes[i].State == j || (m_Nodes[i].State == POINT_DESTROYED && j == 3));
1108 data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)]) << uint32((m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok) ? 1 : 0);
1109 data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)]) << uint32((m_Nodes[i].OwnerId == TEAM_HORDE && stateok) ? 1 : 0);
1110 }
1111 if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].OwnerId == TEAM_NEUTRAL) //cause neutral teams aren't handled generic
1112 data << uint32(AV_SNOWFALL_N) << uint32(1);
1114 data << uint32(AV_Horde_Score) << uint32(m_Team_Scores[1]);
1115 if (GetStatus() == STATUS_IN_PROGRESS) //only if game started the teamscores are displayed
1116 {
1117 data << uint32(AV_SHOW_A_SCORE) << uint32(1);
1118 data << uint32(AV_SHOW_H_SCORE) << uint32(1);
1119 }
1120 else
1121 {
1122 data << uint32(AV_SHOW_A_SCORE) << uint32(0);
1123 data << uint32(AV_SHOW_H_SCORE) << uint32(0);
1124 }
1127}
@ BG_AV_NODES_FROSTWOLF_HUT
Definition: BattlegroundAV.h:181
const uint32 BG_AV_NodeWorldStates[16][4]
Definition: BattlegroundAV.h:1580
@ AV_SNOWFALL_N
Definition: BattlegroundAV.h:1490
@ AV_SHOW_A_SCORE
Definition: BattlegroundAV.h:1464
@ AV_Horde_Score
Definition: BattlegroundAV.h:1462
@ AV_Alliance_Score
Definition: BattlegroundAV.h:1461
@ AV_SHOW_H_SCORE
Definition: BattlegroundAV.h:1463
uint8 GetWorldStateType(uint8 state, TeamId teamId)
Definition: BattlegroundAV.cpp:1129

References AV_Alliance_Score, AV_Horde_Score, AV_NORTH_MINE, AV_SHOW_A_SCORE, AV_SHOW_H_SCORE, AV_SNOWFALL_N, AV_SOUTH_MINE, BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_FIRSTAID_STATION, BG_AV_NODES_FROSTWOLF_HUT, BG_AV_NODES_MAX, BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_NodeWorldStates, Battleground::GetStatus(), GetWorldStateType(), m_Nodes, m_Team_Scores, POINT_DESTROYED, SendMineWorldStates(), BG_AV_NodeInfo::State, STATUS_IN_PROGRESS, TEAM_ALLIANCE, TEAM_HORDE, and TEAM_NEUTRAL.

◆ GetAttackString()

uint8 BattlegroundAV::GetAttackString ( BG_AV_Nodes  node,
TeamId  teamId 
)
private
1449{
1450 uint8 strId = 0;
1451 switch (node)
1452 {
1454 if (teamId == TEAM_ALLIANCE)
1456 else
1458 break;
1460 if (teamId == TEAM_ALLIANCE)
1462 else
1464 break;
1466 if (teamId == TEAM_ALLIANCE)
1468 else
1470 break;
1472 if (teamId == TEAM_ALLIANCE)
1474 else
1476 break;
1478 if (teamId == TEAM_ALLIANCE)
1480 else
1482 break;
1484 if (teamId == TEAM_ALLIANCE)
1486 else
1488 break;
1490 if (teamId == TEAM_ALLIANCE)
1492 else
1494 break;
1496 if (teamId == TEAM_ALLIANCE)
1498 else
1500 break;
1503 break;
1505 if (teamId == TEAM_ALLIANCE)
1507 else
1509 break;
1511 if (teamId == TEAM_ALLIANCE)
1513 else
1515 break;
1517 if (teamId == TEAM_ALLIANCE)
1519 else
1521 break;
1523 if (teamId == TEAM_ALLIANCE)
1525 else
1527 break;
1529 if (teamId == TEAM_ALLIANCE)
1531 else
1533 break;
1535 if (teamId == TEAM_ALLIANCE)
1537 else
1539 break;
1540 default:
1541 break;
1542 }
1543
1544 return strId;
1545}
@ BG_AV_NODES_ICEWING_BUNKER
Definition: BattlegroundAV.h:184
@ BG_AV_NODES_TOWER_POINT
Definition: BattlegroundAV.h:187
@ BG_AV_NODES_FROSTWOLF_GRAVE
Definition: BattlegroundAV.h:180
@ BG_AV_NODES_STORMPIKE_GRAVE
Definition: BattlegroundAV.h:176
@ BG_AV_NODES_STONEHEART_GRAVE
Definition: BattlegroundAV.h:177
@ BG_AV_NODES_ICEBLOOD_TOWER
Definition: BattlegroundAV.h:186
@ BG_AV_NODES_DUNBALDAR_NORTH
Definition: BattlegroundAV.h:183
@ BG_AV_NODES_STONEHEART_BUNKER
Definition: BattlegroundAV.h:185
@ BG_AV_NODES_FROSTWOLF_ETOWER
Definition: BattlegroundAV.h:188
@ BG_AV_NODES_ICEBLOOD_GRAVE
Definition: BattlegroundAV.h:179
@ AV_TEXT_H_HERALD_EAST_FROSTWOLF_TOWER_ATTACK
Definition: BattlegroundAV.h:1682
@ AV_TEXT_A_HERALD_ICEBLOOD_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1709
@ AV_TEXT_A_HERALD_TOWER_POINT_ATTACK
Definition: BattlegroundAV.h:1688
@ AV_TEXT_H_HERALD_ICEBLOOD_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1707
@ AV_TEXT_A_HERALD_FROSTWOLF_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1659
@ AV_TEXT_H_HERALD_DUN_BALDAR_SOUTH_ATTACK
Definition: BattlegroundAV.h:1662
@ AV_TEXT_H_HERALD_TOWER_POINT_ATTACK
Definition: BattlegroundAV.h:1686
@ AV_TEXT_H_HERALD_WEST_FROSTWOLF_TOWER_ATTACK
Definition: BattlegroundAV.h:1678
@ AV_TEXT_A_HERALD_WEST_FROSTWOLF_TOWER_ATTACK
Definition: BattlegroundAV.h:1680
@ AV_TEXT_A_HERALD_ICEWING_BUNKER_ATTACK
Definition: BattlegroundAV.h:1672
@ AV_TEXT_H_HERALD_STONEHEARTH_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1703
@ AV_TEXT_A_HERALD_FROSTWOLF_RELIEF_HUT_ATTACK
Definition: BattlegroundAV.h:1701
@ AV_TEXT_A_HERALD_EAST_FROSTWOLF_TOWER_ATTACK
Definition: BattlegroundAV.h:1684
@ AV_TEXT_H_HERALD_FROSTWOLF_RELIEF_HUT_ATTACK
Definition: BattlegroundAV.h:1699
@ AV_TEXT_A_HERALD_DUN_BALDAR_SOUTH_ATTACK
Definition: BattlegroundAV.h:1664
@ AV_TEXT_A_HERALD_STONEHEARTH_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1705
@ AV_TEXT_A_HERALD_DUN_BALDAR_NORTH_ATTACK
Definition: BattlegroundAV.h:1668
@ AV_TEXT_A_HERALD_ICEBLOOD_TOWER_ATTACK
Definition: BattlegroundAV.h:1692
@ AV_TEXT_H_HERALD_STORMPIKE_AID_STATION_ATTACK
Definition: BattlegroundAV.h:1695
@ AV_TEXT_H_HERALD_DUN_BALDAR_NORTH_ATTACK
Definition: BattlegroundAV.h:1666
@ AV_TEXT_A_HERALD_STORMPIKE_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1651
@ AV_TEXT_A_HERALD_STORMPIKE_AID_STATION_ATTACK
Definition: BattlegroundAV.h:1697
@ AV_TEXT_A_HERALD_SNOWFALL_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1655
@ AV_TEXT_H_HERALD_FROSTWOLF_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1661
@ AV_TEXT_A_HERALD_STONEHEARTH_BUNKER_ATTACK
Definition: BattlegroundAV.h:1676
@ AV_TEXT_H_HERALD_SNOWFALL_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1657
@ AV_TEXT_H_HERALD_STORMPIKE_GRAVEYARD_ATTACK
Definition: BattlegroundAV.h:1653
@ AV_TEXT_H_HERALD_STONEHEARTH_BUNKER_ATTACK
Definition: BattlegroundAV.h:1674
@ AV_TEXT_H_HERALD_ICEWING_BUNKER_ATTACK
Definition: BattlegroundAV.h:1670

References AV_TEXT_A_HERALD_DUN_BALDAR_NORTH_ATTACK, AV_TEXT_A_HERALD_DUN_BALDAR_SOUTH_ATTACK, AV_TEXT_A_HERALD_EAST_FROSTWOLF_TOWER_ATTACK, AV_TEXT_A_HERALD_FROSTWOLF_GRAVEYARD_ATTACK, AV_TEXT_A_HERALD_FROSTWOLF_RELIEF_HUT_ATTACK, AV_TEXT_A_HERALD_ICEBLOOD_GRAVEYARD_ATTACK, AV_TEXT_A_HERALD_ICEBLOOD_TOWER_ATTACK, AV_TEXT_A_HERALD_ICEWING_BUNKER_ATTACK, AV_TEXT_A_HERALD_SNOWFALL_GRAVEYARD_ATTACK, AV_TEXT_A_HERALD_STONEHEARTH_BUNKER_ATTACK, AV_TEXT_A_HERALD_STONEHEARTH_GRAVEYARD_ATTACK, AV_TEXT_A_HERALD_STORMPIKE_AID_STATION_ATTACK, AV_TEXT_A_HERALD_STORMPIKE_GRAVEYARD_ATTACK, AV_TEXT_A_HERALD_TOWER_POINT_ATTACK, AV_TEXT_A_HERALD_WEST_FROSTWOLF_TOWER_ATTACK, AV_TEXT_H_HERALD_DUN_BALDAR_NORTH_ATTACK, AV_TEXT_H_HERALD_DUN_BALDAR_SOUTH_ATTACK, AV_TEXT_H_HERALD_EAST_FROSTWOLF_TOWER_ATTACK, AV_TEXT_H_HERALD_FROSTWOLF_GRAVEYARD_ATTACK, AV_TEXT_H_HERALD_FROSTWOLF_RELIEF_HUT_ATTACK, AV_TEXT_H_HERALD_ICEBLOOD_GRAVEYARD_ATTACK, AV_TEXT_H_HERALD_ICEWING_BUNKER_ATTACK, AV_TEXT_H_HERALD_SNOWFALL_GRAVEYARD_ATTACK, AV_TEXT_H_HERALD_STONEHEARTH_BUNKER_ATTACK, AV_TEXT_H_HERALD_STONEHEARTH_GRAVEYARD_ATTACK, AV_TEXT_H_HERALD_STORMPIKE_AID_STATION_ATTACK, AV_TEXT_H_HERALD_STORMPIKE_GRAVEYARD_ATTACK, AV_TEXT_H_HERALD_TOWER_POINT_ATTACK, AV_TEXT_H_HERALD_WEST_FROSTWOLF_TOWER_ATTACK, BG_AV_NODES_DUNBALDAR_NORTH, BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_FIRSTAID_STATION, BG_AV_NODES_FROSTWOLF_ETOWER, BG_AV_NODES_FROSTWOLF_GRAVE, BG_AV_NODES_FROSTWOLF_HUT, BG_AV_NODES_FROSTWOLF_WTOWER, BG_AV_NODES_ICEBLOOD_GRAVE, BG_AV_NODES_ICEBLOOD_TOWER, BG_AV_NODES_ICEWING_BUNKER, BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_NODES_STONEHEART_BUNKER, BG_AV_NODES_STONEHEART_GRAVE, BG_AV_NODES_STORMPIKE_GRAVE, BG_AV_NODES_TOWER_POINT, and TEAM_ALLIANCE.

Referenced by EventPlayerAssaultsPoint().

◆ GetClosestGraveyard()

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

Reimplemented from Battleground.

1179{
1180 GraveyardStruct const* entry = nullptr;
1181 float dist = 0;
1182 float minDist = 0;
1183 float x, y;
1184
1185 player->GetPosition(x, y);
1186
1187 GraveyardStruct const* pGraveyard = sGraveyard->GetGraveyard(BG_AV_GraveyardIds[player->GetTeamId() + 7]);
1188 minDist = (pGraveyard->x - x) * (pGraveyard->x - x) + (pGraveyard->y - y) * (pGraveyard->y - y);
1189
1191 if (m_Nodes[i].OwnerId == player->GetTeamId() && m_Nodes[i].State == POINT_CONTROLED)
1192 {
1193 entry = sGraveyard->GetGraveyard(BG_AV_GraveyardIds[i]);
1194 if (entry)
1195 {
1196 dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y);
1197 if (dist < minDist)
1198 {
1199 minDist = dist;
1200 pGraveyard = entry;
1201 }
1202 }
1203 }
1204 return pGraveyard;
1205}
#define sGraveyard
Definition: GameGraveyard.h:74
const uint32 BG_AV_GraveyardIds[9]
Definition: BattlegroundAV.h:1430
void GetPosition(float &x, float &y) const
Definition: Position.h:121
Definition: GameGraveyard.h:27
float x
Definition: GameGraveyard.h:30
float y
Definition: GameGraveyard.h:31

References BG_AV_GraveyardIds, BG_AV_NODES_FIRSTAID_STATION, BG_AV_NODES_FROSTWOLF_HUT, Position::GetPosition(), Player::GetTeamId(), m_Nodes, POINT_CONTROLED, sGraveyard, BG_AV_NodeInfo::State, GraveyardStruct::x, and GraveyardStruct::y.

◆ GetDefendString()

uint8 BattlegroundAV::GetDefendString ( BG_AV_Nodes  node,
TeamId  teamId 
)
private
1548{
1549 uint8 strId = 0;
1550 switch (node)
1551 {
1553 if (teamId == TEAM_ALLIANCE)
1555 else
1557 break;
1559 if (teamId == TEAM_ALLIANCE)
1561 else
1563 break;
1565 if (teamId == TEAM_ALLIANCE)
1567 else
1569 break;
1571 if (teamId == TEAM_ALLIANCE)
1573 else
1575 break;
1577 if (teamId == TEAM_ALLIANCE)
1579 else
1581 break;
1583 if (teamId == TEAM_ALLIANCE)
1585 else
1587 break;
1589 if (teamId == TEAM_ALLIANCE)
1591 else
1593 break;
1595 if (teamId == TEAM_ALLIANCE)
1597 else
1599 break;
1602 break;
1604 if (teamId == TEAM_ALLIANCE)
1606 else
1608 break;
1610 if (teamId == TEAM_ALLIANCE)
1612 else
1614 break;
1616 if (teamId == TEAM_ALLIANCE)
1618 else
1620 break;
1622 if (teamId == TEAM_ALLIANCE)
1624 else
1626 break;
1628 if (teamId == TEAM_ALLIANCE)
1630 else
1632 break;
1634 if (teamId == TEAM_ALLIANCE)
1636 else
1638 break;
1639 default:
1640 break;
1641 }
1642
1643 return strId;
1644}
@ AV_TEXT_H_HERALD_TOWER_POINT_TAKEN
Definition: BattlegroundAV.h:1687
@ AV_TEXT_A_HERALD_WEST_FROSTWOLF_TOWER_TAKEN
Definition: BattlegroundAV.h:1681
@ AV_TEXT_A_HERALD_ICEBLOOD_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1708
@ AV_TEXT_H_HERALD_STORMPIKE_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1652
@ AV_TEXT_H_HERALD_SNOWFALL_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1656
@ AV_TEXT_H_HERALD_ICEWING_BUNKER_TAKEN
Definition: BattlegroundAV.h:1671
@ AV_TEXT_H_HERALD_STONEHEARTH_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1702
@ AV_TEXT_H_HERALD_DUN_BALDAR_NORTH_TAKEN
Definition: BattlegroundAV.h:1667
@ AV_TEXT_A_HERALD_ICEBLOOD_TOWER_TAKEN
Definition: BattlegroundAV.h:1693
@ AV_TEXT_H_HERALD_STONEHEARTH_BUNKER_TAKEN
Definition: BattlegroundAV.h:1675
@ AV_TEXT_A_HERALD_TOWER_POINT_TAKEN
Definition: BattlegroundAV.h:1689
@ AV_TEXT_H_HERALD_EAST_FROSTWOLF_TOWER_TAKEN
Definition: BattlegroundAV.h:1683
@ AV_TEXT_H_HERALD_STORMPIKE_AID_STATION_TAKEN
Definition: BattlegroundAV.h:1694
@ AV_TEXT_H_HERALD_FROSTWOLF_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1660
@ AV_TEXT_A_HERALD_STONEHEARTH_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1704
@ AV_TEXT_A_HERALD_SNOWFALL_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1654
@ AV_TEXT_A_HERALD_ICEWING_BUNKER_TAKEN
Definition: BattlegroundAV.h:1673
@ AV_TEXT_A_HERALD_DUN_BALDAR_SOUTH_TAKEN
Definition: BattlegroundAV.h:1665
@ AV_TEXT_H_HERALD_ICEBLOOD_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1706
@ AV_TEXT_A_HERALD_FROSTWOLF_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1658
@ AV_TEXT_H_HERALD_FROSTWOLF_RELIEF_HUT_TAKEN
Definition: BattlegroundAV.h:1698
@ AV_TEXT_A_HERALD_DUN_BALDAR_NORTH_TAKEN
Definition: BattlegroundAV.h:1669
@ AV_TEXT_A_HERALD_STORMPIKE_GRAVEYARD_TAKEN
Definition: BattlegroundAV.h:1650
@ AV_TEXT_A_HERALD_EAST_FROSTWOLF_TOWER_TAKEN
Definition: BattlegroundAV.h:1685
@ AV_TEXT_H_HERALD_WEST_FROSTWOLF_TOWER_TAKEN
Definition: BattlegroundAV.h:1679
@ AV_TEXT_A_HERALD_FROSTWOLF_RELIEF_HUT_TAKEN
Definition: BattlegroundAV.h:1700
@ AV_TEXT_A_HERALD_STONEHEARTH_BUNKER_TAKEN
Definition: BattlegroundAV.h:1677
@ AV_TEXT_H_HERALD_DUN_BALDAR_SOUTH_TAKEN
Definition: BattlegroundAV.h:1663
@ AV_TEXT_A_HERALD_STORMPIKE_AID_STATION_TAKEN
Definition: BattlegroundAV.h:1696

References AV_TEXT_A_HERALD_DUN_BALDAR_NORTH_TAKEN, AV_TEXT_A_HERALD_DUN_BALDAR_SOUTH_TAKEN, AV_TEXT_A_HERALD_EAST_FROSTWOLF_TOWER_TAKEN, AV_TEXT_A_HERALD_FROSTWOLF_GRAVEYARD_TAKEN, AV_TEXT_A_HERALD_FROSTWOLF_RELIEF_HUT_TAKEN, AV_TEXT_A_HERALD_ICEBLOOD_GRAVEYARD_TAKEN, AV_TEXT_A_HERALD_ICEBLOOD_TOWER_TAKEN, AV_TEXT_A_HERALD_ICEWING_BUNKER_TAKEN, AV_TEXT_A_HERALD_SNOWFALL_GRAVEYARD_TAKEN, AV_TEXT_A_HERALD_STONEHEARTH_BUNKER_TAKEN, AV_TEXT_A_HERALD_STONEHEARTH_GRAVEYARD_TAKEN, AV_TEXT_A_HERALD_STORMPIKE_AID_STATION_TAKEN, AV_TEXT_A_HERALD_STORMPIKE_GRAVEYARD_TAKEN, AV_TEXT_A_HERALD_TOWER_POINT_TAKEN, AV_TEXT_A_HERALD_WEST_FROSTWOLF_TOWER_TAKEN, AV_TEXT_H_HERALD_DUN_BALDAR_NORTH_TAKEN, AV_TEXT_H_HERALD_DUN_BALDAR_SOUTH_TAKEN, AV_TEXT_H_HERALD_EAST_FROSTWOLF_TOWER_TAKEN, AV_TEXT_H_HERALD_FROSTWOLF_GRAVEYARD_TAKEN, AV_TEXT_H_HERALD_FROSTWOLF_RELIEF_HUT_TAKEN, AV_TEXT_H_HERALD_ICEBLOOD_GRAVEYARD_TAKEN, AV_TEXT_H_HERALD_ICEWING_BUNKER_TAKEN, AV_TEXT_H_HERALD_SNOWFALL_GRAVEYARD_TAKEN, AV_TEXT_H_HERALD_STONEHEARTH_BUNKER_TAKEN, AV_TEXT_H_HERALD_STONEHEARTH_GRAVEYARD_TAKEN, AV_TEXT_H_HERALD_STORMPIKE_AID_STATION_TAKEN, AV_TEXT_H_HERALD_STORMPIKE_GRAVEYARD_TAKEN, AV_TEXT_H_HERALD_TOWER_POINT_TAKEN, AV_TEXT_H_HERALD_WEST_FROSTWOLF_TOWER_TAKEN, BG_AV_NODES_DUNBALDAR_NORTH, BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_FIRSTAID_STATION, BG_AV_NODES_FROSTWOLF_ETOWER, BG_AV_NODES_FROSTWOLF_GRAVE, BG_AV_NODES_FROSTWOLF_HUT, BG_AV_NODES_FROSTWOLF_WTOWER, BG_AV_NODES_ICEBLOOD_GRAVE, BG_AV_NODES_ICEBLOOD_TOWER, BG_AV_NODES_ICEWING_BUNKER, BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_NODES_STONEHEART_BUNKER, BG_AV_NODES_STONEHEART_GRAVE, BG_AV_NODES_STORMPIKE_GRAVE, BG_AV_NODES_TOWER_POINT, and TEAM_ALLIANCE.

Referenced by EventPlayerDefendsPoint(), and EventPlayerDestroyedPoint().

◆ GetMineString()

uint8 BattlegroundAV::GetMineString ( uint8  mine,
TeamId  teamId 
)
private
1647{
1648 uint8 strId = 0;
1649 switch (mineId)
1650 {
1651 case AV_NORTH_MINE:
1652 if (teamId == TEAM_ALLIANCE)
1654 else
1656 break;
1657 case AV_SOUTH_MINE:
1658 if (teamId == TEAM_ALLIANCE)
1660 else
1662 break;
1663 default:
1664 break;
1665 }
1666
1667 return strId;
1668}
@ AV_TEXT_H_HERALD_COLDTOOTH_MINE_TAKEN
Definition: BattlegroundAV.h:1712
@ AV_TEXT_H_HERALD_IRONDEEP_MINE_TAKEN
Definition: BattlegroundAV.h:1713
@ AV_TEXT_A_HERALD_COLDTOOTH_MINE_TAKEN
Definition: BattlegroundAV.h:1710
@ AV_TEXT_A_HERALD_IRONDEEP_MINE_TAKEN
Definition: BattlegroundAV.h:1711

References AV_NORTH_MINE, AV_SOUTH_MINE, AV_TEXT_A_HERALD_COLDTOOTH_MINE_TAKEN, AV_TEXT_A_HERALD_IRONDEEP_MINE_TAKEN, AV_TEXT_H_HERALD_COLDTOOTH_MINE_TAKEN, AV_TEXT_H_HERALD_IRONDEEP_MINE_TAKEN, and TEAM_ALLIANCE.

Referenced by ChangeMineOwner().

◆ GetNodeThroughObject()

BG_AV_Nodes BattlegroundAV::GetNodeThroughObject ( uint32  object)
private
825{
826 LOG_DEBUG("bg.battleground", "bg_AV getnodethroughobject {}", object);
828 return BG_AV_Nodes(object);
830 return BG_AV_Nodes(object - 11);
832 return BG_AV_Nodes(object - 7);
834 return BG_AV_Nodes(object - 22);
836 return BG_AV_Nodes(object - 33);
838 return BG_AV_Nodes(object - 29);
841 LOG_ERROR("bg.battleground", "BattlegroundAV: ERROR! GetPlace got a wrong object :(");
842 ABORT();
843 return BG_AV_Nodes(0);
844}
@ BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT
Definition: BattlegroundAV.h:238
@ BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER
Definition: BattlegroundAV.h:242
@ BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT
Definition: BattlegroundAV.h:214
@ BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER
Definition: BattlegroundAV.h:230
@ BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER
Definition: BattlegroundAV.h:206
@ BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER
Definition: BattlegroundAV.h:218

References ABORT, BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER, BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT, BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_WTOWER, BG_AV_OBJECT_FLAG_C_H_STONEHEART_BUNKER, BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT, BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER, BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, LOG_DEBUG, and LOG_ERROR.

Referenced by EventPlayerAssaultsPoint(), EventPlayerDefendsPoint(), and SetupBattleground().

◆ GetObjectThroughNode()

uint32 BattlegroundAV::GetObjectThroughNode ( BG_AV_Nodes  node)
private
847{
848 //this function is the counterpart to GetNodeThroughObject()
849 LOG_DEBUG("bg.battleground", "bg_AV GetObjectThroughNode {}", node);
850 if (m_Nodes[node].OwnerId == TEAM_ALLIANCE)
851 {
852 if (m_Nodes[node].State == POINT_ASSAULTED)
853 {
854 if (node <= BG_AV_NODES_FROSTWOLF_HUT)
855 return node + 11;
857 return node + 7;
858 }
859 else if (m_Nodes[node].State == POINT_CONTROLED)
861 return node;
862 }
863 else if (m_Nodes[node].OwnerId == TEAM_HORDE)
864 {
865 if (m_Nodes[node].State == POINT_ASSAULTED)
866 {
868 return node + 22;
869 }
870 else if (m_Nodes[node].State == POINT_CONTROLED)
871 {
872 if (node <= BG_AV_NODES_FROSTWOLF_HUT)
873 return node + 33;
875 return node + 29;
876 }
877 }
878 else if (m_Nodes[node].OwnerId == TEAM_NEUTRAL)
880 LOG_ERROR("bg.battleground", "BattlegroundAV: Error! GetPlaceNode couldn't resolve node {}", node);
881 ABORT();
882 return 0;
883}

References ABORT, BG_AV_NODES_FROSTWOLF_HUT, BG_AV_NODES_FROSTWOLF_WTOWER, BG_AV_NODES_ICEBLOOD_TOWER, BG_AV_NODES_STONEHEART_BUNKER, BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, LOG_DEBUG, LOG_ERROR, m_Nodes, POINT_ASSAULTED, POINT_CONTROLED, TEAM_ALLIANCE, TEAM_HORDE, and TEAM_NEUTRAL.

Referenced by EventPlayerDestroyedPoint().

◆ GetPrematureWinner()

TeamId BattlegroundAV::GetPrematureWinner ( )
overridevirtual

Reimplemented from Battleground.

1816{
1818 return TEAM_ALLIANCE;
1819
1821}
uint32 GetTeamScore(TeamId teamId) const
Definition: Battleground.cpp:1837
virtual TeamId GetPrematureWinner()
Definition: Battleground.cpp:408

References Battleground::GetPrematureWinner(), Battleground::GetTeamScore(), TEAM_ALLIANCE, and TEAM_HORDE.

◆ GetWorldStateType()

uint8 BattlegroundAV::GetWorldStateType ( uint8  state,
TeamId  teamId 
)
private
1130{
1131 //neutral stuff cant get handled (currently its only snowfall)
1132 ASSERT(teamId != TEAM_NEUTRAL);
1133 //a_c a_a h_c h_a the positions in worldstate-array
1134 if (teamId == TEAM_ALLIANCE)
1135 {
1136 if (state == POINT_CONTROLED || state == POINT_DESTROYED)
1137 return 0;
1138 if (state == POINT_ASSAULTED)
1139 return 1;
1140 }
1141 if (teamId == TEAM_HORDE)
1142 {
1143 if (state == POINT_DESTROYED || state == POINT_CONTROLED)
1144 return 2;
1145 if (state == POINT_ASSAULTED)
1146 return 3;
1147 }
1148 LOG_ERROR("bg.battleground", "BG_AV: should update a strange worldstate state:{} team:{}", state, teamId);
1149 return 5; //this will crash the game, but i want to know if something is wrong here
1150}

References ASSERT, LOG_ERROR, POINT_ASSAULTED, POINT_CONTROLED, POINT_DESTROYED, TEAM_ALLIANCE, TEAM_HORDE, and TEAM_NEUTRAL.

Referenced by FillInitialWorldStates(), and UpdateNodeWorldState().

◆ HandleAreaTrigger()

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

Reimplemented from Battleground.

542{
543 // this is wrong way to implement these things. On official it done by gameobject spell cast.
545 return;
546
547 switch (trigger)
548 {
549 case 95:
550 case 2608:
551 if (player->GetTeamId() != TEAM_ALLIANCE)
552 player->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
553 else
554 player->LeaveBattleground();
555 break;
556 case 2606:
557 if (player->GetTeamId() != TEAM_HORDE)
558 player->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
559 else
560 player->LeaveBattleground();
561 break;
562 case 3326:
563 case 3327:
564 case 3328:
565 case 3329:
566 case 3330:
567 case 3331:
568 //player->Unmount();
569 break;
570 default:
571 break;
572 }
573}
WorldSession * GetSession() const
Definition: Player.h:1980
void LeaveBattleground(Battleground *bg=nullptr)
Definition: Player.cpp:11318
void SendAreaTriggerMessage(const char *Text,...) ATTR_PRINTF(2
Definition: MiscHandler.cpp:692

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

◆ HandleKillPlayer()

void BattlegroundAV::HandleKillPlayer ( Player player,
Player killer 
)
overridevirtual

Reimplemented from Battleground.

67{
69 return;
70
71 Battleground::HandleKillPlayer(player, killer);
72 UpdateScore(player->GetTeamId(), -1);
73}
virtual void HandleKillPlayer(Player *player, Player *killer)
Definition: Battleground.cpp:1719

References Battleground::GetStatus(), Player::GetTeamId(), Battleground::HandleKillPlayer(), STATUS_IN_PROGRESS, and UpdateScore().

◆ HandleKillUnit()

void BattlegroundAV::HandleKillUnit ( Creature unit,
Player killer 
)
overridevirtual

Reimplemented from Battleground.

76{
77 LOG_DEBUG("bg.battleground", "bg_av HandleKillUnit {}", unit->GetEntry());
79 return;
80 uint32 entry = unit->GetEntry();
81 /*
82 uint32 triggerSpawnID = 0;
83 if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN])
84 triggerSpawnID = AV_CPLACE_TRIGGER16;
85 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_BOSS])
86 triggerSpawnID = AV_CPLACE_TRIGGER17;
87 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN])
88 triggerSpawnID = AV_CPLACE_TRIGGER18;
89 else if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_BOSS])
90 triggerSpawnID = AV_CPLACE_TRIGGER19;
91 */
93 {
94 CastSpellOnTeam(23658, TEAM_HORDE); //this is a spell which finishes a quest where a player has to kill the boss
99 }
100 else if (entry == BG_AV_CreatureInfo[AV_NPC_H_BOSS])
101 {
102 CastSpellOnTeam(23658, TEAM_ALLIANCE); //this is a spell which finishes a quest where a player has to kill the boss
107 }
108 else if (entry == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN])
109 {
110 if (!m_CaptainAlive[0])
111 {
112 LOG_ERROR("bg.battleground", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
113 return;
114 }
115 m_CaptainAlive[0] = false;
119 //spawn destroyed aura
120 for (uint8 i = 0; i <= 9; i++)
122 if (Creature* creature = GetBGCreature(AV_CPLACE_HERALD))
123 creature->AI()->Talk(AV_TEXT_HERALD_STORMPIKE_GENERAL_DEAD);
125 }
126 else if (entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN])
127 {
128 if (!m_CaptainAlive[1])
129 {
130 LOG_ERROR("bg.battleground", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
131 return;
132 }
133 m_CaptainAlive[1] = false;
137 //spawn destroyed aura
138 for (uint8 i = 0; i <= 9; i++)
140 if (Creature* creature = GetBGCreature(AV_CPLACE_HERALD))
141 creature->AI()->Talk(AV_TEXT_HERALD_FROSTWOLF_GENERAL_DEAD);
143 }
145 {
149 }
151 {
155 }
156}
#define BG_AV_RES_CAPTAIN
Definition: BattlegroundAV.h:35
#define BG_AV_KILL_BOSS
Definition: BattlegroundAV.h:30
@ BG_AV_OBJECT_BURN_BUILDING_HORDE
Definition: BattlegroundAV.h:314
@ BG_AV_OBJECT_BURN_BUILDING_ALLIANCE
Definition: BattlegroundAV.h:313
@ BG_AV_QUEST_CREDIT_MINE
Definition: BattlegroundAV.h:115
#define BG_AV_REP_BOSS
Definition: BattlegroundAV.h:31
@ AV_TEXT_HERALD_STORMPIKE_GENERAL_DEAD
Definition: BattlegroundAV.h:1715
@ AV_TEXT_HERALD_FROSTWOLF_GENERAL_DEAD
Definition: BattlegroundAV.h:1714
@ AV_NPC_S_MINE_H_4
Definition: BattlegroundAV.h:1169
@ AV_NPC_N_MINE_A_4
Definition: BattlegroundAV.h:1152
@ AV_NPC_N_MINE_N_4
Definition: BattlegroundAV.h:1148
@ AV_NPC_S_MINE_N_4
Definition: BattlegroundAV.h:1160
@ AV_NPC_S_MINE_A_4
Definition: BattlegroundAV.h:1165
@ AV_NPC_N_MINE_H_4
Definition: BattlegroundAV.h:1156
#define BG_AV_KILL_CAPTAIN
Definition: BattlegroundAV.h:33
#define BG_AV_REP_CAPTAIN
Definition: BattlegroundAV.h:34
@ SCORE_MINES_CAPTURED
Definition: BattlegroundScore.h:48
void CastSpellOnTeam(uint32 spellId, TeamId teamId)
Definition: Battleground.cpp:705
void EndBattleground(TeamId winnerTeamId) override
Definition: BattlegroundAV.cpp:493
void ChangeMineOwner(uint8 mine, TeamId teamId, bool initial=false)
Definition: BattlegroundAV.cpp:654

References AV_CPLACE_HERALD, AV_CPLACE_TRIGGER16, AV_CPLACE_TRIGGER17, AV_CPLACE_TRIGGER18, AV_CPLACE_TRIGGER19, AV_NORTH_MINE, AV_NPC_A_BOSS, AV_NPC_A_CAPTAIN, AV_NPC_H_BOSS, AV_NPC_H_CAPTAIN, AV_NPC_N_MINE_A_4, AV_NPC_N_MINE_H_4, AV_NPC_N_MINE_N_4, AV_NPC_S_MINE_A_4, AV_NPC_S_MINE_H_4, AV_NPC_S_MINE_N_4, AV_SOUTH_MINE, AV_TEXT_HERALD_FROSTWOLF_GENERAL_DEAD, AV_TEXT_HERALD_STORMPIKE_GENERAL_DEAD, BG_AV_CreatureInfo, BG_AV_KILL_BOSS, BG_AV_KILL_CAPTAIN, BG_AV_OBJECT_BURN_BUILDING_ALLIANCE, BG_AV_OBJECT_BURN_BUILDING_HORDE, BG_AV_QUEST_CREDIT_MINE, BG_AV_REP_BOSS, BG_AV_REP_CAPTAIN, BG_AV_RES_CAPTAIN, Battleground::CastSpellOnTeam(), ChangeMineOwner(), Battleground::DelCreature(), EndBattleground(), Battleground::GetBGCreature(), Battleground::GetBonusHonorFromKill(), Object::GetEntry(), Battleground::GetStatus(), Player::GetTeamId(), Player::KilledMonsterCredit(), LOG_DEBUG, LOG_ERROR, m_CaptainAlive, RESPAWN_IMMEDIATELY, Battleground::RewardHonorToTeam(), Battleground::RewardReputationToTeam(), SCORE_MINES_CAPTURED, Battleground::SpawnBGObject(), STATUS_IN_PROGRESS, TEAM_ALLIANCE, TEAM_HORDE, UpdatePlayerScore(), and UpdateScore().

◆ HandleQuestComplete()

void BattlegroundAV::HandleQuestComplete ( uint32  questid,
Player player 
)
159{
161 return;//maybe we should log this, cause this must be a cheater or a big bug
162 TeamId teamId = player->GetTeamId();
163 //TODO add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor
164 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed", questid);
165 switch (questid)
166 {
171 m_Team_QuestStatus[teamId][0] += 20;
172 if (m_Team_QuestStatus[teamId][0] == 500 || m_Team_QuestStatus[teamId][0] == 1000 || m_Team_QuestStatus[teamId][0] == 1500) //25, 50, 75 turn ins
173 {
174 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed starting with unit upgrading..", questid);
176 if (m_Nodes[i].OwnerId == player->GetTeamId() && m_Nodes[i].State == POINT_CONTROLED)
177 {
179 PopulateNode(i);
180 //maybe this is bad, because it will instantly respawn all creatures on every grave..
181 }
182 }
183 break;
186 m_Team_QuestStatus[teamId][1]++;
187 RewardReputationToTeam(teamId, 1, teamId);
188 if (m_Team_QuestStatus[teamId][1] == 30)
189 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
190 break;
193 m_Team_QuestStatus[teamId][2]++;
194 RewardReputationToTeam(teamId, 1, teamId);
195 if (m_Team_QuestStatus[teamId][2] == 60)
196 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
197 break;
200 m_Team_QuestStatus[teamId][3]++;
201 RewardReputationToTeam(teamId, 1, teamId);
202 if (m_Team_QuestStatus[teamId][3] == 120)
203 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
204 break;
205 case AV_QUEST_A_BOSS1:
206 case AV_QUEST_H_BOSS1:
207 m_Team_QuestStatus[teamId][4] += 9; //you can turn in 10 or 1 item..
208 [[fallthrough]];
209 case AV_QUEST_A_BOSS2:
210 case AV_QUEST_H_BOSS2:
211 m_Team_QuestStatus[teamId][4]++;
212 if (m_Team_QuestStatus[teamId][4] >= 200)
213 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
214 break;
217 m_Team_QuestStatus[teamId][5]++;
218 if (m_Team_QuestStatus[teamId][5] == 28)
219 {
220 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
221
222 if (m_Team_QuestStatus[teamId][6] == 7)
223 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - ground assault ready", questid);
224 }
225 break;
228 m_Team_QuestStatus[teamId][6]++;
229 if (m_Team_QuestStatus[teamId][6] == 7)
230 {
231 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
232
233 if (m_Team_QuestStatus[teamId][5] == 20)
234 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - ground assault ready", questid);
235 }
236 break;
239 m_Team_QuestStatus[teamId][7]++;
240 if (m_Team_QuestStatus[teamId][7] == 25)
241 {
242 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
243
244 if (m_Team_QuestStatus[teamId][8] == 25)
245 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - rider assault ready", questid);
246 }
247 break;
250 m_Team_QuestStatus[teamId][8]++;
251 if (m_Team_QuestStatus[teamId][8] == 25)
252 {
253 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here", questid);
254
255 if (m_Team_QuestStatus[teamId][7] == 25)
256 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed (need to implement some events here - rider assault ready", questid);
257 }
258 break;
259 default:
260 LOG_DEBUG("bg.battleground", "BG_AV Quest {} completed but is not interesting at all", questid);
261 return; //was no interesting quest at all
262 break;
263 }
264}
@ AV_QUEST_A_COMMANDER3
Definition: BattlegroundAV.h:1624
@ AV_QUEST_H_SCRAPS1
Definition: BattlegroundAV.h:1618
@ AV_QUEST_H_BOSS1
Definition: BattlegroundAV.h:1627
@ AV_QUEST_H_RIDER_TAME
Definition: BattlegroundAV.h:1637
@ AV_QUEST_A_COMMANDER1
Definition: BattlegroundAV.h:1620
@ AV_QUEST_A_RIDER_HIDE
Definition: BattlegroundAV.h:1634
@ AV_QUEST_A_SCRAPS1
Definition: BattlegroundAV.h:1616
@ AV_QUEST_H_COMMANDER1
Definition: BattlegroundAV.h:1621
@ AV_QUEST_A_RIDER_TAME
Definition: BattlegroundAV.h:1636
@ AV_QUEST_H_COMMANDER3
Definition: BattlegroundAV.h:1625
@ AV_QUEST_H_NEAR_MINE
Definition: BattlegroundAV.h:1631
@ AV_QUEST_A_COMMANDER2
Definition: BattlegroundAV.h:1622
@ AV_QUEST_A_OTHER_MINE
Definition: BattlegroundAV.h:1632
@ AV_QUEST_A_NEAR_MINE
Definition: BattlegroundAV.h:1630
@ AV_QUEST_H_OTHER_MINE
Definition: BattlegroundAV.h:1633
@ AV_QUEST_A_SCRAPS2
Definition: BattlegroundAV.h:1617
@ AV_QUEST_H_BOSS2
Definition: BattlegroundAV.h:1629
@ AV_QUEST_A_BOSS1
Definition: BattlegroundAV.h:1626
@ AV_QUEST_H_COMMANDER2
Definition: BattlegroundAV.h:1623
@ AV_QUEST_H_RIDER_HIDE
Definition: BattlegroundAV.h:1635
@ AV_QUEST_A_BOSS2
Definition: BattlegroundAV.h:1628
@ AV_QUEST_H_SCRAPS2
Definition: BattlegroundAV.h:1619

References AV_QUEST_A_BOSS1, AV_QUEST_A_BOSS2, AV_QUEST_A_COMMANDER1, AV_QUEST_A_COMMANDER2, AV_QUEST_A_COMMANDER3, AV_QUEST_A_NEAR_MINE, AV_QUEST_A_OTHER_MINE, AV_QUEST_A_RIDER_HIDE, AV_QUEST_A_RIDER_TAME, AV_QUEST_A_SCRAPS1, AV_QUEST_A_SCRAPS2, AV_QUEST_H_BOSS1, AV_QUEST_H_BOSS2, AV_QUEST_H_COMMANDER1, AV_QUEST_H_COMMANDER2, AV_QUEST_H_COMMANDER3, AV_QUEST_H_NEAR_MINE, AV_QUEST_H_OTHER_MINE, AV_QUEST_H_RIDER_HIDE, AV_QUEST_H_RIDER_TAME, AV_QUEST_H_SCRAPS1, AV_QUEST_H_SCRAPS2, BG_AV_NODES_FIRSTAID_STATION, BG_AV_NODES_FROSTWOLF_HUT, DePopulateNode(), Battleground::GetStatus(), Player::GetTeamId(), LOG_DEBUG, m_Nodes, m_Team_QuestStatus, POINT_CONTROLED, PopulateNode(), Battleground::RewardReputationToTeam(), BG_AV_NodeInfo::State, and STATUS_IN_PROGRESS.

◆ InitNode()

void BattlegroundAV::InitNode ( BG_AV_Nodes  node,
TeamId  teamId,
bool  tower 
)
private

◆ IsAllTowersControlledAndCaptainAlive()

bool BattlegroundAV::IsAllTowersControlledAndCaptainAlive ( TeamId  teamId) const
1772{
1773 if (teamId == TEAM_ALLIANCE)
1774 {
1775 for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers controlled
1776 {
1777 if (m_Nodes[i].State == POINT_CONTROLED)
1778 {
1779 if (m_Nodes[i].OwnerId != TEAM_ALLIANCE)
1780 return false;
1781 }
1782 else
1783 return false;
1784 }
1785
1786 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers destroyed
1787 if (m_Nodes[i].State != POINT_DESTROYED)
1788 return false;
1789
1790 return m_CaptainAlive[0];
1791 }
1792 else if (teamId == TEAM_HORDE)
1793 {
1794 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) // horde towers controlled
1795 {
1796 if (m_Nodes[i].State == POINT_CONTROLED)
1797 {
1798 if (m_Nodes[i].OwnerId != TEAM_HORDE)
1799 return false;
1800 }
1801 else
1802 return false;
1803 }
1804
1805 for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) // alliance towers destroyed
1806 if (m_Nodes[i].State != POINT_DESTROYED)
1807 return false;
1808
1809 return m_CaptainAlive[1];
1810 }
1811
1812 return false;
1813}

References BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_FROSTWOLF_WTOWER, BG_AV_NODES_ICEBLOOD_TOWER, BG_AV_NODES_STONEHEART_BUNKER, m_CaptainAlive, m_Nodes, POINT_CONTROLED, POINT_DESTROYED, TEAM_ALLIANCE, and TEAM_HORDE.

Referenced by achievement_bg_av_perfection::OnCheck().

◆ IsBothMinesControlledByTeam()

bool BattlegroundAV::IsBothMinesControlledByTeam ( TeamId  teamId) const
1763{
1764 for (auto& mine : m_Mine_Owner)
1765 if (mine != teamId)
1766 return false;
1767
1768 return true;
1769}

References m_Mine_Owner.

Referenced by achievement_everything_counts::OnCheck().

◆ IsTower()

bool BattlegroundAV::IsTower ( BG_AV_Nodes  node)
inlineprivate

◆ PlayerCanDoMineQuest()

bool BattlegroundAV::PlayerCanDoMineQuest ( int32  GOId,
TeamId  teamId 
)
740{
741 if (GOId == BG_AV_OBJECTID_MINE_N)
742 return (m_Mine_Owner[AV_NORTH_MINE] == teamId);
743 if (GOId == BG_AV_OBJECTID_MINE_S)
744 return (m_Mine_Owner[AV_SOUTH_MINE] == teamId);
745 return true; //cause it's no mine'object it is ok if this is true
746}
@ BG_AV_OBJECTID_MINE_N
Definition: BattlegroundAV.h:160
@ BG_AV_OBJECTID_MINE_S
Definition: BattlegroundAV.h:161

References AV_NORTH_MINE, AV_SOUTH_MINE, BG_AV_OBJECTID_MINE_N, BG_AV_OBJECTID_MINE_S, and m_Mine_Owner.

◆ PopulateNode()

void BattlegroundAV::PopulateNode ( BG_AV_Nodes  node)
private
749{
750 TeamId ownerId = m_Nodes[node].OwnerId;
751
752 uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
753 uint32 creatureid;
754 if (IsTower(node))
755 creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_TOWERDEFENSE : AV_NPC_H_TOWERDEFENSE;
756 else
757 {
758 if (m_Team_QuestStatus[ownerId][0] < 500)
759 creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0;
760 else if (m_Team_QuestStatus[ownerId][0] < 1000)
761 creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1;
762 else if (m_Team_QuestStatus[ownerId][0] < 1500)
763 creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE2 : AV_NPC_H_GRAVEDEFENSE2;
764 else
765 creatureid = (ownerId == TEAM_ALLIANCE) ? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3;
766 //spiritguide
767 if (BgCreatures[node])
768 DelCreature(node);
769 if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], ownerId))
770 LOG_ERROR("bg.battleground", "AV: couldn't spawn spiritguide at node {}", node);
771 }
772 for (uint8 i = 0; i < 4; i++)
773 AddAVCreature(creatureid, c_place + i);
774
775 if (node >= BG_AV_NODES_MAX)//fail safe
776 return;
777 Creature* trigger = GetBgMap()->GetCreature(BgCreatures[node + 302]);//0-302 other creatures
778 if (!trigger)
779 {
780 trigger = AddCreature(WORLD_TRIGGER,
781 node + 302,
782 BG_AV_CreaturePos[node + 302][0],
783 BG_AV_CreaturePos[node + 302][1],
784 BG_AV_CreaturePos[node + 302][2],
785 BG_AV_CreaturePos[node + 302][3]);
786 }
787
788 //add bonus honor aura trigger creature when node is accupied
789 //cast bonus aura (+50% honor in 25yards)
790 //aura should only apply to players who have accupied the node, set correct faction for trigger
791 if (trigger)
792 {
793 if (ownerId != TEAM_ALLIANCE && ownerId != TEAM_HORDE)//node can be neutral, remove trigger
794 {
795 DelCreature(node + 302);
796 return;
797 }
799 trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
800 }
801}
@ AV_NPC_A_GRAVEDEFENSE1
Definition: BattlegroundAV.h:1122
@ AV_NPC_H_GRAVEDEFENSE2
Definition: BattlegroundAV.h:1131
@ AV_NPC_H_GRAVEDEFENSE1
Definition: BattlegroundAV.h:1130
@ AV_NPC_A_GRAVEDEFENSE2
Definition: BattlegroundAV.h:1123
@ 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:1631
BattlegroundMap * GetBgMap() const
Definition: Battleground.h:449
void SetFaction(uint32 faction)
Definition: Unit.cpp:10047
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:1167
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3316

References AddAVCreature(), Battleground::AddCreature(), Battleground::AddSpiritGuide(), AV_CPLACE_DEFENSE_STORM_AID, AV_NPC_A_GRAVEDEFENSE0, AV_NPC_A_GRAVEDEFENSE1, AV_NPC_A_GRAVEDEFENSE2, AV_NPC_A_GRAVEDEFENSE3, AV_NPC_A_TOWERDEFENSE, AV_NPC_H_GRAVEDEFENSE0, AV_NPC_H_GRAVEDEFENSE1, AV_NPC_H_GRAVEDEFENSE2, AV_NPC_H_GRAVEDEFENSE3, AV_NPC_H_TOWERDEFENSE, BG_AV_CreaturePos, BG_AV_NODES_MAX, Battleground::BgCreatures, Unit::CastSpell(), Battleground::DelCreature(), FACTION_ALLIANCE_GENERIC, FACTION_HORDE_GENERIC, Battleground::GetBgMap(), Map::GetCreature(), IsTower(), LOG_ERROR, m_Nodes, m_Team_QuestStatus, BG_AV_NodeInfo::OwnerId, Unit::SetFaction(), SPELL_HONORABLE_DEFENDER_25Y, TEAM_ALLIANCE, TEAM_HORDE, and WORLD_TRIGGER.

Referenced by EventPlayerDefendsPoint(), EventPlayerDestroyedPoint(), HandleQuestComplete(), and SetupBattleground().

◆ PostUpdateImpl()

void BattlegroundAV::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.

388{
390 {
391 for (uint8 i = 0; i <= 1; i++) //0=alliance, 1=horde
392 {
393 if (!m_CaptainAlive[i])
394 {
395 continue;
396 }
397 if (m_CaptainBuffTimer[i] > diff)
398 {
399 m_CaptainBuffTimer[i] -= diff;
400 }
401 else
402 {
403 if (i == 0)
404 {
406 Creature* creature = GetBGCreature(AV_CPLACE_MAX + 61);
407 if (creature)
408 {
409 std::string creatureText = sCreatureTextMgr->GetLocalizedChatString(creature->GetEntry(), creature->getGender(), 0, 0, DEFAULT_LOCALE);
410 YellToAll(creature, creatureText.c_str(), LANG_COMMON);
411 }
412 }
413 else
414 {
416 Creature* creature = GetBGCreature(AV_CPLACE_MAX + 59); //TODO: make the captains a dynamic creature
417 if (creature)
418 {
419 std::string creatureText = sCreatureTextMgr->GetLocalizedChatString(creature->GetEntry(), creature->getGender(), 2, 0, DEFAULT_LOCALE);
420 YellToAll(creature, creatureText.c_str(), LANG_ORCISH);
421 }
422 }
423 m_CaptainBuffTimer[i] = 120000 + urand(0, 4) * 60000; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
424 }
425 }
426 //add points from mine owning, and look if he neutral team wanrts to reclaim the mine
427 m_Mine_Timer -= diff;
428 for (uint8 mine = 0; mine < 2; mine++)
429 {
430 if (m_Mine_Owner[mine] == TEAM_ALLIANCE || m_Mine_Owner[mine] == TEAM_HORDE)
431 {
432 if (m_Mine_Timer <= 0)
433 UpdateScore(m_Mine_Owner[mine], 1);
434
435 if (m_Mine_Reclaim_Timer[mine] > diff)
436 m_Mine_Reclaim_Timer[mine] -= diff;
437 else //we don't need to set this timer to 0 cause this codepart wont get called when this thing is 0
438 {
440 }
441 }
442 }
443 if (m_Mine_Timer <= 0)
444 m_Mine_Timer = AV_MINE_TICK_TIMER; //this is at the end, cause we need to update both mines
445
446 //looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
448 if (m_Nodes[i].State == POINT_ASSAULTED) //maybe remove this
449 {
450 if (m_Nodes[i].Timer > diff)
451 m_Nodes[i].Timer -= diff;
452 else
454 }
455 }
456}
Timer
Definition: boss_grizzle.cpp:30
@ AV_BUFF_H_CAPTAIN
Definition: BattlegroundAV.h:1448
@ AV_BUFF_A_CAPTAIN
Definition: BattlegroundAV.h:1447
@ AV_MINE_TICK_TIMER
Definition: BattlegroundAV.h:113
@ LANG_COMMON
Definition: SharedDefines.h:740
@ LANG_ORCISH
Definition: SharedDefines.h:736
void EventPlayerDestroyedPoint(BG_AV_Nodes node)
Definition: BattlegroundAV.cpp:601
uint8 getGender() const
Definition: Unit.h:805

References AV_BUFF_A_CAPTAIN, AV_BUFF_H_CAPTAIN, AV_CPLACE_MAX, AV_MINE_TICK_TIMER, BG_AV_NODES_FIRSTAID_STATION, BG_AV_NODES_MAX, Battleground::CastSpellOnTeam(), ChangeMineOwner(), DEFAULT_LOCALE, EventPlayerDestroyedPoint(), Battleground::GetBGCreature(), Object::GetEntry(), Unit::getGender(), Battleground::GetStatus(), LANG_COMMON, LANG_ORCISH, m_CaptainAlive, m_CaptainBuffTimer, m_Mine_Owner, m_Mine_Reclaim_Timer, m_Mine_Timer, m_Nodes, POINT_ASSAULTED, sCreatureTextMgr, STATUS_IN_PROGRESS, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, BG_AV_NodeInfo::Timer, UpdateScore(), urand(), and Battleground::YellToAll().

◆ RemovePlayer()

void BattlegroundAV::RemovePlayer ( Player player)
overridevirtual

Reimplemented from Battleground.

534{
535 //TODO search more buffs
539}
@ AV_BUFF_ARMOR
Definition: BattlegroundAV.h:1446
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4909

References AV_BUFF_A_CAPTAIN, AV_BUFF_ARMOR, AV_BUFF_H_CAPTAIN, and Unit::RemoveAurasDueToSpell().

◆ ResetBGSubclass()

void BattlegroundAV::ResetBGSubclass ( )
overridevirtual

Reimplemented from Battleground.

1735{
1736 for (uint8 i = 0; i < 2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south
1737 {
1738 for (uint8 j = 0; j < 9; j++)
1739 m_Team_QuestStatus[i][j] = 0;
1741 m_IsInformedNearVictory[i] = false;
1742 m_CaptainAlive[i] = true;
1743 m_CaptainBuffTimer[i] = 120000 + urand(0, 4) * 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
1745 }
1746 for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves
1747 InitNode(i, TEAM_ALLIANCE, false);
1748 for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers
1749 InitNode(i, TEAM_ALLIANCE, true);
1750 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_GRAVE; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) //horde graves
1751 InitNode(i, TEAM_HORDE, false);
1752 for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) //horde towers
1753 InitNode(i, TEAM_HORDE, true);
1754 InitNode(BG_AV_NODES_SNOWFALL_GRAVE, TEAM_NEUTRAL, false); //give snowfall neutral owner
1755
1757 for (uint16 i = 0; i < static_cast<uint16>(AV_CPLACE_MAX) + AV_STATICCPLACE_MAX; i++)
1758 if (BgCreatures[i])
1759 DelCreature(i);
1760}
#define BG_AV_SCORE_INITIAL_POINTS
Definition: BattlegroundAV.h:27

References AV_CPLACE_MAX, AV_MINE_TICK_TIMER, AV_STATICCPLACE_MAX, BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_FIRSTAID_STATION, BG_AV_NODES_FROSTWOLF_HUT, BG_AV_NODES_FROSTWOLF_WTOWER, BG_AV_NODES_ICEBLOOD_GRAVE, BG_AV_NODES_ICEBLOOD_TOWER, BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_NODES_STONEHEART_BUNKER, BG_AV_NODES_STONEHEART_GRAVE, BG_AV_SCORE_INITIAL_POINTS, Battleground::BgCreatures, Battleground::DelCreature(), InitNode(), m_CaptainAlive, m_CaptainBuffTimer, m_IsInformedNearVictory, m_Mine_Owner, m_Mine_Timer, m_Team_QuestStatus, m_Team_Scores, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, and urand().

◆ SendMineWorldStates()

void BattlegroundAV::SendMineWorldStates ( uint32  mine)
private
1162{
1163 ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
1164
1165 uint8 owner = 1;
1166
1167 if (m_Mine_Owner[mine] == TEAM_ALLIANCE)
1168 owner = 0;
1169 else if (m_Mine_Owner[mine] == TEAM_HORDE)
1170 owner = 2;
1171
1172 for (uint8 i = 0; i < 3; ++i)
1173 UpdateWorldState(BG_AV_MineWorldStates[mine][i], 0); // Xinef: Clear data for consistency and buglessness
1174
1175 UpdateWorldState(BG_AV_MineWorldStates[mine][owner], 1);
1176}
const uint32 BG_AV_MineWorldStates[2][3]
Definition: BattlegroundAV.h:1573
void UpdateWorldState(uint32 variable, uint32 value)
Definition: Battleground.cpp:779

References ASSERT, AV_NORTH_MINE, AV_SOUTH_MINE, BG_AV_MineWorldStates, m_Mine_Owner, TEAM_ALLIANCE, TEAM_HORDE, and Battleground::UpdateWorldState().

Referenced by ChangeMineOwner(), and FillInitialWorldStates().

◆ SetupBattleground()

bool BattlegroundAV::SetupBattleground ( )
overridevirtual

Reimplemented from Battleground.

1208{
1209 // Create starting objects
1210
1211 //spawn node-objects
1213 {
1215 {
1216 if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1217 || !AddObject(i + 11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1218 || !AddObject(i + 33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1219 || !AddObject(i + 22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1220 //aura
1224 {
1225 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!2");
1226 return false;
1227 }
1228 }
1229 else //towers
1230 {
1231 if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers
1232 {
1233 if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1234 || !AddObject(i + 22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1235 || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1236 || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1239 {
1240 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!3");
1241 return false;
1242 }
1243 }
1244 else //horde towers
1245 {
1246 if (!AddObject(i + 7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1247 || !AddObject(i + 29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
1248 || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1249 || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, std::sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
1252 {
1253 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!4");
1254 return false;
1255 }
1256 }
1257 for (uint8 j = 0; j <= 9; j++) //burning aura
1258 {
1260 {
1261 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!5.{}", i);
1262 return false;
1263 }
1264 }
1265 }
1266 }
1267 for (uint8 i = 0; i < 2; i++) //burning aura for buildings
1268 {
1269 for (uint8 j = 0; j <= 9; j++)
1270 {
1271 if (j < 5)
1272 {
1274 {
1275 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!6.{}", i);
1276 return false;
1277 }
1278 }
1279 else
1280 {
1282 {
1283 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!7.{}", i);
1284 return false;
1285 }
1286 }
1287 }
1288 }
1290 {
1292 {
1293 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.{}", i);
1294 return false;
1295 }
1296 }
1298 {
1300 {
1301 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.{}", i);
1302 return false;
1303 }
1304 }
1305
1307 {
1308 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
1309 return false;
1310 }
1311 for (uint8 i = 0; i < 4; i++)
1312 {
1317 {
1318 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!9.{}", i);
1319 return false;
1320 }
1321 }
1322
1323 // Handpacked snowdrift, only during holiday
1326 {
1328 return false;
1329 }
1330
1331 // Generic gameobjects
1333 {
1335 std::get<0>(BG_AV_GenericObjectPos[i]),
1336 std::get<1>(BG_AV_GenericObjectPos[i]).GetPositionX(),
1337 std::get<1>(BG_AV_GenericObjectPos[i]).GetPositionY(),
1338 std::get<1>(BG_AV_GenericObjectPos[i]).GetPositionZ(),
1339 std::get<1>(BG_AV_GenericObjectPos[i]).GetOrientation(),
1340 std::get<2>(BG_AV_GenericObjectPos[i])[0],
1341 std::get<2>(BG_AV_GenericObjectPos[i])[1],
1342 std::get<2>(BG_AV_GenericObjectPos[i])[2],
1343 std::get<2>(BG_AV_GenericObjectPos[i])[3],
1345 {
1346 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!10.{}", i);
1347 return false;
1348 }
1349 }
1350
1351 // Quest banners
1353 {
1354 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
1355 return false;
1356 }
1358 {
1359 LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
1360 return false;
1361 }
1362
1363 uint16 i;
1364 LOG_DEBUG("bg.battleground", "Alterac Valley: entering state STATUS_WAIT_JOIN ...");
1365 // Initial Nodes
1366 for (i = 0; i < BG_AV_OBJECT_MAX; i++)
1368
1370 {
1373 }
1374
1377
1379 {
1383 }
1384
1386 {
1388 SpawnBGObject(i + 16, RESPAWN_IMMEDIATELY); //aura
1389 }
1390
1392 {
1394 SpawnBGObject(i + 16, RESPAWN_IMMEDIATELY); //aura
1395 }
1396
1397 //snowfall and the doors
1400
1401 // Handpacked snowdrift, only during holiday
1405
1406 // Generic gameobjects
1409
1410 // Quest banners
1413
1414 //creatures
1415 LOG_DEBUG("bg.battleground", "BG_AV start poputlating nodes");
1417 {
1418 if (m_Nodes[i].OwnerId != TEAM_NEUTRAL)
1420 }
1421 //all creatures which don't get despawned through the script are static
1422 LOG_DEBUG("bg.battleground", "BG_AV: start spawning static creatures");
1423 for (i = 0; i < AV_STATICCPLACE_MAX; i++)
1425 //mainspiritguides:
1426 LOG_DEBUG("bg.battleground", "BG_AV: start spawning spiritguides creatures");
1429 //spawn the marshals (those who get deleted, if a tower gets destroyed)
1430 LOG_DEBUG("bg.battleground", "BG_AV: start spawning marshal creatures");
1434
1435 if (
1436 // alliance gates
1438 // horde gates
1440 {
1441 LOG_ERROR("sql.sql", "BatteGroundAV: Failed to spawn some object Battleground not created!1");
1442 return false;
1443 }
1444
1445 return true;
1446}
const float BG_AV_DoorPositons[2][4]
Definition: BattlegroundAV.h:661
@ BG_AV_OBJECTID_FROSTWOLF_BANNER
Definition: BattlegroundAV.h:169
@ BG_AV_OBJECTID_SMOKE
Definition: BattlegroundAV.h:164
@ BG_AV_OBJECTID_SNOWFALL_CANDY_A
Definition: BattlegroundAV.h:137
@ BG_AV_OBJECTID_SNOWFALL_CANDY_PH
Definition: BattlegroundAV.h:140
@ BG_AV_OBJECTID_FIRE
Definition: BattlegroundAV.h:163
@ BG_AV_OBJECTID_TOWER_BANNER_PA
Definition: BattlegroundAV.h:145
@ BG_AV_OBJECTID_TOWER_BANNER_H
Definition: BattlegroundAV.h:144
@ BG_AV_OBJECTID_SNOWFALL_CANDY_H
Definition: BattlegroundAV.h:139
@ BG_AV_OBJECTID_SNOWFALL_CANDY_PA
Definition: BattlegroundAV.h:138
@ BG_AV_OBJECTID_GATE_H
Definition: BattlegroundAV.h:157
@ BG_AV_OBJECTID_TOWER_BANNER_PH
Definition: BattlegroundAV.h:146
@ BG_AV_OBJECTID_STORMPIKE_BANNER
Definition: BattlegroundAV.h:170
@ BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT
Definition: BattlegroundAV.h:167
@ BG_AV_OBJECTID_AURA_N
Definition: BattlegroundAV.h:151
@ BG_AV_OBJECTID_AURA_A
Definition: BattlegroundAV.h:149
@ BG_AV_OBJECTID_AURA_H
Definition: BattlegroundAV.h:150
@ BG_AV_OBJECTID_TOWER_BANNER_A
Definition: BattlegroundAV.h:143
@ BG_AV_OBJECTID_GATE_A
Definition: BattlegroundAV.h:156
std::tuple< uint32, Position, std::array< float, 4 > > const BG_AV_GenericObjectPos[BG_AV_OBJECT_GENERIC_MAX - BG_AV_OBJECT_GENERIC_MIN+1]
Definition: BattlegroundAV.h:571
const float BG_AV_ObjectPos[AV_OPLACE_MAX][4]
Definition: BattlegroundAV.h:385
@ AV_OPLACE_BURN_DUNBALDAR_SOUTH
Definition: BattlegroundAV.h:359
@ AV_OPLACE_MINE_SUPPLY_N_MIN
Definition: BattlegroundAV.h:373
@ AV_OPLACE_SNOW_1
Definition: BattlegroundAV.h:369
@ AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN
Definition: BattlegroundAV.h:377
@ AV_OPLACE_STORMPIKE_BANNER
Definition: BattlegroundAV.h:380
@ AV_OPLACE_MINE_SUPPLY_S_MIN
Definition: BattlegroundAV.h:375
@ AV_OPLACE_BURN_BUILDING_A
Definition: BattlegroundAV.h:367
@ AV_OPLACE_FROSTWOLF_BANNER
Definition: BattlegroundAV.h:379
@ BG_AV_OBJECT_MINE_SUPPLY_N_MIN
Definition: BattlegroundAV.h:319
@ BG_AV_OBJECT_MINE_SUPPLY_N_MAX
Definition: BattlegroundAV.h:320
@ BG_AV_OBJECT_MINE_SUPPLY_S_MIN
Definition: BattlegroundAV.h:321
@ BG_AV_OBJECT_MINE_SUPPLY_S_MAX
Definition: BattlegroundAV.h:322
@ BG_AV_OBJECT_DOOR_H
Definition: BattlegroundAV.h:246
@ BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION
Definition: BattlegroundAV.h:196
@ BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE
Definition: BattlegroundAV.h:236
@ BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN
Definition: BattlegroundAV.h:323
@ BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER
Definition: BattlegroundAV.h:281
@ BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER
Definition: BattlegroundAV.h:278
@ BG_AV_OBJECT_AURA_H_FIRSTAID_STATION
Definition: BattlegroundAV.h:251
@ BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX
Definition: BattlegroundAV.h:324
@ BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER
Definition: BattlegroundAV.h:287
@ BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH
Definition: BattlegroundAV.h:203
@ BG_AV_OBJECT_GENERIC_MAX
Definition: BattlegroundAV.h:328
@ BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE
Definition: BattlegroundAV.h:258
@ BG_AV_OBJECT_DOOR_A
Definition: BattlegroundAV.h:247
@ BG_AV_OBJECT_GENERIC_MIN
Definition: BattlegroundAV.h:327
@ BG_AV_OBJECT_STORMPIKE_BANNER
Definition: BattlegroundAV.h:326
@ BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE
Definition: BattlegroundAV.h:198
@ BG_AV_OBJECT_FROSTWOLF_BANNER
Definition: BattlegroundAV.h:325
@ AV_NPC_H_MARSHAL_WTOWER
Definition: BattlegroundAV.h:1144
@ AV_NPC_HERALD
Definition: BattlegroundAV.h:1170
@ AV_NPC_A_MARSHAL_SOUTH
Definition: BattlegroundAV.h:1137
bool IsHolidayActive(HolidayIds id)
Definition: GameEventMgr.cpp:1909
@ HOLIDAY_FEAST_OF_WINTER_VEIL
Definition: SharedDefines.h:2745
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:1407

References AddAVCreature(), Battleground::AddObject(), Battleground::AddSpiritGuide(), AV_CPLACE_A_MARSHAL_SOUTH, AV_CPLACE_HERALD, AV_CPLACE_MAX, AV_NPC_A_MARSHAL_SOUTH, AV_NPC_H_MARSHAL_WTOWER, AV_NPC_HERALD, AV_OPLACE_BURN_BUILDING_A, AV_OPLACE_BURN_DUNBALDAR_SOUTH, AV_OPLACE_FROSTWOLF_BANNER, AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN, AV_OPLACE_MINE_SUPPLY_N_MIN, AV_OPLACE_MINE_SUPPLY_S_MIN, AV_OPLACE_SNOW_1, AV_OPLACE_STORMPIKE_BANNER, AV_STATICCPLACE_MAX, BG_AV_CreaturePos, BG_AV_DoorPositons, BG_AV_GenericObjectPos, BG_AV_NODES_DUNBALDAR_SOUTH, BG_AV_NODES_FIRSTAID_STATION, BG_AV_NODES_FROSTWOLF_HUT, BG_AV_NODES_MAX, BG_AV_NODES_SNOWFALL_GRAVE, BG_AV_NODES_STONEHEART_BUNKER, BG_AV_OBJECT_AURA_A_FIRSTAID_STATION, BG_AV_OBJECT_AURA_H_FIRSTAID_STATION, BG_AV_OBJECT_AURA_N_FIRSTAID_STATION, BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE, BG_AV_OBJECT_BURN_BUILDING_ALLIANCE, BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH, BG_AV_OBJECT_DOOR_A, BG_AV_OBJECT_DOOR_H, BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH, BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION, BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER, BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE, BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT, BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER, BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE, BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECT_GENERIC_MAX, BG_AV_OBJECT_GENERIC_MIN, BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX, BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN, BG_AV_OBJECT_MAX, BG_AV_OBJECT_MINE_SUPPLY_N_MAX, BG_AV_OBJECT_MINE_SUPPLY_N_MIN, BG_AV_OBJECT_MINE_SUPPLY_S_MAX, BG_AV_OBJECT_MINE_SUPPLY_S_MIN, BG_AV_OBJECT_SNOW_EYECANDY_A, BG_AV_OBJECT_SNOW_EYECANDY_H, BG_AV_OBJECT_SNOW_EYECANDY_PA, BG_AV_OBJECT_SNOW_EYECANDY_PH, BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH, BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH, BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH, BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER, BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH, BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER, BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER, BG_AV_OBJECTID_AURA_A, BG_AV_OBJECTID_AURA_H, BG_AV_OBJECTID_AURA_N, BG_AV_OBJECTID_BANNER_A, BG_AV_OBJECTID_BANNER_A_B, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_OBJECTID_BANNER_H, BG_AV_OBJECTID_BANNER_H_B, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_OBJECTID_FIRE, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_OBJECTID_GATE_A, BG_AV_OBJECTID_GATE_H, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_OBJECTID_MINE_N, BG_AV_OBJECTID_MINE_S, BG_AV_OBJECTID_SMOKE, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos, GetNodeThroughObject(), HOLIDAY_FEAST_OF_WINTER_VEIL, IsHolidayActive(), LOG_DEBUG, LOG_ERROR, m_Nodes, PopulateNode(), RESPAWN_IMMEDIATELY, RESPAWN_ONE_DAY, Battleground::SpawnBGObject(), TEAM_ALLIANCE, TEAM_HORDE, and TEAM_NEUTRAL.

◆ StartingEventCloseDoors()

void BattlegroundAV::StartingEventCloseDoors ( )
overridevirtual

◆ StartingEventOpenDoors()

void BattlegroundAV::StartingEventOpenDoors ( )
overridevirtual

Reimplemented from Battleground.

468{
469 LOG_DEBUG("bg.battleground", "BG_AV: start spawning mine stuff");
474 for (uint8 mine = AV_NORTH_MINE; mine <= AV_SOUTH_MINE; mine++) //mine population
475 ChangeMineOwner(mine, TEAM_NEUTRAL, true);
476
479
482
483 // Achievement: The Alterac Blitz
485}
constexpr auto MINUTE
Definition: Common.h:47
#define AV_EVENT_START_BATTLE
Definition: BattlegroundAV.h:49
@ ACHIEVEMENT_TIMED_TYPE_EVENT
Definition: DBCEnums.h:110
void DoorOpen(uint32 type)
Definition: Battleground.cpp:1479
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Definition: Battleground.cpp:1831

References ACHIEVEMENT_TIMED_TYPE_EVENT, AV_EVENT_START_BATTLE, AV_NORTH_MINE, AV_SHOW_A_SCORE, AV_SHOW_H_SCORE, AV_SOUTH_MINE, BG_AV_OBJECT_DOOR_A, BG_AV_OBJECT_DOOR_H, BG_AV_OBJECT_MINE_SUPPLY_N_MAX, BG_AV_OBJECT_MINE_SUPPLY_N_MIN, BG_AV_OBJECT_MINE_SUPPLY_S_MAX, BG_AV_OBJECT_MINE_SUPPLY_S_MIN, ChangeMineOwner(), Battleground::DoorOpen(), LOG_DEBUG, MINUTE, RESPAWN_IMMEDIATELY, Battleground::SpawnBGObject(), Battleground::StartTimedAchievement(), TEAM_NEUTRAL, and Battleground::UpdateWorldState().

◆ UpdateNodeWorldState()

void BattlegroundAV::UpdateNodeWorldState ( BG_AV_Nodes  node)
private
1153{
1154 UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State, m_Nodes[node].OwnerId)], 1);
1155 if (m_Nodes[node].PrevOwnerId == TEAM_NEUTRAL) //currently only snowfall is supported as neutral node (i don't want to make an extra row (neutral states) in worldstatesarray just for one node
1157 else
1158 UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwnerId)], 0);
1159}

References AV_SNOWFALL_N, BG_AV_NodeWorldStates, GetWorldStateType(), m_Nodes, TEAM_NEUTRAL, and Battleground::UpdateWorldState().

Referenced by EventPlayerAssaultsPoint(), EventPlayerDefendsPoint(), and EventPlayerDestroyedPoint().

◆ UpdatePlayerScore()

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

Reimplemented from Battleground.

576{
577 if (!Battleground::UpdatePlayerScore(player, type, value, doAddHonor))
578 return false;
579
580 switch (type)
581 {
584 break;
587 break;
590 break;
593 break;
594 default:
595 break;
596 }
597
598 return true;
599}
@ AV_OBJECTIVE_DEFEND_GRAVEYARD
Definition: BattlegroundAV.h:1645
@ AV_OBJECTIVE_ASSAULT_GRAVEYARD
Definition: BattlegroundAV.h:1643
@ AV_OBJECTIVE_ASSAULT_TOWER
Definition: BattlegroundAV.h:1642
@ AV_OBJECTIVE_DEFEND_TOWER
Definition: BattlegroundAV.h:1644
@ ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE
Definition: DBCEnums.h:144
virtual bool UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
Definition: Battleground.cpp:1346
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2127

References ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_ASSAULT_GRAVEYARD, AV_OBJECTIVE_ASSAULT_TOWER, AV_OBJECTIVE_DEFEND_GRAVEYARD, AV_OBJECTIVE_DEFEND_TOWER, SCORE_GRAVEYARDS_ASSAULTED, SCORE_GRAVEYARDS_DEFENDED, SCORE_TOWERS_ASSAULTED, SCORE_TOWERS_DEFENDED, Player::UpdateAchievementCriteria(), and Battleground::UpdatePlayerScore().

Referenced by EventPlayerAssaultsPoint(), EventPlayerDefendsPoint(), and HandleKillUnit().

◆ UpdateScore()

void BattlegroundAV::UpdateScore ( TeamId  teamId,
int16  points 
)
267{
268 //note: to remove reinforcementpoints points must be negative, for adding reinforcements points must be positive
269 m_Team_Scores[teamId] += points;
270
272 if (points < 0)
273 {
274 if (m_Team_Scores[teamId] < 1)
275 {
276 m_Team_Scores[teamId] = 0;
278 }
279 else if (!m_IsInformedNearVictory[teamId] && m_Team_Scores[teamId] < SEND_MSG_NEAR_LOSE)
280 {
281 if (teamId == TEAM_ALLIANCE)
282 {
284 }
285 else
286 {
288 }
289
291 m_IsInformedNearVictory[teamId] = true;
292 }
293 }
294}
@ AV_SOUND_NEAR_VICTORY
Definition: BattlegroundAV.h:96
#define SEND_MSG_NEAR_LOSE
Definition: BattlegroundAV.h:28
@ BG_AV_TEXT_ALLIANCE_NEAR_LOSE
Definition: BattlegroundAV.h:57
@ BG_AV_TEXT_HORDE_NEAR_LOSE
Definition: BattlegroundAV.h:58
@ CHAT_MSG_BG_SYSTEM_ALLIANCE
Definition: SharedDefines.h:3189
@ CHAT_MSG_BG_SYSTEM_HORDE
Definition: SharedDefines.h:3190
static TeamId GetOtherTeamId(TeamId teamId)
Definition: Battleground.cpp:1754
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const *target=nullptr)
Definition: Battleground.cpp:687

References AV_Alliance_Score, AV_Horde_Score, AV_SOUND_NEAR_VICTORY, BG_AV_TEXT_ALLIANCE_NEAR_LOSE, BG_AV_TEXT_HORDE_NEAR_LOSE, CHAT_MSG_BG_SYSTEM_ALLIANCE, CHAT_MSG_BG_SYSTEM_HORDE, EndBattleground(), Battleground::GetOtherTeamId(), m_IsInformedNearVictory, m_Team_Scores, Battleground::PlaySoundToAll(), SEND_MSG_NEAR_LOSE, Battleground::SendBroadcastText(), TEAM_ALLIANCE, TEAM_HORDE, and Battleground::UpdateWorldState().

Referenced by EventPlayerDestroyedPoint(), HandleKillPlayer(), HandleKillUnit(), and PostUpdateImpl().

Member Data Documentation

◆ m_CaptainAlive

bool BattlegroundAV::m_CaptainAlive[2] {}
private

◆ m_CaptainBuffTimer

uint32 BattlegroundAV::m_CaptainBuffTimer[2] {}
private

◆ m_IsInformedNearVictory

bool BattlegroundAV::m_IsInformedNearVictory[2] {}
private

◆ m_Mine_Owner

◆ m_Mine_Reclaim_Timer

uint32 BattlegroundAV::m_Mine_Reclaim_Timer[2] {}
private

◆ m_Mine_Timer

int32 BattlegroundAV::m_Mine_Timer
private

◆ m_Nodes

◆ m_Team_QuestStatus

uint32 BattlegroundAV::m_Team_QuestStatus[2][9] {}
private

◆ m_Team_Scores

int32 BattlegroundAV::m_Team_Scores[2] {}
private