API 11
This commit is contained in:
+55
-43
@@ -19,8 +19,10 @@ using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Memory;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Info;
|
||||
using ImGuiNET;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
|
||||
@@ -57,7 +59,6 @@ public sealed class ChatLogWindow : Window
|
||||
private int InputBacklogIdx = -1;
|
||||
private int LastTab { get; set; }
|
||||
private InputChannel? TempChannel;
|
||||
internal TellTarget? TellTarget;
|
||||
public bool TellSpecial;
|
||||
private readonly Stopwatch LastResize = new();
|
||||
private AutoCompleteInfo? AutoCompleteInfo;
|
||||
@@ -128,7 +129,7 @@ public sealed class ChatLogWindow : Window
|
||||
Plugin.Commands.Register("/clearlog2").Execute -= ClearLog;
|
||||
}
|
||||
|
||||
private void Logout()
|
||||
private void Logout(int _, int __)
|
||||
{
|
||||
Plugin.MessageManager.ClearAllTabs();
|
||||
}
|
||||
@@ -138,8 +139,12 @@ public sealed class ChatLogWindow : Window
|
||||
Plugin.MessageManager.FilterAllTabsAsync();
|
||||
}
|
||||
|
||||
internal void Activated(ChatActivatedArgs args)
|
||||
internal unsafe void Activated(ChatActivatedArgs args)
|
||||
{
|
||||
// Return if we don't have a tab selected
|
||||
if (CurrentTab == null)
|
||||
return;
|
||||
|
||||
TellSpecial = args.TellSpecial;
|
||||
|
||||
Activate = true;
|
||||
@@ -176,18 +181,18 @@ public sealed class ChatLogWindow : Window
|
||||
|
||||
var tellInfo = Plugin.Functions.Chat.GetTellHistoryInfo(idx);
|
||||
if (tellInfo != null && reason != null)
|
||||
TellTarget = new TellTarget(tellInfo.Name, (ushort) tellInfo.World, tellInfo.ContentId, reason.Value);
|
||||
CurrentTab!.TellTarget = new TellTarget(tellInfo.Name, (ushort) tellInfo.World, tellInfo.ContentId, reason.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
TellTarget = null;
|
||||
CurrentTab!.TellTarget = null;
|
||||
if (target != null)
|
||||
TellTarget = target;
|
||||
CurrentTab!.TellTarget = target;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TellTarget = null;
|
||||
CurrentTab!.TellTarget = null;
|
||||
}
|
||||
|
||||
if (info.Channel is InputChannel.Linkshell1 or InputChannel.CrossLinkshell1 && info.Rotate != RotateMode.None)
|
||||
@@ -199,15 +204,13 @@ public sealed class ChatLogWindow : Window
|
||||
// Rotate using the game's code.
|
||||
if (info.Channel == InputChannel.Linkshell1)
|
||||
{
|
||||
var idx = GameFunctions.Chat.RotateLinkshellHistory(info.Rotate);
|
||||
if (idx >= 0 && GameFunctions.Chat.ValidLinkshell((uint)idx))
|
||||
targetChannel = info.Channel + (uint)idx;
|
||||
GameFunctions.Chat.RotateLinkshellHistory(info.Rotate);
|
||||
targetChannel = (InputChannel) AgentChatLog.Instance()->CurrentChannel;
|
||||
}
|
||||
else
|
||||
{
|
||||
var idx = GameFunctions.Chat.RotateCrossLinkshellHistory(info.Rotate);
|
||||
if (idx >= 0 && GameFunctions.Chat.ValidCrossLinkshell((uint)idx))
|
||||
targetChannel = info.Channel + (uint)idx;
|
||||
GameFunctions.Chat.RotateCrossLinkshellHistory(info.Rotate);
|
||||
targetChannel = (InputChannel)AgentChatLog.Instance()->CurrentChannel;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -293,17 +296,19 @@ public sealed class ChatLogWindow : Window
|
||||
AddTextCommandChannel(command, type);
|
||||
}
|
||||
|
||||
var echo = Sheets.TextCommandSheet.GetRow(116);
|
||||
if (echo != null)
|
||||
if (Sheets.TextCommandSheet.HasRow(116))
|
||||
{
|
||||
var echo = Sheets.TextCommandSheet.GetRow(116);
|
||||
AddTextCommandChannel(echo, ChatType.Echo);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddTextCommandChannel(TextCommand command, ChatType type)
|
||||
{
|
||||
TextCommandChannels[command.Command] = type;
|
||||
TextCommandChannels[command.ShortCommand] = type;
|
||||
TextCommandChannels[command.Alias] = type;
|
||||
TextCommandChannels[command.ShortAlias] = type;
|
||||
TextCommandChannels[command.Command.ExtractText()] = type;
|
||||
TextCommandChannels[command.ShortCommand.ExtractText()] = type;
|
||||
TextCommandChannels[command.Alias.ExtractText()] = type;
|
||||
TextCommandChannels[command.ShortAlias.ExtractText()] = type;
|
||||
}
|
||||
|
||||
private void SetUpAllCommands()
|
||||
@@ -313,10 +318,10 @@ public sealed class ChatLogWindow : Window
|
||||
|
||||
var commandNames = commands.SelectMany(cmd => new[]
|
||||
{
|
||||
cmd.Command.RawString,
|
||||
cmd.ShortCommand.RawString,
|
||||
cmd.Alias.RawString,
|
||||
cmd.ShortAlias.RawString,
|
||||
cmd.Command.ExtractText(),
|
||||
cmd.ShortCommand.ExtractText(),
|
||||
cmd.Alias.ExtractText(),
|
||||
cmd.ShortAlias.ExtractText(),
|
||||
});
|
||||
|
||||
foreach (var command in commandNames)
|
||||
@@ -673,8 +678,8 @@ public sealed class ChatLogWindow : Window
|
||||
UIModule.PlaySound(ChatCloseSfx);
|
||||
}
|
||||
|
||||
if (TempChannel is InputChannel.Tell)
|
||||
TellTarget = null;
|
||||
if (TempChannel is InputChannel.Tell && CurrentTab != null)
|
||||
CurrentTab.TellTarget = null;
|
||||
|
||||
TempChannel = null;
|
||||
if (Plugin.Functions.Chat.UsesTellTempChannel)
|
||||
@@ -724,7 +729,7 @@ public sealed class ChatLogWindow : Window
|
||||
var channels = new Dictionary<string, InputChannel>();
|
||||
foreach (var channel in Enum.GetValues<InputChannel>())
|
||||
{
|
||||
var name = Sheets.LogFilterSheet.FirstOrDefault(row => row.LogKind == (byte) channel.ToChatType())?.Name?.RawString ?? channel.ToChatType().Name();
|
||||
var name = Sheets.LogFilterSheet.FirstOrNull(row => row.LogKind == (byte) channel.ToChatType())?.Name.ExtractText() ?? channel.ToChatType().Name();
|
||||
if (channel.IsLinkshell())
|
||||
{
|
||||
var lsName = Plugin.Functions.Chat.GetLinkshellName(channel.LinkshellIndex());
|
||||
@@ -774,14 +779,17 @@ public sealed class ChatLogWindow : Window
|
||||
internal Chunk[] ReadChannelName(Tab? activeTab)
|
||||
{
|
||||
Chunk[] channelNameChunks;
|
||||
if (TellTarget != null)
|
||||
if (activeTab?.TellTarget != null)
|
||||
{
|
||||
var playerName = TellTarget.Name;
|
||||
var playerName = activeTab.TellTarget.Name;
|
||||
if (ScreenshotMode)
|
||||
// Note: don't use HidePlayerInString here because
|
||||
// abbreviation settings do not affect this.
|
||||
playerName = HashPlayer(TellTarget.Name, TellTarget.World);
|
||||
var world = Sheets.WorldSheet.GetRow(TellTarget.World)?.Name?.RawString ?? "???";
|
||||
playerName = HashPlayer(activeTab.TellTarget.Name, activeTab.TellTarget.World);
|
||||
|
||||
var world = Sheets.WorldSheet.HasRow(activeTab.TellTarget.World)
|
||||
? Sheets.WorldSheet.GetRow(activeTab.TellTarget.World).Name.ExtractText()
|
||||
: "???";
|
||||
|
||||
channelNameChunks =
|
||||
[
|
||||
@@ -834,7 +842,9 @@ public sealed class ChatLogWindow : Window
|
||||
// Note: don't use HidePlayerInString here because
|
||||
// abbreviation settings do not affect this.
|
||||
var playerName = HashPlayer(tellPlayerName, tellWorldId);
|
||||
var world = Sheets.WorldSheet.GetRow(tellWorldId)?.Name?.RawString ?? "???";
|
||||
var world = Sheets.WorldSheet.HasRow(tellWorldId)
|
||||
? Sheets.WorldSheet.GetRow(tellWorldId).Name.ExtractText()
|
||||
: "???";
|
||||
|
||||
channelNameChunks =
|
||||
[
|
||||
@@ -862,7 +872,8 @@ public sealed class ChatLogWindow : Window
|
||||
internal void SetChannel(InputChannel? channel)
|
||||
{
|
||||
channel ??= InputChannel.Say;
|
||||
TellTarget = null;
|
||||
if (CurrentTab != null)
|
||||
CurrentTab.TellTarget = null;
|
||||
|
||||
// Instead of calling SetChannel(), we ask the ExtraChat plugin to set a
|
||||
// channel override by just calling the command directly.
|
||||
@@ -901,8 +912,8 @@ public sealed class ChatLogWindow : Window
|
||||
Plugin.Functions.Chat.SendTellUsingCommandInner(tellBytes);
|
||||
|
||||
TellSpecial = false;
|
||||
if (TempChannel is InputChannel.Tell)
|
||||
TellTarget = null;
|
||||
if (TempChannel is InputChannel.Tell && CurrentTab != null)
|
||||
CurrentTab.TellTarget = null;
|
||||
|
||||
Chat = string.Empty;
|
||||
return;
|
||||
@@ -910,9 +921,9 @@ public sealed class ChatLogWindow : Window
|
||||
|
||||
if (!trimmed.StartsWith('/'))
|
||||
{
|
||||
if (TellTarget != null)
|
||||
if (CurrentTab?.TellTarget != null)
|
||||
{
|
||||
var target = TellTarget;
|
||||
var target = CurrentTab.TellTarget;
|
||||
var reason = target.Reason;
|
||||
var world = Sheets.WorldSheet.GetRow(target.World);
|
||||
if (world is { IsPublic: true })
|
||||
@@ -927,7 +938,7 @@ public sealed class ChatLogWindow : Window
|
||||
}
|
||||
|
||||
if (TempChannel is InputChannel.Tell)
|
||||
TellTarget = null;
|
||||
CurrentTab.TellTarget = null;
|
||||
|
||||
Chat = string.Empty;
|
||||
return;
|
||||
@@ -1213,6 +1224,7 @@ public sealed class ChatLogWindow : Window
|
||||
var switchedTab = LastTab != tabI;
|
||||
if (switchedTab)
|
||||
TabChannelSwitch(tab);
|
||||
|
||||
LastTab = tabI;
|
||||
tab.Unread = 0;
|
||||
|
||||
@@ -1588,12 +1600,12 @@ public sealed class ChatLogWindow : Window
|
||||
if (text.StartsWith('/'))
|
||||
{
|
||||
var command = text.Split(' ')[0];
|
||||
var cmd = Sheets.TextCommandSheet.FirstOrDefault(cmd =>
|
||||
cmd.Command.RawString == command || cmd.Alias.RawString == command ||
|
||||
cmd.ShortCommand.RawString == command || cmd.ShortAlias.RawString == command);
|
||||
var cmd = Sheets.TextCommandSheet.FirstOrNull(cmd =>
|
||||
cmd.Command.ExtractText() == command || cmd.Alias.ExtractText() == command ||
|
||||
cmd.ShortCommand.ExtractText() == command || cmd.ShortAlias.ExtractText() == command);
|
||||
|
||||
if (cmd != null)
|
||||
Plugin.CommandHelpWindow.UpdateContent(cmd);
|
||||
Plugin.CommandHelpWindow.UpdateContent(cmd.Value);
|
||||
}
|
||||
|
||||
if (data->EventFlag != ImGuiInputTextFlags.CallbackHistory)
|
||||
@@ -1733,7 +1745,7 @@ public sealed class ChatLogWindow : Window
|
||||
if (chunk.Link is PlayerPayload playerPayload)
|
||||
content = HidePlayerInString(content, playerPayload.PlayerName, playerPayload.World.RowId);
|
||||
else if (Plugin.ClientState.LocalPlayer is { } player)
|
||||
content = HidePlayerInString(content, player.Name.TextValue, player.HomeWorld.Id);
|
||||
content = HidePlayerInString(content, player.Name.TextValue, player.HomeWorld.RowId);
|
||||
}
|
||||
|
||||
if (wrap)
|
||||
|
||||
@@ -4,7 +4,7 @@ using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Utility;
|
||||
using ImGuiNET;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
|
||||
@@ -59,6 +59,6 @@ public class CommandHelpWindow : Window {
|
||||
if (Command == null)
|
||||
return;
|
||||
|
||||
LogWindow.DrawChunks(ChunkUtil.ToChunks(Command.Description.ToDalamudString(), ChunkSource.None, null).ToList());
|
||||
LogWindow.DrawChunks(ChunkUtil.ToChunks(Command.Value.Description.ToDalamudString(), ChunkSource.None, null).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.Sheets;
|
||||
using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
@@ -84,11 +85,11 @@ public class SeStringDebugger : Window
|
||||
{
|
||||
RenderMetadataDictionary("Link MapLinkPayload", new Dictionary<string, string?>
|
||||
{
|
||||
{ "Map.RowId", map.Map?.RowId.ToString() },
|
||||
{ "Map.PlaceName", map.Map?.PlaceName.Value?.Name.ToString() },
|
||||
{ "Map.PlaceNameRegion", map.Map?.PlaceNameRegion.Value?.Name.ToString() },
|
||||
{ "Map.PlaceNameSub", map.Map?.PlaceNameSub.Value?.Name.ToString() },
|
||||
{ "TerritoryType.RowId", map.TerritoryType?.RowId.ToString() },
|
||||
{ "Map.RowId", map.Map.RowId.ToString() },
|
||||
{ "Map.PlaceName", map.Map.Value.PlaceName.Value.Name.ToString() },
|
||||
{ "Map.PlaceNameRegion", map.Map.Value.PlaceNameRegion.Value.Name.ToString() },
|
||||
{ "Map.PlaceNameSub", map.Map.Value.PlaceNameSub.Value.Name.ToString() },
|
||||
{ "TerritoryType.RowId", map.TerritoryType.RowId.ToString() },
|
||||
{ "RawX", map.RawX.ToString() },
|
||||
{ "RawY", map.RawY.ToString() },
|
||||
{ "XCoord", map.XCoord.ToString() },
|
||||
@@ -102,8 +103,8 @@ public class SeStringDebugger : Window
|
||||
{
|
||||
RenderMetadataDictionary("Link QuestPayload", new Dictionary<string, string?>
|
||||
{
|
||||
{ "Quest.RowId", quest.Quest?.RowId.ToString() },
|
||||
{ "Quest.Name", quest.Quest?.Name.ToString() },
|
||||
{ "Quest.RowId", quest.Quest.RowId.ToString() },
|
||||
{ "Quest.Name", quest.Quest.Value.Name.ToString() },
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -131,7 +132,7 @@ public class SeStringDebugger : Window
|
||||
{
|
||||
{ "Displayed", player.DisplayedName },
|
||||
{ "Player Name", player.PlayerName },
|
||||
{ "World Name", player.World.Name },
|
||||
{ "World Name", player.World.Value.Name.ExtractText() },
|
||||
{ "Data", string.Join(" ", player.Encode().Select(b => b.ToString("X2"))) },
|
||||
});
|
||||
break;
|
||||
@@ -144,7 +145,7 @@ public class SeStringDebugger : Window
|
||||
{ "RawItemId", item.RawItemId.ToString() },
|
||||
{ "Kind", EnumName(item.Kind) },
|
||||
{ "IsHQ", item.IsHQ.ToString() },
|
||||
{ "Item.Name", item.Item?.Name.ToString() },
|
||||
{ "Item.Name", item.Kind == ItemPayload.ItemKind.EventItem ? Sheets.EventItemSheet.GetRow(item.ItemId).Name.ExtractText() : Sheets.ItemSheet.GetRow(item.ItemId).Name.ExtractText() },
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -197,8 +198,8 @@ public class SeStringDebugger : Window
|
||||
RenderMetadataDictionary("Link StatusPayload", new Dictionary<string, string?>
|
||||
{
|
||||
{ "Status.RowId", status.Status.RowId.ToString() },
|
||||
{ "Status.Name", status.Status.Name },
|
||||
{ "Status.Icon", status.Status.Icon.ToString() }
|
||||
{ "Status.Name", status.Status.Value.Name.ExtractText() },
|
||||
{ "Status.Icon", status.Status.Value.Icon.ToString() }
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ internal sealed class Database : ISettingsTab
|
||||
// Generate
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
var playerName = Plugin.ClientState.LocalPlayer?.Name.ToString() ?? "Unknown Player";
|
||||
var worldId = Plugin.ClientState.LocalPlayer?.HomeWorld.Id ?? 0;
|
||||
var worldId = Plugin.ClientState.LocalPlayer?.HomeWorld.RowId ?? 0;
|
||||
var senderSource = new SeStringBuilder()
|
||||
.AddText("<")
|
||||
.Add(new PlayerPayload(playerName, worldId))
|
||||
|
||||
Reference in New Issue
Block a user