No more ExtractText or soft hyphens

This commit is contained in:
Asriel Camora
2025-08-19 00:07:53 -07:00
parent 14b5bd66c0
commit d4de8524c6
6 changed files with 18 additions and 30 deletions
+7 -7
View File
@@ -76,7 +76,7 @@ internal static class ActionUtils
public static string GetName(this ActionType me, ClassJob classJob) public static string GetName(this ActionType me, ClassJob classJob)
{ {
var (craftAction, action) = GetActionRow(me, 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) public static ITextureIcon GetIcon(this ActionType me, ClassJob classJob)
@@ -163,7 +163,7 @@ internal static class ClassJobUtils
public static string GetName(this ClassJob me) public static string GetName(this ClassJob me)
{ {
var job = LuminaSheets.ClassJobSheet.GetRow(me.GetClassJobIndex()); var job = LuminaSheets.ClassJobSheet.GetRow(me.GetClassJobIndex());
return job.Name.ExtractCleanText(); return job.Name.ToString();
} }
public static string GetNameArticle(this ClassJob me) public static string GetNameArticle(this ClassJob me)
@@ -180,7 +180,7 @@ internal static class ClassJobUtils
public static string GetAbbreviation(this ClassJob me) public static string GetAbbreviation(this ClassJob me)
{ {
var job = LuminaSheets.ClassJobSheet.GetRow(me.GetClassJobIndex()); var job = LuminaSheets.ClassJobSheet.GetRow(me.GetClassJobIndex());
return job.Abbreviation.ExtractText(); return job.Abbreviation.ToString();
} }
public static Quest GetUnlockQuest(this ClassJob me) => public static Quest GetUnlockQuest(this ClassJob me) =>
@@ -298,13 +298,13 @@ internal static class ConditionUtils
} }
public static string Name(this Condition me) => 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) public static string Description(this Condition me, bool isRelic)
{ {
var text = LuminaSheets.AddonSheet.GetRow(me.AddonIds().Description).Text; var text = LuminaSheets.AddonSheet.GetRow(me.AddonIds().Description).Text;
if (!text.Any(p => p is { Type: ReadOnlySePayloadType.Macro, MacroCode: MacroCode.Float })) if (!text.Any(p => p is { Type: ReadOnlySePayloadType.Macro, MacroCode: MacroCode.Float }))
return text.ExtractText(); return text.ToString();
ReadOnlySeString finalText = new(); ReadOnlySeString finalText = new();
foreach (var payload in text) foreach (var payload in text)
@@ -314,7 +314,7 @@ internal static class ConditionUtils
else else
finalText += payload; finalText += payload;
} }
return finalText.ExtractText(); return finalText.ToString();
} }
} }
@@ -360,7 +360,7 @@ internal static class EffectUtils
{ {
var status = me.Status(); var status = me.Status();
var name = new StringBuilder(); var name = new StringBuilder();
name.Append(status.Name.ExtractText()); name.Append(status.Name.ToString());
if (status.MaxStacks != 0) if (status.MaxStacks != 0)
name.Append($" {strength}"); name.Append($" {strength}");
if (!status.IsPermanent) if (!status.IsPermanent)
+1 -1
View File
@@ -129,7 +129,7 @@ public static unsafe class Gearsets
} }
public static bool IsSplendorousTool(GearsetItem item) => 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 // 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) private static int CalculateParamCap(Item item, uint paramId)
@@ -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();
}
}
+6 -6
View File
@@ -572,7 +572,7 @@ public sealed class MacroEditor : Window, IDisposable
if (input.ItemId == 0) if (input.ItemId == 0)
return "None"; 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; return input.IsHQ ? $"{name} (HQ)" : name;
} }
@@ -788,11 +788,11 @@ public sealed class MacroEditor : Window, IDisposable
searchableRecipes, searchableRecipes,
fontHandle, fontHandle,
ImGui.GetContentRegionAvail().X - rightSideWidth, ImGui.GetContentRegionAvail().X - rightSideWidth,
r => r.Recipe.ItemResult.Value.Name.ExtractCleanText(), r => r.Recipe.ItemResult.Value.Name.ToString(),
r => r.Recipe.RowId.ToString(), r => r.Recipe.RowId.ToString(),
r => r =>
{ {
ImGui.TextUnformatted($"{r.Recipe.ItemResult.Value.Name.ExtractCleanText()}"); ImGui.TextUnformatted($"{r.Recipe.ItemResult.Value.Name}");
var classJob = (ClassJob)r.Recipe.CraftType.RowId; var classJob = (ClassJob)r.Recipe.CraftType.RowId;
var textLevel = SqText.LevelPrefix.ToIconChar() + SqText.ToLevelString(r.Recipe.RecipeLevelTable.Value!.ClassJobLevel); 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 perItem = RecipeData.CalculateItemStartingQuality(idx, 1);
var total = RecipeData.CalculateItemStartingQuality(idx, hqCount); 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) else if (ingredient.Amount != 0)
ImGuiUtils.Tooltip($"{ingredient.Item.Name.ExtractCleanText()}"); ImGuiUtils.Tooltip($"{ingredient.Item.Name}");
} }
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));
@@ -1247,7 +1247,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();
ImGuiUtils.Tooltip($"{status.Name.ExtractCleanText()}\n{status.Description.ExtractCleanText()}"); ImGuiUtils.Tooltip($"{status.Name}\n{status.Description}");
} }
ImGui.SameLine(); ImGui.SameLine();
} }
+3 -3
View File
@@ -607,7 +607,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
case CraftableStatus.RequiredItem: case CraftableStatus.RequiredItem:
{ {
var item = RecipeData.Recipe.ItemRequired.Value!; var item = RecipeData.Recipe.ItemRequired.Value!;
var itemName = item.Name.ExtractCleanText(); var itemName = item.Name.ToString();
var imageSize = ImGui.GetFrameHeight(); var imageSize = ImGui.GetFrameHeight();
ImGuiUtils.TextCentered($"You are missing the required equipment."); ImGuiUtils.TextCentered($"You are missing the required equipment.");
@@ -621,7 +621,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
case CraftableStatus.RequiredStatus: case CraftableStatus.RequiredStatus:
{ {
var status = RecipeData.Recipe.StatusRequired.Value!; var status = RecipeData.Recipe.StatusRequired.Value!;
var statusName = status.Name.ExtractCleanText(); var statusName = status.Name.ToString();
var statusIcon = Service.IconManager.GetIconCached(status.Icon); var statusIcon = Service.IconManager.GetIconCached(status.Icon);
var imageSize = new Vector2(ImGui.GetFrameHeight() * (statusIcon.AspectRatio ?? 1), ImGui.GetFrameHeight()); 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) private static (string NpcName, string Territory, Vector2 MapLocation, MapLinkPayload Payload) ResolveLevelData(uint levelRowId)
{ {
var level = LuminaSheets.LevelSheet.GetRow(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!); 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)); return (ResolveNpcResidentName(level.Object.RowId), placeName, location, new(level.Territory.RowId, level.Map.RowId, location.X, location.Y));
+1 -1
View File
@@ -392,7 +392,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();
ImGuiUtils.Tooltip($"{status.Name.ExtractCleanText()}\n{status.Description.ExtractCleanText()}"); ImGuiUtils.Tooltip($"{status.Name}\n{status.Description}");
} }
ImGui.SameLine(); ImGui.SameLine();
} }