From 18c311ace5012b5be54437594e6cca290448e3ae Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 11 Feb 2022 01:51:58 -0500 Subject: [PATCH] fiX: handle commands with temp channels better --- ChatTwo/Ui/ChatLog.cs | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/ChatTwo/Ui/ChatLog.cs b/ChatTwo/Ui/ChatLog.cs index 79014d0..3df9924 100755 --- a/ChatTwo/Ui/ChatLog.cs +++ b/ChatTwo/Ui/ChatLog.cs @@ -463,29 +463,32 @@ internal sealed class ChatLog : IUiComponent { this.AddBacklog(trimmed); this._inputBacklogIdx = -1; - if (this._tellTarget != null) { - var target = this._tellTarget; - var reason = target.Reason; - var world = this.Ui.Plugin.DataManager.GetExcelSheet()?.GetRow(target.World); - if (world is { IsPublic: true }) { - if (reason == TellReason.Reply && this.Ui.Plugin.Common.Functions.FriendList.List.Any(friend => friend.ContentId == target.ContentId)) { - reason = TellReason.Friend; + if (!trimmed.StartsWith('/')) { + if (this._tellTarget != null) { + var target = this._tellTarget; + var reason = target.Reason; + var world = this.Ui.Plugin.DataManager.GetExcelSheet()?.GetRow(target.World); + if (world is { IsPublic: true }) { + if (reason == TellReason.Reply && this.Ui.Plugin.Common.Functions.FriendList.List.Any(friend => friend.ContentId == target.ContentId)) { + reason = TellReason.Friend; + } + + this.Ui.Plugin.Functions.Chat.SendTell(reason, target.ContentId, target.Name, (ushort) world.RowId, trimmed); } - this.Ui.Plugin.Functions.Chat.SendTell(reason, target.ContentId, target.Name, (ushort) world.RowId, trimmed); + if (this._tempChannel is InputChannel.Tell) { + this._tellTarget = null; + } + + goto Skip; } - if (this._tempChannel is InputChannel.Tell) { - this._tellTarget = null; + + if (this._tempChannel != null) { + trimmed = $"{this._tempChannel.Value.Prefix()} {trimmed}"; + } else if (activeTab is { Channel: { } channel }) { + trimmed = $"{channel.Prefix()} {trimmed}"; } - - goto Skip; - } - - if (this._tempChannel != null) { - trimmed = $"{this._tempChannel.Value.Prefix()} {trimmed}"; - } else if (activeTab is { Channel: { } channel } && !trimmed.StartsWith('/')) { - trimmed = $"{channel.Prefix()} {trimmed}"; } this.Ui.Plugin.Common.Functions.Chat.SendMessage(trimmed);