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:
@@ -4404,7 +4404,7 @@ namespace Game.Achievements
|
|||||||
if (!bg)
|
if (!bg)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int score = (int)bg.GetTeamScore(source.GetTeam() == Team.Alliance ? Framework.Constants.TeamId.Horde : Framework.Constants.TeamId.Alliance);
|
int score = (int)bg.GetTeamScore(bg.GetPlayerTeam(source.GetGUID()) == Team.Alliance ? Framework.Constants.TeamId.Horde : Framework.Constants.TeamId.Alliance);
|
||||||
return score >= BattlegroundScore.Min && score <= BattlegroundScore.Max;
|
return score >= BattlegroundScore.Min && score <= BattlegroundScore.Max;
|
||||||
}
|
}
|
||||||
case CriteriaDataType.InstanceScript:
|
case CriteriaDataType.InstanceScript:
|
||||||
|
|||||||
@@ -52,14 +52,14 @@ namespace Game.Arenas
|
|||||||
|
|
||||||
if (player.GetBGTeam() == Team.Alliance) // gold
|
if (player.GetBGTeam() == Team.Alliance) // gold
|
||||||
{
|
{
|
||||||
if (player.GetTeam() == Team.Horde)
|
if (player.GetEffectiveTeam() == Team.Horde)
|
||||||
player.CastSpell(player, ArenaSpellIds.HordeGoldFlag, true);
|
player.CastSpell(player, ArenaSpellIds.HordeGoldFlag, true);
|
||||||
else
|
else
|
||||||
player.CastSpell(player, ArenaSpellIds.AllianceGoldFlag, true);
|
player.CastSpell(player, ArenaSpellIds.AllianceGoldFlag, true);
|
||||||
}
|
}
|
||||||
else // green
|
else // green
|
||||||
{
|
{
|
||||||
if (player.GetTeam() == Team.Horde)
|
if (player.GetEffectiveTeam() == Team.Horde)
|
||||||
player.CastSpell(player, ArenaSpellIds.HordeGreenFlag, true);
|
player.CastSpell(player, ArenaSpellIds.HordeGreenFlag, true);
|
||||||
else
|
else
|
||||||
player.CastSpell(player, ArenaSpellIds.AllianceGreenFlag, true);
|
player.CastSpell(player, ArenaSpellIds.AllianceGreenFlag, true);
|
||||||
|
|||||||
@@ -508,7 +508,7 @@ namespace Game.BattleGrounds
|
|||||||
{
|
{
|
||||||
Team team = pair.Value.Team;
|
Team team = pair.Value.Team;
|
||||||
if (team == 0)
|
if (team == 0)
|
||||||
team = player.GetTeam();
|
team = player.GetEffectiveTeam();
|
||||||
if (team != teamId)
|
if (team != teamId)
|
||||||
player = null;
|
player = null;
|
||||||
}
|
}
|
||||||
@@ -1728,16 +1728,18 @@ namespace Game.BattleGrounds
|
|||||||
if (killer == victim)
|
if (killer == victim)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Team killerTeam = GetPlayerTeam(killer.GetGUID());
|
||||||
|
|
||||||
UpdatePlayerScore(killer, ScoreType.HonorableKills, 1);
|
UpdatePlayerScore(killer, ScoreType.HonorableKills, 1);
|
||||||
UpdatePlayerScore(killer, ScoreType.KillingBlows, 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);
|
Player creditedPlayer = Global.ObjAccessor.FindPlayer(guid);
|
||||||
if (!creditedPlayer || creditedPlayer == killer)
|
if (!creditedPlayer || creditedPlayer == killer)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (creditedPlayer.GetTeam() == killer.GetTeam() && creditedPlayer.IsAtGroupRewardDistance(victim))
|
if (player.Team == killerTeam && creditedPlayer.IsAtGroupRewardDistance(victim))
|
||||||
UpdatePlayerScore(creditedPlayer, ScoreType.HonorableKills, 1);
|
UpdatePlayerScore(creditedPlayer, ScoreType.HonorableKills, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1753,7 +1755,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
// Return the player's team based on Battlegroundplayer info
|
// Return the player's team based on Battlegroundplayer info
|
||||||
// Used in same faction arena matches mainly
|
// Used in same faction arena matches mainly
|
||||||
Team GetPlayerTeam(ObjectGuid guid)
|
public Team GetPlayerTeam(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
var player = m_Players.LookupByKey(guid);
|
var player = m_Players.LookupByKey(guid);
|
||||||
if (player != null)
|
if (player != null)
|
||||||
@@ -1841,7 +1843,7 @@ namespace Game.BattleGrounds
|
|||||||
|
|
||||||
public virtual WorldSafeLocsEntry GetClosestGraveYard(Player player)
|
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)
|
public void StartCriteriaTimer(CriteriaStartEvent startEvent, uint entry)
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int teamIndex = GetTeamIndexByTeamId(source.GetTeam());
|
int teamIndex = GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID()));
|
||||||
|
|
||||||
// Check if player really could use this banner, not cheated
|
// Check if player really could use this banner, not cheated
|
||||||
if (!(m_Nodes[node] == 0 || teamIndex == (int)m_Nodes[node] % 2))
|
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)
|
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?
|
// Is there any occupied node for this team?
|
||||||
List<byte> nodes = new();
|
List<byte> nodes = new();
|
||||||
@@ -716,7 +716,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
switch ((BattlegroundCriteriaId)criteriaId)
|
switch ((BattlegroundCriteriaId)criteriaId)
|
||||||
{
|
{
|
||||||
case BattlegroundCriteriaId.ResilientVictory:
|
case BattlegroundCriteriaId.ResilientVictory:
|
||||||
return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(player.GetTeam())];
|
return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID()))];
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CheckAchievementCriteriaMeet(criteriaId, player, target, miscvalue);
|
return base.CheckAchievementCriteriaMeet(criteriaId, player, target, miscvalue);
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//player is neat flag, so update count:
|
//player is neat flag, so update count:
|
||||||
m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(player.GetTeam())]++;
|
m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID()))]++;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,20 +275,21 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (player)
|
if (player)
|
||||||
{
|
{
|
||||||
player.SendUpdateWorldState(EotSWorldStateIds.ProgressBarStatus, (uint)m_PointBarStatus[point]);
|
player.SendUpdateWorldState(EotSWorldStateIds.ProgressBarStatus, (uint)m_PointBarStatus[point]);
|
||||||
|
Team team = GetPlayerTeam(player.GetGUID());
|
||||||
//if point owner changed we must evoke event!
|
//if point owner changed we must evoke event!
|
||||||
if (pointOwnerTeamId != (uint)m_PointOwnedByTeam[point])
|
if (pointOwnerTeamId != (uint)m_PointOwnedByTeam[point])
|
||||||
{
|
{
|
||||||
//point was uncontrolled and player is from team which captured 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);
|
EventTeamCapturedPoint(player, point);
|
||||||
|
|
||||||
//point was under control and player isn't from team which controlled it
|
//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);
|
EventTeamLostPoint(player, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @workaround The original AreaTrigger is covered by a bigger one and not triggered on client side.
|
// @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 (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||||
if (player.GetDistance(2044.0f, 1729.729f, 1190.03f) < 3.0f)
|
if (player.GetDistance(2044.0f, 1729.729f, 1190.03f) < 3.0f)
|
||||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagFelReaver);
|
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagFelReaver);
|
||||||
@@ -414,22 +415,22 @@ namespace Game.BattleGrounds.Zones
|
|||||||
TeleportPlayerToExploitLocation(player);
|
TeleportPlayerToExploitLocation(player);
|
||||||
break;
|
break;
|
||||||
case EotSPointsTrigger.BloodElfPoint:
|
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())
|
if (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagBloodElf);
|
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagBloodElf);
|
||||||
break;
|
break;
|
||||||
case EotSPointsTrigger.FelReaverPoint:
|
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())
|
if (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagFelReaver);
|
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagFelReaver);
|
||||||
break;
|
break;
|
||||||
case EotSPointsTrigger.MageTowerPoint:
|
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())
|
if (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagMageTower);
|
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagMageTower);
|
||||||
break;
|
break;
|
||||||
case EotSPointsTrigger.DraeneiRuinsPoint:
|
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())
|
if (m_FlagState != 0 && GetFlagPickerGUID() == player.GetGUID())
|
||||||
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagDraeneiRuins);
|
EventPlayerCapturedFlag(player, EotSObjectTypes.FlagDraeneiRuins);
|
||||||
break;
|
break;
|
||||||
@@ -643,7 +644,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateHorde, (uint)EotSFlagState.WaitRespawn);
|
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateHorde, (uint)EotSFlagState.WaitRespawn);
|
||||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (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);
|
SendBroadcastText(EotSBroadcastTexts.FlagDropped, ChatMsg.BgSystemAlliance, null);
|
||||||
else
|
else
|
||||||
SendBroadcastText(EotSBroadcastTexts.FlagDropped, ChatMsg.BgSystemHorde, null);
|
SendBroadcastText(EotSBroadcastTexts.FlagDropped, ChatMsg.BgSystemHorde, null);
|
||||||
@@ -654,7 +655,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (GetStatus() != BattlegroundStatus.InProgress || IsFlagPickedup() || !player.IsWithinDistInMap(target_obj, 10))
|
if (GetStatus() != BattlegroundStatus.InProgress || IsFlagPickedup() || !player.IsWithinDistInMap(target_obj, 10))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (player.GetTeam() == Team.Alliance)
|
if (GetPlayerTeam(player.GetGUID()) == Team.Alliance)
|
||||||
{
|
{
|
||||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (uint)EotSFlagState.OnPlayer);
|
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (uint)EotSFlagState.OnPlayer);
|
||||||
PlaySoundToAll(EotSSoundIds.FlagPickedUpAlliance);
|
PlaySoundToAll(EotSSoundIds.FlagPickedUpAlliance);
|
||||||
@@ -675,7 +676,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
player.CastSpell(player, EotSMisc.SpellNetherstormFlag, true);
|
player.CastSpell(player, EotSMisc.SpellNetherstormFlag, true);
|
||||||
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.PvPActive);
|
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.PvPActive);
|
||||||
|
|
||||||
if (player.GetTeam() == Team.Alliance)
|
if (GetPlayerTeam(player.GetGUID()) == Team.Alliance)
|
||||||
SendBroadcastText(EotSBroadcastTexts.TakenFlag, ChatMsg.BgSystemAlliance, player);
|
SendBroadcastText(EotSBroadcastTexts.TakenFlag, ChatMsg.BgSystemAlliance, player);
|
||||||
else
|
else
|
||||||
SendBroadcastText(EotSBroadcastTexts.TakenFlag, ChatMsg.BgSystemHorde, player);
|
SendBroadcastText(EotSBroadcastTexts.TakenFlag, ChatMsg.BgSystemHorde, player);
|
||||||
@@ -734,7 +735,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Team Team = player.GetTeam();
|
Team Team = GetPlayerTeam(player.GetGUID());
|
||||||
|
|
||||||
SpawnBGObject(EotSMisc.m_CapturingPointTypes[Point].DespawnNeutralObjectType, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(EotSMisc.m_CapturingPointTypes[Point].DespawnNeutralObjectType, BattlegroundConst.RespawnOneDay);
|
||||||
SpawnBGObject(EotSMisc.m_CapturingPointTypes[Point].DespawnNeutralObjectType + 1, BattlegroundConst.RespawnOneDay);
|
SpawnBGObject(EotSMisc.m_CapturingPointTypes[Point].DespawnNeutralObjectType + 1, BattlegroundConst.RespawnOneDay);
|
||||||
@@ -806,7 +807,8 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.PvPActive);
|
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.PvPActive);
|
||||||
|
|
||||||
if (player.GetTeam() == Team.Alliance)
|
Team team = GetPlayerTeam(player.GetGUID());
|
||||||
|
if (team == Team.Alliance)
|
||||||
{
|
{
|
||||||
SendBroadcastText(EotSBroadcastTexts.AllianceCapturedFlag, ChatMsg.BgSystemAlliance, player);
|
SendBroadcastText(EotSBroadcastTexts.AllianceCapturedFlag, ChatMsg.BgSystemAlliance, player);
|
||||||
PlaySoundToAll(EotSSoundIds.FlagCapturedAlliance);
|
PlaySoundToAll(EotSSoundIds.FlagCapturedAlliance);
|
||||||
@@ -822,9 +824,9 @@ namespace Game.BattleGrounds.Zones
|
|||||||
m_FlagsTimer = EotSMisc.FlagRespawnTime;
|
m_FlagsTimer = EotSMisc.FlagRespawnTime;
|
||||||
m_FlagCapturedBgObjectType = BgObjectType;
|
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)
|
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.NetherstormFlagStateHorde, (int)EotSFlagState.OnBase);
|
||||||
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (int)EotSFlagState.OnBase);
|
UpdateWorldState(EotSWorldStateIds.NetherstormFlagStateAlliance, (int)EotSFlagState.OnBase);
|
||||||
@@ -899,7 +901,8 @@ namespace Game.BattleGrounds.Zones
|
|||||||
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
|
public override WorldSafeLocsEntry GetClosestGraveYard(Player player)
|
||||||
{
|
{
|
||||||
uint g_id;
|
uint g_id;
|
||||||
switch (player.GetTeam())
|
Team team = GetPlayerTeam(player.GetGUID());
|
||||||
|
switch (team)
|
||||||
{
|
{
|
||||||
case Team.Alliance:
|
case Team.Alliance:
|
||||||
g_id = EotSGaveyardIds.MainAlliance;
|
g_id = EotSGaveyardIds.MainAlliance;
|
||||||
@@ -927,7 +930,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
for (byte i = 0; i < EotSPoints.PointsMax; ++i)
|
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);
|
entry = Global.ObjectMgr.GetWorldSafeLoc(EotSMisc.m_CapturingPointTypes[i].GraveYardId);
|
||||||
if (entry == null)
|
if (entry == null)
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
void TeleportToEntrancePosition(Player player)
|
void TeleportToEntrancePosition(Player player)
|
||||||
{
|
{
|
||||||
if (player.GetTeamId() == Attackers)
|
if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers)
|
||||||
{
|
{
|
||||||
if (!ShipsStarted)
|
if (!ShipsStarted)
|
||||||
{
|
{
|
||||||
@@ -706,7 +706,8 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
uint safeloc;
|
uint safeloc;
|
||||||
|
|
||||||
if (player.GetTeamId() == Attackers)
|
int teamId = GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID()));
|
||||||
|
if (teamId == Attackers)
|
||||||
safeloc = SAMiscConst.GYEntries[SAGraveyards.BeachGy];
|
safeloc = SAMiscConst.GYEntries[SAGraveyards.BeachGy];
|
||||||
else
|
else
|
||||||
safeloc = SAMiscConst.GYEntries[SAGraveyards.DefenderLastGy];
|
safeloc = SAMiscConst.GYEntries[SAGraveyards.DefenderLastGy];
|
||||||
@@ -716,7 +717,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
for (byte i = SAGraveyards.RightCapturableGy; i < SAGraveyards.Max; i++)
|
for (byte i = SAGraveyards.RightCapturableGy; i < SAGraveyards.Max; i++)
|
||||||
{
|
{
|
||||||
if (GraveyardStatus[i] != player.GetTeamId())
|
if (GraveyardStatus[i] != teamId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
WorldSafeLocsEntry ret = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]);
|
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)
|
if (GraveyardStatus[i] == Attackers)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DelCreature(SACreatureTypes.Max + i);
|
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]);
|
WorldSafeLocsEntry sg = Global.ObjectMgr.GetWorldSafeLoc(SAMiscConst.GYEntries[i]);
|
||||||
if (sg == null)
|
if (sg == null)
|
||||||
{
|
{
|
||||||
@@ -831,7 +833,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
flag = SAObjectTypes.LeftFlag;
|
flag = SAObjectTypes.LeftFlag;
|
||||||
DelObject(flag);
|
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);
|
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||||
|
|
||||||
npc = SACreatureTypes.Rigspark;
|
npc = SACreatureTypes.Rigspark;
|
||||||
@@ -850,16 +852,16 @@ namespace Game.BattleGrounds.Zones
|
|||||||
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
UpdateWorldState(SAWorldStateIds.LeftGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
||||||
UpdateWorldState(SAWorldStateIds.LeftGyHorde, GraveyardStatus[i] == TeamId.Horde);
|
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)
|
if (c)
|
||||||
SendChatMessage(c, Source.GetTeamId() == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, Source);
|
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.WestGraveyardCapturedA : SATextIds.WestGraveyardCapturedH, source);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SAGraveyards.RightCapturableGy:
|
case SAGraveyards.RightCapturableGy:
|
||||||
{
|
{
|
||||||
flag = SAObjectTypes.RightFlag;
|
flag = SAObjectTypes.RightFlag;
|
||||||
DelObject(flag);
|
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);
|
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||||
|
|
||||||
npc = SACreatureTypes.Sparklight;
|
npc = SACreatureTypes.Sparklight;
|
||||||
@@ -879,24 +881,24 @@ namespace Game.BattleGrounds.Zones
|
|||||||
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
UpdateWorldState(SAWorldStateIds.RightGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
||||||
UpdateWorldState(SAWorldStateIds.RightGyHorde, GraveyardStatus[i] == TeamId.Horde);
|
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)
|
if (c)
|
||||||
SendChatMessage(c, Source.GetTeamId() == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, Source);
|
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.EastGraveyardCapturedA : SATextIds.EastGraveyardCapturedH, source);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SAGraveyards.CentralCapturableGy:
|
case SAGraveyards.CentralCapturableGy:
|
||||||
{
|
{
|
||||||
flag = SAObjectTypes.CentralFlag;
|
flag = SAObjectTypes.CentralFlag;
|
||||||
DelObject(flag);
|
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);
|
SAMiscConst.ObjSpawnlocs[flag], 0, 0, 0, 0, BattlegroundConst.RespawnOneDay);
|
||||||
|
|
||||||
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
UpdateWorldState(SAWorldStateIds.CenterGyAlliance, GraveyardStatus[i] == TeamId.Alliance);
|
||||||
UpdateWorldState(SAWorldStateIds.CenterGyHorde, GraveyardStatus[i] == TeamId.Horde);
|
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)
|
if (c)
|
||||||
SendChatMessage(c, Source.GetTeamId() == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, Source);
|
SendChatMessage(c, teamId == TeamId.Alliance ? SATextIds.SouthGraveyardCapturedA : SATextIds.SouthGraveyardCapturedH, source);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -912,9 +914,10 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
if (CanInteractWithObject(SAObjectTypes.TitanRelic))
|
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);
|
SendBroadcastText(SABroadcastTexts.AllianceCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
||||||
else
|
else
|
||||||
SendBroadcastText(SABroadcastTexts.HordeCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
SendBroadcastText(SABroadcastTexts.HordeCapturedTitanPortal, ChatMsg.BgSystemNeutral);
|
||||||
@@ -928,7 +931,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||||
if (player)
|
if (player)
|
||||||
if (player.GetTeamId() == Attackers)
|
if (GetTeamIndexByTeamId(GetPlayerTeam(player.GetGUID())) == Attackers)
|
||||||
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -960,7 +963,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
Player player = Global.ObjAccessor.FindPlayer(pair.Key);
|
||||||
if (player)
|
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);
|
player.UpdateCriteria(CriteriaType.BeSpellTarget, 65246);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1065,9 +1068,9 @@ namespace Game.BattleGrounds.Zones
|
|||||||
switch ((BattlegroundCriteriaId)criteriaId)
|
switch ((BattlegroundCriteriaId)criteriaId)
|
||||||
{
|
{
|
||||||
case BattlegroundCriteriaId.NotEvenAScratch:
|
case BattlegroundCriteriaId.NotEvenAScratch:
|
||||||
return _allVehiclesAlive[GetTeamIndexByTeamId(source.GetTeam())];
|
return _allVehiclesAlive[GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID()))];
|
||||||
case BattlegroundCriteriaId.DefenseOfTheAncients:
|
case BattlegroundCriteriaId.DefenseOfTheAncients:
|
||||||
return source.GetTeamId() != Attackers && !_gateDestroyed;
|
return GetTeamIndexByTeamId(GetPlayerTeam(source.GetGUID())) != Attackers && !_gateDestroyed;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
|
return base.CheckAchievementCriteriaMeet(criteriaId, source, target, miscValue);
|
||||||
|
|||||||
@@ -260,7 +260,8 @@ namespace Game.BattleGrounds.Zones
|
|||||||
Team winner = 0;
|
Team winner = 0;
|
||||||
|
|
||||||
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.PvPActive);
|
player.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.PvPActive);
|
||||||
if (player.GetTeam() == Team.Alliance)
|
Team team = GetPlayerTeam(player.GetGUID());
|
||||||
|
if (team == Team.Alliance)
|
||||||
{
|
{
|
||||||
if (!IsHordeFlagPickedup())
|
if (!IsHordeFlagPickedup())
|
||||||
return;
|
return;
|
||||||
@@ -299,23 +300,23 @@ namespace Game.BattleGrounds.Zones
|
|||||||
RewardReputationToTeam(889, m_ReputationCapture, Team.Horde);
|
RewardReputationToTeam(889, m_ReputationCapture, Team.Horde);
|
||||||
}
|
}
|
||||||
//for flag capture is reward 2 honorable kills
|
//for flag capture is reward 2 honorable kills
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(2), player.GetTeam());
|
RewardHonorToTeam(GetBonusHonorFromKill(2), team);
|
||||||
|
|
||||||
SpawnBGObject(WSGObjectTypes.HFlag, WSGTimerOrScore.FlagRespawnTime);
|
SpawnBGObject(WSGObjectTypes.HFlag, WSGTimerOrScore.FlagRespawnTime);
|
||||||
SpawnBGObject(WSGObjectTypes.AFlag, WSGTimerOrScore.FlagRespawnTime);
|
SpawnBGObject(WSGObjectTypes.AFlag, WSGTimerOrScore.FlagRespawnTime);
|
||||||
|
|
||||||
if (player.GetTeam() == Team.Alliance)
|
if (team == Team.Alliance)
|
||||||
SendBroadcastText(WSGBroadcastTexts.CapturedHordeFlag, ChatMsg.BgSystemAlliance, player);
|
SendBroadcastText(WSGBroadcastTexts.CapturedHordeFlag, ChatMsg.BgSystemAlliance, player);
|
||||||
else
|
else
|
||||||
SendBroadcastText(WSGBroadcastTexts.CapturedAllianceFlag, ChatMsg.BgSystemHorde, player);
|
SendBroadcastText(WSGBroadcastTexts.CapturedAllianceFlag, ChatMsg.BgSystemHorde, player);
|
||||||
|
|
||||||
UpdateFlagState(player.GetTeam(), WSGFlagState.WaitRespawn); // flag state none
|
UpdateFlagState(team, WSGFlagState.WaitRespawn); // flag state none
|
||||||
UpdateTeamScore(player.GetTeamId());
|
UpdateTeamScore(GetTeamIndexByTeamId(team));
|
||||||
// only flag capture should be updated
|
// only flag capture should be updated
|
||||||
UpdatePlayerScore(player, ScoreType.FlagCaptures, 1); // +1 flag captures
|
UpdatePlayerScore(player, ScoreType.FlagCaptures, 1); // +1 flag captures
|
||||||
|
|
||||||
// update last flag capture to be used if teamscore is equal
|
// update last flag capture to be used if teamscore is equal
|
||||||
SetLastFlagCapture(player.GetTeam());
|
SetLastFlagCapture(team);
|
||||||
|
|
||||||
if (GetTeamScore(TeamId.Alliance) == WSGTimerOrScore.MaxTeamScore)
|
if (GetTeamScore(TeamId.Alliance) == WSGTimerOrScore.MaxTeamScore)
|
||||||
winner = Team.Alliance;
|
winner = Team.Alliance;
|
||||||
@@ -336,17 +337,18 @@ namespace Game.BattleGrounds.Zones
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_flagsTimer[GetTeamIndexByTeamId(player.GetTeam())] = WSGTimerOrScore.FlagRespawnTime;
|
_flagsTimer[GetTeamIndexByTeamId(team)] = WSGTimerOrScore.FlagRespawnTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void EventPlayerDroppedFlag(Player player)
|
public override void EventPlayerDroppedFlag(Player player)
|
||||||
{
|
{
|
||||||
|
Team team = GetPlayerTeam(player.GetGUID());
|
||||||
if (GetStatus() != BattlegroundStatus.InProgress)
|
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||||
{
|
{
|
||||||
// if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages
|
// 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
|
// just take off the aura
|
||||||
if (player.GetTeam() == Team.Alliance)
|
if (team == Team.Alliance)
|
||||||
{
|
{
|
||||||
if (!IsHordeFlagPickedup())
|
if (!IsHordeFlagPickedup())
|
||||||
return;
|
return;
|
||||||
@@ -373,7 +375,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
|
|
||||||
bool set = false;
|
bool set = false;
|
||||||
|
|
||||||
if (player.GetTeam() == Team.Alliance)
|
if (team == Team.Alliance)
|
||||||
{
|
{
|
||||||
if (!IsHordeFlagPickedup())
|
if (!IsHordeFlagPickedup())
|
||||||
return;
|
return;
|
||||||
@@ -411,9 +413,9 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (set)
|
if (set)
|
||||||
{
|
{
|
||||||
player.CastSpell(player, BattlegroundConst.SpellRecentlyDroppedFlag, true);
|
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);
|
SendBroadcastText(WSGBroadcastTexts.HordeFlagDropped, ChatMsg.BgSystemHorde, player);
|
||||||
UpdateWorldState(WSGWorldStates.FlagUnkHorde, 0xFFFFFFFF);
|
UpdateWorldState(WSGWorldStates.FlagUnkHorde, 0xFFFFFFFF);
|
||||||
@@ -424,7 +426,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
UpdateWorldState(WSGWorldStates.FlagUnkAlliance, 0xFFFFFFFF);
|
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)
|
if (GetStatus() != BattlegroundStatus.InProgress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Team team = GetPlayerTeam(player.GetGUID());
|
||||||
|
|
||||||
//alliance flag picked up from base
|
//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())
|
&& BgObjects[WSGObjectTypes.AFlag] == target_obj.GetGUID())
|
||||||
{
|
{
|
||||||
SendBroadcastText(WSGBroadcastTexts.AllianceFlagPickedUp, ChatMsg.BgSystemHorde, player);
|
SendBroadcastText(WSGBroadcastTexts.AllianceFlagPickedUp, ChatMsg.BgSystemHorde, player);
|
||||||
@@ -452,7 +456,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
}
|
}
|
||||||
|
|
||||||
//horde flag picked up from base
|
//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())
|
&& BgObjects[WSGObjectTypes.HFlag] == target_obj.GetGUID())
|
||||||
{
|
{
|
||||||
SendBroadcastText(WSGBroadcastTexts.HordeFlagPickedUp, ChatMsg.BgSystemAlliance, player);
|
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)
|
if (GetFlagState(Team.Alliance) == WSGFlagState.OnGround && player.IsWithinDistInMap(target_obj, 10)
|
||||||
&& target_obj.GetGoInfo().entry == WSGObjectEntry.AFlagGround)
|
&& target_obj.GetGoInfo().entry == WSGObjectEntry.AFlagGround)
|
||||||
{
|
{
|
||||||
if (player.GetTeam() == Team.Alliance)
|
if (team == Team.Alliance)
|
||||||
{
|
{
|
||||||
SendBroadcastText(WSGBroadcastTexts.AllianceFlagReturned, ChatMsg.BgSystemAlliance, player);
|
SendBroadcastText(WSGBroadcastTexts.AllianceFlagReturned, ChatMsg.BgSystemAlliance, player);
|
||||||
UpdateFlagState(Team.Horde, WSGFlagState.WaitRespawn);
|
UpdateFlagState(Team.Horde, WSGFlagState.WaitRespawn);
|
||||||
@@ -506,7 +510,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
if (GetFlagState(Team.Horde) == WSGFlagState.OnGround && player.IsWithinDistInMap(target_obj, 10)
|
if (GetFlagState(Team.Horde) == WSGFlagState.OnGround && player.IsWithinDistInMap(target_obj, 10)
|
||||||
&& target_obj.GetGoInfo().entry == WSGObjectEntry.HFlagGround)
|
&& target_obj.GetGoInfo().entry == WSGObjectEntry.HFlagGround)
|
||||||
{
|
{
|
||||||
if (player.GetTeam() == Team.Horde)
|
if (team == Team.Horde)
|
||||||
{
|
{
|
||||||
SendBroadcastText(WSGBroadcastTexts.HordeFlagReturned, ChatMsg.BgSystemHorde, player);
|
SendBroadcastText(WSGBroadcastTexts.HordeFlagReturned, ChatMsg.BgSystemHorde, player);
|
||||||
UpdateFlagState(Team.Alliance, WSGFlagState.WaitRespawn);
|
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
|
//if a player dies in preparation phase - then the player can't cheat
|
||||||
//and teleport to the graveyard outside the flagroom
|
//and teleport to the graveyard outside the flagroom
|
||||||
//and start running around, while the doors are still closed
|
//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)
|
if (GetStatus() == BattlegroundStatus.InProgress)
|
||||||
return Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainAlliance);
|
return Global.ObjectMgr.GetWorldSafeLoc(WSGGraveyards.MainAlliance);
|
||||||
@@ -860,7 +864,7 @@ namespace Game.BattleGrounds.Zones
|
|||||||
{
|
{
|
||||||
Player playerTarget = target.ToPlayer();
|
Player playerTarget = target.ToPlayer();
|
||||||
if (playerTarget)
|
if (playerTarget)
|
||||||
return GetFlagState(playerTarget.GetTeam()) == WSGFlagState.OnBase;
|
return GetFlagState(GetPlayerTeam(playerTarget.GetGUID())) == WSGFlagState.OnBase;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1411,7 +1411,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
Battleground bg = target.GetBattleground();
|
Battleground bg = target.GetBattleground();
|
||||||
if (bg)
|
if (bg)
|
||||||
return bg.CanActivateGO((int)GetEntry(), (uint)target.GetTeam());
|
return bg.CanActivateGO((int)GetEntry(), (uint)bg.GetPlayerTeam(target.GetGUID()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1213,7 +1213,7 @@ namespace Game.Entities
|
|||||||
Player objPlayer = obj.ToPlayer();
|
Player objPlayer = obj.ToPlayer();
|
||||||
if (objPlayer != null)
|
if (objPlayer != null)
|
||||||
{
|
{
|
||||||
if (thisPlayer.GetTeam() != objPlayer.GetTeam() || !thisPlayer.IsGroupVisibleFor(objPlayer))
|
if (!thisPlayer.IsGroupVisibleFor(objPlayer))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -6158,7 +6158,7 @@ namespace Game.Entities
|
|||||||
Battleground bg = GetBattleground();
|
Battleground bg = GetBattleground();
|
||||||
if (bg)
|
if (bg)
|
||||||
{
|
{
|
||||||
if (!bg.CanActivateGO((int)go.GetEntry(), (uint)GetTeam()))
|
if (!bg.CanActivateGO((int)go.GetEntry(), (uint)bg.GetPlayerTeam(GetGUID())))
|
||||||
{
|
{
|
||||||
SendLootRelease(guid);
|
SendLootRelease(guid);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace Game.Entities
|
|||||||
Player plrVictim = victim.ToPlayer();
|
Player plrVictim = victim.ToPlayer();
|
||||||
if (plrVictim)
|
if (plrVictim)
|
||||||
{
|
{
|
||||||
if (GetTeam() == plrVictim.GetTeam() && !Global.WorldMgr.IsFFAPvPRealm())
|
if (GetEffectiveTeam() == plrVictim.GetEffectiveTeam() && !Global.WorldMgr.IsFFAPvPRealm())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
byte k_level = (byte)GetLevel();
|
byte k_level = (byte)GetLevel();
|
||||||
@@ -662,7 +662,7 @@ namespace Game.Entities
|
|||||||
reportAfkResult.Offender = GetGUID();
|
reportAfkResult.Offender = GetGUID();
|
||||||
Battleground bg = GetBattleground();
|
Battleground bg = GetBattleground();
|
||||||
// Battleground also must be in progress!
|
// Battleground also must be in progress!
|
||||||
if (!bg || bg != reporter.GetBattleground() || GetTeam() != reporter.GetTeam() || bg.GetStatus() != BattlegroundStatus.InProgress)
|
if (!bg || bg != reporter.GetBattleground() || GetEffectiveTeam() != reporter.GetEffectiveTeam() || bg.GetStatus() != BattlegroundStatus.InProgress)
|
||||||
{
|
{
|
||||||
reporter.SendPacket(reportAfkResult);
|
reporter.SendPacket(reportAfkResult);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2384,7 +2384,7 @@ namespace Game.Entities
|
|||||||
if (objectiveType == QuestObjectiveType.PlayerKills && objective.Flags.HasAnyFlag(QuestObjectiveFlags.KillPlayersSameFaction))
|
if (objectiveType == QuestObjectiveType.PlayerKills && objective.Flags.HasAnyFlag(QuestObjectiveFlags.KillPlayersSameFaction))
|
||||||
{
|
{
|
||||||
Player victim = Global.ObjAccessor.GetPlayer(GetMap(), victimGuid);
|
Player victim = Global.ObjAccessor.GetPlayer(GetMap(), victimGuid);
|
||||||
if (victim?.GetTeam() != GetTeam())
|
if (victim?.GetEffectiveTeam() != GetEffectiveTeam())
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3516,14 +3516,6 @@ namespace Game.Entities
|
|||||||
uint GetChampioningFaction() { return m_ChampioningFaction; }
|
uint GetChampioningFaction() { return m_ChampioningFaction; }
|
||||||
public void SetChampioningFaction(uint faction) { m_ChampioningFaction = faction; }
|
public void SetChampioningFaction(uint faction) { m_ChampioningFaction = faction; }
|
||||||
|
|
||||||
public void SwitchToOppositeTeam(bool apply)
|
|
||||||
{
|
|
||||||
m_team = TeamForRace(GetRace());
|
|
||||||
|
|
||||||
if (apply)
|
|
||||||
m_team = (m_team == Team.Alliance) ? Team.Horde : Team.Alliance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetFactionForRace(Race race)
|
public void SetFactionForRace(Race race)
|
||||||
{
|
{
|
||||||
m_team = TeamForRace(race);
|
m_team = TeamForRace(race);
|
||||||
@@ -5251,6 +5243,9 @@ namespace Game.Entities
|
|||||||
public Team GetTeam() { return m_team; }
|
public Team GetTeam() { return m_team; }
|
||||||
public int GetTeamId() { return m_team == Team.Alliance ? TeamId.Alliance : TeamId.Horde; }
|
public int GetTeamId() { return m_team == Team.Alliance ? TeamId.Alliance : TeamId.Horde; }
|
||||||
|
|
||||||
|
public Team GetEffectiveTeam() { return HasPlayerFlagEx(PlayerFlagsEx.MercenaryMode) ? (GetTeam() == Team.Alliance ? Team.Horde : Team.Alliance) : GetTeam(); }
|
||||||
|
public int GetEffectiveTeamId() { return GetEffectiveTeam() == Team.Alliance ? TeamId.Alliance : TeamId.Horde; }
|
||||||
|
|
||||||
//Money
|
//Money
|
||||||
public ulong GetMoney() { return m_activePlayerData.Coinage; }
|
public ulong GetMoney() { return m_activePlayerData.Coinage; }
|
||||||
public bool HasEnoughMoney(ulong amount) { return GetMoney() >= amount; }
|
public bool HasEnoughMoney(ulong amount) { return GetMoney() >= amount; }
|
||||||
|
|||||||
@@ -1001,7 +1001,7 @@ namespace Game.Entities
|
|||||||
if (attacker.IsCreature())
|
if (attacker.IsCreature())
|
||||||
victim.ToPlayer().UpdateCriteria(CriteriaType.KilledByCreature, attacker.GetEntry());
|
victim.ToPlayer().UpdateCriteria(CriteriaType.KilledByCreature, attacker.GetEntry());
|
||||||
else if (attacker.IsPlayer() && victim != attacker)
|
else if (attacker.IsPlayer() && victim != attacker)
|
||||||
victim.ToPlayer().UpdateCriteria(CriteriaType.KilledByPlayer, 1, (ulong)attacker.ToPlayer().GetTeam());
|
victim.ToPlayer().UpdateCriteria(CriteriaType.KilledByPlayer, 1, (ulong)attacker.ToPlayer().GetEffectiveTeam());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook for OnPVPKill Event
|
// Hook for OnPVPKill Event
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ namespace Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetPlayer().GetTeam() != receiver.GetTeam() && !HasPermission(RBACPermissions.TwoSideInteractionChat) && !receiver.IsInWhisperWhiteList(sender.GetGUID()))
|
if (GetPlayer().GetEffectiveTeam() != receiver.GetEffectiveTeam() && !HasPermission(RBACPermissions.TwoSideInteractionChat) && !receiver.IsInWhisperWhiteList(sender.GetGUID()))
|
||||||
{
|
{
|
||||||
SendChatPlayerNotfoundNotice(target);
|
SendChatPlayerNotfoundNotice(target);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Game
|
|||||||
InspectResult inspectResult = new();
|
InspectResult inspectResult = new();
|
||||||
inspectResult.DisplayInfo.Initialize(player);
|
inspectResult.DisplayInfo.Initialize(player);
|
||||||
|
|
||||||
if (GetPlayer().CanBeGameMaster() || WorldConfig.GetIntValue(WorldCfg.TalentsInspecting) + (GetPlayer().GetTeamId() == player.GetTeamId() ? 1 : 0) > 1)
|
if (GetPlayer().CanBeGameMaster() || WorldConfig.GetIntValue(WorldCfg.TalentsInspecting) + (GetPlayer().GetEffectiveTeam() == player.GetEffectiveTeam() ? 1 : 0) > 1)
|
||||||
{
|
{
|
||||||
var talents = player.GetTalentMap(player.GetActiveTalentGroup());
|
var talents = player.GetTalentMap(player.GetActiveTalentGroup());
|
||||||
foreach (var v in talents)
|
foreach (var v in talents)
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ namespace Game.Maps
|
|||||||
WorldObject i_source;
|
WorldObject i_source;
|
||||||
T i_packetSender;
|
T i_packetSender;
|
||||||
float i_distSq;
|
float i_distSq;
|
||||||
uint team;
|
Team team;
|
||||||
Player skipped_receiver;
|
Player skipped_receiver;
|
||||||
|
|
||||||
public MessageDistDeliverer(WorldObject src, T packetSender, float dist, bool own_team_only = false, Player skipped = null)
|
public MessageDistDeliverer(WorldObject src, T packetSender, float dist, bool own_team_only = false, Player skipped = null)
|
||||||
@@ -410,7 +410,9 @@ namespace Game.Maps
|
|||||||
i_source = src;
|
i_source = src;
|
||||||
i_packetSender = packetSender;
|
i_packetSender = packetSender;
|
||||||
i_distSq = dist * dist;
|
i_distSq = dist * dist;
|
||||||
team = (uint)((own_team_only && src.IsTypeId(TypeId.Player)) ? ((Player)src).GetTeam() : 0);
|
if (own_team_only && src.IsPlayer())
|
||||||
|
team = src.ToPlayer().GetEffectiveTeam();
|
||||||
|
|
||||||
skipped_receiver = skipped;
|
skipped_receiver = skipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,7 +486,7 @@ namespace Game.Maps
|
|||||||
void SendPacket(Player player)
|
void SendPacket(Player player)
|
||||||
{
|
{
|
||||||
// never send packet to self
|
// never send packet to self
|
||||||
if (i_source == player || (team != 0 && (uint)player.GetTeam() != team) || skipped_receiver == player)
|
if (i_source == player || (team != 0 && player.GetEffectiveTeam() != team) || skipped_receiver == player)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!player.HaveAtClient(i_source))
|
if (!player.HaveAtClient(i_source))
|
||||||
|
|||||||
@@ -5742,9 +5742,9 @@ namespace Game.Spells
|
|||||||
if (!mode.HasFlag(AuraEffectHandleModes.Real))
|
if (!mode.HasFlag(AuraEffectHandleModes.Real))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = aurApp.GetTarget().ToPlayer();
|
//Player player = aurApp.GetTarget().ToPlayer();
|
||||||
if (player != null)
|
//if (player != null)
|
||||||
player.SwitchToOppositeTeam(apply);
|
//player.SwitchToOppositeTeam(apply);
|
||||||
}
|
}
|
||||||
|
|
||||||
[AuraEffectHandler(AuraType.SetFFAPvp)]
|
[AuraEffectHandler(AuraType.SetFFAPvp)]
|
||||||
@@ -5808,9 +5808,9 @@ namespace Game.Spells
|
|||||||
playerPosition.Pos = target.GetPosition();
|
playerPosition.Pos = target.GetPosition();
|
||||||
|
|
||||||
if (GetAuraType() == AuraType.BattleGroundPlayerPositionFactional)
|
if (GetAuraType() == AuraType.BattleGroundPlayerPositionFactional)
|
||||||
playerPosition.IconID = target.GetTeam() == Team.Alliance ? BattlegroundConst.PlayerPositionIconHordeFlag : BattlegroundConst.PlayerPositionIconAllianceFlag;
|
playerPosition.IconID = target.GetEffectiveTeam() == Team.Alliance ? BattlegroundConst.PlayerPositionIconHordeFlag : BattlegroundConst.PlayerPositionIconAllianceFlag;
|
||||||
else if (GetAuraType() == AuraType.BattleGroundPlayerPosition)
|
else if (GetAuraType() == AuraType.BattleGroundPlayerPosition)
|
||||||
playerPosition.IconID = target.GetTeam() == Team.Alliance ? BattlegroundConst.PlayerPositionIconAllianceFlag : BattlegroundConst.PlayerPositionIconHordeFlag;
|
playerPosition.IconID = target.GetEffectiveTeam() == Team.Alliance ? BattlegroundConst.PlayerPositionIconAllianceFlag : BattlegroundConst.PlayerPositionIconHordeFlag;
|
||||||
else
|
else
|
||||||
Log.outWarn(LogFilter.Spells, $"Unknown aura effect {GetAuraType()} handled by HandleBattlegroundPlayerPosition.");
|
Log.outWarn(LogFilter.Spells, $"Unknown aura effect {GetAuraType()} handled by HandleBattlegroundPlayerPosition.");
|
||||||
|
|
||||||
|
|||||||
@@ -2678,7 +2678,7 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
Battleground bg = player.GetBattleground();
|
Battleground bg = player.GetBattleground();
|
||||||
if (bg)
|
if (bg)
|
||||||
bg.SetDroppedFlagGUID(go.GetGUID(), (player.GetTeam() == Team.Alliance ? TeamId.Horde : TeamId.Alliance));
|
bg.SetDroppedFlagGUID(go.GetGUID(), bg.GetPlayerTeam(player.GetGUID()) == Team.Alliance ? TeamId.Horde : TeamId.Alliance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ namespace Game
|
|||||||
uint areaId = source.GetAreaId();
|
uint areaId = source.GetAreaId();
|
||||||
var players = source.GetMap().GetPlayers();
|
var players = source.GetMap().GetPlayers();
|
||||||
foreach (var pl in players)
|
foreach (var pl in players)
|
||||||
if (pl.GetAreaId() == areaId && (team == 0 || pl.GetTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
if (pl.GetAreaId() == areaId && (team == 0 || pl.GetEffectiveTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
||||||
pl.SendPacket(data);
|
pl.SendPacket(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -336,7 +336,7 @@ namespace Game
|
|||||||
uint zoneId = source.GetZoneId();
|
uint zoneId = source.GetZoneId();
|
||||||
var players = source.GetMap().GetPlayers();
|
var players = source.GetMap().GetPlayers();
|
||||||
foreach (var pl in players)
|
foreach (var pl in players)
|
||||||
if (pl.GetZoneId() == zoneId && (team == 0 || pl.GetTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
if (pl.GetZoneId() == zoneId && (team == 0 || pl.GetEffectiveTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
||||||
pl.SendPacket(data);
|
pl.SendPacket(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -344,7 +344,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
var players = source.GetMap().GetPlayers();
|
var players = source.GetMap().GetPlayers();
|
||||||
foreach (var pl in players)
|
foreach (var pl in players)
|
||||||
if ((team == 0 || pl.GetTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
if ((team == 0 || pl.GetEffectiveTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
||||||
pl.SendPacket(data);
|
pl.SendPacket(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -479,7 +479,7 @@ namespace Game
|
|||||||
uint areaId = source.GetAreaId();
|
uint areaId = source.GetAreaId();
|
||||||
var players = source.GetMap().GetPlayers();
|
var players = source.GetMap().GetPlayers();
|
||||||
foreach (var pl in players)
|
foreach (var pl in players)
|
||||||
if (pl.GetAreaId() == areaId && (team == 0 || pl.GetTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
if (pl.GetAreaId() == areaId && (team == 0 || pl.GetEffectiveTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
||||||
localizer.Invoke(pl);
|
localizer.Invoke(pl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -488,7 +488,7 @@ namespace Game
|
|||||||
uint zoneId = source.GetZoneId();
|
uint zoneId = source.GetZoneId();
|
||||||
var players = source.GetMap().GetPlayers();
|
var players = source.GetMap().GetPlayers();
|
||||||
foreach (var pl in players)
|
foreach (var pl in players)
|
||||||
if (pl.GetZoneId() == zoneId && (team == 0 || pl.GetTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
if (pl.GetZoneId() == zoneId && (team == 0 || pl.GetEffectiveTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
||||||
localizer.Invoke(pl);
|
localizer.Invoke(pl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -496,7 +496,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
var players = source.GetMap().GetPlayers();
|
var players = source.GetMap().GetPlayers();
|
||||||
foreach (var pl in players)
|
foreach (var pl in players)
|
||||||
if ((team == 0 || pl.GetTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
if ((team == 0 || pl.GetEffectiveTeam() == team) && (!gmOnly || pl.IsGameMaster()))
|
||||||
localizer.Invoke(pl);
|
localizer.Invoke(pl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2589,7 +2589,7 @@ namespace Scripts.Spells.Generic
|
|||||||
{
|
{
|
||||||
Player caster = GetCaster().ToPlayer();
|
Player caster = GetCaster().ToPlayer();
|
||||||
|
|
||||||
switch (caster.GetTeam())
|
switch (caster.GetEffectiveTeam())
|
||||||
{
|
{
|
||||||
case Team.Alliance:
|
case Team.Alliance:
|
||||||
caster.CastSpell(caster, SpellIds.PvpTrinketAlliance, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
|
caster.CastSpell(caster, SpellIds.PvpTrinketAlliance, new CastSpellExtraArgs(TriggerCastFlags.FullMask));
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace Scripts.World.Achievements
|
|||||||
{
|
{
|
||||||
Battleground bg = source.GetBattleground();
|
Battleground bg = source.GetBattleground();
|
||||||
if (bg)
|
if (bg)
|
||||||
return bg.IsAllNodesControlledByTeam(source.GetTeam());
|
return bg.IsAllNodesControlledByTeam(bg.GetPlayerTeam(source.GetGUID()));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user