diff --git a/Craftimizer/ImGuiUtils.cs b/Craftimizer/ImGuiUtils.cs index d86b902..6089b70 100644 --- a/Craftimizer/ImGuiUtils.cs +++ b/Craftimizer/ImGuiUtils.cs @@ -60,7 +60,7 @@ internal static class ImGuiUtils ImGui.SameLine(0, 0); var textFrameHeight = ImGui.GetFrameHeight(); ImGui.AlignTextToFramePadding(); - ImGui.Text(name); + ImGui.TextUnformatted(name); GroupPanelLabelStack.Push((ImGui.GetItemRectMin(), ImGui.GetItemRectMax(), textFrameHeight / 2f)); // push rect to stack ImGui.SameLine(0, 0); 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); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) 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) { if (availWidth == default) diff --git a/Craftimizer/Utils/DynamicBars.cs b/Craftimizer/Utils/DynamicBars.cs index a768ba4..9e4dbcd 100644 --- a/Craftimizer/Utils/DynamicBars.cs +++ b/Craftimizer/Utils/DynamicBars.cs @@ -65,7 +65,7 @@ internal static class DynamicBars ImGui.SetCursorPos(pos); ImGuiUtils.ViolinPlot(violinData, new(barSize, ImGui.GetFrameHeight())); if (ImGui.IsItemHovered()) - ImGui.SetTooltip( + ImGuiUtils.Tooltip( $"Min: {reliability.Min}\n" + $"Med: {reliability.Median:0.##}\n" + $"Avg: {reliability.Average:0.##}\n" + diff --git a/Craftimizer/Windows/MacroClipboard.cs b/Craftimizer/Windows/MacroClipboard.cs index 989ce6a..befafb3 100644 --- a/Craftimizer/Windows/MacroClipboard.cs +++ b/Craftimizer/Windows/MacroClipboard.cs @@ -57,7 +57,7 @@ public sealed class MacroClipboard : Window, IDisposable } } if (buttonHovered) - ImGui.SetTooltip("Copy to Clipboard"); + ImGuiUtils.Tooltip("Copy to Clipboard"); ImGui.SetCursorPos(cursor); { diff --git a/Craftimizer/Windows/MacroEditor.cs b/Craftimizer/Windows/MacroEditor.cs index be947ac..0c312fa 100644 --- a/Craftimizer/Windows/MacroEditor.cs +++ b/Craftimizer/Windows/MacroEditor.cs @@ -151,7 +151,7 @@ public sealed class MacroEditor : Window, IDisposable Icon = FontAwesomeIcon.Cog, IconOffset = new(2.5f, 1), 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 }; 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 imageButtonPadding = (int)(ImGui.GetStyle().FramePadding.Y / 2f); @@ -322,7 +322,7 @@ public sealed class MacroEditor : Window, IDisposable CharacterStats = CharacterStats with { HasSplendorousBuff = !v }; } 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); bool? newIsSpecialist = null; @@ -343,7 +343,7 @@ public sealed class MacroEditor : Window, IDisposable } } if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) - ImGui.SetTooltip(v ? $"Specialist" : "Not a Specialist"); + ImGuiUtils.Tooltip(v ? $"Specialist" : "Not a Specialist"); } ImGui.SameLine(0, 5); { @@ -356,7 +356,7 @@ public sealed class MacroEditor : Window, IDisposable CharacterStats = CharacterStats with { CanUseManipulation = !v }; } 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(); @@ -365,13 +365,13 @@ public sealed class MacroEditor : Window, IDisposable var buffImageSize = new Vector2(imageSize * WellFedBadge.Width / WellFedBadge.Height, imageSize); ImGui.Image(WellFedBadge.ImGuiHandle, buffImageSize); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Food"); + ImGuiUtils.Tooltip("Food"); ImGui.SameLine(0, 5); { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); using var combo = ImRaii.Combo("##food", FormatItemBuff(Buffs.Food)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(FormatItemBuffDescription(Buffs.Food)); + ImGuiUtils.Tooltip(FormatItemBuffDescription(Buffs.Food)); if (combo) { 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)) newFoodBuff = row; if (ImGui.IsItemHovered()) - ImGui.SetTooltip(FormatItemBuffDescription(row)); + ImGuiUtils.Tooltip(FormatItemBuffDescription(row)); if (food.Item.CanBeHq) { @@ -391,7 +391,7 @@ public sealed class MacroEditor : Window, IDisposable if (ImGui.Selectable(FormatItemBuff(row), Buffs.Food == row)) newFoodBuff = row; 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); ImGui.Image(MedicatedBadge.ImGuiHandle, buffImageSize); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Medicine"); + ImGuiUtils.Tooltip("Medicine"); ImGui.SameLine(0, 5); { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); using var combo = ImRaii.Combo("##medicine", FormatItemBuff(Buffs.Medicine)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(FormatItemBuffDescription(Buffs.Medicine)); + ImGuiUtils.Tooltip(FormatItemBuffDescription(Buffs.Medicine)); if (combo) { 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)) newMedicineBuff = row; if (ImGui.IsItemHovered()) - ImGui.SetTooltip(FormatItemBuffDescription(row)); + ImGuiUtils.Tooltip(FormatItemBuffDescription(row)); if (medicine.Item.CanBeHq) { @@ -427,7 +427,7 @@ public sealed class MacroEditor : Window, IDisposable if (ImGui.Selectable(FormatItemBuff(row), Buffs.Medicine == row)) newMedicineBuff = row; 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 fcStatName = "Craftsmanship"; if (ImGui.IsItemHovered()) - ImGui.SetTooltip(fcBuffName); + ImGuiUtils.Tooltip(fcBuffName); ImGui.SameLine(0, 5); { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); using var combo = ImRaii.Combo("##fcCraftsmanship", FormatFCBuff(fcBuffName, Buffs.FC.Craftsmanship)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(FormatFCBuffDescription(fcBuffName, fcStatName, Buffs.FC.Craftsmanship)); + ImGuiUtils.Tooltip(FormatFCBuffDescription(fcBuffName, fcStatName, Buffs.FC.Craftsmanship)); if (combo) { 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)) newFCCraftsmanshipBuff = i; 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"; fcStatName = "Control"; if (ImGui.IsItemHovered()) - ImGui.SetTooltip(fcBuffName); + ImGuiUtils.Tooltip(fcBuffName); ImGui.SameLine(0, 5); { ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); using var combo = ImRaii.Combo("##fcControl", FormatFCBuff(fcBuffName, Buffs.FC.Control)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(FormatFCBuffDescription(fcBuffName, fcStatName, Buffs.FC.Control)); + ImGuiUtils.Tooltip(FormatFCBuffDescription(fcBuffName, fcStatName, Buffs.FC.Control)); if (combo) { 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)) newFCControlBuff = i; 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) s.AppendLine($"{name} +{value}"); else - s.AppendLine($"{name} +{value}%% (Max {max})"); + s.AppendLine($"{name} +{value}% (Max {max})"); } if (FoodStatus.TryGetFood(input.ItemId) is { } food) @@ -777,7 +777,7 @@ public sealed class MacroEditor : Window, IDisposable ImGui.SameLine(0, 5); ImGui.Text(textLevel); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"RLvl {RecipeData.RecipeInfo.RLvl}"); + ImGuiUtils.Tooltip($"RLvl {RecipeData.RecipeInfo.RLvl}"); if (textStarsSize != Vector2.Zero) { @@ -792,7 +792,7 @@ public sealed class MacroEditor : Window, IDisposable ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset); ImGui.Image(CollectibleBadge.ImGuiHandle, badgeSize); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Collectible"); + ImGuiUtils.Tooltip($"Collectible"); } if (isExpert) @@ -801,7 +801,7 @@ public sealed class MacroEditor : Window, IDisposable ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset); ImGui.Image(ExpertBadge.ImGuiHandle, badgeSize); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Expert Recipe"); + ImGuiUtils.Tooltip($"Expert Recipe"); } 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 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 - ImGui.SetTooltip($"{ingredient.Item.Name.ToDalamudString()}"); + ImGuiUtils.Tooltip($"{ingredient.Item.Name.ToDalamudString()}"); } ImGui.SameLine(0, 5); 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(); } 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 _source = ImRaii.DragDropSource()) @@ -1028,7 +1028,7 @@ public sealed class MacroEditor : Window, IDisposable ImGui.Text(condition.Name()); } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(condition.Description(CharacterStats.HasSplendorousBuff).Replace("%", "%%")); + ImGuiUtils.Tooltip(condition.Description(CharacterStats.HasSplendorousBuff)); ImGui.SetCursorPos(pos); ImGuiUtils.AlignRight(ImGui.GetFrameHeight(), totalSize); @@ -1045,8 +1045,8 @@ public sealed class MacroEditor : Window, IDisposable } } if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) - ImGui.SetTooltip("Condition Randomness\n" + - "Allows the condition to fluctuate randomly like a real craft.\n" + + ImGuiUtils.TooltipWrapped($"Condition Randomness{(!Service.Configuration.ConditionRandomness ? " (Disabled)" : string.Empty)}\n" + + "Allows the condition to fluctuate randomly like a real craft. " + "Turns off when generating a macro."); } var datas = new List(3) @@ -1059,10 +1059,10 @@ public sealed class MacroEditor : Window, IDisposable else if (RecipeData.Recipe.RequiredQuality > 0) { 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) - 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); ImGui.TableNextColumn(); @@ -1110,7 +1110,7 @@ public sealed class MacroEditor : Window, IDisposable { var status = effect.Status(); 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(); } @@ -1155,7 +1155,7 @@ public sealed class MacroEditor : Window, IDisposable ImGui.SetCursorPos(pos); ImGuiUtils.ViolinPlot(violinData, new(barSize, ImGui.GetFrameHeight())); if (ImGui.IsItemHovered()) - ImGui.SetTooltip( + ImGuiUtils.Tooltip( $"Min: {reliability.Min}\n" + $"Med: {reliability.Median:0.##}\n" + $"Avg: {reliability.Average:0.##}\n" + @@ -1226,7 +1226,7 @@ public sealed class MacroEditor : Window, IDisposable ImGui.PopClipRect(); } 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 _source = ImRaii.DragDropSource()) @@ -1263,7 +1263,7 @@ public sealed class MacroEditor : Window, IDisposable using (var color = ImRaii.PushColor(ImGuiCol.PlotHistogram, ImGuiColors.DalamudGrey3)) ImGui.ProgressBar(fraction, new(progressWidth, ImGui.GetFrameHeight()), string.Empty); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}"); + ImGuiUtils.Tooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}"); ImGui.SameLine(0, spacing); ImGui.AlignTextToFramePadding(); ImGuiUtils.TextRight($"{fraction * 100:0}%", percentWidth); @@ -1304,7 +1304,7 @@ public sealed class MacroEditor : Window, IDisposable using var _disabled = ImRaii.Disabled(); ImGui.Button("Stopping", new(halfWidth, height)); 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."); } else @@ -1318,15 +1318,15 @@ public sealed class MacroEditor : Window, IDisposable if (ImGui.Button(SolverStartStepCount.HasValue ? "Regenerate" : "Generate", new(halfWidth, height))) CalculateBestMacro(); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Suggest a way to finish the crafting recipe.\n" + - "Results aren't perfect, and levels of success\n" + + ImGuiUtils.Tooltip("Suggest a way to finish the crafting recipe. " + + "Results aren't perfect, and levels of success " + "can vary wildly depending on the solver's settings."); } ImGui.SameLine(); if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Paste)) Service.Plugin.CopyMacro(Macro.Actions.ToArray()); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Copy to Clipboard"); + ImGuiUtils.Tooltip("Copy to Clipboard"); ImGui.SameLine(); using (var _disabled = ImRaii.Disabled(SolverRunning)) { @@ -1334,7 +1334,7 @@ public sealed class MacroEditor : Window, IDisposable ShowImportPopup(); } if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) - ImGui.SetTooltip("Import Macro"); + ImGuiUtils.Tooltip("Import Macro"); DrawImportPopup(); ImGui.SameLine(); if (DefaultActions.Length > 0) @@ -1350,7 +1350,7 @@ public sealed class MacroEditor : Window, IDisposable } } if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) - ImGui.SetTooltip("Reset"); + ImGuiUtils.Tooltip("Reset"); } ImGui.SameLine(); using (var _disabled = ImRaii.Disabled(SolverRunning)) @@ -1362,7 +1362,7 @@ public sealed class MacroEditor : Window, IDisposable } } if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) - ImGui.SetTooltip("Clear"); + ImGuiUtils.Tooltip("Clear"); } private void ShowSaveAsPopup() diff --git a/Craftimizer/Windows/MacroList.cs b/Craftimizer/Windows/MacroList.cs index dfc1cf9..886ff0b 100644 --- a/Craftimizer/Windows/MacroList.cs +++ b/Craftimizer/Windows/MacroList.cs @@ -44,7 +44,7 @@ public sealed class MacroList : Window, IDisposable Icon = FontAwesomeIcon.Cog, IconOffset = new(2.5f, 1), 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(Colors.Quality)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Quality: {state.Quality} / {state.Input.Recipe.MaxQuality}"); + ImGuiUtils.Tooltip($"Quality: {state.Quality} / {state.Input.Recipe.MaxQuality}"); } else { @@ -190,7 +190,7 @@ public sealed class MacroList : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.Progress)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Progress: {state.Progress} / {state.Input.Recipe.MaxProgress}"); + ImGuiUtils.Tooltip($"Progress: {state.Progress} / {state.Input.Recipe.MaxProgress}"); } } else @@ -202,7 +202,7 @@ public sealed class MacroList : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.Progress)); 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); ImGuiUtils.ArcProgress( @@ -212,7 +212,7 @@ public sealed class MacroList : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.Quality)); 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, miniRowHeight / 2f, @@ -220,7 +220,7 @@ public sealed class MacroList : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.Durability)); 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); ImGuiUtils.ArcProgress( @@ -230,7 +230,7 @@ public sealed class MacroList : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.CP)); 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)) OpenEditor(macro); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Open in Simulator"); + ImGuiUtils.Tooltip("Open in Simulator"); ImGui.SameLine(0, spacing); if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.PencilAlt, miniRowHeight)) ShowRenamePopup(macro); DrawRenamePopup(macro); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Rename"); + ImGuiUtils.Tooltip("Rename"); if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Paste, miniRowHeight)) Service.Plugin.CopyMacro(macro.Actions); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Copy to Clipboard"); + ImGuiUtils.Tooltip("Copy to Clipboard"); ImGui.SameLine(0, spacing); using (var _disabled = ImRaii.Disabled(!ImGui.GetIO().KeyShift)) { @@ -258,7 +258,7 @@ public sealed class MacroList : Window, IDisposable Service.Configuration.RemoveMacro(macro); } if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) - ImGui.SetTooltip("Delete (Hold Shift)"); + ImGuiUtils.Tooltip("Delete (Hold Shift)"); } ImGui.TableNextColumn(); @@ -276,7 +276,7 @@ public sealed class MacroList : Window, IDisposable { ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(macro.Actions[i].GetName(RecipeData!.ClassJob)); + ImGuiUtils.Tooltip(macro.Actions[i].GetName(RecipeData!.ClassJob)); } else { @@ -284,7 +284,7 @@ public sealed class MacroList : Window, IDisposable var pos = ImGui.GetCursorPos(); ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight), default, Vector2.One, new(1, 1, 1, .5f)); 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.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); diff --git a/Craftimizer/Windows/RecipeNote.cs b/Craftimizer/Windows/RecipeNote.cs index 6e338cc..60f0dc6 100644 --- a/Craftimizer/Windows/RecipeNote.cs +++ b/Craftimizer/Windows/RecipeNote.cs @@ -297,7 +297,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable { ImGui.Text(levelText); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"CLvl {Gearsets.CalculateCLvl(level)}"); + ImGuiUtils.Tooltip($"CLvl {Gearsets.CalculateCLvl(level)}"); ImGui.SameLine(0, 3); } @@ -309,7 +309,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.SameLine(0, 3); ImGui.Image(SplendorousBadge.ImGuiHandle, new Vector2(imageSize)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Splendorous Tool"); + ImGuiUtils.Tooltip($"Splendorous Tool"); } if (hasSpecialist) @@ -317,7 +317,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.SameLine(0, 3); ImGui.Image(SpecialistBadge.ImGuiHandle, new Vector2(imageSize), Vector2.Zero, Vector2.One, new(0.99f, 0.97f, 0.62f, 1f)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Specialist"); + ImGuiUtils.Tooltip($"Specialist"); } if (shouldHaveManip) @@ -325,7 +325,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.SameLine(0, 3); ImGui.Image(NoManipulationBadge.ImGuiHandle, new Vector2(imageSize)); 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)) Service.GameGui.OpenMapWithMapLink(mapPayload); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Open in map"); + ImGuiUtils.Tooltip("Open in map"); 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")) RaptureGearsetModule.Instance()->EquipGearset(gearsetId.Value); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Swap to gearset {gearsetId + 1}"); + ImGuiUtils.Tooltip($"Swap to gearset {gearsetId + 1}"); } else 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)) Service.GameGui.OpenMapWithMapLink(mapPayload); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Open in map"); + ImGuiUtils.Tooltip("Open in map"); 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.Text(textLevel); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"RLvl {RecipeData.RecipeInfo.RLvl}"); + ImGuiUtils.Tooltip($"RLvl {RecipeData.RecipeInfo.RLvl}"); if (textStarsSize != Vector2.Zero) { @@ -506,7 +506,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset); ImGui.Image(CollectibleBadge.ImGuiHandle, badgeSize); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Collectible"); + ImGuiUtils.Tooltip($"Collectible"); } if (isExpert) @@ -515,7 +515,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.SetCursorPosY(ImGui.GetCursorPosY() + badgeOffset); ImGui.Image(ExpertBadge.ImGuiHandle, badgeSize); 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(Colors.Quality)); 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 { @@ -603,7 +603,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.Progress)); 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 @@ -615,7 +615,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.Progress)); 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); ImGuiUtils.ArcProgress( @@ -625,7 +625,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.Quality)); 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, miniRowHeight / 2f, @@ -633,7 +633,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.Durability)); 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); ImGuiUtils.ArcProgress( @@ -643,7 +643,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGui.GetColorU32(ImGuiCol.TableBorderLight), ImGui.GetColorU32(Colors.CP)); 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)) Service.Plugin.OpenMacroEditor(CharacterStats!, RecipeData!, new(Service.ClientState.LocalPlayer!.StatusList), macro.Actions, setter); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Open in Simulator"); + ImGuiUtils.Tooltip("Open in Simulator"); if (ImGuiUtils.IconButtonSquare(FontAwesomeIcon.Paste, miniRowHeight)) Service.Plugin.CopyMacro(macro.Actions); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Copy to Clipboard"); + ImGuiUtils.Tooltip("Copy to Clipboard"); } ImGui.TableNextColumn(); @@ -674,7 +674,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable { ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(macro.Actions[i].GetName(RecipeData!.ClassJob)); + ImGuiUtils.Tooltip(macro.Actions[i].GetName(RecipeData!.ClassJob)); } else { @@ -682,7 +682,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable var pos = ImGui.GetCursorPos(); ImGui.Image(macro.Actions[i].GetIcon(RecipeData!.ClassJob).ImGuiHandle, new(miniRowHeight), default, Vector2.One, new(1, 1, 1, .5f)); 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.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); diff --git a/Craftimizer/Windows/Settings.cs b/Craftimizer/Windows/Settings.cs index 35a1003..1fb53dd 100644 --- a/Craftimizer/Windows/Settings.cs +++ b/Craftimizer/Windows/Settings.cs @@ -59,7 +59,7 @@ public sealed class Settings : Window, IDisposable isDirty = true; } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(tooltip); + ImGuiUtils.TooltipWrapped(tooltip); } private static void DrawOption(string label, string tooltip, T value, T min, T max, Action setter, ref bool isDirty) where T : struct, INumber @@ -79,7 +79,7 @@ public sealed class Settings : Window, IDisposable } } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(tooltip); + ImGuiUtils.TooltipWrapped(tooltip); } private static void DrawOption(string label, string tooltip, Func getName, Func getTooltip, T value, Action setter, ref bool isDirty) where T : struct, Enum @@ -97,12 +97,12 @@ public sealed class Settings : Window, IDisposable isDirty = true; } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(getTooltip(type)); + ImGuiUtils.TooltipWrapped(getTooltip(type)); } } } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(tooltip); + ImGuiUtils.TooltipWrapped(tooltip); } 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.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", SolverAlgorithm.StepwiseForked => "Stepwise, but using multiple solvers simultaneously", - SolverAlgorithm.StepwiseFurcated => "Stepwise Forked, but the top N next best steps are\n" + - "selected from the solvers, and each one is equally\n" + + SolverAlgorithm.StepwiseFurcated => "Stepwise Forked, but the top N next best steps are " + + "selected from the solvers, and each one is equally " + "used as a starting point", _ => "Unknown" }; @@ -142,7 +142,7 @@ public sealed class Settings : Window, IDisposable private static string GetCopyTypeTooltip(MacroCopyConfiguration.CopyType type) => 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.", 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.", @@ -175,8 +175,8 @@ public sealed class Settings : Window, IDisposable DrawOption( "Enable Synthesis Helper", - "Adds a helper next to your synthesis window to help solve for the best craft.\n" + - "Extremely useful for expert recipes, where the condition can greatly affect\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 " + "which actions you take.", Config.EnableSynthHelper, v => Config.EnableSynthHelper = v, @@ -185,8 +185,8 @@ public sealed class Settings : Window, IDisposable DrawOption( "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" + - "is shown. Otherwise, progress is shown. Durability and remaining CP will be\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 " + "hidden.", Config.ShowOptimalMacroStat, v => Config.ShowOptimalMacroStat = v, @@ -195,8 +195,8 @@ public sealed class Settings : Window, IDisposable DrawOption( "Reliability Trial Count", - "When testing for reliability of a macro in the editor, this many trials will be\n" + - "run. You should set this value to at least 100 to get a reliable spread of data.\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. " + "If it's too low, you may not find an outlier, and the average might be skewed.", Config.ReliabilitySimulationCount, 5, @@ -231,7 +231,7 @@ public sealed class Settings : Window, IDisposable DrawOption( "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.", Config.MacroCopy.SharedMacro, v => Config.MacroCopy.SharedMacro = v, @@ -240,7 +240,7 @@ public sealed class Settings : Window, IDisposable DrawOption( "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.", Config.MacroCopy.StartMacroIdx, 0, 99, @@ -250,7 +250,7 @@ public sealed class Settings : Window, IDisposable DrawOption( "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.", Config.MacroCopy.MaxMacroCount, 1, 99, @@ -261,8 +261,8 @@ public sealed class Settings : Window, IDisposable DrawOption( "Use Macro Chain's /nextmacro", - "Replaces the last step with /nextmacro to run the next macro\n" + - "automatically. Overrides Add End Notification except for the\n" + + "Replaces the last step with /nextmacro to run the next macro " + + "automatically. Overrides Add End Notification except for the " + "last macro.", Config.MacroCopy.UseNextMacro, v => Config.MacroCopy.UseNextMacro = v, @@ -278,12 +278,12 @@ public sealed class Settings : Window, IDisposable ImGui.Text(FontAwesomeIcon.ExclamationCircle.ToIconString()); } if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Macro Chain is not installed"); + ImGuiUtils.Tooltip("Macro Chain is not installed"); } DrawOption( "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.", Config.MacroCopy.UseMacroLock, v => Config.MacroCopy.UseMacroLock = v, @@ -305,7 +305,7 @@ public sealed class Settings : Window, IDisposable { DrawOption( "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.", Config.MacroCopy.ForceNotification, v => Config.MacroCopy.ForceNotification = v, @@ -313,7 +313,7 @@ public sealed class Settings : Window, IDisposable ); } 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( "Add Notification Sound", @@ -395,9 +395,9 @@ public sealed class Settings : Window, IDisposable DrawOption( "Algorithm", - "The algorithm to use when solving for a macro. Different\n" + - "algorithms provide different pros and cons for using them.\n" + - "By far, the Stepwise Furcated algorithm provides the best\n" + + "The algorithm to use when solving for a macro. Different " + + "algorithms provide different pros and cons for using them. " + + "By far, the Stepwise Furcated algorithm provides the best " + "results, especially for very difficult crafts.", GetAlgorithmName, GetAlgorithmTooltip, @@ -408,9 +408,9 @@ public sealed class Settings : Window, IDisposable DrawOption( "Iterations", - "The total number of iterations to run per crafting step.\n" + - "Higher values require more computational power. Higher values\n" + - "also may decrease variance, so other values should be tweaked\n" + + "The total number of iterations to run per crafting step. " + + "Higher values require more computational power. Higher values " + + "also may decrease variance, so other values should be tweaked " + "as necessary to get a more favorable outcome.", config.Iterations, 1000, @@ -421,10 +421,10 @@ public sealed class Settings : Window, IDisposable DrawOption( "Max Step Count", - "The maximum number of crafting steps; this is generally the only\n" + - "setting you should change, and it should be set to around 5 steps\n" + - "more than what you'd expect. If this value is too low, the solver\n" + - "won't learn much per iteration; too high and it will waste time\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 " + + "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 " + "on useless extra steps.", config.MaxStepCount, 1, @@ -435,8 +435,8 @@ public sealed class Settings : Window, IDisposable DrawOption( "Exploration Constant", - "A constant that decides how often the solver will explore new,\n" + - "possibly good paths. If this value is too high,\n" + + "A constant that decides how often the solver will explore new, " + + "possibly good paths. If this value is too high, " + "moves will mostly be decided at random.", config.ExplorationConstant, 0, @@ -447,9 +447,9 @@ public sealed class Settings : Window, IDisposable DrawOption( "Score Weighting Constant", - "A constant ranging from 0 to 1 that configures how the solver\n" + - "scores and picks paths to travel to next. A value of 0 means\n" + - "actions will be chosen based on their average outcome, whereas\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 " + + "actions will be chosen based on their average outcome, whereas " + "1 uses their best outcome achieved so far.", config.MaxScoreWeightingConstant, 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))) DrawOption( "Max Core Count", - "The number of cores to use when solving. You should use as many\n" + - "as you can. If it's too high, it will have an effect on your gameplay\n" + - $"experience. A good estimate would be 1 or 2 cores less than your\n" + - $"system (FYI, you have {Environment.ProcessorCount} cores), but make sure to accomodate\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 " + + $"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 " + $"for any other tasks you have in the background, if you have any.\n" + "(Only used in the Forked and Furcated algorithms)", 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))) DrawOption( "Fork Count", - "Split the number of iterations across different solvers. In general,\n" + - "you should increase this value to at least the number of cores in\n" + - $"your system (FYI, you have {Environment.ProcessorCount} cores) to attain the most speedup.\n" + - "The higher the number, the more chance you have of finding a\n" + - "better local maximum; this concept similar but not equivalent\n" + + "Split the number of iterations across different solvers. In general, " + + "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. " + + "The higher the number, the more chance you have of finding a " + + "better local maximum; this concept similar but not equivalent " + "to the exploration constant.\n" + "(Only used in the Forked and Furcated algorithms)", config.ForkCount, @@ -494,8 +494,8 @@ public sealed class Settings : Window, IDisposable using (var d = ImRaii.Disabled(config.Algorithm is not SolverAlgorithm.StepwiseFurcated)) DrawOption( "Furcated Action Count", - "On every craft step, pick this many top solutions and use them as\n" + - "the input for the next craft step. For best results, use Fork Count / 2\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 " + "and add about 1 or 2 more if needed.\n" + "(Only used in the Stepwise Furcated algorithm)", config.FurcatedActionCount, @@ -510,8 +510,8 @@ public sealed class Settings : Window, IDisposable { DrawOption( "Score Storage Threshold", - "If a craft achieves this certain arbitrary score, the solver will\n" + - "throw away all other possible combinations in favor of that one.\n" + + "If a craft achieves this certain arbitrary score, the solver will " + + "throw away all other possible combinations in favor of that one. " + "Only change this value if you absolutely know what you're doing.", config.ScoreStorageThreshold, 0, @@ -522,8 +522,8 @@ public sealed class Settings : Window, IDisposable DrawOption( "Max Rollout Step Count", - "The maximum number of crafting steps every iteration can consider.\n" + - "Decreasing this value can have unintended side effects. Only change\n" + + "The maximum number of crafting steps every iteration can consider. " + + "Decreasing this value can have unintended side effects. Only change " + "this value if you absolutely know what you're doing.", config.MaxRolloutStepCount, 1, @@ -534,8 +534,8 @@ public sealed class Settings : Window, IDisposable DrawOption( "Strict Actions", - "When finding the next possible actions to execute, use a heuristic\n" + - "to restrict which actions to attempt taking. This results in a much\n" + + "When finding the next possible actions to execute, use a heuristic " + + "to restrict which actions to attempt taking. This results in a much " + "better macro at the cost of not finding an extremely creative one.", config.StrictActions, v => config = config with { StrictActions = v }, @@ -590,7 +590,7 @@ public sealed class Settings : Window, IDisposable DrawOption( "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.", config.ScoreSteps, 0, @@ -617,7 +617,7 @@ public sealed class Settings : Window, IDisposable isDirty = true; } 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) diff --git a/Craftimizer/Windows/SynthHelper.cs b/Craftimizer/Windows/SynthHelper.cs index 0cf46be..66ada5d 100644 --- a/Craftimizer/Windows/SynthHelper.cs +++ b/Craftimizer/Windows/SynthHelper.cs @@ -236,7 +236,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable } if (isHovered) { - ImGui.SetTooltip($"{action.GetName(RecipeData!.ClassJob)}\n" + + ImGuiUtils.Tooltip($"{action.GetName(RecipeData!.ClassJob)}\n" + $"{actionBase.GetTooltip(CreateSim(lastState), true)}" + $"{(canExecute && i == 0 ? "Click to Execute" : string.Empty)}"); hoveredState = state; @@ -288,7 +288,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable { var status = effect.Status(); 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(); } @@ -313,10 +313,10 @@ public sealed unsafe class SynthHelper : Window, IDisposable else if (RecipeData.Recipe.RequiredQuality > 0) { 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) - 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) { @@ -350,7 +350,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable using (var color = ImRaii.PushColor(ImGuiCol.PlotHistogram, ImGuiColors.DalamudGrey3)) ImGui.ProgressBar(fraction, new(progressWidth, ImGui.GetFrameHeight()), string.Empty); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}"); + ImGuiUtils.Tooltip($"Solver Progress: {solver.ProgressValue} / {solver.ProgressMax}"); ImGui.SameLine(0, spacing); ImGui.AlignTextToFramePadding(); ImGuiUtils.TextRight($"{fraction * 100:0}%", percentWidth); @@ -365,8 +365,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable using var _disabled = ImRaii.Disabled(); ImGui.Button("Stopping", new(-1, 0)); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("This might could a while, sorry! Please report\n" + - "if this takes longer than a second."); + ImGuiUtils.TooltipWrapped("This might could a while, sorry! Please report if this takes longer than a second."); } else { @@ -379,8 +378,8 @@ public sealed unsafe class SynthHelper : Window, IDisposable if (ImGui.Button("Retry", new(-1, 0))) CalculateBestMacro(); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Suggest a way to finish the crafting recipe.\n" + - "Results aren't perfect, and levels of success\n" + + ImGuiUtils.TooltipWrapped("Suggest a way to finish the crafting recipe. " + + "Results aren't perfect, and levels of success " + "can vary wildly depending on the solver's settings."); } diff --git a/Simulator/Actions/BaseAction.cs b/Simulator/Actions/BaseAction.cs index 8e006be..07c4cee 100644 --- a/Simulator/Actions/BaseAction.cs +++ b/Simulator/Actions/BaseAction.cs @@ -83,7 +83,7 @@ public abstract class BaseAction if (!IncreasesStepCount) builder.AppendLine($"Does Not Increase Step Count"); 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(); } }