Battle log exists, selftest with the use action message

This commit is contained in:
RedworkDE 2026-01-04 08:12:06 +01:00
parent 9b55b020ca
commit 790669e60a

View file

@ -1,13 +1,10 @@
using Dalamud.Bindings.ImGui; using Dalamud.Bindings.ImGui;
using Dalamud.Data;
using Dalamud.Game.Chat; using Dalamud.Game.Chat;
using Dalamud.Game.Gui; using Dalamud.Game.Gui;
using Dalamud.Game.Text; using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Plugin.SelfTest; using Dalamud.Plugin.SelfTest;
using Lumina.Excel.Sheets;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps; namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary> /// <summary>
@ -19,9 +16,9 @@ internal class ChatSelfTestStep : ISelfTestStep
private bool subscribedChatMessage = false; private bool subscribedChatMessage = false;
private bool subscribedLogMessage = false; private bool subscribedLogMessage = false;
private bool hasSeenEchoMessage = false; private bool hasSeenEchoMessage = false;
private bool hasSeenMountMessage = false; private bool hasSeenActionMessage = false;
private string mountName = ""; private string actionName = "";
private string mountUser = ""; private string actionUser = "";
/// <inheritdoc/> /// <inheritdoc/>
public string Name => "Test Chat"; public string Name => "Test Chat";
@ -58,7 +55,7 @@ internal class ChatSelfTestStep : ISelfTestStep
break; break;
case 2: case 2:
ImGui.Text("Use any mount..."); ImGui.Text("Use any action (for example Sprint) or be near a player using an action.");
if (!this.subscribedLogMessage) if (!this.subscribedLogMessage)
{ {
@ -66,11 +63,10 @@ internal class ChatSelfTestStep : ISelfTestStep
chatGui.LogMessage += this.ChatOnLogMessage; chatGui.LogMessage += this.ChatOnLogMessage;
} }
if (this.hasSeenMountMessage) if (this.hasSeenActionMessage)
{ {
ImGui.Text($"{this.mountUser} mounted {this.mountName}."); ImGui.Text($"{this.actionUser} used {this.actionName}.");
ImGui.Text("Is this correct?");
ImGui.Text("Is this correct? It is correct if this triggers on other players around you.");
if (ImGui.Button("Yes")) if (ImGui.Button("Yes"))
{ {
@ -119,19 +115,11 @@ internal class ChatSelfTestStep : ISelfTestStep
private void ChatOnLogMessage(ILogMessage message) private void ChatOnLogMessage(ILogMessage message)
{ {
if (message.LogMessageId == 646 && message.TryGetIntParameter(0, out var value)) if (message.LogMessageId == 533 && message.TryGetStringParameter(0, out var value))
{ {
this.hasSeenMountMessage = true; this.hasSeenActionMessage = true;
this.mountUser = message.SourceEntity?.Name.ExtractText() ?? "<incorrect>"; this.actionUser = message.SourceEntity?.Name.ExtractText() ?? "<incorrect>";
try this.actionName = value.ExtractText();
{
this.mountName = Service<DataManager>.Get().GetExcelSheet<Mount>().GetRow((uint)value).Singular.ExtractText();
}
catch
{
// ignore any errors with retrieving the mount name, they are probably not related to this test
this.mountName = $"Mount ID: {value} (failed to retrieve mount name)";
}
} }
} }
} }