Skip to content

Commit

Permalink
Start on step events/conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Sep 14, 2024
1 parent 611e111 commit 3ead9d6
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
1 change: 0 additions & 1 deletion Winch/Data/POI/Dock/CustomDockPOI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Winch.Data.POI.Dock;

// TODO: actually implement this
public class CustomDockPOI : CustomPOI
{
/// <summary>
Expand Down
24 changes: 24 additions & 0 deletions Winch/Serialization/DredgeTypeHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -842,4 +842,28 @@ internal static List<CompletedGridCondition> ParseCompletedGridConditions(JArray
}
return parsed;
}

//TODO: implement
internal static QuestStepCondition ParseQuestStepCondition(JToken questStepCondition) => throw new NotImplementedException();
internal static List<QuestStepCondition> ParseQuestStepConditions(JArray o)
{
var parsed = new List<QuestStepCondition>();
foreach (var questStepCondition in o)
{
parsed.Add(ParseQuestStepCondition(questStepCondition));
}
return parsed;
}

//TODO: implement
internal static QuestStepEvent ParseQuestStepEvent(JToken questStepEvent) => throw new NotImplementedException();
internal static List<QuestStepEvent> ParseQuestStepEvents(JArray o)
{
var parsed = new List<QuestStepEvent>();
foreach (var questStepEvent in o)
{
parsed.Add(ParseQuestStepEvent(questStepEvent));
}
return parsed;
}
}
2 changes: 1 addition & 1 deletion Winch/Serialization/Quest/Grid/QuestGridConfigConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class QuestGridConfigConverter : DredgeTypeConverter<DeferredQuestGridCon
{ "createWithDurabilityValue", new(false, o=> bool.Parse(o.ToString())) },
{ "startingDurabilityProportion", new(0f, o=> float.Parse(o.ToString())) },
{ "gridConfiguration", new(string.Empty, null) },
{ "presetGrid", new(new SerializableGrid(), o => DredgeTypeHelpers.ParseSerializableGrid(o)) }, //TODO: implement better
{ "presetGrid", new(new SerializableGrid(), o => DredgeTypeHelpers.ParseSerializableGrid(o)) },
{ "presetGridMode", new(PresetGridMode.NONE, o => DredgeTypeHelpers.GetEnumValue<PresetGridMode>(o)) },
{ "completeConditions", new(new List<CompletedGridCondition>{ new FullCondition() }, o=> DredgeTypeHelpers.ParseCompletedGridConditions((JArray)o)) },
};
Expand Down
2 changes: 1 addition & 1 deletion Winch/Serialization/Quest/QuestDataConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class QuestDataConverter : DredgeTypeConverter<DeferredQuestData>
{ "steps", new(new List<string>(), o=>DredgeTypeHelpers.ParseStringList((JArray)o)) },
{ "subquests", new(new List<string>(), o=>DredgeTypeHelpers.ParseStringList((JArray)o)) },
{ "onOfferedQuestStep", new(string.Empty, null) },
{ "offerConditions", new(new List<QuestStepCondition>(), null) }, //TODO: implement
{ "offerConditions", new(new List<QuestStepCondition>(), o=>DredgeTypeHelpers.ParseQuestStepConditions((JArray)o)) },
{ "canBeOfferedAutomatically", new(false, o=> bool.Parse(o.ToString())) },
};

Expand Down
6 changes: 3 additions & 3 deletions Winch/Serialization/Quest/Step/QuestStepDataConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public class QuestStepDataConverter : DredgeTypeConverter<DeferredQuestStepData>
{ "showAtSpeaker", new(false, o=> bool.Parse(o.ToString())) },
{ "stepSpeaker", new(string.Empty, null) },
{ "yarnRootNode", new(string.Empty, null) },
{ "showConditions", new(new List<QuestStepCondition>(), null) }, //TODO: implement
{ "showConditions", new(new List<QuestStepCondition>(), o=>DredgeTypeHelpers.ParseQuestStepConditions((JArray)o)) },
{ "canBeFailed", new(false, o=> bool.Parse(o.ToString())) },
{ "failureEvents", new(new List<QuestStepEvent>(), null) }, //TODO: implement
{ "failureEvents", new(new List<QuestStepEvent>(), o=>DredgeTypeHelpers.ParseQuestStepEvents((JArray)o)) },
{ "allowAutomaticCompletion", new(false, o=> bool.Parse(o.ToString())) },
{ "conditionMode", new(ConditionMode.NULL, o => DredgeTypeHelpers.GetEnumValue<ConditionMode>(o)) },
{ "completeConditions", new(new List<QuestStepCondition>(), null) }, //TODO: implement
{ "completeConditions", new(new List<QuestStepCondition>(), o=>DredgeTypeHelpers.ParseQuestStepConditions((JArray)o)) },
};

public QuestStepDataConverter()
Expand Down

0 comments on commit 3ead9d6

Please sign in to comment.