Add conditions for skipping interacting with firmament npcs after 'Towards the Firmament'

This commit is contained in:
Liza 2024-09-23 02:00:32 +02:00
parent 0ac2e36afd
commit 361a3ff5f8
Signed by: liza
GPG Key ID: 7199F8D727D55F67
5 changed files with 112 additions and 13 deletions

View 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(),

View 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": {
@ -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,

View File

@ -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"
},

View 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}";
}
}

View 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();