Fix exception when changing zones
This commit is contained in:
parent
fbb9df392c
commit
66689fee59
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0-windows</TargetFramework>
|
<TargetFramework>net7.0-windows</TargetFramework>
|
||||||
<Version>2.8</Version>
|
<Version>2.9</Version>
|
||||||
<LangVersion>11.0</LangVersion>
|
<LangVersion>11.0</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -51,25 +51,17 @@ partial class DeliverooPlugin
|
|||||||
|
|
||||||
private float GetDistanceToNpc(int npcId, out GameObject? o)
|
private float GetDistanceToNpc(int npcId, out GameObject? o)
|
||||||
{
|
{
|
||||||
try
|
foreach (var obj in _objectTable)
|
||||||
{
|
{
|
||||||
foreach (var obj in _objectTable)
|
if (obj.ObjectKind == ObjectKind.EventNpc && obj is Character c)
|
||||||
{
|
{
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
|
if (GetNpcId(obj) == npcId)
|
||||||
if (obj != null && obj.ObjectKind == ObjectKind.EventNpc && obj is Character c)
|
|
||||||
{
|
{
|
||||||
if (GetNpcId(obj) == npcId)
|
o = obj;
|
||||||
{
|
return Vector3.Distance(_clientState.LocalPlayer?.Position ?? Vector3.Zero, c.Position);
|
||||||
o = obj;
|
|
||||||
return Vector3.Distance(_clientState.LocalPlayer!.Position, c.Position);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
o = null;
|
o = null;
|
||||||
return float.MaxValue;
|
return float.MaxValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user