Core: Combat/threat system rewrite
Port From (https://github.com/TrinityCore/TrinityCore/commit/34c7810fe507eca1b8b9389630db5d5d26d92e77)
This commit is contained in:
@@ -342,6 +342,20 @@ namespace Game.Entities
|
||||
UpdateDamagePhysical(attType);
|
||||
}
|
||||
|
||||
public override void AtEnterCombat()
|
||||
{
|
||||
base.AtEnterCombat();
|
||||
if (GetCombatManager().HasPvPCombat())
|
||||
EnablePvpRules(true);
|
||||
}
|
||||
|
||||
public override void AtExitCombat()
|
||||
{
|
||||
base.AtExitCombat();
|
||||
UpdatePotionCooldown();
|
||||
m_combatExitTime = Time.GetMSTime();
|
||||
}
|
||||
|
||||
public override float GetBlockPercent(uint attackerLevel)
|
||||
{
|
||||
float blockArmor = (float)m_activePlayerData.ShieldBlock;
|
||||
|
||||
@@ -475,7 +475,7 @@ namespace Game.Entities
|
||||
if (IsInAreaThatActivatesPvpTalents())
|
||||
return;
|
||||
|
||||
if (GetCombatTimer() == 0)
|
||||
if (!GetCombatManager().HasPvPCombat())
|
||||
{
|
||||
RemoveAurasDueToSpell(PlayerConst.SpellPvpRulesEnabled);
|
||||
UpdateItemLevelAreaBasedScaling();
|
||||
|
||||
@@ -316,6 +316,8 @@ namespace Game.Entities
|
||||
SetPrimarySpecialization(defaultSpec.Id);
|
||||
}
|
||||
|
||||
GetThreatManager().Initialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
public override void Update(uint diff)
|
||||
@@ -358,7 +360,7 @@ namespace Game.Entities
|
||||
|
||||
UpdateAfkReport(now);
|
||||
|
||||
if (GetCombatTimer() != 0) // Only set when in pvp combat
|
||||
if (GetCombatManager().HasPvPCombat()) // Only set when in pvp combat
|
||||
{
|
||||
Aura aura = GetAura(PlayerConst.SpellPvpRulesEnabled);
|
||||
if (aura != null)
|
||||
@@ -615,7 +617,7 @@ namespace Game.Entities
|
||||
{
|
||||
m_hostileReferenceCheckTimer = 15 * Time.InMilliseconds;
|
||||
if (!GetMap().IsDungeon())
|
||||
GetHostileRefManager().DeleteReferencesOutOfRange(GetVisibilityRange());
|
||||
GetCombatManager().EndCombatBeyondRange(GetVisibilityRange(), true);
|
||||
}
|
||||
else
|
||||
m_hostileReferenceCheckTimer -= diff;
|
||||
@@ -1908,9 +1910,6 @@ namespace Game.Entities
|
||||
|
||||
// Call base
|
||||
base.SetInWater(inWater);
|
||||
|
||||
// Update threat tables
|
||||
GetHostileRefManager().UpdateThreatTables();
|
||||
}
|
||||
public void ValidateMovementInfo(MovementInfo mi)
|
||||
{
|
||||
@@ -2151,15 +2150,11 @@ namespace Game.Entities
|
||||
|
||||
Pet pet = GetPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.SetFaction(35);
|
||||
pet.GetHostileRefManager().SetOnlineOfflineState(false);
|
||||
}
|
||||
|
||||
RemovePvpFlag(UnitPVPStateFlags.FFAPvp);
|
||||
ResetContestedPvP();
|
||||
|
||||
GetHostileRefManager().SetOnlineOfflineState(false);
|
||||
CombatStopWithPets();
|
||||
|
||||
PhasingHandler.SetAlwaysVisible(this, true, false);
|
||||
@@ -2176,10 +2171,7 @@ namespace Game.Entities
|
||||
|
||||
Pet pet = GetPet();
|
||||
if (pet != null)
|
||||
{
|
||||
pet.SetFaction(GetFaction());
|
||||
pet.GetHostileRefManager().SetOnlineOfflineState(true);
|
||||
}
|
||||
|
||||
// restore FFA PvP Server state
|
||||
if (Global.WorldMgr.IsFFAPvPRealm())
|
||||
@@ -2188,7 +2180,6 @@ namespace Game.Entities
|
||||
// restore FFA PvP area state, remove not allowed for GM mounts
|
||||
UpdateArea(m_areaUpdateId);
|
||||
|
||||
GetHostileRefManager().SetOnlineOfflineState(true);
|
||||
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.GM, AccountTypes.Player);
|
||||
}
|
||||
|
||||
@@ -3918,14 +3909,6 @@ namespace Game.Entities
|
||||
public static bool IsValidClass(Class _class) { return Convert.ToBoolean((1 << ((int)_class - 1)) & (int)Class.ClassMaskAllPlayable); }
|
||||
public static bool IsValidRace(Race _race) { return Convert.ToBoolean((ulong)SharedConst.GetMaskForRace(_race) & SharedConst.RaceMaskAllPlayable); }
|
||||
|
||||
public override void OnCombatExit()
|
||||
{
|
||||
base.OnCombatExit();
|
||||
|
||||
UpdatePotionCooldown();
|
||||
m_combatExitTime = Time.GetMSTime();
|
||||
}
|
||||
|
||||
void LeaveLFGChannel()
|
||||
{
|
||||
foreach (var i in m_channels)
|
||||
@@ -6887,7 +6870,6 @@ namespace Game.Entities
|
||||
m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
|
||||
Dismount();
|
||||
RemoveUnitFlag(UnitFlags.RemoveClientControl | UnitFlags.TaxiFlight);
|
||||
GetHostileRefManager().SetOnlineOfflineState(true);
|
||||
}
|
||||
|
||||
public void ContinueTaxiFlight()
|
||||
|
||||
Reference in New Issue
Block a user