Core/Battlegrounds: Strand of the Ancients Rework

Port From (https://github.com/TrinityCore/TrinityCore/commit/3d56cdc08413a0682299136a763e13e67d38818b)
This commit is contained in:
hondacrx
2024-03-06 17:19:02 -05:00
parent faab7ba1f1
commit 69d144c399
27 changed files with 876 additions and 1339 deletions
@@ -199,7 +199,7 @@ namespace Game.BattleGrounds.Zones.AlteracValley
m_Team_QuestStatus[teamIndex][4]++;
if (m_Team_QuestStatus[teamIndex][4] >= 200)
Log.outDebug(LogFilter.Battleground, "BG_AV Quest {} completed (need to implement some events here", questid);
UpdateWorldState((int)(teamIndex == BatttleGroundTeamId.Alliance ? WorldStateIds.IvusStormCrystalCount : WorldStateIds.LokholarStormpikeSoldiersBloodCount), (int)m_Team_QuestStatus[teamIndex][4]);
UpdateWorldState((int)(teamIndex == BattleGroundTeamId.Alliance ? WorldStateIds.IvusStormCrystalCount : WorldStateIds.LokholarStormpikeSoldiersBloodCount), (int)m_Team_QuestStatus[teamIndex][4]);
break;
case QuestIds.ANearMine:
case QuestIds.HNearMine:
@@ -253,17 +253,17 @@ namespace Game.BattleGrounds.Zones.AlteracValley
int teamindex = GetTeamIndexByTeamId(team);
_teamResources[teamindex] += points;
UpdateWorldState((int)(teamindex == BatttleGroundTeamId.Horde ? WorldStateIds.HordeReinforcements : WorldStateIds.AllianceReinforcements), _teamResources[teamindex]);
UpdateWorldState((int)(teamindex == BattleGroundTeamId.Horde ? WorldStateIds.HordeReinforcements : WorldStateIds.AllianceReinforcements), _teamResources[teamindex]);
if (points < 0)
{
if (_teamResources[teamindex] < 1)
{
_teamResources[teamindex] = 0;
EndBattleground(teamindex == BatttleGroundTeamId.Horde ? Team.Alliance : Team.Horde);
EndBattleground(teamindex == BattleGroundTeamId.Horde ? Team.Alliance : Team.Horde);
}
else if (!_isInformedNearVictory[teamindex] && _teamResources[teamindex] < MiscConst.NearLosePoints)
{
if (teamindex == BatttleGroundTeamId.Alliance)
if (teamindex == BattleGroundTeamId.Alliance)
SendBroadcastText((uint)BroadcastTextIds.AllianceNearLose, ChatMsg.BgSystemAlliance);
else
SendBroadcastText((uint)BroadcastTextIds.HordeNearLose, ChatMsg.BgSystemHorde);
@@ -292,7 +292,7 @@ namespace Game.BattleGrounds.Zones.AlteracValley
_mineResourceTimer.Reset(MiscConst.MineResourceTimer);
}
for (byte i = BatttleGroundTeamId.Alliance; i <= BatttleGroundTeamId.Horde; i++)
for (byte i = BattleGroundTeamId.Alliance; i <= BattleGroundTeamId.Horde; i++)
{
if (!IsCaptainAlive(i))
continue;
@@ -322,9 +322,9 @@ namespace Game.BattleGrounds.Zones.AlteracValley
bool IsCaptainAlive(uint teamId)
{
if (teamId == BatttleGroundTeamId.Horde)
if (teamId == BattleGroundTeamId.Horde)
return GetBgMap().GetWorldStateValue((int)WorldStateIds.GalvagarAlive) == 1;
else if (teamId == BatttleGroundTeamId.Alliance)
else if (teamId == BattleGroundTeamId.Alliance)
return GetBgMap().GetWorldStateValue((int)WorldStateIds.BalindaAlive) == 1;
return false;
@@ -365,18 +365,18 @@ namespace Game.BattleGrounds.Zones.AlteracValley
{
if (_nodes[i].Owner == Team.Alliance)
{
rep[BatttleGroundTeamId.Alliance] += MiscConst.RepGainSurvivingTower;
kills[BatttleGroundTeamId.Alliance] += MiscConst.HonorKillBonusSurvivingTower;
rep[BattleGroundTeamId.Alliance] += MiscConst.RepGainSurvivingTower;
kills[BattleGroundTeamId.Alliance] += MiscConst.HonorKillBonusSurvivingTower;
}
else
{
rep[BatttleGroundTeamId.Horde] += MiscConst.RepGainSurvivingTower;
kills[BatttleGroundTeamId.Horde] += MiscConst.HonorKillBonusSurvivingTower;
rep[BattleGroundTeamId.Horde] += MiscConst.RepGainSurvivingTower;
kills[BattleGroundTeamId.Horde] += MiscConst.HonorKillBonusSurvivingTower;
}
}
}
for (byte i = BatttleGroundTeamId.Alliance; i <= BatttleGroundTeamId.Horde; ++i)
for (byte i = BattleGroundTeamId.Alliance; i <= BattleGroundTeamId.Horde; ++i)
{
if (IsCaptainAlive(i))
{
@@ -713,24 +713,24 @@ namespace Game.BattleGrounds.Zones.AlteracValley
Team owner = _nodes[(int)node].Owner;
AVStates state = _nodes[(int)node].State;
UpdateWorldState(nodeInfo.AllianceAssault, (owner == Team.Alliance && state == AVStates.PointAssaulted) ? 1 : 0);
UpdateWorldState(nodeInfo.AllianceControl, (owner == Team.Alliance && state >= AVStates.PointDestroyed) ? 1 : 0);
UpdateWorldState(nodeInfo.HordeAssault, (owner == Team.Horde && state == AVStates.PointAssaulted) ? 1 : 0);
UpdateWorldState(nodeInfo.HordeControl, (owner == Team.Horde && state >= AVStates.PointDestroyed) ? 1 : 0);
UpdateWorldState(nodeInfo.AllianceAssault, owner == Team.Alliance && state == AVStates.PointAssaulted);
UpdateWorldState(nodeInfo.AllianceControl, owner == Team.Alliance && state >= AVStates.PointDestroyed);
UpdateWorldState(nodeInfo.HordeAssault, owner == Team.Horde && state == AVStates.PointAssaulted);
UpdateWorldState(nodeInfo.HordeControl, owner == Team.Horde && state >= AVStates.PointDestroyed);
if (nodeInfo.Owner != 0)
UpdateWorldState(nodeInfo.Owner, owner == Team.Horde ? 2 : owner == Team.Alliance ? 1 : 0);
}
if (node == AVNodes.SnowfallGrave)
UpdateWorldState((int)WorldStateIds.SnowfallGraveyardUncontrolled, _nodes[(int)node].Owner == Team.Other ? 1 : 0);
UpdateWorldState((int)WorldStateIds.SnowfallGraveyardUncontrolled, _nodes[(int)node].Owner == Team.Other);
}
void SendMineWorldStates(AlteracValleyMine mine)
{
AlteracValleyMineInfo mineInfo = _mineInfo[(byte)mine];
UpdateWorldState(mineInfo.StaticInfo.WorldStateHordeControlled, mineInfo.Owner == Team.Horde ? 1 : 0);
UpdateWorldState(mineInfo.StaticInfo.WorldStateAllianceControlled, mineInfo.Owner == Team.Alliance ? 1 : 0);
UpdateWorldState(mineInfo.StaticInfo.WorldStateNeutralControlled, mineInfo.Owner == Team.Other ? 1 : 0);
UpdateWorldState(mineInfo.StaticInfo.WorldStateHordeControlled, mineInfo.Owner == Team.Horde);
UpdateWorldState(mineInfo.StaticInfo.WorldStateAllianceControlled, mineInfo.Owner == Team.Alliance);
UpdateWorldState(mineInfo.StaticInfo.WorldStateNeutralControlled, mineInfo.Owner == Team.Other);
UpdateWorldState(mineInfo.StaticInfo.WorldStateOwner, mineInfo.Owner == Team.Horde ? 2 : mineInfo.Owner == Team.Alliance ? 1 : 0);
}
@@ -842,9 +842,9 @@ namespace Game.BattleGrounds.Zones.AlteracValley
switch (dataId)
{
case MiscConst.DataDefenderTierAlliance:
return (uint)getDefenderTierForTeam(BatttleGroundTeamId.Alliance);
return (uint)getDefenderTierForTeam(BattleGroundTeamId.Alliance);
case MiscConst.DataDefenderTierHorde:
return (uint)getDefenderTierForTeam(BatttleGroundTeamId.Horde);
return (uint)getDefenderTierForTeam(BattleGroundTeamId.Horde);
default:
return base.GetData(dataId);
}
@@ -62,7 +62,7 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
if (m_ReputationScoreTics[team] >= m_ReputationTics)
{
if (team == BatttleGroundTeamId.Alliance)
if (team == BattleGroundTeamId.Alliance)
RewardReputationToTeam(509, 10, Team.Alliance);
else
RewardReputationToTeam(510, 10, Team.Horde);
@@ -72,13 +72,13 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
if (m_HonorScoreTics[team] >= m_HonorTics)
{
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BatttleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde);
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BattleGroundTeamId.Alliance) ? Team.Alliance : Team.Horde);
m_HonorScoreTics[team] -= m_HonorTics;
}
if (!m_IsInformedNearVictory && m_TeamScores[team] > MiscConst.WarningNearVictoryScore)
{
if (team == BatttleGroundTeamId.Alliance)
if (team == BattleGroundTeamId.Alliance)
{
SendBroadcastText((uint)ABBattlegroundBroadcastTexts.AllianceNearVictory, ChatMsg.BgSystemNeutral);
PlaySoundToAll((uint)SoundIds.NearVictoryAlliance);
@@ -94,7 +94,7 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
if (m_TeamScores[team] > MiscConst.MaxTeamScore)
m_TeamScores[team] = MiscConst.MaxTeamScore;
if (team == BatttleGroundTeamId.Alliance)
if (team == BattleGroundTeamId.Alliance)
UpdateWorldState(WorldStateIds.ResourcesAlly, (int)m_TeamScores[team]);
else
UpdateWorldState(WorldStateIds.ResourcesHorde, (int)m_TeamScores[team]);
@@ -103,7 +103,7 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
int otherTeam = (team + 1) % SharedConst.PvpTeamsCount;
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
{
if (team == BatttleGroundTeamId.Alliance)
if (team == BattleGroundTeamId.Alliance)
UpdateWorldState(WorldStateIds.Had500DisadvantageHorde, 1);
else
UpdateWorldState(WorldStateIds.Had500DisadvantageAlliance, 1);
@@ -115,9 +115,9 @@ namespace Game.BattleGrounds.Zones.ArathisBasin
}
// Test win condition
if (m_TeamScores[BatttleGroundTeamId.Alliance] >= MiscConst.MaxTeamScore)
if (m_TeamScores[BattleGroundTeamId.Alliance] >= MiscConst.MaxTeamScore)
EndBattleground(Team.Alliance);
else if (m_TeamScores[BatttleGroundTeamId.Horde] >= MiscConst.MaxTeamScore)
else if (m_TeamScores[BattleGroundTeamId.Horde] >= MiscConst.MaxTeamScore)
EndBattleground(Team.Horde);
}
}
+21 -21
View File
@@ -48,8 +48,8 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
{
_pointsTimer.Reset(MiscConst.PointsTickTime);
byte baseCountAlliance = GetControlledBaseCount(BatttleGroundTeamId.Alliance);
byte baseCountHorde = GetControlledBaseCount(BatttleGroundTeamId.Horde);
byte baseCountAlliance = GetControlledBaseCount(BattleGroundTeamId.Alliance);
byte baseCountHorde = GetControlledBaseCount(BattleGroundTeamId.Horde);
if (baseCountAlliance > 0)
AddPoints(Team.Alliance, MiscConst.TickPoints[baseCountAlliance - 1]);
if (baseCountHorde > 0)
@@ -108,11 +108,11 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
uint point = controlZoneHandler.Value.GetPoint();
switch (teamId)
{
case BatttleGroundTeamId.Alliance:
case BattleGroundTeamId.Alliance:
if (GetBgMap().GetWorldStateValue(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex) == 1)
baseCount++;
break;
case BatttleGroundTeamId.Horde:
case BattleGroundTeamId.Horde:
if (GetBgMap().GetWorldStateValue(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex) == 1)
baseCount++;
break;
@@ -177,13 +177,13 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
if (score >= ScoreIds.MaxTeamScore)
{
score = ScoreIds.MaxTeamScore;
if (team == BatttleGroundTeamId.Alliance)
if (team == BattleGroundTeamId.Alliance)
EndBattleground(Team.Alliance);
else
EndBattleground(Team.Horde);
}
if (team == BatttleGroundTeamId.Alliance)
if (team == BattleGroundTeamId.Alliance)
UpdateWorldState(WorldStateIds.AllianceResources, (int)score);
else
UpdateWorldState(WorldStateIds.HordeResources, (int)score);
@@ -206,10 +206,10 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
void UpdatePointsCount(uint teamId)
{
if (teamId == BatttleGroundTeamId.Alliance)
UpdateWorldState(WorldStateIds.AllianceBase, GetControlledBaseCount(BatttleGroundTeamId.Alliance));
if (teamId == BattleGroundTeamId.Alliance)
UpdateWorldState(WorldStateIds.AllianceBase, GetControlledBaseCount(BattleGroundTeamId.Alliance));
else
UpdateWorldState(WorldStateIds.HordeBase, GetControlledBaseCount(BatttleGroundTeamId.Horde));
UpdateWorldState(WorldStateIds.HordeBase, GetControlledBaseCount(BattleGroundTeamId.Horde));
}
public override void OnGameObjectCreate(GameObject gameobject)
@@ -358,8 +358,8 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
//call parent's class reset
base.Reset();
m_TeamScores[BatttleGroundTeamId.Alliance] = 0;
m_TeamScores[BatttleGroundTeamId.Horde] = 0;
m_TeamScores[BattleGroundTeamId.Alliance] = 0;
m_TeamScores[BattleGroundTeamId.Horde] = 0;
m_HonorScoreTics = [0, 0];
m_FlagCapturedBgObjectType = 0;
bool isBGWeekend = Global.BattlegroundMgr.IsBGWeekend(GetTypeID());
@@ -377,12 +377,12 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
public void EventTeamLostPoint(uint teamId, uint point, WorldObject controlZone)
{
if (teamId == BatttleGroundTeamId.Alliance)
if (teamId == BattleGroundTeamId.Alliance)
{
SendBroadcastText(MiscConst.m_LosingPointTypes[point].MessageIdAlliance, ChatMsg.BgSystemAlliance, controlZone);
UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex, 0);
}
else if (teamId == BatttleGroundTeamId.Horde)
else if (teamId == BattleGroundTeamId.Horde)
{
SendBroadcastText(MiscConst.m_LosingPointTypes[point].MessageIdHorde, ChatMsg.BgSystemHorde, controlZone);
UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex, 0);
@@ -394,12 +394,12 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
public void EventTeamCapturedPoint(uint teamId, uint point, WorldObject controlZone)
{
if (teamId == BatttleGroundTeamId.Alliance)
if (teamId == BattleGroundTeamId.Alliance)
{
SendBroadcastText(MiscConst.m_CapturingPointTypes[point].MessageIdAlliance, ChatMsg.BgSystemAlliance, controlZone);
UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateAllianceControlledIndex, 1);
}
else if (teamId == BatttleGroundTeamId.Horde)
else if (teamId == BattleGroundTeamId.Horde)
{
SendBroadcastText(MiscConst.m_CapturingPointTypes[point].MessageIdHorde, ChatMsg.BgSystemHorde, controlZone);
UpdateWorldState(MiscConst.m_PointsIconStruct[point].WorldStateHordeControlledIndex, 1);
@@ -416,9 +416,9 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
public override Team GetPrematureWinner()
{
if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde))
if (GetTeamScore(BattleGroundTeamId.Alliance) > GetTeamScore(BattleGroundTeamId.Horde))
return Team.Alliance;
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance))
else if (GetTeamScore(BattleGroundTeamId.Horde) > GetTeamScore(BattleGroundTeamId.Alliance))
return Team.Horde;
return base.GetPrematureWinner();
@@ -526,22 +526,22 @@ namespace Game.BattleGrounds.Zones.EyeofStorm
public override void HandleProgressEventHorde(GameObject controlZone)
{
_battleground.EventTeamCapturedPoint(BatttleGroundTeamId.Horde, _point, controlZone);
_battleground.EventTeamCapturedPoint(BattleGroundTeamId.Horde, _point, controlZone);
}
public override void HandleProgressEventAlliance(GameObject controlZone)
{
_battleground.EventTeamCapturedPoint(BatttleGroundTeamId.Alliance, _point, controlZone);
_battleground.EventTeamCapturedPoint(BattleGroundTeamId.Alliance, _point, controlZone);
}
public override void HandleNeutralEventHorde(GameObject controlZone)
{
_battleground.EventTeamLostPoint(BatttleGroundTeamId.Horde, _point, controlZone);
_battleground.EventTeamLostPoint(BattleGroundTeamId.Horde, _point, controlZone);
}
public override void HandleNeutralEventAlliance(GameObject controlZone)
{
_battleground.EventTeamLostPoint(BatttleGroundTeamId.Alliance, _point, controlZone);
_battleground.EventTeamLostPoint(BattleGroundTeamId.Alliance, _point, controlZone);
}
public uint GetPoint() { return _point; }
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -41,18 +41,18 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
{
if (GetElapsedTime() >= 17 * Time.Minute * Time.InMilliseconds)
{
if (GetTeamScore(BatttleGroundTeamId.Alliance) == 0)
if (GetTeamScore(BattleGroundTeamId.Alliance) == 0)
{
if (GetTeamScore(BatttleGroundTeamId.Horde) == 0) // No one scored - result is tie
if (GetTeamScore(BattleGroundTeamId.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(BatttleGroundTeamId.Horde) == 0)
else if (GetTeamScore(BattleGroundTeamId.Horde) == 0)
EndBattleground(Team.Alliance); // Alliance has > 0, Horde has 0, alliance wins
else if (GetTeamScore(BatttleGroundTeamId.Horde) == GetTeamScore(BatttleGroundTeamId.Alliance)) // Team score equal, winner is team that scored the last flag
else if (GetTeamScore(BattleGroundTeamId.Horde) == GetTeamScore(BattleGroundTeamId.Alliance)) // Team score equal, winner is team that scored the last flag
EndBattleground((Team)_lastFlagCaptureTeam);
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance)) // Last but not least, check who has the higher score
else if (GetTeamScore(BattleGroundTeamId.Horde) > GetTeamScore(BattleGroundTeamId.Alliance)) // Last but not least, check who has the higher score
EndBattleground(Team.Horde);
else
EndBattleground(Team.Alliance);
@@ -205,7 +205,7 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
void UpdateTeamScore(int team)
{
if (team == BatttleGroundTeamId.Alliance)
if (team == BattleGroundTeamId.Alliance)
UpdateWorldState((int)WorldStateIds.FlagCapturesAlliance, (int)GetTeamScore(team));
else
UpdateWorldState((int)WorldStateIds.FlagCapturesHorde, (int)GetTeamScore(team));
@@ -221,8 +221,8 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
//call parent's class reset
base.Reset();
m_TeamScores[BatttleGroundTeamId.Alliance] = 0;
m_TeamScores[BatttleGroundTeamId.Horde] = 0;
m_TeamScores[BattleGroundTeamId.Alliance] = 0;
m_TeamScores[BattleGroundTeamId.Horde] = 0;
if (Global.BattlegroundMgr.IsBGWeekend(GetTypeID()))
{
@@ -284,9 +284,9 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
public override Team GetPrematureWinner()
{
if (GetTeamScore(BatttleGroundTeamId.Alliance) > GetTeamScore(BatttleGroundTeamId.Horde))
if (GetTeamScore(BattleGroundTeamId.Alliance) > GetTeamScore(BattleGroundTeamId.Horde))
return Team.Alliance;
else if (GetTeamScore(BatttleGroundTeamId.Horde) > GetTeamScore(BatttleGroundTeamId.Alliance))
else if (GetTeamScore(BattleGroundTeamId.Horde) > GetTeamScore(BattleGroundTeamId.Alliance))
return Team.Horde;
return base.GetPrematureWinner();
@@ -305,10 +305,10 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
_doors.Add(gameObject.GetGUID());
break;
case GameobjectIds.AllianceFlagInBase:
_flags[BatttleGroundTeamId.Alliance] = gameObject.GetGUID();
_flags[BattleGroundTeamId.Alliance] = gameObject.GetGUID();
break;
case GameobjectIds.HordeFlagInBase:
_flags[BatttleGroundTeamId.Horde] = gameObject.GetGUID();
_flags[BattleGroundTeamId.Horde] = gameObject.GetGUID();
break;
default:
break;
@@ -323,10 +323,10 @@ namespace Game.BattleGrounds.Zones.WarsongGluch
switch (areaTrigger.GetEntry())
{
case MiscConst.AtCapturePointAlliance:
_capturePointAreaTriggers[BatttleGroundTeamId.Alliance] = areaTrigger.GetGUID();
_capturePointAreaTriggers[BattleGroundTeamId.Alliance] = areaTrigger.GetGUID();
break;
case MiscConst.AtCapturePointHorde:
_capturePointAreaTriggers[BatttleGroundTeamId.Horde] = areaTrigger.GetGUID();
_capturePointAreaTriggers[BattleGroundTeamId.Horde] = areaTrigger.GetGUID();
break;
default:
break;