From 9fcb890d20aace92b70257e9020951740d1bf214 Mon Sep 17 00:00:00 2001 From: Infi Date: Mon, 27 May 2024 07:34:32 +0200 Subject: [PATCH] AutoTranslatePayload: Use `Alias` for TextCommands (#1809) --- .../SeStringHandling/Payloads/AutoTranslatePayload.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Dalamud/Game/Text/SeStringHandling/Payloads/AutoTranslatePayload.cs b/Dalamud/Game/Text/SeStringHandling/Payloads/AutoTranslatePayload.cs index 451d43065..0315c0d6b 100644 --- a/Dalamud/Game/Text/SeStringHandling/Payloads/AutoTranslatePayload.cs +++ b/Dalamud/Game/Text/SeStringHandling/Payloads/AutoTranslatePayload.cs @@ -150,7 +150,7 @@ public class AutoTranslatePayload : Payload, ITextProvider "PetMirage" => this.DataResolver.GetExcelSheet().GetRow(this.key).Name, "PlaceName" => this.DataResolver.GetExcelSheet().GetRow(this.key).Name, "Race" => this.DataResolver.GetExcelSheet().GetRow(this.key).Masculine, - "TextCommand" => this.DataResolver.GetExcelSheet().GetRow(this.key).Command, + "TextCommand" => this.ResolveTextCommand(), "Tribe" => this.DataResolver.GetExcelSheet().GetRow(this.key).Masculine, "Weather" => this.DataResolver.GetExcelSheet().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().GetRow(this.key); + return result.Alias.Payloads.Count > 0 ? result.Alias : result.Command; + } }