Core/Auras: Implemented SPELL_AURA_MOD_OVERRIDE_ZONE_PVP_TYPE

Port From (https://github.com/TrinityCore/TrinityCore/commit/c250a858b91a11736ee0a64c2f120b1d036b5203)
This commit is contained in:
hondacrx
2020-10-09 13:57:32 -04:00
parent 77b08c3fd9
commit a108bb1dbc
3 changed files with 62 additions and 11 deletions
+23 -2
View File
@@ -222,15 +222,17 @@ namespace Game.Entities
}
}
void UpdateHostileAreaState(AreaTableRecord area)
public void UpdateHostileAreaState(AreaTableRecord area)
{
ZonePVPTypeOverride overrideZonePvpType = GetOverrideZonePVPType();
pvpInfo.IsInHostileArea = false;
if (area.IsSanctuary()) // sanctuary and arena cannot be overriden
pvpInfo.IsInHostileArea = false;
else if (area.Flags[0].HasAnyFlag(AreaFlags.Arena))
pvpInfo.IsInHostileArea = true;
else
else if (overrideZonePvpType == ZonePVPTypeOverride.None)
{
if (area != null)
{
@@ -253,11 +255,30 @@ namespace Game.Entities
}
}
}
else
{
switch (overrideZonePvpType)
{
case ZonePVPTypeOverride.Friendly:
pvpInfo.IsInHostileArea = false;
break;
case ZonePVPTypeOverride.Hostile:
case ZonePVPTypeOverride.Contested:
case ZonePVPTypeOverride.Combat:
pvpInfo.IsInHostileArea = true;
break;
default:
break;
}
}
// Treat players having a quest flagging for PvP as always in hostile area
pvpInfo.IsHostile = pvpInfo.IsInHostileArea || HasPvPForcingQuest();
}
public ZonePVPTypeOverride GetOverrideZonePVPType() { return (ZonePVPTypeOverride)(uint)m_activePlayerData.OverrideZonePVPType; }
public void SetOverrideZonePVPType(ZonePVPTypeOverride type) { SetUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.OverrideZonePVPType), (uint)type); }
public InstanceBind GetBoundInstance(uint mapid, Difficulty difficulty, bool withExpired = false)
{
// some instances only have one difficulty