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:
@@ -27,64 +27,64 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (GetElapsedTime() >= 17 * Time.Minute * Time.InMilliseconds)
|
||||
{
|
||||
if (GetTeamScore(TeamId.Alliance) == 0)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Alliance) == 0)
|
||||
{
|
||||
if (GetTeamScore(TeamId.Horde) == 0) // No one scored - result is tie
|
||||
if (GetTeamScore(BatttleGroundTeamId.Horde) == 0) // No one scored - result is tie
|
||||
EndBattleground(Team.Other);
|
||||
else // Horde has more points and thus wins
|
||||
EndBattleground(Team.Horde);
|
||||
}
|
||||
else if (GetTeamScore(TeamId.Horde) == 0)
|
||||
else if (GetTeamScore(BatttleGroundTeamId.Horde) == 0)
|
||||
EndBattleground(Team.Alliance); // Alliance has > 0, Horde has 0, alliance wins
|
||||
else if (GetTeamScore(TeamId.Horde) == GetTeamScore(TeamId.Alliance)) // Team score equal, winner is team that scored the last flag
|
||||
else if (GetTeamScore(BatttleGroundTeamId.Horde) == GetTeamScore(BatttleGroundTeamId.Alliance)) // Team score equal, winner is team that scored the last flag
|
||||
EndBattleground((Team)_lastFlagCaptureTeam);
|
||||
else if (GetTeamScore(TeamId.Horde) > GetTeamScore(TeamId.Alliance)) // Last but not least, check who has the higher score
|
||||
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance)) // Last but not least, check who has the higher score
|
||||
EndBattleground(Team.Horde);
|
||||
else
|
||||
EndBattleground(Team.Alliance);
|
||||
}
|
||||
|
||||
if (_flagState[TeamId.Alliance] == WSGFlagState.WaitRespawn)
|
||||
if (_flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.WaitRespawn)
|
||||
{
|
||||
_flagsTimer[TeamId.Alliance] -= (int)diff;
|
||||
_flagsTimer[BatttleGroundTeamId.Alliance] -= (int)diff;
|
||||
|
||||
if (_flagsTimer[TeamId.Alliance] < 0)
|
||||
if (_flagsTimer[BatttleGroundTeamId.Alliance] < 0)
|
||||
{
|
||||
_flagsTimer[TeamId.Alliance] = 0;
|
||||
_flagsTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||
RespawnFlag(Team.Alliance, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (_flagState[TeamId.Alliance] == WSGFlagState.OnGround)
|
||||
if (_flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.OnGround)
|
||||
{
|
||||
_flagsDropTimer[TeamId.Alliance] -= (int)diff;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Alliance] -= (int)diff;
|
||||
|
||||
if (_flagsDropTimer[TeamId.Alliance] < 0)
|
||||
if (_flagsDropTimer[BatttleGroundTeamId.Alliance] < 0)
|
||||
{
|
||||
_flagsDropTimer[TeamId.Alliance] = 0;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||
RespawnFlagAfterDrop(Team.Alliance);
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_flagState[TeamId.Horde] == WSGFlagState.WaitRespawn)
|
||||
if (_flagState[BatttleGroundTeamId.Horde] == WSGFlagState.WaitRespawn)
|
||||
{
|
||||
_flagsTimer[TeamId.Horde] -= (int)diff;
|
||||
_flagsTimer[BatttleGroundTeamId.Horde] -= (int)diff;
|
||||
|
||||
if (_flagsTimer[TeamId.Horde] < 0)
|
||||
if (_flagsTimer[BatttleGroundTeamId.Horde] < 0)
|
||||
{
|
||||
_flagsTimer[TeamId.Horde] = 0;
|
||||
_flagsTimer[BatttleGroundTeamId.Horde] = 0;
|
||||
RespawnFlag(Team.Horde, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (_flagState[TeamId.Horde] == WSGFlagState.OnGround)
|
||||
if (_flagState[BatttleGroundTeamId.Horde] == WSGFlagState.OnGround)
|
||||
{
|
||||
_flagsDropTimer[TeamId.Horde] -= (int)diff;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Horde] -= (int)diff;
|
||||
|
||||
if (_flagsDropTimer[TeamId.Horde] < 0)
|
||||
if (_flagsDropTimer[BatttleGroundTeamId.Horde] < 0)
|
||||
{
|
||||
_flagsDropTimer[TeamId.Horde] = 0;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Horde] = 0;
|
||||
RespawnFlagAfterDrop(Team.Horde);
|
||||
_bothFlagsKept = false;
|
||||
}
|
||||
@@ -125,8 +125,8 @@ namespace Game.BattleGrounds.Zones
|
||||
_flagDebuffState = 2;
|
||||
}
|
||||
}
|
||||
else if ((_flagState[TeamId.Alliance] == WSGFlagState.OnBase || _flagState[TeamId.Alliance] == WSGFlagState.WaitRespawn) &&
|
||||
(_flagState[TeamId.Horde] == WSGFlagState.OnBase || _flagState[TeamId.Horde] == WSGFlagState.WaitRespawn))
|
||||
else if ((_flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.OnBase || _flagState[BatttleGroundTeamId.Alliance] == WSGFlagState.WaitRespawn) &&
|
||||
(_flagState[BatttleGroundTeamId.Horde] == WSGFlagState.OnBase || _flagState[BatttleGroundTeamId.Horde] == WSGFlagState.WaitRespawn))
|
||||
{
|
||||
// Both flags are in base or awaiting respawn.
|
||||
// Remove assault debuffs, reset timers
|
||||
@@ -189,12 +189,12 @@ namespace Game.BattleGrounds.Zones
|
||||
if (Team == Team.Alliance)
|
||||
{
|
||||
Log.outDebug(LogFilter.Battleground, "Respawn Alliance flag");
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnBase;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnBase;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.outDebug(LogFilter.Battleground, "Respawn Horde flag");
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnBase;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnBase;
|
||||
}
|
||||
|
||||
if (captured)
|
||||
@@ -231,7 +231,7 @@ namespace Game.BattleGrounds.Zones
|
||||
SetDroppedFlagGUID(ObjectGuid.Empty, GetTeamIndexByTeamId(team));
|
||||
_bothFlagsKept = false;
|
||||
// Check opposing flag if it is in capture zone; if so, capture it
|
||||
HandleFlagRoomCapturePoint(team == Team.Alliance ? TeamId.Horde : TeamId.Alliance);
|
||||
HandleFlagRoomCapturePoint(team == Team.Alliance ? BatttleGroundTeamId.Horde : BatttleGroundTeamId.Alliance);
|
||||
}
|
||||
|
||||
void EventPlayerCapturedFlag(Player player)
|
||||
@@ -249,7 +249,7 @@ namespace Game.BattleGrounds.Zones
|
||||
return;
|
||||
SetHordeFlagPicker(ObjectGuid.Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// horde flag in base (but not respawned yet)
|
||||
_flagState[TeamId.Horde] = WSGFlagState.WaitRespawn;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.WaitRespawn;
|
||||
// Drop Horde Flag from Player
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
||||
if (_flagDebuffState == 1)
|
||||
@@ -257,7 +257,7 @@ namespace Game.BattleGrounds.Zones
|
||||
else if (_flagDebuffState == 2)
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
|
||||
if (GetTeamScore(TeamId.Alliance) < WSGTimerOrScore.MaxTeamScore)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Alliance) < WSGTimerOrScore.MaxTeamScore)
|
||||
AddPoint(Team.Alliance, 1);
|
||||
PlaySoundToAll(WSGSound.FlagCapturedAlliance);
|
||||
RewardReputationToTeam(890, m_ReputationCapture, Team.Alliance);
|
||||
@@ -268,7 +268,7 @@ namespace Game.BattleGrounds.Zones
|
||||
return;
|
||||
SetAllianceFlagPicker(ObjectGuid.Empty); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// alliance flag in base (but not respawned yet)
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.WaitRespawn;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.WaitRespawn;
|
||||
// Drop Alliance Flag from Player
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
||||
if (_flagDebuffState == 1)
|
||||
@@ -276,7 +276,7 @@ namespace Game.BattleGrounds.Zones
|
||||
else if (_flagDebuffState == 2)
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
|
||||
if (GetTeamScore(TeamId.Horde) < WSGTimerOrScore.MaxTeamScore)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Horde) < WSGTimerOrScore.MaxTeamScore)
|
||||
AddPoint(Team.Horde, 1);
|
||||
PlaySoundToAll(WSGSound.FlagCapturedHorde);
|
||||
RewardReputationToTeam(889, m_ReputationCapture, Team.Horde);
|
||||
@@ -300,10 +300,10 @@ namespace Game.BattleGrounds.Zones
|
||||
// update last flag capture to be used if teamscore is equal
|
||||
SetLastFlagCapture(team);
|
||||
|
||||
if (GetTeamScore(TeamId.Alliance) == WSGTimerOrScore.MaxTeamScore)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Alliance) == WSGTimerOrScore.MaxTeamScore)
|
||||
winner = Team.Alliance;
|
||||
|
||||
if (GetTeamScore(TeamId.Horde) == WSGTimerOrScore.MaxTeamScore)
|
||||
if (GetTeamScore(BatttleGroundTeamId.Horde) == WSGTimerOrScore.MaxTeamScore)
|
||||
winner = Team.Horde;
|
||||
|
||||
if (winner != 0)
|
||||
@@ -324,7 +324,7 @@ namespace Game.BattleGrounds.Zones
|
||||
void HandleFlagRoomCapturePoint(int team)
|
||||
{
|
||||
Player flagCarrier = Global.ObjAccessor.GetPlayer(GetBgMap(), GetFlagPickerGUID(team));
|
||||
uint areaTrigger = team == TeamId.Alliance ? 3647 : 3646u;
|
||||
uint areaTrigger = team == BatttleGroundTeamId.Alliance ? 3647 : 3646u;
|
||||
if (flagCarrier != null && flagCarrier.IsInAreaTriggerRadius(CliDB.AreaTriggerStorage.LookupByKey(areaTrigger)))
|
||||
EventPlayerCapturedFlag(flagCarrier);
|
||||
}
|
||||
@@ -341,7 +341,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
|
||||
if (GetFlagPickerGUID(TeamId.Horde) == player.GetGUID())
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Horde) == player.GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(ObjectGuid.Empty);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
||||
@@ -352,7 +352,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
|
||||
if (GetFlagPickerGUID(TeamId.Alliance) == player.GetGUID())
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Alliance) == player.GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(ObjectGuid.Empty);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
||||
@@ -367,7 +367,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(TeamId.Horde) == player.GetGUID())
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Horde) == player.GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(ObjectGuid.Empty);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.WarsongFlag);
|
||||
@@ -375,7 +375,7 @@ namespace Game.BattleGrounds.Zones
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||
else if (_flagDebuffState == 2)
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnGround;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnGround;
|
||||
player.CastSpell(player, WSGSpellId.WarsongFlagDropped, true);
|
||||
set = true;
|
||||
}
|
||||
@@ -384,7 +384,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
if (GetFlagPickerGUID(TeamId.Alliance) == player.GetGUID())
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Alliance) == player.GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(ObjectGuid.Empty);
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.SilverwingFlag);
|
||||
@@ -392,7 +392,7 @@ namespace Game.BattleGrounds.Zones
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.FocusedAssault);
|
||||
else if (_flagDebuffState == 2)
|
||||
player.RemoveAurasDueToSpell(WSGSpellId.BrutalAssault);
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnGround;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnGround;
|
||||
player.CastSpell(player, WSGSpellId.SilverwingFlagDropped, true);
|
||||
set = true;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ namespace Game.BattleGrounds.Zones
|
||||
PlaySoundToAll(WSGSound.AllianceFlagPickedUp);
|
||||
SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay);
|
||||
SetAllianceFlagPicker(player.GetGUID());
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(Team.Horde, WSGFlagState.OnPlayer);
|
||||
player.CastSpell(player, WSGSpellId.SilverwingFlag, true);
|
||||
@@ -449,7 +449,7 @@ namespace Game.BattleGrounds.Zones
|
||||
PlaySoundToAll(WSGSound.HordeFlagPickedUp);
|
||||
SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay);
|
||||
SetHordeFlagPicker(player.GetGUID());
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnPlayer;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnPlayer;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(Team.Alliance, WSGFlagState.OnPlayer);
|
||||
player.CastSpell(player, WSGSpellId.WarsongFlag, true);
|
||||
@@ -477,7 +477,7 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdatePvpStat(player, (uint)WarsongGulchPvpStats.FlagReturns, 1);
|
||||
_bothFlagsKept = false;
|
||||
|
||||
HandleFlagRoomCapturePoint(TeamId.Horde); // Check Horde flag if it is in capture zone; if so, capture it
|
||||
HandleFlagRoomCapturePoint(BatttleGroundTeamId.Horde); // Check Horde flag if it is in capture zone; if so, capture it
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -486,7 +486,7 @@ namespace Game.BattleGrounds.Zones
|
||||
SpawnBGObject(WSGObjectTypes.AFlag, BattlegroundConst.RespawnOneDay);
|
||||
SetAllianceFlagPicker(player.GetGUID());
|
||||
player.CastSpell(player, WSGSpellId.SilverwingFlag, true);
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||
UpdateFlagState(Team.Horde, WSGFlagState.OnPlayer);
|
||||
if (_flagDebuffState == 1)
|
||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||
@@ -511,7 +511,7 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdatePvpStat(player, (uint)WarsongGulchPvpStats.FlagReturns, 1);
|
||||
_bothFlagsKept = false;
|
||||
|
||||
HandleFlagRoomCapturePoint(TeamId.Alliance); // Check Alliance flag if it is in capture zone; if so, capture it
|
||||
HandleFlagRoomCapturePoint(BatttleGroundTeamId.Alliance); // Check Alliance flag if it is in capture zone; if so, capture it
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -520,7 +520,7 @@ namespace Game.BattleGrounds.Zones
|
||||
SpawnBGObject(WSGObjectTypes.HFlag, BattlegroundConst.RespawnOneDay);
|
||||
SetHordeFlagPicker(player.GetGUID());
|
||||
player.CastSpell(player, WSGSpellId.WarsongFlag, true);
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnPlayer;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnPlayer;
|
||||
UpdateFlagState(Team.Alliance, WSGFlagState.OnPlayer);
|
||||
if (_flagDebuffState == 1)
|
||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||
@@ -537,7 +537,7 @@ namespace Game.BattleGrounds.Zones
|
||||
public override void RemovePlayer(Player player, ObjectGuid guid, Team team)
|
||||
{
|
||||
// sometimes flag aura not removed :(
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[TeamId.Alliance] == guid)
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[BatttleGroundTeamId.Alliance] == guid)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
@@ -548,7 +548,7 @@ namespace Game.BattleGrounds.Zones
|
||||
else
|
||||
EventPlayerDroppedFlag(player);
|
||||
}
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[TeamId.Horde] == guid)
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[BatttleGroundTeamId.Horde] == guid)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
void UpdateTeamScore(int team)
|
||||
{
|
||||
if (team == TeamId.Alliance)
|
||||
if (team == BatttleGroundTeamId.Alliance)
|
||||
UpdateWorldState(WSGWorldStates.FlagCapturesAlliance, (int)GetTeamScore(team));
|
||||
else
|
||||
UpdateWorldState(WSGWorldStates.FlagCapturesHorde, (int)GetTeamScore(team));
|
||||
@@ -628,13 +628,13 @@ namespace Game.BattleGrounds.Zones
|
||||
//buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
||||
break;
|
||||
case 3646: // Alliance Flag spawn
|
||||
if (_flagState[TeamId.Horde] != 0 && _flagState[TeamId.Alliance] == 0)
|
||||
if (GetFlagPickerGUID(TeamId.Horde) == player.GetGUID())
|
||||
if (_flagState[BatttleGroundTeamId.Horde] != 0 && _flagState[BatttleGroundTeamId.Alliance] == 0)
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Horde) == player.GetGUID())
|
||||
EventPlayerCapturedFlag(player);
|
||||
break;
|
||||
case 3647: // Horde Flag spawn
|
||||
if (_flagState[TeamId.Alliance] != 0 && _flagState[TeamId.Horde] == 0)
|
||||
if (GetFlagPickerGUID(TeamId.Alliance) == player.GetGUID())
|
||||
if (_flagState[BatttleGroundTeamId.Alliance] != 0 && _flagState[BatttleGroundTeamId.Horde] == 0)
|
||||
if (GetFlagPickerGUID(BatttleGroundTeamId.Alliance) == player.GetGUID())
|
||||
EventPlayerCapturedFlag(player);
|
||||
break;
|
||||
case 3649: // unk1
|
||||
@@ -694,14 +694,14 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainAlliance);
|
||||
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainAlliance, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.124139f, TeamId.Alliance))
|
||||
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainAlliance, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.124139f, BatttleGroundTeamId.Alliance))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "BgWarsongGluch: Failed to spawn Alliance spirit guide! Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sg = Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainHorde);
|
||||
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainHorde, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.193953f, TeamId.Horde))
|
||||
if (sg == null || !AddSpiritGuide(WSGCreatureTypes.SpiritMainHorde, sg.Loc.GetPositionX(), sg.Loc.GetPositionY(), sg.Loc.GetPositionZ(), 3.193953f, BatttleGroundTeamId.Horde))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "BgWarsongGluch: Failed to spawn Horde spirit guide! Battleground not created!");
|
||||
return false;
|
||||
@@ -715,14 +715,14 @@ namespace Game.BattleGrounds.Zones
|
||||
//call parent's class reset
|
||||
base.Reset();
|
||||
|
||||
m_FlagKeepers[TeamId.Alliance].Clear();
|
||||
m_FlagKeepers[TeamId.Horde].Clear();
|
||||
m_DroppedFlagGUID[TeamId.Alliance] = ObjectGuid.Empty;
|
||||
m_DroppedFlagGUID[TeamId.Horde] = ObjectGuid.Empty;
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnBase;
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnBase;
|
||||
m_TeamScores[TeamId.Alliance] = 0;
|
||||
m_TeamScores[TeamId.Horde] = 0;
|
||||
m_FlagKeepers[BatttleGroundTeamId.Alliance].Clear();
|
||||
m_FlagKeepers[BatttleGroundTeamId.Horde].Clear();
|
||||
m_DroppedFlagGUID[BatttleGroundTeamId.Alliance] = ObjectGuid.Empty;
|
||||
m_DroppedFlagGUID[BatttleGroundTeamId.Horde] = ObjectGuid.Empty;
|
||||
_flagState[BatttleGroundTeamId.Alliance] = WSGFlagState.OnBase;
|
||||
_flagState[BatttleGroundTeamId.Horde] = WSGFlagState.OnBase;
|
||||
m_TeamScores[BatttleGroundTeamId.Alliance] = 0;
|
||||
m_TeamScores[BatttleGroundTeamId.Horde] = 0;
|
||||
|
||||
if (Global.BattlegroundMgr.IsBGWeekend(GetTypeID()))
|
||||
{
|
||||
@@ -740,10 +740,10 @@ namespace Game.BattleGrounds.Zones
|
||||
_bothFlagsKept = false;
|
||||
_flagDebuffState = 0;
|
||||
_flagSpellForceTimer = 0;
|
||||
_flagsDropTimer[TeamId.Alliance] = 0;
|
||||
_flagsDropTimer[TeamId.Horde] = 0;
|
||||
_flagsTimer[TeamId.Alliance] = 0;
|
||||
_flagsTimer[TeamId.Horde] = 0;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||
_flagsDropTimer[BatttleGroundTeamId.Horde] = 0;
|
||||
_flagsTimer[BatttleGroundTeamId.Alliance] = 0;
|
||||
_flagsTimer[BatttleGroundTeamId.Horde] = 0;
|
||||
}
|
||||
|
||||
public override void EndBattleground(Team winner)
|
||||
@@ -800,9 +800,9 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
public override Team GetPrematureWinner()
|
||||
{
|
||||
if (GetTeamScore(TeamId.Alliance) > GetTeamScore(TeamId.Horde))
|
||||
if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde))
|
||||
return Team.Alliance;
|
||||
else if (GetTeamScore(TeamId.Horde) > GetTeamScore(TeamId.Alliance))
|
||||
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance))
|
||||
return Team.Horde;
|
||||
|
||||
return base.GetPrematureWinner();
|
||||
@@ -810,22 +810,22 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
public override ObjectGuid GetFlagPickerGUID(int team = -1)
|
||||
{
|
||||
if (team == TeamId.Alliance || team == TeamId.Horde)
|
||||
if (team == BatttleGroundTeamId.Alliance || team == BatttleGroundTeamId.Horde)
|
||||
return m_FlagKeepers[team];
|
||||
|
||||
return ObjectGuid.Empty;
|
||||
}
|
||||
|
||||
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[TeamId.Alliance] = guid; }
|
||||
void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[TeamId.Horde] = guid; }
|
||||
bool IsAllianceFlagPickedup() { return !m_FlagKeepers[TeamId.Alliance].IsEmpty(); }
|
||||
bool IsHordeFlagPickedup() { return !m_FlagKeepers[TeamId.Horde].IsEmpty(); }
|
||||
void SetAllianceFlagPicker(ObjectGuid guid) { m_FlagKeepers[BatttleGroundTeamId.Alliance] = guid; }
|
||||
void SetHordeFlagPicker(ObjectGuid guid) { m_FlagKeepers[BatttleGroundTeamId.Horde] = guid; }
|
||||
bool IsAllianceFlagPickedup() { return !m_FlagKeepers[BatttleGroundTeamId.Alliance].IsEmpty(); }
|
||||
bool IsHordeFlagPickedup() { return !m_FlagKeepers[BatttleGroundTeamId.Horde].IsEmpty(); }
|
||||
WSGFlagState GetFlagState(Team team) { return _flagState[GetTeamIndexByTeamId(team)]; }
|
||||
|
||||
void SetLastFlagCapture(Team team) { _lastFlagCaptureTeam = (uint)team; }
|
||||
public override void SetDroppedFlagGUID(ObjectGuid guid, int team = -1)
|
||||
{
|
||||
if (team == TeamId.Alliance || team == TeamId.Horde)
|
||||
if (team == BatttleGroundTeamId.Alliance || team == BatttleGroundTeamId.Horde)
|
||||
m_DroppedFlagGUID[team] = guid;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user