diff --git a/Dalamud/Game/Chat/SeStringHandling/Payload.cs b/Dalamud/Game/Chat/SeStringHandling/Payload.cs
index b932a338d..25b4531de 100644
--- a/Dalamud/Game/Chat/SeStringHandling/Payload.cs
+++ b/Dalamud/Game/Chat/SeStringHandling/Payload.cs
@@ -80,6 +80,10 @@ namespace Dalamud.Game.Chat.SeStringHandling
}
break;
+ case SeStringChunkType.AutoTranslateKey:
+ payload = new AutoTranslatePayload();
+ break;
+
case SeStringChunkType.UIForeground:
payload = new UIForegroundPayload();
break;
@@ -119,6 +123,7 @@ namespace Dalamud.Game.Chat.SeStringHandling
protected enum SeStringChunkType
{
Interactable = 0x27,
+ AutoTranslateKey = 0x2E,
UIForeground = 0x48,
UIGlow = 0x49
}
diff --git a/Dalamud/Game/Chat/SeStringHandling/PayloadType.cs b/Dalamud/Game/Chat/SeStringHandling/PayloadType.cs
index c4e8015a3..92e8afa44 100644
--- a/Dalamud/Game/Chat/SeStringHandling/PayloadType.cs
+++ b/Dalamud/Game/Chat/SeStringHandling/PayloadType.cs
@@ -1,8 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Dalamud.Game.Chat.SeStringHandling
{
@@ -40,6 +35,10 @@ namespace Dalamud.Game.Chat.SeStringHandling
///
MapLink,
///
+ /// An SeString payload representing an auto-translate dictionary entry.
+ ///
+ AutoTranslateText,
+ ///
/// An SeString payload representing any data we don't handle.
///
Unknown
diff --git a/Dalamud/Game/Chat/SeStringHandling/Payloads/AutoTranslatePayload.cs b/Dalamud/Game/Chat/SeStringHandling/Payloads/AutoTranslatePayload.cs
new file mode 100644
index 000000000..87b25aa45
--- /dev/null
+++ b/Dalamud/Game/Chat/SeStringHandling/Payloads/AutoTranslatePayload.cs
@@ -0,0 +1,105 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+
+namespace Dalamud.Game.Chat.SeStringHandling.Payloads
+{
+ public class AutoTranslatePayload : Payload
+ {
+ public override PayloadType Type => PayloadType.AutoTranslateText;
+
+ public uint Group { get; set; }
+
+ public uint Key { get; set; }
+
+ public string Text { get; set; }
+
+ public override void Resolve()
+ {
+ // TODO: fixup once lumina DI is in
+
+ //if (string.IsNullOrEmpty(Text))
+ //{
+ // var sheet = dalamud.Data.GetExcelSheet();
+
+ // Completion row = null;
+ // try
+ // {
+ // // try to get the row in the Completion table itself, because this is 'easiest'
+ // // The row may not exist at all (if the Key is for another table), or it could be the wrong row
+ // // (again, if it's meant for another table)
+ // row = sheet.GetRow(Key);
+ // }
+ // catch {} // don't care, row will be null
+
+ // if (row?.Group == Group)
+ // {
+ // // if the row exists in this table and the group matches, this is actually the correct data
+ // Text = $"{{ {row.Text} }} ";
+ // }
+ // else
+ // {
+ // Log.Verbose("row mismatch");
+ // try
+ // {
+ // // we need to get the linked table and do the lookup there instead
+ // // in this case, there will only be one entry for this group id
+ // row = sheet.GetRows().First(r => r.Group == Group);
+ // // many of the names contain valid id ranges after the table name, but we don't need those
+ // var actualTableName = row.LookupTable.Split('[')[0];
+
+ // var name = actualTableName switch
+ // {
+ // // TODO: rest of xref'd tables
+ // "Action" => dalamud.Data.GetExcelSheet().GetRow(Key).Name,
+ // "ClassJob" => dalamud.Data.GetExcelSheet().GetRow(Key).Name,
+ // "CraftAction" => dalamud.Data.GetExcelSheet().GetRow(Key).Name,
+ // "Mount" => dalamud.Data.GetExcelSheet().GetRow(Key).Singular,
+ // "PlaceName" => dalamud.Data.GetExcelSheet().GetRow(Key).Name,
+ // "Race" => dalamud.Data.GetExcelSheet().GetRow(Key).Masculine,
+ // _ => throw new Exception(actualTableName)
+ // };
+
+ // Text = $"{{ {name} }} ";
+ // }
+ // catch (Exception e)
+ // {
+ // Log.Error(e, $"AutoTranslatePayload - failed to resolve: {this}");
+ // }
+ // }
+ //}
+ }
+
+ public override byte[] Encode()
+ {
+ var keyBytes = MakeInteger(Key);
+
+ var chunkLen = keyBytes.Length + 2;
+ var bytes = new List()
+ {
+ START_BYTE,
+ (byte)SeStringChunkType.AutoTranslateKey, (byte)chunkLen,
+ (byte)Group
+ };
+ bytes.AddRange(keyBytes);
+ bytes.Add(END_BYTE);
+
+ return bytes.ToArray();
+ }
+
+ public override string ToString()
+ {
+ return $"{Type} - Group: {Group}, Key: {Key}, Text: {Text}";
+ }
+
+ protected override void ProcessChunkImpl(BinaryReader reader, long endOfStream)
+ {
+ // this seems to always be a bare byte, and not following normal integer encoding
+ // the values in the table are all <70 so this is presumably ok
+ Group = reader.ReadByte();
+
+ Key = GetInteger(reader);
+ }
+ }
+}