Add conditions for skipping interacting with firmament npcs after 'Towards the Firmament'
authorLiza Carvelli <liza@carvel.li>
Mon, 23 Sep 2024 00:00:32 +0000 (02:00 +0200)
committerLiza Carvelli <liza@carvel.li>
Mon, 23 Sep 2024 00:00:32 +0000 (02:00 +0200)
QuestPathGenerator/RoslynElements/SkipConditionsExtensions.cs
QuestPaths/3.x - Heavensward/Unlocks/Ishgard Restoration/3725_A Home in the Firmament.json
QuestPaths/quest-v1.json
Questionable.Model/Questing/SkipStepConditions.cs
Questionable/Controller/Steps/Shared/SkipCondition.cs

index 02084db16dd7c0262c95c9582ba2d4fc6897d22c..e904e0f78bbf1582481a9a840619eddf06305d81 100644 (file)
@@ -65,6 +65,8 @@ internal static class SkipConditionsExtensions
                                 skipStepConditions.QuestsAccepted).AsSyntaxNodeOrToken(),
                             AssignmentList(nameof(SkipStepConditions.QuestsCompleted),
                                 skipStepConditions.QuestsCompleted).AsSyntaxNodeOrToken(),
+                            AssignmentList(nameof(SkipStepConditions.NotNamePlateIconId),
+                                skipStepConditions.NotNamePlateIconId).AsSyntaxNodeOrToken(),
                             Assignment(nameof(SkipStepConditions.AetheryteLocked),
                                     skipStepConditions.AetheryteLocked, emptyStep.AetheryteLocked)
                                 .AsSyntaxNodeOrToken(),
index d30e7457aed9fcea5f5016db59d1d6cf9f96995e..1f31e641c590878c5b1df8318443ba4d0f06b0e3 100644 (file)
@@ -5,6 +5,22 @@
     {
       "Sequence": 0,
       "Steps": [
+        {
+          "InteractionType": "None",
+          "TerritoryId": 886,
+          "AetheryteShortcut": "Ishgard",
+          "AethernetShortcut": [
+            "[Ishgard] Aetheryte Plaza",
+            "[Ishgard] Firmament"
+          ],
+          "SkipConditions": {
+            "AetheryteShortcutIf": {
+              "InTerritory": [
+                886
+              ]
+            }
+          }
+        },
         {
           "DataId": 1031681,
           "Position": {
             "Z": 146.34924
           },
           "TerritoryId": 886,
-          "InteractionType": "Interact"
+          "InteractionType": "Interact",
+          "SkipConditions": {
+            "StepIf": {
+              "NotNamePlateIconId": [
+                60091
+              ]
+            }
+          }
         },
         {
           "DataId": 1031677,
             "Z": 168.9325
           },
           "TerritoryId": 886,
-          "InteractionType": "Interact"
+          "InteractionType": "Interact",
+          "SkipConditions": {
+            "StepIf": {
+              "NotNamePlateIconId": [
+                60091
+              ]
+            }
+          }
         },
         {
           "DataId": 1031692,
           },
           "StopDistance": 5,
           "TerritoryId": 886,
-          "InteractionType": "Interact"
+          "InteractionType": "Interact",
+          "SkipConditions": {
+            "StepIf": {
+              "NotNamePlateIconId": [
+                60091
+              ]
+            }
+          }
         },
         {
           "Position": {
             "Z": 138.47559
           },
           "TerritoryId": 886,
-          "InteractionType": "Interact"
+          "InteractionType": "Interact",
+          "SkipConditions": {
+            "StepIf": {
+              "NotNamePlateIconId": [
+                60091
+              ]
+            }
+          }
         },
         {
           "DataId": 1031693,
             "Z": 138.93335
           },
           "TerritoryId": 886,
-          "InteractionType": "Interact"
+          "InteractionType": "Interact",
+          "SkipConditions": {
+            "StepIf": {
+              "NotNamePlateIconId": [
+                60091
+              ]
+            }
+          }
         },
         {
           "DataId": 1031694,
           },
           "StopDistance": 7,
           "TerritoryId": 886,
-          "InteractionType": "Interact"
+          "InteractionType": "Interact",
+          "SkipConditions": {
+            "StepIf": {
+              "NotNamePlateIconId": [
+                60091
+              ]
+            }
+          }
         },
         {
           "DataId": 1031695,
             "Z": 169.9397
           },
           "TerritoryId": 886,
-          "InteractionType": "Interact"
+          "InteractionType": "Interact",
+          "SkipConditions": {
+            "StepIf": {
+              "NotNamePlateIconId": [
+                60091
+              ]
+            }
+          }
         },
         {
           "DataId": 1031681,
             "Z": 146.34924
           },
           "TerritoryId": 886,
-          "InteractionType": "Interact"
+          "InteractionType": "Interact",
+          "SkipConditions": {
+            "StepIf": {
+              "NotNamePlateIconId": [
+                60091
+              ]
+            }
+          }
         },
         {
           "DataId": 1031992,
index a29a43fa226df7205d6bc881933373d92cf78db6..9502f77ae7df2116319aeb5d3bd6db193539ac9f 100644 (file)
                     ]
                   }
                 },
