muffin v7.4.7

This commit is contained in:
alydev 2025-12-28 12:35:39 +10:00
parent 1cc65e495d
commit 63f975ff4f
16 changed files with 1659 additions and 939 deletions

View file

@ -19,6 +19,8 @@ namespace Questionable.Windows.ConfigComponents;
internal sealed class StopConditionComponent : ConfigComponent
{
private static readonly string[] StopModeNames = new string[3] { "Off", "Pause", "Stop" };
private readonly IDalamudPluginInterface _pluginInterface;
private readonly QuestSelector _questSelector;
@ -55,6 +57,7 @@ internal sealed class StopConditionComponent : ConfigComponent
_questSelector.QuestSelected = delegate(Quest quest)
{
configuration.Stop.QuestsToStopAfter.Add(quest.Id);
configuration.Stop.QuestStopModes[quest.Id.ToString()] = Questionable.Configuration.EStopConditionMode.Stop;
stopConditionComponent.Save();
};
}
@ -67,26 +70,30 @@ internal sealed class StopConditionComponent : ConfigComponent
return;
}
bool v = base.Configuration.Stop.Enabled;
if (ImGui.Checkbox("Stop Questionable when any of the conditions below are met", ref v))
if (ImGui.Checkbox("Enable stop conditions", ref v))
{
base.Configuration.Stop.Enabled = v;
Save();
}
ImGui.SameLine();
ImGuiComponents.HelpMarker("Pause: Stops automation when condition is met, but allows resuming past it.\nStop: True stop, blocks automation from starting/resuming if condition is already met.");
ImGui.Separator();
using (ImRaii.Disabled(!v))
{
ImGui.Text("Stop when character level reaches:");
bool v2 = base.Configuration.Stop.LevelToStopAfter;
if (ImGui.Checkbox("Enable level stop condition", ref v2))
int currentItem = (int)base.Configuration.Stop.LevelStopMode;
ImGui.SetNextItemWidth(100f);
if (ImGui.Combo((ImU8String)"##LevelMode", ref currentItem, (ReadOnlySpan<string>)StopModeNames, StopModeNames.Length))
{
base.Configuration.Stop.LevelToStopAfter = v2;
base.Configuration.Stop.LevelStopMode = (Configuration.EStopConditionMode)currentItem;
Save();
}
using (ImRaii.Disabled(!v2))
ImGui.SameLine();
using (ImRaii.Disabled(base.Configuration.Stop.LevelStopMode == Questionable.Configuration.EStopConditionMode.Off))
{
int data = base.Configuration.Stop.TargetLevel;
ImGui.SetNextItemWidth(100f);
if (ImGui.InputInt("Stop at level", ref data, 1, 5))
if (ImGui.InputInt("Target level", ref data, 1, 5))
{
base.Configuration.Stop.TargetLevel = Math.Max(1, Math.Min(100, data));
Save();
@ -103,18 +110,20 @@ internal sealed class StopConditionComponent : ConfigComponent
}
}
ImGui.Separator();
ImGui.Text("Stop on quest sequence:");
bool v3 = base.Configuration.Stop.SequenceToStopAfter;
if (ImGui.Checkbox("Enable global quest sequence stop condition", ref v3))
ImGui.Text("Stop on quest sequence (global):");
int currentItem2 = (int)base.Configuration.Stop.SequenceStopMode;
ImGui.SetNextItemWidth(100f);
if (ImGui.Combo((ImU8String)"##SequenceMode", ref currentItem2, (ReadOnlySpan<string>)StopModeNames, StopModeNames.Length))
{
base.Configuration.Stop.SequenceToStopAfter = v3;
base.Configuration.Stop.SequenceStopMode = (Configuration.EStopConditionMode)currentItem2;
Save();
}
using (ImRaii.Disabled(!v3))
ImGui.SameLine();
using (ImRaii.Disabled(base.Configuration.Stop.SequenceStopMode == Questionable.Configuration.EStopConditionMode.Off))
{
int data2 = base.Configuration.Stop.TargetSequence;
ImGui.SetNextItemWidth(100f);
if (ImGui.InputInt("Stop at sequence", ref data2, 1, 1))
if (ImGui.InputInt("Target sequence", ref data2, 1, 1))
{
base.Configuration.Stop.TargetSequence = Math.Max(0, Math.Min(255, data2));
Save();
@ -130,8 +139,8 @@ internal sealed class StopConditionComponent : ConfigComponent
text2.AppendLiteral(")");
ImGui.TextDisabled(text2);
}
ImGui.TextWrapped("Note: Individual quest sequences below override this global setting.");
}
ImGui.TextWrapped("Note: Individual quest sequences below override this global setting.");
ImGui.Separator();
ImGui.Text("Stop when completing quests (or reaching specific sequences):");
DrawCurrentlyAcceptedQuests();
@ -143,11 +152,13 @@ internal sealed class StopConditionComponent : ConfigComponent
{
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Trash, "Clear All"))
{
base.Configuration.Stop.QuestsToStopAfter.Clear();
foreach (ElementId item in questsToStopAfter)
{
base.Configuration.Stop.QuestSequences.Remove(item.ToString());
string key = item.ToString();
base.Configuration.Stop.QuestSequences.Remove(key);
base.Configuration.Stop.QuestStopModes.Remove(key);
}
base.Configuration.Stop.QuestsToStopAfter.Clear();
Save();
}
}
@ -186,16 +197,34 @@ internal sealed class StopConditionComponent : ConfigComponent
{
_questTooltipComponent.Draw(quest2.Info);
}
ImGui.SameLine();
string text3 = elementId.ToString();
base.Configuration.Stop.QuestSequences.TryGetValue(text3, out var value);
bool v4 = value.HasValue;
ImU8String label = new ImU8String(8, 1);
label.AppendLiteral("##UseSeq");
int currentItem3 = (int)base.Configuration.Stop.QuestStopModes.GetValueOrDefault(text3, Questionable.Configuration.EStopConditionMode.Stop);
ImGui.SameLine();
ImGui.SetNextItemWidth(70f);
ImU8String label = new ImU8String(6, 1);
label.AppendLiteral("##Mode");
label.AppendFormatted(text3);
if (ImGui.Checkbox(label, ref v4))
if (ImGui.Combo(label, ref currentItem3, (ReadOnlySpan<string>)StopModeNames, StopModeNames.Length))
{
if (v4)
if (currentItem3 == 0)
{
quest = quest2;
}
else
{
base.Configuration.Stop.QuestStopModes[text3] = (Configuration.EStopConditionMode)currentItem3;
Save();
}
}
ImGui.SameLine();
base.Configuration.Stop.QuestSequences.TryGetValue(text3, out var value);
bool v2 = value.HasValue;
ImU8String label2 = new ImU8String(8, 1);
label2.AppendLiteral("##UseSeq");
label2.AppendFormatted(text3);
if (ImGui.Checkbox(label2, ref v2))
{
if (v2)
{
base.Configuration.Stop.QuestSequences[text3] = 1;
}
@ -209,17 +238,17 @@ internal sealed class StopConditionComponent : ConfigComponent
{
ImGui.SetTooltip("Stop at specific sequence (unchecked = stop on quest completion)");
}
using (ImRaii.Disabled(!v4))
using (ImRaii.Disabled(!v2))
{
ImGui.SameLine();
ImGui.Text("Seq:");
ImGui.SameLine();
ImGui.SetNextItemWidth(85f);
int data3 = value ?? 1;
ImU8String label2 = new ImU8String(10, 1);
label2.AppendLiteral("##SeqValue");
label2.AppendFormatted(text3);
if (ImGui.InputInt(label2, ref data3, 1, 1) && v4)
ImU8String label3 = new ImU8String(10, 1);
label3.AppendLiteral("##SeqValue");
label3.AppendFormatted(text3);
if (ImGui.InputInt(label3, ref data3, 1, 1) && v2)
{
base.Configuration.Stop.QuestSequences[text3] = Math.Max(0, Math.Min(255, data3));
Save();
@ -237,8 +266,10 @@ internal sealed class StopConditionComponent : ConfigComponent
}
if (quest != null)
{
string key2 = quest.Id.ToString();
base.Configuration.Stop.QuestsToStopAfter.Remove(quest.Id);
base.Configuration.Stop.QuestSequences.Remove(quest.Id.ToString());
base.Configuration.Stop.QuestSequences.Remove(key2);
base.Configuration.Stop.QuestStopModes.Remove(key2);
Save();
}
}
@ -286,6 +317,7 @@ internal sealed class StopConditionComponent : ConfigComponent
if (ImGuiComponents.IconButton($"##Add{item.Id}", FontAwesomeIcon.Plus))
{
base.Configuration.Stop.QuestsToStopAfter.Add(item.Id);
base.Configuration.Stop.QuestStopModes[item.Id.ToString()] = Questionable.Configuration.EStopConditionMode.Stop;
Save();
}
}