Add better action tooltips
This commit is contained in:
@@ -40,7 +40,7 @@ public class SimulatorWindow : Window
|
|||||||
if (ImGui.ImageButton(action.GetIcon(ClassJob.Carpenter).ImGuiHandle, new Vector2(ImGui.GetFontSize() * 2)))
|
if (ImGui.ImageButton(action.GetIcon(ClassJob.Carpenter).ImGuiHandle, new Vector2(ImGui.GetFontSize() * 2)))
|
||||||
Simulation.Execute(action);
|
Simulation.Execute(action);
|
||||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||||
ImGui.SetTooltip(action.GetName(ClassJob.Carpenter));
|
ImGui.SetTooltip(action.Tooltip);
|
||||||
ImGui.EndDisabled();
|
ImGui.EndDisabled();
|
||||||
if (++i % 5 != 0)
|
if (++i % 5 != 0)
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
@@ -84,7 +84,7 @@ public class SimulatorWindow : Window
|
|||||||
i = 0;
|
i = 0;
|
||||||
foreach(var action in Simulation.ActionHistory)
|
foreach(var action in Simulation.ActionHistory)
|
||||||
{
|
{
|
||||||
ImGui.Image(action.GetIcon(ClassJob.Carpenter).ImGuiHandle, new Vector2(ImGui.GetFontSize() * 1.5f));
|
ImGui.Image(action.GetIcon(ClassJob.Carpenter).ImGuiHandle, new Vector2(ImGui.GetFontSize() * 2f));
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
ImGui.SetTooltip(action.GetName(ClassJob.Carpenter));
|
ImGui.SetTooltip(action.GetName(ClassJob.Carpenter));
|
||||||
if (++i % 5 != 0)
|
if (++i % 5 != 0)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using ImGuiScene;
|
|||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using Action = Lumina.Excel.GeneratedSheets.Action;
|
using Action = Lumina.Excel.GeneratedSheets.Action;
|
||||||
|
|
||||||
namespace Craftimizer.Simulator.Actions;
|
namespace Craftimizer.Simulator.Actions;
|
||||||
@@ -111,4 +112,28 @@ public abstract class BaseAction
|
|||||||
Simulation.IncreaseQuality(Efficiency);
|
Simulation.IncreaseQuality(Efficiency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual string Tooltip
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var builder = new StringBuilder();
|
||||||
|
builder.AppendLine(GetName(ClassJob.Carpenter));
|
||||||
|
if (!CanUse)
|
||||||
|
builder.AppendLine($"Cannot Use");
|
||||||
|
builder.AppendLine($"Level {Level}");
|
||||||
|
builder.AppendLine($"CP Cost: {CPCost}");
|
||||||
|
if (DurabilityCost != 0)
|
||||||
|
builder.AppendLine($"Durability Cost: {DurabilityCost}");
|
||||||
|
if (IncreasesProgress)
|
||||||
|
builder.AppendLine($"+{Simulation.CalculateProgressGain(Efficiency)} Progress");
|
||||||
|
if (IncreasesQuality)
|
||||||
|
builder.AppendLine($"+{Simulation.CalculateQualityGain(Efficiency)} Quality");
|
||||||
|
if (!IncreasesStepCount)
|
||||||
|
builder.AppendLine($"Does Not Increase Step Count");
|
||||||
|
if (SuccessRate != 1f)
|
||||||
|
builder.AppendLine($"{SuccessRate * 100}%% Success Rate");
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Craftimizer.Simulator.Actions;
|
namespace Craftimizer.Simulator.Actions;
|
||||||
|
|
||||||
@@ -19,4 +20,16 @@ public abstract class BaseBuffAction : BaseAction
|
|||||||
Simulation.RemoveEffect(effect);
|
Simulation.RemoveEffect(effect);
|
||||||
Simulation.AddEffect(Effect, EffectDuration);
|
Simulation.AddEffect(Effect, EffectDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string Tooltip {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var builder = new StringBuilder(base.Tooltip);
|
||||||
|
builder.AppendLine($"Effect: {Effect.Status().Name}");
|
||||||
|
builder.AppendLine($"Duration: {EffectDuration} steps");
|
||||||
|
foreach(var effect in ConflictingEffects)
|
||||||
|
builder.AppendLine($"Conflicts with: {effect.Status().Name}");
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user