Core/Auras: Implement SPELL_AURA_BATTLEGROUND_PLAYER_POSITION_FACTIONAL (397) & SPELL_AURA_BATTLEGROUND_PLAYER_POSITION (398)
Port From (https://github.com/TrinityCore/TrinityCore/commit/e9357dc7f29fc15a72a3dc25b647d577dc979db8)
This commit is contained in:
@@ -188,13 +188,21 @@ namespace Game.BattleGrounds
|
||||
m_LastPlayerPositionBroadcast = 0;
|
||||
|
||||
BattlegroundPlayerPositions playerPositions = new BattlegroundPlayerPositions();
|
||||
GetPlayerPositionData(playerPositions.FlagCarriers);
|
||||
for (var i =0; i < _playerPositions.Count; ++i)
|
||||
{
|
||||
var playerPosition = _playerPositions[i];
|
||||
// Update position data if we found player.
|
||||
Player player = Global.ObjAccessor.GetPlayer(GetBgMap(), playerPosition.Guid);
|
||||
if (player != null)
|
||||
playerPosition.Pos = player.GetPosition();
|
||||
|
||||
playerPositions.FlagCarriers.Add(playerPosition);
|
||||
}
|
||||
|
||||
SendPacketToAll(playerPositions);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void GetPlayerPositionData(List<BattlegroundPlayerPosition> positions) { }
|
||||
|
||||
void _ProcessOfflineQueue()
|
||||
{
|
||||
// remove offline players from bg after 5 Time.Minutes
|
||||
@@ -943,6 +951,8 @@ namespace Game.BattleGrounds
|
||||
PlayerScores.Clear();
|
||||
|
||||
ResetBGSubclass();
|
||||
|
||||
_playerPositions.Clear();
|
||||
}
|
||||
|
||||
public void StartBattleground()
|
||||
@@ -1586,6 +1596,16 @@ namespace Game.BattleGrounds
|
||||
BroadcastWorker(localizer);
|
||||
}
|
||||
|
||||
public void AddPlayerPosition(BattlegroundPlayerPosition position)
|
||||
{
|
||||
_playerPositions.Add(position);
|
||||
}
|
||||
|
||||
public void RemovePlayerPosition(ObjectGuid guid)
|
||||
{
|
||||
_playerPositions.RemoveAll(playerPosition => playerPosition.Guid == guid);
|
||||
}
|
||||
|
||||
void EndNow()
|
||||
{
|
||||
RemoveFromBGFreeSlotQueue();
|
||||
@@ -2078,6 +2098,8 @@ namespace Game.BattleGrounds
|
||||
|
||||
BattlegroundTemplate _battlegroundTemplate;
|
||||
PvpDifficultyRecord _pvpDifficultyEntry;
|
||||
|
||||
List<BattlegroundPlayerPosition> _playerPositions = new List<BattlegroundPlayerPosition>();
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -107,21 +107,6 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetPlayerPositionData(List<BattlegroundPlayerPosition> positions)
|
||||
{
|
||||
Player player = Global.ObjAccessor.GetPlayer(GetBgMap(), m_FlagKeeper);
|
||||
if (player)
|
||||
{
|
||||
BattlegroundPlayerPosition position = new BattlegroundPlayerPosition();
|
||||
position.Guid = player.GetGUID();
|
||||
position.Pos.X = player.GetPositionX();
|
||||
position.Pos.Y = player.GetPositionY();
|
||||
position.IconID = player.GetTeam() == Team.Alliance ? BattlegroundConst.PlayerPositionIconAllianceFlag : BattlegroundConst.PlayerPositionIconHordeFlag;
|
||||
position.ArenaSlot = BattlegroundConst.PlayerPositionArenaSlotNone;
|
||||
positions.Add(position);
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartingEventCloseDoors()
|
||||
{
|
||||
SpawnBGObject(EotSObjectTypes.DoorA, BattlegroundConst.RespawnImmediately);
|
||||
|
||||
@@ -165,33 +165,6 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetPlayerPositionData(List<BattlegroundPlayerPosition> positions)
|
||||
{
|
||||
Player player = Global.ObjAccessor.GetPlayer(GetBgMap(), m_FlagKeepers[TeamId.Alliance]);
|
||||
if (player)
|
||||
{
|
||||
BattlegroundPlayerPosition position = new BattlegroundPlayerPosition();
|
||||
position.Guid = player.GetGUID();
|
||||
position.Pos.X = player.GetPositionX();
|
||||
position.Pos.Y = player.GetPositionY();
|
||||
position.IconID = BattlegroundConst.PlayerPositionIconAllianceFlag;
|
||||
position.ArenaSlot = BattlegroundConst.PlayerPositionArenaSlotNone;
|
||||
positions.Add(position);
|
||||
}
|
||||
|
||||
player = Global.ObjAccessor.GetPlayer(GetBgMap(), m_FlagKeepers[TeamId.Horde]);
|
||||
if (player)
|
||||
{
|
||||
BattlegroundPlayerPosition position = new BattlegroundPlayerPosition();
|
||||
position.Guid = player.GetGUID();
|
||||
position.Pos.X = player.GetPositionX();
|
||||
position.Pos.Y = player.GetPositionY();
|
||||
position.IconID = BattlegroundConst.PlayerPositionIconHordeFlag;
|
||||
position.ArenaSlot = BattlegroundConst.PlayerPositionArenaSlotNone;
|
||||
positions.Add(position);
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartingEventCloseDoors()
|
||||
{
|
||||
for (int i = WSGObjectTypes.DoorA1; i <= WSGObjectTypes.DoorH4; ++i)
|
||||
|
||||
Reference in New Issue
Block a user