mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[8926] BattleGround: call correct function at playerleave
it will now correctly drop the flag and correctly remove the player from
eye of the storm objectives
+ also avoid the spamming of all "Player not found!" messages in battlegrounds
maybe all existing "player not found!" places should now get an assert(false)
since this shouldn't happen anymore
+ also better error output in GetBattleGroundQueueIdFromLevel
This commit is contained in:
parent
8c1ea4f444
commit
1de6692e04
5 changed files with 33 additions and 21 deletions
|
|
@ -519,11 +519,13 @@ void BattleGround::SendPacketToAll(WorldPacket *packet)
|
||||||
{
|
{
|
||||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
if (itr->second.OfflineRemoveTime)
|
||||||
|
continue;
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
if (plr)
|
if (plr)
|
||||||
plr->GetSession()->SendPacket(packet);
|
plr->GetSession()->SendPacket(packet);
|
||||||
else
|
else
|
||||||
sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
sLog.outError("BattleGround:SendPacketToAll: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -531,11 +533,12 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *
|
||||||
{
|
{
|
||||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
if (itr->second.OfflineRemoveTime)
|
||||||
|
continue;
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
|
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
sLog.outError("BattleGround:SendPacketToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -563,11 +566,13 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
||||||
|
|
||||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
if (itr->second.OfflineRemoveTime)
|
||||||
|
continue;
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
|
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
sLog.outError("BattleGround:PlaySoundToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -586,11 +591,13 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
|
||||||
{
|
{
|
||||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
if (itr->second.OfflineRemoveTime)
|
||||||
|
continue;
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
|
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
sLog.outError("BattleGround:CastSpellOnTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -606,11 +613,13 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
|
||||||
{
|
{
|
||||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
if (itr->second.OfflineRemoveTime)
|
||||||
|
continue;
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
|
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
sLog.outError("BattleGround:RewardHonorToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -631,11 +640,13 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
||||||
|
|
||||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
if (itr->second.OfflineRemoveTime)
|
||||||
|
continue;
|
||||||
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
|
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
sLog.outError("BattleGround:RewardReputationToTeam: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -721,10 +732,9 @@ 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 = sObjectMgr.GetPlayer(itr->first);
|
|
||||||
uint32 team = itr->second.Team;
|
uint32 team = itr->second.Team;
|
||||||
|
|
||||||
if (!plr)
|
if (itr->second.OfflineRemoveTime)
|
||||||
{
|
{
|
||||||
//if rated arena match - make member lost!
|
//if rated arena match - make member lost!
|
||||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||||
|
|
@ -734,9 +744,11 @@ void BattleGround::EndBattleGround(uint32 winner)
|
||||||
else
|
else
|
||||||
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
|
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
|
||||||
}
|
}
|
||||||
sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Player *plr = sObjectMgr.GetPlayer(itr->first);
|
||||||
|
if (!plr)
|
||||||
|
sLog.outError("BattleGround:EndBattleGround Player (GUID: %u) not found!", GUID_LOPART(itr->first));
|
||||||
|
|
||||||
// should remove spirit of redemption
|
// should remove spirit of redemption
|
||||||
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||||
|
|
@ -1285,14 +1297,13 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
|
||||||
m_Players[player->GetGUID()].OfflineRemoveTime = sWorld.GetGameTime() + MAX_OFFLINE_TIME;
|
m_Players[player->GetGUID()].OfflineRemoveTime = sWorld.GetGameTime() + MAX_OFFLINE_TIME;
|
||||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||||
{
|
{
|
||||||
if (isBattleGround())
|
// drop flag and handle other cleanups
|
||||||
EventPlayerDroppedFlag(player);
|
RemovePlayer(player, player->GetGUID());
|
||||||
else
|
|
||||||
{
|
// 1 player is logging out, if it is the last, then end arena!
|
||||||
//1 player is logging out, if it is the last, then end arena!
|
if (isArena())
|
||||||
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
|
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
|
||||||
EndBattleGround(GetOtherTeam(player->GetTeam()));
|
EndBattleGround(GetOtherTeam(player->GetTeam()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
|
||||||
Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[BG_EY_NODES_MAX][j]);
|
Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[BG_EY_NODES_MAX][j]);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGroundEY: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[BG_EY_NODES_MAX][j]));
|
sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[BG_EY_NODES_MAX][j]));
|
||||||
++j;
|
++j;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -170,7 +170,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
|
||||||
Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[i][j]);
|
Player *plr = sObjectMgr.GetPlayer(m_PlayersNearPoint[i][j]);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGroundEY: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
|
sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
|
||||||
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
|
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
|
||||||
m_PlayersNearPoint[BG_EY_NODES_MAX].push_back(m_PlayersNearPoint[i][j]);
|
m_PlayersNearPoint[BG_EY_NODES_MAX].push_back(m_PlayersNearPoint[i][j]);
|
||||||
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
|
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
|
||||||
|
|
|
||||||
|
|
@ -366,7 +366,8 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
|
||||||
//if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue
|
//if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue
|
||||||
if (_player->getLevel() > bg->GetMaxLevel())
|
if (_player->getLevel() > bg->GetMaxLevel())
|
||||||
{
|
{
|
||||||
sLog.outError("Battleground: Player %s (%u) has level higher than maxlevel of battleground! Do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
|
sLog.outError("Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!",
|
||||||
|
_player->GetName(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID());
|
||||||
action = 0;
|
action = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19123,7 +19123,7 @@ BGQueueIdBasedOnLevel Player::GetBattleGroundQueueIdFromLevel() const
|
||||||
uint32 queue_id = ( getLevel() / 10) - 1;
|
uint32 queue_id = ( getLevel() / 10) - 1;
|
||||||
if( queue_id >= MAX_BATTLEGROUND_QUEUES )
|
if( queue_id >= MAX_BATTLEGROUND_QUEUES )
|
||||||
{
|
{
|
||||||
sLog.outError("BattleGround: too high queue_id %u this shouldn't happen", queue_id);
|
sLog.outError("BattleGround: too high queue_id %u for player %u (acc: %u) with level %u", queue_id, GetGUIDLow(), GetSession()->GetAccountId(), getLevel());
|
||||||
return QUEUE_ID_MAX_LEVEL_80;
|
return QUEUE_ID_MAX_LEVEL_80;
|
||||||
}
|
}
|
||||||
return BGQueueIdBasedOnLevel(queue_id);
|
return BGQueueIdBasedOnLevel(queue_id);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8925"
|
#define REVISION_NR "8926"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue