Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
Battleground.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef SF_BATTLEGROUND_H
7#define SF_BATTLEGROUND_H
8
9#include "Common.h"
10#include "DBCEnums.h"
11#include "GameObject.h"
12#include "Object.h"
13#include "SharedDefines.h"
14#include "WorldPacket.h"
15#include "WorldStateBuilder.h"
16
17class Creature;
18class GameObject;
19class Group;
20class Player;
21class Unit;
22class WorldObject;
23class WorldPacket;
24class BattlegroundMap;
25
28
38
46
58
75
81
87
89{
90 SPELL_WAITING_FOR_RESURRECT = 2584, // Waiting to Resurrect
91 SPELL_SPIRIT_HEAL_CHANNEL = 22011, // Spirit Heal Channel
92 SPELL_SPIRIT_HEAL = 22012, // Spirit Heal
93 SPELL_RESURRECTION_VISUAL = 24171, // Resurrection Impact Visual
94 SPELL_ARENA_PREPARATION = 32727, // use this one, 32728 not correct
99 SPELL_PREPARATION = 44521, // Preparation
100 SPELL_SPIRIT_HEAL_MANA = 44535, // Spirit Heal
101 SPELL_RECENTLY_DROPPED_FLAG = 42792, // Recently Dropped Flag
102 SPELL_AURA_PLAYER_INACTIVE = 43681, // Inactive
103 SPELL_HONORABLE_DEFENDER_25Y = 68652, // +50% honor when standing at a capture point that you control, 25yards radius (added in 3.2)
104 SPELL_HONORABLE_DEFENDER_60Y = 66157, // +50% honor when standing at a capture point that you control, 60yards radius (added in 3.2), probably for 40+ player battlegrounds
105 SPELL_THE_LAST_STANDING = 26549 // Arena achievement related
106};
107
109{
112 //REMIND_INTERVAL = 10000, // ms
116 MAX_OFFLINE_TIME = 300, // secs
117 RESPAWN_ONE_DAY = 86400, // secs
119 BUFF_RESPAWN_TIME = 180, // secs
123};
124
126{
127 BG_START_DELAY_2M = 120000, // ms (2 minutes)
128 BG_START_DELAY_1M = 60000, // ms (1 minute)
129 BG_START_DELAY_30S = 30000, // ms (30 seconds)
130 BG_START_DELAY_15S = 15000, // ms (15 seconds) Used only in arena
132};
133
140
142
144{
145 STATUS_NONE = 0, // first status, should mean bg is not instance
146 STATUS_WAIT_QUEUE = 1, // means bg is empty and waiting for queue
147 STATUS_WAIT_JOIN = 2, // this means, that BG has already started and it is waiting for more players
148 STATUS_IN_PROGRESS = 3, // means bg is running
149 STATUS_WAIT_LEAVE = 4 // means some faction has won BG and it is ending
150};
151
153{
154 time_t OfflineRemoveTime; // for tracking and removing offline players from queue after 5 minutes
155 uint32 Team; // Player's team
156 int32 ActiveSpec; // Player's active spec
157};
158
167
174
205
206
207
213
220
221#define BG_TEAMS_COUNT 2
222
231
239#define BG_STARTING_EVENT_COUNT 4
240
247
249{
253
254 virtual ~BattlegroundScore() { } //virtual destructor is used when deleting score from scores map
255
262};
263
264#define BG_AWARD_ARENA_POINTS_MIN_LEVEL 71
265#define ARENA_TIMELIMIT_POINTS_LOSS -16
266
267/*
268This class is used to:
2691. Add player to battleground
2702. Remove player from battleground
2713. some certain cases, same for all battlegrounds
2724. It has properties same for all battlegrounds
273*/
275{
276public:
277 Battleground();
278 virtual ~Battleground();
279
280 void Update(uint32 diff);
281
282 virtual bool SetupBattleground() // must be implemented in BG subclass
283 {
284 return true;
285 }
286 virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass
287 virtual void StartingEventCloseDoors() { }
288 virtual void StartingEventOpenDoors() { }
289 virtual void ResetBGSubclass() { } // must be implemented in BG subclass
290
291 virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) { }
292
293 /* achievement req. */
294 virtual bool IsAllNodesControlledByTeam(uint32 /*team*/) const { return false; }
296 virtual bool CheckAchievementCriteriaMeet(uint32 /*criteriaId*/, Player const* /*player*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0);
297
298 /* Battleground */
299 // Get methods:
300 char const* GetName() const { return m_Name; }
301 uint64 GetGUID() const { return m_Guid; }
302 BattlegroundTypeId GetTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_TypeID; }
312
313 uint32 GetMinLevel() const { return m_LevelMin; }
314 uint32 GetMaxLevel() const { return m_LevelMax; }
315
318
320 uint8 GetArenaType() const { return m_ArenaType; }
321 uint8 GetWinner() const { return m_Winner; }
322 uint32 GetScriptId() const { return ScriptId; }
324 bool IsRandom() const { return m_IsRandom; }
325
326 // Set methods:
327 void SetGuid(uint64 newGuid) { m_Guid = newGuid; }
328 void SetName(char const* Name) { m_Name = Name; }
331 //here we can count minlevel and maxlevel for players
332 void SetBracket(PvPDifficultyEntry const* bracketEntry);
333 void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; }
334 void SetStatus(BattlegroundStatus Status) { m_Status = Status; }
335 void SetClientInstanceID(uint32 InstanceID) { m_ClientInstanceID = InstanceID; }
336 void SetElapsedTime(uint32 Time) { m_StartTime = Time; }
337 void SetRemainingTime(uint32 Time) { m_EndTime = Time; }
339 void SetMaxPlayers(uint32 MaxPlayers) { m_MaxPlayers = MaxPlayers; }
340 void SetMinPlayers(uint32 MinPlayers) { m_MinPlayers = MinPlayers; }
341 void SetLevelRange(uint32 min, uint32 max) { m_LevelMin = min; m_LevelMax = max; }
342 void SetRated(bool state) { m_IsRated = state; }
343 void SetArenaType(uint8 type) { m_ArenaType = type; }
344 void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; }
345 void SetWinner(uint8 winner) { m_Winner = winner; }
346 void SetScriptId(uint32 scriptId) { ScriptId = scriptId; }
347
348 void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; }
349 void SetStartDelayTime(int Time) { m_StartDelayTime = Time; }
350
351 void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; }
352 void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; }
353
354 void AddToBGFreeSlotQueue(); //this queue will be useful when more battlegrounds instances will be available
355 void RemoveFromBGFreeSlotQueue(); //this method could delete whole BG instance, if another free is available
356
359
360 void SetRandom(bool isRandom) { m_IsRandom = isRandom; }
362 bool HasFreeSlots() const;
364
365 bool isArena() const { return m_IsArena; }
366 bool isBattleground() const { return !m_IsArena; }
367 bool isRated() const { return m_IsRated; }
368
369 typedef std::map<uint64, BattlegroundPlayer> BattlegroundPlayerMap;
370 BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
371 uint32 GetPlayersSize() const { return m_Players.size(); }
372
373 typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap;
374 BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return PlayerScores.begin(); }
375 BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return PlayerScores.end(); }
376 uint32 GetPlayerScoresSize() const { return PlayerScores.size(); }
377
378 uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); }
379
380 void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
381 void RemovePlayerFromResurrectQueue(uint64 player_guid);
382
384 void RelocateDeadPlayers(uint64 queueIndex);
385
386 void StartBattleground();
387
390
391 // Location
392 void SetMapId(uint32 MapID) { m_MapId = MapID; }
393 uint32 GetMapId() const { return m_MapId; }
394
395 // Map pointers
396 void SetBgMap(BattlegroundMap* map) { m_Map = map; }
398 BattlegroundMap* FindBgMap() const { return m_Map; }
399
400 void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O);
401 void GetTeamStartLoc(uint32 TeamID, float& X, float& Y, float& Z, float& O) const
402 {
403 TeamId idx = GetTeamIndexByTeamId(TeamID);
404 X = m_TeamStartLocX[idx];
405 Y = m_TeamStartLocY[idx];
406 Z = m_TeamStartLocZ[idx];
407 O = m_TeamStartLocO[idx];
408 }
409
410 void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
411 float GetStartMaxDist() const { return m_StartMaxDist; }
412
413 // Packet Transfer
414 // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
415 virtual void FillInitialWorldStates(WorldStateBuilder& /*builder*/) { }
416 void SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player* sender = NULL, bool self = true);
417 void SendPacketToAll(WorldPacket* packet);
418 void YellToAll(Creature* creature, const char* text, Language language);
419
420 template<class Do>
421 void BroadcastWorker(Do& _do);
422
423 void PlaySoundToTeam(uint32 SoundID, uint32 TeamID);
424 void PlaySoundToAll(uint32 SoundID);
425 void CastSpellOnTeam(uint32 SpellID, uint32 TeamID);
426 void RemoveAuraOnTeam(uint32 SpellID, uint32 TeamID);
427 void RewardHonorToTeam(uint32 Honor, uint32 TeamID);
428 void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID);
429 void UpdateWorldState(uint32 Field, uint32 Value);
430 void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* player);
431 void EndBattleground(uint32 winner);
432 void BlockMovement(Player* player);
433
434 void SendWarningToAll(int32 entry, ...);
435 void SendMessageToAll(int32 entry, ChatMsg type, Player const* source = NULL);
436 void PSendMessageToAll(int32 entry, ChatMsg type, Player const* source, ...);
437
438 // specialized version with 2 string id args
439 void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0);
440
441 // Raid Group
442 Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; }
443 void SetBgRaid(uint32 TeamID, Group* bg_raid);
444
445 virtual void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
446
449 uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
451 {
452 if (remove)
454 else
456 }
457
458 // used for rated arena battles
461 uint32 GetArenaTeamIdByIndex(uint32 index) const { return m_ArenaTeamIds[index]; }
471
472 // Triggers handle
473 // must be implemented in BG subclass
474 virtual void HandleAreaTrigger(Player* /*player*/, uint32 /*Trigger*/);
475 // must be implemented in BG subclass if need AND call base class generic code
476 virtual void HandleKillPlayer(Player* player, Player* killer);
477 virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/);
478
479 // Battleground events
480 virtual void EventPlayerDroppedFlag(Player* /*player*/) { }
481 virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) { }
482 void EventPlayerLoggedIn(Player* player);
483 void EventPlayerLoggedOut(Player* player);
484 virtual void EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/, uint32 /*eventType*/) { }
485 virtual void EventPlayerUsedGO(Player* /*player*/, GameObject* /*go*/) { }
486
487 // this function can be used by spell to interact with the BG map
488 virtual void DoAction(uint32 /*action*/, uint64 /*var*/) { }
489
490 virtual void HandlePlayerResurrect(Player* /*player*/) { }
491
492 // Death related
493 virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
494
495 virtual void AddPlayer(Player* player); // must be implemented in BG subclass
496
497 void AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team);
498
499 virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket);
500 // can be extended in in BG subclass
501
502 void HandleTriggerBuff(uint64 go_guid);
503 void SetHoliday(bool is_holiday);
504
506 typedef std::vector<uint64> BGObjects;
507 typedef std::vector<uint64> BGCreatures;
510 void SpawnBGObject(uint32 type, uint32 respawntime);
511 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);
512 Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime = 0);
513 bool DelCreature(uint32 type);
514 bool DelObject(uint32 type);
515 bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team);
517
518 void DoorOpen(uint32 type);
519 void DoorClose(uint32 type);
520 //to be removed
521 const char* GetSkyFireString(int32 entry);
522
523 virtual bool HandlePlayerUnderMap(Player* /*player*/) { return false; }
524
525 // since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
526 uint32 GetPlayerTeam(uint64 guid) const;
528 uint32 GetOtherTeam(uint32 teamId) const;
529 bool IsPlayerInBattleground(uint64 guid) const;
530
531 bool ToBeDeleted() const { return m_SetDeleteThis; }
533
534 void RewardXPAtKill(Player* killer, Player* victim);
536
537 virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; }
538 virtual void SetDroppedFlagGUID(uint64 /*guid*/, int32 /*team*/ = -1) { }
539 virtual void HandleQuestComplete(uint32 /*questid*/, Player* /*player*/) { }
540 virtual bool CanActivateGO(int32 /*entry*/, uint32 /*team*/) const { return true; }
541 virtual bool IsSpellAllowed(uint32 /*spellId*/, Player const* /*player*/) const { return true; }
542 uint32 GetTeamScore(uint32 TeamID) const;
543
544 virtual uint32 GetPrematureWinner();
545
546protected:
547 // this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
548 void EndNow();
550
551 Player* _GetPlayer(uint64 guid, bool offlineRemove, const char* context) const;
552 Player* _GetPlayer(BattlegroundPlayerMap::iterator itr, const char* context);
553 Player* _GetPlayer(BattlegroundPlayerMap::const_iterator itr, const char* context) const;
554 Player* _GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char* context) const;
555
557 void _ProcessRessurect(uint32 diff);
558 void _ProcessProgress(uint32 diff);
559 void _ProcessLeave(uint32 diff);
560 void _ProcessJoin(uint32 diff);
561 void _CheckSafePositions(uint32 diff);
562
563 // Scorekeeping
565 // must be implemented in BG subclass
566 virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) { }
567
568 // Player lists, those need to be accessible by inherited classes
570 // Spirit Guide guid + Player list GUIDS
571 std::map<uint64, std::vector<uint64> > m_ReviveQueue;
572
573 // these are important variables used for starting messages
576 // this must be filled in constructors!
578
581
584
585private:
586 // Battleground
589 uint32 m_InstanceID; // Battleground Instance's GUID!
591 uint32 m_ClientInstanceID; // the instance-id which is sent to the client and without any other internal use
596 int32 m_EndTime; // it is set to 120000 when bg is ending and it decreases itself
599 uint8 m_ArenaType; // 2=2v2, 3=3v3, 5=5v5
600 bool m_InBGFreeSlotQueue; // used to make sure that BG is only once inserted into the BattlegroundMgr.BGFreeSlotQueue[bgTypeId] deque
601 bool m_SetDeleteThis; // used for safe deletion of the bg after end / all players leave
603 uint8 m_Winner; // 0=alliance, 1=horde, 2=none
605 bool m_IsRated; // is this battle rated?
608 char const* m_Name;
610
611 /* Pre- and post-update hooks */
612
626 virtual bool PreUpdateImpl(uint32 /* diff */) { return true; }
627 virtual bool ShouldDelayStartForDebug() const { return false; }
628
640 virtual void PostUpdateImpl(uint32 /* diff */) { }
641
642 // Player lists
643 std::vector<uint64> m_ResurrectQueue; // Player GUID
644 std::deque<uint64> m_OfflineQueue; // Player GUID
645
646 // Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
647 // Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
648 // Invited players counters
651
652 // Raid Group
653 Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
654
655 // Players count by team
657
658 // Arena team ids by team
660
663
664 // Limits
671
672 // Start location
681};
682#endif
BattlegroundWinner
@ WINNER_HORDE
@ WINNER_ALLIANCE
@ WINNER_NONE
BattlegroundCriteriaId
@ BG_CRITERIA_CHECK_AV_PERFECTION
@ BG_CRITERIA_CHECK_SAVE_THE_DAY
@ BG_CRITERIA_CHECK_DEFENSE_OF_THE_ANCIENTS
@ BG_CRITERIA_CHECK_RESILIENT_VICTORY
@ BG_CRITERIA_CHECK_EVERYTHING_COUNTS
@ BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH
BattlegroundTimeIntervals
@ INVITE_ACCEPT_WAIT_TIME
@ RESURRECTION_INTERVAL
@ ARENA_COUNTDOWN_MAX
@ PLAYER_POSITION_UPDATE_INTERVAL
@ MAX_OFFLINE_TIME
@ RESPAWN_IMMEDIATELY
@ BUFF_RESPAWN_TIME
@ TIME_AUTOCLOSE_BATTLEGROUND
@ BATTLEGROUND_COUNTDOWN_MAX
@ RESPAWN_ONE_DAY
@ CHECK_PLAYER_POSITION_INVERVAL
@ INVITATION_REMIND_TIME
ArenaType
@ ARENA_TYPE_5v5
@ ARENA_TYPE_3v3
@ ARENA_TYPE_2v2
BattlegroundMarks
@ SPELL_WS_MARK_WINNER
@ ITEM_WS_MARK_OF_HONOR
@ ITEM_SA_MARK_OF_HONOR
@ SPELL_SA_MARK_WINNER
@ SPELL_AV_MARK_LOSER
@ ITEM_EY_MARK_OF_HONOR
@ SPELL_WS_MARK_LOSER
@ SPELL_SA_MARK_LOSER
@ SPELL_AB_MARK_LOSER
@ ITEM_AV_MARK_OF_HONOR
@ ITEM_AB_MARK_OF_HONOR
@ SPELL_AB_MARK_WINNER
@ SPELL_AV_MARK_WINNER
BattlegroundStartingEvents
@ BG_STARTING_EVENT_NONE
@ BG_STARTING_EVENT_3
@ BG_STARTING_EVENT_2
@ BG_STARTING_EVENT_1
@ BG_STARTING_EVENT_4
BattlegroundBuffObjects
@ BG_OBJECTID_REGENBUFF_ENTRY
@ BG_OBJECTID_BERSERKERBUFF_ENTRY
@ BG_OBJECTID_SPEEDBUFF_ENTRY
BattlegroundMarksCount
@ ITEM_WINNER_COUNT
@ ITEM_LOSER_COUNT
BattlegroundCreatures
@ BG_CREATURE_ENTRY_H_SPIRITGUIDE
@ BG_CREATURE_ENTRY_A_SPIRITGUIDE
uint32 const Buff_Entries[3]
BGHonorMode
@ BG_NORMAL
@ BG_HOLIDAY
@ BG_HONOR_MODE_NUM
BattlegroundSpells
@ SPELL_SPIRIT_HEAL
@ SPELL_AURA_PLAYER_INACTIVE
@ SPELL_ALLIANCE_GOLD_FLAG
@ SPELL_THE_LAST_STANDING
@ SPELL_RECENTLY_DROPPED_FLAG
@ SPELL_SPIRIT_HEAL_CHANNEL
@ SPELL_HORDE_GOLD_FLAG
@ SPELL_ARENA_PREPARATION
@ SPELL_SPIRIT_HEAL_MANA
@ SPELL_HONORABLE_DEFENDER_25Y
@ SPELL_PREPARATION
@ SPELL_RESURRECTION_VISUAL
@ SPELL_HORDE_GREEN_FLAG
@ SPELL_ALLIANCE_GREEN_FLAG
@ SPELL_WAITING_FOR_RESURRECT
@ SPELL_HONORABLE_DEFENDER_60Y
ScoreType
@ SCORE_BASES_ASSAULTED
@ SCORE_GRAVEYARDS_ASSAULTED
@ SCORE_KILLING_BLOWS
@ SCORE_SECONDARY_OBJECTIVES
@ SCORE_TOWERS_DEFENDED
@ SCORE_BONUS_HONOR
@ SCORE_FLAG_CAPTURES
@ SCORE_DEATHS
@ SCORE_ORB_CONTROL
@ SCORE_TOWERS_ASSAULTED
@ SCORE_MINES_CAPTURED
@ SCORE_DAMAGE_DONE
@ SCORE_DESTROYED_WALL
@ SCORE_LEADERS_KILLED
@ SCORE_ORB_SCORE
@ SCORE_DESTROYED_DEMOLISHER
@ SCORE_BASES_DEFENDED
@ SCORE_HEALING_DONE
@ SCORE_GRAVEYARDS_DEFENDED
@ SCORE_HONORABLE_KILLS
@ SCORE_FLAG_RETURNS
BattlegroundStartTimeIntervals
@ BG_START_DELAY_1M
@ BG_START_DELAY_30S
@ BG_START_DELAY_2M
@ BG_START_DELAY_NONE
@ BG_START_DELAY_15S
#define BG_TEAMS_COUNT
#define BG_AWARD_ARENA_POINTS_MIN_LEVEL
BattlegroundType
@ TYPE_BATTLEGROUND
@ TYPE_ARENA
BattlegroundStatus
@ STATUS_WAIT_QUEUE
@ STATUS_NONE
@ STATUS_WAIT_LEAVE
@ STATUS_WAIT_JOIN
@ STATUS_IN_PROGRESS
BattlegroundSounds
@ SOUND_BG_START
@ SOUND_ALLIANCE_WINS
@ SOUND_HORDE_WINS
@ SOUND_BG_START_L70ETC
#define BG_STARTING_EVENT_COUNT
BattlegroundQuests
@ SPELL_AV_QUEST_REWARD
@ SPELL_AB_QUEST_REWARD_4_BASES
@ SPELL_AB_QUEST_REWARD
@ SPELL_AB_QUEST_REWARD_5_BASES
@ SPELL_WS_QUEST_REWARD
@ SPELL_SA_QUEST_REWARD
@ SPELL_EY_QUEST_REWARD
@ SPELL_AV_QUEST_KILLED_BOSS
BattlegroundStartingEventsIds
@ BG_STARTING_EVENT_THIRD
@ BG_STARTING_EVENT_SECOND
@ BG_STARTING_EVENT_FIRST
@ BG_STARTING_EVENT_FOURTH
AchievementCriteriaTimedTypes
Definition DBCEnums.h:157
BattlegroundBracketId
Definition DBCEnums.h:28
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::uint64_t uint64
Definition Define.h:76
#define ASSERT
Definition Errors.h:29
TypeID
Definition Object.h:50
ChatMsg
Language
TeamId
@ TEAM_ALLIANCE
@ TEAM_HORDE
@ ALLIANCE
BattlegroundTypeId
void GetTeamStartLoc(uint32 TeamID, float &X, float &Y, float &Z, float &O) const
virtual void AddPlayer(Player *player)
void SetMapId(uint32 MapID)
uint32 m_InvitedAlliance
void SetRemainingTime(uint32 Time)
void SetInstanceID(uint32 InstanceID)
void IncreaseInvitedCount(uint32 team)
uint32 GetAlivePlayersCountByTeam(uint32 Team) const
virtual void EventPlayerDamagedGO(Player *, GameObject *, uint32)
uint32 GetMapId() const
BattlegroundTypeId GetTypeID(bool GetRandom=false) const
void EndBattleground(uint32 winner)
virtual void EventPlayerClickedOnFlag(Player *, GameObject *)
uint32 m_CountdownTimer
virtual bool HandlePlayerUnderMap(Player *)
virtual void HandleKillUnit(Creature *, Player *)
bool ToBeDeleted() const
uint32 GetReviveQueueSize() const
char const * GetName() const
void SetDeleteThis()
BGHonorMode m_HonorMode
Group * m_BgRaids[BG_TEAMS_COUNT]
int32 GetArenaTeamRatingChangeForTeam(uint32 Team) const
uint32 GetMinLevel() const
void ModifyStartDelayTime(int diff)
uint32 m_ArenaTeamIds[BG_TEAMS_COUNT]
void SetRandom(bool isRandom)
void SetMaxPlayers(uint32 MaxPlayers)
void CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
void SetElapsedTime(uint32 Time)
virtual void HandleKillPlayer(Player *player, Player *killer)
virtual uint64 GetFlagPickerGUID(int32=-1) const
static TeamId GetTeamIndexByTeamId(uint32 Team)
virtual bool SetupBattleground()
float m_TeamStartLocX[BG_TEAMS_COUNT]
void DoorOpen(uint32 type)
uint32 GetMinPlayersPerTeam() const
void PlayerAddedToBGCheckIfBGIsRunning(Player *player)
bool DelCreature(uint32 type)
virtual void HandlePlayerResurrect(Player *)
int32 GetArenaTeamRatingChangeByIndex(uint32 index) const
uint8 GetArenaType() const
float m_TeamStartLocY[BG_TEAMS_COUNT]
BattlegroundPlayerMap m_Players
void SpawnBGObject(uint32 type, uint32 respawntime)
uint32 GetMaxPlayersPerTeam() const
uint32 GetArenaTeamIdByIndex(uint32 index) const
virtual void Reset()
uint32 m_ValidStartPositionTimer
void SendPacketToAll(WorldPacket *packet)
void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player *player)
void HandleTriggerBuff(uint64 go_guid)
void YellToAll(Creature *creature, const char *text, Language language)
int32 m_StartDelayTime
virtual void SetDroppedFlagGUID(uint64, int32=-1)
void AddOrSetPlayerToCorrectBgGroup(Player *player, uint32 team)
void PlaySoundToAll(uint32 SoundID)
virtual void EventPlayerUsedGO(Player *, GameObject *)
uint32 GetArenaMatchmakerRating(uint32 Team) const
uint32 m_ClientInstanceID
uint32 m_LevelMax
void AddToBGFreeSlotQueue()
uint32 GetPlayerScoresSize() const
BattlegroundTypeId m_TypeID
std::map< uint64, std::vector< uint64 > > m_ReviveQueue
void PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
Group * GetBgRaid(uint32 TeamID) const
virtual void HandleQuestComplete(uint32, Player *)
uint32 GetPlayerActiveSpec(uint64 guid) const
void SetScriptId(uint32 scriptId)
uint32 m_LastResurrectTime
virtual bool IsAllNodesControlledByTeam(uint32) const
bool CanAwardArenaPoints() const
bool isRated() const
void SetName(char const *Name)
uint32 GetOtherTeam(uint32 teamId) const
void SetBgMap(BattlegroundMap *map)
uint32 GetMaxPlayers() const
BattlegroundMap * GetBgMap() const
virtual void PostUpdateImpl(uint32)
Post-update hook.
BattlegroundTypeId m_RandomTypeID
void SetBracket(PvPDifficultyEntry const *bracketEntry)
void DecreaseInvitedCount(uint32 team)
void SetMinPlayersPerTeam(uint32 MinPlayers)
void _ProcessRessurect(uint32 diff)
void CheckArenaWinConditions()
void SetRated(bool state)
uint32 m_ArenaTeamMMR[BG_TEAMS_COUNT]
uint32 GetArenaTeamIdForTeam(uint32 Team) const
BattlegroundMap * FindBgMap() const
void SetStartMaxDist(float startMaxDist)
void BlockMovement(Player *player)
uint32 GetRemainingTime() const
void RemoveAuraOnTeam(uint32 SpellID, uint32 TeamID)
void StartBattleground()
uint64 GetGUID() const
virtual void ResetBGSubclass()
void DoorClose(uint32 type)
float m_TeamStartLocZ[BG_TEAMS_COUNT]
void Update(uint32 diff)
void RelocateDeadPlayers(uint64 queueIndex)
Relocate all players in ReviveQueue to the closest graveyard.
void SetBgRaid(uint32 TeamID, Group *bg_raid)
bool m_PrematureCountDown
uint32 GetInstanceID() const
uint32 m_PrematureCountDownTimer
virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket)
int32 GetObjectType(uint64 guid)
BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const
void SetLevelRange(uint32 min, uint32 max)
BGObjects BgObjects
void EventPlayerLoggedOut(Player *player)
void UpdateWorldState(uint32 Field, uint32 Value)
const char * GetSkyFireString(int32 entry)
Player * _GetPlayer(uint64 guid, bool offlineRemove, const char *context) const
uint32 GetClientInstanceID() const
uint32 m_MinPlayers
virtual bool IsSpellAllowed(uint32, Player const *) const
void SetGuid(uint64 newGuid)
void RewardXPAtKill(Player *killer, Player *victim)
bool m_InBGFreeSlotQueue
void SetClientInstanceID(uint32 InstanceID)
void SetStatus(BattlegroundStatus Status)
virtual void StartingEventCloseDoors()
BattlegroundBracketId m_BracketId
void BroadcastWorker(Do &_do)
BattlegroundStartTimeIntervals StartDelayTimes[BG_STARTING_EVENT_COUNT]
bool isArena() const
void SetArenaTeamIdForTeam(uint32 Team, uint32 ArenaTeamId)
char const * m_Name
void SetWinner(uint8 winner)
void SetArenaType(uint8 type)
void SetArenaMatchmakerRating(uint32 Team, uint32 MMR)
uint32 m_InstanceID
void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid)
void SetRandomTypeID(BattlegroundTypeId TypeID)
int32 m_ArenaTeamRatingChanges[BG_TEAMS_COUNT]
virtual void DoAction(uint32, uint64)
virtual void FillInitialWorldStates(WorldStateBuilder &)
bool DelObject(uint32 type)
std::map< uint64, BattlegroundScore * > BattlegroundScoreMap
uint32 m_ResetStatTimer
BattlegroundPlayerMap const & GetPlayers() const
int32 GetStartDelayTime() const
virtual void RemovePlayer(Player *, uint64, uint32)
BattlegroundScoreMap PlayerScores
virtual void StartingEventOpenDoors()
float GetStartMaxDist() const
bool isBattleground() const
uint32 m_MinPlayersPerTeam
virtual bool ShouldDelayStartForDebug() const
void SetLastResurrectTime(uint32 Time)
void RewardHonorToTeam(uint32 Honor, uint32 TeamID)
void SendWarningToAll(int32 entry,...)
bool AddSpiritGuide(uint32 type, float x, float y, float z, float o, uint32 team)
void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O)
BattlegroundStatus GetStatus() const
void SetArenaorBGType(bool _isArena)
bool HasFreeSlots() const
virtual bool CheckAchievementCriteriaMeet(uint32, Player const *, Unit const *=NULL, uint32=0)
uint8 GetWinner() const
uint32 GetArenaMatchmakerRatingByIndex(uint32 index) const
bool IsRandom() const
virtual WorldSafeLocsEntry const * GetClosestGraveYard(Player *player)
uint32 m_PlayersCount[BG_TEAMS_COUNT]
std::vector< uint64 > BGCreatures
virtual void HandleAreaTrigger(Player *, uint32)
void _ProcessOfflineQueue()
void RemoveFromBGFreeSlotQueue()
void _ProcessProgress(uint32 diff)
float m_TeamStartLocO[BG_TEAMS_COUNT]
void SetHoliday(bool is_holiday)
BGCreatures BgCreatures
GameObject * GetBGObject(uint32 type)
uint32 GetPlayersCountByTeam(uint32 Team) const
virtual bool PreUpdateImpl(uint32)
Pre-update hook.
float m_StartMaxDist
uint32 GetLastResurrectTime() const
void UpdateArenaWorldState()
uint32 GetScriptId() const
virtual ~Battleground()
uint32 GetTeamScore(uint32 TeamID) const
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
uint32 m_MaxPlayersPerTeam
void EventPlayerLoggedIn(Player *player)
void SetArenaTeamRatingChangeForTeam(uint32 Team, int32 RatingChange)
void SendMessage2ToAll(int32 entry, ChatMsg type, Player const *source, int32 strId1=0, int32 strId2=0)
void _CheckSafePositions(uint32 diff)
virtual void DestroyGate(Player *, GameObject *)
std::vector< uint64 > m_ResurrectQueue
void _ProcessJoin(uint32 diff)
BattlegroundBracketId GetBracketId() const
uint32 m_InvitedHorde
void UpdatePlayersCountByTeam(uint32 Team, bool remove)
uint32 m_MaxPlayers
virtual bool CanActivateGO(int32, uint32) const
std::vector< uint64 > BGObjects
void SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *sender=NULL, bool self=true)
virtual void EventPlayerDroppedFlag(Player *)
std::map< uint64, BattlegroundPlayer > BattlegroundPlayerMap
bool IsPlayerInBattleground(uint64 guid) const
uint32 GetBonusHonorFromKill(uint32 kills) const
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID)
uint32 GetMaxLevel() const
virtual void UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const
Creature * AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime=0)
uint32 GetElapsedTime() const
void SetMinPlayers(uint32 MinPlayers)
uint32 GetPlayersSize() const
uint32 m_LevelMin
uint32 GetPlayerTeam(uint64 guid) const
void PSendMessageToAll(int32 entry, ChatMsg type, Player const *source,...)
void SetMaxPlayersPerTeam(uint32 MaxPlayers)
void SendMessageToAll(int32 entry, ChatMsg type, Player const *source=NULL)
int32 m_TeamScores[BG_TEAMS_COUNT]
std::deque< uint64 > m_OfflineQueue
uint32 m_StartTime
Creature * GetBGCreature(uint32 type)
void SetStartDelayTime(int Time)
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)
uint32 GetFreeSlotsForTeam(uint32 Team) const
void RemovePlayerFromResurrectQueue(uint64 player_guid)
BattlegroundMap * m_Map
uint32 GetMinPlayers() const
uint32 GetInvitedCount(uint32 team) const
void _ProcessLeave(uint32 diff)
virtual uint32 GetPrematureWinner()
Player * _GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char *context) const
BattlegroundStatus m_Status
void CheckArenaAfterTimerConditions()
void SetTypeID(BattlegroundTypeId TypeID)
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
Definition Field.h:16
Definition Group.h:147
Definition Unit.h:1367
virtual ~BattlegroundScore()