1
0
forked from liza/Questionable
Questionable/QuestPathGenerator/RoslynElements/QuestStepExtensions.cs

151 lines
9.7 KiB
C#
Raw Normal View History

2024-08-17 18:59:42 +00:00
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Questionable.Model.Questing;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
using static Questionable.QuestPathGenerator.RoslynShortcuts;
namespace Questionable.QuestPathGenerator.RoslynElements;
internal static class QuestStepExtensions
{
public static ExpressionSyntax ToExpressionSyntax(this QuestStep step)
{
var emptyStep = new QuestStep();
return ObjectCreationExpression(
IdentifierName(nameof(QuestStep)))
.WithArgumentList(
ArgumentList(
SeparatedList<ArgumentSyntax>(
new SyntaxNodeOrToken[]
{
Argument(LiteralValue(step.InteractionType)),
Token(SyntaxKind.CommaToken),
Argument(LiteralValue(step.DataId)),
Token(SyntaxKind.CommaToken),
Argument(LiteralValue(step.Position)),
Token(SyntaxKind.CommaToken),
Argument(LiteralValue(step.TerritoryId))
})))
.WithInitializer(
InitializerExpression(
SyntaxKind.ObjectInitializerExpression,
SeparatedList<ExpressionSyntax>(
SyntaxNodeList(
Assignment(nameof(QuestStep.StopDistance), step.StopDistance,
emptyStep.StopDistance)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.NpcWaitDistance), step.NpcWaitDistance,
emptyStep.NpcWaitDistance)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.TargetTerritoryId), step.TargetTerritoryId,
emptyStep.TargetTerritoryId)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.DelaySecondsAtStart), step.DelaySecondsAtStart,
emptyStep.DelaySecondsAtStart)
.AsSyntaxNodeOrToken(),
2024-08-22 10:14:12 +00:00
Assignment(nameof(QuestStep.PickUpItemId), step.PickUpItemId, emptyStep.PickUpItemId)
.AsSyntaxNodeOrToken(),
2024-08-17 18:59:42 +00:00
Assignment(nameof(QuestStep.Disabled), step.Disabled, emptyStep.Disabled)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.DisableNavmesh), step.DisableNavmesh,
emptyStep.DisableNavmesh)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.Mount), step.Mount, emptyStep.Mount)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.Fly), step.Fly, emptyStep.Fly)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.Land), step.Land, emptyStep.Land)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.Sprint), step.Sprint, emptyStep.Sprint)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.IgnoreDistanceToObject),
step.IgnoreDistanceToObject, emptyStep.IgnoreDistanceToObject)
.AsSyntaxNodeOrToken(),
2024-08-30 18:35:37 +00:00
Assignment(nameof(QuestStep.RestartNavigationIfCancelled),
step.RestartNavigationIfCancelled, emptyStep.RestartNavigationIfCancelled)
.AsSyntaxNodeOrToken(),
2024-08-17 18:59:42 +00:00
Assignment(nameof(QuestStep.Comment), step.Comment, emptyStep.Comment)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.Aetheryte), step.Aetheryte, emptyStep.Aetheryte)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.AethernetShard), step.AethernetShard,
emptyStep.AethernetShard)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.AetheryteShortcut), step.AetheryteShortcut,
emptyStep.AetheryteShortcut)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.AethernetShortcut), step.AethernetShortcut,
emptyStep.AethernetShortcut)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.AetherCurrentId), step.AetherCurrentId,
emptyStep.AetherCurrentId)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.ItemId), step.ItemId, emptyStep.ItemId)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.GroundTarget), step.GroundTarget,
emptyStep.GroundTarget)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.ItemCount), step.ItemCount, emptyStep.ItemCount)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.Emote), step.Emote, emptyStep.Emote)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.ChatMessage), step.ChatMessage,
emptyStep.ChatMessage)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.Action), step.Action, emptyStep.Action)
.AsSyntaxNodeOrToken(),
2024-10-19 15:24:21 +00:00
Assignment(nameof(QuestStep.Status), step.Status, emptyStep.Status)
.AsSyntaxNodeOrToken(),
2024-08-17 18:59:42 +00:00
Assignment(nameof(QuestStep.EnemySpawnType), step.EnemySpawnType,
emptyStep.EnemySpawnType)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.KillEnemyDataIds), step.KillEnemyDataIds)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.ComplexCombatData), step.ComplexCombatData)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.CombatDelaySecondsAtStart),
step.CombatDelaySecondsAtStart,
emptyStep.CombatDelaySecondsAtStart)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.JumpDestination), step.JumpDestination,
emptyStep.JumpDestination)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.ContentFinderConditionId),
step.ContentFinderConditionId, emptyStep.ContentFinderConditionId)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.SkipConditions), step.SkipConditions,
emptyStep.SkipConditions)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.RequiredQuestVariables),
step.RequiredQuestVariables)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.RequiredCurrentJob),
step.RequiredCurrentJob)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.RequiredQuestAcceptedJob),
step.RequiredQuestAcceptedJob)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.ItemsToGather),
step.ItemsToGather),
2024-08-17 18:59:42 +00:00
AssignmentList(nameof(QuestStep.CompletionQuestVariablesFlags),
step.CompletionQuestVariablesFlags)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.DialogueChoices), step.DialogueChoices)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.PointMenuChoices), step.PointMenuChoices)
.AsSyntaxNodeOrToken(),
2024-09-22 12:31:14 +00:00
Assignment(nameof(QuestStep.PurchaseMenu), step.PurchaseMenu, emptyStep.PurchaseMenu)
.AsSyntaxNodeOrToken(),
2024-08-17 18:59:42 +00:00
Assignment(nameof(QuestStep.PickUpQuestId), step.PickUpQuestId,
emptyStep.PickUpQuestId)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.TurnInQuestId), step.TurnInQuestId,
emptyStep.TurnInQuestId)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.NextQuestId), step.NextQuestId,
emptyStep.NextQuestId)
.AsSyntaxNodeOrToken()))));
}
}