From 1e4fa35ac234c6a203ce1c67f85fb8008e72dac1 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 1 Nov 2021 12:09:07 -0400 Subject: [PATCH] Core/Unit: Random code style/naming adjustments Port From (https://github.com/TrinityCore/TrinityCore/commit/05119fd90949340cad4a700d12069154a2faf5f6) --- Source/Game/Entities/Object/Update/UpdateFields.cs | 2 +- Source/Game/Entities/Player/Player.cs | 2 +- Source/Game/Entities/Unit/Unit.Fields.cs | 2 +- Source/Game/Entities/Unit/Unit.Spells.cs | 3 ++- Source/Game/Entities/Unit/Unit.cs | 6 +++--- Source/Game/Maps/GridNotifiers.cs | 2 +- Source/Game/Spells/Auras/AuraEffect.cs | 12 ++++++------ 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Source/Game/Entities/Object/Update/UpdateFields.cs b/Source/Game/Entities/Object/Update/UpdateFields.cs index 77298487e..e26a45e53 100644 --- a/Source/Game/Entities/Object/Update/UpdateFields.cs +++ b/Source/Game/Entities/Object/Update/UpdateFields.cs @@ -2216,7 +2216,7 @@ namespace Game.Entities CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate(); // this also applies for transform auras - SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransForm(), unit.GetMap().GetDifficultyID()); + SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransformSpell(), unit.GetMap().GetDifficultyID()); if (transform != null) { foreach (var spellEffectInfo in transform.GetEffects()) diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 3b3d2b4cb..6964ba8e2 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -6731,7 +6731,7 @@ namespace Game.Entities if (GetDisplayId() != GetNativeDisplayId()) RestoreDisplayId(true); - if (IsDisallowedMountForm(GetTransForm(), ShapeShiftForm.None, GetDisplayId())) + if (IsDisallowedMountForm(GetTransformSpell(), ShapeShiftForm.None, GetDisplayId())) { GetSession().SendActivateTaxiReply(ActivateTaxiReply.PlayerShapeshifted); return false; diff --git a/Source/Game/Entities/Unit/Unit.Fields.cs b/Source/Game/Entities/Unit/Unit.Fields.cs index f105a98db..49d8e227c 100644 --- a/Source/Game/Entities/Unit/Unit.Fields.cs +++ b/Source/Game/Entities/Unit/Unit.Fields.cs @@ -125,7 +125,7 @@ namespace Game.Entities public Vehicle VehicleKit { get; set; } bool canModifyStats; public uint LastSanctuaryTime { get; set; } - uint m_transform; + uint m_transformSpell; bool m_cleanupDone; // lock made to not add stuff after cleanup before delete bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world bool _instantCast; diff --git a/Source/Game/Entities/Unit/Unit.Spells.cs b/Source/Game/Entities/Unit/Unit.Spells.cs index 0abe7050a..10e2cf687 100644 --- a/Source/Game/Entities/Unit/Unit.Spells.cs +++ b/Source/Game/Entities/Unit/Unit.Spells.cs @@ -1782,9 +1782,10 @@ namespace Game.Entities public bool HasInvisibilityAura() { return HasAuraType(AuraType.ModInvisibility); } public bool IsFeared() { return HasAuraType(AuraType.ModFear); } public bool IsFrozen() { return HasAuraState(AuraStateType.Frozen); } + public bool HasRootAura() { return HasAuraType(AuraType.ModRoot) || HasAuraType(AuraType.ModRoot2); } public bool IsPolymorphed() { - uint transformId = GetTransForm(); + uint transformId = GetTransformSpell(); if (transformId == 0) return false; diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index ead386789..cb788ac36 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -258,7 +258,7 @@ namespace Game.Entities public bool IsInDisallowedMountForm() { - return IsDisallowedMountForm(GetTransForm(), GetShapeshiftForm(), GetDisplayId()); + return IsDisallowedMountForm(GetTransformSpell(), GetShapeshiftForm(), GetDisplayId()); } public bool IsDisallowedMountForm(uint spellId, ShapeShiftForm form, uint displayId) @@ -510,8 +510,8 @@ namespace Game.Entities base.CleanupsBeforeDelete(finalCleanup); } - public void SetTransForm(uint spellid) { m_transform = spellid; } - public uint GetTransForm() { return m_transform; } + public void SetTransformSpell(uint spellid) { m_transformSpell = spellid; } + public uint GetTransformSpell() { return m_transformSpell; } public Vehicle GetVehicleKit() { return VehicleKit; } public Vehicle GetVehicle() { return m_vehicle; } diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs index 9171f2df3..7d6fbf9fe 100644 --- a/Source/Game/Maps/GridNotifiers.cs +++ b/Source/Game/Maps/GridNotifiers.cs @@ -1905,7 +1905,7 @@ namespace Game.Maps public bool Invoke(Creature u) { if (u.IsAlive() && u.IsInCombat() && !i_obj.IsHostileTo(u) && i_obj.IsWithinDistInMap(u, i_range) && - (u.IsFeared() || u.IsCharmed() || u.IsFrozen() || u.HasUnitState(UnitState.Stunned) || u.HasUnitState(UnitState.Confused))) + (u.IsFeared() || u.IsCharmed() || u.HasRootAura() || u.HasUnitState(UnitState.Stunned) || u.HasUnitState(UnitState.Confused))) return true; return false; } diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 5189ce3e3..383d1c0d2 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -1250,7 +1250,7 @@ namespace Game.Spells // and polymorphic affects if (target.IsPolymorphed()) - target.RemoveAurasDueToSpell(target.GetTransForm()); + target.RemoveAurasDueToSpell(target.GetTransformSpell()); break; } default: @@ -1272,7 +1272,7 @@ namespace Game.Spells if (modelid > 0) { - SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm(), GetBase().GetCastDifficulty()); + SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransformSpell(), GetBase().GetCastDifficulty()); if (transformSpellInfo == null || !GetSpellInfo().IsPositive()) target.SetDisplayId(modelid); } @@ -1377,10 +1377,10 @@ namespace Game.Spells if (apply) { // update active transform spell only when transform not set or not overwriting negative by positive case - SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm(), GetBase().GetCastDifficulty()); + SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransformSpell(), GetBase().GetCastDifficulty()); if (transformSpellInfo == null || !GetSpellInfo().IsPositive() || transformSpellInfo.IsPositive()) { - target.SetTransForm(GetId()); + target.SetTransformSpell(GetId()); // special case (spell specific functionality) if (GetMiscValue() == 0) { @@ -1558,8 +1558,8 @@ namespace Game.Spells } else { - if (target.GetTransForm() == GetId()) - target.SetTransForm(0); + if (target.GetTransformSpell() == GetId()) + target.SetTransformSpell(0); target.RestoreDisplayId(target.IsMounted());