Core/Battlegrounds: Set PLAYER_FLAGS_EX_MERCENARY_MODE for mercenary players

Port From (https://github.com/TrinityCore/TrinityCore/commit/798693c0b8c6f4ae43f908c9239e14bcf4c3b76f)
This commit is contained in:
hondacrx
2022-05-31 13:00:06 -04:00
parent 036c565f69
commit 014c4b9c54
2 changed files with 11 additions and 7 deletions
+10 -3
View File
@@ -625,7 +625,7 @@ namespace Game.BattleGrounds
if (!player) if (!player)
continue; continue;
if (player.GetNativeTeam() != team) if (player.HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode))
continue; continue;
uint repGain = Reputation; uint repGain = Reputation;
@@ -853,8 +853,12 @@ namespace Game.BattleGrounds
player.RemoveAurasByType(AuraType.ModShapeshift); player.RemoveAurasByType(AuraType.ModShapeshift);
player.RemoveAurasByType(AuraType.Mounted); player.RemoveAurasByType(AuraType.Mounted);
player.RemoveAurasByType(AuraType.SwitchTeam); player.RemoveAura(BattlegroundConst.SpellMercenaryHorde1);
player.RemoveAurasByType(AuraType.ModFaction); player.RemoveAura(BattlegroundConst.SpellMercenaryHordeReactions);
player.RemoveAura(BattlegroundConst.SpellMercenaryAlliance1);
player.RemoveAura(BattlegroundConst.SpellMercenaryAllianceReactions);
player.RemoveAura(BattlegroundConst.SpellMercenaryShapeshift);
player.RemovePlayerFlagEx(PlayerFlagsEx.MercenaryMode);
if (!player.IsAlive()) // resurrect on exit if (!player.IsAlive()) // resurrect on exit
{ {
@@ -1084,6 +1088,9 @@ namespace Game.BattleGrounds
player.CastSpell(player, BattlegroundConst.SpellMercenaryAlliance1, true); player.CastSpell(player, BattlegroundConst.SpellMercenaryAlliance1, true);
player.CastSpell(player, BattlegroundConst.SpellMercenaryAllianceReactions, true); player.CastSpell(player, BattlegroundConst.SpellMercenaryAllianceReactions, true);
} }
player.CastSpell(player, BattlegroundConst.SpellMercenaryShapeshift);
player.SetPlayerFlagEx(PlayerFlagsEx.MercenaryMode);
} }
} }
+1 -4
View File
@@ -3518,14 +3518,11 @@ namespace Game.Entities
public void SwitchToOppositeTeam(bool apply) public void SwitchToOppositeTeam(bool apply)
{ {
m_team = GetNativeTeam(); m_team = TeamForRace(GetRace());
if (apply) if (apply)
m_team = (m_team == Team.Alliance) ? Team.Horde : Team.Alliance; m_team = (m_team == Team.Alliance) ? Team.Horde : Team.Alliance;
} }
public Team GetNativeTeam() { return TeamForRace(GetRace()); }
public uint GetNativeTeamId() { return TeamIdForRace(GetRace()); }
public void SetFactionForRace(Race race) public void SetFactionForRace(Race race)
{ {