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

#include <Arena.h>

Protected Member Functions

 Arena ()
 
void AddPlayer (Player *player) override
 
void RemovePlayer (Player *, ObjectGuid, uint32) override
 
void FillInitialWorldStates (WorldPackets::WorldState::InitWorldStates &packet) override
 
void UpdateArenaWorldState ()
 
void HandleKillPlayer (Player *player, Player *killer) override
 
- Protected Member Functions inherited from Battleground
void EndNow ()
 
void PlayerAddedToBGCheckIfBGIsRunning (Player *player)
 
Player_GetPlayer (ObjectGuid guid, bool offlineRemove, const char *context) const
 
Player_GetPlayer (BattlegroundPlayerMap::iterator itr, const char *context)
 
Player_GetPlayer (BattlegroundPlayerMap::const_iterator itr, const char *context) const
 
Player_GetPlayerForTeam (uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char *context) const
 
virtual bool PreUpdateImpl (uint32)
 Pre-update hook. More...
 
virtual void PostUpdateImpl (uint32)
 Post-update hook. More...
 
void _ProcessOfflineQueue ()
 
void _ProcessResurrect (uint32 diff)
 
void _ProcessProgress (uint32 diff)
 
void _ProcessLeave (uint32 diff)
 
void _ProcessJoin (uint32 diff)
 
void _CheckSafePositions (uint32 diff)
 
void _ProcessPlayerPositionBroadcast (uint32 diff)
 
virtual void GetPlayerPositionData (std::vector< WorldPackets::Battleground::BattlegroundPlayerPosition > *) const
 

Private Member Functions

void RemovePlayerAtLeave (ObjectGuid guid, bool transport, bool sendPacket) override
 
void CheckWinConditions () override
 
void EndBattleground (uint32 winner) override
 

Additional Inherited Members

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

Constructor & Destructor Documentation

