From 361a3ff5f8f1d96baf915dcbd8f5809df98ed07b Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Mon, 23 Sep 2024 02:00:32 +0200 Subject: [PATCH] Add conditions for skipping interacting with firmament npcs after 'Towards the Firmament' --- .../SkipConditionsExtensions.cs | 2 + .../3725_A Home in the Firmament.json | 88 +++++++++++++++++-- QuestPaths/quest-v1.json | 6 ++ .../Questing/SkipStepConditions.cs | 13 +-- .../Controller/Steps/Shared/SkipCondition.cs | 16 ++++ 5 files changed, 112 insertions(+), 13 deletions(-) diff --git a/QuestPathGenerator/RoslynElements/SkipConditionsExtensions.cs b/QuestPathGenerator/RoslynElements/SkipConditionsExtensions.cs index 02084db1..e904e0f7 100644 --- a/QuestPathGenerator/RoslynElements/SkipConditionsExtensions.cs +++ b/QuestPathGenerator/RoslynElements/SkipConditionsExtensions.cs @@ -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(), diff --git a/QuestPaths/3.x - Heavensward/Unlocks/Ishgard Restoration/3725_A Home in the Firmament.json b/QuestPaths/3.x - Heavensward/Unlocks/Ishgard Restoration/3725_A Home in the Firmament.json index d30e7457..1f31e641 100644 --- a/QuestPaths/3.x - Heavensward/Unlocks/Ishgard Restoration/3725_A Home in the Firmament.json +++ b/QuestPaths/3.x - Heavensward/Unlocks/Ishgard Restoration/3725_A Home in the Firmament.json @@ -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": { @@ -13,7 +29,14 @@ "Z": 146.34924 }, "TerritoryId": 886, - "InteractionType": "Interact" + "InteractionType": "Interact", + "SkipConditions": { + "StepIf": { + "NotNamePlateIconId": [ + 60091 + ] + } + } }, { "DataId": 1031677, @@ -23,7 +46,14 @@ "Z": 168.9325 }, "TerritoryId": 886, - "InteractionType": "Interact" + "InteractionType": "Interact", + "SkipConditions": { + "StepIf": { + "NotNamePlateIconId": [ + 60091 + ] + } + } }, { "DataId": 1031692, @@ -34,7 +64,14 @@ }, "StopDistance": 5, "TerritoryId": 886, - "InteractionType": "Interact" + "InteractionType": "Interact", + "SkipConditions": { + "StepIf": { + "NotNamePlateIconId": [ + 60091 + ] + } + } }, { "Position": { @@ -53,7 +90,14 @@ "Z": 138.47559 }, "TerritoryId": 886, - "InteractionType": "Interact" + "InteractionType": "Interact", + "SkipConditions": { + "StepIf": { + "NotNamePlateIconId": [ + 60091 + ] + } + } }, { "DataId": 1031693, @@ -63,7 +107,14 @@ "Z": 138.93335 }, "TerritoryId": 886, - "InteractionType": "Interact" + "InteractionType": "Interact", + "SkipConditions": { + "StepIf": { + "NotNamePlateIconId": [ + 60091 + ] + } + } }, { "DataId": 1031694, @@ -74,7 +125,14 @@ }, "StopDistance": 7, "TerritoryId": 886, - "InteractionType": "Interact" + "InteractionType": "Interact", + "SkipConditions": { + "StepIf": { + "NotNamePlateIconId": [ + 60091 + ] + } + } }, { "DataId": 1031695, @@ -84,7 +142,14 @@ "Z": 169.9397 }, "TerritoryId": 886, - "InteractionType": "Interact" + "InteractionType": "Interact", + "SkipConditions": { + "StepIf": { + "NotNamePlateIconId": [ + 60091 + ] + } + } }, { "DataId": 1031681, @@ -94,7 +159,14 @@ "Z": 146.34924 }, "TerritoryId": 886, - "InteractionType": "Interact" + "InteractionType": "Interact", + "SkipConditions": { + "StepIf": { + "NotNamePlateIconId": [ + 60091 + ] + } + } }, { "DataId": 1031992, diff --git a/QuestPaths/quest-v1.json b/QuestPaths/quest-v1.json index a29a43fa..9502f77a 100644 --- a/QuestPaths/quest-v1.json +++ b/QuestPaths/quest-v1.json @@ -256,6 +256,12 @@ ] } }, + "NotNamePlateIconId": { + "type": "array", + "items": { + "type": "integer" + } + }, "AetheryteLocked": { "$ref": "https://git.carvel.li/liza/Questionable/raw/branch/master/Questionable.Model/common-schema.json#/$defs/Aetheryte" }, diff --git a/Questionable.Model/Questing/SkipStepConditions.cs b/Questionable.Model/Questing/SkipStepConditions.cs index bfb8fcfc..25c1a46b 100644 --- a/Questionable.Model/Questing/SkipStepConditions.cs +++ b/Questionable.Model/Questing/SkipStepConditions.cs @@ -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 InTerritory { get; set; } = new(); - public List NotInTerritory { get; set; } = new(); + public List InTerritory { get; set; } = []; + public List NotInTerritory { get; set; } = []; public SkipItemConditions? Item { get; set; } [JsonConverter(typeof(ElementIdListConverter))] - public List QuestsAccepted { get; set; } = new(); + public List QuestsAccepted { get; set; } = []; [JsonConverter(typeof(ElementIdListConverter))] - public List QuestsCompleted { get; set; } = new(); + public List QuestsCompleted { get; set; } = []; + + public List 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}"; } } diff --git a/Questionable/Controller/Steps/Shared/SkipCondition.cs b/Questionable/Controller/Steps/Shared/SkipCondition.cs index eaf1d167..9690d474 100644 --- a/Questionable/Controller/Steps/Shared/SkipCondition.cs +++ b/Questionable/Controller/Steps/Shared/SkipCondition.cs @@ -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();