18#ifndef __BATTLEGROUND_H
19#define __BATTLEGROUND_H
40struct BattlegroundPlayerScoreTemplate;
50 struct PVPMatchStatistics;
51 struct BattlegroundPlayerPosition;
211#define BG_STARTING_EVENT_COUNT 4
213#define BG_AWARD_ARENA_POINTS_MIN_LEVEL 71
214#define ARENA_TIMELIMIT_POINTS_LOSS -16
270 virtual void Reset();
288 uint32 GetMaxPlayers()
const;
289 uint32 GetMinPlayers()
const;
291 uint32 GetMinLevel()
const;
292 uint32 GetMaxLevel()
const;
294 uint32 GetMaxPlayersPerTeam()
const;
295 uint32 GetMinPlayersPerTeam()
const;
300 uint32 GetScriptId()
const;
314 std::unordered_set<uint32>
const*
GetPvpStatIds()
const {
return _pvpStatIds; }
319 void AddToBGFreeSlotQueue();
320 void RemoveFromBGFreeSlotQueue();
326 bool HasFreeSlots()
const;
329 bool isArena()
const;
330 bool isBattleground()
const;
355 float GetStartMaxDist()
const;
360 void SendPacketToAll(
WorldPacket const* packet)
const;
366 void BroadcastWorker(Do& _do);
368 void PlaySoundToTeam(
uint32 SoundID,
Team team);
369 void PlaySoundToAll(
uint32 SoundID);
370 void CastSpellOnTeam(
uint32 SpellID,
Team team);
371 void RemoveAuraOnTeam(
uint32 SpellID,
Team team);
373 void RewardReputationToTeam(
uint32 faction_id,
uint32 Reputation,
Team team);
374 void UpdateWorldState(
int32 worldStateId,
int32 value,
bool hidden =
false);
375 virtual void EndBattleground(
Team winner);
376 void BlockMovement(
Player* player);
383 void SetBgRaid(
Team team,
Group* bg_raid);
389 virtual bool UpdatePlayerScore(
Player* player,
uint32 type,
uint32 value,
bool doAddHonor =
true);
394 uint32 GetAlivePlayersCountByTeam(
Team team)
const;
398 --m_PlayersCount[GetTeamIndexByTeamId(team)];
400 ++m_PlayersCount[GetTeamIndexByTeamId(team)];
414 virtual void HandleAreaTrigger(
Player* ,
uint32 ,
bool );
416 virtual void HandleKillPlayer(
Player* player,
Player* killer);
422 void EventPlayerLoggedIn(
Player* player);
423 void EventPlayerLoggedOut(
Player* player);
433 void TeleportPlayerToExploitLocation(
Player* player);
437 void AddOrSetPlayerToCorrectBgGroup(
Player* player,
Team team);
446 virtual bool AddObject(
uint32 type,
uint32 entry,
float x,
float y,
float z,
float o,
float rotation0,
float rotation1,
float rotation2,
float rotation3,
uint32 respawnTime = 0,
GOState goState =
GO_STATE_READY);
450 bool DelCreature(
uint32 type);
451 bool DelObject(
uint32 type);
452 bool RemoveObjectFromWorld(
uint32 type);
457 void DoorOpen(
uint32 type);
458 void DoorClose(
uint32 type);
465 bool IsPlayerInBattleground(
ObjectGuid guid)
const;
466 bool IsPlayerMercenaryInBattleground(
ObjectGuid guid)
const;
481 virtual Team GetPrematureWinner();
484 uint8 GetUniqueBracketId()
const;
491 auto const& itr = m_Players.find(playerGuid);
492 if (itr == m_Players.end())
507 void PlayerAddedToBGCheckIfBGIsRunning(
Player* player);
509 Player* _GetPlayer(
ObjectGuid guid,
bool offlineRemove,
char const* context)
const;
510 Player*
_GetPlayer(BattlegroundPlayerMap::iterator itr,
char const* context) {
return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
511 Player*
_GetPlayer(BattlegroundPlayerMap::const_iterator itr,
char const* context)
const {
return _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, context); }
512 Player* _GetPlayerForTeam(
Team team, BattlegroundPlayerMap::const_iterator itr,
char const* context)
const;
544 void _ProcessOfflineQueue();
545 void _ProcessProgress(
uint32 diff);
546 void _ProcessLeave(
uint32 diff);
547 void _ProcessJoin(
uint32 diff);
548 void _CheckSafePositions(
uint32 diff);
549 void _ProcessPlayerPositionBroadcast(
uint32 diff);
BattlegroundTimeIntervals
@ INVITE_ACCEPT_WAIT_TIME
@ PLAYER_POSITION_UPDATE_INTERVAL
@ TIME_AUTOCLOSE_BATTLEGROUND
@ BATTLEGROUND_COUNTDOWN_MAX
@ CHECK_PLAYER_POSITION_INVERVAL
BattlegroundStartingEvents
@ BG_OBJECTID_REGENBUFF_ENTRY
@ BG_OBJECTID_BERSERKERBUFF_ENTRY
@ BG_OBJECTID_SPEEDBUFF_ENTRY
@ BG_CREATURE_ENTRY_H_SPIRITGUIDE
@ BG_CREATURE_ENTRY_A_SPIRITGUIDE
uint32 const Buff_Entries[3]
BattlegroundPlayerPositionConstants
@ PLAYER_POSITION_ARENA_SLOT_1
@ PLAYER_POSITION_ICON_NONE
@ PLAYER_POSITION_ARENA_SLOT_NONE
@ PLAYER_POSITION_ARENA_SLOT_4
@ PLAYER_POSITION_ICON_ALLIANCE_FLAG
@ PLAYER_POSITION_ARENA_SLOT_2
@ PLAYER_POSITION_ICON_HORDE_FLAG
@ PLAYER_POSITION_ARENA_SLOT_3
@ PLAYER_POSITION_ARENA_SLOT_5
BattlegroundBroadcastTexts
@ BG_TEXT_START_TWO_MINUTES
@ BG_TEXT_BATTLE_HAS_BEGUN
@ BG_TEXT_START_ONE_MINUTE
@ BG_TEXT_START_HALF_MINUTE
@ SPELL_SPIRIT_HEAL_CHANNEL_AOE
@ SPELL_AURA_PLAYER_INACTIVE
@ SPELL_MERCENARY_SHAPESHIFT
@ SPELL_RECENTLY_DROPPED_ALLIANCE_FLAG
@ SPELL_MERCENARY_ALLIANCE_REACTIONS
@ SPELL_SPIRIT_HEAL_PLAYER_AURA
@ SPELL_MERCENARY_HORDE_REACTIONS
@ SPELL_MERCENARY_HORDE_1
@ SPELL_ARENA_PREPARATION
@ SPELL_RECENTLY_DROPPED_HORDE_FLAG
@ SPELL_MERCENARY_CONTRACT_ALLIANCE
@ SPELL_HONORABLE_DEFENDER_25Y
@ SPELL_MERCENARY_CONTRACT_HORDE
@ SPELL_RECENTLY_DROPPED_NEUTRAL_FLAG
@ SPELL_SPIRIT_HEAL_CHANNEL_SELF
@ VISUAL_SPIRIT_HEAL_CHANNEL
@ SPELL_RESURRECTION_VISUAL
@ SPELL_MERCENARY_ALLIANCE_1
@ SPELL_WAITING_FOR_RESURRECT
@ SPELL_HONORABLE_DEFENDER_60Y
BattlegroundStartTimeIntervals
BattlegroundPointCaptureStatus
#define BG_AWARD_ARENA_POINTS_MIN_LEVEL
#define BG_STARTING_EVENT_COUNT
@ SPELL_AB_QUEST_REWARD_4_BASES
@ SPELL_AB_QUEST_REWARD_5_BASES
@ SPELL_AV_QUEST_KILLED_BOSS
BattlegroundStartingEventsIds
@ BG_STARTING_EVENT_THIRD
@ BG_STARTING_EVENT_SECOND
@ BG_STARTING_EVENT_FIRST
@ BG_STARTING_EVENT_FOURTH
std::vector< ObjectGuid > GuidVector
uint8 constexpr PVP_TEAMS_COUNT
virtual ObjectGuid GetFlagPickerGUID(int32=-1) const
void UpdatePlayersCountByTeam(Team team, bool remove)
void SetRemainingTime(uint32 Time)
void SetInstanceID(uint32 InstanceID)
virtual void EventPlayerClickedOnFlag(Player *, GameObject *)
virtual bool HandlePlayerUnderMap(Player *)
PVPDifficultyEntry const * _pvpDifficultyEntry
void IncreaseInvitedCount(Team team)
void ModifyStartDelayTime(int diff)
void SetElapsedTime(uint32 Time)
virtual bool SetupBattleground()
std::unordered_set< uint32 > const * GetPvpStatIds() const
std::deque< ObjectGuid > m_OfflineQueue
virtual void OnMapSet(BattlegroundMap *map)
virtual void HandlePlayerResurrect(Player *)
uint8 GetArenaType() const
BattlegroundPlayerMap m_Players
time_t _preparationStartTime
uint32 m_ValidStartPositionTimer
Group * GetBgRaid(Team team) const
uint32 GetArenaTeamIdForTeam(Team team) const
BattlegroundTemplate const * _battlegroundTemplate
uint32 GetInvitedCount(Team team) const
void SetWinner(PvPTeamId winnerTeamId)
Battleground(Battleground const &)
uint32 m_ClientInstanceID
uint32 GetPlayerScoresSize() const
virtual void HandleQuestComplete(uint32, Player *)
void DecreaseInvitedCount(Team team)
bool CanAwardArenaPoints() const
virtual void PostUpdateImpl(uint32)
Post-update hook.
PvPTeamId GetWinner() const
void SetRated(bool state)
virtual void RemovePlayer(Player *, ObjectGuid, uint32)
BattlegroundMap * FindBgMap() const
uint32 GetArenaTeamIdByIndex(TeamId teamId) const
uint32 GetRemainingTime() const
bool m_PrematureCountDown
uint32 GetInstanceID() const
Battleground & operator=(Battleground const &)=delete
uint32 m_PrematureCountDownTimer
void SetArenaTeamIdForTeam(Team team, uint32 ArenaTeamId)
void ProcessEvent(WorldObject *, uint32, WorldObject *) override
virtual WorldSafeLocsEntry const * GetExploitTeleportLocation(Team)
void SetArenaMatchmakerRating(Team team, uint32 MMR)
uint32 GetClientInstanceID() const
virtual bool IsSpellAllowed(uint32, Player const *) const
BattlegroundPlayer const * GetBattlegroundPlayerData(ObjectGuid const &playerGuid) const
void SetClientInstanceID(uint32 InstanceID)
static TeamId GetTeamIndexByTeamId(Team team)
void SetStatus(BattlegroundStatus Status)
virtual void StartingEventCloseDoors()
uint32 m_LastPlayerPositionBroadcast
void SetArenaType(uint8 type)
BattlegroundPlayerMap const & GetPlayers() const
int32 GetStartDelayTime() const
BattlegroundScoreMap PlayerScores
virtual void StartingEventOpenDoors()
virtual void SetDroppedFlagGUID(ObjectGuid, int32=-1)
std::vector< WorldPackets::Battleground::BattlegroundPlayerPosition > _playerPositions
BattlegroundStatus GetStatus() const
virtual void HandleKillUnit(Creature *, Unit *)
uint32 GetPlayersCountByTeam(Team team) const
virtual bool PreUpdateImpl(uint32)
Pre-update hook.
Trinity::unique_weak_ptr< Battleground > m_weakRef
virtual void CheckWinConditions()
std::map< ObjectGuid, BattlegroundPlayer > BattlegroundPlayerMap
std::map< ObjectGuid, BattlegroundScore * > BattlegroundScoreMap
virtual void DestroyGate(Player *, GameObject *)
std::unordered_set< uint32 > const * _pvpStatIds
virtual bool CanActivateGO(int32, uint32) const
virtual void EventPlayerDroppedFlag(Player *)
uint32 GetArenaMatchmakerRating(Team team) const
uint32 GetElapsedTime() const
Trinity::unique_weak_ptr< Battleground > GetWeakPtr() const
uint32 GetPlayersSize() const
Player * _GetPlayer(BattlegroundPlayerMap::iterator itr, char const *context)
void SetStartDelayTime(int Time)
void SetWeakPtr(Trinity::unique_weak_ptr< Battleground > weakRef)
Player * _GetPlayer(BattlegroundPlayerMap::const_iterator itr, char const *context) const
BattlegroundStatus m_Status
static ObjectGuid const Empty
virtual void TriggerGameEvent(uint32 gameEventId, WorldObject *source=nullptr, WorldObject *target=nullptr)
TC_GAME_API bool GetName(uint32 accountId, std::string &name)
void AddObject(T *object)
void Update(VignetteData &vignette, WorldObject const *owner)
BattlegroundQueueTypeId queueTypeId