AutoTranslatePayload: Use Alias for TextCommands (#1809)

This commit is contained in:
Infi 2024-05-27 07:34:32 +02:00 committed by GitHub
parent d5d9942d91
commit 9fcb890d20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -150,7 +150,7 @@ public class AutoTranslatePayload : Payload, ITextProvider
"PetMirage" => this.DataResolver.GetExcelSheet<PetMirage>().GetRow(this.key).Name,
"PlaceName" => this.DataResolver.GetExcelSheet<PlaceName>().GetRow(this.key).Name,
"Race" => this.DataResolver.GetExcelSheet<Race>().GetRow(this.key).Masculine,
"TextCommand" => this.DataResolver.GetExcelSheet<TextCommand>().GetRow(this.key).Command,
"TextCommand" => this.ResolveTextCommand(),
"Tribe" => this.DataResolver.GetExcelSheet<Tribe>().GetRow(this.key).Masculine,
"Weather" => this.DataResolver.GetExcelSheet<Weather>().GetRow(this.key).Name,
_ => throw new Exception(actualTableName),
@ -166,4 +166,12 @@ public class AutoTranslatePayload : Payload, ITextProvider
return value;
}
private Lumina.Text.SeString ResolveTextCommand()
{
// TextCommands prioritize the `Alias` field, if it not empty
// Example for this is /rangerpose2l which becomes /blackrangerposeb in chat
var result = this.DataResolver.GetExcelSheet<TextCommand>().GetRow(this.key);
return result.Alias.Payloads.Count > 0 ? result.Alias : result.Command;
}
}