Clean up simulation window
This commit is contained in:
@@ -10,4 +10,5 @@ public static class LuminaSheets
|
|||||||
public static readonly ExcelSheet<ParamGrow> ParamGrowSheet = Service.DataManager.GetExcelSheet<ParamGrow>()!;
|
public static readonly ExcelSheet<ParamGrow> ParamGrowSheet = Service.DataManager.GetExcelSheet<ParamGrow>()!;
|
||||||
public static readonly ExcelSheet<Action> ActionSheet = Service.DataManager.GetExcelSheet<Action>()!;
|
public static readonly ExcelSheet<Action> ActionSheet = Service.DataManager.GetExcelSheet<Action>()!;
|
||||||
public static readonly ExcelSheet<CraftAction> CraftActionSheet = Service.DataManager.GetExcelSheet<CraftAction>()!;
|
public static readonly ExcelSheet<CraftAction> CraftActionSheet = Service.DataManager.GetExcelSheet<CraftAction>()!;
|
||||||
|
public static readonly ExcelSheet<Status> StatusSheet = Service.DataManager.GetExcelSheet<Status>()!;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,5 +42,7 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
{
|
{
|
||||||
if (command != "/craft")
|
if (command != "/craft")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SimulatorWindow.IsOpen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Craftimizer.Simulator;
|
using Craftimizer.Simulator;
|
||||||
using Craftimizer.Simulator.Actions;
|
using Craftimizer.Simulator.Actions;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Components;
|
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using System;
|
using System;
|
||||||
@@ -23,7 +22,7 @@ public class SimulatorWindow : Window
|
|||||||
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
|
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
|
||||||
};
|
};
|
||||||
|
|
||||||
Simulation = new(new CharacterStats { Craftsmanship = 4041, Control = 905, CP = 609, Level = 90 }, LuminaSheets.RecipeSheet.GetRow(35573)!);
|
Simulation = new(new CharacterStats { Craftsmanship = 4041, Control = 3905, CP = 609, Level = 90 }, LuminaSheets.RecipeSheet.GetRow(35573)!);
|
||||||
AvailableActions = BaseAction.Actions.Select(a => (Activator.CreateInstance(a, Simulation)! as BaseAction)!).ToArray();
|
AvailableActions = BaseAction.Actions.Select(a => (Activator.CreateInstance(a, Simulation)! as BaseAction)!).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,33 +33,62 @@ public class SimulatorWindow : Window
|
|||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.BeginChild("CraftimizerActions", Vector2.Zero, true, ImGuiWindowFlags.NoDecoration);
|
ImGui.BeginChild("CraftimizerActions", Vector2.Zero, true, ImGuiWindowFlags.NoDecoration);
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
|
||||||
|
var i = 0;
|
||||||
foreach(var action in AvailableActions)
|
foreach(var action in AvailableActions)
|
||||||
{
|
{
|
||||||
ImGui.BeginDisabled(!action.CanUse);
|
ImGui.BeginDisabled(!action.CanUse);
|
||||||
if (ImGui.ImageButton(action.GetIcon(ClassJob.Carpenter).ImGuiHandle, new Vector2(ImGui.GetFontSize() * 4)))
|
if (ImGui.ImageButton(action.GetIcon(ClassJob.Carpenter).ImGuiHandle, new Vector2(ImGui.GetFontSize() * 2)))
|
||||||
Simulation.Execute(action);
|
Simulation.Execute(action);
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||||
ImGui.SetTooltip(action.GetName(ClassJob.Carpenter));
|
ImGui.SetTooltip(action.GetName(ClassJob.Carpenter));
|
||||||
ImGui.EndDisabled();
|
ImGui.EndDisabled();
|
||||||
ImGui.SameLine();
|
if (++i % 5 != 0)
|
||||||
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
ImGui.PopStyleVar();
|
ImGui.PopStyleVar();
|
||||||
ImGui.EndChild();
|
ImGui.EndChild();
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.BeginChild("CraftimizerSimulator", Vector2.Zero, true, ImGuiWindowFlags.NoDecoration);
|
ImGui.BeginChild("CraftimizerSimulator", Vector2.Zero, true, ImGuiWindowFlags.NoDecoration);
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(.2f, 1f, .2f, 1f));
|
ImGui.PushStyleColor(ImGuiCol.PlotHistogram, new Vector4(.2f, 1f, .2f, 1f));
|
||||||
ImGui.ProgressBar(Math.Min((float)Simulation.Progress / Simulation.MaxProgress, 1f), new Vector2(200, 10));
|
ImGui.ProgressBar(Math.Min((float)Simulation.Progress / Simulation.MaxProgress, 1f), new Vector2(200, 20), $"{Simulation.Progress} / {Simulation.MaxProgress}");
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(.2f, .2f, 1f, 1f));
|
ImGui.PushStyleColor(ImGuiCol.PlotHistogram, new Vector4(.2f, .2f, 1f, 1f));
|
||||||
ImGui.ProgressBar(Math.Min((float)Simulation.Quality / Simulation.MaxQuality, 1f), new Vector2(200, 10));
|
ImGui.ProgressBar(Math.Min((float)Simulation.Quality / Simulation.MaxQuality, 1f), new Vector2(200, 20), $"{Simulation.Quality} / {Simulation.MaxQuality}");
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1f, 1f, .2f, 1f));
|
ImGui.PushStyleColor(ImGuiCol.PlotHistogram, new Vector4(1f, 1f, .2f, 1f));
|
||||||
ImGui.ProgressBar(Math.Clamp((float)Simulation.Durability / Simulation.MaxDurability, 0f, 1f), new Vector2(200, 10));
|
ImGui.ProgressBar(Math.Clamp((float)Simulation.Durability / Simulation.MaxDurability, 0f, 1f), new Vector2(200, 20), $"{Simulation.Durability} / {Simulation.MaxDurability}");
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
|
ImGui.PushStyleColor(ImGuiCol.PlotHistogram, new Vector4(1f, .2f, 1f, 1f));
|
||||||
|
ImGui.ProgressBar(Math.Clamp((float)Simulation.CP / Simulation.Stats.CP, 0f, 1f), new Vector2(200, 20), $"{Simulation.CP} / {Simulation.Stats.CP}");
|
||||||
|
ImGui.PopStyleColor();
|
||||||
|
ImGui.Text($"{Simulation.HQPercent}%% HQ");
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
ImGui.Text($"Effects:");
|
ImGui.Text($"Effects:");
|
||||||
foreach (var (effect, strength, stepsLeft) in Simulation.ActiveEffects)
|
foreach (var (effect, strength, stepsLeft) in Simulation.ActiveEffects)
|
||||||
ImGui.Text($"{effect} {strength} - {stepsLeft}");
|
{
|
||||||
|
var status = effect.Status();
|
||||||
|
var icon = Icons.GetIconFromId((ushort)status.Icon);
|
||||||
|
var h = ImGui.GetFontSize() * 1.25f;
|
||||||
|
var w = icon.Width * h / icon.Height;
|
||||||
|
ImGui.Image(icon.ImGuiHandle, new Vector2(w, h));
|
||||||
|
if (ImGui.IsItemHovered())
|
||||||
|
ImGui.SetTooltip(status.Name.ToString());
|
||||||
|
ImGui.SameLine();
|
||||||
|
if (stepsLeft < 0)
|
||||||
|
ImGui.Text($"{strength}");
|
||||||
|
else
|
||||||
|
ImGui.Text($"> {stepsLeft}");
|
||||||
|
}
|
||||||
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
i = 0;
|
||||||
|
foreach(var action in Simulation.ActionHistory)
|
||||||
|
{
|
||||||
|
ImGui.Image(action.GetIcon(ClassJob.Carpenter).ImGuiHandle, new Vector2(ImGui.GetFontSize() * 1.5f));
|
||||||
|
if (ImGui.IsItemHovered())
|
||||||
|
ImGui.SetTooltip(action.GetName(ClassJob.Carpenter));
|
||||||
|
if (++i % 5 != 0)
|
||||||
|
ImGui.SameLine();
|
||||||
|
}
|
||||||
ImGui.EndChild();
|
ImGui.EndChild();
|
||||||
ImGui.EndTable();
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user