diff --git a/QuestPathGenerator/QuestSourceGenerator.cs b/QuestPathGenerator/QuestSourceGenerator.cs index 5ba7b3639..5eb62a883 100644 --- a/QuestPathGenerator/QuestSourceGenerator.cs +++ b/QuestPathGenerator/QuestSourceGenerator.cs @@ -365,6 +365,9 @@ public class QuestSourceGenerator : ISourceGenerator .AsSyntaxNodeOrToken(), AssignmentList(nameof(QuestStep.SkipIf), step.SkipIf) .AsSyntaxNodeOrToken(), + AssignmentList(nameof(QuestStep.RequiredQuestVariables), + step.RequiredQuestVariables) + .AsSyntaxNodeOrToken(), AssignmentList(nameof(QuestStep.CompletionQuestVariablesFlags), step.CompletionQuestVariablesFlags) .AsSyntaxNodeOrToken(), diff --git a/QuestPathGenerator/RoslynShortcuts.cs b/QuestPathGenerator/RoslynShortcuts.cs index 186de3e0d..6364dca93 100644 --- a/QuestPathGenerator/RoslynShortcuts.cs +++ b/QuestPathGenerator/RoslynShortcuts.cs @@ -39,6 +39,8 @@ public static class RoslynShortcuts return LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(i16)); else if (value is int i32) return LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(i32)); + else if (value is byte u8) + return LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(u8)); else if (value is ushort u16) return LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(u16)); else if (value is uint u32) @@ -173,15 +175,40 @@ public static class RoslynShortcuts SyntaxNodeList( Assignment(nameof(ComplexCombatData.DataId), complexCombatData.DataId, default(uint)) .AsSyntaxNodeOrToken(), - Assignment(nameof(ComplexCombatData.MinimumKillCount), complexCombatData.MinimumKillCount, null) + Assignment(nameof(ComplexCombatData.MinimumKillCount), + complexCombatData.MinimumKillCount, null) .AsSyntaxNodeOrToken(), Assignment(nameof(ComplexCombatData.RewardItemId), complexCombatData.RewardItemId, null) .AsSyntaxNodeOrToken(), - Assignment(nameof(ComplexCombatData.RewardItemCount), complexCombatData.RewardItemCount, null) + Assignment(nameof(ComplexCombatData.RewardItemCount), complexCombatData.RewardItemCount, + null) .AsSyntaxNodeOrToken(), - AssignmentList(nameof(ComplexCombatData.CompletionQuestVariablesFlags), complexCombatData.CompletionQuestVariablesFlags) + AssignmentList(nameof(ComplexCombatData.CompletionQuestVariablesFlags), + complexCombatData.CompletionQuestVariablesFlags) .AsSyntaxNodeOrToken())))); - }else if (value is null) + } + else if (value is QuestWorkValue qwv) + { + return ObjectCreationExpression( + IdentifierName(nameof(QuestWorkValue))) + .WithArgumentList( + ArgumentList( + SeparatedList( + new SyntaxNodeOrToken[] + { + Argument(LiteralValue(qwv.High)), + Token(SyntaxKind.CommaToken), + Argument(LiteralValue(qwv.Low)) + }))); + } + else if (value is List list) + { + return CollectionExpression( + SeparatedList( + SyntaxNodeList(list.Select(x => ExpressionElement( + LiteralValue(x)).AsSyntaxNodeOrToken()).ToArray()))); + } + else if (value is null) return LiteralExpression(SyntaxKind.NullLiteralExpression); else throw new Exception($"Unsupported data type {value.GetType()} = {value}");