From 8f99be33f2487fd7e2ca7798de63208a5fe03d63 Mon Sep 17 00:00:00 2001 From: TehCheat Date: Sat, 27 Jun 2026 18:51:30 -0400 Subject: [PATCH] added setting to disable annoying tooltip. always draw unit outline --- AncestorQol.cs | 55 ++++++++++++++++++++++++------------------ AncestorQolSettings.cs | 1 + 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/AncestorQol.cs b/AncestorQol.cs index 21f4ef2..b0d1c94 100644 --- a/AncestorQol.cs +++ b/AncestorQol.cs @@ -136,8 +136,7 @@ public void RenderTribeTier() public void RenderUnitTier() { - if (GameController.Game.IngameState.UIHover?.Tooltip is not { IsVisible: true } && - GameController.IngameState.IngameUi.AncestorMainShopWindow is { IsVisible: true, Options: { Count: > 0 } options }) + if (GameController.IngameState.IngameUi.AncestorMainShopWindow is { IsVisible: true, Options: { Count: > 0 } options }) { foreach (var option in options) { @@ -148,31 +147,39 @@ public void RenderUnitTier() var tier = Settings.GetUnitTier(unit?.Id ?? item?.Id ?? string.Empty); var unitNote = Settings.UnitNotes.GetValueOrDefault(unit?.Id ?? item?.Id ?? string.Empty); var color = TierToColor(tier); - var tooltipDescription = (unit, item) switch - { - (_, { }) => string.Join("\n", option.Tooltip?.GetChildFromIndices(0, 0)?.Children.Where(x => x.IsVisible).Select(x => x.TextNoTags) ?? new List()), - _ => option.Tooltip?.GetChildFromIndices(0, 0)?.TextNoTags, - }; - if (string.IsNullOrWhiteSpace(tooltipDescription)) - { - tooltipDescription = CleanDescriptionRegex.Replace(unit?.Description ?? string.Empty, "$1"); - } - - tooltipDescription = SentenceSplitRegex.Replace(LineEndingRegex.Replace(tooltipDescription, "\n\n"), ".\n"); - var optionRect = option.GetClientRectCache; - var textPadding = Settings.FrameThickness + 2; - var rect = new Vector2(string.IsNullOrWhiteSpace(tooltipDescription) ? 0 : Graphics.MeasureText(tooltipDescription).X + textPadding * 2, optionRect.Height); - var topRight = optionRect.TopRight.ToVector2Num(); - Graphics.DrawBox(topRight, topRight + rect, Color.Black); - Graphics.DrawFrame(topRight, topRight + rect, color, Settings.FrameThickness); Graphics.DrawFrame(optionRect, color, Settings.FrameThickness); - Graphics.DrawText(tooltipDescription, topRight + new Vector2(textPadding), Color.White); - if (!string.IsNullOrEmpty(unitNote)) + if (GameController.Game.IngameState.UIHover?.Tooltip is not { IsVisible: true }) { - var unitNoteRect = option[2]?.GetClientRectCache ?? default; - Graphics.DrawBox(unitNoteRect, Color.Black); - Graphics.DrawText(unitNote, unitNoteRect.TopLeft.ToVector2Num()); + var tooltipDescription = (unit, item) switch + { + (_, { }) => string.Join("\n", option.Tooltip?.GetChildFromIndices(0, 0)?.Children.Where(x => x.IsVisible).Select(x => x.TextNoTags) ?? new List()), + _ => option.Tooltip?.GetChildFromIndices(0, 0)?.TextNoTags, + }; + if (string.IsNullOrWhiteSpace(tooltipDescription)) + { + tooltipDescription = CleanDescriptionRegex.Replace(unit?.Description ?? string.Empty, "$1"); + } + if (!Settings.ShowTooltip) + { + unitNote = string.Empty; + tooltipDescription = string.Empty; + } + + tooltipDescription = SentenceSplitRegex.Replace(LineEndingRegex.Replace(tooltipDescription, "\n\n"), ".\n"); + + var textPadding = Settings.FrameThickness + 2; + var rect = new Vector2(string.IsNullOrWhiteSpace(tooltipDescription) ? 0 : Graphics.MeasureText(tooltipDescription).X + textPadding * 2, optionRect.Height); + var topRight = optionRect.TopRight.ToVector2Num(); + Graphics.DrawBox(topRight, topRight + rect, Color.Black); + Graphics.DrawFrame(topRight, topRight + rect, color, Settings.FrameThickness); + Graphics.DrawText(tooltipDescription, topRight + new Vector2(textPadding), Color.White); + if (!string.IsNullOrEmpty(unitNote)) + { + var unitNoteRect = option[2]?.GetClientRectCache ?? default; + Graphics.DrawBox(unitNoteRect, Color.Black); + Graphics.DrawText(unitNote, unitNoteRect.TopLeft.ToVector2Num()); + } } } catch (Exception ex) diff --git a/AncestorQolSettings.cs b/AncestorQolSettings.cs index 0f67a3a..2330a1e 100644 --- a/AncestorQolSettings.cs +++ b/AncestorQolSettings.cs @@ -286,6 +286,7 @@ public int GetTribeRewardTier(string tribeName) public ColorNode Tier4Color { get; set; } = new(Color.Yellow); public ColorNode Tier5Color { get; set; } = new(Color.Red); public ToggleNode DrawTribeRewardFrameOverTheWholeElement { get; set; } = new ToggleNode(true); + public ToggleNode ShowTooltip { get; set; } = new ToggleNode(false); [JsonIgnore] public CustomNode Units { get; }