mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Fix a crash in BattleGroundMgr::BuildPvpLogDataPacket caused by objmgr not finding player object by guid when showing scoreboard. In this case get bg team ID for player via character database. Closes #938
--HG-- branch : trunk
This commit is contained in:
@@ -1336,8 +1336,22 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
|
||||
*data << uint32(itr->second->KillingBlows);
|
||||
if (type) // if (bg->isArena())
|
||||
{
|
||||
// BG Team ID (Green/Gold team, not faction teams in arena)
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
*data << uint8(plr->GetBGTeam()); // BG Team ID (Green/Gold team, not faction teams in arena)
|
||||
uint8 team = 0;
|
||||
if (plr)
|
||||
team = plr->GetBGTeam();
|
||||
else
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT team FROM character_battleground_data WHERE guid = '%u'", GUID_LOPART(itr->first));
|
||||
if (result)
|
||||
{
|
||||
team = (*result)[0].GetUInt8();
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
sLog.outError("Player GUID %u - unable to find correct BG Team ID for MSG_PVP_LOG_DATA (scoreboard). Defaulting to 0.", GUID_LOPART(itr->first));
|
||||
}
|
||||
}
|
||||
else // if (!bg->isArena())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user