qstbak/Questionable/Questionable.Windows.ConfigComponents/DebugConfigComponent.cs
2026-08-19 13:19:57 +10:00

126 lines
5.1 KiB
C#

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Numerics;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Plugin;
using Questionable.External;
namespace Questionable.Windows.ConfigComponents;
internal sealed class DebugConfigComponent : ConfigComponent
{
private readonly Dictionary<string, bool> _featurePausingOpenState = new Dictionary<string, bool>();
public DebugConfigComponent(IDalamudPluginInterface pluginInterface, Configuration configuration)
: base(pluginInterface, configuration)
{
}
public override void DrawTab()
{
UiThemeUtils.SectionHeader("Interaction Recovery");
(Vector2 ContentStartPos, float AvailableWidth, ImDrawListPtr DrawList) tuple = UiThemeUtils.BeginCard();
Vector2 item = tuple.ContentStartPos;
float item2 = tuple.AvailableWidth;
ImDrawListPtr item3 = tuple.DrawList;
int value = base.Configuration.Advanced.InteractionRetryLimit;
if (UiThemeUtils.AccentSliderInt("Retry limit", ref value, 1, 10, 260f))
{
base.Configuration.Advanced.InteractionRetryLimit = value;
Save();
}
ImGui.SameLine();
UiThemeUtils.InfoIcon("Maximum number of times an interrupted interaction will be retried before stopping. Interruptions can be caused by combat, other plugins, or server issues.");
float value2 = base.Configuration.Advanced.InteractionTimeoutSeconds;
if (UiThemeUtils.AccentSliderFloat("Timeout (seconds)", ref value2, 5f, 30f, "%.0f", 260f))
{
base.Configuration.Advanced.InteractionTimeoutSeconds = value2;
Save();
}
ImGui.SameLine();
UiThemeUtils.InfoIcon("Maximum time an interaction can run without progress before it is treated as stuck and retried.");
UiThemeUtils.EndCard(item, item2, item3);
UiThemeUtils.SectionSpacing();
UiThemeUtils.SectionHeader("Navigation debug");
(Vector2 ContentStartPos, float AvailableWidth, ImDrawListPtr DrawList) tuple2 = UiThemeUtils.BeginCard();
Vector2 item4 = tuple2.ContentStartPos;
float item5 = tuple2.AvailableWidth;
ImDrawListPtr item6 = tuple2.DrawList;
bool value3 = base.Configuration.Advanced.ShowWigglyNavShimProvider;
if (UiThemeUtils.WrappedCheckbox("Show WigglyNav shim provider option", ref value3, "Reveals an extra navigation provider row on the Dependencies page that drives WigglyNav through its vnavmesh-shaped legacy surface instead of its native one. Intended for comparing the two surfaces, not for normal use."))
{
base.Configuration.Advanced.ShowWigglyNavShimProvider = value3;
Save();
}
UiThemeUtils.EndCard(item4, item5, item6);
UiThemeUtils.SectionSpacing();
UiThemeUtils.SectionHeader("Danger Zone");
var (contentStartPos, availableWidth, drawList) = UiThemeUtils.BeginCard();
UiThemeUtils.WrappedTextColored(UiThemeUtils.StatusLocked, "Enabling any option below may cause unexpected behavior. Use at your own risk.");
bool value4 = base.Configuration.Advanced.DisablePartyWatchdog;
if (UiThemeUtils.WrappedCheckbox("Disable Party Watchdog", ref value4, "The Party Watchdog stops Questionable when entering certain zones with other party members, or when entering unsupported content. Disabling this allows Questionable to continue working while in a party, but may cause unexpected behavior in group content."))
{
base.Configuration.Advanced.DisablePartyWatchdog = value4;
Save();
}
DrawFeaturePausingSection("Pandora's Box Feature Pausing", PandorasBoxIpc.ConflictingFeatures, "Auto Active Time Maneuver", "Only applies when Auto-Solve QTE is enabled.", base.Configuration.Advanced.PandoraFeatureExclusions);
DrawFeaturePausingSection("Bundle of Tweaks Feature Pausing", AutomatonIpc.ConflictingTweaks, "AutoSnipeQuests", "Only applies when AutoSnipe is enabled.", base.Configuration.Advanced.AutomatonTweakExclusions);
UiThemeUtils.EndCard(contentStartPos, availableWidth, drawList);
}
private void DrawFeaturePausingSection(string header, ImmutableHashSet<string> features, string conditionalFeature, string conditionalHelpText, HashSet<string> exclusions)
{
bool open = _featurePausingOpenState.GetValueOrDefault(header);
UiThemeUtils.ThemedAccordion(header, header, null, ref open);
_featurePausingOpenState[header] = open;
if (!open)
{
return;
}
using (ImRaii.PushId(header))
{
using (ImRaii.PushIndent())
{
foreach (string item in features.Order())
{
bool value = !exclusions.Contains(item);
if (UiThemeUtils.WrappedCheckbox("Pause: " + item, ref value))
{
if (value)
{
exclusions.Remove(item);
}
else
{
exclusions.Add(item);
}
Save();
}
}
ImGui.Spacing();
bool value2 = !exclusions.Contains(conditionalFeature);
if (UiThemeUtils.WrappedCheckbox("Pause: " + conditionalFeature, ref value2, conditionalHelpText))
{
if (value2)
{
exclusions.Remove(conditionalFeature);
}
else
{
exclusions.Add(conditionalFeature);
}
Save();
}
ImGui.Spacing();
if (UiThemeUtils.DestructiveButton(FontAwesomeIcon.Undo, "Reset to defaults"))
{
exclusions.Clear();
Save();
}
}
}
}
}