fix(Core/BG): store correct faction id (#10576)

This commit is contained in:
Francesco Borzì
2022-02-09 10:20:55 +01:00
committed by GitHub
parent 50ef9872af
commit 65a1fbfd35
3 changed files with 14 additions and 2 deletions

View File

@@ -782,7 +782,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_BATTLEGROUND);
stmt->SetData(0, battlegroundId);
stmt->SetData(1, GetWinner());
stmt->SetData(1, GetPvPTeamId(GetWinner()));
stmt->SetData(2, GetUniqueBracketId());
stmt->SetData(3, GetBgTypeID(true));
CharacterDatabase.Execute(stmt);

View File

@@ -241,7 +241,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
else
{
*data << uint8(1); // bg ended
*data << uint8(bg->GetWinner() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE); // who win
*data << uint8(GetPvPTeamId(bg->GetWinner())); // who win
}
size_t wpos = data->wpos();

View File

@@ -3400,6 +3400,18 @@ enum ResponseCodes
CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 0x67
};
enum PvPTeamId
{
PVP_TEAM_HORDE = 0, // Battleground: Horde, Arena: Green
PVP_TEAM_ALLIANCE = 1, // Battleground: Alliance, Arena: Gold
PVP_TEAM_NEUTRAL = 2 // Battleground: Neutral, Arena: None
};
inline PvPTeamId GetPvPTeamId(TeamId teamId)
{
return teamId == TEAM_ALLIANCE ? PVP_TEAM_ALLIANCE : PVP_TEAM_HORDE;
}
// indexes of BattlemasterList.dbc
enum BattlegroundTypeId
{