aboutsummaryrefslogtreecommitdiff
path: root/src/game/BattleGround.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/BattleGround.cpp')
-rw-r--r--src/game/BattleGround.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index 454c2a1de3d..df58b643294 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -130,6 +130,7 @@ void BattleGround::BroadcastWorker(Do& _do)
BattleGround::BattleGround()
{
m_TypeID = BattleGroundTypeId(0);
+ m_RandomTypeID = BattleGroundTypeId(0);
m_InstanceID = 0;
m_Status = STATUS_NONE;
m_ClientInstanceID = 0;
@@ -145,6 +146,7 @@ BattleGround::BattleGround()
m_Events = 0;
m_IsRated = false;
m_BuffChange = false;
+ m_IsRandom = false;
m_Name = "";
m_LevelMin = 0;
m_LevelMax = 0;
@@ -794,9 +796,29 @@ void BattleGround::EndBattleGround(uint32 winner)
}
}
+ uint32 win_kills = plr->GetRandomWinner() ? BG_REWARD_WINNER_HONOR_LAST : BG_REWARD_WINNER_HONOR_FIRST;
+ uint32 loos_kills = plr->GetRandomWinner() ? BG_REWARD_LOOSER_HONOR_LAST : BG_REWARD_LOOSER_HONOR_FIRST;
+ uint32 win_arena = plr->GetRandomWinner() ? BG_REWARD_WINNER_ARENA_LAST : BG_REWARD_WINNER_ARENA_FIRST;
+
// Reward winner team
if (team == winner)
+ {
+ if (IsRandom() || BattleGroundMgr::IsBGWeekend(GetTypeID()))
+ {
+ UpdatePlayerScore(plr, SCORE_BONUS_HONOR, GetBonusHonorFromKill(win_kills*2));
+ plr->ModifyArenaPoints(win_arena);
+ if (!plr->GetRandomWinner())
+ plr->SetRandomWinner(true);
+ }
+
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
+ }
+ else
+ {
+ if (IsRandom() || BattleGroundMgr::IsBGWeekend(GetTypeID()))
+ UpdatePlayerScore(plr, SCORE_BONUS_HONOR, GetBonusHonorFromKill(loos_kills*4));
+ }
+
plr->SetHealth(plr->GetMaxHealth());
plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA));
@@ -839,7 +861,7 @@ uint32 BattleGround::GetBonusHonorFromKill(uint32 kills) const
uint32 BattleGround::GetBattlemasterEntry() const
{
- switch(GetTypeID())
+ switch(GetTypeID(true))
{
case BATTLEGROUND_AV: return 15972;
case BATTLEGROUND_WS: return 14623;
@@ -1647,7 +1669,7 @@ void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
index--;
if (index < 0)
{
- sLog.outError("BattleGround (Type: %u) has buff gameobject (Guid: %u Entry: %u Type:%u) but it hasn't that object in its internal data",GetTypeID(),GUID_LOPART(go_guid),obj->GetEntry(),obj->GetGoType());
+ sLog.outError("BattleGround (Type: %u) has buff gameobject (Guid: %u Entry: %u Type:%u) but it hasn't that object in its internal data",GetTypeID(true),GUID_LOPART(go_guid),obj->GetEntry(),obj->GetGoType());
return;
}