fix: handle anchors

This commit is contained in:
Anna 2024-06-17 14:40:28 -04:00
parent 9af9083011
commit 679b07c4bb
Signed by: anna
GPG Key ID: D0943384CD9F87D1
3 changed files with 25 additions and 6 deletions

View File

@ -11,8 +11,7 @@ public interface IWhen {
bool IsValid(Plugin plugin); bool IsValid(Plugin plugin);
} }
public class WhenNodeDeserialiser : INodeDeserializer public class WhenNodeDeserialiser : INodeDeserializer {
{
public bool Deserialize(IParser reader, Type expectedType, Func<IParser, Type, object?> nestedObjectDeserializer, out object? value) { public bool Deserialize(IParser reader, Type expectedType, Func<IParser, Type, object?> nestedObjectDeserializer, out object? value) {
if (expectedType != typeof(IWhen)) { if (expectedType != typeof(IWhen)) {
value = null; value = null;

View File

@ -25,9 +25,10 @@ public class Plugin : IDalamudPlugin {
private Dictionary<(string, bool), nint> ReplacementPointers { get; } = []; private Dictionary<(string, bool), nint> ReplacementPointers { get; } = [];
private SemaphoreSlim Mutex { get; } = new(1, 1); private SemaphoreSlim Mutex { get; } = new(1, 1);
internal static IDeserializer Deserializer { get; } = new DeserializerBuilder() private static IDeserializer Deserializer { get; } = new DeserializerBuilder()
.WithNamingConvention(UnderscoredNamingConvention.Instance) .WithNamingConvention(UnderscoredNamingConvention.Instance)
.WithNodeDeserializer(new WhenNodeDeserialiser()) .WithNodeDeserializer(new WhenNodeDeserialiser())
.IgnoreUnmatchedProperties()
.Build(); .Build();
private static class Signatures { private static class Signatures {
@ -149,5 +150,11 @@ public class Plugin : IDalamudPlugin {
[Serializable] [Serializable]
internal class DataFile { internal class DataFile {
public Definitions Definitions { get; init; }
public Replacement[] Replacements { get; init; } public Replacement[] Replacements { get; init; }
} }
[Serializable]
public class Definitions {
public Dictionary<string, uint> Quests { get; init; }
}

View File

@ -1,10 +1,23 @@
definitions:
quests:
patch2.0: &patch2.0 70058
replacements: replacements:
# Original: Just what we need. Another outsider. # Original: Just what we need. Another outsider.
- id: 22 - id: 22
when: when:
- quest: - quest:
id: 70058 # final msq for A Realm Reborn id: *patch2.0 # final msq for A Realm Reborn
status: complete status: complete
text: |- text: |-
It's been The water here
quiet lately. is so peaceful.
# Original: Start any trouble, and I'll see you rot in the oubliettes for eternity.
- id: 291
when:
- quest:
id: *patch2.0
status: complete
text: |-
My eyes are peeled
for trouble.