using System; using System.Linq; using Dalamud.Bindings.ImGui; using Dalamud.Plugin; using LLib.GameData; using Questionable.Windows.ConfigComponents; namespace Questionable.Windows.Setup; internal sealed class EssentialSettingsStep : ISetupStep { private const float MaxComboWidth = 300f; private readonly GeneralConfigComponent _generalConfigComponent; private readonly DutyConfigComponent _dutyConfigComponent; private readonly IDalamudPluginInterface _pluginInterface; public string Title => "Essential settings"; public bool CanAdvance => true; public EssentialSettingsStep(GeneralConfigComponent generalConfigComponent, DutyConfigComponent dutyConfigComponent, IDalamudPluginInterface pluginInterface) { _generalConfigComponent = generalConfigComponent; _dutyConfigComponent = dutyConfigComponent; _pluginInterface = pluginInterface; } public bool ShouldShow() { if (!GrandCompanyNotJoined()) { return AutoDutyInstalled(); } return true; } public void Draw() { if (GrandCompanyNotJoined()) { UiThemeUtils.SectionHeader("Grand Company"); ImGui.PushTextWrapPos(0f); ImGui.TextColored(in UiThemeUtils.DimTextColor, "You haven't joined a Grand Company yet. Pick the one you intend to join - the MSQ stalls at \"The Company You Keep\" without it."); ImGui.PopTextWrapPos(); _generalConfigComponent.DrawGrandCompanySelector(MathF.Min(ImGui.GetContentRegionAvail().X, 300f)); UiThemeUtils.SectionSpacing(); } if (AutoDutyInstalled()) { UiThemeUtils.SectionHeader("Dungeons (AutoDuty)"); ImGui.PushTextWrapPos(0f); ImGui.TextColored(in UiThemeUtils.DimTextColor, "AutoDuty is installed. Enable this to let Questionable clear mandatory MSQ dungeons instead of stopping at them."); ImGui.PopTextWrapPos(); _dutyConfigComponent.DrawAutoDutySettings(); } } private static bool GrandCompanyNotJoined() { return GrandCompanyHelper.GetGrandCompanyId() == 0; } private bool AutoDutyInstalled() { return _pluginInterface.InstalledPlugins.Any((IExposedPlugin x) => x.InternalName == "AutoDuty" && x.IsLoaded); } }