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 CompletionQuestVariablesFlags { get; set; } = new List(); public ELockedSkipCondition? Flying { get; set; } public ELockedSkipCondition? Chocobo { get; set; } public bool? Diving { get; set; } public bool NotTargetable { get; set; } public List InTerritory { get; set; } = new List(); public List NotInTerritory { get; set; } = new List(); public SkipItemConditions? Item { get; set; } [JsonConverter(typeof(ElementIdListConverter))] public List QuestsAccepted { get; set; } = new List(); [JsonConverter(typeof(ElementIdListConverter))] public List QuestsCompleted { get; set; } = new List(); public List NotNamePlateIconId { get; set; } = new List(); 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}"; } }