From d4de8524c6abb9c6af3bf2f9ee6fe62d9b1f6f4a Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Tue, 19 Aug 2025 00:07:53 -0700 Subject: [PATCH] No more ExtractText or soft hyphens --- Craftimizer/SimulatorUtils.cs | 14 +++++++------- Craftimizer/Utils/Gearsets.cs | 2 +- Craftimizer/Utils/ReadOnlySeStringExtensions.cs | 12 ------------ Craftimizer/Windows/MacroEditor.cs | 12 ++++++------ Craftimizer/Windows/RecipeNote.cs | 6 +++--- Craftimizer/Windows/SynthHelper.cs | 2 +- 6 files changed, 18 insertions(+), 30 deletions(-) delete mode 100644 Craftimizer/Utils/ReadOnlySeStringExtensions.cs diff --git a/Craftimizer/SimulatorUtils.cs b/Craftimizer/SimulatorUtils.cs index 62ed666..4e02f6f 100644 --- a/Craftimizer/SimulatorUtils.cs +++ b/Craftimizer/SimulatorUtils.cs @@ -76,7 +76,7 @@ internal static class ActionUtils public static string GetName(this ActionType me, ClassJob classJob) { var (craftAction, action) = GetActionRow(me, classJob); - return (craftAction?.Name ?? action?.Name)?.AsSpan().ExtractText() ?? "Unknown"; + return (craftAction?.Name ?? action?.Name)?.AsSpan().ToString() ?? "Unknown"; } public static ITextureIcon GetIcon(this ActionType me, ClassJob classJob) @@ -163,7 +163,7 @@ internal static class ClassJobUtils public static string GetName(this ClassJob me) { var job = LuminaSheets.ClassJobSheet.GetRow(me.GetClassJobIndex()); - return job.Name.ExtractCleanText(); + return job.Name.ToString(); } public static string GetNameArticle(this ClassJob me) @@ -180,7 +180,7 @@ internal static class ClassJobUtils public static string GetAbbreviation(this ClassJob me) { var job = LuminaSheets.ClassJobSheet.GetRow(me.GetClassJobIndex()); - return job.Abbreviation.ExtractText(); + return job.Abbreviation.ToString(); } public static Quest GetUnlockQuest(this ClassJob me) => @@ -298,13 +298,13 @@ internal static class ConditionUtils } public static string Name(this Condition me) => - LuminaSheets.AddonSheet.GetRow(me.AddonIds().Name).Text.ExtractText(); + LuminaSheets.AddonSheet.GetRow(me.AddonIds().Name).Text.ToString(); public static string Description(this Condition me, bool isRelic) { var text = LuminaSheets.AddonSheet.GetRow(me.AddonIds().Description).Text; if (!text.Any(p => p is { Type: ReadOnlySePayloadType.Macro, MacroCode: MacroCode.Float })) - return text.ExtractText(); + return text.ToString(); ReadOnlySeString finalText = new(); foreach (var payload in text) @@ -314,7 +314,7 @@ internal static class ConditionUtils else finalText += payload; } - return finalText.ExtractText(); + return finalText.ToString(); } } @@ -360,7 +360,7 @@ internal static class EffectUtils { var status = me.Status(); var name = new StringBuilder(); - name.Append(status.Name.ExtractText()); + name.Append(status.Name.ToString()); if (status.MaxStacks != 0) name.Append($" {strength}"); if (!status.IsPermanent) diff --git a/Craftimizer/Utils/Gearsets.cs b/Craftimizer/Utils/Gearsets.cs index 7d8ce2e..09a892d 100644 --- a/Craftimizer/Utils/Gearsets.cs +++ b/Craftimizer/Utils/Gearsets.cs @@ -129,7 +129,7 @@ public static unsafe class Gearsets } public static bool IsSplendorousTool(GearsetItem item) => - LuminaSheets.ItemSheetEnglish.GetRow(item.ItemId).Description.ExtractText().Contains("Increases to quality are 1.75 times higher than normal when material condition is Good.", StringComparison.Ordinal); + LuminaSheets.ItemSheetEnglish.GetRow(item.ItemId).Description.ToString().Contains("Increases to quality are 1.75 times higher than normal when material condition is Good.", StringComparison.Ordinal); // https://github.com/ffxiv-teamcraft/ffxiv-teamcraft/blob/24d0db2d9676f264edf53651b21005305267c84c/apps/client/src/app/modules/gearsets/materia.service.ts#L265 private static int CalculateParamCap(Item item, uint paramId) diff --git a/Craftimizer/Utils/ReadOnlySeStringExtensions.cs b/Craftimizer/Utils/ReadOnlySeStringExtensions.cs deleted file mode 100644 index 13f35ee..0000000 --- a/Craftimizer/Utils/ReadOnlySeStringExtensions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Dalamud.Utility; -using Lumina.Text.ReadOnly; - -namespace Craftimizer.Utils; - -public static class ReadOnlySeStringExtensions -{ - public static string ExtractCleanText(this ReadOnlySeString self) - { - return self.ExtractText().StripSoftHyphen(); - } -} diff --git a/Craftimizer/Windows/MacroEditor.cs b/Craftimizer/Windows/MacroEditor.cs index cd6b1ba..95c77b9 100644 --- a/Craftimizer/Windows/MacroEditor.cs +++ b/Craftimizer/Windows/MacroEditor.cs @@ -572,7 +572,7 @@ public sealed class MacroEditor : Window, IDisposable if (input.ItemId == 0) return "None"; - var name = LuminaSheets.ItemSheet.GetRowOrDefault(input.ItemId)?.Name.ExtractCleanText() ?? $"Unknown ({input.ItemId})"; + var name = LuminaSheets.ItemSheet.GetRowOrDefault(input.ItemId)?.Name.ToString() ?? $"Unknown ({input.ItemId})"; return input.IsHQ ? $"{name} (HQ)" : name; } @@ -788,11 +788,11 @@ public sealed class MacroEditor : Window, IDisposable searchableRecipes, fontHandle, ImGui.GetContentRegionAvail().X - rightSideWidth, - r => r.Recipe.ItemResult.Value.Name.ExtractCleanText(), + r => r.Recipe.ItemResult.Value.Name.ToString(), r => r.Recipe.RowId.ToString(), r => { - ImGui.TextUnformatted($"{r.Recipe.ItemResult.Value.Name.ExtractCleanText()}"); + ImGui.TextUnformatted($"{r.Recipe.ItemResult.Value.Name}"); var classJob = (ClassJob)r.Recipe.CraftType.RowId; var textLevel = SqText.LevelPrefix.ToIconChar() + SqText.ToLevelString(r.Recipe.RecipeLevelTable.Value!.ClassJobLevel); @@ -975,10 +975,10 @@ public sealed class MacroEditor : Window, IDisposable { var perItem = RecipeData.CalculateItemStartingQuality(idx, 1); var total = RecipeData.CalculateItemStartingQuality(idx, hqCount); - ImGuiUtils.Tooltip($"{ingredient.Item.Name.ExtractCleanText()} {SeIconChar.HighQuality.ToIconString()}\n+{perItem} Quality/Item{(total > 0 ? $"\n+{total} Quality" : "")}"); + ImGuiUtils.Tooltip($"{ingredient.Item.Name} {SeIconChar.HighQuality.ToIconString()}\n+{perItem} Quality/Item{(total > 0 ? $"\n+{total} Quality" : "")}"); } else if (ingredient.Amount != 0) - ImGuiUtils.Tooltip($"{ingredient.Item.Name.ExtractCleanText()}"); + ImGuiUtils.Tooltip($"{ingredient.Item.Name}"); } ImGui.SameLine(0, 5); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - (5 + ImGui.CalcTextSize("/").X + 5 + ImGui.CalcTextSize($"99").X)); @@ -1247,7 +1247,7 @@ public sealed class MacroEditor : Window, IDisposable { var status = effect.Status(); using var _reset = ImRaii.DefaultFont(); - ImGuiUtils.Tooltip($"{status.Name.ExtractCleanText()}\n{status.Description.ExtractCleanText()}"); + ImGuiUtils.Tooltip($"{status.Name}\n{status.Description}"); } ImGui.SameLine(); } diff --git a/Craftimizer/Windows/RecipeNote.cs b/Craftimizer/Windows/RecipeNote.cs index e2625e9..d4579f6 100644 --- a/Craftimizer/Windows/RecipeNote.cs +++ b/Craftimizer/Windows/RecipeNote.cs @@ -607,7 +607,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable case CraftableStatus.RequiredItem: { var item = RecipeData.Recipe.ItemRequired.Value!; - var itemName = item.Name.ExtractCleanText(); + var itemName = item.Name.ToString(); var imageSize = ImGui.GetFrameHeight(); ImGuiUtils.TextCentered($"You are missing the required equipment."); @@ -621,7 +621,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable case CraftableStatus.RequiredStatus: { var status = RecipeData.Recipe.StatusRequired.Value!; - var statusName = status.Name.ExtractCleanText(); + var statusName = status.Name.ToString(); var statusIcon = Service.IconManager.GetIconCached(status.Icon); var imageSize = new Vector2(ImGui.GetFrameHeight() * (statusIcon.AspectRatio ?? 1), ImGui.GetFrameHeight()); @@ -1136,7 +1136,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable private static (string NpcName, string Territory, Vector2 MapLocation, MapLinkPayload Payload) ResolveLevelData(uint levelRowId) { var level = LuminaSheets.LevelSheet.GetRow(levelRowId); - var placeName = level.Territory.Value.PlaceName.Value.Name.ExtractCleanText(); + var placeName = level.Territory.Value.PlaceName.Value.Name.ToString(); var location = WorldToMap2(new(level.X, level.Z), level.Map.Value!); return (ResolveNpcResidentName(level.Object.RowId), placeName, location, new(level.Territory.RowId, level.Map.RowId, location.X, location.Y)); diff --git a/Craftimizer/Windows/SynthHelper.cs b/Craftimizer/Windows/SynthHelper.cs index 120a119..7527022 100644 --- a/Craftimizer/Windows/SynthHelper.cs +++ b/Craftimizer/Windows/SynthHelper.cs @@ -392,7 +392,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable { var status = effect.Status(); using var _reset = ImRaii.DefaultFont(); - ImGuiUtils.Tooltip($"{status.Name.ExtractCleanText()}\n{status.Description.ExtractCleanText()}"); + ImGuiUtils.Tooltip($"{status.Name}\n{status.Description}"); } ImGui.SameLine(); }