aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Battlegrounds/Battleground.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2022-04-14 23:31:17 +0200
committerShauren <shauren.trinity@gmail.com>2022-04-16 12:15:37 +0200
commit84486ded67efc4e779412ff865c66ca8b9cee7ea (patch)
treea151ddae81c40c305f9540689ae9778d21b81d5b /src/server/game/Battlegrounds/Battleground.cpp
parent15fe4e09d4dda16f23100412670dbdfbae5c5e61 (diff)
Core/Battlegrounds: Store mercenary status separately from the aura obtained from gossip as it can be removed at any time
Diffstat (limited to 'src/server/game/Battlegrounds/Battleground.cpp')
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 1f7a3ce187c..b82061bdf93 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -1050,6 +1050,7 @@ void Battleground::AddPlayer(Player* player)
bp.OfflineRemoveTime = 0;
bp.Team = team;
bp.ActiveSpec = player->GetPrimarySpecialization();
+ bp.Mercenary = player->IsMercenaryForBattlegroundQueueType(GetQueueId());
bool const isInBattleground = IsPlayerInBattleground(player->GetGUID());
// Add to list/maps
@@ -1124,15 +1125,19 @@ void Battleground::AddPlayer(Player* player)
player->SendDirectMessage(startTimer.Write());
}
- if (player->HasAura(SPELL_MERCENARY_CONTRACT_HORDE))
+ if (bp.Mercenary)
{
- player->CastSpell(player, SPELL_MERCENARY_HORDE_1, true);
- player->CastSpell(player, SPELL_MERCENARY_HORDE_2, true);
- }
- else if (player->HasAura(SPELL_MERCENARY_CONTRACT_ALLIANCE))
- {
- player->CastSpell(player, SPELL_MERCENARY_ALLIANCE_1, true);
- player->CastSpell(player, SPELL_MERCENARY_ALLIANCE_2, true);
+ if (bp.Team == HORDE)
+ {
+ player->CastSpell(player, SPELL_MERCENARY_HORDE_1);
+ player->CastSpell(player, SPELL_MERCENARY_HORDE_REACTIONS);
+ }
+ else if (bp.Team == ALLIANCE)
+ {
+ player->CastSpell(player, SPELL_MERCENARY_ALLIANCE_1);
+ player->CastSpell(player, SPELL_MERCENARY_ALLIANCE_REACTIONS);
+ }
+ player->CastSpell(player, SPELL_MERCENARY_SHAPESHIFT);
}
}
@@ -1856,6 +1861,14 @@ bool Battleground::IsPlayerInBattleground(ObjectGuid guid) const
return false;
}
+bool Battleground::IsPlayerMercenaryInBattleground(ObjectGuid guid) const
+{
+ auto itr = m_Players.find(guid);
+ if (itr != m_Players.end())
+ return itr->second.Mercenary;
+ return false;
+}
+
void Battleground::PlayerAddedToBGCheckIfBGIsRunning(Player* player)
{
if (GetStatus() != STATUS_WAIT_LEAVE)