Add ability to only simulate first synth helper action
This commit is contained in:
@@ -101,6 +101,7 @@ public class Configuration : IPluginConfiguration
|
|||||||
public bool ShowCommunityMacros { get; set; } = true;
|
public bool ShowCommunityMacros { get; set; } = true;
|
||||||
public bool SearchCommunityMacroAutomatically { get; set; }
|
public bool SearchCommunityMacroAutomatically { get; set; }
|
||||||
public int SynthHelperStepCount { get; set; } = 5;
|
public int SynthHelperStepCount { get; set; } = 5;
|
||||||
|
public bool SynthHelperDisplayOnlyFirstStep { get; set; }
|
||||||
|
|
||||||
public bool PinSynthHelperToWindow { get; set; } = true;
|
public bool PinSynthHelperToWindow { get; set; } = true;
|
||||||
public bool PinRecipeNoteToWindow { get; set; } = true;
|
public bool PinRecipeNoteToWindow { get; set; } = true;
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ internal sealed class SimulatedMacro
|
|||||||
private object QueueLock { get; } = new();
|
private object QueueLock { get; } = new();
|
||||||
private List<Step> QueuedSteps { get; set; } = [];
|
private List<Step> QueuedSteps { get; set; } = [];
|
||||||
|
|
||||||
|
public SimulationState FirstState => Macro.Count > 0 ? Macro[0].State : InitialState;
|
||||||
public SimulationState State => Macro.Count > 0 ? Macro[^1].State : InitialState;
|
public SimulationState State => Macro.Count > 0 ? Macro[^1].State : InitialState;
|
||||||
|
|
||||||
public IEnumerable<ActionType> Actions => Macro.Select(m => m.Action);
|
public IEnumerable<ActionType> Actions => Macro.Select(m => m.Action);
|
||||||
@@ -155,9 +156,9 @@ internal sealed class SimulatedMacro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Reliablity GetReliability(RecipeData recipeData) =>
|
public Reliablity GetReliability(RecipeData recipeData, Index? idx = null) =>
|
||||||
Macro.Count > 0 ?
|
Macro.Count > 0 ?
|
||||||
Macro[^1].GetReliability(InitialState, Macro.Select(m => m.Action), recipeData) :
|
Macro[idx ?? ^1].GetReliability(InitialState, Macro.Select(m => m.Action), recipeData) :
|
||||||
new(InitialState, Array.Empty<ActionType>(), 0, recipeData);
|
new(InitialState, Array.Empty<ActionType>(), 0, recipeData);
|
||||||
|
|
||||||
private void TryRecalculateFrom(int index)
|
private void TryRecalculateFrom(int index)
|
||||||
|
|||||||
@@ -166,9 +166,9 @@ public sealed class Settings : Window, IDisposable
|
|||||||
{
|
{
|
||||||
DrawTabGeneral();
|
DrawTabGeneral();
|
||||||
DrawTabRecipeNote();
|
DrawTabRecipeNote();
|
||||||
DrawTabMacroEditor();
|
|
||||||
if (Config.EnableSynthHelper)
|
if (Config.EnableSynthHelper)
|
||||||
DrawTabSynthHelper();
|
DrawTabSynthHelper();
|
||||||
|
DrawTabMacroEditor();
|
||||||
DrawTabAbout();
|
DrawTabAbout();
|
||||||
|
|
||||||
ImGui.EndTabBar();
|
ImGui.EndTabBar();
|
||||||
@@ -885,9 +885,19 @@ public sealed class Settings : Window, IDisposable
|
|||||||
ref isDirty
|
ref isDirty
|
||||||
);
|
);
|
||||||
|
|
||||||
|
DrawOption(
|
||||||
|
"Simulate Only First Step",
|
||||||
|
"Only the first step is simulated by default. You can still " +
|
||||||
|
"hover over the other steps to view their outcomes, but the " +
|
||||||
|
"reliability trials (when hovering over the macro stats) are hidden.",
|
||||||
|
Config.SynthHelperDisplayOnlyFirstStep,
|
||||||
|
v => Config.SynthHelperDisplayOnlyFirstStep = v,
|
||||||
|
ref isDirty
|
||||||
|
);
|
||||||
|
|
||||||
DrawOption(
|
DrawOption(
|
||||||
"Step Count",
|
"Step Count",
|
||||||
"The number of future actions to solve for during an in-game craft.",
|
"The minimum number of future steps to solve for during an in-game craft.",
|
||||||
Config.SynthHelperStepCount,
|
Config.SynthHelperStepCount,
|
||||||
1,
|
1,
|
||||||
100,
|
100,
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private SimulationState? hoveredState;
|
private SimulationState? hoveredState;
|
||||||
private SimulationState DisplayedState => hoveredState ?? Macro.State;
|
private SimulationState DisplayedState => hoveredState ?? (Service.Configuration.SynthHelperDisplayOnlyFirstStep ? Macro.FirstState : Macro.State);
|
||||||
private void DrawMacro()
|
private void DrawMacro()
|
||||||
{
|
{
|
||||||
var spacing = ImGui.GetStyle().ItemSpacing.X;
|
var spacing = ImGui.GetStyle().ItemSpacing.X;
|
||||||
@@ -278,7 +278,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
|||||||
{
|
{
|
||||||
ImGuiUtils.Tooltip($"{action.GetName(RecipeData!.ClassJob)}\n" +
|
ImGuiUtils.Tooltip($"{action.GetName(RecipeData!.ClassJob)}\n" +
|
||||||
$"{actionBase.GetTooltip(CreateSim(lastState), true)}" +
|
$"{actionBase.GetTooltip(CreateSim(lastState), true)}" +
|
||||||
$"{(canExecute && i == 0 ? "Click to Execute" : string.Empty)}");
|
$"{(canExecute && i == 0 ? "Click or run /craftaction to Execute" : string.Empty)}");
|
||||||
hoveredState = state;
|
hoveredState = state;
|
||||||
}
|
}
|
||||||
lastState = state;
|
lastState = state;
|
||||||
@@ -334,7 +334,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var reliability = Macro.GetReliability(RecipeData!);
|
var reliability = Macro.GetReliability(RecipeData!, Service.Configuration.SynthHelperDisplayOnlyFirstStep ? 0 : ^1);
|
||||||
{
|
{
|
||||||
var mainBars = new List<DynamicBars.BarData>()
|
var mainBars = new List<DynamicBars.BarData>()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user