From e86ca2aed477ea543088d1ca146feef09add57fe Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Thu, 28 Nov 2024 14:13:41 -0800 Subject: [PATCH] Add /craftretry --- Craftimizer/Plugin.cs | 4 ++++ Craftimizer/Windows/SynthHelper.cs | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Craftimizer/Plugin.cs b/Craftimizer/Plugin.cs index 81b4f4a..5b3a067 100644 --- a/Craftimizer/Plugin.cs +++ b/Craftimizer/Plugin.cs @@ -118,6 +118,10 @@ public sealed class Plugin : IDalamudPlugin public void ExecuteSuggestedSynthHelperAction() => SynthHelperWindow.ExecuteNextAction(); + [Command(name: "/craftretry", description: "Clicks \"Retry\" in the synthesis helper. Can also be run inside a macro. This command is useful for controller players.")] + public void ExecuteRetrySynthHelper() => + SynthHelperWindow.AttemptRetry(); + [Command(name: "/craftimizer", description: "Open the settings window.")] private void OpenSettingsWindowForced() => OpenSettingsWindow(true); diff --git a/Craftimizer/Windows/SynthHelper.cs b/Craftimizer/Windows/SynthHelper.cs index ecf75ac..ac9e62c 100644 --- a/Craftimizer/Windows/SynthHelper.cs +++ b/Craftimizer/Windows/SynthHelper.cs @@ -459,7 +459,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable else { if (ImGui.Button("Retry", new(-1, 0))) - CalculateBestMacro(); + AttemptRetry(); if (ImGui.IsItemHovered()) ImGuiUtils.TooltipWrapped("Suggest a way to finish the crafting recipe. " + "Results aren't perfect, and levels of success " + @@ -482,6 +482,12 @@ public sealed unsafe class SynthHelper : Window, IDisposable return false; } + public void AttemptRetry() + { + if (!SolverRunning) + CalculateBestMacro(); + } + private void OnStartCrafting(ushort recipeId) { var shouldUpdateInput = false;