Add new skip conditions for NIN quests
authorLiza Carvelli <liza@carvel.li>
Sat, 19 Oct 2024 08:31:27 +0000 (10:31 +0200)
committerLiza Carvelli <liza@carvel.li>
Sat, 19 Oct 2024 08:31:27 +0000 (10:31 +0200)
QuestPaths/quest-v1.json
Questionable.Model/Questing/Converter/SkipConditionConverter.cs
Questionable.Model/Questing/EExtraSkipCondition.cs
Questionable/Controller/Steps/Shared/SkipCondition.cs

index 3751b47d09aaf7b846e2fcc6ba74c7ba11743f18..4551e444e92b81618bc59da199d52b920dd8a6ac 100644 (file)
                   "type": "string",
                   "enum": [
                     "WakingSandsMainArea",
-                    "RisingStonesSolar"
+                    "RisingStonesSolar",
+                    "RoguesGuild",
+                    "DockStorehouse"
                   ]
                 }
               },
index 4088446e746a70046a790bb9312c7c7d6a5bbb51..3de919b9f8cbc4b68faa4f1b7cef1ef931745af7 100644 (file)
@@ -9,5 +9,7 @@ public sealed class SkipConditionConverter() : EnumConverter<EExtraSkipCondition
     {
         { EExtraSkipCondition.WakingSandsMainArea, "WakingSandsMainArea" },
         { EExtraSkipCondition.RisingStonesSolar, "RisingStonesSolar"},
+        { EExtraSkipCondition.RoguesGuild, "RoguesGuild"},
+        { EExtraSkipCondition.DockStorehouse, "DockStorehouse"},
     };
 }
index ddf29e9c2aa4913bbff498c24ef23e9e5c7694cc..d9d7b0bee0b052574d1ccd6162302994f516bf76 100644 (file)
@@ -8,6 +8,15 @@ public enum EExtraSkipCondition
 {
     None,
     WakingSandsMainArea,
-
     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,
 }
index c95ee8eabfe0197b88bcf392a2a36e68301cc9e7..c1efdbded78410387a04e941562fed593ddf3ad2 100644 (file)
@@ -1,4 +1,5 @@
-using System.Linq;
+using System;
+using System.Linq;
 using System.Numerics;
 using Dalamud.Game.ClientState.Objects.Types;
 using Dalamud.Plugin.Services;
@@ -225,24 +226,14 @@ internal static class SkipCondition
                 }
             }
 
-            if (skipConditions.ExtraCondition == EExtraSkipCondition.WakingSandsMainArea &&
-                clientState.TerritoryType == 212)
+            if (skipConditions.ExtraCondition != null && skipConditions.ExtraCondition != EExtraSkipCondition.None)
             {
-                var position = clientState.LocalPlayer!.Position;
-                if (position.X < 24)
+                var position = clientState.LocalPlayer?.Position;
+                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");
-                    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");
+                    logger.LogInformation("Skipping step, extra condition {} matches", skipConditions.ExtraCondition);
                     return true;
                 }
             }
@@ -262,6 +253,18 @@ internal static class SkipCondition
             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;
     }
 }