158 lines
8.6 KiB
C#
158 lines
8.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
using Dalamud.Plugin.Services;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Questionable.Controller.NavigationOverrides;
|
|
|
|
internal sealed class MovementOverrideController
|
|
{
|
|
private static readonly List<IBlacklistedLocation> BlacklistedLocations;
|
|
|
|
private readonly IClientState _clientState;
|
|
|
|
private readonly ILogger<MovementOverrideController> _logger;
|
|
|
|
public MovementOverrideController(IClientState clientState, ILogger<MovementOverrideController> logger)
|
|
{
|
|
_clientState = clientState;
|
|
_logger = logger;
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
public (List<Vector3>, bool) AdjustPath(List<Vector3> navPoints)
|
|
{
|
|
using (List<IBlacklistedLocation>.Enumerator enumerator = BlacklistedLocations.GetEnumerator())
|
|
{
|
|
int num = -1572847159;
|
|
AlternateLocation alternateLocation = default(AlternateLocation);
|
|
IBlacklistedLocation current = default(IBlacklistedLocation);
|
|
int num7 = default(int);
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -1572847156;
|
|
int num4 = num2;
|
|
int num5 = num4 + num3;
|
|
int num6 = num4 & num3;
|
|
switch (num5 - (num6 + num6))
|
|
{
|
|
case 6:
|
|
alternateLocation = current.AdjustPoint(navPoints[num7]);
|
|
num = ((!(alternateLocation != null)) ? (-1572847155) : (-1572847163));
|
|
break;
|
|
case 5:
|
|
num = (enumerator.MoveNext() ? (-1572847154) : (-1572847160));
|
|
break;
|
|
case 0:
|
|
num = -1572847159;
|
|
break;
|
|
case 8:
|
|
num7 = 0;
|
|
num = -1572847153;
|
|
break;
|
|
case 2:
|
|
current = enumerator.Current;
|
|
num = ((_206E_206C_202E_202C_206B_200E_206A_206D_200F_202E_202B_202C_200B_202D_202B_202C_206E_202C_206E_200B_202E_206E_206C_202E_206D_202E_202E_206B_202E_202A_200C_202A_206F_200D_206A_202D_206D_202E_206A_202D_202E(_clientState) != current.TerritoryId) ? (-1572847159) : (-1572847164));
|
|
break;
|
|
case 3:
|
|
num = ((num7 < navPoints.Count) ? (-1572847158) : (-1572847159));
|
|
break;
|
|
case 7:
|
|
{
|
|
int num11 = num7;
|
|
num3 = 1;
|
|
num4 = num11;
|
|
return (navPoints.Take((num4 | num3) + (num4 & num3)).ToList(), true);
|
|
}
|
|
case 1:
|
|
{
|
|
int num8 = num7;
|
|
num3 = 1;
|
|
num4 = num8;
|
|
int num9 = num4 ^ num3;
|
|
int num10 = num4 & num3;
|
|
num7 = num9 + (num10 + num10);
|
|
num = -1572847153;
|
|
break;
|
|
}
|
|
case 9:
|
|
_200E_202B_200B_200F_206D_202C_202E_200D_200C_200C_202B_202D_200F_202B_206A_200E_202A_206C_200B_202D_202A_200D_206F_200E_200D_200F_200E_202E_202D_200D_200F_200D_202E_202E_202A_202A_206B_202E_206A_200F_202E((ILogger)_logger, global::_003CModule_003E._202D_206D_206A_206E_202C_202B_200C_206C_200E_206A_206D_200E_206A_202A_200C_202E_206E_202C_206F_200B_206D_206F_200C_202C_200B_202B_200F_200B_206A_206F_200F_202E_206B_200E_202B_202A_200F_200B_202A_200E_202E<string>(1083711634), new object[2]
|
|
{
|
|
navPoints[num7].ToString(global::_003CModule_003E._206C_202A_206D_206A_206E_202A_202B_206F_206D_200F_202D_200F_202D_206A_202C_202B_206D_206A_200E_200E_202D_202D_200D_200C_200D_200D_206D_206E_202A_200F_206E_206C_206D_206A_206D_202B_200F_200D_206E_200C_202E<string>(2120763774), _202E_206B_200B_206E_202B_206F_202D_206B_202C_202C_202A_200F_206E_206B_202A_200C_200E_202E_200C_206A_202B_202C_200D_200E_202A_202B_202E_200E_200B_200C_202C_206C_206B_202A_202C_200D_206F_202D_206F_206E_202E()),
|
|
alternateLocation
|
|
});
|
|
navPoints[num7] = alternateLocation.Point;
|
|
num = ((!alternateLocation.RecalculateNavmesh) ? (-1572847155) : (-1572847157));
|
|
break;
|
|
case 4:
|
|
goto end_IL_0017;
|
|
}
|
|
continue;
|
|
end_IL_0017:
|
|
break;
|
|
}
|
|
}
|
|
return (navPoints, false);
|
|
}
|
|
|
|
static MovementOverrideController()
|
|
{
|
|
int num = 31;
|
|
List<IBlacklistedLocation> list = new List<IBlacklistedLocation>(num);
|
|
CollectionsMarshal.SetCount(list, num);
|
|
Span<IBlacklistedLocation> span = CollectionsMarshal.AsSpan(list);
|
|
span[0] = new BlacklistedArea(1191, new Vector3(-223.0412f, 31.937134f, -584.03906f), 5f, 7.75f);
|
|
span[1] = new BlacklistedPoint(128, new Vector3(2f, 40.25f, 36.5f), new Vector3(0.25f, 40.25f, 36.5f));
|
|
span[2] = new BlacklistedPoint(132, new Vector3(29f, -8f, 120.5f), new Vector3(28.265165f, -8.000001f, 120.149734f));
|
|
span[3] = new BlacklistedPoint(132, new Vector3(28.25f, -8f, 125f), new Vector3(27.372725f, -8.200001f, 125.55859f));
|
|
span[4] = new BlacklistedPoint(132, new Vector3(32.25f, -8f, 126.5f), new Vector3(32.022232f, -8.200011f, 126.86095f));
|
|
span[5] = new BlacklistedPoint(205, new Vector3(26.75f, 0.5f, 20.75f), new Vector3(27.179117f, 0.26728272f, 19.714373f));
|
|
span[6] = new BlacklistedPoint(130, new Vector3(59.5f, 4.25f, -118f), new Vector3(60.551353f, 4f, -119.76446f));
|
|
span[7] = new BlacklistedPoint(145, new Vector3(-139.75f, -32.25f, 75.25f), new Vector3(-139.57748f, -33.785175f, 77.87906f));
|
|
span[8] = new BlacklistedPoint(146, new Vector3(-201.75f, 10.5f, -265.5f), new Vector3(-203.75235f, 10.130764f, -265.15314f));
|
|
span[9] = new BlacklistedArea(135, new Vector3(156.11499f, 15.518433f, 673.21277f), 0.5f, 5f);
|
|
span[10] = new BlacklistedPoint(139, new Vector3(366f, -2.5f, 95.5f), new Vector3(362.65973f, -3.4f, 96.6896f), 2f);
|
|
span[11] = new BlacklistedPoint(155, new Vector3(-478.75f, 149.25f, -305.75f), new Vector3(-476.1802f, 149.06573f, -304.7811f));
|
|
span[12] = new BlacklistedPoint(351, new Vector3(3.25f, 0.75f, 8.5f), new Vector3(4f, 0f, 9.5f));
|
|
span[13] = new BlacklistedPoint(418, new Vector3(-136.75f, 2.75f, 9f), new Vector3(-138.66408f, 2.0333426f, 8.860787f), 1f);
|
|
span[14] = new BlacklistedPoint(401, new Vector3(-14.75f, -136.75f, 515.75f), new Vector3(-17.631899f, -137.39148f, 512.6676f), 2f);
|
|
span[15] = new BlacklistedPoint(397, new Vector3(-93.75f, 87.75f, -715.5f), new Vector3(-87.78183f, 87.188995f, -713.3343f), 2f);
|
|
span[16] = new BlacklistedPoint(400, new Vector3(384f, -74f, 648.75f), new Vector3(386.0543f, -72.409454f, 652.0184f), 3f);
|
|
span[17] = new BlacklistedPoint(399, new Vector3(-514.4851f, 149.63762f, -480.58087f), new Vector3(-528.78656f, 151.17374f, -473.07077f), 5f, RecalculateNavmesh: true);
|
|
span[18] = new BlacklistedPoint(399, new Vector3(-534.5f, 153f, -476.75f), new Vector3(-528.78656f, 151.17374f, -473.07077f), 5f, RecalculateNavmesh: true);
|
|
span[19] = new BlacklistedPoint(478, new Vector3(14.5f, 215.25f, -101.5f), new Vector3(18.133032f, 215.44998f, -107.83075f), 5f);
|
|
span[20] = new BlacklistedPoint(478, new Vector3(11f, 215.5f, -104.5f), new Vector3(18.133032f, 215.44998f, -107.83075f), 5f);
|
|
span[21] = new BlacklistedPoint(1189, new Vector3(574f, -142.25f, 504.25f), new Vector3(574.44183f, -142.12766f, 507.60065f));
|
|
span[22] = new BlacklistedPoint(814, new Vector3(-324f, 348.75f, -181.75f), new Vector3(-322.75076f, 347.0529f, -177.69328f), 3f);
|
|
span[23] = new BlacklistedPoint(956, new Vector3(6.25f, -27.75f, -41.5f), new Vector3(5.0831127f, -28.213453f, -42.239136f));
|
|
span[24] = new BlacklistedPoint(1189, new Vector3(-115.75f, -213.75f, 336.5f), new Vector3(-112.40265f, -215.01514f, 339.0067f), 2f);
|
|
span[25] = new BlacklistedPoint(1190, new Vector3(-292.29004f, 18.598045f, -133.83907f), new Vector3(-288.20895f, 18.652182f, -132.67445f), 4f);
|
|
span[26] = new BlacklistedPoint(1191, new Vector3(-108f, 29.25f, -350.75f), new Vector3(-107.56289f, 29.008266f, -348.80087f));
|
|
span[27] = new BlacklistedPoint(1191, new Vector3(-105.75f, 29.75f, -351f), new Vector3(-105.335304f, 29.017048f, -348.85077f));
|
|
span[28] = new BlacklistedPoint(1186, new Vector3(284.25f, 50.75f, 171.25f), new Vector3(284.25f, 50.75f, 166.25f));
|
|
span[29] = new BlacklistedPoint(1186, new Vector3(283.75f, 50.75f, 167.25f), new Vector3(284.25f, 50.75f, 166.25f));
|
|
span[30] = new BlacklistedPoint(1186, new Vector3(287.75f, 51.25f, 172f), new Vector3(288.875f, 50.75f, 166.25f));
|
|
BlacklistedLocations = list;
|
|
}
|
|
|
|
static uint _206E_206C_202E_202C_206B_200E_206A_206D_200F_202E_202B_202C_200B_202D_202B_202C_206E_202C_206E_200B_202E_206E_206C_202E_206D_202E_202E_206B_202E_202A_200C_202A_206F_200D_206A_202D_206D_202E_206A_202D_202E(IClientState P_0)
|
|
{
|
|
return P_0.TerritoryType;
|
|
}
|
|
|
|
static CultureInfo _202E_206B_200B_206E_202B_206F_202D_206B_202C_202C_202A_200F_206E_206B_202A_200C_200E_202E_200C_206A_202B_202C_200D_200E_202A_202B_202E_200E_200B_200C_202C_206C_206B_202A_202C_200D_206F_202D_206F_206E_202E()
|
|
{
|
|
return CultureInfo.InvariantCulture;
|
|
}
|
|
|
|
static void _200E_202B_200B_200F_206D_202C_202E_200D_200C_200C_202B_202D_200F_202B_206A_200E_202A_206C_200B_202D_202A_200D_206F_200E_200D_200F_200E_202E_202D_200D_200F_200D_202E_202E_202A_202A_206B_202E_206A_200F_202E(ILogger P_0, string P_1, object[] P_2)
|
|
{
|
|
P_0.LogDebug(P_1, P_2);
|
|
}
|
|
}
|