Core/Battlegrounds: Clean up some Team/TeamId parameters to use enums instead of raw integer types
Port From (https://github.com/TrinityCore/TrinityCore/commit/1ef0c045202a6af33fb991f2ff765fa183ce976f)
This commit is contained in:
@@ -342,7 +342,7 @@ namespace Game.Entities
|
||||
case GameObjectTypes.CapturePoint:
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.SpellVisualID), m_goInfo.CapturePoint.SpellVisual1);
|
||||
m_goValue.CapturePoint.AssaultTimer = 0;
|
||||
m_goValue.CapturePoint.LastTeamCapture = TeamId.Neutral;
|
||||
m_goValue.CapturePoint.LastTeamCapture = BatttleGroundTeamId.Neutral;
|
||||
m_goValue.CapturePoint.State = BattlegroundCapturePointState.Neutral;
|
||||
UpdateCapturePoint();
|
||||
if (map.Instanceable())
|
||||
@@ -679,7 +679,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
m_goValue.CapturePoint.LastTeamCapture = hordeCapturing ? TeamId.Horde : TeamId.Alliance;
|
||||
m_goValue.CapturePoint.LastTeamCapture = hordeCapturing ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance;
|
||||
UpdateCapturePoint();
|
||||
}
|
||||
else
|
||||
@@ -3462,7 +3462,7 @@ namespace Game.Entities
|
||||
|
||||
if (player.GetBGTeam() == Team.Horde)
|
||||
{
|
||||
if (m_goValue.CapturePoint.LastTeamCapture == TeamId.Horde)
|
||||
if (m_goValue.CapturePoint.LastTeamCapture == BatttleGroundTeamId.Horde)
|
||||
{
|
||||
// defended. capture instantly.
|
||||
m_goValue.CapturePoint.State = BattlegroundCapturePointState.HordeCaptured;
|
||||
@@ -3491,7 +3491,7 @@ namespace Game.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_goValue.CapturePoint.LastTeamCapture == TeamId.Alliance)
|
||||
if (m_goValue.CapturePoint.LastTeamCapture == BatttleGroundTeamId.Alliance)
|
||||
{
|
||||
// defended. capture instantly.
|
||||
m_goValue.CapturePoint.State = BattlegroundCapturePointState.AllianceCaptured;
|
||||
@@ -4549,12 +4549,12 @@ namespace Game.Entities
|
||||
int GetControllingTeam()
|
||||
{
|
||||
if (_value < GetMaxHordeValue())
|
||||
return TeamId.Horde;
|
||||
return BatttleGroundTeamId.Horde;
|
||||
|
||||
if (_value > GetMinAllianceValue())
|
||||
return TeamId.Alliance;
|
||||
return BatttleGroundTeamId.Alliance;
|
||||
|
||||
return TeamId.Neutral;
|
||||
return BatttleGroundTeamId.Neutral;
|
||||
}
|
||||
|
||||
public List<ObjectGuid> GetInsidePlayers() { return _insidePlayers; }
|
||||
@@ -4601,31 +4601,31 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
int newControllingTeam = GetControllingTeam();
|
||||
int assaultingTeam = pointsGained > 0 ? TeamId.Alliance : TeamId.Horde;
|
||||
int assaultingTeam = pointsGained > 0 ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde;
|
||||
|
||||
if (oldControllingTeam != newControllingTeam)
|
||||
_contestedTriggered = false;
|
||||
|
||||
if (oldControllingTeam != TeamId.Alliance && newControllingTeam == TeamId.Alliance)
|
||||
if (oldControllingTeam != BatttleGroundTeamId.Alliance && newControllingTeam == BatttleGroundTeamId.Alliance)
|
||||
TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventAlliance);
|
||||
else if (oldControllingTeam != TeamId.Horde && newControllingTeam == TeamId.Horde)
|
||||
else if (oldControllingTeam != BatttleGroundTeamId.Horde && newControllingTeam == BatttleGroundTeamId.Horde)
|
||||
TriggerEvent(_owner.GetGoInfo().ControlZone.ProgressEventHorde);
|
||||
else if (oldControllingTeam == TeamId.Horde && newControllingTeam == TeamId.Neutral)
|
||||
else if (oldControllingTeam == BatttleGroundTeamId.Horde && newControllingTeam == BatttleGroundTeamId.Neutral)
|
||||
TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventHorde);
|
||||
else if (oldControllingTeam == TeamId.Alliance && newControllingTeam == TeamId.Neutral)
|
||||
else if (oldControllingTeam == BatttleGroundTeamId.Alliance && newControllingTeam == BatttleGroundTeamId.Neutral)
|
||||
TriggerEvent(_owner.GetGoInfo().ControlZone.NeutralEventAlliance);
|
||||
|
||||
if (roundedValue == 100 && newControllingTeam == TeamId.Alliance && assaultingTeam == TeamId.Alliance)
|
||||
if (roundedValue == 100 && newControllingTeam == BatttleGroundTeamId.Alliance && assaultingTeam == BatttleGroundTeamId.Alliance)
|
||||
TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventAlliance);
|
||||
else if (roundedValue == 0 && newControllingTeam == TeamId.Horde && assaultingTeam == TeamId.Horde)
|
||||
else if (roundedValue == 0 && newControllingTeam == BatttleGroundTeamId.Horde && assaultingTeam == BatttleGroundTeamId.Horde)
|
||||
TriggerEvent(_owner.GetGoInfo().ControlZone.CaptureEventHorde);
|
||||
|
||||
if (oldRoundedValue == 100 && assaultingTeam == TeamId.Horde && !_contestedTriggered)
|
||||
if (oldRoundedValue == 100 && assaultingTeam == BatttleGroundTeamId.Horde && !_contestedTriggered)
|
||||
{
|
||||
TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventHorde);
|
||||
_contestedTriggered = true;
|
||||
}
|
||||
else if (oldRoundedValue == 0 && assaultingTeam == TeamId.Alliance && !_contestedTriggered)
|
||||
else if (oldRoundedValue == 0 && assaultingTeam == BatttleGroundTeamId.Alliance && !_contestedTriggered)
|
||||
{
|
||||
TriggerEvent(_owner.GetGoInfo().ControlZone.ContestedEventAlliance);
|
||||
_contestedTriggered = true;
|
||||
|
||||
@@ -1623,7 +1623,7 @@ namespace Game.Entities
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
// SELECT instanceId, team, joinX, joinY, joinZ, joinO, joinMapId, taxiStart, taxiEnd, mountSpell, queueTypeId FROM character_Battleground_data WHERE guid = ?
|
||||
m_bgData.bgInstanceID = result.Read<uint>(0);
|
||||
m_bgData.bgTeam = result.Read<ushort>(1);
|
||||
m_bgData.bgTeam = (Team)result.Read<ushort>(1);
|
||||
m_bgData.joinPos = new WorldLocation(result.Read<ushort>(6), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4), result.Read<float>(5));
|
||||
m_bgData.taxiPath[0] = result.Read<uint>(7);
|
||||
m_bgData.taxiPath[1] = result.Read<uint>(8);
|
||||
@@ -2784,7 +2784,7 @@ namespace Game.Entities
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PLAYER_BGDATA);
|
||||
stmt.AddValue(0, GetGUID().GetCounter());
|
||||
stmt.AddValue(1, m_bgData.bgInstanceID);
|
||||
stmt.AddValue(2, m_bgData.bgTeam);
|
||||
stmt.AddValue(2, (ushort)m_bgData.bgTeam);
|
||||
stmt.AddValue(3, m_bgData.joinPos.GetPositionX());
|
||||
stmt.AddValue(4, m_bgData.joinPos.GetPositionY());
|
||||
stmt.AddValue(5, m_bgData.joinPos.GetPositionZ());
|
||||
|
||||
@@ -578,7 +578,7 @@ namespace Game.Entities
|
||||
public byte bgAfkReportedCount;
|
||||
public long bgAfkReportedTimer;
|
||||
|
||||
public uint bgTeam; //< What side the player will be added to
|
||||
public Team bgTeam; //< What side the player will be added to
|
||||
|
||||
public uint mountSpell;
|
||||
public uint[] taxiPath = new uint[2];
|
||||
|
||||
@@ -580,13 +580,13 @@ namespace Game.Entities
|
||||
|
||||
public void SetBGTeam(Team team)
|
||||
{
|
||||
m_bgData.bgTeam = (uint)team;
|
||||
m_bgData.bgTeam = team;
|
||||
SetArenaFaction((byte)(team == Team.Alliance ? 1 : 0));
|
||||
}
|
||||
|
||||
public Team GetBGTeam()
|
||||
{
|
||||
return m_bgData.bgTeam != 0 ? (Team)m_bgData.bgTeam : GetTeam();
|
||||
return m_bgData.bgTeam != 0 ? m_bgData.bgTeam : GetTeam();
|
||||
}
|
||||
|
||||
public void LeaveBattleground(bool teleportToEntryPoint = true)
|
||||
|
||||
@@ -5179,13 +5179,13 @@ namespace Game.Entities
|
||||
return (uint)rEntry.Alliance;
|
||||
|
||||
Log.outError(LogFilter.Player, "Race ({0}) not found in DBC: wrong DBC files?", race);
|
||||
return TeamId.Neutral;
|
||||
return BatttleGroundTeamId.Neutral;
|
||||
}
|
||||
public Team GetTeam() { return m_team; }
|
||||
public int GetTeamId() { return m_team == Team.Alliance ? TeamId.Alliance : TeamId.Horde; }
|
||||
public int GetTeamId() { return m_team == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; }
|
||||
|
||||
public Team GetEffectiveTeam() { return HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode) ? (GetTeam() == Team.Alliance ? Team.Horde : Team.Alliance) : GetTeam(); }
|
||||
public int GetEffectiveTeamId() { return GetEffectiveTeam() == Team.Alliance ? TeamId.Alliance : TeamId.Horde; }
|
||||
public int GetEffectiveTeamId() { return GetEffectiveTeam() == Team.Alliance ? BatttleGroundTeamId.Alliance : BatttleGroundTeamId.Horde; }
|
||||
|
||||
//Money
|
||||
public ulong GetMoney() { return m_activePlayerData.Coinage; }
|
||||
|
||||
Reference in New Issue
Block a user