Skip to content

Commit

Permalink
Reimplement classjob article prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Jul 29, 2024
1 parent a9b85bb commit 8ca5308
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
13 changes: 12 additions & 1 deletion Craftimizer/SimulatorUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,18 @@ public static unsafe bool CanPlayerUseManipulation(this ClassJob me) =>
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)
Expand Down
10 changes: 3 additions & 7 deletions Craftimizer/Windows/RecipeNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ private void DrawCharacterStats()
{
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);
Expand All @@ -503,11 +503,7 @@ private void DrawCharacterStats()
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)
{
Expand All @@ -517,7 +513,7 @@ private void DrawCharacterStats()
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;
Expand Down

1 comment on commit 8ca5308

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 8ca5308 Previous: 1622902 Ratio
Craftimizer.Benchmark.Bench.Solve(State: 37FA449F, Config: D9EA3610) 73585540.95238094 ns (± 540923.8443261165)
Craftimizer.Benchmark.Bench.Solve(State: 7E3828F1, Config: D9EA3610) 90206348.8888889 ns (± 618916.7100241289)

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.