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:
@@ -1411,7 +1411,7 @@ namespace Game.Entities
|
||||
{
|
||||
Battleground bg = target.GetBattleground();
|
||||
if (bg)
|
||||
return bg.CanActivateGO((int)GetEntry(), (uint)target.GetTeam());
|
||||
return bg.CanActivateGO((int)GetEntry(), (uint)bg.GetPlayerTeam(target.GetGUID()));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1213,7 +1213,7 @@ namespace Game.Entities
|
||||
Player objPlayer = obj.ToPlayer();
|
||||
if (objPlayer != null)
|
||||
{
|
||||
if (thisPlayer.GetTeam() != objPlayer.GetTeam() || !thisPlayer.IsGroupVisibleFor(objPlayer))
|
||||
if (!thisPlayer.IsGroupVisibleFor(objPlayer))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -6158,7 +6158,7 @@ namespace Game.Entities
|
||||
Battleground bg = GetBattleground();
|
||||
if (bg)
|
||||
{
|
||||
if (!bg.CanActivateGO((int)go.GetEntry(), (uint)GetTeam()))
|
||||
if (!bg.CanActivateGO((int)go.GetEntry(), (uint)bg.GetPlayerTeam(GetGUID())))
|
||||
{
|
||||
SendLootRelease(guid);
|
||||
return;
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Game.Entities
|
||||
Player plrVictim = victim.ToPlayer();
|
||||
if (plrVictim)
|
||||
{
|
||||
if (GetTeam() == plrVictim.GetTeam() && !Global.WorldMgr.IsFFAPvPRealm())
|
||||
if (GetEffectiveTeam() == plrVictim.GetEffectiveTeam() && !Global.WorldMgr.IsFFAPvPRealm())
|
||||
return false;
|
||||
|
||||
byte k_level = (byte)GetLevel();
|
||||
@@ -662,7 +662,7 @@ namespace Game.Entities
|
||||
reportAfkResult.Offender = GetGUID();
|
||||
Battleground bg = GetBattleground();
|
||||
// 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);
|
||||
return;
|
||||
|
||||
@@ -2384,7 +2384,7 @@ namespace Game.Entities
|
||||
if (objectiveType == QuestObjectiveType.PlayerKills && objective.Flags.HasAnyFlag(QuestObjectiveFlags.KillPlayersSameFaction))
|
||||
{
|
||||
Player victim = Global.ObjAccessor.GetPlayer(GetMap(), victimGuid);
|
||||
if (victim?.GetTeam() != GetTeam())
|
||||
if (victim?.GetEffectiveTeam() != GetEffectiveTeam())
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -3515,14 +3515,6 @@ namespace Game.Entities
|
||||
|
||||
uint GetChampioningFaction() { return m_ChampioningFaction; }
|
||||
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)
|
||||
{
|
||||
@@ -5251,6 +5243,9 @@ namespace Game.Entities
|
||||
public Team GetTeam() { return m_team; }
|
||||
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
|
||||
public ulong GetMoney() { return m_activePlayerData.Coinage; }
|
||||
public bool HasEnoughMoney(ulong amount) { return GetMoney() >= amount; }
|
||||
|
||||
@@ -1001,7 +1001,7 @@ namespace Game.Entities
|
||||
if (attacker.IsCreature())
|
||||
victim.ToPlayer().UpdateCriteria(CriteriaType.KilledByCreature, attacker.GetEntry());
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user