namespace AcDream.App.UI.Layout; /// /// Retail character identity display helpers for gmStatManagementUI. /// Sources: gmStatManagementUI::UpdateCharacterInfo (0x004f0770) calls /// AppraisalSystem::InqGenderHeritageDisplay(gender 0x71, heritage 0xBC, 0), /// then appends the current CharacterTitleTable title when one is active. /// internal static class CharacterIdentityText { public const uint GenderPropertyId = 0x71u; public const uint HeritageGroupPropertyId = 0xBCu; public static string StatHeaderLine(CharacterSheet sheet) { string? heritage = !string.IsNullOrWhiteSpace(sheet.Heritage) ? sheet.Heritage : sheet.Race; string? title = StripLeadingArticle(sheet.Title); if (string.IsNullOrWhiteSpace(sheet.Gender)) return Join(heritage, title); return Join(sheet.Gender, heritage, title); } public static string? GenderDisplayName(int gender) => gender switch { 1 => "Male", 2 => "Female", _ => null, }; public static string? HeritageGroupDisplayName(int heritageGroup) => heritageGroup switch { 1 => "Aluvian", 2 => "Gharu'ndim", 3 => "Sho", 4 => "Viamontian", 5 => "Umbraen", 6 => "Gearknight", 7 => "Tumerok", 8 => "Lugian", 9 => "Empyrean", 10 => "Penumbraen", 11 => "Undead", 12 => "Olthoi", 13 => "Olthoi", _ => null, }; private static string Join(params string?[] parts) { return string.Join(" ", parts .Where(p => !string.IsNullOrWhiteSpace(p)) .Select(p => p!.Trim())); } private static string? StripLeadingArticle(string? title) { if (string.IsNullOrWhiteSpace(title)) return null; string trimmed = title.Trim(); return trimmed.StartsWith("the ", System.StringComparison.OrdinalIgnoreCase) ? trimmed[4..] : trimmed; } }