From ab69caf4afb6d7a34296896ad42eea0c5b107aa7 Mon Sep 17 00:00:00 2001 From: meli <57847713+ff-meli@users.noreply.github.com> Date: Thu, 19 Mar 2020 11:24:50 -0700 Subject: [PATCH] fix discord name handling (and subsequent character lookup) of local player chats in party/alliance --- Dalamud/DiscordBot/DiscordBotManager.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dalamud/DiscordBot/DiscordBotManager.cs b/Dalamud/DiscordBot/DiscordBotManager.cs index 6b68961cc..4943c9f06 100644 --- a/Dalamud/DiscordBot/DiscordBotManager.cs +++ b/Dalamud/DiscordBot/DiscordBotManager.cs @@ -189,12 +189,20 @@ namespace Dalamud.DiscordBot { if (playerLink == null) { // chat messages from the local player do not include a player link, and are just the raw name // but we should still track other instances to know if this is ever an issue otherwise - if (parsedSender.TextValue != this.dalamud.ClientState.LocalPlayer.Name) + + // Special case 2 - When the local player talks in party/alliance, the name comes through as raw text, + // but prefixed by their position number in the party (which for local player may always be 1) + if (parsedSender.TextValue.EndsWith(this.dalamud.ClientState.LocalPlayer.Name)) + { + senderName = this.dalamud.ClientState.LocalPlayer.Name; + } + else { Log.Error("playerLink was null. Sender: {0}", BitConverter.ToString(sender.RawData)); + + senderName = wasOutgoingTell ? this.dalamud.ClientState.LocalPlayer.Name : parsedSender.TextValue; } - senderName = wasOutgoingTell ? this.dalamud.ClientState.LocalPlayer.Name : parsedSender.TextValue; senderWorld = this.dalamud.ClientState.LocalPlayer.HomeWorld.Name; } else { playerLink.Resolve();