mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7415] Fixed removing player from battlegrounds
Probably fixed bug with not ending battlegrounds - reported in previous commit message Fixed player will loose arena rating if 1. he doesn't click on enter rated arena window - and timer will expire 2. he logs out during time he is invited to rated arena match 3. if he logs out during fight in rated arena match Patch is not tested, i will test it as soon as possible. Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
parent
ee5feab3eb
commit
bd0619ce40
7 changed files with 112 additions and 109 deletions
|
|
@ -575,6 +575,28 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstRating)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstRating)
|
||||||
|
{
|
||||||
|
// called for offline player after ending rated arena match!
|
||||||
|
for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||||
|
{
|
||||||
|
if(itr->guid == guid)
|
||||||
|
{
|
||||||
|
// update personal rating
|
||||||
|
float chance = GetChanceAgainst(itr->personal_rating, againstRating);
|
||||||
|
int32 mod = (int32)ceil(32.0f * (0.0f - chance));
|
||||||
|
if (int32(itr->personal_rating) + mod < 0)
|
||||||
|
itr->personal_rating = 0;
|
||||||
|
else
|
||||||
|
itr->personal_rating += mod;
|
||||||
|
// update personal played stats
|
||||||
|
itr->games_week +=1;
|
||||||
|
itr->games_season +=1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
|
void ArenaTeam::MemberWon(Player * plr, uint32 againstRating)
|
||||||
{
|
{
|
||||||
// called for each participant after winning a match
|
// called for each participant after winning a match
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,7 @@ class ArenaTeam
|
||||||
void MemberWon(Player * plr, uint32 againstRating);
|
void MemberWon(Player * plr, uint32 againstRating);
|
||||||
int32 LostAgainst(uint32 againstRating);
|
int32 LostAgainst(uint32 againstRating);
|
||||||
void MemberLost(Player * plr, uint32 againstRating);
|
void MemberLost(Player * plr, uint32 againstRating);
|
||||||
|
void OfflineMemberLost(uint64 guid, uint32 againstRating);
|
||||||
|
|
||||||
void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
|
void UpdateArenaPointsHelper(std::map<uint32, uint32> & PlayerPoints);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -226,33 +226,10 @@ BattleGround::~BattleGround()
|
||||||
|
|
||||||
void BattleGround::Update(uint32 diff)
|
void BattleGround::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
if(!GetPlayersSize() && !GetRemovedPlayersSize() && !GetReviveQueueSize())
|
if(!GetPlayersSize() && !GetReviveQueueSize())
|
||||||
//BG is empty
|
//BG is empty
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(GetRemovedPlayersSize())
|
|
||||||
{
|
|
||||||
for(std::map<uint64, uint8>::iterator itr = m_RemovedPlayers.begin(); itr != m_RemovedPlayers.end(); ++itr)
|
|
||||||
{
|
|
||||||
Player *plr = objmgr.GetPlayer(itr->first);
|
|
||||||
switch(itr->second)
|
|
||||||
{
|
|
||||||
case 1: // currently in bg and was removed from bg
|
|
||||||
if(plr)
|
|
||||||
RemovePlayerAtLeave(itr->first, true, true);
|
|
||||||
else
|
|
||||||
RemovePlayerAtLeave(itr->first, false, false);
|
|
||||||
break;
|
|
||||||
case 2: // revive queue
|
|
||||||
RemovePlayerFromResurrectQueue(itr->first);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sLog.outError("BattleGround: Unknown remove player case!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_RemovedPlayers.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove offline players from bg after 5 minutes
|
// remove offline players from bg after 5 minutes
|
||||||
if( !m_OfflineQueue.empty() )
|
if( !m_OfflineQueue.empty() )
|
||||||
{
|
{
|
||||||
|
|
@ -261,7 +238,7 @@ void BattleGround::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
if( itr->second.OfflineRemoveTime <= sWorld.GetGameTime() )
|
if( itr->second.OfflineRemoveTime <= sWorld.GetGameTime() )
|
||||||
{
|
{
|
||||||
m_RemovedPlayers[itr->first] = 1; // add to remove list (BG)
|
RemovePlayerAtLeave(itr->first, true, true);// remove player from BG
|
||||||
m_OfflineQueue.pop_front(); // remove from offline queue
|
m_OfflineQueue.pop_front(); // remove from offline queue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -446,9 +423,7 @@ void BattleGround::Update(uint32 diff)
|
||||||
if(m_EndTime >= TIME_TO_AUTOREMOVE) // 2 minutes
|
if(m_EndTime >= TIME_TO_AUTOREMOVE) // 2 minutes
|
||||||
{
|
{
|
||||||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
{
|
RemovePlayerAtLeave(itr->first, true, true);// remove player from BG
|
||||||
m_RemovedPlayers[itr->first] = 1; // add to remove list (BG)
|
|
||||||
}
|
|
||||||
// do not change any battleground's private variables
|
// do not change any battleground's private variables
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -648,33 +623,17 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||||
// arena rating calculation
|
// arena rating calculation
|
||||||
if(isArena() && isRated())
|
if(isArena() && isRated())
|
||||||
{
|
{
|
||||||
if(winner == ALLIANCE)
|
winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner));
|
||||||
{
|
loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));
|
||||||
winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(ALLIANCE));
|
if( winner_arena_team && loser_arena_team )
|
||||||
loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(HORDE));
|
|
||||||
}
|
|
||||||
else if(winner == HORDE)
|
|
||||||
{
|
|
||||||
winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(HORDE));
|
|
||||||
loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(ALLIANCE));
|
|
||||||
}
|
|
||||||
if(winner_arena_team && loser_arena_team)
|
|
||||||
{
|
{
|
||||||
loser_rating = loser_arena_team->GetStats().rating;
|
loser_rating = loser_arena_team->GetStats().rating;
|
||||||
winner_rating = winner_arena_team->GetStats().rating;
|
winner_rating = winner_arena_team->GetStats().rating;
|
||||||
int32 winner_change = winner_arena_team->WonAgainst(loser_rating);
|
int32 winner_change = winner_arena_team->WonAgainst(loser_rating);
|
||||||
int32 loser_change = loser_arena_team->LostAgainst(winner_rating);
|
int32 loser_change = loser_arena_team->LostAgainst(winner_rating);
|
||||||
sLog.outDebug("--- Winner rating: %u, Loser rating: %u, Winner change: %u, Losser change: %u ---", winner_rating, loser_rating, winner_change, loser_change);
|
sLog.outDebug("--- Winner rating: %u, Loser rating: %u, Winner change: %u, Losser change: %u ---", winner_rating, loser_rating, winner_change, loser_change);
|
||||||
if(winner == ALLIANCE)
|
SetArenaTeamRatingChangeForTeam(winner, winner_change);
|
||||||
{
|
SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change);
|
||||||
SetArenaTeamRatingChangeForTeam(ALLIANCE, winner_change);
|
|
||||||
SetArenaTeamRatingChangeForTeam(HORDE, loser_change);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetArenaTeamRatingChangeForTeam(HORDE, winner_change);
|
|
||||||
SetArenaTeamRatingChangeForTeam(ALLIANCE, loser_change);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -686,8 +645,18 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
{
|
{
|
||||||
Player *plr = objmgr.GetPlayer(itr->first);
|
Player *plr = objmgr.GetPlayer(itr->first);
|
||||||
|
uint32 team = itr->second.Team;
|
||||||
|
|
||||||
if(!plr)
|
if(!plr)
|
||||||
{
|
{
|
||||||
|
//if rated arena match - make member lost!
|
||||||
|
if(isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||||
|
{
|
||||||
|
if(team == winner)
|
||||||
|
winner_arena_team->OfflineMemberLost(itr->first, loser_rating);
|
||||||
|
else
|
||||||
|
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
|
||||||
|
}
|
||||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -702,8 +671,8 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||||
plr->SpawnCorpseBones();
|
plr->SpawnCorpseBones();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 team = itr->second.Team;
|
//this line is obsolete - team is set ALWAYS
|
||||||
if(!team) team = plr->GetTeam();
|
//if(!team) team = plr->GetTeam();
|
||||||
|
|
||||||
// per player calculation
|
// per player calculation
|
||||||
if(isArena() && isRated() && winner_arena_team && loser_arena_team)
|
if(isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||||
|
|
@ -937,16 +906,16 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||||
|
|
||||||
RemovePlayer(plr, guid); // BG subclass specific code
|
RemovePlayer(plr, guid); // BG subclass specific code
|
||||||
|
|
||||||
if(plr)
|
if(participant) // if the player was a match participant, remove auras, calc rating, update queue
|
||||||
{
|
{
|
||||||
plr->ClearAfkReports();
|
BattleGroundTypeId bgTypeId = GetTypeID();
|
||||||
|
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||||
if(participant) // if the player was a match participant, remove auras, calc rating, update queue
|
if(plr)
|
||||||
{
|
{
|
||||||
|
plr->ClearAfkReports();
|
||||||
|
|
||||||
if(!team) team = plr->GetTeam();
|
if(!team) team = plr->GetTeam();
|
||||||
|
|
||||||
BattleGroundTypeId bgTypeId = GetTypeID();
|
|
||||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
|
||||||
// if arena, remove the specific arena auras
|
// if arena, remove the specific arena auras
|
||||||
if(isArena())
|
if(isArena())
|
||||||
{
|
{
|
||||||
|
|
@ -966,56 +935,56 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||||
if(isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
if(isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||||
{
|
{
|
||||||
//left a rated match while the encounter was in progress, consider as loser
|
//left a rated match while the encounter was in progress, consider as loser
|
||||||
ArenaTeam * winner_arena_team = 0;
|
ArenaTeam * winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||||
ArenaTeam * loser_arena_team = 0;
|
ArenaTeam * loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||||
if(team == HORDE)
|
|
||||||
{
|
|
||||||
winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(ALLIANCE));
|
|
||||||
loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(HORDE));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(HORDE));
|
|
||||||
loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(ALLIANCE));
|
|
||||||
}
|
|
||||||
if(winner_arena_team && loser_arena_team)
|
if(winner_arena_team && loser_arena_team)
|
||||||
{
|
|
||||||
loser_arena_team->MemberLost(plr,winner_arena_team->GetRating());
|
loser_arena_team->MemberLost(plr,winner_arena_team->GetRating());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldPacket data;
|
|
||||||
if(SendPacket)
|
if(SendPacket)
|
||||||
{
|
{
|
||||||
|
WorldPacket data;
|
||||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, team, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0);
|
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, team, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0);
|
||||||
plr->GetSession()->SendPacket(&data);
|
plr->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this call is important, because player, when joins to battleground, this method is not called, so it must be called when leaving bg
|
// this call is important, because player, when joins to battleground, this method is not called, so it must be called when leaving bg
|
||||||
plr->RemoveBattleGroundQueueId(bgQueueTypeId);
|
plr->RemoveBattleGroundQueueId(bgQueueTypeId);
|
||||||
|
}
|
||||||
DecreaseInvitedCount(team);
|
else
|
||||||
//we should update battleground queue, but only if bg isn't ending
|
// removing offline participant
|
||||||
if (GetStatus() < STATUS_WAIT_LEAVE)
|
{
|
||||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId());
|
if(isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||||
|
|
||||||
Group * group = plr->GetGroup();
|
|
||||||
// remove from raid group if exist
|
|
||||||
if(group && group == GetBgRaid(team))
|
|
||||||
{
|
{
|
||||||
if(!group->RemoveMember(guid, 0)) // group was disbanded
|
//left a rated match while the encounter was in progress, consider as loser
|
||||||
{
|
ArenaTeam * others_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||||
SetBgRaid(team, NULL);
|
ArenaTeam * players_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||||
delete group;
|
if( others_arena_team && players_arena_team )
|
||||||
}
|
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let others know
|
|
||||||
sBattleGroundMgr.BuildPlayerLeftBattleGroundPacket(&data, plr);
|
|
||||||
SendPacketToTeam(team, &data, plr, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove from raid group if player is member
|
||||||
|
if(Group *group = GetBgRaid(team))
|
||||||
|
{
|
||||||
|
if( !group->RemoveMember(guid, 0) ) // group was disbanded
|
||||||
|
{
|
||||||
|
SetBgRaid(team, NULL);
|
||||||
|
delete group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DecreaseInvitedCount(team);
|
||||||
|
//we should update battleground queue, but only if bg isn't ending
|
||||||
|
if( isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE )
|
||||||
|
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId());
|
||||||
|
// Let others know
|
||||||
|
WorldPacket data;
|
||||||
|
sBattleGroundMgr.BuildPlayerLeftBattleGroundPacket(&data, guid);
|
||||||
|
SendPacketToTeam(team, &data, plr, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( plr )
|
||||||
|
{
|
||||||
// Do next only if found in battleground
|
// Do next only if found in battleground
|
||||||
plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
|
plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
|
||||||
// reset destination bg team
|
// reset destination bg team
|
||||||
|
|
@ -1024,7 +993,6 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
||||||
if(Transport)
|
if(Transport)
|
||||||
plr->TeleportTo(plr->GetBattleGroundEntryPoint());
|
plr->TeleportTo(plr->GetBattleGroundEntryPoint());
|
||||||
|
|
||||||
// Log
|
|
||||||
sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName());
|
sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1188,6 +1156,8 @@ void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid)
|
||||||
}
|
}
|
||||||
m_Players[plr_guid].OfflineRemoveTime = 0;
|
m_Players[plr_guid].OfflineRemoveTime = 0;
|
||||||
PlayerAddedToBGCheckIfBGIsRunning(player);
|
PlayerAddedToBGCheckIfBGIsRunning(player);
|
||||||
|
// if battleground is starting, then add preparation aura
|
||||||
|
// we don't have to do that, because preparation aura isn't removed when player logs out
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method should be called when player logs out from running battleground
|
// This method should be called when player logs out from running battleground
|
||||||
|
|
@ -1683,6 +1653,11 @@ uint32 BattleGround::GetPlayerTeam(uint64 guid)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 BattleGround::GetOtherTeam(uint32 teamId)
|
||||||
|
{
|
||||||
|
return (teamId) ? ((teamId == ALLIANCE) ? HORDE : ALLIANCE) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool BattleGround::IsPlayerInBattleGround(uint64 guid)
|
bool BattleGround::IsPlayerInBattleGround(uint64 guid)
|
||||||
{
|
{
|
||||||
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
|
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
|
||||||
|
|
|
||||||
|
|
@ -367,7 +367,6 @@ class BattleGround
|
||||||
typedef std::map<uint64, BattleGroundPlayer> BattleGroundPlayerMap;
|
typedef std::map<uint64, BattleGroundPlayer> BattleGroundPlayerMap;
|
||||||
BattleGroundPlayerMap const& GetPlayers() const { return m_Players; }
|
BattleGroundPlayerMap const& GetPlayers() const { return m_Players; }
|
||||||
uint32 GetPlayersSize() const { return m_Players.size(); }
|
uint32 GetPlayersSize() const { return m_Players.size(); }
|
||||||
uint32 GetRemovedPlayersSize() const { return m_RemovedPlayers.size(); }
|
|
||||||
|
|
||||||
std::map<uint64, BattleGroundScore*>::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); }
|
std::map<uint64, BattleGroundScore*>::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); }
|
||||||
std::map<uint64, BattleGroundScore*>::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); }
|
std::map<uint64, BattleGroundScore*>::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); }
|
||||||
|
|
@ -491,6 +490,7 @@ class BattleGround
|
||||||
|
|
||||||
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
|
// since arenas can be AvA or Hvh, we have to get the "temporary" team of a player
|
||||||
uint32 GetPlayerTeam(uint64 guid);
|
uint32 GetPlayerTeam(uint64 guid);
|
||||||
|
uint32 GetOtherTeam(uint32 teamId);
|
||||||
bool IsPlayerInBattleGround(uint64 guid);
|
bool IsPlayerInBattleGround(uint64 guid);
|
||||||
|
|
||||||
void SetDeleteThis() {m_SetDeleteThis = true;}
|
void SetDeleteThis() {m_SetDeleteThis = true;}
|
||||||
|
|
@ -544,7 +544,6 @@ class BattleGround
|
||||||
/* Player lists */
|
/* Player lists */
|
||||||
std::vector<uint64> m_ResurrectQueue; // Player GUID
|
std::vector<uint64> m_ResurrectQueue; // Player GUID
|
||||||
std::deque<uint64> m_OfflineQueue; // Player GUID
|
std::deque<uint64> m_OfflineQueue; // Player GUID
|
||||||
std::map<uint64, uint8> m_RemovedPlayers; // uint8 is remove type (0 - bgqueue, 1 - bg, 2 - resurrect queue)
|
|
||||||
|
|
||||||
/* 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 */
|
/* 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 */
|
||||||
/* Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG */
|
/* Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG */
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||||
}
|
}
|
||||||
sLog.outDebug("BattleGroundQueue: Removing player GUID %u, from queue_id %u", GUID_LOPART(guid), (uint32)queue_id);
|
sLog.outDebug("BattleGroundQueue: Removing player GUID %u, from queue_id %u", GUID_LOPART(guid), (uint32)queue_id);
|
||||||
|
|
||||||
// ALL variables are corrcetly set
|
// ALL variables are correctly set
|
||||||
// We can ignore leveling up in queue - it should not cause crash
|
// We can ignore leveling up in queue - it should not cause crash
|
||||||
// remove player from group
|
// remove player from group
|
||||||
// if only one player there, remove group
|
// if only one player there, remove group
|
||||||
|
|
@ -259,6 +259,22 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
|
||||||
if( (decreaseInvitedCount && !group->ArenaType) || (group->ArenaType && group->IsRated && group->Players.empty()) )
|
if( (decreaseInvitedCount && !group->ArenaType) || (group->ArenaType && group->IsRated && group->Players.empty()) )
|
||||||
AnnounceWorld(group, guid, false);
|
AnnounceWorld(group, guid, false);
|
||||||
|
|
||||||
|
//if player leaves queue and he is invited to rated arena match, then he have to loose
|
||||||
|
if( group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount )
|
||||||
|
{
|
||||||
|
ArenaTeam * at = objmgr.GetArenaTeamById(group->ArenaTeamId);
|
||||||
|
if( at )
|
||||||
|
{
|
||||||
|
sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
|
||||||
|
Player *plr = objmgr.GetPlayer(guid);
|
||||||
|
if( plr )
|
||||||
|
at->MemberLost(plr, group->OpponentsTeamRating);
|
||||||
|
else
|
||||||
|
at->OfflineMemberLost(guid, group->OpponentsTeamRating);
|
||||||
|
at->SaveToDB();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// remove group queue info if needed
|
// remove group queue info if needed
|
||||||
if( group->Players.empty() )
|
if( group->Players.empty() )
|
||||||
{
|
{
|
||||||
|
|
@ -1032,16 +1048,6 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||||
BattleGroundQueue::QueuedPlayersMap::iterator qMapItr = qpMap.find(m_PlayerGuid);
|
BattleGroundQueue::QueuedPlayersMap::iterator qMapItr = qpMap.find(m_PlayerGuid);
|
||||||
if (qMapItr != qpMap.end() && qMapItr->second.GroupInfo && qMapItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID)
|
if (qMapItr != qpMap.end() && qMapItr->second.GroupInfo && qMapItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID)
|
||||||
{
|
{
|
||||||
if (qMapItr->second.GroupInfo->IsRated)
|
|
||||||
{
|
|
||||||
ArenaTeam * at = objmgr.GetArenaTeamById(qMapItr->second.GroupInfo->ArenaTeamId);
|
|
||||||
if (at)
|
|
||||||
{
|
|
||||||
sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(plr->GetGUID()), qMapItr->second.GroupInfo->OpponentsTeamRating);
|
|
||||||
at->MemberLost(plr, qMapItr->second.GroupInfo->OpponentsTeamRating);
|
|
||||||
at->SaveToDB();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plr->RemoveBattleGroundQueueId(bgQueueTypeId);
|
plr->RemoveBattleGroundQueueId(bgQueueTypeId);
|
||||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(m_PlayerGuid, true);
|
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(m_PlayerGuid, true);
|
||||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bg->GetTypeID(), bg->GetQueueId());
|
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bg->GetTypeID(), bg->GetQueueId());
|
||||||
|
|
@ -1388,10 +1394,10 @@ void BattleGroundMgr::BuildPlaySoundPacket(WorldPacket *data, uint32 soundid)
|
||||||
*data << uint32(soundid);
|
*data << uint32(soundid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket *data, Player *plr)
|
void BattleGroundMgr::BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid)
|
||||||
{
|
{
|
||||||
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
|
data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8);
|
||||||
*data << uint64(plr->GetGUID());
|
*data << uint64(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr)
|
void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr)
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class BattleGroundMgr
|
||||||
|
|
||||||
/* Packet Building */
|
/* Packet Building */
|
||||||
void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr);
|
void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr);
|
||||||
void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, Player *plr);
|
void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, const uint64& guid);
|
||||||
void BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player *plr, BattleGroundTypeId bgTypeId);
|
void BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player *plr, BattleGroundTypeId bgTypeId);
|
||||||
void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, BattleGroundTypeId bgTypeId);
|
void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, BattleGroundTypeId bgTypeId);
|
||||||
void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value);
|
void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7414"
|
#define REVISION_NR "7415"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue