Core/Battlegrounds: Replaced overriding m_team with more fine grained approach
Port From (https://github.com/TrinityCore/TrinityCore/commit/55587694053583b4cb85be38a47563a9fdf77271)
This commit is contained in:
@@ -508,7 +508,7 @@ namespace Game.BattleGrounds
|
||||
{
|
||||
Team team = pair.Value.Team;
|
||||
if (team == 0)
|
||||
team = player.GetTeam();
|
||||
team = player.GetEffectiveTeam();
|
||||
if (team != teamId)
|
||||
player = null;
|
||||
}
|
||||
@@ -1728,16 +1728,18 @@ namespace Game.BattleGrounds
|
||||
if (killer == victim)
|
||||
return;
|
||||
|
||||
Team killerTeam = GetPlayerTeam(killer.GetGUID());
|
||||
|
||||
UpdatePlayerScore(killer, ScoreType.HonorableKills, 1);
|
||||
UpdatePlayerScore(killer, ScoreType.KillingBlows, 1);
|
||||
|
||||
foreach (var guid in m_Players.Keys)
|
||||
foreach (var (guid, player) in m_Players)
|
||||
{
|
||||
Player creditedPlayer = Global.ObjAccessor.FindPlayer(guid);
|
||||
if (!creditedPlayer || creditedPlayer == killer)
|
||||
continue;
|
||||
|
||||
if (creditedPlayer.GetTeam() == killer.GetTeam() && creditedPlayer.IsAtGroupRewardDistance(victim))
|
||||
if (player.Team == killerTeam && creditedPlayer.IsAtGroupRewardDistance(victim))
|
||||
UpdatePlayerScore(creditedPlayer, ScoreType.HonorableKills, 1);
|
||||
}
|
||||
}
|
||||
@@ -1753,7 +1755,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
// Return the player's team based on Battlegroundplayer info
|
||||
// Used in same faction arena matches mainly
|
||||
Team GetPlayerTeam(ObjectGuid guid)
|
||||
public Team GetPlayerTeam(ObjectGuid guid)
|
||||
{
|
||||
var player = m_Players.LookupByKey(guid);
|
||||
if (player != null)
|
||||
@@ -1841,7 +1843,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
public virtual WorldSafeLocsEntry GetClosestGraveYard(Player player)
|
||||
{
|
||||
return Global.ObjectMgr.GetClosestGraveYard(player, player.GetTeam(), player);
|
||||
return Global.ObjectMgr.GetClosestGraveYard(player, GetPlayerTeam(player.GetGUID()), player);
|
||||
}
|
||||
|
||||
public void StartCriteriaTimer(CriteriaStartEvent startEvent, uint entry)
|
||||
|
||||
@@ -427,7 +427,7 @@ namespace Game.BattleGrounds.Zones
|
||||
return;
|
||||
}
|
||||
|
||||
int teamIndex = GetTeamIndexByTeamId(source.GetTeam());
|
||||
int teamIndex = GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID()));
|
||||
|
||||
// Check if player really could use this banner, not cheated
|
||||
if (!(m_Nodes[node] == 0 || teamIndex == (int)m_Nodes[node] % 2))
|
||||
@@ -639,7 +639,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
|
||||
{
|
||||
int teamIndex = GetTeamIndexByTeamId(player.GetTeam());
|
||||
int teamIndex = GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID()));
|
||||
|
||||
// Is there any occupied node for this team?
|
||||
List<byte> nodes = new();
|
||||
@@ -716,7 +716,7 @@ namespace Game.BattleGrounds.Zones
|
||||
switch ((BattlegroundCriteriaId)criteriaId)
|
||||
{
|
||||
case BattlegroundCriteriaId.ResilientVictory:
|
||||
return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(player.GetTeam())];
|
||||
return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID()))];
|
||||
}
|
||||
|
||||
return base.CheckAchievementCriteriaMeet(criteriaId, player, target, miscvalue);
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace Game.BattleGrounds.Zones
|
||||
else
|
||||
{
|
||||
//player is neat flag, so update count:
|
||||
m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(player.GetTeam())]++;
|
||||
m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID()))]++;
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -275,20 +275,21 @@ namespace Game.BattleGrounds.Zones
|
||||
if (player)
|
||||
{
|
||||
player.SendUpdateWorldState(EotSWorldStateIds.ProgressBarStatus, (uint)m_PointBarStatus[point]);
|
||||
Team team = GetPlayerTeam(player.GetGUID());
|
||||
//if point owner changed we must evoke event!
|
||||
if (pointOwnerTeamId != (uint)m_PointOwnedByTeam[point])
|
||||
{
|
||||
//point was uncontrolled and player is from team which captured point
|
||||
if (m_PointState[point] == EotSPointState.Uncontrolled && (uint)player.GetTeam() == pointOwnerTeamId)
|
||||
if (m_PointState[point] == EotSPointState.Uncontrolled && (uint)team == pointOwnerTeamId)
|
||||
EventTeamCapturedPoint(player, point);
|
||||
|
||||
//point was under control and player isn't from team which controlled it
|
||||
if (m_PointState[point] == EotSPointState.UnderControl && player.GetTeam() != m_PointOwnedByTeam[point])
|
||||
if (m_PointState[point] == EotSPointState.UnderControl && team != m_PointOwnedByTeam[point])
|
||||
EventTeamLostPoint(player, point);
|
||||
}
|
||||
|
||||
// @workaround The original AreaTrigger is covered by a bigger one and not triggered on client side.
|
||||
if (point == EotSPoints.FelReaver && m_PointOwnedByTeam[point] == player.GetTeam())
|
||||
if (point == EotSPoints.FelReaver && m_PointOwnedByTeam[point] == team)
|
||||
if (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||
if (player.GetDistance(2044.0f, 1729.729f, 1190.03f) < 3.0f)
|
||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagFelReaver);
|
||||
@@ -414,22 +415,22 @@ namespace Game.BattleGrounds.Zones
|
||||
TeleportPlayerToExploitLocation(player);
|
||||
break;
|
||||
case EotSPointsTrigger.BloodElfPoint:
|
||||
if (m_PointState[EotSPoints.BloodElf] == EotSPointState.UnderControl && m_PointOwnedByTeam[EotSPoints.BloodElf] == player.GetTeam())
|
||||
if (m_PointState[EotSPoints.BloodElf] == EotSPointState.UnderControl && m_PointOwnedByTeam[EotSPoints.BloodElf] == GetPlayerTeam(player.GetGUID()))
|
||||
if (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagBloodElf);
|
||||
break;
|
||||
case EotSPointsTrigger.FelReaverPoint:
|
||||
if (m_PointState[EotSPoints.FelReaver] == EotSPointState.UnderControl && m_PointOwnedByTeam[EotSPoints.FelReaver] == player.GetTeam())
|
||||
if (m_PointState[EotSPoints.FelReaver] == EotSPointState.UnderControl && m_PointOwnedByTeam[EotSPoints.FelReaver] == GetPlayerTeam(player.GetGUID()))
|
||||
if (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagFelReaver);
|
||||
break;
|
||||
case EotSPointsTrigger.MageTowerPoint:
|
||||
if (m_PointState[EotSPoints.MageTower] == EotSPointState.UnderControl && m_PointOwnedByTeam[EotSPoints.MageTower] == player.GetTeam())
|
||||
if (m_PointState[EotSPoints.MageTower] == EotSPointState.UnderControl && m_PointOwnedByTeam[EotSPoints.MageTower] == GetPlayerTeam(player.GetGUID()))
|
||||
if (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagMageTower);
|
||||
break;
|
||||
case EotSPointsTrigger.DraeneiRuinsPoint:
|
||||
if (m_PointState[EotSPoints.DraeneiRuins] == EotSPointState.UnderControl && m_PointOwnedByTeam[EotSPoints.DraeneiRuins] == player.GetTeam())
|
||||
if (m_PointState[EotSPoints.DraeneiRuins] == EotSPointState.UnderControl && m_PointOwnedByTeam[EotSPoints.DraeneiRuins] == GetPlayerTeam(player.GetGUID()))
|
||||
if (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagDraeneiRuins);
|
||||
break;
|
||||
@@ -643,7 +644,7 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateHorde, (uint)EotSFlagState.WaitRespawn);
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (uint)EotSFlagState.WaitRespawn);
|
||||
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
if (GetPlayerTeam(player.GetGUID()) == Team.Alliance)
|
||||
SendBroadcastText(EotSBroadcastTexts.FlagDropped, ChatMsg.BgSystemAlliance, null);
|
||||
else
|
||||
SendBroadcastText(EotSBroadcastTexts.FlagDropped, ChatMsg.BgSystemHorde, null);
|
||||
@@ -654,7 +655,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (GetStatus() != BattlegroundStatus.InProgress || IsFlagPickedup() || !player.IsWithinDistInMap(target_obj, 10))
|
||||
return;
|
||||
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
if (GetPlayerTeam(player.GetGUID()) == Team.Alliance)
|
||||
{
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (uint)EotSFlagState.OnPlayer);
|
||||
PlaySoundToAll(EotSSoundIds.FlagPickedUpAlliance);
|
||||
@@ -675,7 +676,7 @@ namespace Game.BattleGrounds.Zones
|
||||
player.CastSpell(player, EotSMisc.SpellNetherstormFlag, true);
|
||||
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.PvPActive);
|
||||
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
if (GetPlayerTeam(player.GetGUID()) == Team.Alliance)
|
||||
SendBroadcastText(EotSBroadcastTexts.TakenFlag, ChatMsg.BgSystemAlliance, player);
|
||||
else
|
||||
SendBroadcastText(EotSBroadcastTexts.TakenFlag, ChatMsg.BgSystemHorde, player);
|
||||
@@ -734,7 +735,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||
return;
|
||||
|
||||
Team Team = player.GetTeam();
|
||||
Team Team = GetPlayerTeam(player.GetGUID());
|
||||
|
||||
SpawnBGObject(EotSMisc.m_CapturingPointTypes[Point].DespawnNeutralObjectType, BattlegroundConst.RespawnOneDay);
|
||||
SpawnBGObject(EotSMisc.m_CapturingPointTypes[Point].DespawnNeutralObjectType + 1, BattlegroundConst.RespawnOneDay);
|
||||
@@ -806,7 +807,8 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.PvPActive);
|
||||
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
Team team = GetPlayerTeam(player.GetGUID());
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
SendBroadcastText(EotSBroadcastTexts.AllianceCapturedFlag, ChatMsg.BgSystemAlliance, player);
|
||||
PlaySoundToAll(EotSSoundIds.FlagCapturedAlliance);
|
||||
@@ -822,9 +824,9 @@ namespace Game.BattleGrounds.Zones
|
||||
m_FlagsTimer = EotSMisc.FlagRespawnTime;
|
||||
m_FlagCapturedBgObjectType = BgObjectType;
|
||||
|
||||
int team_id = player.GetTeam() == Team.Alliance ? TeamId.Alliance : TeamId.Horde;
|
||||
int team_id = GetTeamIndexByTeamId(team);
|
||||
if (m_TeamPointsCount[team_id] > 0)
|
||||
AddPoints(player.GetTeam(), EotSMisc.FlagPoints[m_TeamPointsCount[team_id] - 1]);
|
||||
AddPoints(team, EotSMisc.FlagPoints[m_TeamPointsCount[team_id] - 1]);
|
||||
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateHorde, (int)EotSFlagState.OnBase);
|
||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (int)EotSFlagState.OnBase);
|
||||
@@ -899,7 +901,8 @@ namespace Game.BattleGrounds.Zones
|
||||
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
|
||||
{
|
||||
uint g_id;
|
||||
switch (player.GetTeam())
|
||||
Team team = GetPlayerTeam(player.GetGUID());
|
||||
switch (team)
|
||||
{
|
||||
case Team.Alliance:
|
||||
g_id = EotSGaveyardIds.MainAlliance;
|
||||
@@ -927,7 +930,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
for (byte i = 0; i < EotSPoints.PointsMax; ++i)
|
||||
{
|
||||
if (m_PointOwnedByTeam[i] == player.GetTeam() && m_PointState[i] == EotSPointState.UnderControl)
|
||||
if (m_PointOwnedByTeam[i] == team && m_PointState[i] == EotSPointState.UnderControl)
|
||||
{
|
||||
entry = Global.ObjectMgr.GetWorldSafeLoc(EotSMisc.m_CapturingPointTypes[i].GraveYardId);
|
||||
if (entry == null)
|
||||
|
||||
@@ -530,7 +530,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
void TeleportToEntrancePosition(Player player)
|
||||
{
|
||||
if (player.GetTeamId() == Attackers)
|
||||
if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers)
|
||||
{
|
||||
if (!ShipsStarted)
|
||||
{
|
||||
@@ -706,7 +706,8 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
uint safeloc;
|
||||
|
||||
if (player.GetTeamId() == Attackers)
|
||||
int teamId = GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID()));
|
||||
if (teamId == Attackers)
|
||||
safeloc = SAMiscConst.GYEntries[SAGraveyards.BeachGy];
|
||||
else
|
||||
safeloc = SAMiscConst.GYEntries[SAGraveyards.DefenderLastGy];
|
||||
@@ -716,7 +717,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
for (byte i = SAGraveyards.RightCapturableGy; i < SAGraveyards.Max; i++)
|
||||
{
|
||||
if (GraveyardStatus[i] != player.GetTeamId())
|
||||
if (GraveyardStatus[i] != teamId)
|
||||
continue;
|
||||
|
||||
WorldSafeLocsEntry ret = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]);
|
||||
@@ -807,13 +808,14 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureGraveyard(int i, Player Source)
|
||||
void CaptureGraveyard(int i, Player source)
|
||||
{
|
||||
if (GraveyardStatus[i] == Attackers)
|
||||
return;
|
||||
|
||||
DelCreature(SACreatureTypes.Max + i);
|
||||
GraveyardStatus[i] = Source.GetTeamId();
|
||||
int teamId = GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID()));
|
||||
GraveyardStatus[i] = teamId;
|
||||
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]);
|
||||
if (sg == null)
|
||||
{
|
||||
@@ -831,7 +833,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
flag = SAObjectTypes.LeftFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (Source.GetTeamId() == TeamId.Alliance ? 0 : 1u)),
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == TeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
npc = SACreatureTypes.Rigspark;
|
||||
@@ -850,16 +852,16 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[i] == TeamId.Horde);
|
||||
|
||||
Creature c = Source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, Source.GetTeamId() == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, Source);
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
case SAGraveyards.RightCapturableGy:
|
||||
{
|
||||
flag = SAObjectTypes.RightFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (Source.GetTeamId() == TeamId.Alliance ? 0 : 1u)),
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (teamId == TeamId.Alliance ? 0 : 1u)),
|
||||
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||
|
||||
npc = SACreatureTypes.Sparklight;
|
||||
@@ -879,24 +881,24 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[i] == TeamId.Horde);
|
||||
|
||||
Creature c = Source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, Source.GetTeamId() == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, Source);
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
case SAGraveyards.CentralCapturableGy:
|
||||
{
|
||||
flag = SAObjectTypes.CentralFlag;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (SAMiscConst.ObjEntries[flag] - (Source.GetTeamId() == TeamId.Alliance ? 0 : 1u)),
|
||||
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);
|
||||
|
||||
Creature c = Source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
Creature c = source.FindNearestCreature(SharedConst.WorldTrigger, 500.0f);
|
||||
if (c)
|
||||
SendChatMessage(c, Source.GetTeamId() == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, Source);
|
||||
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -912,9 +914,10 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
if (CanInteractWithObject(SAObjectTypes.TitanRelic))
|
||||
{
|
||||
if (clicker.GetTeamId() == Attackers)
|
||||
int clickerTeamId = GetTeamIndexByTeamId(GetPlayerTeam(clicker.GetGUID()));
|
||||
if (clickerTeamId == Attackers)
|
||||
{
|
||||
if (clicker.GetTeamId() == TeamId.Alliance)
|
||||
if (clickerTeamId == TeamId.Alliance)
|
||||
SendBroadcastText(SABroadcastTexts.AllianceCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
||||
else
|
||||
SendBroadcastText(SABroadcastTexts.HordeCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
||||
@@ -928,7 +931,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player.GetTeamId() == Attackers)
|
||||
if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers)
|
||||
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
||||
}
|
||||
|
||||
@@ -960,7 +963,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||
if (player)
|
||||
if (player.GetTeamId() == Attackers && RoundScores[1].winner == Attackers)
|
||||
if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers && RoundScores[1].winner == Attackers)
|
||||
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
||||
}
|
||||
|
||||
@@ -1065,9 +1068,9 @@ namespace Game.BattleGrounds.Zones
|
||||
switch ((BattlegroundCriteriaId)criteriaId)
|
||||
{
|
||||
case BattlegroundCriteriaId.NotEvenAScratch:
|
||||
return _allVehiclesAlive[GetTeamIndexByTeamId(source.GetTeam())];
|
||||
return _allVehiclesAlive[GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID()))];
|
||||
case BattlegroundCriteriaId.DefenseOfTheAncients:
|
||||
return source.GetTeamId() != Attackers && !_gateDestroyed;
|
||||
return GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID())) != Attackers && !_gateDestroyed;
|
||||
}
|
||||
|
||||
return base.CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
|
||||
|
||||
@@ -260,7 +260,8 @@ namespace Game.BattleGrounds.Zones
|
||||
Team winner = 0;
|
||||
|
||||
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.PvPActive);
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
Team team = GetPlayerTeam(player.GetGUID());
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
@@ -299,23 +300,23 @@ namespace Game.BattleGrounds.Zones
|
||||
RewardReputationToTeam(889, m_ReputationCapture, Team.Horde);
|
||||
}
|
||||
//for flag capture is reward 2 honorable kills
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(2), player.GetTeam());
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(2), team);
|
||||
|
||||
SpawnBGObject(WSGObjectTypes.HFlag, WSGTimerOrScore.FlagRespawnTime);
|
||||
SpawnBGObject(WSGObjectTypes.AFlag, WSGTimerOrScore.FlagRespawnTime);
|
||||
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
if (team == Team.Alliance)
|
||||
SendBroadcastText(WSGBroadcastTexts.CapturedHordeFlag, ChatMsg.BgSystemAlliance, player);
|
||||
else
|
||||
SendBroadcastText(WSGBroadcastTexts.CapturedAllianceFlag, ChatMsg.BgSystemHorde, player);
|
||||
|
||||
UpdateFlagState(player.GetTeam(), WSGFlagState.WaitRespawn); // flag state none
|
||||
UpdateTeamScore(player.GetTeamId());
|
||||
UpdateFlagState(team, WSGFlagState.WaitRespawn); // flag state none
|
||||
UpdateTeamScore(GetTeamIndexByTeamId(team));
|
||||
// only flag capture should be updated
|
||||
UpdatePlayerScore(player, ScoreType.FlagCaptures, 1); // +1 flag captures
|
||||
|
||||
// update last flag capture to be used if teamscore is equal
|
||||
SetLastFlagCapture(player.GetTeam());
|
||||
SetLastFlagCapture(team);
|
||||
|
||||
if (GetTeamScore(TeamId.Alliance) == WSGTimerOrScore.MaxTeamScore)
|
||||
winner = Team.Alliance;
|
||||
@@ -336,17 +337,18 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
else
|
||||
{
|
||||
_flagsTimer[GetTeamIndexByTeamId(player.GetTeam())] = WSGTimerOrScore.FlagRespawnTime;
|
||||
_flagsTimer[GetTeamIndexByTeamId(team)] = WSGTimerOrScore.FlagRespawnTime;
|
||||
}
|
||||
}
|
||||
|
||||
public override void EventPlayerDroppedFlag(Player player)
|
||||
{
|
||||
Team team = GetPlayerTeam(player.GetGUID());
|
||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||
{
|
||||
// if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages
|
||||
// just take off the aura
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
@@ -373,7 +375,7 @@ namespace Game.BattleGrounds.Zones
|
||||
|
||||
bool set = false;
|
||||
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
@@ -411,9 +413,9 @@ namespace Game.BattleGrounds.Zones
|
||||
if (set)
|
||||
{
|
||||
player.CastSpell(player, BattlegroundConst.SpellRecentlyDroppedFlag, true);
|
||||
UpdateFlagState(player.GetTeam(), WSGFlagState.WaitRespawn);
|
||||
UpdateFlagState(team, WSGFlagState.WaitRespawn);
|
||||
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
SendBroadcastText(WSGBroadcastTexts.HordeFlagDropped, ChatMsg.BgSystemHorde, player);
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkHorde, 0xFFFFFFFF);
|
||||
@@ -424,7 +426,7 @@ namespace Game.BattleGrounds.Zones
|
||||
UpdateWorldState(WSGWorldStates.FlagUnkAlliance, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
_flagsDropTimer[GetTeamIndexByTeamId(GetOtherTeam(player.GetTeam()))] = WSGTimerOrScore.FlagDropTime;
|
||||
_flagsDropTimer[GetTeamIndexByTeamId(GetOtherTeam(team))] = WSGTimerOrScore.FlagDropTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,8 +435,10 @@ namespace Game.BattleGrounds.Zones
|
||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||
return;
|
||||
|
||||
Team team = GetPlayerTeam(player.GetGUID());
|
||||
|
||||
//alliance flag picked up from base
|
||||
if (player.GetTeam() == Team.Horde && GetFlagState(Team.Alliance) == WSGFlagState.OnBase
|
||||
if (team == Team.Horde && GetFlagState(Team.Alliance) == WSGFlagState.OnBase
|
||||
&& BgObjects[WSGObjectTypes.AFlag] == target_obj.GetGUID())
|
||||
{
|
||||
SendBroadcastText(WSGBroadcastTexts.AllianceFlagPickedUp, ChatMsg.BgSystemHorde, player);
|
||||
@@ -452,7 +456,7 @@ namespace Game.BattleGrounds.Zones
|
||||
}
|
||||
|
||||
//horde flag picked up from base
|
||||
if (player.GetTeam() == Team.Alliance && GetFlagState(Team.Horde) == WSGFlagState.OnBase
|
||||
if (team == Team.Alliance && GetFlagState(Team.Horde) == WSGFlagState.OnBase
|
||||
&& BgObjects[WSGObjectTypes.HFlag] == target_obj.GetGUID())
|
||||
{
|
||||
SendBroadcastText(WSGBroadcastTexts.HordeFlagPickedUp, ChatMsg.BgSystemAlliance, player);
|
||||
@@ -473,7 +477,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (GetFlagState(Team.Alliance) == WSGFlagState.OnGround && player.IsWithinDistInMap(target_obj, 10)
|
||||
&& target_obj.GetGoInfo().entry == WSGObjectEntry.AFlagGround)
|
||||
{
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
if (team == Team.Alliance)
|
||||
{
|
||||
SendBroadcastText(WSGBroadcastTexts.AllianceFlagReturned, ChatMsg.BgSystemAlliance, player);
|
||||
UpdateFlagState(Team.Horde, WSGFlagState.WaitRespawn);
|
||||
@@ -506,7 +510,7 @@ namespace Game.BattleGrounds.Zones
|
||||
if (GetFlagState(Team.Horde) == WSGFlagState.OnGround && player.IsWithinDistInMap(target_obj, 10)
|
||||
&& target_obj.GetGoInfo().entry == WSGObjectEntry.HFlagGround)
|
||||
{
|
||||
if (player.GetTeam() == Team.Horde)
|
||||
if (team == Team.Horde)
|
||||
{
|
||||
SendBroadcastText(WSGBroadcastTexts.HordeFlagReturned, ChatMsg.BgSystemHorde, player);
|
||||
UpdateFlagState(Team.Alliance, WSGFlagState.WaitRespawn);
|
||||
@@ -780,7 +784,7 @@ namespace Game.BattleGrounds.Zones
|
||||
//if a player dies in preparation phase - then the player can't cheat
|
||||
//and teleport to the graveyard outside the flagroom
|
||||
//and start running around, while the doors are still closed
|
||||
if (player.GetTeam() == Team.Alliance)
|
||||
if (GetPlayerTeam(player.GetGUID()) == Team.Alliance)
|
||||
{
|
||||
if (GetStatus() == BattlegroundStatus.InProgress)
|
||||
return Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainAlliance);
|
||||
@@ -860,7 +864,7 @@ namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
Player playerTarget = target.ToPlayer();
|
||||
if (playerTarget)
|
||||
return GetFlagState(playerTarget.GetTeam()) == WSGFlagState.OnBase;
|
||||
return GetFlagState(GetPlayerTeam(playerTarget.GetGUID())) == WSGFlagState.OnBase;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user