Arena::Arena ( )
protected
30 {
35 
40 }
Definition: Battleground.h:199
Definition: Battleground.h:142
Definition: Battleground.h:200
BattlegroundStartTimeIntervals StartDelayTimes[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:554
Definition: Language.h:703
Definition: Language.h:704
Definition: Battleground.h:198
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:556
Definition: Battleground.h:139
Definition: Battleground.h:140
Definition: Battleground.h:141
Definition: Language.h:702
Definition: Language.h:701
Definition: Battleground.h:197

Member Function Documentation

void Arena::AddPlayer ( Player player)
overrideprotectedvirtual

Reimplemented from Battleground.

43 {
45  PlayerScores[player->GetGUID()] = new ArenaScore(player->GetGUID(), player->GetBGTeam());
46 
47  if (player->GetBGTeam() == ALLIANCE) // gold
48  {
49  if (player->GetTeam() == HORDE)
50  player->CastSpell(player, SPELL_HORDE_GOLD_FLAG, true);
51  else
52  player->CastSpell(player, SPELL_ALLIANCE_GOLD_FLAG, true);
53  }
54  else // green
55  {
56  if (player->GetTeam() == HORDE)
57  player->CastSpell(player, SPELL_HORDE_GREEN_FLAG, true);
58  else
59  player->CastSpell(player, SPELL_ALLIANCE_GREEN_FLAG, true);
60  }
61 
63 }
Definition: Arena.h:27
Definition: Arena.h:25
Definition: Arena.h:28
Definition: SharedDefines.h:1000
Definition: ArenaScore.h:26
Definition: SharedDefines.h:999
virtual void AddPlayer(Player *player)
Definition: Battleground.cpp:1079
void UpdateArenaWorldState()
Definition: Arena.cpp:80
Definition: Arena.h:26
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:543

+ Here is the call graph for this function:

void Arena::CheckWinConditions ( )
overrideprivatevirtual

Reimplemented from Battleground.

126 {
131 }
uint32 GetAlivePlayersCountByTeam(uint32 Team) const
Definition: Battleground.cpp:1860
Definition: SharedDefines.h:1000
Definition: SharedDefines.h:999
void EndBattleground(uint32 winner) override
Definition: Arena.cpp:133
uint32 GetPlayersCountByTeam(uint32 Team) const
Definition: Battleground.h:400

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Arena::EndBattleground ( uint32  winner)
overrideprivatevirtual

Reimplemented from Battleground.

134 {
135  // arena rating calculation
136  if (isRated())
137  {
138  uint32 loserTeamRating = 0;
139  uint32 loserMatchmakerRating = 0;
140  int32 loserChange = 0;
141  int32 loserMatchmakerChange = 0;
142  uint32 winnerTeamRating = 0;
143  uint32 winnerMatchmakerRating = 0;
144  int32 winnerChange = 0;
145  int32 winnerMatchmakerChange = 0;
146  bool guildAwarded = false;
147 
148  ArenaTeam* winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner));
149  ArenaTeam* loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));
150 
151  if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
152  {
153  loserTeamRating = loserArenaTeam->GetRating();
154  loserMatchmakerRating = GetArenaMatchmakerRating(GetOtherTeam(winner));
155  winnerTeamRating = winnerArenaTeam->GetRating();
156  winnerMatchmakerRating = GetArenaMatchmakerRating(winner);
157 
158  if (winner != 0)
159  {
160  winnerMatchmakerChange = winnerArenaTeam->WonAgainst(winnerMatchmakerRating, loserMatchmakerRating, winnerChange);
161  loserMatchmakerChange = loserArenaTeam->LostAgainst(loserMatchmakerRating, winnerMatchmakerRating, loserChange);
162 
163  TC_LOG_DEBUG("bg.arena", "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---",
164  GetArenaType(), winnerTeamRating, winnerChange, winnerMatchmakerRating, winnerMatchmakerChange,
165  loserTeamRating, loserChange, loserMatchmakerRating, loserMatchmakerChange);
166 
167  SetArenaMatchmakerRating(winner, winnerMatchmakerRating + winnerMatchmakerChange);
168  SetArenaMatchmakerRating(GetOtherTeam(winner), loserMatchmakerRating + loserMatchmakerChange);
169 
170  // bg team that the client expects is different to TeamId
171  // alliance 1, horde 0
172  uint8 winnerTeam = winner == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE;
173  uint8 loserTeam = winner == ALLIANCE ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE;
174 
175  _arenaTeamScores[winnerTeam].Assign(winnerTeamRating, winnerTeamRating + winnerChange, winnerMatchmakerRating);
176  _arenaTeamScores[loserTeam].Assign(loserTeamRating, loserTeamRating + loserChange, loserMatchmakerRating);
177 
178  TC_LOG_DEBUG("bg.arena", "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d",
179  GetArenaType(), GetArenaTeamIdByIndex(TEAM_ALLIANCE), GetArenaTeamIdByIndex(TEAM_HORDE), winnerArenaTeam->GetId(), winnerChange, loserChange);
180 
181  if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
182  for (auto const& score : PlayerScores)
183  if (Player* player = ObjectAccessor::FindConnectedPlayer(score.first))
184  {
185  TC_LOG_DEBUG("bg.arena", "Statistics match Type: %u for %s (%s, Team: %d, IP: %s): %s",
186  GetArenaType(), player->GetName().c_str(), score.first.ToString().c_str(), player->GetArenaTeamId(GetArenaType() == 5 ? 2 : GetArenaType() == 3),
187  player->GetSession()->GetRemoteAddress().c_str(), score.second->ToString().c_str());
188  }
189  }
190  // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
191  else
192  {
193  _arenaTeamScores[BG_TEAM_ALLIANCE].Assign(winnerTeamRating, winnerTeamRating + ARENA_TIMELIMIT_POINTS_LOSS, winnerMatchmakerRating);
194  _arenaTeamScores[BG_TEAM_HORDE].Assign(loserTeamRating, loserTeamRating + ARENA_TIMELIMIT_POINTS_LOSS, loserMatchmakerRating);
195 
196  winnerArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
197  loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
198  }
199 
200  uint8 aliveWinners = GetAlivePlayersCountByTeam(winner);
201 
202  for (auto const& i : GetPlayers())
203  {
204  uint32 team = i.second.Team;
205 
206  if (i.second.OfflineRemoveTime)
207  {
208  // if rated arena match - make member lost!
209  if (team == winner)
210  winnerArenaTeam->OfflineMemberLost(i.first, loserMatchmakerRating, winnerMatchmakerChange);
211  else
212  loserArenaTeam->OfflineMemberLost(i.first, winnerMatchmakerRating, loserMatchmakerChange);
213  continue;
214  }
215 
216  Player* player = _GetPlayer(i.first, i.second.OfflineRemoveTime != 0, "Arena::EndBattleground");
217  if (!player)
218  continue;
219 
220  // per player calculation
221  if (team == winner)
222  {
223  // update achievement BEFORE personal rating update
224  uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
225  player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
226  player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());
228 
229  // Last standing - Rated 5v5 arena & be solely alive player
230  if (GetArenaType() == ARENA_TYPE_5v5 && aliveWinners == 1 && player->IsAlive())
231  player->CastSpell(player, SPELL_LAST_MAN_STANDING, true);
232 
233  if (!guildAwarded)
234  {
235  guildAwarded = true;
236  if (ObjectGuid::LowType guildId = GetBgMap()->GetOwnerGuildId(player->GetBGTeam()))
237  if (Guild* guild = sGuildMgr->GetGuildById(guildId))
238  guild->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, std::max<uint32>(winnerArenaTeam->GetRating(), 1), 0, 0, NULL, player);
239  }
240 
241  winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);
242  }
243  else
244  {
245  loserArenaTeam->MemberLost(player, winnerMatchmakerRating, loserMatchmakerChange);
246 
247  // Arena lost => reset the win_rated_arena having the "no_lose" condition
249  }
250  }
251 
252  // save the stat changes
253  winnerArenaTeam->SaveToDB();
254  loserArenaTeam->SaveToDB();
255  // send updated arena team stats to players
256  // this way all arena team members will get notified, not only the ones who participated in this match
257  winnerArenaTeam->NotifyStatsChanged();
258  loserArenaTeam->NotifyStatsChanged();
259  }
260  }
261 
262  // end battleground
264 }
Definition: Battleground.h:183
Definition: DBCEnums.h:109
int32 LostAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32 &rating_change)
Definition: ArenaTeam.cpp:637
uint32 GetOtherTeam(uint32 teamId) const
Definition: Battleground.cpp:1829
#define sGuildMgr
Definition: GuildMgr.h:61
Definition: Arena.h:30
void SetArenaMatchmakerRating(uint32 Team, uint32 MMR)
Definition: Battleground.h:416
arena_t NULL
Definition: jemalloc_internal.h:624
BattlegroundMap * GetBgMap() const
Definition: Battleground.h:356
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: DBCEnums.h:762
BattlegroundPlayerMap const & GetPlayers() const
Definition: Battleground.h:331
#define sWorld
Definition: World.h:887
uint64 LowType
Definition: ObjectGuid.h:199
uint32 GetAlivePlayersCountByTeam(uint32 Team) const
Definition: Battleground.cpp:1860
Definition: DBCEnums.h:224
ArenaTeamScore _arenaTeamScores[BG_TEAMS_COUNT]
Definition: Battleground.h:564
Definition: SharedDefines.h:1000
bool isRated() const
Definition: Battleground.h:328
uint32 GetRating() const
Definition: ArenaTeam.h:133
#define ARENA_TIMELIMIT_POINTS_LOSS
Definition: Battleground.h:212
void MemberLost(Player *player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange=-12)
Definition: ArenaTeam.cpp:653
void FinishGame(int32 mod)
Definition: ArenaTeam.cpp:588
int32 WonAgainst(uint32 Own_MMRating, uint32 Opponent_MMRating, int32 &rating_change)
Definition: ArenaTeam.cpp:617
uint8 GetArenaType() const
Definition: Battleground.h:281
void NotifyStatsChanged()
Definition: ArenaTeam.cpp:402
void Assign(int32 oldRating, int32 newRating, uint32 matchMakerRating)
Definition: ArenaScore.h:63
uint32 GetId() const
Definition: ArenaTeam.h:124
uint32 GetArenaTeamIdForTeam(uint32 Team) const
Definition: Battleground.h:414
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
uint32 GetArenaTeamIdByIndex(uint32 index) const
Definition: Battleground.h:415
Definition: SharedDefines.h:992
void SaveToDB()
Definition: ArenaTeam.cpp:728
Definition: World.h:141
Definition: SharedDefines.h:4551
Definition: ArenaTeam.h:112
Player * _GetPlayer(ObjectGuid guid, bool offlineRemove, const char *context) const
Definition: Battleground.cpp:617
uint8 GetSlot() const
Definition: ArenaTeam.h:126
uint8_t uint8
Definition: Define.h:152
uint32 GetArenaMatchmakerRating(uint32 Team) const
Definition: Battleground.h:417
uint32 GetMapId() const
Definition: Battleground.h:352
Definition: SharedDefines.h:4550
#define sArenaTeamMgr
Definition: ArenaTeamMgr.h:53
virtual void EndBattleground(uint32 winner)
Definition: Battleground.cpp:744
Definition: SharedDefines.h:993
Definition: Guild.h:320
void OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange=-12)
Definition: ArenaTeam.cpp:679
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:215
void MemberWon(Player *player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange)
Definition: ArenaTeam.cpp:701
BattlegroundScoreMap PlayerScores
Definition: Battleground.h:543

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Arena::FillInitialWorldStates ( WorldPackets::WorldState::InitWorldStates packet)
overrideprotectedvirtual

