fix(Core:Battlegrounds): fixes some Arathi Basin achievements. (#8009)

* fix(Core:Battlegrounds): fixes some Arathi Basin achievements.

Fixes #7775

* minor change.
This commit is contained in:
UltraNix
2021-10-01 10:11:10 +02:00
committed by GitHub
parent d461898a3d
commit 08f1e86195
2 changed files with 7 additions and 9 deletions

View File

@@ -764,20 +764,18 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
int32 winmsg_id = 0; int32 winmsg_id = 0;
SetWinner(winnerTeamId);
if (winnerTeamId == TEAM_ALLIANCE) if (winnerTeamId == TEAM_ALLIANCE)
{ {
SetWinner(TEAM_HORDE); // reversed in packet
winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS; winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS;
PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound
} }
else if (winnerTeamId == TEAM_HORDE) else if (winnerTeamId == TEAM_HORDE)
{ {
SetWinner(TEAM_ALLIANCE); // reversed in packet
winmsg_id = isBattleground() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS; winmsg_id = isBattleground() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS;
PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound
} }
else
SetWinner(TEAM_NEUTRAL);
CharacterDatabasePreparedStatement* stmt = nullptr; CharacterDatabasePreparedStatement* stmt = nullptr;
uint64 battlegroundId = 1; uint64 battlegroundId = 1;
@@ -990,8 +988,6 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST); uint32 loser_kills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST);
uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST); uint32 winner_arena = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_ARENA_FIRST);
sScriptMgr->OnBattlegroundEndReward(this, player, winnerTeamId);
// Reward winner team // Reward winner team
if (bgTeamId == winnerTeamId) if (bgTeamId == winnerTeamId)
{ {
@@ -1015,6 +1011,8 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loser_kills)); UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loser_kills));
} }
sScriptMgr->OnBattlegroundEndReward(this, player, winnerTeamId);
player->ResetAllPowers(); player->ResetAllPowers();
player->CombatStopWithPets(true); player->CombatStopWithPets(true);

View File

@@ -242,11 +242,11 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
} }
if (bg->GetStatus() != STATUS_WAIT_LEAVE) if (bg->GetStatus() != STATUS_WAIT_LEAVE)
*data << uint8(0); // bg not ended *data << uint8(0); // bg not ended
else else
{ {
*data << uint8(1); // bg ended *data << uint8(1); // bg ended
*data << uint8(bg->GetWinner()); // who win *data << uint8(bg->GetWinner() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE); // who win
} }
size_t wpos = data->wpos(); size_t wpos = data->wpos();