Use TextUnformatted to remove %%, add tooltip auto-wrapping

This commit is contained in:
Asriel Camora
2023-11-18 02:56:56 -08:00
parent a5033463ec
commit 2f1cbfd01b
9 changed files with 159 additions and 146 deletions
+16 -2
View File
@@ -60,7 +60,7 @@ internal static class ImGuiUtils
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
var textFrameHeight = ImGui.GetFrameHeight(); var textFrameHeight = ImGui.GetFrameHeight();
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
ImGui.Text(name); ImGui.TextUnformatted(name);
GroupPanelLabelStack.Push((ImGui.GetItemRectMin(), ImGui.GetItemRectMax(), textFrameHeight / 2f)); // push rect to stack GroupPanelLabelStack.Push((ImGui.GetItemRectMin(), ImGui.GetItemRectMax(), textFrameHeight / 2f)); // push rect to stack
ImGui.SameLine(0, 0); ImGui.SameLine(0, 0);
ImGui.Dummy(new Vector2(0f, textFrameHeight + itemSpacing.Y)); // shifts content by fh + is.y ImGui.Dummy(new Vector2(0f, textFrameHeight + itemSpacing.Y)); // shifts content by fh + is.y
@@ -574,10 +574,24 @@ internal static class ImGuiUtils
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand); ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true }); Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
ImGui.SetTooltip("Open in Browser"); Tooltip("Open in Browser");
} }
} }
public static void Tooltip(string text)
{
using var _tooltip = ImRaii.Tooltip();
ImGui.TextUnformatted(text);
}
public static void TooltipWrapped(string text, float width = 300)
{
using var _tooltip = ImRaii.Tooltip();
ImGui.PushTextWrapPos(width);
ImGui.TextUnformatted(text);
ImGui.PopTextWrapPos();
}
public static void AlignCentered(float width, float availWidth = default) public static void AlignCentered(float width, float availWidth = default)
{ {
if (availWidth == default) if (availWidth == default)
+1 -1
View File
@@ -65,7 +65,7 @@ internal static class DynamicBars
ImGui.SetCursorPos(pos); ImGui.SetCursorPos(pos);
ImGuiUtils.ViolinPlot(violinData, new(barSize, ImGui.GetFrameHeight())); ImGuiUtils.ViolinPlot(violinData, new(barSize, ImGui.GetFrameHeight()));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip( ImGuiUtils.Tooltip(
$"Min: {reliability.Min}\n" + $"Min: {reliability.Min}\n" +
$"Med: {reliability.Median:0.##}\n" + $"Med: {reliability.Median:0.##}\n" +
$"Avg: {reliability.Average:0.##}\n" + $"Avg: {reliability.Average:0.##}\n" +
+1 -1
View File
@@ -57,7 +57,7 @@ public sealed class MacroClipboard : Window, IDisposable
} }
} }
if (buttonHovered) if (buttonHovered)
ImGui.SetTooltip("Copy to Clipboard"); ImGuiUtils.Tooltip("Copy to Clipboard");
ImGui.SetCursorPos(cursor); ImGui.SetCursorPos(cursor);
{ {
+42 -42
View File
@@ -151,7 +151,7 @@ public sealed class MacroEditor : Window, IDisposable
Icon = FontAwesomeIcon.Cog, Icon = FontAwesomeIcon.Cog,
IconOffset = new(2.5f, 1), IconOffset = new(2.5f, 1),
Click = _ => Service.Plugin.OpenSettingsWindow(), Click = _ => Service.Plugin.OpenSettingsWindow(),
ShowTooltip = () => ImGui.SetTooltip("Open Craftimizer Settings") ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
} }
}; };
@@ -304,7 +304,7 @@ public sealed class MacroEditor : Window, IDisposable
: 1 : 1
}; };
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"CLvl {Gearsets.CalculateCLvl(CharacterStats.Level)}"); ImGuiUtils.Tooltip($"CLvl {Gearsets.CalculateCLvl(CharacterStats.Level)}");
var disabledTint = new Vector4(0.5f, 0.5f, 0.5f, 0.75f); var disabledTint = new Vector4(0.5f, 0.5f, 0.5f, 0.75f);
var imageButtonPadding = (int)(ImGui.GetStyle().FramePadding.Y / 2f); var imageButtonPadding = (int)(ImGui.GetStyle().FramePadding.Y / 2f);
@@ -322,7 +322,7 @@ public sealed class MacroEditor : Window, IDisposable
CharacterStats = CharacterStats with { HasSplendorousBuff = !v }; CharacterStats = CharacterStats with { HasSplendorousBuff = !v };
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip(CharacterStats.HasSplendorousBuff ? $"Splendorous Tool" : "No Splendorous Tool"); ImGuiUtils.Tooltip(CharacterStats.HasSplendorousBuff ? $"Splendorous Tool" : "No Splendorous Tool");
} }
ImGui.SameLine(0, 5); ImGui.SameLine(0, 5);
bool? newIsSpecialist = null; bool? newIsSpecialist = null;
@@ -343,7 +343,7 @@ public sealed class MacroEditor : Window, IDisposable
} }
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip(v ? $"Specialist" : "Not a Specialist"); ImGuiUtils.Tooltip(v ? $"Specialist" : "Not a Specialist");
} }
ImGui.SameLine(0, 5); ImGui.SameLine(0, 5);
{ {
@@ -356,7 +356,7 @@ public sealed class MacroEditor : Window, IDisposable
CharacterStats = CharacterStats with { CanUseManipulation = !v }; CharacterStats = CharacterStats with { CanUseManipulation = !v };
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip(CharacterStats.CanUseManipulation && manipLevel <= CharacterStats.Level ? $"Can Use Manipulation" : "Cannot Use Manipulation"); ImGuiUtils.Tooltip(CharacterStats.CanUseManipulation && manipLevel <= CharacterStats.Level ? $"Can Use Manipulation" : "Cannot Use Manipulation");
} }
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@@ -365,13 +365,13 @@ public sealed class MacroEditor : Window, IDisposable
var buffImageSize = new Vector2(imageSize * WellFedBadge.Width / WellFedBadge.Height, imageSize); var buffImageSize = new Vector2(imageSize * WellFedBadge.Width / WellFedBadge.Height, imageSize);
ImGui.Image(WellFedBadge.ImGuiHandle, buffImageSize); ImGui.Image(WellFedBadge.ImGuiHandle, buffImageSize);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Food"); ImGuiUtils.Tooltip("Food");
ImGui.SameLine(0, 5); ImGui.SameLine(0, 5);
{ {
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
using var combo = ImRaii.Combo("##food", FormatItemBuff(Buffs.Food)); using var combo = ImRaii.Combo("##food", FormatItemBuff(Buffs.Food));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatItemBuffDescription(Buffs.Food)); ImGuiUtils.Tooltip(FormatItemBuffDescription(Buffs.Food));
if (combo) if (combo)
{ {
if (ImGui.Selectable("None", Buffs.Food.ItemId == 0)) if (ImGui.Selectable("None", Buffs.Food.ItemId == 0))
@@ -383,7 +383,7 @@ public sealed class MacroEditor : Window, IDisposable
if (ImGui.Selectable(FormatItemBuff(row), Buffs.Food == row)) if (ImGui.Selectable(FormatItemBuff(row), Buffs.Food == row))
newFoodBuff = row; newFoodBuff = row;
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatItemBuffDescription(row)); ImGuiUtils.Tooltip(FormatItemBuffDescription(row));
if (food.Item.CanBeHq) if (food.Item.CanBeHq)
{ {
@@ -391,7 +391,7 @@ public sealed class MacroEditor : Window, IDisposable
if (ImGui.Selectable(FormatItemBuff(row), Buffs.Food == row)) if (ImGui.Selectable(FormatItemBuff(row), Buffs.Food == row))
newFoodBuff = row; newFoodBuff = row;
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatItemBuffDescription(row)); ImGuiUtils.Tooltip(FormatItemBuffDescription(row));
} }
} }
} }
@@ -401,13 +401,13 @@ public sealed class MacroEditor : Window, IDisposable
buffImageSize = new Vector2(imageSize * MedicatedBadge.Width / MedicatedBadge.Height, imageSize); buffImageSize = new Vector2(imageSize * MedicatedBadge.Width / MedicatedBadge.Height, imageSize);
ImGui.Image(MedicatedBadge.ImGuiHandle, buffImageSize); ImGui.Image(MedicatedBadge.ImGuiHandle, buffImageSize);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Medicine"); ImGuiUtils.Tooltip("Medicine");
ImGui.SameLine(0, 5); ImGui.SameLine(0, 5);
{ {
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
using var combo = ImRaii.Combo("##medicine", FormatItemBuff(Buffs.Medicine)); using var combo = ImRaii.Combo("##medicine", FormatItemBuff(Buffs.Medicine));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatItemBuffDescription(Buffs.Medicine)); ImGuiUtils.Tooltip(FormatItemBuffDescription(Buffs.Medicine));
if (combo) if (combo)
{ {
if (ImGui.Selectable("None", Buffs.Medicine.ItemId == 0)) if (ImGui.Selectable("None", Buffs.Medicine.ItemId == 0))
@@ -419,7 +419,7 @@ public sealed class MacroEditor : Window, IDisposable
if (ImGui.Selectable(FormatItemBuff(row), Buffs.Medicine == row)) if (ImGui.Selectable(FormatItemBuff(row), Buffs.Medicine == row))
newMedicineBuff = row; newMedicineBuff = row;
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatItemBuffDescription(row)); ImGuiUtils.Tooltip(FormatItemBuffDescription(row));
if (medicine.Item.CanBeHq) if (medicine.Item.CanBeHq)
{ {
@@ -427,7 +427,7 @@ public sealed class MacroEditor : Window, IDisposable
if (ImGui.Selectable(FormatItemBuff(row), Buffs.Medicine == row)) if (ImGui.Selectable(FormatItemBuff(row), Buffs.Medicine == row))
newMedicineBuff = row; newMedicineBuff = row;
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatItemBuffDescription(row)); ImGuiUtils.Tooltip(FormatItemBuffDescription(row));
} }
} }
} }
@@ -441,13 +441,13 @@ public sealed class MacroEditor : Window, IDisposable
var fcBuffName = "Eat from the Hand"; var fcBuffName = "Eat from the Hand";
var fcStatName = "Craftsmanship"; var fcStatName = "Craftsmanship";
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(fcBuffName); ImGuiUtils.Tooltip(fcBuffName);
ImGui.SameLine(0, 5); ImGui.SameLine(0, 5);
{ {
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
using var combo = ImRaii.Combo("##fcCraftsmanship", FormatFCBuff(fcBuffName, Buffs.FC.Craftsmanship)); using var combo = ImRaii.Combo("##fcCraftsmanship", FormatFCBuff(fcBuffName, Buffs.FC.Craftsmanship));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatFCBuffDescription(fcBuffName, fcStatName, Buffs.FC.Craftsmanship)); ImGuiUtils.Tooltip(FormatFCBuffDescription(fcBuffName, fcStatName, Buffs.FC.Craftsmanship));
if (combo) if (combo)
{ {
if (ImGui.Selectable("None", Buffs.FC.Craftsmanship == 0)) if (ImGui.Selectable("None", Buffs.FC.Craftsmanship == 0))
@@ -458,7 +458,7 @@ public sealed class MacroEditor : Window, IDisposable
if (ImGui.Selectable(FormatFCBuff(fcBuffName, i), Buffs.FC.Craftsmanship == i)) if (ImGui.Selectable(FormatFCBuff(fcBuffName, i), Buffs.FC.Craftsmanship == i))
newFCCraftsmanshipBuff = i; newFCCraftsmanshipBuff = i;
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatFCBuffDescription(fcBuffName, fcStatName, i)); ImGuiUtils.Tooltip(FormatFCBuffDescription(fcBuffName, fcStatName, i));
} }
} }
} }
@@ -469,13 +469,13 @@ public sealed class MacroEditor : Window, IDisposable
fcBuffName = "In Control"; fcBuffName = "In Control";
fcStatName = "Control"; fcStatName = "Control";
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(fcBuffName); ImGuiUtils.Tooltip(fcBuffName);
ImGui.SameLine(0, 5); ImGui.SameLine(0, 5);
{ {
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X);
using var combo = ImRaii.Combo("##fcControl", FormatFCBuff(fcBuffName, Buffs.FC.Control)); using var combo = ImRaii.Combo("##fcControl", FormatFCBuff(fcBuffName, Buffs.FC.Control));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatFCBuffDescription(fcBuffName, fcStatName, Buffs.FC.Control)); ImGuiUtils.Tooltip(FormatFCBuffDescription(fcBuffName, fcStatName, Buffs.FC.Control));
if (combo) if (combo)
{ {
if (ImGui.Selectable("None", Buffs.FC.Control == 0)) if (ImGui.Selectable("None", Buffs.FC.Control == 0))
@@ -486,7 +486,7 @@ public sealed class MacroEditor : Window, IDisposable
if (ImGui.Selectable(FormatFCBuff(fcBuffName, i), Buffs.FC.Control == i)) if (ImGui.Selectable(FormatFCBuff(fcBuffName, i), Buffs.FC.Control == i))
newFCControlBuff = i; newFCControlBuff = i;
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(FormatFCBuffDescription(fcBuffName, fcStatName, i)); ImGuiUtils.Tooltip(FormatFCBuffDescription(fcBuffName, fcStatName, i));
} }
} }
} }
@@ -577,7 +577,7 @@ public sealed class MacroEditor : Window, IDisposable
if (!stat.IsRelative) if (!stat.IsRelative)
s.AppendLine($"{name} +{value}"); s.AppendLine($"{name} +{value}");
else else
s.AppendLine($"{name} +{value}%% (Max {max})"); s.AppendLine($"{name} +{value}% (Max {max})");
} }
if (FoodStatus.TryGetFood(input.ItemId) is { } food) if (FoodStatus.TryGetFood(input.ItemId) is { } food)
@@ -777,7 +777,7 @@ public sealed class MacroEditor : Window, IDisposable
ImGui.SameLine(0, 5); ImGui.SameLine(0, 5);
ImGui.Text(textLevel); ImGui.Text(textLevel);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"RLvl {RecipeData.RecipeInfo.RLvl}"); ImGuiUtils.Tooltip($"RLvl {RecipeData.RecipeInfo.RLvl}");
if (textStarsSize != Vector2.Zero) if (textStarsSize != Vector2.Zero)
{ {
@@ -792,7 +792,7 @@ public sealed class MacroEditor : Window, IDisposable
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset);
ImGui.Image(CollectibleBadge.ImGuiHandle, badgeSize); ImGui.Image(CollectibleBadge.ImGuiHandle, badgeSize);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Collectible"); ImGuiUtils.Tooltip($"Collectible");
} }
if (isExpert) if (isExpert)
@@ -801,7 +801,7 @@ public sealed class MacroEditor : Window, IDisposable
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset);
ImGui.Image(ExpertBadge.ImGuiHandle, badgeSize); ImGui.Image(ExpertBadge.ImGuiHandle, badgeSize);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Expert Recipe"); ImGuiUtils.Tooltip($"Expert Recipe");
} }
using (var statsTable = ImRaii.Table("stats", 3, ImGuiTableFlags.BordersInnerV)) using (var statsTable = ImRaii.Table("stats", 3, ImGuiTableFlags.BordersInnerV))
@@ -897,10 +897,10 @@ public sealed class MacroEditor : Window, IDisposable
{ {
var perItem = RecipeData.CalculateItemStartingQuality(idx, 1); var perItem = RecipeData.CalculateItemStartingQuality(idx, 1);
var total = RecipeData.CalculateItemStartingQuality(idx, hqCount); var total = RecipeData.CalculateItemStartingQuality(idx, hqCount);
ImGui.SetTooltip($"{ingredient.Item.Name.ToDalamudString()} {SeIconChar.HighQuality.ToIconString()}\n+{perItem} Quality/Item{(total > 0 ? $"\n+{total} Quality" : "")}"); ImGuiUtils.Tooltip($"{ingredient.Item.Name.ToDalamudString()} {SeIconChar.HighQuality.ToIconString()}\n+{perItem} Quality/Item{(total > 0 ? $"\n+{total} Quality" : "")}");
} }
else else
ImGui.SetTooltip($"{ingredient.Item.Name.ToDalamudString()}"); ImGuiUtils.Tooltip($"{ingredient.Item.Name.ToDalamudString()}");
} }
ImGui.SameLine(0, 5); ImGui.SameLine(0, 5);
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - (5 + ImGui.CalcTextSize("/").X + 5 + ImGui.CalcTextSize($"99").X)); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - (5 + ImGui.CalcTextSize("/").X + 5 + ImGui.CalcTextSize($"99").X));
@@ -974,7 +974,7 @@ public sealed class MacroEditor : Window, IDisposable
ImGui.PopClipRect(); ImGui.PopClipRect();
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip($"{actions[i].GetName(RecipeData!.ClassJob)}\n{actionBase.GetTooltip(sim, true)}"); ImGuiUtils.Tooltip($"{actions[i].GetName(RecipeData!.ClassJob)}\n{actionBase.GetTooltip(sim, true)}");
using var _padding = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, Vector2.Zero); using var _padding = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, Vector2.Zero);
using (var _source = ImRaii.DragDropSource()) using (var _source = ImRaii.DragDropSource())
@@ -1028,7 +1028,7 @@ public sealed class MacroEditor : Window, IDisposable
ImGui.Text(condition.Name()); ImGui.Text(condition.Name());
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(condition.Description(CharacterStats.HasSplendorousBuff).Replace("%", "%%")); ImGuiUtils.Tooltip(condition.Description(CharacterStats.HasSplendorousBuff));
ImGui.SetCursorPos(pos); ImGui.SetCursorPos(pos);
ImGuiUtils.AlignRight(ImGui.GetFrameHeight(), totalSize); ImGuiUtils.AlignRight(ImGui.GetFrameHeight(), totalSize);
@@ -1045,8 +1045,8 @@ public sealed class MacroEditor : Window, IDisposable
} }
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip("Condition Randomness\n" + ImGuiUtils.TooltipWrapped($"Condition Randomness{(!Service.Configuration.ConditionRandomness ? " (Disabled)" : string.Empty)}\n" +
"Allows the condition to fluctuate randomly like a real craft.\n" + "Allows the condition to fluctuate randomly like a real craft. " +
"Turns off when generating a macro."); "Turns off when generating a macro.");
} }
var datas = new List<DynamicBars.BarData>(3) var datas = new List<DynamicBars.BarData>(3)
@@ -1059,10 +1059,10 @@ public sealed class MacroEditor : Window, IDisposable
else if (RecipeData.Recipe.RequiredQuality > 0) else if (RecipeData.Recipe.RequiredQuality > 0)
{ {
var qualityPercent = (float)State.Quality / RecipeData.Recipe.RequiredQuality * 100; var qualityPercent = (float)State.Quality / RecipeData.Recipe.RequiredQuality * 100;
datas.Add(new("Quality %%", Colors.HQ, Reliability.ParamScore, qualityPercent, 100, $"{qualityPercent:0}%")); datas.Add(new("Quality %", Colors.HQ, Reliability.ParamScore, qualityPercent, 100, $"{qualityPercent:0}%"));
} }
else if (RecipeData.RecipeInfo.MaxQuality > 0) else if (RecipeData.RecipeInfo.MaxQuality > 0)
datas.Add(new("HQ %%", Colors.HQ, Reliability.ParamScore, State.HQPercent, 100, $"{State.HQPercent}%")); datas.Add(new("HQ %", Colors.HQ, Reliability.ParamScore, State.HQPercent, 100, $"{State.HQPercent}%"));
DynamicBars.Draw(datas); DynamicBars.Draw(datas);
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@@ -1110,7 +1110,7 @@ public sealed class MacroEditor : Window, IDisposable
{ {
var status = effect.Status(); var status = effect.Status();
using var _reset = ImRaii.DefaultFont(); using var _reset = ImRaii.DefaultFont();
ImGui.SetTooltip($"{status.Name.ToDalamudString()}\n{status.Description.ToDalamudString()}"); ImGuiUtils.Tooltip($"{status.Name.ToDalamudString()}\n{status.Description.ToDalamudString()}");
} }
ImGui.SameLine(); ImGui.SameLine();
} }
@@ -1155,7 +1155,7 @@ public sealed class MacroEditor : Window, IDisposable
ImGui.SetCursorPos(pos); ImGui.SetCursorPos(pos);
ImGuiUtils.ViolinPlot(violinData, new(barSize, ImGui.GetFrameHeight())); ImGuiUtils.ViolinPlot(violinData, new(barSize, ImGui.GetFrameHeight()));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip( ImGuiUtils.Tooltip(
$"Min: {reliability.Min}\n" + $"Min: {reliability.Min}\n" +
$"Med: {reliability.Median:0.##}\n" + $"Med: {reliability.Median:0.##}\n" +
$"Avg: {reliability.Average:0.##}\n" + $"Avg: {reliability.Average:0.##}\n" +
@@ -1226,7 +1226,7 @@ public sealed class MacroEditor : Window, IDisposable
ImGui.PopClipRect(); ImGui.PopClipRect();
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip($"{action.GetName(RecipeData!.ClassJob)}\n{actionBase.GetTooltip(CreateSim(lastState), true)}"); ImGuiUtils.Tooltip($"{action.GetName(RecipeData!.ClassJob)}\n{actionBase.GetTooltip(CreateSim(lastState), true)}");
using var _padding = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, Vector2.Zero); using var _padding = ImRaii.PushStyle(ImGuiStyleVar.WindowPadding, Vector2.Zero);
using (var _source = ImRaii.DragDropSource()) using (var _source = ImRaii.DragDropSource())
@@ -1263,7 +1263,7 @@ public sealed class MacroEditor : Window, IDisposable
using (var color = ImRaii.PushColor(ImGuiCol.PlotHistogram, ImGuiColors.DalamudGrey3)) using (var color = ImRaii.PushColor(ImGuiCol.PlotHistogram, ImGuiColors.DalamudGrey3))
ImGui.ProgressBar(fraction, new(progressWidth, ImGui.GetFrameHeight()), string.Empty); ImGui.ProgressBar(fraction, new(progressWidth, ImGui.GetFrameHeight()), string.Empty);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}"); ImGuiUtils.Tooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}");
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
ImGuiUtils.TextRight($"{fraction * 100:0}%", percentWidth); ImGuiUtils.TextRight($"{fraction * 100:0}%", percentWidth);
@@ -1304,7 +1304,7 @@ public sealed class MacroEditor : Window, IDisposable
using var _disabled = ImRaii.Disabled(); using var _disabled = ImRaii.Disabled();
ImGui.Button("Stopping", new(halfWidth, height)); ImGui.Button("Stopping", new(halfWidth, height));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("This might could a while, sorry! Please report\n" + ImGuiUtils.Tooltip("This might could a while, sorry! Please report " +
"if this takes longer than a second."); "if this takes longer than a second.");
} }
else else
@@ -1318,15 +1318,15 @@ public sealed class MacroEditor : Window, IDisposable
if (ImGui.Button(SolverStartStepCount.HasValue ? "Regenerate" : "Generate", new(halfWidth, height))) if (ImGui.Button(SolverStartStepCount.HasValue ? "Regenerate" : "Generate", new(halfWidth, height)))
CalculateBestMacro(); CalculateBestMacro();
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Suggest a way to finish the crafting recipe.\n" + ImGuiUtils.Tooltip("Suggest a way to finish the crafting recipe. " +
"Results aren't perfect, and levels of success\n" + "Results aren't perfect, and levels of success " +
"can vary wildly depending on the solver's settings."); "can vary wildly depending on the solver's settings.");
} }
ImGui.SameLine(); ImGui.SameLine();
if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Paste)) if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Paste))
Service.Plugin.CopyMacro(Macro.Actions.ToArray()); Service.Plugin.CopyMacro(Macro.Actions.ToArray());
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Copy to Clipboard"); ImGuiUtils.Tooltip("Copy to Clipboard");
ImGui.SameLine(); ImGui.SameLine();
using (var _disabled = ImRaii.Disabled(SolverRunning)) using (var _disabled = ImRaii.Disabled(SolverRunning))
{ {
@@ -1334,7 +1334,7 @@ public sealed class MacroEditor : Window, IDisposable
ShowImportPopup(); ShowImportPopup();
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip("Import Macro"); ImGuiUtils.Tooltip("Import Macro");
DrawImportPopup(); DrawImportPopup();
ImGui.SameLine(); ImGui.SameLine();
if (DefaultActions.Length > 0) if (DefaultActions.Length > 0)
@@ -1350,7 +1350,7 @@ public sealed class MacroEditor : Window, IDisposable
} }
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip("Reset"); ImGuiUtils.Tooltip("Reset");
} }
ImGui.SameLine(); ImGui.SameLine();
using (var _disabled = ImRaii.Disabled(SolverRunning)) using (var _disabled = ImRaii.Disabled(SolverRunning))
@@ -1362,7 +1362,7 @@ public sealed class MacroEditor : Window, IDisposable
} }
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip("Clear"); ImGuiUtils.Tooltip("Clear");
} }
private void ShowSaveAsPopup() private void ShowSaveAsPopup()
+13 -13
View File
@@ -44,7 +44,7 @@ public sealed class MacroList : Window, IDisposable
Icon = FontAwesomeIcon.Cog, Icon = FontAwesomeIcon.Cog,
IconOffset = new(2.5f, 1), IconOffset = new(2.5f, 1),
Click = _ => Service.Plugin.OpenSettingsWindow(), Click = _ => Service.Plugin.OpenSettingsWindow(),
ShowTooltip = () => ImGui.SetTooltip("Open Craftimizer Settings") ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
} }
}; };
@@ -179,7 +179,7 @@ public sealed class MacroList : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Quality)); ImGui.GetColorU32(Colors.Quality));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Quality: {state.Quality} / {state.Input.Recipe.MaxQuality}"); ImGuiUtils.Tooltip($"Quality: {state.Quality} / {state.Input.Recipe.MaxQuality}");
} }
else else
{ {
@@ -190,7 +190,7 @@ public sealed class MacroList : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Progress)); ImGui.GetColorU32(Colors.Progress));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Progress: {state.Progress} / {state.Input.Recipe.MaxProgress}"); ImGuiUtils.Tooltip($"Progress: {state.Progress} / {state.Input.Recipe.MaxProgress}");
} }
} }
else else
@@ -202,7 +202,7 @@ public sealed class MacroList : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Progress)); ImGui.GetColorU32(Colors.Progress));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Progress: {state.Progress} / {state.Input.Recipe.MaxProgress}"); ImGuiUtils.Tooltip($"Progress: {state.Progress} / {state.Input.Recipe.MaxProgress}");
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
ImGuiUtils.ArcProgress( ImGuiUtils.ArcProgress(
@@ -212,7 +212,7 @@ public sealed class MacroList : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Quality)); ImGui.GetColorU32(Colors.Quality));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Quality: {state.Quality} / {state.Input.Recipe.MaxQuality}"); ImGuiUtils.Tooltip($"Quality: {state.Quality} / {state.Input.Recipe.MaxQuality}");
ImGuiUtils.ArcProgress((float)state.Durability / state.Input.Recipe.MaxDurability, ImGuiUtils.ArcProgress((float)state.Durability / state.Input.Recipe.MaxDurability,
miniRowHeight / 2f, miniRowHeight / 2f,
@@ -220,7 +220,7 @@ public sealed class MacroList : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Durability)); ImGui.GetColorU32(Colors.Durability));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Remaining Durability: {state.Durability} / {state.Input.Recipe.MaxDurability}"); ImGuiUtils.Tooltip($"Remaining Durability: {state.Durability} / {state.Input.Recipe.MaxDurability}");
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
ImGuiUtils.ArcProgress( ImGuiUtils.ArcProgress(
@@ -230,7 +230,7 @@ public sealed class MacroList : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.CP)); ImGui.GetColorU32(Colors.CP));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Remaining CP: {state.CP} / {state.Input.Stats.CP}"); ImGuiUtils.Tooltip($"Remaining CP: {state.CP} / {state.Input.Stats.CP}");
} }
} }
@@ -239,18 +239,18 @@ public sealed class MacroList : Window, IDisposable
if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Edit, miniRowHeight)) if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Edit, miniRowHeight))
OpenEditor(macro); OpenEditor(macro);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Open in Simulator"); ImGuiUtils.Tooltip("Open in Simulator");
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.PencilAlt, miniRowHeight)) if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.PencilAlt, miniRowHeight))
ShowRenamePopup(macro); ShowRenamePopup(macro);
DrawRenamePopup(macro); DrawRenamePopup(macro);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Rename"); ImGuiUtils.Tooltip("Rename");
if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Paste, miniRowHeight)) if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Paste, miniRowHeight))
Service.Plugin.CopyMacro(macro.Actions); Service.Plugin.CopyMacro(macro.Actions);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Copy to Clipboard"); ImGuiUtils.Tooltip("Copy to Clipboard");
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
using (var _disabled = ImRaii.Disabled(!ImGui.GetIO().KeyShift)) using (var _disabled = ImRaii.Disabled(!ImGui.GetIO().KeyShift))
{ {
@@ -258,7 +258,7 @@ public sealed class MacroList : Window, IDisposable
Service.Configuration.RemoveMacro(macro); Service.Configuration.RemoveMacro(macro);
} }
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip("Delete (Hold Shift)"); ImGuiUtils.Tooltip("Delete (Hold Shift)");
} }
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@@ -276,7 +276,7 @@ public sealed class MacroList : Window, IDisposable
{ {
ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight)); ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(macro.Actions[i].GetName(RecipeData!.ClassJob)); ImGuiUtils.Tooltip(macro.Actions[i].GetName(RecipeData!.ClassJob));
} }
else else
{ {
@@ -284,7 +284,7 @@ public sealed class MacroList : Window, IDisposable
var pos = ImGui.GetCursorPos(); var pos = ImGui.GetCursorPos();
ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight), default, Vector2.One, new(1, 1, 1, .5f)); ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight), default, Vector2.One, new(1, 1, 1, .5f));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"{macro.Actions[i].GetName(RecipeData!.ClassJob)}\nand {amtMore} more"); ImGuiUtils.Tooltip($"{macro.Actions[i].GetName(RecipeData!.ClassJob)}\nand {amtMore} more");
ImGui.SetCursorPos(pos); ImGui.SetCursorPos(pos);
ImGui.GetWindowDrawList().AddRectFilled(ImGui.GetCursorScreenPos(), ImGui.GetCursorScreenPos() + new Vector2(miniRowHeight), ImGui.GetColorU32(ImGuiCol.FrameBg), miniRowHeight / 8f); ImGui.GetWindowDrawList().AddRectFilled(ImGui.GetCursorScreenPos(), ImGui.GetCursorScreenPos() + new Vector2(miniRowHeight), ImGui.GetColorU32(ImGuiCol.FrameBg), miniRowHeight / 8f);
ImGui.GetWindowDrawList().AddTextClippedEx(ImGui.GetCursorScreenPos(), ImGui.GetCursorScreenPos() + new Vector2(miniRowHeight), $"+{amtMore}", null, new(.5f), null); ImGui.GetWindowDrawList().AddTextClippedEx(ImGui.GetCursorScreenPos(), ImGui.GetCursorScreenPos() + new Vector2(miniRowHeight), $"+{amtMore}", null, new(.5f), null);
+20 -20
View File
@@ -297,7 +297,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
{ {
ImGui.Text(levelText); ImGui.Text(levelText);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"CLvl {Gearsets.CalculateCLvl(level)}"); ImGuiUtils.Tooltip($"CLvl {Gearsets.CalculateCLvl(level)}");
ImGui.SameLine(0, 3); ImGui.SameLine(0, 3);
} }
@@ -309,7 +309,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.SameLine(0, 3); ImGui.SameLine(0, 3);
ImGui.Image(SplendorousBadge.ImGuiHandle, new Vector2(imageSize)); ImGui.Image(SplendorousBadge.ImGuiHandle, new Vector2(imageSize));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Splendorous Tool"); ImGuiUtils.Tooltip($"Splendorous Tool");
} }
if (hasSpecialist) if (hasSpecialist)
@@ -317,7 +317,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.SameLine(0, 3); ImGui.SameLine(0, 3);
ImGui.Image(SpecialistBadge.ImGuiHandle, new Vector2(imageSize), Vector2.Zero, Vector2.One, new(0.99f, 0.97f, 0.62f, 1f)); ImGui.Image(SpecialistBadge.ImGuiHandle, new Vector2(imageSize), Vector2.Zero, Vector2.One, new(0.99f, 0.97f, 0.62f, 1f));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Specialist"); ImGuiUtils.Tooltip($"Specialist");
} }
if (shouldHaveManip) if (shouldHaveManip)
@@ -325,7 +325,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.SameLine(0, 3); ImGui.SameLine(0, 3);
ImGui.Image(NoManipulationBadge.ImGuiHandle, new Vector2(imageSize)); ImGui.Image(NoManipulationBadge.ImGuiHandle, new Vector2(imageSize));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"No Manipulation (Missing Job Quest)"); ImGuiUtils.Tooltip($"No Manipulation (Missing Job Quest)");
} }
} }
@@ -348,7 +348,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
if (ImGuiComponents.IconButton(FontAwesomeIcon.Flag)) if (ImGuiComponents.IconButton(FontAwesomeIcon.Flag))
Service.GameGui.OpenMapWithMapLink(mapPayload); Service.GameGui.OpenMapWithMapLink(mapPayload);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Open in map"); ImGuiUtils.Tooltip("Open in map");
ImGuiUtils.TextCentered($"{questTerritory} ({questLocation.X:0.0}, {questLocation.Y:0.0})"); ImGuiUtils.TextCentered($"{questTerritory} ({questLocation.X:0.0}, {questLocation.Y:0.0})");
} }
@@ -362,7 +362,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
if (ImGuiUtils.ButtonCentered("Switch Job")) if (ImGuiUtils.ButtonCentered("Switch Job"))
RaptureGearsetModule.Instance()->EquipGearset(gearsetId.Value); RaptureGearsetModule.Instance()->EquipGearset(gearsetId.Value);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Swap to gearset {gearsetId + 1}"); ImGuiUtils.Tooltip($"Swap to gearset {gearsetId + 1}");
} }
else else
ImGuiUtils.TextCentered($"You do not have any {RecipeData.ClassJob.GetName().ToLowerInvariant()} gearsets."); ImGuiUtils.TextCentered($"You do not have any {RecipeData.ClassJob.GetName().ToLowerInvariant()} gearsets.");
@@ -383,7 +383,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
if (ImGuiComponents.IconButton(FontAwesomeIcon.Flag)) if (ImGuiComponents.IconButton(FontAwesomeIcon.Flag))
Service.GameGui.OpenMapWithMapLink(mapPayload); Service.GameGui.OpenMapWithMapLink(mapPayload);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Open in map"); ImGuiUtils.Tooltip("Open in map");
ImGuiUtils.TextCentered($"{vendorTerritory} ({vendorLoation.X:0.0}, {vendorLoation.Y:0.0})"); ImGuiUtils.TextCentered($"{vendorTerritory} ({vendorLoation.X:0.0}, {vendorLoation.Y:0.0})");
} }
@@ -491,7 +491,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.SameLine(0, 5); ImGui.SameLine(0, 5);
ImGui.Text(textLevel); ImGui.Text(textLevel);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"RLvl {RecipeData.RecipeInfo.RLvl}"); ImGuiUtils.Tooltip($"RLvl {RecipeData.RecipeInfo.RLvl}");
if (textStarsSize != Vector2.Zero) if (textStarsSize != Vector2.Zero)
{ {
@@ -506,7 +506,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset);
ImGui.Image(CollectibleBadge.ImGuiHandle, badgeSize); ImGui.Image(CollectibleBadge.ImGuiHandle, badgeSize);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Collectible"); ImGuiUtils.Tooltip($"Collectible");
} }
if (isExpert) if (isExpert)
@@ -515,7 +515,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset); ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset);
ImGui.Image(ExpertBadge.ImGuiHandle, badgeSize); ImGui.Image(ExpertBadge.ImGuiHandle, badgeSize);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Expert Recipe"); ImGuiUtils.Tooltip($"Expert Recipe");
} }
} }
@@ -592,7 +592,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Quality)); ImGui.GetColorU32(Colors.Quality));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Quality: {macro.State.Quality} / {macro.State.Input.Recipe.MaxQuality}"); ImGuiUtils.Tooltip($"Quality: {macro.State.Quality} / {macro.State.Input.Recipe.MaxQuality}");
} }
else else
{ {
@@ -603,7 +603,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Progress)); ImGui.GetColorU32(Colors.Progress));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Progress: {macro.State.Progress} / {macro.State.Input.Recipe.MaxProgress}"); ImGuiUtils.Tooltip($"Progress: {macro.State.Progress} / {macro.State.Input.Recipe.MaxProgress}");
} }
} }
else else
@@ -615,7 +615,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Progress)); ImGui.GetColorU32(Colors.Progress));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Progress: {macro.State.Progress} / {macro.State.Input.Recipe.MaxProgress}"); ImGuiUtils.Tooltip($"Progress: {macro.State.Progress} / {macro.State.Input.Recipe.MaxProgress}");
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
ImGuiUtils.ArcProgress( ImGuiUtils.ArcProgress(
@@ -625,7 +625,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Quality)); ImGui.GetColorU32(Colors.Quality));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Quality: {macro.State.Quality} / {macro.State.Input.Recipe.MaxQuality}"); ImGuiUtils.Tooltip($"Quality: {macro.State.Quality} / {macro.State.Input.Recipe.MaxQuality}");
ImGuiUtils.ArcProgress((float)macro.State.Durability / macro.State.Input.Recipe.MaxDurability, ImGuiUtils.ArcProgress((float)macro.State.Durability / macro.State.Input.Recipe.MaxDurability,
miniRowHeight / 2f, miniRowHeight / 2f,
@@ -633,7 +633,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.Durability)); ImGui.GetColorU32(Colors.Durability));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Remaining Durability: {macro.State.Durability} / {macro.State.Input.Recipe.MaxDurability}"); ImGuiUtils.Tooltip($"Remaining Durability: {macro.State.Durability} / {macro.State.Input.Recipe.MaxDurability}");
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
ImGuiUtils.ArcProgress( ImGuiUtils.ArcProgress(
@@ -643,7 +643,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(ImGuiCol.TableBorderLight),
ImGui.GetColorU32(Colors.CP)); ImGui.GetColorU32(Colors.CP));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Remaining CP: {macro.State.CP} / {macro.State.Input.Stats.CP}"); ImGuiUtils.Tooltip($"Remaining CP: {macro.State.CP} / {macro.State.Input.Stats.CP}");
} }
} }
@@ -652,11 +652,11 @@ public sealed unsafe class RecipeNote : Window, IDisposable
if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Edit, miniRowHeight)) if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Edit, miniRowHeight))
Service.Plugin.OpenMacroEditor(CharacterStats!, RecipeData!, new(Service.ClientState.LocalPlayer!.StatusList), macro.Actions, setter); Service.Plugin.OpenMacroEditor(CharacterStats!, RecipeData!, new(Service.ClientState.LocalPlayer!.StatusList), macro.Actions, setter);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Open in Simulator"); ImGuiUtils.Tooltip("Open in Simulator");
if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Paste, miniRowHeight)) if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Paste, miniRowHeight))
Service.Plugin.CopyMacro(macro.Actions); Service.Plugin.CopyMacro(macro.Actions);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Copy to Clipboard"); ImGuiUtils.Tooltip("Copy to Clipboard");
} }
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@@ -674,7 +674,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
{ {
ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight)); ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(macro.Actions[i].GetName(RecipeData!.ClassJob)); ImGuiUtils.Tooltip(macro.Actions[i].GetName(RecipeData!.ClassJob));
} }
else else
{ {
@@ -682,7 +682,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
var pos = ImGui.GetCursorPos(); var pos = ImGui.GetCursorPos();
ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight), default, Vector2.One, new(1, 1, 1, .5f)); ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight), default, Vector2.One, new(1, 1, 1, .5f));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"{macro.Actions[i].GetName(RecipeData!.ClassJob)}\nand {amtMore} more"); ImGuiUtils.Tooltip($"{macro.Actions[i].GetName(RecipeData!.ClassJob)}\nand {amtMore} more");
ImGui.SetCursorPos(pos); ImGui.SetCursorPos(pos);
ImGui.GetWindowDrawList().AddRectFilled(ImGui.GetCursorScreenPos(), ImGui.GetCursorScreenPos() + new Vector2(miniRowHeight), ImGui.GetColorU32(ImGuiCol.FrameBg), miniRowHeight / 8f); ImGui.GetWindowDrawList().AddRectFilled(ImGui.GetCursorScreenPos(), ImGui.GetCursorScreenPos() + new Vector2(miniRowHeight), ImGui.GetColorU32(ImGuiCol.FrameBg), miniRowHeight / 8f);
ImGui.GetWindowDrawList().AddTextClippedEx(ImGui.GetCursorScreenPos(), ImGui.GetCursorScreenPos() + new Vector2(miniRowHeight), $"+{amtMore}", null, new(.5f), null); ImGui.GetWindowDrawList().AddTextClippedEx(ImGui.GetCursorScreenPos(), ImGui.GetCursorScreenPos() + new Vector2(miniRowHeight), $"+{amtMore}", null, new(.5f), null);
+57 -57
View File
@@ -59,7 +59,7 @@ public sealed class Settings : Window, IDisposable
isDirty = true; isDirty = true;
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(tooltip); ImGuiUtils.TooltipWrapped(tooltip);
} }
private static void DrawOption<T>(string label, string tooltip, T value, T min, T max, Action<T> setter, ref bool isDirty) where T : struct, INumber<T> private static void DrawOption<T>(string label, string tooltip, T value, T min, T max, Action<T> setter, ref bool isDirty) where T : struct, INumber<T>
@@ -79,7 +79,7 @@ public sealed class Settings : Window, IDisposable
} }
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(tooltip); ImGuiUtils.TooltipWrapped(tooltip);
} }
private static void DrawOption<T>(string label, string tooltip, Func<T, string> getName, Func<T, string> getTooltip, T value, Action<T> setter, ref bool isDirty) where T : struct, Enum private static void DrawOption<T>(string label, string tooltip, Func<T, string> getName, Func<T, string> getTooltip, T value, Action<T> setter, ref bool isDirty) where T : struct, Enum
@@ -97,12 +97,12 @@ public sealed class Settings : Window, IDisposable
isDirty = true; isDirty = true;
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(getTooltip(type)); ImGuiUtils.TooltipWrapped(getTooltip(type));
} }
} }
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip(tooltip); ImGuiUtils.TooltipWrapped(tooltip);
} }
private static string GetAlgorithmName(SolverAlgorithm algorithm) => private static string GetAlgorithmName(SolverAlgorithm algorithm) =>
@@ -121,11 +121,11 @@ public sealed class Settings : Window, IDisposable
{ {
SolverAlgorithm.Oneshot => "Run through all iterations and pick the best macro", SolverAlgorithm.Oneshot => "Run through all iterations and pick the best macro",
SolverAlgorithm.OneshotForked => "Oneshot, but using multiple solvers simultaneously", SolverAlgorithm.OneshotForked => "Oneshot, but using multiple solvers simultaneously",
SolverAlgorithm.Stepwise => "Run through all iterations and pick the next best step,\n" + SolverAlgorithm.Stepwise => "Run through all iterations and pick the next best step, " +
"and repeat using previous steps as a starting point", "and repeat using previous steps as a starting point",
SolverAlgorithm.StepwiseForked => "Stepwise, but using multiple solvers simultaneously", SolverAlgorithm.StepwiseForked => "Stepwise, but using multiple solvers simultaneously",
SolverAlgorithm.StepwiseFurcated => "Stepwise Forked, but the top N next best steps are\n" + SolverAlgorithm.StepwiseFurcated => "Stepwise Forked, but the top N next best steps are " +
"selected from the solvers, and each one is equally\n" + "selected from the solvers, and each one is equally " +
"used as a starting point", "used as a starting point",
_ => "Unknown" _ => "Unknown"
}; };
@@ -142,7 +142,7 @@ public sealed class Settings : Window, IDisposable
private static string GetCopyTypeTooltip(MacroCopyConfiguration.CopyType type) => private static string GetCopyTypeTooltip(MacroCopyConfiguration.CopyType type) =>
type switch type switch
{ {
MacroCopyConfiguration.CopyType.OpenWindow => "Open a dedicated window with all macros being copied.\n" + MacroCopyConfiguration.CopyType.OpenWindow => "Open a dedicated window with all macros being copied. " +
"Copy, view, and choose at your own leisure.", "Copy, view, and choose at your own leisure.",
MacroCopyConfiguration.CopyType.CopyToMacro => "Copy directly to the game's macro system.", MacroCopyConfiguration.CopyType.CopyToMacro => "Copy directly to the game's macro system.",
MacroCopyConfiguration.CopyType.CopyToClipboard => "Copy to your clipboard. Macros are separated by a blank line.", MacroCopyConfiguration.CopyType.CopyToClipboard => "Copy to your clipboard. Macros are separated by a blank line.",
@@ -175,8 +175,8 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Enable Synthesis Helper", "Enable Synthesis Helper",
"Adds a helper next to your synthesis window to help solve for the best craft.\n" + "Adds a helper next to your synthesis window to help solve for the best craft. " +
"Extremely useful for expert recipes, where the condition can greatly affect\n" + "Extremely useful for expert recipes, where the condition can greatly affect " +
"which actions you take.", "which actions you take.",
Config.EnableSynthHelper, Config.EnableSynthHelper,
v => Config.EnableSynthHelper = v, v => Config.EnableSynthHelper = v,
@@ -185,8 +185,8 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Show Only One Macro Stat in Crafting Log", "Show Only One Macro Stat in Crafting Log",
"Only one stat will be shown for a macro. If a craft will be finished, quality\n" + "Only one stat will be shown for a macro. If a craft will be finished, quality " +
"is shown. Otherwise, progress is shown. Durability and remaining CP will be\n" + "is shown. Otherwise, progress is shown. Durability and remaining CP will be " +
"hidden.", "hidden.",
Config.ShowOptimalMacroStat, Config.ShowOptimalMacroStat,
v => Config.ShowOptimalMacroStat = v, v => Config.ShowOptimalMacroStat = v,
@@ -195,8 +195,8 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Reliability Trial Count", "Reliability Trial Count",
"When testing for reliability of a macro in the editor, this many trials will be\n" + "When testing for reliability of a macro in the editor, this many trials will be " +
"run. You should set this value to at least 100 to get a reliable spread of data.\n" + "run. You should set this value to at least 100 to get a reliable spread of data. " +
"If it's too low, you may not find an outlier, and the average might be skewed.", "If it's too low, you may not find an outlier, and the average might be skewed.",
Config.ReliabilitySimulationCount, Config.ReliabilitySimulationCount,
5, 5,
@@ -231,7 +231,7 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Copy to Shared Macros", "Copy to Shared Macros",
"Copy to the shared macros tab. Leaving this unchecked copies to the\n" + "Copy to the shared macros tab. Leaving this unchecked copies to the " +
"individual tab.", "individual tab.",
Config.MacroCopy.SharedMacro, Config.MacroCopy.SharedMacro,
v => Config.MacroCopy.SharedMacro = v, v => Config.MacroCopy.SharedMacro = v,
@@ -240,7 +240,7 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Macro Number", "Macro Number",
"The # of the macro to being copying to. Subsequent macros will be\n" + "The # of the macro to being copying to. Subsequent macros will be " +
"copied relative to this macro.", "copied relative to this macro.",
Config.MacroCopy.StartMacroIdx, Config.MacroCopy.StartMacroIdx,
0, 99, 0, 99,
@@ -250,7 +250,7 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Max Macro Copy Count", "Max Macro Copy Count",
"The maximum number of macros to be copied. Any more and a window is\n" + "The maximum number of macros to be copied. Any more and a window is " +
"displayed with the rest of them.", "displayed with the rest of them.",
Config.MacroCopy.MaxMacroCount, Config.MacroCopy.MaxMacroCount,
1, 99, 1, 99,
@@ -261,8 +261,8 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Use Macro Chain's /nextmacro", "Use Macro Chain's /nextmacro",
"Replaces the last step with /nextmacro to run the next macro\n" + "Replaces the last step with /nextmacro to run the next macro " +
"automatically. Overrides Add End Notification except for the\n" + "automatically. Overrides Add End Notification except for the " +
"last macro.", "last macro.",
Config.MacroCopy.UseNextMacro, Config.MacroCopy.UseNextMacro,
v => Config.MacroCopy.UseNextMacro = v, v => Config.MacroCopy.UseNextMacro = v,
@@ -278,12 +278,12 @@ public sealed class Settings : Window, IDisposable
ImGui.Text(FontAwesomeIcon.ExclamationCircle.ToIconString()); ImGui.Text(FontAwesomeIcon.ExclamationCircle.ToIconString());
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Macro Chain is not installed"); ImGuiUtils.Tooltip("Macro Chain is not installed");
} }
DrawOption( DrawOption(
"Add Macro Lock", "Add Macro Lock",
"Adds /mlock to the beginning of every macro. Prevents other\n" + "Adds /mlock to the beginning of every macro. Prevents other " +
"macros from being run.", "macros from being run.",
Config.MacroCopy.UseMacroLock, Config.MacroCopy.UseMacroLock,
v => Config.MacroCopy.UseMacroLock = v, v => Config.MacroCopy.UseMacroLock = v,
@@ -305,7 +305,7 @@ public sealed class Settings : Window, IDisposable
{ {
DrawOption( DrawOption(
"Force Notification", "Force Notification",
"Prioritize always having a notification sound at the end of\n" + "Prioritize always having a notification sound at the end of " +
"every macro. Keeping this off prevents macros with only 1 action.", "every macro. Keeping this off prevents macros with only 1 action.",
Config.MacroCopy.ForceNotification, Config.MacroCopy.ForceNotification,
v => Config.MacroCopy.ForceNotification = v, v => Config.MacroCopy.ForceNotification = v,
@@ -313,7 +313,7 @@ public sealed class Settings : Window, IDisposable
); );
} }
if (!isForceUseful && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) if (!isForceUseful && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
ImGui.SetTooltip("Only useful when Combine Macro is off"); ImGuiUtils.Tooltip("Only useful when Combine Macro is off");
DrawOption( DrawOption(
"Add Notification Sound", "Add Notification Sound",
@@ -395,9 +395,9 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Algorithm", "Algorithm",
"The algorithm to use when solving for a macro. Different\n" + "The algorithm to use when solving for a macro. Different " +
"algorithms provide different pros and cons for using them.\n" + "algorithms provide different pros and cons for using them. " +
"By far, the Stepwise Furcated algorithm provides the best\n" + "By far, the Stepwise Furcated algorithm provides the best " +
"results, especially for very difficult crafts.", "results, especially for very difficult crafts.",
GetAlgorithmName, GetAlgorithmName,
GetAlgorithmTooltip, GetAlgorithmTooltip,
@@ -408,9 +408,9 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Iterations", "Iterations",
"The total number of iterations to run per crafting step.\n" + "The total number of iterations to run per crafting step. " +
"Higher values require more computational power. Higher values\n" + "Higher values require more computational power. Higher values " +
"also may decrease variance, so other values should be tweaked\n" + "also may decrease variance, so other values should be tweaked " +
"as necessary to get a more favorable outcome.", "as necessary to get a more favorable outcome.",
config.Iterations, config.Iterations,
1000, 1000,
@@ -421,10 +421,10 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Max Step Count", "Max Step Count",
"The maximum number of crafting steps; this is generally the only\n" + "The maximum number of crafting steps; this is generally the only " +
"setting you should change, and it should be set to around 5 steps\n" + "setting you should change, and it should be set to around 5 steps " +
"more than what you'd expect. If this value is too low, the solver\n" + "more than what you'd expect. If this value is too low, the solver " +
"won't learn much per iteration; too high and it will waste time\n" + "won't learn much per iteration; too high and it will waste time " +
"on useless extra steps.", "on useless extra steps.",
config.MaxStepCount, config.MaxStepCount,
1, 1,
@@ -435,8 +435,8 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Exploration Constant", "Exploration Constant",
"A constant that decides how often the solver will explore new,\n" + "A constant that decides how often the solver will explore new, " +
"possibly good paths. If this value is too high,\n" + "possibly good paths. If this value is too high, " +
"moves will mostly be decided at random.", "moves will mostly be decided at random.",
config.ExplorationConstant, config.ExplorationConstant,
0, 0,
@@ -447,9 +447,9 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Score Weighting Constant", "Score Weighting Constant",
"A constant ranging from 0 to 1 that configures how the solver\n" + "A constant ranging from 0 to 1 that configures how the solver " +
"scores and picks paths to travel to next. A value of 0 means\n" + "scores and picks paths to travel to next. A value of 0 means " +
"actions will be chosen based on their average outcome, whereas\n" + "actions will be chosen based on their average outcome, whereas " +
"1 uses their best outcome achieved so far.", "1 uses their best outcome achieved so far.",
config.MaxScoreWeightingConstant, config.MaxScoreWeightingConstant,
0, 0,
@@ -461,10 +461,10 @@ public sealed class Settings : Window, IDisposable
using (var d = ImRaii.Disabled(config.Algorithm is not (SolverAlgorithm.OneshotForked or SolverAlgorithm.StepwiseForked or SolverAlgorithm.StepwiseFurcated))) using (var d = ImRaii.Disabled(config.Algorithm is not (SolverAlgorithm.OneshotForked or SolverAlgorithm.StepwiseForked or SolverAlgorithm.StepwiseFurcated)))
DrawOption( DrawOption(
"Max Core Count", "Max Core Count",
"The number of cores to use when solving. You should use as many\n" + "The number of cores to use when solving. You should use as many " +
"as you can. If it's too high, it will have an effect on your gameplay\n" + "as you can. If it's too high, it will have an effect on your gameplay " +
$"experience. A good estimate would be 1 or 2 cores less than your\n" + $"experience. A good estimate would be 1 or 2 cores less than your " +
$"system (FYI, you have {Environment.ProcessorCount} cores), but make sure to accomodate\n" + $"system (FYI, you have {Environment.ProcessorCount} cores), but make sure to accomodate " +
$"for any other tasks you have in the background, if you have any.\n" + $"for any other tasks you have in the background, if you have any.\n" +
"(Only used in the Forked and Furcated algorithms)", "(Only used in the Forked and Furcated algorithms)",
config.MaxThreadCount, config.MaxThreadCount,
@@ -477,11 +477,11 @@ public sealed class Settings : Window, IDisposable
using (var d = ImRaii.Disabled(config.Algorithm is not (SolverAlgorithm.OneshotForked or SolverAlgorithm.StepwiseForked or SolverAlgorithm.StepwiseFurcated))) using (var d = ImRaii.Disabled(config.Algorithm is not (SolverAlgorithm.OneshotForked or SolverAlgorithm.StepwiseForked or SolverAlgorithm.StepwiseFurcated)))
DrawOption( DrawOption(
"Fork Count", "Fork Count",
"Split the number of iterations across different solvers. In general,\n" + "Split the number of iterations across different solvers. In general, " +
"you should increase this value to at least the number of cores in\n" + "you should increase this value to at least the number of cores in " +
$"your system (FYI, you have {Environment.ProcessorCount} cores) to attain the most speedup.\n" + $"your system (FYI, you have {Environment.ProcessorCount} cores) to attain the most speedup. " +
"The higher the number, the more chance you have of finding a\n" + "The higher the number, the more chance you have of finding a " +
"better local maximum; this concept similar but not equivalent\n" + "better local maximum; this concept similar but not equivalent " +
"to the exploration constant.\n" + "to the exploration constant.\n" +
"(Only used in the Forked and Furcated algorithms)", "(Only used in the Forked and Furcated algorithms)",
config.ForkCount, config.ForkCount,
@@ -494,8 +494,8 @@ public sealed class Settings : Window, IDisposable
using (var d = ImRaii.Disabled(config.Algorithm is not SolverAlgorithm.StepwiseFurcated)) using (var d = ImRaii.Disabled(config.Algorithm is not SolverAlgorithm.StepwiseFurcated))
DrawOption( DrawOption(
"Furcated Action Count", "Furcated Action Count",
"On every craft step, pick this many top solutions and use them as\n" + "On every craft step, pick this many top solutions and use them as " +
"the input for the next craft step. For best results, use Fork Count / 2\n" + "the input for the next craft step. For best results, use Fork Count / 2 " +
"and add about 1 or 2 more if needed.\n" + "and add about 1 or 2 more if needed.\n" +
"(Only used in the Stepwise Furcated algorithm)", "(Only used in the Stepwise Furcated algorithm)",
config.FurcatedActionCount, config.FurcatedActionCount,
@@ -510,8 +510,8 @@ public sealed class Settings : Window, IDisposable
{ {
DrawOption( DrawOption(
"Score Storage Threshold", "Score Storage Threshold",
"If a craft achieves this certain arbitrary score, the solver will\n" + "If a craft achieves this certain arbitrary score, the solver will " +
"throw away all other possible combinations in favor of that one.\n" + "throw away all other possible combinations in favor of that one. " +
"Only change this value if you absolutely know what you're doing.", "Only change this value if you absolutely know what you're doing.",
config.ScoreStorageThreshold, config.ScoreStorageThreshold,
0, 0,
@@ -522,8 +522,8 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Max Rollout Step Count", "Max Rollout Step Count",
"The maximum number of crafting steps every iteration can consider.\n" + "The maximum number of crafting steps every iteration can consider. " +
"Decreasing this value can have unintended side effects. Only change\n" + "Decreasing this value can have unintended side effects. Only change " +
"this value if you absolutely know what you're doing.", "this value if you absolutely know what you're doing.",
config.MaxRolloutStepCount, config.MaxRolloutStepCount,
1, 1,
@@ -534,8 +534,8 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Strict Actions", "Strict Actions",
"When finding the next possible actions to execute, use a heuristic\n" + "When finding the next possible actions to execute, use a heuristic " +
"to restrict which actions to attempt taking. This results in a much\n" + "to restrict which actions to attempt taking. This results in a much " +
"better macro at the cost of not finding an extremely creative one.", "better macro at the cost of not finding an extremely creative one.",
config.StrictActions, config.StrictActions,
v => config = config with { StrictActions = v }, v => config = config with { StrictActions = v },
@@ -590,7 +590,7 @@ public sealed class Settings : Window, IDisposable
DrawOption( DrawOption(
"Steps", "Steps",
"Amount of weight to give to the craft's number of steps. The lower\n" + "Amount of weight to give to the craft's number of steps. The lower " +
"the step count, the higher the score.", "the step count, the higher the score.",
config.ScoreSteps, config.ScoreSteps,
0, 0,
@@ -617,7 +617,7 @@ public sealed class Settings : Window, IDisposable
isDirty = true; isDirty = true;
} }
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Normalize all weights to sum up to 1"); ImGuiUtils.Tooltip("Normalize all weights to sum up to 1");
} }
if (isDirty) if (isDirty)
+8 -9
View File
@@ -236,7 +236,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
} }
if (isHovered) if (isHovered)
{ {
ImGui.SetTooltip($"{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 to Execute" : string.Empty)}");
hoveredState = state; hoveredState = state;
@@ -288,7 +288,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
{ {
var status = effect.Status(); var status = effect.Status();
using var _reset = ImRaii.DefaultFont(); using var _reset = ImRaii.DefaultFont();
ImGui.SetTooltip($"{status.Name.ToDalamudString()}\n{status.Description.ToDalamudString()}"); ImGuiUtils.Tooltip($"{status.Name.ToDalamudString()}\n{status.Description.ToDalamudString()}");
} }
ImGui.SameLine(); ImGui.SameLine();
} }
@@ -313,10 +313,10 @@ public sealed unsafe class SynthHelper : Window, IDisposable
else if (RecipeData.Recipe.RequiredQuality > 0) else if (RecipeData.Recipe.RequiredQuality > 0)
{ {
var qualityPercent = (float)state.Quality / RecipeData.Recipe.RequiredQuality * 100; var qualityPercent = (float)state.Quality / RecipeData.Recipe.RequiredQuality * 100;
halfBars.Add(new("Quality %%", Colors.HQ, reliability.ParamScore, qualityPercent, 100, $"{qualityPercent:0}%", null)); halfBars.Add(new("Quality %", Colors.HQ, reliability.ParamScore, qualityPercent, 100, $"{qualityPercent:0}%", null));
} }
else if (RecipeData.RecipeInfo.MaxQuality > 0) else if (RecipeData.RecipeInfo.MaxQuality > 0)
halfBars.Add(new("HQ %%", Colors.HQ, reliability.ParamScore, state.HQPercent, 100, $"{state.HQPercent}%", null)); halfBars.Add(new("HQ %", Colors.HQ, reliability.ParamScore, state.HQPercent, 100, $"{state.HQPercent}%", null));
if (halfBars.Count > 1) if (halfBars.Count > 1)
{ {
@@ -350,7 +350,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
using (var color = ImRaii.PushColor(ImGuiCol.PlotHistogram, ImGuiColors.DalamudGrey3)) using (var color = ImRaii.PushColor(ImGuiCol.PlotHistogram, ImGuiColors.DalamudGrey3))
ImGui.ProgressBar(fraction, new(progressWidth, ImGui.GetFrameHeight()), string.Empty); ImGui.ProgressBar(fraction, new(progressWidth, ImGui.GetFrameHeight()), string.Empty);
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}"); ImGuiUtils.Tooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}");
ImGui.SameLine(0, spacing); ImGui.SameLine(0, spacing);
ImGui.AlignTextToFramePadding(); ImGui.AlignTextToFramePadding();
ImGuiUtils.TextRight($"{fraction * 100:0}%", percentWidth); ImGuiUtils.TextRight($"{fraction * 100:0}%", percentWidth);
@@ -365,8 +365,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
using var _disabled = ImRaii.Disabled(); using var _disabled = ImRaii.Disabled();
ImGui.Button("Stopping", new(-1, 0)); ImGui.Button("Stopping", new(-1, 0));
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("This might could a while, sorry! Please report\n" + ImGuiUtils.TooltipWrapped("This might could a while, sorry! Please report if this takes longer than a second.");
"if this takes longer than a second.");
} }
else else
{ {
@@ -379,8 +378,8 @@ public sealed unsafe class SynthHelper : Window, IDisposable
if (ImGui.Button("Retry", new(-1, 0))) if (ImGui.Button("Retry", new(-1, 0)))
CalculateBestMacro(); CalculateBestMacro();
if (ImGui.IsItemHovered()) if (ImGui.IsItemHovered())
ImGui.SetTooltip("Suggest a way to finish the crafting recipe.\n" + ImGuiUtils.TooltipWrapped("Suggest a way to finish the crafting recipe. " +
"Results aren't perfect, and levels of success\n" + "Results aren't perfect, and levels of success " +
"can vary wildly depending on the solver's settings."); "can vary wildly depending on the solver's settings.");
} }
+1 -1
View File
@@ -83,7 +83,7 @@ public abstract class BaseAction
if (!IncreasesStepCount) if (!IncreasesStepCount)
builder.AppendLine($"Does Not Increase Step Count"); builder.AppendLine($"Does Not Increase Step Count");
if (SuccessRate(s) != 1f) if (SuccessRate(s) != 1f)
builder.AppendLine($"{s.CalculateSuccessRate(SuccessRate(s)) * 100:##}%% Success Rate"); builder.AppendLine($"{s.CalculateSuccessRate(SuccessRate(s)) * 100:##}% Success Rate");
return builder.ToString(); return builder.ToString();
} }
} }