43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using Lumina.Excel;
|
|
using Lumina.Excel.GeneratedSheets;
|
|
|
|
namespace GameDataExtractor;
|
|
|
|
internal static class TerritoryExt {
|
|
internal static (string? Subtitle, string? Category) GetSubtitleAndCategory(this TerritoryType territory, ExcelSheet<Quest> quests) {
|
|
string? subtitle = null;
|
|
string? category = null;
|
|
if (territory.QuestBattle.Row != 0) {
|
|
var questId = territory.QuestBattle.Value!.Quest;
|
|
var quest = quests.GetRow((uint) questId);
|
|
if (quest != null) {
|
|
category = "Quest Battles";
|
|
subtitle = quest.Name.RawString;
|
|
}
|
|
} else if (territory.ContentFinderCondition.Row != 0) {
|
|
var cfc = territory.ContentFinderCondition.Value!;
|
|
|
|
var ctName = cfc.ContentType.Value?.Name.RawString;
|
|
if (!string.IsNullOrWhiteSpace(ctName)) {
|
|
category = ctName;
|
|
}
|
|
|
|
var cfcName = cfc.Name.RawString;
|
|
subtitle = Prettify(cfcName);
|
|
}
|
|
|
|
return (subtitle, category);
|
|
|
|
string Prettify(string input) {
|
|
if (string.IsNullOrWhiteSpace(input)) {
|
|
return "Instance";
|
|
}
|
|
|
|
var name = input[..1].ToUpperInvariant() + input[1..];
|
|
return name
|
|
.Replace("TamTara", "Tam-Tara")
|
|
.Replace("TotoRak", "Toto-Rak");
|
|
}
|
|
}
|
|
}
|