Questionable/Questionable.Model/Questing/QuestStep.cs

131 lines
4.3 KiB
C#
Raw Normal View History

2024-07-27 13:39:47 +00:00
using System.Collections.Generic;
2024-08-15 23:51:12 +00:00
using System.Diagnostics.CodeAnalysis;
2024-05-26 13:43:33 +00:00
using System.Numerics;
using System.Text.Json.Serialization;
2024-08-02 16:30:21 +00:00
using Questionable.Model.Common;
using Questionable.Model.Common.Converter;
using Questionable.Model.Questing.Converter;
2024-05-25 21:51:37 +00:00
2024-08-02 16:30:21 +00:00
namespace Questionable.Model.Questing;
2024-05-25 21:51:37 +00:00
2024-08-15 23:51:12 +00:00
[SuppressMessage("ReSharper", "CollectionNeverUpdated.Global")]
2024-06-14 09:37:33 +00:00
public sealed class QuestStep
2024-05-25 21:51:37 +00:00
{
public const float DefaultStopDistance = 3f;
public const int VesperBayAetheryteTicket = 30362;
2024-05-26 19:45:26 +00:00
public uint? DataId { get; set; }
[JsonConverter(typeof(VectorConverter))]
public Vector3? Position { get; set; }
public float? StopDistance { get; set; }
2024-05-25 21:51:37 +00:00
public ushort TerritoryId { get; set; }
2024-08-15 23:51:12 +00:00
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public EInteractionType InteractionType { get; set; }
public float? NpcWaitDistance { get; set; }
public ushort? TargetTerritoryId { get; set; }
public float? DelaySecondsAtStart { get; set; }
2024-08-22 10:14:12 +00:00
public uint? PickUpItemId { get; set; }
2024-05-26 13:43:33 +00:00
public bool Disabled { get; set; }
2024-05-27 19:54:34 +00:00
public bool DisableNavmesh { get; set; }
public bool? Mount { get; set; }
2024-06-01 16:46:57 +00:00
public bool? Fly { get; set; }
2024-07-12 21:58:48 +00:00
public bool? Land { get; set; }
2024-06-01 16:46:57 +00:00
public bool? Sprint { get; set; }
public bool? IgnoreDistanceToObject { get; set; }
public bool? RestartNavigationIfCancelled { get; set; }
2024-05-26 19:45:26 +00:00
public string? Comment { get; set; }
/// <summary>
/// Only used when attuning to an aetheryte.
/// </summary>
public EAetheryteLocation? Aetheryte { get; set; }
/// <summary>
/// Only used when attuning to an aethernet shard.
/// </summary>
[JsonConverter(typeof(AethernetShardConverter))]
public EAetheryteLocation? AethernetShard { get; set; }
2024-05-26 19:45:26 +00:00
public EAetheryteLocation? AetheryteShortcut { get; set; }
2024-05-26 13:43:33 +00:00
2024-05-26 19:45:26 +00:00
public AethernetShortcut? AethernetShortcut { get; set; }
2024-05-27 19:54:34 +00:00
public uint? AetherCurrentId { get; set; }
public uint? ItemId { get; set; }
2024-05-28 22:17:19 +00:00
public bool? GroundTarget { get; set; }
public int? ItemCount { get; set; }
2024-05-27 19:54:34 +00:00
public EEmote? Emote { get; set; }
public ChatMessage? ChatMessage { get; set; }
public EAction? Action { get; set; }
2024-05-27 19:54:34 +00:00
public EEnemySpawnType? EnemySpawnType { get; set; }
2024-08-15 23:51:12 +00:00
public List<uint> KillEnemyDataIds { get; set; } = [];
public List<ComplexCombatData> ComplexCombatData { get; set; } = [];
public float? CombatDelaySecondsAtStart { get; set; }
2024-06-14 09:37:33 +00:00
2024-06-01 12:30:20 +00:00
public JumpDestination? JumpDestination { get; set; }
public uint? ContentFinderConditionId { get; set; }
2024-07-27 13:39:47 +00:00
public SkipConditions? SkipConditions { get; set; }
2024-07-20 17:09:51 +00:00
public List<List<QuestWorkValue>?> RequiredQuestVariables { get; set; } = new();
public List<GatheredItem> ItemsToGather { get; set; } = [];
2024-08-15 23:51:12 +00:00
public List<QuestWorkValue?> CompletionQuestVariablesFlags { get; set; } = [];
public List<DialogueChoice> DialogueChoices { get; set; } = [];
public List<uint> PointMenuChoices { get; set; } = [];
2024-09-22 12:31:14 +00:00
public PurchaseMenu? PurchaseMenu { get; set; }
// TODO: Not implemented
2024-08-03 20:17:18 +00:00
[JsonConverter(typeof(ElementIdConverter))]
public ElementId? PickUpQuestId { get; set; }
2024-08-03 20:17:18 +00:00
[JsonConverter(typeof(ElementIdConverter))]
public ElementId? TurnInQuestId { get; set; }
2024-08-03 18:30:18 +00:00
2024-08-03 20:17:18 +00:00
[JsonConverter(typeof(ElementIdConverter))]
public ElementId? NextQuestId { get; set; }
2024-06-01 16:46:57 +00:00
2024-06-14 09:37:33 +00:00
[JsonConstructor]
public QuestStep()
2024-06-01 16:46:57 +00:00
{
2024-06-14 09:37:33 +00:00
}
2024-06-01 16:46:57 +00:00
2024-06-14 09:37:33 +00:00
public QuestStep(EInteractionType interactionType, uint? dataId, Vector3? position, ushort territoryId)
{
InteractionType = interactionType;
DataId = dataId;
Position = position;
TerritoryId = territoryId;
2024-06-01 16:46:57 +00:00
}
public float CalculateActualStopDistance()
{
if (InteractionType == EInteractionType.WalkTo)
return StopDistance ?? 0.25f;
if (InteractionType == EInteractionType.AttuneAetheryte)
return StopDistance ?? 10f;
else
return StopDistance ?? DefaultStopDistance;
}
/// <summary>
/// Only relevant for the step 0 in sequence 0: Whether this step is valid for teleporting to it.
/// </summary>
/// <returns></returns>
public bool IsTeleportableForPriorityQuests()
{
if (AetheryteShortcut != null)
return true;
if (InteractionType == EInteractionType.UseItem && ItemId == VesperBayAetheryteTicket)
return true;
return false;
}
2024-05-25 21:51:37 +00:00
}