Fix floor change regex (for pomanders)

Not sure how or why that even broke, the string doesn't seem to have changed in the LogMessage sheet.

Fixes #18.
rendering v4.5
Liza 2023-04-13 09:17:06 +02:00
parent 8042aee951
commit ddbeb9843f
1 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Text;
using System.Text.RegularExpressions;
using Dalamud.Data;
using Dalamud.Game.Gui;
@ -82,14 +83,21 @@ internal sealed class ChatService : IDisposable
HoardNotOnCurrentFloor = GetLocalizedString(7273),
HoardCofferOpened = GetLocalizedString(7274),
FloorChanged =
new Regex("^" + GetLocalizedString(7270).Replace("\u0002 \u0003\ufffd\u0002\u0003", @"(\d+)") +
new Regex("^" + GetLocalizedString(7270, true).Replace("\u0002 \u0003\ufffd\u0002\u0003", @"(\d+)") +
"$"),
};
}
private string GetLocalizedString(uint id)
private string GetLocalizedString(uint id, bool asRawData = false)
{
return _dataManager.GetExcelSheet<LogMessage>()?.GetRow(id)?.Text?.ToString() ?? "Unknown";
var text = _dataManager.GetExcelSheet<LogMessage>()?.GetRow(id)?.Text;
if (text == null)
return "Unknown";
if (asRawData)
return Encoding.UTF8.GetString(text.RawData);
else
return text.ToString();
}
private sealed class LocalizedChatMessages