1
0
Fork 0
forked from aly/qstbak
qstbak/Questionable.Model/Questionable.Model.Questing/SkipStepConditions.cs
2025-12-18 00:49:57 +10:00

66 lines
2.6 KiB
C#

using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using Questionable.Model.Common;
using Questionable.Model.Questing.Converter;
namespace Questionable.Model.Questing;
public sealed class SkipStepConditions
{
public bool Never { get; set; }
public IList<QuestWorkValue?> CompletionQuestVariablesFlags { get; set; } = new List<QuestWorkValue>();
public ELockedSkipCondition? Flying { get; set; }
public ELockedSkipCondition? Chocobo { get; set; }
public bool? Diving { get; set; }
public bool NotTargetable { get; set; }
public List<ushort> InTerritory { get; set; } = new List<ushort>();
public List<ushort> NotInTerritory { get; set; } = new List<ushort>();
public SkipItemConditions? Item { get; set; }
[JsonConverter(typeof(ElementIdListConverter))]
public List<ElementId> QuestsAccepted { get; set; } = new List<ElementId>();
[JsonConverter(typeof(ElementIdListConverter))]
public List<ElementId> QuestsCompleted { get; set; } = new List<ElementId>();
public List<uint> NotNamePlateIconId { get; set; } = new List<uint>();
public EAetheryteLocation? AetheryteLocked { get; set; }
public EAetheryteLocation? AetheryteUnlocked { get; set; }
public ushort? MinimumLevel { get; set; }
public NearPositionCondition? NearPosition { get; set; }
public NearPositionCondition? NotNearPosition { get; set; }
public EExtraSkipCondition? ExtraCondition { get; set; }
public bool HasSkipConditions()
{
if (Never)
{
return false;
}
if ((CompletionQuestVariablesFlags.Count <= 0 || !CompletionQuestVariablesFlags.Any((QuestWorkValue x) => x != null)) && !Flying.HasValue && !Chocobo.HasValue && !Diving.HasValue && !NotTargetable && InTerritory.Count <= 0 && NotInTerritory.Count <= 0 && Item == null && QuestsAccepted.Count <= 0 && QuestsCompleted.Count <= 0 && NotNamePlateIconId.Count <= 0 && !AetheryteLocked.HasValue && !AetheryteUnlocked.HasValue && !MinimumLevel.HasValue && NearPosition == null && NotNearPosition == null)
{
return ExtraCondition.HasValue;
}
return true;
}
public override string ToString()
{
return $"{"Never"}: {Never}, {"CompletionQuestVariablesFlags"}: {CompletionQuestVariablesFlags}, {"Flying"}: {Flying}, {"Chocobo"}: {Chocobo}, {"Diving"}: {Diving}, {"NotTargetable"}: {NotTargetable}, {"InTerritory"}: {string.Join(" ", InTerritory)}, {"NotInTerritory"}: {string.Join(" ", NotInTerritory)}, {"Item"}: {Item}, {"QuestsAccepted"}: {string.Join(" ", QuestsAccepted)}, {"QuestsCompleted"}: {string.Join(" ", QuestsCompleted)}, {"NotNamePlateIconId"}: {string.Join(" ", NotNamePlateIconId)}, {"NearPosition"}: {NearPosition}, {"ExtraCondition"}: {ExtraCondition}";
}
}