From 8ca53080c36a05f036b3c8453c8f082dfe6c748b Mon Sep 17 00:00:00 2001 From: Asriel Camora Date: Sun, 28 Jul 2024 19:57:39 -0700 Subject: [PATCH] Reimplement classjob article prefix --- Craftimizer/SimulatorUtils.cs | 13 ++++++++++++- Craftimizer/Windows/RecipeNote.cs | 10 +++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Craftimizer/SimulatorUtils.cs b/Craftimizer/SimulatorUtils.cs index e084c8d..2ef4d1d 100644 --- a/Craftimizer/SimulatorUtils.cs +++ b/Craftimizer/SimulatorUtils.cs @@ -160,7 +160,18 @@ internal static class ClassJobUtils public static string GetName(this ClassJob me) { var job = LuminaSheets.ClassJobSheet.GetRow(me.GetClassJobIndex())!; - return CultureInfo.InvariantCulture.TextInfo.ToTitleCase(job.Name.ToDalamudString().TextValue); + return job.Name.ToDalamudString().TextValue.ToLowerInvariant(); + } + + public static string GetNameArticle(this ClassJob me) + { + var job = LuminaSheets.ClassJobSheet.GetRow(me.GetClassJobIndex())!; + if (job.SheetLanguage == Lumina.Data.Language.English) + { + if (me is ClassJob.Alchemist or ClassJob.Armorer) + return "an"; + } + return "a"; } public static string GetAbbreviation(this ClassJob me) diff --git a/Craftimizer/Windows/RecipeNote.cs b/Craftimizer/Windows/RecipeNote.cs index be738f0..4ddd1e4 100644 --- a/Craftimizer/Windows/RecipeNote.cs +++ b/Craftimizer/Windows/RecipeNote.cs @@ -483,7 +483,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable { case CraftableStatus.LockedClassJob: { - ImGuiUtils.TextCentered($"You do not have {RecipeData.ClassJob.GetName().ToLowerInvariant()} unlocked."); + ImGuiUtils.TextCentered($"You do not have {RecipeData.ClassJob.GetName()} unlocked."); ImGui.Separator(); var unlockQuest = RecipeData.ClassJob.GetUnlockQuest(); var (questGiver, questTerritory, questLocation, mapPayload) = ResolveLevelData(unlockQuest.IssuerLocation.Row); @@ -503,11 +503,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable break; case CraftableStatus.WrongClassJob: { - var fullClassName = RecipeData.ClassJob.GetName().ToLowerInvariant(); - var classArticle = "a"; - if (fullClassName == "Alchemist" || fullClassName == "Armorer") - classArticle = "an"; - ImGuiUtils.TextCentered($"You are not {classArticle} {fullClassName}."); + ImGuiUtils.TextCentered($"You are not {RecipeData.ClassJob.GetNameArticle()} {RecipeData.ClassJob.GetName()}."); var gearsetId = GetGearsetForJob(RecipeData.ClassJob); if (gearsetId.HasValue) { @@ -517,7 +513,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable ImGuiUtils.Tooltip($"Swap to gearset {gearsetId + 1}"); } else - ImGuiUtils.TextCentered($"You do not have any {RecipeData.ClassJob.GetName().ToLowerInvariant()} gearsets."); + ImGuiUtils.TextCentered($"You do not have any {RecipeData.ClassJob.GetName()} gearsets."); ImGui.Dummy(default); } break;