1
0
forked from liza/Questionable

Add new skip conditions for NIN quests

This commit is contained in:
Liza 2024-10-19 10:31:27 +02:00
parent 15999c8c79
commit 3dd5c07a1a
Signed by: liza
GPG Key ID: 7199F8D727D55F67
4 changed files with 35 additions and 19 deletions

View File

@ -286,7 +286,9 @@
"type": "string", "type": "string",
"enum": [ "enum": [
"WakingSandsMainArea", "WakingSandsMainArea",
"RisingStonesSolar" "RisingStonesSolar",
"RoguesGuild",
"DockStorehouse"
] ]
} }
}, },

View File

@ -9,5 +9,7 @@ public sealed class SkipConditionConverter() : EnumConverter<EExtraSkipCondition
{ {
{ EExtraSkipCondition.WakingSandsMainArea, "WakingSandsMainArea" }, { EExtraSkipCondition.WakingSandsMainArea, "WakingSandsMainArea" },
{ EExtraSkipCondition.RisingStonesSolar, "RisingStonesSolar"}, { EExtraSkipCondition.RisingStonesSolar, "RisingStonesSolar"},
{ EExtraSkipCondition.RoguesGuild, "RoguesGuild"},
{ EExtraSkipCondition.DockStorehouse, "DockStorehouse"},
}; };
} }

View File

@ -8,6 +8,15 @@ public enum EExtraSkipCondition
{ {
None, None,
WakingSandsMainArea, WakingSandsMainArea,
RisingStonesSolar, RisingStonesSolar,
/// <summary>
/// Location for ROG quests in Limsa Lominsa; located far underneath the actual lower decks.
/// </summary>
RoguesGuild,
/// <summary>
/// Location for NIN quests in Eastern La Noscea; located far underneath the actual zone.
/// </summary>
DockStorehouse,
} }

View File

@ -1,4 +1,5 @@
using System.Linq; using System;
using System.Linq;
using System.Numerics; using System.Numerics;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
@ -225,24 +226,14 @@ internal static class SkipCondition
} }
} }
if (skipConditions.ExtraCondition == EExtraSkipCondition.WakingSandsMainArea && if (skipConditions.ExtraCondition != null && skipConditions.ExtraCondition != EExtraSkipCondition.None)
clientState.TerritoryType == 212)
{ {
var position = clientState.LocalPlayer!.Position; var position = clientState.LocalPlayer?.Position;
if (position.X < 24) if (position != null &&
clientState.TerritoryType != 0 &&
MatchesExtraCondition(skipConditions.ExtraCondition.Value, position.Value, clientState.TerritoryType))
{ {
logger.LogInformation("Skipping step, as we're not in the Solar"); logger.LogInformation("Skipping step, extra condition {} matches", skipConditions.ExtraCondition);
return true;
}
}
if (skipConditions.ExtraCondition == EExtraSkipCondition.RisingStonesSolar &&
clientState.TerritoryType == 351)
{
var position = clientState.LocalPlayer!.Position;
if (position.Z <= -28)
{
logger.LogInformation("Skipping step, as we're in the Rising Stones Solar");
return true; return true;
} }
} }
@ -262,6 +253,18 @@ internal static class SkipCondition
return false; return false;
} }
private static bool MatchesExtraCondition(EExtraSkipCondition condition, Vector3 position, ushort territoryType)
{
return condition switch
{
EExtraSkipCondition.WakingSandsMainArea => territoryType == 212 && position.X < 24,
EExtraSkipCondition.RisingStonesSolar => territoryType == 351 && position.Z <= -28,
EExtraSkipCondition.RoguesGuild => territoryType == 129 && position.Y <= -115,
EExtraSkipCondition.DockStorehouse => territoryType == 137 && position.Y <= -20,
_ => throw new ArgumentOutOfRangeException(nameof(condition), condition, null)
};
}
public override ETaskResult Update() => ETaskResult.SkipRemainingTasksForStep; public override ETaskResult Update() => ETaskResult.SkipRemainingTasksForStep;
} }
} }