Core/WorldStates: Migrate battleground worldstates to new system
Port From (https://github.com/TrinityCore/TrinityCore/commit/5dbfaecd5c020fd4c3b3dfc235580849c39ce7db)
This commit is contained in:
@@ -635,22 +635,14 @@ namespace Game.BattleGrounds
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateWorldState(uint variable, uint value, bool hidden = false)
|
||||
public void UpdateWorldState(int worldStateId, int value, bool hidden = false)
|
||||
{
|
||||
UpdateWorldState worldstate = new();
|
||||
worldstate.VariableID = variable;
|
||||
worldstate.Value = (int)value;
|
||||
worldstate.Hidden = hidden;
|
||||
SendPacketToAll(worldstate);
|
||||
Global.WorldStateMgr.SetValue(worldStateId, value, hidden, GetBgMap());
|
||||
}
|
||||
|
||||
public void UpdateWorldState(uint variable, bool value, bool hidden = false)
|
||||
public void UpdateWorldState(uint worldStateId, int value, bool hidden = false)
|
||||
{
|
||||
UpdateWorldState worldstate = new();
|
||||
worldstate.VariableID = variable;
|
||||
worldstate.Value = value ? 1 : 0;
|
||||
worldstate.Hidden = hidden;
|
||||
SendPacketToAll(worldstate);
|
||||
Global.WorldStateMgr.SetValue((int)worldStateId, value, hidden, GetBgMap());
|
||||
}
|
||||
|
||||
public virtual void EndBattleground(Team winner)
|
||||
@@ -958,8 +950,6 @@ namespace Game.BattleGrounds
|
||||
|
||||
PlayerScores.Clear();
|
||||
|
||||
ResetBGSubclass();
|
||||
|
||||
_playerPositions.Clear();
|
||||
}
|
||||
|
||||
@@ -1883,12 +1873,6 @@ namespace Game.BattleGrounds
|
||||
trigger, player.GetMapId(), player.GetPositionX(), player.GetPositionY(), player.GetPositionZ());
|
||||
}
|
||||
|
||||
public virtual bool CheckAchievementCriteriaMeet(uint criteriaId, Player source, Unit target, uint miscvalue1 = 0)
|
||||
{
|
||||
Log.outError(LogFilter.Battleground, "Battleground.CheckAchievementCriteriaMeet: No implementation for criteria {0}", criteriaId);
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool SetupBattleground()
|
||||
{
|
||||
return true;
|
||||
@@ -1967,10 +1951,8 @@ namespace Game.BattleGrounds
|
||||
|
||||
public virtual void StartingEventCloseDoors() { }
|
||||
public virtual void StartingEventOpenDoors() { }
|
||||
public virtual void ResetBGSubclass() { } // must be implemented in BG subclass
|
||||
|
||||
public virtual void DestroyGate(Player player, GameObject go) { }
|
||||
public virtual bool IsAllNodesControlledByTeam(Team team) { return false; }
|
||||
|
||||
public BattlegroundQueueTypeId GetQueueId() { return m_queueId; }
|
||||
public uint GetInstanceID() { return m_InstanceID; }
|
||||
@@ -2029,8 +2011,6 @@ namespace Game.BattleGrounds
|
||||
public void SetBgMap(BattlegroundMap map) { m_Map = map; }
|
||||
BattlegroundMap FindBgMap() { return m_Map; }
|
||||
|
||||
public virtual void FillInitialWorldStates(InitWorldStates data) { }
|
||||
|
||||
Group GetBgRaid(Team team) { return m_BgRaids[GetTeamIndexByTeamId(team)]; }
|
||||
|
||||
public static int GetTeamIndexByTeamId(Team team) { return team == Team.Alliance ? TeamId.Alliance : TeamId.Horde; }
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace Game.BattleGrounds.Zones
|
||||
m_lastTick[i] = 0;
|
||||
m_HonorScoreTics[i] = 0;
|
||||
m_ReputationScoreTics[i] = 0;
|
||||
m_TeamScores500Disadvantage[i] = false;
|
||||
}
|
||||
|
||||
m_HonorTics = 0;
|
||||
@@ -163,14 +162,19 @@ namespace Game.BattleGrounds.Zones
|
||||
m_TeamScores[team] = MaxTeamScore;
|
||||
|
||||
if (team == TeamId.Alliance)
|
||||
UpdateWorldState(ABWorldStates.ResourcesAlly, m_TeamScores[team]);
|
||||
UpdateWorldState(ABWorldStates.ResourcesAlly, (int)m_TeamScores[team]);
|
||||
else
|
||||
UpdateWorldState(ABWorldStates.ResourcesHorde, m_TeamScores[team]);
|
||||
UpdateWorldState(ABWorldStates.ResourcesHorde, (int)m_TeamScores[team]);
|
||||
// update achievement flags
|
||||
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
||||
int otherTeam = (team + 1) % SharedConst.PvpTeamsCount;
|
||||
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
|
||||
m_TeamScores500Disadvantage[otherTeam] = true;
|
||||
{
|
||||
if (team == TeamId.Alliance)
|
||||
UpdateWorldState(ABWorldStates.Had500DisadvantageHorde, 1);
|
||||
else
|
||||
UpdateWorldState(ABWorldStates.Had500DisadvantageAlliance, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,51 +294,49 @@ namespace Game.BattleGrounds.Zones
|
||||
SpawnBGObject(obj, BattlegroundConst.RespawnOneDay);
|
||||
}
|
||||
|
||||
public override void FillInitialWorldStates(InitWorldStates packet)
|
||||
{
|
||||
byte[] plusArray = { 0, 2, 3, 0, 1 };
|
||||
|
||||
// Node icons
|
||||
for (byte node = 0; node < ABBattlegroundNodes.DynamicNodesCount; ++node)
|
||||
packet.AddState(NodeIcons[node], (m_Nodes[node] == 0));
|
||||
|
||||
// Node occupied states
|
||||
for (byte node = 0; node < ABBattlegroundNodes.DynamicNodesCount; ++node)
|
||||
for (byte i = 1; i < ABBattlegroundNodes.DynamicNodesCount; ++i)
|
||||
packet.AddState(NodeStates[node] + plusArray[i], ((int)m_Nodes[node] == i));
|
||||
|
||||
// How many bases each team owns
|
||||
byte ally = 0, horde = 0;
|
||||
for (byte node = 0; node < ABBattlegroundNodes.DynamicNodesCount; ++node)
|
||||
if (m_Nodes[node] == ABNodeStatus.AllyOccupied)
|
||||
++ally;
|
||||
else if (m_Nodes[node] == ABNodeStatus.HordeOccupied)
|
||||
++horde;
|
||||
|
||||
packet.AddState(ABWorldStates.OccupiedBasesAlly, ally);
|
||||
packet.AddState(ABWorldStates.OccupiedBasesHorde, horde);
|
||||
|
||||
// Team scores
|
||||
packet.AddState(ABWorldStates.ResourcesMax, MaxTeamScore);
|
||||
packet.AddState(ABWorldStates.ResourcesWarning, WarningNearVictoryScore);
|
||||
packet.AddState(ABWorldStates.ResourcesAlly, m_TeamScores[TeamId.Alliance]);
|
||||
packet.AddState(ABWorldStates.ResourcesHorde, m_TeamScores[TeamId.Horde]);
|
||||
|
||||
// other unknown
|
||||
packet.AddState(0x745, 0x2);
|
||||
}
|
||||
|
||||
void _SendNodeUpdate(byte node)
|
||||
{
|
||||
// Send node owner state update to refresh map icons on client
|
||||
byte[] plusArray = { 0, 2, 3, 0, 1 };
|
||||
int[] idPlusArray = { 0, 2, 3, 0, 1 };
|
||||
int[] statePlusArray = { 0, 2, 0, 2, 0 };
|
||||
|
||||
if (m_prevNodes[node] != 0)
|
||||
UpdateWorldState(NodeStates[node] + plusArray[(int)m_prevNodes[node]], 0);
|
||||
UpdateWorldState(NodeStates[node] + idPlusArray[(int)m_prevNodes[node]], 0);
|
||||
else
|
||||
UpdateWorldState(NodeIcons[node], 0);
|
||||
|
||||
UpdateWorldState(NodeStates[node] + plusArray[(byte)m_Nodes[node]], 1);
|
||||
UpdateWorldState(NodeStates[node] + idPlusArray[(byte)m_Nodes[node]], 1);
|
||||
|
||||
switch (node)
|
||||
{
|
||||
case ABBattlegroundNodes.NodeStables:
|
||||
UpdateWorldState(ABWorldStates.StablesIconNew, (int)m_Nodes[node] + statePlusArray[(int)m_Nodes[node]]);
|
||||
UpdateWorldState(ABWorldStates.StablesHordeControlState, m_Nodes[node] == ABNodeStatus.HordeOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.HordeContested ? 1 : 0));
|
||||
UpdateWorldState(ABWorldStates.StablesAllianceControlState, m_Nodes[node] == ABNodeStatus.AllyOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.AllyContested ? 1 : 0));
|
||||
break;
|
||||
case ABBattlegroundNodes.NodeBlacksmith:
|
||||
UpdateWorldState(ABWorldStates.BlacksmithIconNew, (int)m_Nodes[node] + statePlusArray[(int)m_Nodes[node]]);
|
||||
UpdateWorldState(ABWorldStates.BlacksmithHordeControlState, m_Nodes[node] == ABNodeStatus.HordeOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.HordeContested ? 1 : 0));
|
||||
UpdateWorldState(ABWorldStates.BlacksmithAllianceControlState, m_Nodes[node] == ABNodeStatus.AllyOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.AllyContested ? 1 : 0));
|
||||
break;
|
||||
case ABBattlegroundNodes.NodeFarm:
|
||||
UpdateWorldState(ABWorldStates.FarmIconNew, (int)m_Nodes[node] + statePlusArray[(int)m_Nodes[node]]);
|
||||
UpdateWorldState(ABWorldStates.FarmHordeControlState, m_Nodes[node] == ABNodeStatus.HordeOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.HordeContested ? 1 : 0));
|
||||
UpdateWorldState(ABWorldStates.FarmAllianceControlState, m_Nodes[node] == ABNodeStatus.AllyOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.AllyContested ? 1 : 0));
|
||||
break;
|
||||
case ABBattlegroundNodes.NodeLumberMill:
|
||||
UpdateWorldState(ABWorldStates.LumberMillIconNew, (int)m_Nodes[node] + statePlusArray[(int)m_Nodes[node]]);
|
||||
UpdateWorldState(ABWorldStates.LumberMillHordeControlState, m_Nodes[node] == ABNodeStatus.HordeOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.HordeContested ? 1 : 0));
|
||||
UpdateWorldState(ABWorldStates.LumberMillAllianceControlState, m_Nodes[node] == ABNodeStatus.AllyOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.AllyContested ? 1 : 0));
|
||||
break;
|
||||
case ABBattlegroundNodes.NodeGoldMine:
|
||||
UpdateWorldState(ABWorldStates.GoldMineIconNew, (int)m_Nodes[node] + statePlusArray[(int)m_Nodes[node]]);
|
||||
UpdateWorldState(ABWorldStates.GoldMineHordeControlState, m_Nodes[node] == ABNodeStatus.HordeOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.HordeContested ? 1 : 0));
|
||||
UpdateWorldState(ABWorldStates.GoldMineAllianceControlState, m_Nodes[node] == ABNodeStatus.AllyOccupied ? 2 : (m_Nodes[node] == ABNodeStatus.AllyContested ? 1 : 0));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// How many bases each team owns
|
||||
byte ally = 0, horde = 0;
|
||||
@@ -581,6 +583,9 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
}
|
||||
|
||||
UpdateWorldState(ABWorldStates.ResourcesMax, MaxTeamScore);
|
||||
UpdateWorldState(ABWorldStates.ResourcesWarning, WarningNearVictoryScore);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -595,7 +600,6 @@ namespace Game.BattleGrounds.Zones
|
||||
m_lastTick[i] = 0;
|
||||
m_HonorScoreTics[i] = 0;
|
||||
m_ReputationScoreTics[i] = 0;
|
||||
m_TeamScores500Disadvantage[i] = false;
|
||||
}
|
||||
|
||||
m_IsInformedNearVictory = false;
|
||||
@@ -689,28 +693,6 @@ namespace Game.BattleGrounds.Zones
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool IsAllNodesControlledByTeam(Team team)
|
||||
{
|
||||
uint count = 0;
|
||||
for (int i = 0; i < ABBattlegroundNodes.DynamicNodesCount; ++i)
|
||||
if ((team == Team.Alliance && m_Nodes[i] == ABNodeStatus.AllyOccupied) ||
|
||||
(team == Team.Horde && m_Nodes[i] == ABNodeStatus.HordeOccupied))
|
||||
++count;
|
||||
|
||||
return count == ABBattlegroundNodes.DynamicNodesCount;
|
||||
}
|
||||
|
||||
public override bool CheckAchievementCriteriaMeet(uint criteriaId, Player player, Unit target, uint miscvalue)
|
||||
{
|
||||
switch ((BattlegroundCriteriaId)criteriaId)
|
||||
{
|
||||
case BattlegroundCriteriaId.ResilientVictory:
|
||||
return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID()))];
|
||||
}
|
||||
|
||||
return base.CheckAchievementCriteriaMeet(criteriaId, player, target, miscvalue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Nodes info:
|
||||
/// 0: neutral
|
||||
@@ -729,8 +711,6 @@ namespace Game.BattleGrounds.Zones
|
||||
bool m_IsInformedNearVictory;
|
||||
uint m_HonorTics;
|
||||
uint m_ReputationTics;
|
||||
// need for achievements
|
||||
bool[] m_TeamScores500Disadvantage = new bool[SharedConst.PvpTeamsCount];
|
||||
|
||||
//Const
|
||||
public const uint NotABBGWeekendHonorTicks = 260;
|
||||
@@ -751,7 +731,7 @@ namespace Game.BattleGrounds.Zones
|
||||
public const int FlagCapturingTime = 60000;
|
||||
|
||||
public const int WarningNearVictoryScore = 1400;
|
||||
public const int MaxTeamScore = 1600;
|
||||
public const int MaxTeamScore = 1500;
|
||||
|
||||
public const uint ExploitTeleportLocationAlliance = 3705;
|
||||
public const uint ExploitTeleportLocationHorde = 3706;
|
||||
@@ -800,9 +780,9 @@ namespace Game.BattleGrounds.Zones
|
||||
new Position(714.61f, 646.15f, -10.87f, 4.34f) // horde starting base
|
||||
};
|
||||
|
||||
public static uint[] NodeStates = { 1767, 1782, 1772, 1792, 1787 };
|
||||
public static int[] NodeStates = { 1767, 1782, 1772, 1792, 1787 };
|
||||
|
||||
public static uint[] NodeIcons = { 1842, 1846, 1845, 1844, 1843 };
|
||||
public static int[] NodeIcons = { 1842, 1846, 1845, 1844, 1843 };
|
||||
}
|
||||
|
||||
class BattlegroundABScore : BattlegroundScore
|
||||
@@ -854,40 +834,58 @@ namespace Game.BattleGrounds.Zones
|
||||
#region Consts
|
||||
struct ABWorldStates
|
||||
{
|
||||
public const uint OccupiedBasesHorde = 1778;
|
||||
public const uint OccupiedBasesAlly = 1779;
|
||||
public const uint ResourcesAlly = 1776;
|
||||
public const uint ResourcesHorde = 1777;
|
||||
public const uint ResourcesMax = 1780;
|
||||
public const uint ResourcesWarning = 1955;
|
||||
/*
|
||||
public const uint StableIcon = 1842; //Stable Map Icon (None)
|
||||
public const uint StableStateAlience = 1767; //Stable Map State (Alience)
|
||||
public const uint StableStateHorde = 1768; //Stable Map State (Horde)
|
||||
public const uint StableStateConAli = 1769; //Stable Map State (Con Alience)
|
||||
public const uint StableStateConHor = 1770; //Stable Map State (Con Horde)
|
||||
public const uint FarmIcon = 1845; //Farm Map Icon (None)
|
||||
public const uint FarmStateAlience = 1772; //Farm State (Alience)
|
||||
public const uint FarmStateHorde = 1773; //Farm State (Horde)
|
||||
public const uint FarmStateConAli = 1774; //Farm State (Con Alience)
|
||||
public const uint FarmStateConHor = 1775; //Farm State (Con Horde)
|
||||
public const int OccupiedBasesHorde = 1778;
|
||||
public const int OccupiedBasesAlly = 1779;
|
||||
public const int ResourcesAlly = 1776;
|
||||
public const int ResourcesHorde = 1777;
|
||||
public const int ResourcesMax = 1780;
|
||||
public const int ResourcesWarning = 1955;
|
||||
|
||||
public const uint BlacksmithIcon = 1846; //Blacksmith Map Icon (None)
|
||||
public const uint BlacksmithStateAlience = 1782; //Blacksmith Map State (Alience)
|
||||
public const uint BlacksmithStateHorde = 1783; //Blacksmith Map State (Horde)
|
||||
public const uint BlacksmithStateConAli = 1784; //Blacksmith Map State (Con Alience)
|
||||
public const uint BlacksmithStateConHor = 1785; //Blacksmith Map State (Con Horde)
|
||||
public const uint LumbermillIcon = 1844; //Lumber Mill Map Icon (None)
|
||||
public const uint LumbermillStateAlience = 1792; //Lumber Mill Map State (Alience)
|
||||
public const uint LumbermillStateHorde = 1793; //Lumber Mill Map State (Horde)
|
||||
public const uint LumbermillStateConAli = 1794; //Lumber Mill Map State (Con Alience)
|
||||
public const uint LumbermillStateConHor = 1795; //Lumber Mill Map State (Con Horde)
|
||||
public const uint GoldmineIcon = 1843; //Gold Mine Map Icon (None)
|
||||
public const uint GoldmineStateAlience = 1787; //Gold Mine Map State (Alience)
|
||||
public const uint GoldmineStateHorde = 1788; //Gold Mine Map State (Horde)
|
||||
public const uint GoldmineStateConAli = 1789; //Gold Mine Map State (Con Alience
|
||||
public const uint GoldmineStateConHor = 1790; //Gold Mine Map State (Con Horde)
|
||||
*/
|
||||
public const int StableIcon = 1842; // Stable Map Icon (None)
|
||||
public const int StableStateAlience = 1767; // Stable Map State (Alience)
|
||||
public const int StableStateHorde = 1768; // Stable Map State (Horde)
|
||||
public const int StableStateConAli = 1769; // Stable Map State (Con Alience)
|
||||
public const int StableStateConHor = 1770; // Stable Map State (Con Horde)
|
||||
public const int FarmIcon = 1845; // Farm Map Icon (None)
|
||||
public const int FarmStateAlience = 1772; // Farm State (Alience)
|
||||
public const int FarmStateHorde = 1773; // Farm State (Horde)
|
||||
public const int FarmStateConAli = 1774; // Farm State (Con Alience)
|
||||
public const int FarmStateConHor = 1775; // Farm State (Con Horde)
|
||||
public const int BlacksmithIcon = 1846; // Blacksmith Map Icon (None)
|
||||
public const int BlacksmithStateAlience = 1782; // Blacksmith Map State (Alience)
|
||||
public const int BlacksmithStateHorde = 1783; // Blacksmith Map State (Horde)
|
||||
public const int BlacksmithStateConAli = 1784; // Blacksmith Map State (Con Alience)
|
||||
public const int BlacksmithStateConHor = 1785; // Blacksmith Map State (Con Horde)
|
||||
public const int LumbermillIcon = 1844; // Lumber Mill Map Icon (None)
|
||||
public const int LumbermillStateAlience = 1792; // Lumber Mill Map State (Alience)
|
||||
public const int LumbermillStateHorde = 1793; // Lumber Mill Map State (Horde)
|
||||
public const int LumbermillStateConAli = 1794; // Lumber Mill Map State (Con Alience)
|
||||
public const int LumbermillStateConHor = 1795; // Lumber Mill Map State (Con Horde)
|
||||
public const int GoldmineIcon = 1843; // Gold Mine Map Icon (None)
|
||||
public const int GoldmineStateAlience = 1787; // Gold Mine Map State (Alience)
|
||||
public const int GoldmineStateHorde = 1788; // Gold Mine Map State (Horde)
|
||||
public const int GoldmineStateConAli = 1789; // Gold Mine Map State (Con Alience
|
||||
public const int GoldmineStateConHor = 1790; // Gold Mine Map State (Con Horde)
|
||||
|
||||
public const int Had500DisadvantageAlliance = 3644;
|
||||
public const int Had500DisadvantageHorde = 3645;
|
||||
|
||||
public const int FarmIconNew = 8808; // Farm Map Icon
|
||||
public const int LumberMillIconNew = 8805; // Lumber Mill Map Icon
|
||||
public const int BlacksmithIconNew = 8799; // Blacksmith Map Icon
|
||||
public const int GoldMineIconNew = 8809; // Gold Mine Map Icon
|
||||
public const int StablesIconNew = 5834; // Stable Map Icon
|
||||
|
||||
public const int FarmHordeControlState = 17328;
|
||||
public const int FarmAllianceControlState = 17325;
|
||||
public const int LumberMillHordeControlState = 17330;
|
||||
public const int LumberMillAllianceControlState = 17326;
|
||||
public const int BlacksmithHordeControlState = 17327;
|
||||
public const int BlacksmithAllianceControlState = 17324;
|
||||
public const int GoldMineHordeControlState = 17329;
|
||||
public const int GoldMineAllianceControlState = 17323;
|
||||
public const int StablesHordeControlState = 17331;
|
||||
public const int StablesAllianceControlState = 17322;
|
||||
}
|
||||
|
||||
// Note: code uses that these IDs follow each other
|
||||
@@ -1006,8 +1004,6 @@ namespace Game.BattleGrounds.Zones
|
||||
public uint TextHordeClaims;
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum ABNodeStatus
|
||||
{
|
||||
Neutral = 0,
|
||||
|
||||
@@ -300,8 +300,8 @@ namespace Game.BattleGrounds.Zones
|
||||
BattlegroundPointCaptureStatus captureStatus = GetPointCaptureStatus(point);
|
||||
if (m_LastPointCaptureStatus[point] != captureStatus)
|
||||
{
|
||||
UpdateWorldState(EotSMisc.m_PointsIconStruct[point].WorldStateAllianceStatusBarIcon, (uint)(captureStatus == BattlegroundPointCaptureStatus.AllianceControlled ? 2 : (captureStatus == BattlegroundPointCaptureStatus.AllianceCapturing ? 1 : 0)));
|
||||
UpdateWorldState(EotSMisc.m_PointsIconStruct[point].WorldStateHordeStatusBarIcon, (uint)(captureStatus == BattlegroundPointCaptureStatus.HordeControlled ? 2 : (captureStatus == BattlegroundPointCaptureStatus.HordeCapturing ? 1 : 0)));
|
||||
UpdateWorldState(EotSMisc.m_PointsIconStruct[point].WorldStateAllianceStatusBarIcon, (int)(captureStatus == BattlegroundPointCaptureStatus.AllianceControlled ? 2 : (captureStatus == BattlegroundPointCaptureStatus.AllianceCapturing ? 1 : 0)));
|
||||
UpdateWorldState(EotSMisc.m_PointsIconStruct[point].WorldStateHordeStatusBarIcon, (int)(captureStatus == BattlegroundPointCaptureStatus.HordeControlled ? 2 : (captureStatus == BattlegroundPointCaptureStatus.HordeCapturing ? 1 : 0)));
|
||||
m_LastPointCaptureStatus[point] = captureStatus;
|
||||
}
|
||||
}
|
||||
@@ -320,9 +320,9 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
|
||||
if (team == TeamId.Alliance)
|
||||
UpdateWorldState(EotSWorldStateIds.AllianceResources, score);
|
||||
UpdateWorldState(EotSWorldStateIds.AllianceResources, (int)score);
|
||||
else
|
||||
UpdateWorldState(EotSWorldStateIds.HordeResources, score);
|
||||
UpdateWorldState(EotSWorldStateIds.HordeResources, (int)score);
|
||||
}
|
||||
|
||||
public override void EndBattleground(Team winner)
|
||||
@@ -342,9 +342,9 @@ namespace Game.BattleGrounds.Zones
|
||||
void UpdatePointsCount(Team team)
|
||||
{
|
||||
if (team == Team.Alliance)
|
||||
UpdateWorldState(EotSWorldStateIds.AllianceBase, m_TeamPointsCount[TeamId.Alliance]);
|
||||
UpdateWorldState(EotSWorldStateIds.AllianceBase, (int)m_TeamPointsCount[TeamId.Alliance]);
|
||||
else
|
||||
UpdateWorldState(EotSWorldStateIds.HordeBase, m_TeamPointsCount[TeamId.Horde]);
|
||||
UpdateWorldState(EotSWorldStateIds.HordeBase, (int)m_TeamPointsCount[TeamId.Horde]);
|
||||
}
|
||||
|
||||
void UpdatePointsIcons(Team team, int Point)
|
||||
@@ -638,8 +638,8 @@ namespace Game.BattleGrounds.Zones
|
||||
player.CastSpell(player, BattlegroundConst.SpellRecentlyDroppedFlag, true);
|
||||
player.CastSpell(player, EotSMisc.SpellPlayerDroppedFlag, true);
|
||||
//this does not work correctly :((it should remove flag carrier name)
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateHorde, (uint)EotSFlagState.WaitRespawn);
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (uint)EotSFlagState.WaitRespawn);
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateHorde, (int)EotSFlagState.WaitRespawn);
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (int)EotSFlagState.WaitRespawn);
|
||||
|
||||
if (GetPlayerTeam(player.GetGUID()) == Team.Alliance)
|
||||
SendBroadcastText(EotSBroadcastTexts.FlagDropped, ChatMsg.BgSystemAlliance, null);
|
||||
@@ -654,12 +654,12 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
if (GetPlayerTeam(player.GetGUID()) == Team.Alliance)
|
||||
{
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (uint)EotSFlagState.OnPlayer);
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (int)EotSFlagState.OnPlayer);
|
||||
PlaySoundToAll(EotSSoundIds.FlagPickedUpAlliance);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateHorde, (uint)EotSFlagState.OnPlayer);
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateHorde, (int)EotSFlagState.OnPlayer);
|
||||
PlaySoundToAll(EotSSoundIds.FlagPickedUpHorde);
|
||||
}
|
||||
|
||||
@@ -847,54 +847,6 @@ namespace Game.BattleGrounds.Zones
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void FillInitialWorldStates(InitWorldStates packet)
|
||||
{
|
||||
packet.AddState(EotSWorldStateIds.HordeBase, m_TeamPointsCount[TeamId.Horde]);
|
||||
packet.AddState(EotSWorldStateIds.AllianceBase, m_TeamPointsCount[TeamId.Alliance]);
|
||||
packet.AddState(0xAB6, 0x0);
|
||||
packet.AddState(0xAB5, 0x0);
|
||||
packet.AddState(0xAB4, 0x0);
|
||||
packet.AddState(0xAB3, 0x0);
|
||||
packet.AddState(0xAB2, 0x0);
|
||||
packet.AddState(0xAB1, 0x0);
|
||||
packet.AddState(0xAB0, 0x0);
|
||||
packet.AddState(0xAAF, 0x0);
|
||||
|
||||
packet.AddState((EotSWorldStateIds.DraeneiRuinsHordeControl), (m_PointOwnedByTeam[EotSPoints.DraeneiRuins] == Team.Horde && m_PointState[EotSPoints.DraeneiRuins] == EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.DraeneiRuinsAllianceControl), (m_PointOwnedByTeam[EotSPoints.DraeneiRuins] == Team.Alliance && m_PointState[EotSPoints.DraeneiRuins] == EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.DraeneiRuinsUncontrol), (m_PointState[EotSPoints.DraeneiRuins] != EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.MageTowerAllianceControl), (m_PointOwnedByTeam[EotSPoints.MageTower] == Team.Alliance && m_PointState[EotSPoints.MageTower] == EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.MageTowerHordeControl), (m_PointOwnedByTeam[EotSPoints.MageTower] == Team.Horde && m_PointState[EotSPoints.MageTower] == EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.MageTowerUncontrol), (m_PointState[EotSPoints.MageTower] != EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.FelReaverHordeControl), (m_PointOwnedByTeam[EotSPoints.FelReaver] == Team.Horde && m_PointState[EotSPoints.FelReaver] == EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.FelReaverAllianceControl), (m_PointOwnedByTeam[EotSPoints.FelReaver] == Team.Alliance && m_PointState[EotSPoints.FelReaver] == EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.FelReaverUncontrol), (m_PointState[EotSPoints.FelReaver] != EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.BloodElfHordeControl), (m_PointOwnedByTeam[EotSPoints.BloodElf] == Team.Horde && m_PointState[EotSPoints.BloodElf] == EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.BloodElfAllianceControl), (m_PointOwnedByTeam[EotSPoints.BloodElf] == Team.Alliance && m_PointState[EotSPoints.BloodElf] == EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.BloodElfUncontrol), (m_PointState[EotSPoints.BloodElf] != EotSPointState.UnderControl));
|
||||
packet.AddState((EotSWorldStateIds.NetherstormFlag), (m_FlagState == EotSFlagState.OnBase));
|
||||
|
||||
packet.AddState(0xAD2, 0x1);
|
||||
packet.AddState(0xAD1, 0x1);
|
||||
|
||||
packet.AddState(EotSWorldStateIds.HordeResources, GetTeamScore(TeamId.Horde));
|
||||
packet.AddState(EotSWorldStateIds.AllianceResources, GetTeamScore(TeamId.Alliance));
|
||||
packet.AddState(EotSWorldStateIds.MaxResources, EotSScoreIds.MaxTeamScore);
|
||||
|
||||
packet.AddState(0xA05, 0x8E);
|
||||
packet.AddState(0xAA0, 0x0);
|
||||
packet.AddState(0xA9F, 0x0);
|
||||
packet.AddState(0xA9E, 0x0);
|
||||
packet.AddState(0xC0D, 0x17B);
|
||||
|
||||
for (byte point = 0; point < EotSPoints.PointsMax; ++point)
|
||||
{
|
||||
BattlegroundPointCaptureStatus captureStatus = GetPointCaptureStatus(point);
|
||||
packet.AddState(EotSMisc.m_PointsIconStruct[point].WorldStateAllianceStatusBarIcon, captureStatus == BattlegroundPointCaptureStatus.AllianceControlled ? 2 : (captureStatus == BattlegroundPointCaptureStatus.AllianceCapturing ? 1 : 0u));
|
||||
packet.AddState(EotSMisc.m_PointsIconStruct[point].WorldStateHordeStatusBarIcon, captureStatus == BattlegroundPointCaptureStatus.HordeControlled ? 2 : (captureStatus == BattlegroundPointCaptureStatus.HordeCapturing ? 1 : 0u));
|
||||
}
|
||||
}
|
||||
|
||||
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
|
||||
{
|
||||
uint g_id;
|
||||
@@ -952,16 +904,6 @@ namespace Game.BattleGrounds.Zones
|
||||
return Global.ObjectMgr.GetWorldSafeLoc(team == Team.Alliance ? EotSMisc.ExploitTeleportLocationAlliance : EotSMisc.ExploitTeleportLocationHorde);
|
||||
}
|
||||
|
||||
public override bool IsAllNodesControlledByTeam(Team team)
|
||||
{
|
||||
uint count = 0;
|
||||
for (int i = 0; i < EotSPoints.PointsMax; ++i)
|
||||
if (m_PointOwnedByTeam[i] == team && m_PointState[i] == EotSPointState.UnderControl)
|
||||
++count;
|
||||
|
||||
return count == EotSPoints.PointsMax;
|
||||
}
|
||||
|
||||
public override Team GetPrematureWinner()
|
||||
{
|
||||
if (GetTeamScore(TeamId.Alliance) > GetTeamScore(TeamId.Horde))
|
||||
@@ -1189,7 +1131,7 @@ namespace Game.BattleGrounds.Zones
|
||||
public const uint ProgressBarPercentGrey = 2720; //100 = Empty (Only Grey); 0 = Blue|Red (No Grey)
|
||||
public const uint ProgressBarStatus = 2719; //50 Init!; 48 ... Hordak Bere .. 33 .. 0 = Full 100% Hordacky; 100 = Full Alliance
|
||||
public const uint ProgressBarShow = 2718; //1 Init; 0 Druhy Send - Bez Messagu; 1 = Controlled Aliance
|
||||
public const uint NetherstormFlag = 2757;
|
||||
public const uint NetherstormFlag = 8863;
|
||||
//Set To 2 When Flag Is Picked Up; And To 1 If It Is Dropped
|
||||
public const uint NetherstormFlagStateAlliance = 9808;
|
||||
public const uint NetherstormFlagStateHorde = 9809;
|
||||
@@ -1373,7 +1315,7 @@ namespace Game.BattleGrounds.Zones
|
||||
struct EotSScoreIds
|
||||
{
|
||||
public const uint WarningNearVictoryScore = 1400;
|
||||
public const uint MaxTeamScore = 1600;
|
||||
public const uint MaxTeamScore = 1500;
|
||||
}
|
||||
|
||||
enum EotSFlagState
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace Game.BattleGrounds.Zones
|
||||
SignaledRoundTwo = false;
|
||||
SignaledRoundTwoHalfMin = false;
|
||||
InitSecondRound = false;
|
||||
_gateDestroyed = false;
|
||||
Attackers = TeamId.Alliance;
|
||||
TotalTime = 0;
|
||||
EndRoundTimer = 0;
|
||||
@@ -44,13 +43,12 @@ namespace Game.BattleGrounds.Zones
|
||||
Status = SAStatus.NotStarted;
|
||||
|
||||
for (byte i = 0; i < GateStatus.Length; ++i)
|
||||
GateStatus[i] = SAGateState.Ok;
|
||||
GateStatus[i] = SAGateState.HordeGateOk;
|
||||
|
||||
for (byte i = 0; i < 2; i++)
|
||||
{
|
||||
RoundScores[i].winner = TeamId.Alliance;
|
||||
RoundScores[i].time = 0;
|
||||
_allVehiclesAlive[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,11 +57,8 @@ namespace Game.BattleGrounds.Zones
|
||||
TotalTime = 0;
|
||||
Attackers = (RandomHelper.URand(0, 1) != 0 ? TeamId.Alliance : TeamId.Horde);
|
||||
for (byte i = 0; i <= 5; i++)
|
||||
GateStatus[i] = SAGateState.Ok;
|
||||
GateStatus[i] = SAGateState.HordeGateOk;
|
||||
ShipsStarted = false;
|
||||
_gateDestroyed = false;
|
||||
_allVehiclesAlive[TeamId.Alliance] = true;
|
||||
_allVehiclesAlive[TeamId.Horde] = true;
|
||||
Status = SAStatus.Warmup;
|
||||
}
|
||||
|
||||
@@ -94,7 +89,7 @@ namespace Game.BattleGrounds.Zones
|
||||
DelCreature(i);
|
||||
|
||||
for (byte i = 0; i < GateStatus.Length; ++i)
|
||||
GateStatus[i] = SAGateState.Ok;
|
||||
GateStatus[i] = Attackers == TeamId.Horde ? SAGateState.AllianceGateOk : SAGateState.HordeGateOk;
|
||||
|
||||
if (!AddCreature(SAMiscConst.NpcEntries[SACreatureTypes.Kanrethad], SACreatureTypes.Kanrethad, SAMiscConst.NpcSpawnlocs[SACreatureTypes.Kanrethad]))
|
||||
{
|
||||
@@ -223,13 +218,13 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
|
||||
//Player may enter BEFORE we set up BG - lets update his worldstates anyway...
|
||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[SAGraveyards.RightCapturableGy] == TeamId.Horde ? 1 : 0u);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Horde ? 1 : 0u);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.Horde ? 1 : 0u);
|
||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[SAGraveyards.RightCapturableGy] == TeamId.Horde ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Horde ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.Horde ? 1 : 0);
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[SAGraveyards.RightCapturableGy] == TeamId.Alliance ? 1 : 0u);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Alliance ? 1 : 0u);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.Alliance ? 1 : 0u);
|
||||
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[SAGraveyards.RightCapturableGy] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.Alliance ? 1 : 0);
|
||||
|
||||
if (Attackers == TeamId.Alliance)
|
||||
{
|
||||
@@ -258,6 +253,7 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdateWorldState(SAWorldStateIds.AllianceDefenceToken, 1);
|
||||
}
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.AttackerTeam, Attackers);
|
||||
UpdateWorldState(SAWorldStateIds.PurpleGate, 1);
|
||||
UpdateWorldState(SAWorldStateIds.RedGate, 1);
|
||||
UpdateWorldState(SAWorldStateIds.BlueGate, 1);
|
||||
@@ -287,8 +283,8 @@ namespace Game.BattleGrounds.Zones
|
||||
if (ShipsStarted)
|
||||
return;
|
||||
|
||||
DoorOpen(SAObjectTypes.BoatOne);
|
||||
DoorOpen(SAObjectTypes.BoatTwo);
|
||||
GetBGObject(SAObjectTypes.BoatOne).SetGoState(GameObjectState.TransportStopped);
|
||||
GetBGObject(SAObjectTypes.BoatTwo).SetGoState(GameObjectState.TransportStopped);
|
||||
|
||||
for (int i = SAObjectTypes.BoatOne; i <= SAObjectTypes.BoatTwo; i++)
|
||||
{
|
||||
@@ -333,6 +329,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (Status == SAStatus.Warmup)
|
||||
{
|
||||
EndRoundTimer = SATimers.RoundLength;
|
||||
UpdateWorldState(SAWorldStateIds.Timer, (int)(GameTime.GetGameTime() + EndRoundTimer));
|
||||
if (TotalTime >= SATimers.WarmupLength)
|
||||
{
|
||||
Creature c = GetBGCreature(SACreatureTypes.Kanrethad);
|
||||
@@ -356,6 +353,7 @@ namespace Game.BattleGrounds.Zones
|
||||
else
|
||||
EndRoundTimer = SATimers.RoundLength;
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.Timer, (int)(GameTime.GetGameTime() + EndRoundTimer));
|
||||
if (TotalTime >= 60000)
|
||||
{
|
||||
Creature c = GetBGCreature(SACreatureTypes.Kanrethad);
|
||||
@@ -428,57 +426,10 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
}
|
||||
if (Status == SAStatus.RoundOne || Status == SAStatus.RoundTwo)
|
||||
{
|
||||
SendTime();
|
||||
UpdateDemolisherSpawns();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartingEventCloseDoors() { }
|
||||
|
||||
public override void StartingEventOpenDoors() { }
|
||||
|
||||
public override void FillInitialWorldStates(InitWorldStates packet)
|
||||
{
|
||||
bool allyAttacks = Attackers == TeamId.Alliance;
|
||||
bool hordeAttacks = Attackers == TeamId.Horde;
|
||||
|
||||
packet.AddState(SAWorldStateIds.AncientGate, (uint)GateStatus[SAObjectTypes.AncientGate]);
|
||||
packet.AddState(SAWorldStateIds.YellowGate, (uint)GateStatus[SAObjectTypes.YellowGate]);
|
||||
packet.AddState(SAWorldStateIds.GreenGate, (uint)GateStatus[SAObjectTypes.GreenGate]);
|
||||
packet.AddState(SAWorldStateIds.BlueGate, (uint)GateStatus[SAObjectTypes.BlueGate]);
|
||||
packet.AddState(SAWorldStateIds.RedGate, (uint)GateStatus[SAObjectTypes.RedGate]);
|
||||
packet.AddState(SAWorldStateIds.PurpleGate, (uint)GateStatus[SAObjectTypes.PurpleGate]);
|
||||
|
||||
packet.AddState(SAWorldStateIds.BonusTimer, 0);
|
||||
|
||||
packet.AddState(SAWorldStateIds.HordeAttacks, hordeAttacks);
|
||||
packet.AddState(SAWorldStateIds.AllyAttacks, allyAttacks);
|
||||
|
||||
// Time will be sent on first update...
|
||||
packet.AddState(SAWorldStateIds.EnableTimer, TimerEnabled);
|
||||
packet.AddState(SAWorldStateIds.TimerMins, 0);
|
||||
packet.AddState(SAWorldStateIds.TimerSecTens, 0);
|
||||
packet.AddState(SAWorldStateIds.TimerSecDecs, 0);
|
||||
|
||||
packet.AddState(SAWorldStateIds.RightGyHorde, GraveyardStatus[SAGraveyards.RightCapturableGy] == TeamId.Horde);
|
||||
packet.AddState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Horde);
|
||||
packet.AddState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.Horde);
|
||||
|
||||
packet.AddState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[SAGraveyards.RightCapturableGy] == TeamId.Alliance);
|
||||
packet.AddState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[SAGraveyards.LeftCapturableGy] == TeamId.Alliance);
|
||||
packet.AddState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[SAGraveyards.CentralCapturableGy] == TeamId.Alliance);
|
||||
|
||||
packet.AddState(SAWorldStateIds.HordeDefenceToken, allyAttacks);
|
||||
packet.AddState(SAWorldStateIds.AllianceDefenceToken, hordeAttacks);
|
||||
|
||||
packet.AddState(SAWorldStateIds.LeftAttTokenHrd, hordeAttacks);
|
||||
packet.AddState(SAWorldStateIds.RightAttTokenHrd, hordeAttacks);
|
||||
packet.AddState(SAWorldStateIds.RightAttTokenAll, allyAttacks);
|
||||
packet.AddState(SAWorldStateIds.LeftAttTokenAll, allyAttacks);
|
||||
}
|
||||
|
||||
public override void AddPlayer(Player player)
|
||||
{
|
||||
bool isInBattleground = IsPlayerInBattleground(player.GetGUID());
|
||||
@@ -561,85 +512,84 @@ namespace Game.BattleGrounds.Zones
|
||||
TitanRelicActivated(invoker.ToPlayer());
|
||||
break;
|
||||
case GameObjectTypes.DestructibleBuilding:
|
||||
{
|
||||
SAGateInfo gate = GetGate(obj.GetEntry());
|
||||
if (gate != null)
|
||||
{
|
||||
SAGateInfo gate = GetGate(obj.GetEntry());
|
||||
if (gate != null)
|
||||
uint gateId = gate.GateId;
|
||||
|
||||
// damaged
|
||||
if (eventId == go.GetGoInfo().DestructibleBuilding.DamagedEvent)
|
||||
{
|
||||
uint gateId = gate.GateId;
|
||||
GateStatus[gateId] = Attackers == TeamId.Horde ? SAGateState.AllianceGateDamaged : SAGateState.HordeGateDamaged;
|
||||
|
||||
// damaged
|
||||
if (eventId == go.GetGoInfo().DestructibleBuilding.DamagedEvent)
|
||||
Creature c = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, (byte)gate.DamagedText, invoker);
|
||||
|
||||
PlaySoundToAll(Attackers == TeamId.Alliance ? SASoundIds.WallAttackedAlliance : SASoundIds.WallAttackedHorde);
|
||||
}
|
||||
// destroyed
|
||||
else if (eventId == go.GetGoInfo().DestructibleBuilding.DestroyedEvent)
|
||||
{
|
||||
GateStatus[gate.GateId] = Attackers == TeamId.Horde ? SAGateState.AllianceGateDestroyed : SAGateState.HordeGateDestroyed;
|
||||
|
||||
if (gateId < 5)
|
||||
DelObject((int)gateId + 14);
|
||||
|
||||
Creature c = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, (byte)gate.DestroyedText, invoker);
|
||||
|
||||
PlaySoundToAll(Attackers == TeamId.Alliance ? SASoundIds.WallDestroyedAlliance : SASoundIds.WallDestroyedHorde);
|
||||
|
||||
bool rewardHonor = true;
|
||||
switch (gateId)
|
||||
{
|
||||
GateStatus[gateId] = SAGateState.Damaged;
|
||||
|
||||
Creature c = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, (byte)gate.DamagedText, invoker);
|
||||
|
||||
PlaySoundToAll(Attackers == TeamId.Alliance ? SASoundIds.WallAttackedAlliance : SASoundIds.WallAttackedHorde);
|
||||
case SAObjectTypes.GreenGate:
|
||||
if (IsGateDestroyed(SAObjectTypes.BlueGate))
|
||||
rewardHonor = false;
|
||||
break;
|
||||
case SAObjectTypes.BlueGate:
|
||||
if (IsGateDestroyed(SAObjectTypes.GreenGate))
|
||||
rewardHonor = false;
|
||||
break;
|
||||
case SAObjectTypes.RedGate:
|
||||
if (IsGateDestroyed(SAObjectTypes.PurpleGate))
|
||||
rewardHonor = false;
|
||||
break;
|
||||
case SAObjectTypes.PurpleGate:
|
||||
if (IsGateDestroyed(SAObjectTypes.RedGate))
|
||||
rewardHonor = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// destroyed
|
||||
else if (eventId == go.GetGoInfo().DestructibleBuilding.DestroyedEvent)
|
||||
|
||||
if (invoker)
|
||||
{
|
||||
GateStatus[gate.GateId] = SAGateState.Destroyed;
|
||||
_gateDestroyed = true;
|
||||
|
||||
if (gateId < 5)
|
||||
DelObject((int)gateId + 14);
|
||||
|
||||
Creature c = obj.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, (byte)gate.DestroyedText, invoker);
|
||||
|
||||
PlaySoundToAll(Attackers == TeamId.Alliance ? SASoundIds.WallDestroyedAlliance : SASoundIds.WallDestroyedHorde);
|
||||
|
||||
bool rewardHonor = true;
|
||||
switch (gateId)
|
||||
Unit unit = invoker.ToUnit();
|
||||
if (unit)
|
||||
{
|
||||
case SAObjectTypes.GreenGate:
|
||||
if (GateStatus[SAObjectTypes.BlueGate] == SAGateState.Destroyed)
|
||||
rewardHonor = false;
|
||||
break;
|
||||
case SAObjectTypes.BlueGate:
|
||||
if (GateStatus[SAObjectTypes.GreenGate] == SAGateState.Destroyed)
|
||||
rewardHonor = false;
|
||||
break;
|
||||
case SAObjectTypes.RedGate:
|
||||
if (GateStatus[SAObjectTypes.PurpleGate] == SAGateState.Destroyed)
|
||||
rewardHonor = false;
|
||||
break;
|
||||
case SAObjectTypes.PurpleGate:
|
||||
if (GateStatus[SAObjectTypes.RedGate] == SAGateState.Destroyed)
|
||||
rewardHonor = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (invoker)
|
||||
{
|
||||
Unit unit = invoker.ToUnit();
|
||||
if (unit)
|
||||
Player player = unit.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (player)
|
||||
{
|
||||
Player player = unit.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
if (player)
|
||||
{
|
||||
UpdatePlayerScore(player, ScoreType.DestroyedWall, 1);
|
||||
if (rewardHonor)
|
||||
UpdatePlayerScore(player, ScoreType.BonusHonor, GetBonusHonorFromKill(1));
|
||||
}
|
||||
UpdatePlayerScore(player, ScoreType.DestroyedWall, 1);
|
||||
if (rewardHonor)
|
||||
UpdatePlayerScore(player, ScoreType.BonusHonor, GetBonusHonorFromKill(1));
|
||||
}
|
||||
}
|
||||
|
||||
UpdateObjectInteractionFlags();
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
UpdateWorldState(gate.WorldState, (uint)GateStatus[gateId]);
|
||||
UpdateObjectInteractionFlags();
|
||||
}
|
||||
break;
|
||||
else
|
||||
break;
|
||||
|
||||
UpdateWorldState(gate.WorldState, (int)GateStatus[gateId]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -651,7 +601,9 @@ namespace Game.BattleGrounds.Zones
|
||||
if (creature.GetEntry() == SACreatureIds.Demolisher)
|
||||
{
|
||||
UpdatePlayerScore(killer, ScoreType.DestroyedDemolisher, 1);
|
||||
_allVehiclesAlive[Attackers] = false;
|
||||
uint worldStateId = Attackers == TeamId.Horde ? SAWorldStateIds.DestroyedHordeVehicles : SAWorldStateIds.DestroyedAllianceVehicles;
|
||||
int currentDestroyedVehicles = Global.WorldStateMgr.GetValue((int)worldStateId, GetBgMap());
|
||||
UpdateWorldState(worldStateId, currentDestroyedVehicles + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,29 +684,21 @@ namespace Game.BattleGrounds.Zones
|
||||
return closest;
|
||||
}
|
||||
|
||||
void SendTime()
|
||||
{
|
||||
uint end_of_round = (EndRoundTimer - TotalTime);
|
||||
UpdateWorldState(SAWorldStateIds.TimerMins, end_of_round / 60000);
|
||||
UpdateWorldState(SAWorldStateIds.TimerSecTens, (end_of_round % 60000) / 10000);
|
||||
UpdateWorldState(SAWorldStateIds.TimerSecDecs, ((end_of_round % 60000) % 10000) / 1000);
|
||||
}
|
||||
|
||||
bool CanInteractWithObject(uint objectId)
|
||||
{
|
||||
switch (objectId)
|
||||
{
|
||||
case SAObjectTypes.TitanRelic:
|
||||
if (GateStatus[SAObjectTypes.AncientGate] != SAGateState.Destroyed || GateStatus[SAObjectTypes.YellowGate] != SAGateState.Destroyed)
|
||||
if (!IsGateDestroyed(SAObjectTypes.AncientGate) || !IsGateDestroyed(SAObjectTypes.YellowGate))
|
||||
return false;
|
||||
goto case SAObjectTypes.CentralFlag;
|
||||
case SAObjectTypes.CentralFlag:
|
||||
if (GateStatus[SAObjectTypes.RedGate] != SAGateState.Destroyed && GateStatus[SAObjectTypes.PurpleGate] != SAGateState.Destroyed)
|
||||
if (!IsGateDestroyed(SAObjectTypes.RedGate) && !IsGateDestroyed(SAObjectTypes.PurpleGate))
|
||||
return false;
|
||||
goto case SAObjectTypes.LeftFlag;
|
||||
case SAObjectTypes.LeftFlag:
|
||||
case SAObjectTypes.RightFlag:
|
||||
if (GateStatus[SAObjectTypes.GreenGate] != SAGateState.Destroyed && GateStatus[SAObjectTypes.BlueGate] != SAGateState.Destroyed)
|
||||
if (!IsGateDestroyed(SAObjectTypes.GreenGate) && !IsGateDestroyed(SAObjectTypes.BlueGate))
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
@@ -830,77 +774,77 @@ namespace Game.BattleGrounds.Zones
|
||||
switch (i)
|
||||
{
|
||||
case SAGraveyards.LeftCapturableGy:
|
||||
{
|
||||
flag = SAObjectTypes.LeftFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == TeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
npc = SACreatureTypes.Rigspark;
|
||||
Creature rigspark = AddCreature(SAMiscConst.NpcEntries[npc], (int)npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
|
||||
if (rigspark)
|
||||
rigspark.GetAI().Talk(SATextIds.SparklightRigsparkSpawn);
|
||||
|
||||
for (byte j = SACreatureTypes.Demolisher7; j <= SACreatureTypes.Demolisher8; j++)
|
||||
{
|
||||
flag = SAObjectTypes.LeftFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == TeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
npc = SACreatureTypes.Rigspark;
|
||||
Creature rigspark = AddCreature(SAMiscConst.NpcEntries[npc], (int)npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
|
||||
if (rigspark)
|
||||
rigspark.GetAI().Talk(SATextIds.SparklightRigsparkSpawn);
|
||||
|
||||
for (byte j = SACreatureTypes.Demolisher7; j <= SACreatureTypes.Demolisher8; j++)
|
||||
{
|
||||
AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], (Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance), 600);
|
||||
Creature dem = GetBGCreature(j);
|
||||
if (dem)
|
||||
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
||||
}
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[i] == TeamId.Horde);
|
||||
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source);
|
||||
AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], (Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance), 600);
|
||||
Creature dem = GetBGCreature(j);
|
||||
if (dem)
|
||||
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
||||
}
|
||||
break;
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
||||
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
case SAGraveyards.RightCapturableGy:
|
||||
{
|
||||
flag = SAObjectTypes.RightFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == TeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
npc = SACreatureTypes.Sparklight;
|
||||
Creature sparklight = AddCreature(SAMiscConst.NpcEntries[npc], (int)npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
|
||||
if (sparklight)
|
||||
sparklight.GetAI().Talk(SATextIds.SparklightRigsparkSpawn);
|
||||
|
||||
for (byte j = SACreatureTypes.Demolisher5; j <= SACreatureTypes.Demolisher6; j++)
|
||||
{
|
||||
flag = SAObjectTypes.RightFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == TeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance, 600);
|
||||
|
||||
npc = SACreatureTypes.Sparklight;
|
||||
Creature sparklight = AddCreature(SAMiscConst.NpcEntries[npc], (int)npc, SAMiscConst.NpcSpawnlocs[npc], Attackers);
|
||||
if (sparklight)
|
||||
sparklight.GetAI().Talk(SATextIds.SparklightRigsparkSpawn);
|
||||
|
||||
for (byte j = SACreatureTypes.Demolisher5; j <= SACreatureTypes.Demolisher6; j++)
|
||||
{
|
||||
AddCreature(SAMiscConst.NpcEntries[j], j, SAMiscConst.NpcSpawnlocs[j], Attackers == TeamId.Alliance ? TeamId.Horde : TeamId.Alliance, 600);
|
||||
|
||||
Creature dem = GetBGCreature(j);
|
||||
if (dem)
|
||||
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
||||
}
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[i] == TeamId.Horde);
|
||||
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source);
|
||||
Creature dem = GetBGCreature(j);
|
||||
if (dem)
|
||||
dem.SetFaction(SAMiscConst.Factions[Attackers]);
|
||||
}
|
||||
break;
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
||||
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
case SAGraveyards.CentralCapturableGy:
|
||||
{
|
||||
flag = SAObjectTypes.CentralFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == TeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
{
|
||||
flag = SAObjectTypes.CentralFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == TeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[i] == TeamId.Horde);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[i] == TeamId.Alliance ? 1 : 0);
|
||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[i] == TeamId.Horde ? 1 : 0);
|
||||
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//ABORT();
|
||||
break;
|
||||
@@ -981,7 +925,7 @@ namespace Game.BattleGrounds.Zones
|
||||
void ToggleTimer()
|
||||
{
|
||||
TimerEnabled = !TimerEnabled;
|
||||
UpdateWorldState(SAWorldStateIds.EnableTimer, TimerEnabled);
|
||||
UpdateWorldState(SAWorldStateIds.EnableTimer, TimerEnabled ? 1 : 0);
|
||||
}
|
||||
|
||||
public override void EndBattleground(Team winner)
|
||||
@@ -1063,17 +1007,10 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CheckAchievementCriteriaMeet(uint criteriaId, Player source, Unit target, uint miscValue)
|
||||
bool IsGateDestroyed(uint gateId)
|
||||
{
|
||||
switch ((BattlegroundCriteriaId)criteriaId)
|
||||
{
|
||||
case BattlegroundCriteriaId.NotEvenAScratch:
|
||||
return _allVehiclesAlive[GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID()))];
|
||||
case BattlegroundCriteriaId.DefenseOfTheAncients:
|
||||
return GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID())) != Attackers && !_gateDestroyed;
|
||||
}
|
||||
|
||||
return base.CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
|
||||
Cypher.Assert(gateId < SAMiscConst.Gates.Length);
|
||||
return GateStatus[gateId] == SAGateState.AllianceGateDestroyed || GateStatus[gateId] == SAGateState.HordeGateDestroyed;
|
||||
}
|
||||
|
||||
public override bool IsSpellAllowed(uint spellId, Player player)
|
||||
@@ -1149,12 +1086,6 @@ namespace Game.BattleGrounds.Zones
|
||||
// for know if second round has been init
|
||||
bool InitSecondRound;
|
||||
Dictionary<uint/*id*/, uint/*timer*/> DemoliserRespawnList = new();
|
||||
|
||||
// Achievement: Defense of the Ancients
|
||||
bool _gateDestroyed;
|
||||
|
||||
// Achievement: Not Even a Scratch
|
||||
bool[] _allVehiclesAlive = new bool[SharedConst.PvpTeamsCount];
|
||||
}
|
||||
|
||||
class BattlegroundSAScore : BattlegroundScore
|
||||
@@ -1455,9 +1386,14 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
enum SAGateState
|
||||
{
|
||||
Ok = 1,
|
||||
Damaged = 2,
|
||||
Destroyed = 3
|
||||
// alliance is defender
|
||||
AllianceGateOk = 1,
|
||||
AllianceGateDamaged = 2,
|
||||
AllianceGateDestroyed = 3,
|
||||
// horde is defender
|
||||
HordeGateOk = 4,
|
||||
HordeGateDamaged = 5,
|
||||
HordeGateDestroyed = 6,
|
||||
}
|
||||
|
||||
enum SAEventIds
|
||||
@@ -1574,9 +1510,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
struct SAWorldStateIds
|
||||
{
|
||||
public const uint TimerMins = 3559;
|
||||
public const uint TimerSecTens = 3560;
|
||||
public const uint TimerSecDecs = 3561;
|
||||
public const uint Timer = 3557;
|
||||
public const uint AllyAttacks = 4352;
|
||||
public const uint HordeAttacks = 4353;
|
||||
public const uint PurpleGate = 3614;
|
||||
@@ -1599,6 +1533,9 @@ namespace Game.BattleGrounds.Zones
|
||||
public const uint CenterGyHorde = 3634;
|
||||
public const uint BonusTimer = 3571;
|
||||
public const uint EnableTimer = 3564;
|
||||
public const uint AttackerTeam = 3690;
|
||||
public const uint DestroyedAllianceVehicles = 3955;
|
||||
public const uint DestroyedHordeVehicles = 3956;
|
||||
}
|
||||
|
||||
struct SACreatureTypes
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
if (GetStatus() == BattlegroundStatus.InProgress)
|
||||
{
|
||||
if (GetElapsedTime() >= 27 * Time.Minute * Time.InMilliseconds)
|
||||
if (GetElapsedTime() >= 17 * Time.Minute * Time.InMilliseconds)
|
||||
{
|
||||
if (GetTeamScore(TeamId.Alliance) == 0)
|
||||
{
|
||||
@@ -55,12 +55,6 @@ namespace Game.BattleGrounds.Zones
|
||||
else
|
||||
EndBattleground(Team.Alliance);
|
||||
}
|
||||
// first update needed after 1 minute of game already in progress
|
||||
else if (GetElapsedTime() > (_minutesElapsed * Time.Minute * Time.InMilliseconds) + 3 * Time.Minute * Time.InMilliseconds)
|
||||
{
|
||||
++_minutesElapsed;
|
||||
UpdateWorldState(WSGWorldStates.StateTimer, (uint)(25 - _minutesElapsed));
|
||||
}
|
||||
|
||||
if (_flagState[TeamId.Alliance] == WSGFlagState.WaitRespawn)
|
||||
{
|
||||
@@ -172,9 +166,6 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
for (int i = WSGObjectTypes.AFlag; i <= WSGObjectTypes.Berserkbuff2; ++i)
|
||||
SpawnBGObject(i, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
UpdateWorldState(WSGWorldStates.StateTimerActive, 1);
|
||||
UpdateWorldState(WSGWorldStates.StateTimer, 25);
|
||||
}
|
||||
|
||||
public override void StartingEventOpenDoors()
|
||||
@@ -192,8 +183,11 @@ namespace Game.BattleGrounds.Zones
|
||||
SpawnBGObject(WSGObjectTypes.DoorH3, BattlegroundConst.RespawnOneDay);
|
||||
SpawnBGObject(WSGObjectTypes.DoorH4, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
UpdateWorldState(WSGWorldStates.StateTimerActive, 1);
|
||||
UpdateWorldState(WSGWorldStates.StateTimer, (int)(GameTime.GetGameTime() + 15 * Time.Minute));
|
||||
|
||||
// players joining later are not eligibles
|
||||
TriggerGameEvent( 8563);
|
||||
TriggerGameEvent(8563);
|
||||
}
|
||||
|
||||
public override void AddPlayer(Player player)
|
||||
@@ -326,8 +320,6 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
if (winner != 0)
|
||||
{
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkAlliance, 0);
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkHorde, 0);
|
||||
UpdateWorldState(WSGWorldStates.FlagStateAlliance, 1);
|
||||
UpdateWorldState(WSGWorldStates.FlagStateHorde, 1);
|
||||
UpdateWorldState(WSGWorldStates.StateTimerActive, 0);
|
||||
@@ -413,18 +405,12 @@ namespace Game.BattleGrounds.Zones
|
||||
if (set)
|
||||
{
|
||||
player.CastSpell(player, BattlegroundConst.SpellRecentlyDroppedFlag, true);
|
||||
UpdateFlagState(team, WSGFlagState.WaitRespawn);
|
||||
UpdateFlagState(team, WSGFlagState.OnGround);
|
||||
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
SendBroadcastText(WSGBroadcastTexts.HordeFlagDropped, ChatMsg.BgSystemHorde, player);
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkHorde, 0xFFFFFFFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendBroadcastText(WSGBroadcastTexts.AllianceFlagDropped, ChatMsg.BgSystemAlliance, player);
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkAlliance, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
_flagsDropTimer[GetTeamIndexByTeamId(GetOtherTeam(team))] = WSGTimerOrScore.FlagDropTime;
|
||||
}
|
||||
@@ -448,7 +434,6 @@ namespace Game.BattleGrounds.Zones
|
||||
_flagState[TeamId.Alliance] = WSGFlagState.OnPlayer;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(Team.Horde, WSGFlagState.OnPlayer);
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkAlliance, 1);
|
||||
player.CastSpell(player, WSGSpellId.SilverwingFlag, true);
|
||||
player.StartCriteriaTimer(CriteriaStartEvent.BeSpellTarget, WSGSpellId.SilverwingFlagPicked);
|
||||
if (_flagState[1] == WSGFlagState.OnPlayer)
|
||||
@@ -466,7 +451,6 @@ namespace Game.BattleGrounds.Zones
|
||||
_flagState[TeamId.Horde] = WSGFlagState.OnPlayer;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(Team.Alliance, WSGFlagState.OnPlayer);
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkHorde, 1);
|
||||
player.CastSpell(player, WSGSpellId.WarsongFlag, true);
|
||||
player.StartCriteriaTimer(CriteriaStartEvent.BeSpellTarget, WSGSpellId.WarsongFlagPicked);
|
||||
if (_flagState[0] == WSGFlagState.OnPlayer)
|
||||
@@ -500,7 +484,6 @@ namespace Game.BattleGrounds.Zones
|
||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||
else if (_flagDebuffState == 2)
|
||||
player.CastSpell(player, WSGSpellId.BrutalAssault, true);
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkAlliance, 1);
|
||||
}
|
||||
//called in HandleGameObjectUseOpcode:
|
||||
//target_obj.Delete();
|
||||
@@ -533,7 +516,6 @@ namespace Game.BattleGrounds.Zones
|
||||
player.CastSpell(player, WSGSpellId.FocusedAssault, true);
|
||||
else if (_flagDebuffState == 2)
|
||||
player.CastSpell(player, WSGSpellId.BrutalAssault, true);
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkHorde, 1);
|
||||
}
|
||||
//called in HandleGameObjectUseOpcode:
|
||||
//target_obj.Delete();
|
||||
@@ -571,18 +553,39 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
void UpdateFlagState(Team team, WSGFlagState value)
|
||||
{
|
||||
if (team == Team.Alliance)
|
||||
UpdateWorldState(WSGWorldStates.FlagStateAlliance, (uint)value);
|
||||
int transformValueToOtherTeamControlWorldState(WSGFlagState value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case WSGFlagState.OnBase:
|
||||
case WSGFlagState.OnGround:
|
||||
case WSGFlagState.WaitRespawn:
|
||||
return 1;
|
||||
case WSGFlagState.OnPlayer:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
if (team == Team.Horde)
|
||||
{
|
||||
UpdateWorldState(WSGWorldStates.FlagStateAlliance, (int)value);
|
||||
UpdateWorldState(WSGWorldStates.FlagControlHorde, transformValueToOtherTeamControlWorldState(value));
|
||||
}
|
||||
else
|
||||
UpdateWorldState(WSGWorldStates.FlagStateHorde, (uint)value);
|
||||
{
|
||||
UpdateWorldState(WSGWorldStates.FlagStateHorde, (int)value);
|
||||
UpdateWorldState(WSGWorldStates.FlagControlAlliance, transformValueToOtherTeamControlWorldState(value));
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateTeamScore(int team)
|
||||
{
|
||||
if (team == TeamId.Alliance)
|
||||
UpdateWorldState(WSGWorldStates.FlagCapturesAlliance, GetTeamScore(team));
|
||||
UpdateWorldState(WSGWorldStates.FlagCapturesAlliance, (int)GetTeamScore(team));
|
||||
else
|
||||
UpdateWorldState(WSGWorldStates.FlagCapturesHorde, GetTeamScore(team));
|
||||
UpdateWorldState(WSGWorldStates.FlagCapturesHorde, (int)GetTeamScore(team));
|
||||
}
|
||||
|
||||
public override void HandleAreaTrigger(Player player, uint trigger, bool entered)
|
||||
@@ -723,7 +726,6 @@ namespace Game.BattleGrounds.Zones
|
||||
m_HonorWinKills = 1;
|
||||
m_HonorEndKills = 2;
|
||||
}
|
||||
_minutesElapsed = 0;
|
||||
_lastFlagCaptureTeam = 0;
|
||||
_bothFlagsKept = false;
|
||||
_flagDebuffState = 0;
|
||||
@@ -805,46 +807,6 @@ namespace Game.BattleGrounds.Zones
|
||||
return Global.ObjectMgr.GetWorldSafeLoc(team == Team.Alliance ? ExploitTeleportLocationAlliance : ExploitTeleportLocationHorde);
|
||||
}
|
||||
|
||||
public override void FillInitialWorldStates(InitWorldStates packet)
|
||||
{
|
||||
packet.AddState(WSGWorldStates.FlagCapturesAlliance, GetTeamScore(TeamId.Alliance));
|
||||
packet.AddState(WSGWorldStates.FlagCapturesHorde, GetTeamScore(TeamId.Horde));
|
||||
|
||||
if (_flagState[TeamId.Alliance] == WSGFlagState.OnGround)
|
||||
packet.AddState(WSGWorldStates.FlagUnkAlliance, 0xFFFFFFFF);
|
||||
else if (_flagState[TeamId.Alliance] == WSGFlagState.OnPlayer)
|
||||
packet.AddState(WSGWorldStates.FlagUnkAlliance, 1);
|
||||
else
|
||||
packet.AddState(WSGWorldStates.FlagUnkAlliance, 0);
|
||||
|
||||
if (_flagState[TeamId.Horde] == WSGFlagState.OnGround)
|
||||
packet.AddState(WSGWorldStates.FlagUnkHorde, 0xFFFFFFFF);
|
||||
else if (_flagState[TeamId.Horde] == WSGFlagState.OnPlayer)
|
||||
packet.AddState(WSGWorldStates.FlagUnkHorde, 1);
|
||||
else
|
||||
packet.AddState(WSGWorldStates.FlagUnkHorde, 0);
|
||||
|
||||
packet.AddState(WSGWorldStates.FlagCapturesMax, (int)WSGTimerOrScore.MaxTeamScore);
|
||||
|
||||
if (GetStatus() == BattlegroundStatus.InProgress)
|
||||
{
|
||||
packet.AddState(WSGWorldStates.StateTimerActive, 1);
|
||||
packet.AddState(WSGWorldStates.StateTimer, 25u - _minutesElapsed);
|
||||
}
|
||||
else
|
||||
packet.AddState(WSGWorldStates.StateTimerActive, 0);
|
||||
|
||||
if (_flagState[TeamId.Horde] == WSGFlagState.OnPlayer)
|
||||
packet.AddState(WSGWorldStates.FlagStateHorde, 2);
|
||||
else
|
||||
packet.AddState(WSGWorldStates.FlagStateHorde, 1);
|
||||
|
||||
if (_flagState[TeamId.Alliance] == WSGFlagState.OnPlayer)
|
||||
packet.AddState(WSGWorldStates.FlagStateAlliance, 2);
|
||||
else
|
||||
packet.AddState(WSGWorldStates.FlagStateAlliance, 1);
|
||||
}
|
||||
|
||||
public override Team GetPrematureWinner()
|
||||
{
|
||||
if (GetTeamScore(TeamId.Alliance) > GetTeamScore(TeamId.Horde))
|
||||
@@ -855,23 +817,6 @@ namespace Game.BattleGrounds.Zones
|
||||
return base.GetPrematureWinner();
|
||||
}
|
||||
|
||||
public override bool CheckAchievementCriteriaMeet(uint criteriaId, Player player, Unit target, uint miscValue)
|
||||
{
|
||||
switch (criteriaId)
|
||||
{
|
||||
case (uint)BattlegroundCriteriaId.SaveTheDay:
|
||||
if (target)
|
||||
{
|
||||
Player playerTarget = target.ToPlayer();
|
||||
if (playerTarget)
|
||||
return GetFlagState(GetPlayerTeam(playerTarget.GetGUID())) == WSGFlagState.OnBase;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckAchievementCriteriaMeet(criteriaId, player, target, miscValue);
|
||||
}
|
||||
|
||||
public override ObjectGuid GetFlagPickerGUID(int team = -1)
|
||||
{
|
||||
if (team == TeamId.Alliance || team == TeamId.Horde)
|
||||
@@ -910,7 +855,6 @@ namespace Game.BattleGrounds.Zones
|
||||
int _flagSpellForceTimer;
|
||||
bool _bothFlagsKept;
|
||||
byte _flagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault
|
||||
byte _minutesElapsed;
|
||||
|
||||
uint[][] Honor =
|
||||
{
|
||||
@@ -964,12 +908,13 @@ namespace Game.BattleGrounds.Zones
|
||||
MapComplete,
|
||||
RewardNum
|
||||
}
|
||||
|
||||
enum WSGFlagState
|
||||
{
|
||||
OnBase = 0,
|
||||
WaitRespawn = 1,
|
||||
OnBase = 1,
|
||||
OnPlayer = 2,
|
||||
OnGround = 3
|
||||
OnGround = 3,
|
||||
WaitRespawn = 4
|
||||
}
|
||||
|
||||
struct WSGObjectTypes
|
||||
@@ -994,6 +939,7 @@ namespace Game.BattleGrounds.Zones
|
||||
public const int Berserkbuff2 = 17;
|
||||
public const int Max = 18;
|
||||
}
|
||||
|
||||
public sealed class WSGObjectEntry
|
||||
{
|
||||
public const uint DoorA1 = 179918;
|
||||
@@ -1022,14 +968,17 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
struct WSGWorldStates
|
||||
{
|
||||
public const uint FlagUnkAlliance = 1545;
|
||||
public const uint FlagUnkHorde = 1546;
|
||||
// FlagUnk = 1547;
|
||||
public const uint FlagStateAlliance = 1545;
|
||||
public const uint FlagStateHorde = 1546;
|
||||
public const uint FlagStateNeutral = 1547; // Unused
|
||||
public const uint HordeFlagCountPickedUp = 17712; // Brawl
|
||||
public const uint AllianceFlagCountPickedUp = 17713; // Brawl
|
||||
public const uint FlagCapturesAlliance = 1581;
|
||||
public const uint FlagCapturesHorde = 1582;
|
||||
public const uint FlagCapturesMax = 1601;
|
||||
public const uint FlagStateHorde = 2338;
|
||||
public const uint FlagStateAlliance = 2339;
|
||||
public const uint FlagCapturesMaxNew = 17303;
|
||||
public const uint FlagControlHorde = 2338;
|
||||
public const uint FlagControlAlliance = 2339;
|
||||
public const uint StateTimer = 4248;
|
||||
public const uint StateTimerActive = 4247;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user