forked from liza/Questionable
Update serialization of QuestStep
This commit is contained in:
parent
f1165a3937
commit
1bdf86e660
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -6,6 +7,7 @@ using System.Text.Encodings.Web;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Text.Json.Serialization.Metadata;
|
||||||
using Dalamud.Game.ClientState.Objects;
|
using Dalamud.Game.ClientState.Objects;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
@ -155,6 +157,10 @@ public sealed class RendererPlugin : IDalamudPlugin
|
|||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault,
|
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault,
|
||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
|
TypeInfoResolver = new DefaultJsonTypeInfoResolver
|
||||||
|
{
|
||||||
|
Modifiers = { NoEmptyCollectionModifier }
|
||||||
|
},
|
||||||
};
|
};
|
||||||
using (var stream = File.Create(targetFile.FullName))
|
using (var stream = File.Create(targetFile.FullName))
|
||||||
{
|
{
|
||||||
@ -176,6 +182,17 @@ public sealed class RendererPlugin : IDalamudPlugin
|
|||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void NoEmptyCollectionModifier(JsonTypeInfo typeInfo)
|
||||||
|
{
|
||||||
|
foreach (var property in typeInfo.Properties)
|
||||||
|
{
|
||||||
|
if (typeof(ICollection).IsAssignableFrom(property.PropertyType))
|
||||||
|
{
|
||||||
|
property.ShouldSerialize = (_, val) => val is ICollection { Count: > 0 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void TerritoryChanged(ushort territoryId) => Redraw();
|
private void TerritoryChanged(ushort territoryId) => Redraw();
|
||||||
|
|
||||||
private void ClassJobChanged(uint classJobId)
|
private void ClassJobChanged(uint classJobId)
|
||||||
@ -234,7 +251,8 @@ public sealed class RendererPlugin : IDalamudPlugin
|
|||||||
refZ = x.Position.Y,
|
refZ = x.Position.Y,
|
||||||
Filled = true,
|
Filled = true,
|
||||||
radius = locationOverride?.MinimumDistance ?? x.CalculateMinimumDistance(),
|
radius = locationOverride?.MinimumDistance ?? x.CalculateMinimumDistance(),
|
||||||
Donut = (locationOverride?.MaximumDistance ?? x.CalculateMaximumDistance()) - (locationOverride?.MinimumDistance ?? x.CalculateMinimumDistance()),
|
Donut = (locationOverride?.MaximumDistance ?? x.CalculateMaximumDistance()) -
|
||||||
|
(locationOverride?.MinimumDistance ?? x.CalculateMinimumDistance()),
|
||||||
color = _colors[location.Root.Groups.IndexOf(group) % _colors.Count],
|
color = _colors[location.Root.Groups.IndexOf(group) % _colors.Count],
|
||||||
Enabled = true,
|
Enabled = true,
|
||||||
coneAngleMin = minimumAngle,
|
coneAngleMin = minimumAngle,
|
||||||
|
@ -9,7 +9,14 @@
|
|||||||
"AethernetShortcut": [
|
"AethernetShortcut": [
|
||||||
"[Idyllshire] Aetheryte Plaza",
|
"[Idyllshire] Aetheryte Plaza",
|
||||||
"[Idyllshire] Epilogue Gate (Eastern Hinterlands)"
|
"[Idyllshire] Epilogue Gate (Eastern Hinterlands)"
|
||||||
]
|
],
|
||||||
|
"SkipConditions": {
|
||||||
|
"AetheryteShortcutIf": {
|
||||||
|
"InTerritory": [
|
||||||
|
399
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Groups": [
|
"Groups": [
|
||||||
|
@ -9,7 +9,14 @@
|
|||||||
"AethernetShortcut": [
|
"AethernetShortcut": [
|
||||||
"[Idyllshire] Aetheryte Plaza",
|
"[Idyllshire] Aetheryte Plaza",
|
||||||
"[Idyllshire] Prologue Gate (Western Hinterlands)"
|
"[Idyllshire] Prologue Gate (Western Hinterlands)"
|
||||||
]
|
],
|
||||||
|
"SkipConditions": {
|
||||||
|
"AetheryteShortcutIf": {
|
||||||
|
"InTerritory": [
|
||||||
|
399
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Groups": [
|
"Groups": [
|
||||||
|
@ -0,0 +1,119 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://git.carvel.li/liza/Questionable/raw/branch/master/GatheringPaths/gatheringlocation-v1.json",
|
||||||
|
"Author": "liza",
|
||||||
|
"Steps": [
|
||||||
|
{
|
||||||
|
"TerritoryId": 399,
|
||||||
|
"InteractionType": "None",
|
||||||
|
"AetheryteShortcut": "Idyllshire",
|
||||||
|
"AethernetShortcut": [
|
||||||
|
"[Idyllshire] Aetheryte Plaza",
|
||||||
|
"[Idyllshire] Prologue Gate (Western Hinterlands)"
|
||||||
|
],
|
||||||
|
"SkipConditions": {
|
||||||
|
"AetheryteShortcutIf": {
|
||||||
|
"InTerritory": [
|
||||||
|
399
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Groups": [
|
||||||
|
{
|
||||||
|
"Nodes": [
|
||||||
|
{
|
||||||
|
"DataId": 33285,
|
||||||
|
"Locations": [
|
||||||
|
{
|
||||||
|
"Position": {
|
||||||
|
"X": -426.4134,
|
||||||
|
"Y": 137.5601,
|
||||||
|
"Z": 514.3357
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"DataId": 33286,
|
||||||
|
"Locations": [
|
||||||
|
{
|
||||||
|
"Position": {
|
||||||
|
"X": -448.7838,
|
||||||
|
"Y": 137.5986,
|
||||||
|
"Z": 514.3243
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Position": {
|
||||||
|
"X": -433.5015,
|
||||||
|
"Y": 137.6451,
|
||||||
|
"Z": 487.8173
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Nodes": [
|
||||||
|
{
|
||||||
|
"DataId": 33288,
|
||||||
|
"Locations": [
|
||||||
|
{
|
||||||
|
"Position": {
|
||||||
|
"X": -354.5423,
|
||||||
|
"Y": 137.5715,
|
||||||
|
"Z": 638.9959
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"DataId": 33287,
|
||||||
|
"Locations": [
|
||||||
|
{
|
||||||
|
"Position": {
|
||||||
|
"X": -352.4377,
|
||||||
|
"Y": 137.5906,
|
||||||
|
"Z": 604.364
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Nodes": [
|
||||||
|
{
|
||||||
|
"DataId": 33284,
|
||||||
|
"Locations": [
|
||||||
|
{
|
||||||
|
"Position": {
|
||||||
|
"X": -254.4776,
|
||||||
|
"Y": 137.97,
|
||||||
|
"Z": 591.0092
|
||||||
|
},
|
||||||
|
"MinimumAngle": -20,
|
||||||
|
"MaximumAngle": 85
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"DataId": 33283,
|
||||||
|
"Locations": [
|
||||||
|
{
|
||||||
|
"Position": {
|
||||||
|
"X": -263.1079,
|
||||||
|
"Y": 137.4419,
|
||||||
|
"Z": 569.8724
|
||||||
|
},
|
||||||
|
"MinimumAngle": -10,
|
||||||
|
"MaximumAngle": 190
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Questionable.Model.Common;
|
using Questionable.Model.Common;
|
||||||
@ -7,20 +8,23 @@ using Questionable.Model.Questing.Converter;
|
|||||||
|
|
||||||
namespace Questionable.Model.Questing;
|
namespace Questionable.Model.Questing;
|
||||||
|
|
||||||
|
[SuppressMessage("ReSharper", "CollectionNeverUpdated.Global")]
|
||||||
public sealed class QuestStep
|
public sealed class QuestStep
|
||||||
{
|
{
|
||||||
public const float DefaultStopDistance = 3f;
|
public const float DefaultStopDistance = 3f;
|
||||||
|
|
||||||
public EInteractionType InteractionType { get; set; }
|
|
||||||
|
|
||||||
public uint? DataId { get; set; }
|
public uint? DataId { get; set; }
|
||||||
|
|
||||||
[JsonConverter(typeof(VectorConverter))]
|
[JsonConverter(typeof(VectorConverter))]
|
||||||
public Vector3? Position { get; set; }
|
public Vector3? Position { get; set; }
|
||||||
|
|
||||||
public float? StopDistance { get; set; }
|
public float? StopDistance { get; set; }
|
||||||
public float? NpcWaitDistance { get; set; }
|
|
||||||
public ushort TerritoryId { get; set; }
|
public ushort TerritoryId { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||||
|
public EInteractionType InteractionType { get; set; }
|
||||||
|
|
||||||
|
public float? NpcWaitDistance { get; set; }
|
||||||
public ushort? TargetTerritoryId { get; set; }
|
public ushort? TargetTerritoryId { get; set; }
|
||||||
public float? DelaySecondsAtStart { get; set; }
|
public float? DelaySecondsAtStart { get; set; }
|
||||||
|
|
||||||
@ -57,8 +61,8 @@ public sealed class QuestStep
|
|||||||
public EAction? Action { get; set; }
|
public EAction? Action { get; set; }
|
||||||
|
|
||||||
public EEnemySpawnType? EnemySpawnType { get; set; }
|
public EEnemySpawnType? EnemySpawnType { get; set; }
|
||||||
public IList<uint> KillEnemyDataIds { get; set; } = new List<uint>();
|
public List<uint> KillEnemyDataIds { get; set; } = [];
|
||||||
public IList<ComplexCombatData> ComplexCombatData { get; set; } = new List<ComplexCombatData>();
|
public List<ComplexCombatData> ComplexCombatData { get; set; } = [];
|
||||||
public float? CombatDelaySecondsAtStart { get; set; }
|
public float? CombatDelaySecondsAtStart { get; set; }
|
||||||
|
|
||||||
public JumpDestination? JumpDestination { get; set; }
|
public JumpDestination? JumpDestination { get; set; }
|
||||||
@ -67,9 +71,9 @@ public sealed class QuestStep
|
|||||||
|
|
||||||
public List<List<QuestWorkValue>?> RequiredQuestVariables { get; set; } = new();
|
public List<List<QuestWorkValue>?> RequiredQuestVariables { get; set; } = new();
|
||||||
public List<GatheredItem> RequiredGatheredItems { get; set; } = [];
|
public List<GatheredItem> RequiredGatheredItems { get; set; } = [];
|
||||||
public IList<QuestWorkValue?> CompletionQuestVariablesFlags { get; set; } = new List<QuestWorkValue?>();
|
public List<QuestWorkValue?> CompletionQuestVariablesFlags { get; set; } = [];
|
||||||
public IList<DialogueChoice> DialogueChoices { get; set; } = new List<DialogueChoice>();
|
public List<DialogueChoice> DialogueChoices { get; set; } = [];
|
||||||
public IList<uint> PointMenuChoices { get; set; } = new List<uint>();
|
public List<uint> PointMenuChoices { get; set; } = [];
|
||||||
|
|
||||||
// TODO: Not implemented
|
// TODO: Not implemented
|
||||||
[JsonConverter(typeof(ElementIdConverter))]
|
[JsonConverter(typeof(ElementIdConverter))]
|
||||||
|
@ -773,7 +773,6 @@ internal sealed class QuestController : MiniTaskController<QuestController>, IDi
|
|||||||
if (toastAware.OnErrorToast(message))
|
if (toastAware.OnErrorToast(message))
|
||||||
{
|
{
|
||||||
isHandled = true;
|
isHandled = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,13 +278,13 @@ internal sealed unsafe class QuestFunctions
|
|||||||
if (!_questRegistry.TryGetQuest(x, out Quest? quest))
|
if (!_questRegistry.TryGetQuest(x, out Quest? quest))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return quest.AllSteps().All(x =>
|
return quest.AllSteps().All(y =>
|
||||||
{
|
{
|
||||||
if (x.Step.AetheryteShortcut is { } aetheryteShortcut &&
|
if (y.Step.AetheryteShortcut is { } aetheryteShortcut &&
|
||||||
_aetheryteFunctions.IsAetheryteUnlocked(aetheryteShortcut))
|
_aetheryteFunctions.IsAetheryteUnlocked(aetheryteShortcut))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (x.Step.AethernetShortcut is { } aethernetShortcut &&
|
if (y.Step.AethernetShortcut is { } aethernetShortcut &&
|
||||||
(!_aetheryteFunctions.IsAetheryteUnlocked(aethernetShortcut.From) ||
|
(!_aetheryteFunctions.IsAetheryteUnlocked(aethernetShortcut.From) ||
|
||||||
!_aetheryteFunctions.IsAetheryteUnlocked(aethernetShortcut.To)))
|
!_aetheryteFunctions.IsAetheryteUnlocked(aethernetShortcut.To)))
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user