qstbak/Questionable.Model/Questionable.Model.Questing/QuestStep.cs
2025-10-09 07:47:19 +10:00

172 lines
4.4 KiB
C#

using System.Collections.Generic;
using System.Numerics;
using System.Text.Json.Serialization;
using Questionable.Model.Common;
using Questionable.Model.Common.Converter;
using Questionable.Model.Questing.Converter;
namespace Questionable.Model.Questing;
public sealed class QuestStep
{
public const float DefaultStopDistance = 3f;
public const int VesperBayAetheryteTicket = 30362;
public uint? DataId { get; set; }
[JsonConverter(typeof(VectorConverter))]
public Vector3? Position { get; set; }
public float? StopDistance { get; set; }
public ushort TerritoryId { get; set; }
[JsonIgnore(/*Could not decode attribute arguments.*/)]
public EInteractionType InteractionType { get; set; }
public float? NpcWaitDistance { get; set; }
public ushort? TargetTerritoryId { get; set; }
public float? DelaySecondsAtStart { get; set; }
public uint? PickUpItemId { get; set; }
public bool Disabled { get; set; }
public bool DisableNavmesh { get; set; }
public bool? Mount { get; set; }
public bool? Fly { get; set; }
public bool? Land { get; set; }
public bool? Sprint { get; set; }
public bool? IgnoreDistanceToObject { get; set; }
public bool? RestartNavigationIfCancelled { get; set; }
public string? Comment { get; set; }
public EAetheryteLocation? Aetheryte { get; set; }
[JsonConverter(typeof(AethernetShardConverter))]
public EAetheryteLocation? AethernetShard { get; set; }
public EAetheryteLocation? AetheryteShortcut { get; set; }
public AethernetShortcut? AethernetShortcut { get; set; }
public uint? AetherCurrentId { get; set; }
public uint? ItemId { get; set; }
public bool? GroundTarget { get; set; }
public int? ItemCount { get; set; }
public EEmote? Emote { get; set; }
public ChatMessage? ChatMessage { get; set; }
public EAction? Action { get; set; }
public EStatus? Status { get; set; }
public EExtendedClassJob TargetClass { get; set; }
public byte? TaxiStandId { get; set; }
public EEnemySpawnType? EnemySpawnType { get; set; }
public List<uint> KillEnemyDataIds { get; set; } = new List<uint>();
public List<ComplexCombatData> ComplexCombatData { get; set; } = new List<ComplexCombatData>();
public CombatItemUse? CombatItemUse { get; set; }
public float? CombatDelaySecondsAtStart { get; set; }
public JumpDestination? JumpDestination { get; set; }
public DutyOptions? DutyOptions { get; set; }
public SinglePlayerDutyOptions? SinglePlayerDutyOptions { get; set; }
public byte SinglePlayerDutyIndex => SinglePlayerDutyOptions?.Index ?? 0;
public SkipConditions? SkipConditions { get; set; }
public List<List<QuestWorkValue>?> RequiredQuestVariables { get; set; } = new List<List<QuestWorkValue>>();
public List<EExtendedClassJob> RequiredCurrentJob { get; set; } = new List<EExtendedClassJob>();
public List<EExtendedClassJob> RequiredQuestAcceptedJob { get; set; } = new List<EExtendedClassJob>();
public List<GatheredItem> ItemsToGather { get; set; } = new List<GatheredItem>();
public List<QuestWorkValue?> CompletionQuestVariablesFlags { get; set; } = new List<QuestWorkValue>();
public List<DialogueChoice> DialogueChoices { get; set; } = new List<DialogueChoice>();
public List<uint> PointMenuChoices { get; set; } = new List<uint>();
public PurchaseMenu? PurchaseMenu { get; set; }
[JsonConverter(typeof(ElementIdConverter))]
public ElementId? PickUpQuestId { get; set; }
[JsonConverter(typeof(ElementIdConverter))]
public ElementId? TurnInQuestId { get; set; }
[JsonConverter(typeof(ElementIdConverter))]
public ElementId? NextQuestId { get; set; }
[JsonConstructor]
public QuestStep()
{
}
public QuestStep(EInteractionType interactionType, uint? dataId, Vector3? position, ushort territoryId)
{
InteractionType = interactionType;
DataId = dataId;
Position = position;
TerritoryId = territoryId;
}
public float CalculateActualStopDistance()
{
float? stopDistance = StopDistance;
if (stopDistance.HasValue)
{
return stopDistance.GetValueOrDefault();
}
switch (InteractionType)
{
case EInteractionType.WalkTo:
return 0.25f;
case EInteractionType.AttuneAetheryte:
case EInteractionType.RegisterFreeOrFavoredAetheryte:
return 10f;
default:
return 3f;
}
}
public bool IsTeleportableForPriorityQuests()
{
if (AetheryteShortcut.HasValue)
{
return true;
}
if (InteractionType == EInteractionType.UseItem && ItemId == 30362)
{
return true;
}
return false;
}
}