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

64 lines
2.7 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 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 && NearPosition == null && NotNearPosition == null)
{
return ExtraCondition.HasValue;
}
return true;
}
public override string ToString()
{
return string.Format("{0}: {1}, {2}: {3}, {4}: {5}, {6}: {7}, {8}: {9}, {10}: {11}, {12}: {13}, {14}: {15}, {16}: {17}, {18}: {19}, {20}: {21}, {22}: {23}, {24}: {25}, {26}: {27}", "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);
}
}