qstbak/Questionable/Questionable/Configuration.cs
2025-10-10 10:13:06 +10:00

177 lines
4.7 KiB
C#

using System;
using System.Collections.Generic;
using Dalamud.Configuration;
using Dalamud.Game.Text;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using LLib.GameData;
using LLib.ImGui;
using Newtonsoft.Json;
using Questionable.Model.Questing;
namespace Questionable;
internal sealed class Configuration : IPluginConfiguration
{
internal sealed class GeneralConfiguration
{
public ECombatModule CombatModule { get; set; }
public uint MountId { get; set; } = 71u;
public GrandCompany GrandCompany { get; set; }
public EClassJob CombatJob { get; set; }
public bool HideInAllInstances { get; set; } = true;
public bool UseEscToCancelQuesting { get; set; } = true;
public bool ShowIncompleteSeasonalEvents { get; set; } = true;
public bool SkipLowPriorityDuties { get; set; }
public bool ConfigureTextAdvance { get; set; } = true;
public bool AutoStepRefreshEnabled { get; set; } = true;
public int AutoStepRefreshDelaySeconds { get; set; } = 10;
public bool HideSeasonalEventsFromJournalProgress { get; set; }
public bool BatchAlliedSocietyTurnIns { get; set; } = true;
}
internal sealed class StopConfiguration
{
public bool Enabled { get; set; }
[JsonProperty(ItemConverterType = typeof(ElementIdNConverter))]
public List<ElementId> QuestsToStopAfter { get; set; } = new List<ElementId>();
public bool LevelToStopAfter { get; set; }
public int TargetLevel { get; set; } = 50;
public bool SequenceToStopAfter { get; set; }
public int TargetSequence { get; set; } = 1;
}
internal sealed class DutyConfiguration
{
public bool RunInstancedContentWithAutoDuty { get; set; }
public HashSet<uint> WhitelistedDutyCfcIds { get; set; } = new HashSet<uint>();
public HashSet<uint> BlacklistedDutyCfcIds { get; set; } = new HashSet<uint>();
public Dictionary<string, bool> ExpansionHeaderStates { get; set; } = new Dictionary<string, bool>();
}
internal sealed class SinglePlayerDutyConfiguration
{
public bool RunSoloInstancesWithBossMod { get; set; }
public byte RetryDifficulty => 0;
public HashSet<uint> WhitelistedSinglePlayerDutyCfcIds { get; set; } = new HashSet<uint>();
public HashSet<uint> BlacklistedSinglePlayerDutyCfcIds { get; set; } = new HashSet<uint>();
public Dictionary<string, bool> HeaderStates { get; set; } = new Dictionary<string, bool>();
}
internal sealed class NotificationConfiguration
{
public bool Enabled { get; set; } = true;
public XivChatType ChatType { get; set; } = XivChatType.Debug;
public bool ShowTrayMessage { get; set; }
public bool FlashTaskbar { get; set; }
}
internal sealed class AdvancedConfiguration
{
public bool DebugOverlay { get; set; }
public bool CombatDataOverlay { get; set; }
public bool NeverFly { get; set; }
public bool AdditionalStatusInformation { get; set; }
public bool DisableAutoDutyBareMode { get; set; }
public bool SkipAetherCurrents { get; set; }
public bool SkipClassJobQuests { get; set; }
public bool SkipARealmRebornHardModePrimals { get; set; }
public bool SkipCrystalTowerRaids { get; set; }
public bool PreventQuestCompletion { get; set; }
}
internal enum ECombatModule
{
None,
BossMod,
WrathCombo,
RotationSolverReborn
}
public sealed class ElementIdNConverter : JsonConverter<ElementId>
{
public override void WriteJson(JsonWriter writer, ElementId? value, JsonSerializer serializer)
{
writer.WriteValue(value?.ToString());
}
public override ElementId? ReadJson(JsonReader reader, Type objectType, ElementId? existingValue, bool hasExistingValue, JsonSerializer serializer)
{
string text = reader.Value?.ToString();
if (text == null)
{
return null;
}
return ElementId.FromString(text);
}
}
public const int PluginSetupVersion = 5;
public int Version { get; set; } = 1;
public int PluginSetupCompleteVersion { get; set; }
public GeneralConfiguration General { get; } = new GeneralConfiguration();
public StopConfiguration Stop { get; } = new StopConfiguration();
public DutyConfiguration Duties { get; } = new DutyConfiguration();
public SinglePlayerDutyConfiguration SinglePlayerDuties { get; } = new SinglePlayerDutyConfiguration();
public NotificationConfiguration Notifications { get; } = new NotificationConfiguration();
public AdvancedConfiguration Advanced { get; } = new AdvancedConfiguration();
public WindowConfig DebugWindowConfig { get; } = new WindowConfig();
public WindowConfig ConfigWindowConfig { get; } = new WindowConfig();
public WindowConfig QuestValidationWindowConfig { get; set; } = new WindowConfig();
internal bool IsPluginSetupComplete()
{
return PluginSetupCompleteVersion == 5;
}
internal void MarkPluginSetupComplete()
{
PluginSetupCompleteVersion = 5;
}
}