+                "NotNamePlateIconId": {
+                  "type": "array",
+                  "items": {
+                    "type": "integer"
+                  }
+                },
                 "AetheryteLocked": {
                   "$ref": "https://git.carvel.li/liza/Questionable/raw/branch/master/Questionable.Model/common-schema.json#/$defs/Aetheryte"
                 },
index bfb8fcfc71626ea5fc155b713be27839aa7d7c70..25c1a46b138ab9cd6f922b433d6dab92497e5bdb 100644 (file)
@@ -13,15 +13,17 @@ public sealed class SkipStepConditions
     public ELockedSkipCondition? Flying { get; set; }
     public ELockedSkipCondition? Chocobo { get; set; }
     public bool NotTargetable { get; set; }
-    public List<ushort> InTerritory { get; set; } = new();
-    public List<ushort> NotInTerritory { get; set; } = new();
+    public List<ushort> InTerritory { get; set; } = [];
+    public List<ushort> NotInTerritory { get; set; } = [];
     public SkipItemConditions? Item { get; set; }
 
     [JsonConverter(typeof(ElementIdListConverter))]
-    public List<ElementId> QuestsAccepted { get; set; } = new();
+    public List<ElementId> QuestsAccepted { get; set; } = [];
 
     [JsonConverter(typeof(ElementIdListConverter))]
-    public List<ElementId> QuestsCompleted { get; set; } = new();
+    public List<ElementId> QuestsCompleted { get; set; } = [];
+
+    public List<uint> NotNamePlateIconId { get; set; } = [];
 
     public EAetheryteLocation? AetheryteLocked { get; set; }
     public EAetheryteLocation? AetheryteUnlocked { get; set; }
@@ -41,6 +43,7 @@ public sealed class SkipStepConditions
                Item != null ||
                QuestsAccepted.Count > 0 ||
                QuestsCompleted.Count > 0 ||
+               NotNamePlateIconId.Count > 0 ||
                AetheryteLocked != null ||
                AetheryteUnlocked != null ||
                NearPosition != null ||
@@ -50,6 +53,6 @@ public sealed class SkipStepConditions
     public override string ToString()
     {
         return
-            $"{nameof(Never)}: {Never}, {nameof(CompletionQuestVariablesFlags)}: {CompletionQuestVariablesFlags}, {nameof(Flying)}: {Flying}, {nameof(Chocobo)}: {Chocobo}, {nameof(NotTargetable)}: {NotTargetable}, {nameof(InTerritory)}: {string.Join(" ", InTerritory)}, {nameof(NotInTerritory)}: {string.Join(" ", NotInTerritory)}, {nameof(Item)}: {Item}, {nameof(QuestsAccepted)}: {string.Join(" ", QuestsAccepted)}, {nameof(QuestsCompleted)}: {string.Join(" ", QuestsCompleted)}, {nameof(NearPosition)}: {NearPosition}, {nameof(ExtraCondition)}: {ExtraCondition}";
+            $"{nameof(Never)}: {Never}, {nameof(CompletionQuestVariablesFlags)}: {CompletionQuestVariablesFlags}, {nameof(Flying)}: {Flying}, {nameof(Chocobo)}: {Chocobo}, {nameof(NotTargetable)}: {NotTargetable}, {nameof(InTerritory)}: {string.Join(" ", InTerritory)}, {nameof(NotInTerritory)}: {string.Join(" ", NotInTerritory)}, {nameof(Item)}: {Item}, {nameof(QuestsAccepted)}: {string.Join(" ", QuestsAccepted)}, {nameof(QuestsCompleted)}: {string.Join(" ", QuestsCompleted)}, {nameof(NotNamePlateIconId)}: {string.Join(" ", NotNamePlateIconId)}, {nameof(NearPosition)}: {NearPosition}, {nameof(ExtraCondition)}: {ExtraCondition}";
     }
 }
index eaf1d167583180e09ec83053964c01e18959b836..9690d4740184963cd2f2b04f203257a5e2e5a018 100644 (file)
@@ -3,6 +3,7 @@ using System.Numerics;
 using Dalamud.Game.ClientState.Objects.Types;
 using Dalamud.Plugin.Services;
 using FFXIVClientStructs.FFXIV.Client.Game;
+using FFXIVClientStructs.FFXIV.Client.Game.Object;
 using FFXIVClientStructs.FFXIV.Client.Game.UI;
 using Microsoft.Extensions.Logging;
 using Questionable.Controller.Utils;
@@ -125,6 +126,21 @@ internal static class SkipCondition
                 }
             }
 
+            if (skipConditions.NotNamePlateIconId.Count > 0 &&
+                step is { DataId: not null })
+            {
+                IGameObject? target = gameFunctions.FindObjectByDataId(step.DataId.Value);
+                if (target != null)
+                {
+                    GameObject* gameObject = (GameObject*)target.Address;
+                    if (!skipConditions.NotNamePlateIconId.Contains(gameObject->NamePlateIconId))
+                    {
+                        logger.LogInformation("Skipping step, object has icon id {IconId}", gameObject->NamePlateIconId);
+                        return true;
+                    }
+                }
+            }
+
             if (skipConditions.Item is { NotInInventory: true } && step is { ItemId: not null })
             {
                 InventoryManager* inventoryManager = InventoryManager.Instance();