Core/Battlegrounds: Store mercenary status separately from the aura obtained from gossip as it can be removed at any time
Port From (https://github.com/TrinityCore/TrinityCore/commit/84486ded67efc4e779412ff865c66ca8b9cee7ea)
This commit is contained in:
@@ -997,6 +997,7 @@ namespace Game.BattleGrounds
|
||||
bp.OfflineRemoveTime = 0;
|
||||
bp.Team = team;
|
||||
bp.ActiveSpec = (int)player.GetPrimarySpecialization();
|
||||
bp.Mercenary = player.IsMercenaryForBattlegroundQueueType(GetQueueId());
|
||||
|
||||
bool isInBattleground = IsPlayerInBattleground(player.GetGUID());
|
||||
// Add to list/maps
|
||||
@@ -1071,15 +1072,18 @@ namespace Game.BattleGrounds
|
||||
player.SendPacket(timer);
|
||||
}
|
||||
|
||||
if (player.HasAura(PlayerConst.SpellMercenaryContractHorde))
|
||||
if (bp.Mercenary)
|
||||
{
|
||||
player.CastSpell(player, BattlegroundConst.SpellMercenaryHorde1, true);
|
||||
player.CastSpell(player, BattlegroundConst.SpellMercenaryHorde2, true);
|
||||
}
|
||||
else if (player.HasAura(PlayerConst.SpellMercenaryContractAlliance))
|
||||
{
|
||||
player.CastSpell(player, BattlegroundConst.SpellMercenaryAlliance1, true);
|
||||
player.CastSpell(player, BattlegroundConst.SpellMercenaryAlliance2, true);
|
||||
if (bp.Team == Team.Horde)
|
||||
{
|
||||
player.CastSpell(player, BattlegroundConst.SpellMercenaryHorde1, true);
|
||||
player.CastSpell(player, BattlegroundConst.SpellMercenaryHordeReactions, true);
|
||||
}
|
||||
else if (bp.Team == Team.Alliance)
|
||||
{
|
||||
player.CastSpell(player, BattlegroundConst.SpellMercenaryAlliance1, true);
|
||||
player.CastSpell(player, BattlegroundConst.SpellMercenaryAllianceReactions, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1768,6 +1772,15 @@ namespace Game.BattleGrounds
|
||||
return m_Players.ContainsKey(guid);
|
||||
}
|
||||
|
||||
public bool IsPlayerMercenaryInBattleground(ObjectGuid guid)
|
||||
{
|
||||
var player = m_Players.LookupByKey(guid);
|
||||
if (player != null)
|
||||
return player.Mercenary;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void PlayerAddedToBGCheckIfBGIsRunning(Player player)
|
||||
{
|
||||
if (GetStatus() != BattlegroundStatus.WaitLeave)
|
||||
@@ -2154,8 +2167,9 @@ namespace Game.BattleGrounds
|
||||
|
||||
public class BattlegroundPlayer
|
||||
{
|
||||
public long OfflineRemoveTime; // for tracking and removing offline players from queue after 5 Time.Minutes
|
||||
public Team Team; // Player's team
|
||||
public int ActiveSpec;
|
||||
public long OfflineRemoveTime; // for tracking and removing offline players from queue after 5 Time.Minutes
|
||||
public Team Team; // Player's team
|
||||
public int ActiveSpec; // Player's active spec
|
||||
public bool Mercenary;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Game.BattleGrounds
|
||||
}
|
||||
|
||||
// add group or player (grp == null) to bg queue with the given leader and bg specifications
|
||||
public GroupQueueInfo AddGroup(Player leader, Group grp, PvpDifficultyRecord bracketEntry, bool isPremade, uint ArenaRating, uint MatchmakerRating, uint arenateamid = 0)
|
||||
public GroupQueueInfo AddGroup(Player leader, Group group, Team team, PvpDifficultyRecord bracketEntry, bool isPremade, uint ArenaRating, uint MatchmakerRating, uint arenateamid = 0)
|
||||
{
|
||||
BattlegroundBracketId bracketId = bracketEntry.GetBracketId();
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Game.BattleGrounds
|
||||
ginfo.IsInvitedToBGInstanceGUID = 0;
|
||||
ginfo.JoinTime = GameTime.GetGameTimeMS();
|
||||
ginfo.RemoveInviteTime = 0;
|
||||
ginfo.Team = leader.GetBgQueueTeam();
|
||||
ginfo.Team = team;
|
||||
ginfo.ArenaTeamRating = ArenaRating;
|
||||
ginfo.ArenaMatchmakerRating = MatchmakerRating;
|
||||
ginfo.OpponentsTeamRating = 0;
|
||||
@@ -88,15 +88,15 @@ namespace Game.BattleGrounds
|
||||
//announce world (this don't need mutex)
|
||||
if (m_queueId.Rated && WorldConfig.GetBoolValue(WorldCfg.ArenaQueueAnnouncerEnable))
|
||||
{
|
||||
ArenaTeam team = Global.ArenaTeamMgr.GetArenaTeamById(arenateamid);
|
||||
if (team != null)
|
||||
Global.WorldMgr.SendWorldText( CypherStrings.ArenaQueueAnnounceWorldJoin, team.GetName(), m_queueId.TeamSize, m_queueId.TeamSize, ginfo.ArenaTeamRating);
|
||||
ArenaTeam arenaTeam = Global.ArenaTeamMgr.GetArenaTeamById(arenateamid);
|
||||
if (arenaTeam != null)
|
||||
Global.WorldMgr.SendWorldText( CypherStrings.ArenaQueueAnnounceWorldJoin, arenaTeam.GetName(), m_queueId.TeamSize, m_queueId.TeamSize, ginfo.ArenaTeamRating);
|
||||
}
|
||||
|
||||
//add players from group to ginfo
|
||||
if (grp)
|
||||
if (group)
|
||||
{
|
||||
for (GroupReference refe = grp.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
|
||||
{
|
||||
Player member = refe.GetSource();
|
||||
if (!member)
|
||||
@@ -109,14 +109,6 @@ namespace Game.BattleGrounds
|
||||
m_QueuedPlayers[member.GetGUID()] = pl_info;
|
||||
// add the pinfo to ginfo's list
|
||||
ginfo.Players[member.GetGUID()] = pl_info;
|
||||
|
||||
if (ginfo.Team != member.GetTeam())
|
||||
{
|
||||
if (member.GetTeam() == Team.Alliance)
|
||||
member.CastSpell(member, PlayerConst.SpellMercenaryContractHorde);
|
||||
else
|
||||
member.CastSpell(member, PlayerConst.SpellMercenaryContractAlliance);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user