diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs index 029cf6bb4..79af13cde 100644 --- a/Source/Game/AI/SmartScripts/SmartAIManager.cs +++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs @@ -649,7 +649,7 @@ namespace Game.AI SmartEvents.OnSpellFailed => Marshal.SizeOf(typeof(SmartEvent.SpellCast)), SmartEvents.OnSpellStart => Marshal.SizeOf(typeof(SmartEvent.SpellCast)), SmartEvents.OnDespawn => 0, - _ => Marshal.SizeOf(typeof(SmartEvent.Raw)), + _ => Marshal.SizeOf(typeof(SmartEvent.Raw)), }; int rawCount = Marshal.SizeOf(typeof(SmartEvent.Raw)) / sizeof(uint); diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index aef46bd0c..628283365 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -283,7 +283,7 @@ namespace Game.Entities } else if (PetSaveMode.FirstActiveSlot <= slot && slot <= PetSaveMode.LastActiveSlot) { - var activePetIndex = Array.FindIndex(petStable.ActivePets, pet => pet?.PetNumber == petnumber); + var activePetIndex = Array.FindIndex(petStable.ActivePets, pet => pet?.PetNumber == petInfo.PetNumber); Cypher.Assert(activePetIndex != -1); diff --git a/Source/Game/Movement/Generators/PointMovement.cs b/Source/Game/Movement/Generators/PointMovement.cs index ccf44cf3c..3cb345e26 100644 --- a/Source/Game/Movement/Generators/PointMovement.cs +++ b/Source/Game/Movement/Generators/PointMovement.cs @@ -60,25 +60,29 @@ namespace Game.Movement owner.AddUnitState(UnitState.RoamingMove); MoveSplineInit init = new(owner); - if (_generatePath) + + new Action(() => { - PathGenerator path = new(owner); - bool result = path.CalculatePath(_destination.posX, _destination.posY, _destination.posZ, false); - if (result && !path.GetPathType().HasFlag(PathType.NoPath)) + if (_generatePath) { - if (_closeEnoughDistance.HasValue) - path.ShortenPathUntilDist(_destination, _closeEnoughDistance.Value); + PathGenerator path = new(owner); + bool result = path.CalculatePath(_destination.posX, _destination.posY, _destination.posZ, false); + if (result && !path.GetPathType().HasFlag(PathType.NoPath)) + { + if (_closeEnoughDistance.HasValue) + path.ShortenPathUntilDist(_destination, _closeEnoughDistance.Value); - init.MovebyPath(path.GetPath()); - return; + init.MovebyPath(path.GetPath()); + return; + } } - } - Position dest = _destination; - if (_closeEnoughDistance.HasValue) - owner.MovePosition(dest, Math.Min(_closeEnoughDistance.Value, dest.GetExactDist(owner)), MathF.PI + owner.GetRelativeAngle(dest)); + Position dest = _destination; + if (_closeEnoughDistance.HasValue) + owner.MovePosition(dest, Math.Min(_closeEnoughDistance.Value, dest.GetExactDist(owner)), MathF.PI + owner.GetRelativeAngle(dest)); - init.MoveTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), false); + init.MoveTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), false); + })(); if (_speed.HasValue) init.SetVelocity(_speed.Value); diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index a94d97b22..3ffdfb116 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -98,9 +98,6 @@ namespace Game.Spells for (var i = 0; i < SpellConst.MaxEffects; ++i) m_destTargets[i] = new SpellDestination(m_caster); - - m_targets = new SpellCastTargets(); - m_appliedMods = new List(); } public virtual void Dispose() @@ -7964,11 +7961,11 @@ namespace Game.Spells public SpellMisc m_misc; public object m_customArg; public SpellCastVisual m_SpellVisual; - public SpellCastTargets m_targets; + public SpellCastTargets m_targets = new(); public sbyte m_comboPointGain; public SpellCustomErrors m_customError; - public List m_appliedMods; + public List m_appliedMods = new(); WorldObject m_caster; public SpellValue m_spellValue;