Reimplemented from Battleground.

Reimplemented in BattlegroundDS, BattlegroundRV, BattlegroundBE, BattlegroundNA, and BattlegroundRL.

75 {
78 }
std::list< WorldStateInfo > Worldstates
Definition: WorldStatePackets.h:47
uint32 GetAlivePlayersCountByTeam(uint32 Team) const
Definition: Battleground.cpp:1860
Definition: SharedDefines.h:1000
Definition: SharedDefines.h:999
int32_t int32
Definition: g3dmath.h:167
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Arena::HandleKillPlayer ( Player player,
Player killer 
)
overrideprotectedvirtual

Reimplemented from Battleground.

87 {
89  return;
90 
91  Battleground::HandleKillPlayer(player, killer);
92 
95 }
Definition: Battleground.h:159
virtual void HandleKillPlayer(Player *player, Player *killer)
Definition: Battleground.cpp:1784
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266
void UpdateArenaWorldState()
Definition: Arena.cpp:80
void CheckWinConditions() override
Definition: Arena.cpp:125

+ Here is the call graph for this function:

void Arena::RemovePlayer ( Player ,
ObjectGuid  ,
uint32   
)
overrideprotectedvirtual

Reimplemented from Battleground.

66 {
68  return;
69 
72 }
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266
Definition: Battleground.h:160
void UpdateArenaWorldState()
Definition: Arena.cpp:80
void CheckWinConditions() override
Definition: Arena.cpp:125

