40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using System;
|
|
using System.Numerics;
|
|
using Dalamud.Plugin.Services;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.Controller.Steps.Shared;
|
|
|
|
internal sealed class ExtraConditionUtils
|
|
{
|
|
private readonly IClientState _clientState;
|
|
|
|
public ExtraConditionUtils(IClientState clientState)
|
|
{
|
|
_clientState = clientState;
|
|
}
|
|
|
|
public bool MatchesExtraCondition(EExtraSkipCondition skipCondition)
|
|
{
|
|
Vector3? vector = _clientState.LocalPlayer?.Position;
|
|
if (vector.HasValue && _clientState.TerritoryType != 0)
|
|
{
|
|
return MatchesExtraCondition(skipCondition, vector.Value, _clientState.TerritoryType);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static bool MatchesExtraCondition(EExtraSkipCondition skipCondition, Vector3 position, ushort territoryType)
|
|
{
|
|
return skipCondition switch
|
|
{
|
|
EExtraSkipCondition.WakingSandsMainArea => territoryType == 212 && position.X < 24f,
|
|
EExtraSkipCondition.WakingSandsSolar => territoryType == 212 && position.X >= 24f,
|
|
EExtraSkipCondition.RisingStonesSolar => territoryType == 351 && position.Z <= -28f,
|
|
EExtraSkipCondition.RoguesGuild => territoryType == 129 && position.Y <= -115f,
|
|
EExtraSkipCondition.NotRoguesGuild => territoryType == 129 && position.Y > -115f,
|
|
EExtraSkipCondition.DockStorehouse => territoryType == 137 && position.Y <= -20f,
|
|
_ => throw new ArgumentOutOfRangeException("skipCondition", skipCondition, null),
|
|
};
|
|
}
|
|
}
|