Core/Battlegrounds: Set PLAYER_FLAGS_EX_MERCENARY_MODE for mercenary players

This commit is contained in:
Shauren
2022-04-14 23:31:17 +02:00
parent 84486ded67
commit 798693c0b8
3 changed files with 9 additions and 7 deletions

View File

@@ -675,7 +675,7 @@ void Battleground::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
if (!player)
continue;
if (player->GetNativeTeam() != TeamID)
if (player->HasPlayerFlagEx(PLAYER_FLAGS_EX_MERCENARY_MODE))
continue;
uint32 repGain = Reputation;
@@ -901,8 +901,12 @@ void Battleground::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
player->RemoveAurasByType(SPELL_AURA_MOUNTED);
player->RemoveAurasByType(SPELL_AURA_SWITCH_TEAM);
player->RemoveAurasByType(SPELL_AURA_MOD_FACTION);
player->RemoveAura(SPELL_MERCENARY_HORDE_1);
player->RemoveAura(SPELL_MERCENARY_HORDE_REACTIONS);
player->RemoveAura(SPELL_MERCENARY_ALLIANCE_1);
player->RemoveAura(SPELL_MERCENARY_ALLIANCE_REACTIONS);
player->RemoveAura(SPELL_MERCENARY_SHAPESHIFT);
player->RemovePlayerFlagEx(PLAYER_FLAGS_EX_MERCENARY_MODE);
if (!player->IsAlive()) // resurrect on exit
{
@@ -1138,6 +1142,7 @@ void Battleground::AddPlayer(Player* player)
player->CastSpell(player, SPELL_MERCENARY_ALLIANCE_REACTIONS);
}
player->CastSpell(player, SPELL_MERCENARY_SHAPESHIFT);
player->SetPlayerFlagEx(PLAYER_FLAGS_EX_MERCENARY_MODE);
}
}

View File

@@ -6287,7 +6287,7 @@ TeamId Player::TeamIdForRace(uint8 race)
void Player::SwitchToOppositeTeam(bool apply)
{
m_team = GetNativeTeam();
m_team = TeamForRace(GetRace());
if (apply)
m_team = (m_team == ALLIANCE) ? HORDE : ALLIANCE;

View File

@@ -2214,9 +2214,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
void SetFactionForRace(uint8 race);
uint32 GetNativeTeam() const { return TeamForRace(GetRace()); }
TeamId GetNativeTeamId() const { return TeamIdForRace(GetRace()); }
void InitDisplayIds();
bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;