+ Here is the call graph for this function:

void Arena::RemovePlayerAtLeave ( ObjectGuid  guid,
bool  transport,
bool  sendPacket 
)
overrideprivatevirtual

Reimplemented from Battleground.

98 {
99  if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
100  {
101  BattlegroundPlayerMap::const_iterator itr = m_Players.find(guid);
102  if (itr != m_Players.end()) // check if the player was a participant of the match, or only entered through gm command (appear)
103  {
104  // if the player was a match participant, calculate rating
105  uint32 team = itr->second.Team;
106 
107  ArenaTeam* winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
108  ArenaTeam* loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team));
109 
110  // left a rated match while the encounter was in progress, consider as loser
111  if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
112  {
113  if (Player* player = _GetPlayer(itr->first, itr->second.OfflineRemoveTime != 0, "Arena::RemovePlayerAtLeave"))
114  loserArenaTeam->MemberLost(player, GetArenaMatchmakerRating(GetOtherTeam(team)));
115  else
116  loserArenaTeam->OfflineMemberLost(guid, GetArenaMatchmakerRating(GetOtherTeam(team)));
117  }
118  }
119  }
120 
121  // remove player
122  Battleground::RemovePlayerAtLeave(guid, transport, sendPacket);
123 }
Definition: Battleground.h:159
uint32 GetOtherTeam(uint32 teamId) const
Definition: Battleground.cpp:1829
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266
BattlegroundPlayerMap m_Players
Definition: Battleground.h:548
bool isRated() const
Definition: Battleground.h:328
void MemberLost(Player *player, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange=-12)
Definition: ArenaTeam.cpp:653
uint32 GetArenaTeamIdForTeam(uint32 Team) const
Definition: Battleground.h:414
uint32_t uint32
Definition: Define.h:150
Definition: ArenaTeam.h:112
Player * _GetPlayer(ObjectGuid guid, bool offlineRemove, const char *context) const
Definition: Battleground.cpp:617
uint32 GetArenaMatchmakerRating(uint32 Team) const
Definition: Battleground.h:417
#define sArenaTeamMgr
Definition: ArenaTeamMgr.h:53
virtual void RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool SendPacket)
Definition: Battleground.cpp:919
void OfflineMemberLost(ObjectGuid guid, uint32 againstMatchmakerRating, int32 MatchmakerRatingChange=-12)
Definition: ArenaTeam.cpp:679

+ Here is the call graph for this function:

void Arena::UpdateArenaWorldState ( )
protected
81 {
84 }
uint32 GetAlivePlayersCountByTeam(uint32 Team) const
Definition: Battleground.cpp:1860
Definition: SharedDefines.h:1000
Definition: SharedDefines.h:999
void UpdateWorldState(uint32 variable, uint32 value, bool hidden=false)
Definition: Battleground.cpp:735

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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