qstbak/Questionable/Questionable.Controller.Steps.Shared/ExtraConditionUtils.cs
2025-11-30 10:36:46 +10:00

43 lines
1.5 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;
private readonly IObjectTable _objectTable;
public ExtraConditionUtils(IClientState clientState, IObjectTable objectTable)
{
_clientState = clientState;
_objectTable = objectTable;
}
public bool MatchesExtraCondition(EExtraSkipCondition skipCondition)
{
Vector3? vector = _objectTable[0]?.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),
};
}
}