diff --git a/.editorconfig b/.editorconfig
index 4c3ba4a..64861ff 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -11,7 +11,7 @@ resharper_csharp_brace_style=next_line
resharper_csharp_braces_for_foreach=not_required
resharper_csharp_braces_for_for=not_required
resharper_csharp_braces_for_while=not_required
-charset=utf-8-bom
+charset=utf-8
end_of_line=crlf
# Microsoft .NET properties
diff --git a/ChatTwo.Tests/ChatTwo.Tests.csproj b/ChatTwo.Tests/ChatTwo.Tests.csproj
index 8c20f47..07a4679 100644
--- a/ChatTwo.Tests/ChatTwo.Tests.csproj
+++ b/ChatTwo.Tests/ChatTwo.Tests.csproj
@@ -7,10 +7,10 @@
-
-
-
-
+
+
+
+
diff --git a/ChatTwo/ChatTwo.csproj b/ChatTwo/ChatTwo.csproj
index ddab22c..ebd8a38 100755
--- a/ChatTwo/ChatTwo.csproj
+++ b/ChatTwo/ChatTwo.csproj
@@ -1,6 +1,6 @@
- 1.29.3
+ 1.29.4
net8.0-windows
enable
enable
@@ -53,13 +53,13 @@
-
+
-
-
-
+
+
+
-
+
diff --git a/ChatTwo/Code/InputChannelExt.cs b/ChatTwo/Code/InputChannelExt.cs
index 57a5733..537dfef 100755
--- a/ChatTwo/Code/InputChannelExt.cs
+++ b/ChatTwo/Code/InputChannelExt.cs
@@ -1,5 +1,5 @@
using Dalamud.Plugin.Services;
-using Lumina.Excel.GeneratedSheets;
+using Lumina.Excel.Sheets;
namespace ChatTwo.Code;
@@ -146,7 +146,7 @@ internal static class InputChannelExt
return null;
var cmds = data.GetExcelSheet();
- return cmds == null ? null : ids.Select(id => cmds.GetRow(id)).Where(id => id != null).Cast();
+ return ids.Where(id => cmds.HasRow(id)).Select(id => cmds.GetRow(id));
}
internal static bool IsLinkshell(this InputChannel channel) => channel switch
diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs
index da72e85..8c5d23c 100755
--- a/ChatTwo/Configuration.cs
+++ b/ChatTwo/Configuration.cs
@@ -237,20 +237,14 @@ internal class Tab
public float Opacity = 100f;
public bool InputDisabled;
- [NonSerialized]
- public uint Unread;
+ [NonSerialized] public uint Unread;
+ [NonSerialized] public long LastActivity;
+ [NonSerialized] public MessageList Messages = new();
- [NonSerialized]
- public long LastActivity;
+ [NonSerialized] public TellTarget? TellTarget;
+ [NonSerialized] public InputChannel? PreviousChannel;
- [NonSerialized]
- public MessageList Messages = new();
-
- [NonSerialized]
- public InputChannel? PreviousChannel;
-
- [NonSerialized]
- public Guid Identifier = Guid.NewGuid();
+ [NonSerialized] public Guid Identifier = Guid.NewGuid();
internal bool Matches(Message message) => message.Matches(ChatCodes, ExtraChatAll, ExtraChatChannels);
diff --git a/ChatTwo/GameFunctions/Chat.cs b/ChatTwo/GameFunctions/Chat.cs
index 6122047..19acf5e 100755
--- a/ChatTwo/GameFunctions/Chat.cs
+++ b/ChatTwo/GameFunctions/Chat.cs
@@ -29,7 +29,7 @@ internal sealed unsafe class Chat : IDisposable
[Signature("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 48 8D B9 ?? ?? ?? ?? 33 C0")]
private readonly delegate* unmanaged PrintTellNative = null!;
- [Signature("E8 ?? ?? ?? ?? 48 8D 4C 24 ?? E8 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? B0 01")]
+ [Signature("E8 ?? ?? ?? ?? 48 8D 4C 24 ?? E8 ?? ?? ?? ?? 48 8D 8C 24 ?? ?? ?? ?? E8 ?? ?? ?? ?? B0 ?? 48 8B 8C 24")]
private readonly delegate* unmanaged SendTellNative = null!;
// Client::UI::AddonChatLog.OnRefresh
@@ -38,7 +38,7 @@ internal sealed unsafe class Chat : IDisposable
private delegate byte ChatLogRefreshDelegate(nint log, ushort eventId, AtkValue* value);
// Replace with CS version later
- [Signature("E8 ?? ?? ?? ?? EB 81 48 8B 1D", DetourName = nameof(ContextMenuTellInForayDetour))]
+ [Signature("48 89 5C 24 ?? 55 56 57 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 83 B9", DetourName = nameof(ContextMenuTellInForayDetour))]
private Hook? ContextMenuTellInForayHook { get; set; }
private delegate void ContextMenuTellInForayDelegate(RaptureShellModule* module, Utf8String* playerName, Utf8String* worldName, ushort worldId, ulong accountId, ulong contentId, ushort reason);
@@ -123,16 +123,16 @@ internal sealed unsafe class Chat : IDisposable
_ => 0,
};
- internal static int RotateLinkshellHistory(RotateMode mode)
+ internal static void RotateLinkshellHistory(RotateMode mode)
{
var uiModule = UIModule.Instance();
if (mode == RotateMode.None)
uiModule->LinkshellCycle = -1;
- return uiModule->RotateLinkshellHistory(GetRotateIdx(mode));
+ uiModule->RotateLinkshellHistory(GetRotateIdx(mode));
}
- internal static int RotateCrossLinkshellHistory(RotateMode mode) =>
+ internal static void RotateCrossLinkshellHistory(RotateMode mode) =>
UIModule.Instance()->RotateCrossLinkshellHistory(GetRotateIdx(mode));
// This function looks up a channel's user-defined color.
diff --git a/ChatTwo/GameFunctions/ChatBox.cs b/ChatTwo/GameFunctions/ChatBox.cs
index 6f68ff8..efbdc57 100644
--- a/ChatTwo/GameFunctions/ChatBox.cs
+++ b/ChatTwo/GameFunctions/ChatBox.cs
@@ -8,7 +8,7 @@ namespace ChatTwo.GameFunctions;
// From: https://git.anna.lgbt/anna/XivCommon/src/branch/main/XivCommon/Functions/Chat.cs
public unsafe class ChatCommon
{
- [Signature("48 89 5C 24 ?? 57 48 83 EC 20 48 8B FA 48 8B D9 45 84 C9")]
+ [Signature("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 48 8B F2 48 8B F9 45 84 C9")]
private readonly delegate* unmanaged ProcessChatBox = null!;
internal ChatCommon()
diff --git a/ChatTwo/GameFunctions/GameFunctions.cs b/ChatTwo/GameFunctions/GameFunctions.cs
index 59200fe..a9aceea 100755
--- a/ChatTwo/GameFunctions/GameFunctions.cs
+++ b/ChatTwo/GameFunctions/GameFunctions.cs
@@ -10,7 +10,8 @@ using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using FFXIVClientStructs.FFXIV.Client.UI.Info;
using FFXIVClientStructs.FFXIV.Component.GUI;
-using Lumina.Excel.GeneratedSheets;
+using Lumina.Excel;
+using Lumina.Excel.Sheets;
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
namespace ChatTwo.GameFunctions;
@@ -61,11 +62,9 @@ internal unsafe class GameFunctions : IDisposable
private void ListCommand(string name, ushort world, string commandName)
{
- var row = Plugin.DataManager.GetExcelSheet()!.GetRow(world);
- if (row == null)
- return;
+ var row = Plugin.DataManager.GetExcelSheet().GetRow(world);
- var worldName = row.Name.RawString;
+ var worldName = row.Name.ExtractText();
ReplacementName = $"{name}@{worldName}";
Plugin.Common.SendMessage($"/{commandName} add {Placeholder}");
}
@@ -174,9 +173,9 @@ internal unsafe class GameFunctions : IDisposable
return InfoProxyFriendList.Instance()->CharDataSpan.ToArray();
}
- internal static void OpenQuestLog(Quest quest)
+ internal static void OpenQuestLog(RowRef quest)
{
- var splits = quest.Id.RawString.Split("_");
+ var splits = quest.Value.Id.ExtractText().Split("_");
if (splits.Length != 2)
{
Plugin.ChatGui.Print("QuestId is wrongly formatted");
diff --git a/ChatTwo/Http/Processing.cs b/ChatTwo/Http/Processing.cs
index 6040d76..aac8300 100644
--- a/ChatTwo/Http/Processing.cs
+++ b/ChatTwo/Http/Processing.cs
@@ -86,7 +86,7 @@ public class Processing
if (chunk.Link is PlayerPayload playerPayload)
userContent = Plugin.ChatLogWindow.HidePlayerInString(userContent, playerPayload.PlayerName, playerPayload.World.RowId);
else if (Plugin.ClientState.LocalPlayer is { } player)
- userContent = Plugin.ChatLogWindow.HidePlayerInString(userContent, player.Name.TextValue, player.HomeWorld.Id);
+ userContent = Plugin.ChatLogWindow.HidePlayerInString(userContent, player.Name.TextValue, player.HomeWorld.RowId);
}
var isNotUrl = text.Link is not UriPayload;
diff --git a/ChatTwo/Message.cs b/ChatTwo/Message.cs
index 85f87b9..6c4b9aa 100755
--- a/ChatTwo/Message.cs
+++ b/ChatTwo/Message.cs
@@ -6,7 +6,7 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
using System.Text.RegularExpressions;
using Dalamud.Game.Text;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
-using Lumina.Excel.GeneratedSheets;
+using Lumina.Excel.Sheets;
namespace ChatTwo;
diff --git a/ChatTwo/MessageManager.cs b/ChatTwo/MessageManager.cs
index f84624f..4986a84 100644
--- a/ChatTwo/MessageManager.cs
+++ b/ChatTwo/MessageManager.cs
@@ -8,8 +8,9 @@ using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Hooking;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Plugin.Services;
+using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
-using Lumina.Excel.GeneratedSheets;
+using Lumina.Excel.Sheets;
namespace ChatTwo;
@@ -90,7 +91,7 @@ internal class MessageManager : IAsyncDisposable
return Path.Join(Plugin.Interface.ConfigDirectory.FullName, "chat-sqlite.db");
}
- private void Logout()
+ private void Logout(int _, int __)
{
LastContentId = 0;
}
@@ -298,11 +299,8 @@ internal class MessageManager : IAsyncDisposable
if (Formats.TryGetValue(type, out var cached))
return cached;
- var logKind = Plugin.DataManager.GetExcelSheet()!.GetRow((ushort)type);
- if (logKind == null)
- return null;
-
- var format = (SeString)logKind.Format;
+ var logKind = Plugin.DataManager.GetExcelSheet().GetRow((ushort)type);
+ var format = logKind.Format.ToDalamudString();
static bool IsStringParam(Payload payload, byte num)
{
diff --git a/ChatTwo/PayloadHandler.cs b/ChatTwo/PayloadHandler.cs
index 312d19d..98165fc 100755
--- a/ChatTwo/PayloadHandler.cs
+++ b/ChatTwo/PayloadHandler.cs
@@ -14,15 +14,12 @@ using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
-using Dalamud.Memory;
using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.LayoutEngine;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET;
-using Lumina.Excel;
-using Lumina.Excel.GeneratedSheets;
-
+using Lumina.Excel.Sheets;
using Action = System.Action;
using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload;
using ChatTwoPartyFinderPayload = ChatTwo.Util.PartyFinderPayload;
@@ -40,21 +37,11 @@ public sealed class PayloadHandler {
public uint HoverCounter;
public uint LastHoverCounter;
- private readonly ExcelSheet- ItemSheet;
- private readonly ExcelSheet EventItemSheet;
- private readonly ExcelSheet TerritorySheet;
- private readonly ExcelSheet EventItemHelpSheet;
-
private const uint PopupSfx = 1u;
internal PayloadHandler(ChatLogWindow logWindow)
{
LogWindow = logWindow;
-
- ItemSheet = Plugin.DataManager.GetExcelSheet
- ()!;
- EventItemSheet = Plugin.DataManager.GetExcelSheet()!;
- TerritorySheet = Plugin.DataManager.GetExcelSheet()!;
- EventItemHelpSheet = Plugin.DataManager.GetExcelSheet()!;
}
internal void Draw()
@@ -325,15 +312,15 @@ public sealed class PayloadHandler {
private void HoverStatus(StatusPayload status)
{
- if (Plugin.TextureProvider.GetFromGameIcon(status.Status.Icon).GetWrapOrDefault() is { } icon)
+ if (Plugin.TextureProvider.GetFromGameIcon(status.Status.Value.Icon).GetWrapOrDefault() is { } icon)
InlineIcon(icon);
- var nameString = ResolveRsv(status.Status.Name.ToDalamudString());
+ var nameString = ResolveRsv(status.Status.Value.Name.ToDalamudString());
var name = ChunkUtil.ToChunks(nameString, ChunkSource.None, null);
LogWindow.DrawChunks(name.ToList());
ImGui.Separator();
- var descString = ResolveRsv(status.Status.Description.ToDalamudString());
+ var descString = ResolveRsv(status.Status.Value.Description.ToDalamudString());
var desc = ChunkUtil.ToChunks(descString, ChunkSource.None, null);
LogWindow.DrawChunks(desc.ToList());
}
@@ -346,26 +333,24 @@ public sealed class PayloadHandler {
return;
}
- if (item.Item == null)
- return;
-
- if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(item.Item.Icon, item.IsHQ)).GetWrapOrDefault() is { } icon)
+ item.Item.TryGetValue(out Item resolvedItem);
+ if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(resolvedItem.Icon, item.IsHQ)).GetWrapOrDefault() is { } icon)
InlineIcon(icon);
- var name = ChunkUtil.ToChunks(item.Item.Name.ToDalamudString(), ChunkSource.None, null);
+ var name = ChunkUtil.ToChunks(resolvedItem.Name.ToDalamudString(), ChunkSource.None, null);
LogWindow.DrawChunks(name.ToList());
ImGui.Separator();
- var desc = ChunkUtil.ToChunks(item.Item.Description.ToDalamudString(), ChunkSource.None, null);
+ var desc = ChunkUtil.ToChunks(resolvedItem.Description.ToDalamudString(), ChunkSource.None, null);
LogWindow.DrawChunks(desc.ToList());
}
private void HoverEventItem(ItemPayload payload)
{
- var item = EventItemSheet.GetRow(payload.RawItemId);
- if (item == null)
+ if (!Sheets.EventItemSheet.HasRow(payload.RawItemId))
return;
+ var item = Sheets.EventItemSheet.GetRow(payload.RawItemId);
if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(item.Icon)).GetWrapOrDefault() is { } icon)
InlineIcon(icon);
@@ -373,12 +358,11 @@ public sealed class PayloadHandler {
LogWindow.DrawChunks(name.ToList());
ImGui.Separator();
- var help = EventItemHelpSheet.GetRow(payload.RawItemId);
- if (help != null)
- {
- var desc = ChunkUtil.ToChunks(help.Description.ToDalamudString(), ChunkSource.None, null);
- LogWindow.DrawChunks(desc.ToList());
- }
+ if (!Sheets.EventItemHelpSheet.HasRow(payload.RawItemId))
+ return;
+
+ var help = Sheets.EventItemHelpSheet.GetRow(payload.RawItemId);
+ LogWindow.DrawChunks(ChunkUtil.ToChunks(help.Description.ToDalamudString(), ChunkSource.None, null).ToList());
}
private void HoverURI(UriPayload uri)
@@ -467,10 +451,10 @@ public sealed class PayloadHandler {
return;
}
- var item = ItemSheet.GetRow(payload.ItemId);
- if (item == null)
+ if (!Sheets.ItemSheet.HasRow(payload.ItemId))
return;
+ var item = Sheets.ItemSheet.GetRow(payload.ItemId);
var hq = payload.Kind == ItemPayload.ItemKind.Hq;
if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(item.Icon, hq)).GetWrapOrDefault() is { } icon)
InlineIcon(icon);
@@ -486,7 +470,7 @@ public sealed class PayloadHandler {
ImGui.Separator();
var realItemId = payload.RawItemId;
- if (item.EquipSlotCategory.Row != 0)
+ if (item.EquipSlotCategory.RowId != 0)
{
if (ImGui.Selectable(Language.Context_TryOn))
GameFunctions.Context.TryOn(realItemId, 0);
@@ -495,7 +479,7 @@ public sealed class PayloadHandler {
GameFunctions.Context.OpenItemComparison(realItemId);
}
- if (item.ItemSearchCategory.Value?.Category == 3)
+ if (item.ItemSearchCategory.Value.Category == 3)
if (ImGui.Selectable(Language.Context_SearchRecipes))
GameFunctions.Context.SearchForRecipesUsingItem(payload.ItemId);
@@ -514,10 +498,10 @@ public sealed class PayloadHandler {
if (payload.Kind != ItemPayload.ItemKind.EventItem)
return;
- var item = EventItemSheet.GetRow(payload.ItemId);
- if (item == null)
+ if (!Sheets.EventItemSheet.HasRow(payload.ItemId))
return;
+ var item = Sheets.EventItemSheet.GetRow(payload.ItemId);
if (Plugin.TextureProvider.GetFromGameIcon(new GameIconLookup(item.Icon)).GetWrapOrDefault() is { } icon)
InlineIcon(icon);
@@ -541,16 +525,16 @@ public sealed class PayloadHandler {
var world = player.World;
if (chunk.Message?.Code.Type == ChatType.FreeCompanyLoginLogout)
- if (Plugin.ClientState.LocalPlayer?.HomeWorld.GameData is { } homeWorld)
- world = homeWorld;
+ if (Plugin.ClientState.LocalPlayer?.HomeWorld.IsValid == true)
+ world = Plugin.ClientState.LocalPlayer.HomeWorld;
var name = new List { new TextChunk(ChunkSource.None, null, player.PlayerName) };
- if (world.IsPublic)
+ if (world.Value.IsPublic)
{
name.AddRange(new Chunk[]
{
new IconChunk(ChunkSource.None, null, BitmapFontIcon.CrossWorld),
- new TextChunk(ChunkSource.None, null, world.Name),
+ new TextChunk(ChunkSource.None, null, world.Value.Name.ExtractText()),
});
}
@@ -561,31 +545,31 @@ public sealed class PayloadHandler {
if (ImGui.Selectable(Language.Context_SendTell))
{
// Eureka and Bozja need special handling as tells work different
- if (TerritorySheet.GetRow(Plugin.ClientState.TerritoryType)?.TerritoryIntendedUse != 41)
+ if (Sheets.TerritorySheet.GetRow(Plugin.ClientState.TerritoryType).TerritoryIntendedUse.RowId != 41)
{
LogWindow.Chat = $"/tell {player.PlayerName}";
- if (world.IsPublic)
- LogWindow.Chat += $"@{world.Name}";
+ if (world.Value.IsPublic)
+ LogWindow.Chat += $"@{world.Value.Name}";
LogWindow.Chat += " ";
}
else if (validContentId)
{
- LogWindow.Plugin.Functions.Chat.SetEurekaTellChannel(player.PlayerName, world.Name.ToString(), (ushort) world.RowId, 0, chunk.Message!.ContentId, 0, false);
+ LogWindow.Plugin.Functions.Chat.SetEurekaTellChannel(player.PlayerName, world.Value.Name.ToString(), (ushort) world.RowId, 0, chunk.Message!.ContentId, 0, false);
}
LogWindow.Activate = true;
}
- if (world.IsPublic)
+ if (world.Value.IsPublic)
{
var party = Plugin.PartyList;
var leader = (ulong?) party[(int) party.PartyLeaderIndex]?.ContentId;
var isLeader = party.Length == 0 || Plugin.ClientState.LocalContentId == leader;
- var member = party.FirstOrDefault(member => member.Name.TextValue == player.PlayerName && member.World.Id == world.RowId);
+ var member = party.FirstOrDefault(member => member.Name.TextValue == player.PlayerName && member.World.RowId == world.RowId);
var isInParty = member != default;
var inInstance = GameFunctions.GameFunctions.IsInInstance();
- var inPartyInstance = TerritorySheet.GetRow(Plugin.ClientState.TerritoryType)?.TerritoryIntendedUse is (41 or 47 or 48 or 52 or 53);
+ var inPartyInstance = Sheets.TerritorySheet.GetRow(Plugin.ClientState.TerritoryType).TerritoryIntendedUse.RowId is (41 or 47 or 48 or 52 or 53);
if (isLeader)
{
if (!isInParty)
@@ -655,7 +639,7 @@ public sealed class PayloadHandler {
if (character.Name.TextValue != payload.PlayerName)
continue;
- if (payload.World.IsPublic && character.HomeWorld.Id != payload.World.RowId)
+ if (payload.World.Value.IsPublic && character.HomeWorld.RowId != payload.World.RowId)
continue;
return character;
diff --git a/ChatTwo/Sheets.cs b/ChatTwo/Sheets.cs
index 93e4fbd..9bea4ee 100644
--- a/ChatTwo/Sheets.cs
+++ b/ChatTwo/Sheets.cs
@@ -1,5 +1,5 @@
using Lumina.Excel;
-using Lumina.Excel.GeneratedSheets;
+using Lumina.Excel.Sheets;
namespace ChatTwo;
@@ -8,13 +8,21 @@ public static class Sheets
public static readonly ExcelSheet
- ItemSheet;
public static readonly ExcelSheet WorldSheet;
public static readonly ExcelSheet LogFilterSheet;
+ public static readonly ExcelSheet EventItemSheet;
+ public static readonly ExcelSheet CompletionSheet;
+ public static readonly ExcelSheet TerritorySheet;
public static readonly ExcelSheet TextCommandSheet;
+ public static readonly ExcelSheet EventItemHelpSheet;
static Sheets()
{
- ItemSheet = Plugin.DataManager.GetExcelSheet
- ()!;
- WorldSheet = Plugin.DataManager.GetExcelSheet()!;
- LogFilterSheet = Plugin.DataManager.GetExcelSheet()!;
- TextCommandSheet = Plugin.DataManager.GetExcelSheet()!;
+ ItemSheet = Plugin.DataManager.GetExcelSheet
- ();
+ WorldSheet = Plugin.DataManager.GetExcelSheet();
+ EventItemSheet = Plugin.DataManager.GetExcelSheet();
+ LogFilterSheet = Plugin.DataManager.GetExcelSheet();
+ CompletionSheet = Plugin.DataManager.GetExcelSheet();
+ TerritorySheet = Plugin.DataManager.GetExcelSheet();
+ TextCommandSheet = Plugin.DataManager.GetExcelSheet();
+ EventItemHelpSheet = Plugin.DataManager.GetExcelSheet();
}
}
\ No newline at end of file
diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs
index 81bbfb2..870964b 100644
--- a/ChatTwo/Ui/ChatLogWindow.cs
+++ b/ChatTwo/Ui/ChatLogWindow.cs
@@ -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();
foreach (var channel in Enum.GetValues())
{
- 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)
diff --git a/ChatTwo/Ui/CommandHelpWindow.cs b/ChatTwo/Ui/CommandHelpWindow.cs
index b7d118c..ca91123 100644
--- a/ChatTwo/Ui/CommandHelpWindow.cs
+++ b/ChatTwo/Ui/CommandHelpWindow.cs
@@ -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());
}
}
diff --git a/ChatTwo/Ui/SeStringDebugger.cs b/ChatTwo/Ui/SeStringDebugger.cs
index caa3c3b..150df99 100644
--- a/ChatTwo/Ui/SeStringDebugger.cs
+++ b/ChatTwo/Ui/SeStringDebugger.cs
@@ -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
{
- { "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
{
- { "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
{
{ "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;
}
diff --git a/ChatTwo/Ui/SettingsTabs/Database.cs b/ChatTwo/Ui/SettingsTabs/Database.cs
index 775f6f7..66f104e 100755
--- a/ChatTwo/Ui/SettingsTabs/Database.cs
+++ b/ChatTwo/Ui/SettingsTabs/Database.cs
@@ -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))
diff --git a/ChatTwo/Util/AutoTranslate.cs b/ChatTwo/Util/AutoTranslate.cs
index 7681d62..b225a6b 100644
--- a/ChatTwo/Util/AutoTranslate.cs
+++ b/ChatTwo/Util/AutoTranslate.cs
@@ -5,8 +5,7 @@ using Dalamud.Game;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Utility;
-using Lumina.Excel;
-using Lumina.Excel.GeneratedSheets;
+using Lumina.Excel.Sheets;
using Pidgin;
using static Pidgin.Parser;
using static Pidgin.Parser;
@@ -19,13 +18,6 @@ internal static class AutoTranslate
private static readonly Dictionary> Entries = new();
private static readonly HashSet<(uint, uint)> ValidEntries = [];
- private static readonly ExcelSheet CompletionSheet;
-
- static AutoTranslate()
- {
- CompletionSheet = Plugin.DataManager.GetExcelSheet()!;
- }
-
private static Parser> selector)> Parser()
{
var sheetName = Any
@@ -125,117 +117,123 @@ internal static class AutoTranslate
var parser = Parser();
var list = new List();
- foreach (var row in CompletionSheet)
- {
- var lookup = row.LookupTable.TextValue();
- if (lookup is not ("" or "@"))
- {
- var (sheetName, selector) = parser.ParseOrThrow(lookup);
- var sheetType = typeof(Completion)
- .Assembly
- .GetType($"Lumina.Excel.GeneratedSheets.{sheetName}")!;
- var getSheet = Plugin.DataManager
- .GetType()
- .GetMethod("GetExcelSheet", Type.EmptyTypes)!
- .MakeGenericMethod(sheetType);
- var sheet = (ExcelSheetImpl) getSheet.Invoke(Plugin.DataManager, null)!;
- var rowParsers = sheet.GetRowParsers().ToArray();
-
- var columns = new List();
- var rows = new List();
- if (selector.HasValue)
- {
- columns.Clear();
- rows.Clear();
- foreach (var part in selector.Value)
- {
- switch (part)
- {
- case IndexRange range:
- {
- var start = (int) range.Start;
- var end = (int) (range.End + 1);
- rows.Add(start..end);
- break;
- }
- case SingleRow single:
- {
- var idx = (int) single.Row;
- rows.Add(idx..(idx + 1));
- break;
- }
- case ColumnSpecifier col:
- columns.Add((int) col.Column);
- break;
- }
- }
- }
-
- if (columns.Count == 0)
- columns.Add(0);
-
- var validRows = rowParsers.Select(p => p.RowId).ToArray();
- if (rows.Count == 0)
- // We can't use an "index from end" (like `^0`) here because
- // we're iterating over integers, not an array directly.
- // Previously, we were setting `0..^0` which caused these
- // sheets to be completely skipped due to this bug.
- // See below.
- rows.Add(..Index.FromStart((int)validRows.Max() + 1));
-
- foreach (var range in rows)
- {
- // We iterate over the range by numerical values here, so
- // we can't use an "index from end" otherwise nothing will
- // happen.
- // See above.
- for (var i = range.Start.Value; i < range.End.Value; i++)
- {
- if (!validRows.Contains((uint) i))
- continue;
-
- foreach (var col in columns)
- {
- var rowParser = rowParsers.FirstOrDefault(p => p.RowId == i);
- if (rowParser == null)
- continue;
-
- var rawName = rowParser.ReadColumn(col)!;
- var name = rawName.ToDalamudString();
- var text = name.TextValue;
- if (text.Length > 0)
- {
- list.Add(new AutoTranslateEntry(
- row.Group,
- (uint) i,
- text,
- name
- ));
-
- if (shouldAdd)
- ValidEntries.Add((row.Group, (uint) i));
- }
- }
- }
- }
- }
- else if (lookup is not "@")
- {
- var text = row.Text.ToDalamudString();
- list.Add(new AutoTranslateEntry(
- row.Group,
- row.RowId,
- text.TextValue,
- text
- ));
-
- if (shouldAdd)
- ValidEntries.Add((row.Group, row.RowId));
- }
- }
+ // TODO REMOVE AFTER FIX
Entries[Plugin.DataManager.Language] = list;
return list;
+
+ // TODO FIX
+ // foreach (var row in Sheets.CompletionSheet)
+ // {
+ // var lookup = row.LookupTable.ExtractText();
+ // if (lookup is not ("" or "@"))
+ // {
+ // var (sheetName, selector) = parser.ParseOrThrow(lookup);
+ // var sheetType = typeof(Completion)
+ // .Assembly
+ // .GetType($"Lumina.Excel.Sheets.{sheetName}")!;
+ // var getSheet = Plugin.DataManager
+ // .GetType()
+ // .GetMethod("GetExcelSheet", Type.EmptyTypes)!
+ // .MakeGenericMethod(sheetType);
+ // var sheet = (ExcelSheetImpl) getSheet.Invoke(Plugin.DataManager, null)!;
+ // var rowParsers = sheet.GetRowParsers().ToArray();
+ //
+ // var columns = new List();
+ // var rows = new List();
+ // if (selector.HasValue)
+ // {
+ // columns.Clear();
+ // rows.Clear();
+ // foreach (var part in selector.Value)
+ // {
+ // switch (part)
+ // {
+ // case IndexRange range:
+ // {
+ // var start = (int) range.Start;
+ // var end = (int) (range.End + 1);
+ // rows.Add(start..end);
+ // break;
+ // }
+ // case SingleRow single:
+ // {
+ // var idx = (int) single.Row;
+ // rows.Add(idx..(idx + 1));
+ // break;
+ // }
+ // case ColumnSpecifier col:
+ // columns.Add((int) col.Column);
+ // break;
+ // }
+ // }
+ // }
+ //
+ // if (columns.Count == 0)
+ // columns.Add(0);
+ //
+ // var validRows = rowParsers.Select(p => p.RowId).ToArray();
+ // if (rows.Count == 0)
+ // // We can't use an "index from end" (like `^0`) here because
+ // // we're iterating over integers, not an array directly.
+ // // Previously, we were setting `0..^0` which caused these
+ // // sheets to be completely skipped due to this bug.
+ // // See below.
+ // rows.Add(..Index.FromStart((int)validRows.Max() + 1));
+ //
+ // foreach (var range in rows)
+ // {
+ // // We iterate over the range by numerical values here, so
+ // // we can't use an "index from end" otherwise nothing will
+ // // happen.
+ // // See above.
+ // for (var i = range.Start.Value; i < range.End.Value; i++)
+ // {
+ // if (!validRows.Contains((uint) i))
+ // continue;
+ //
+ // foreach (var col in columns)
+ // {
+ // var rowParser = rowParsers.FirstOrDefault(p => p.RowId == i);
+ // if (rowParser == null)
+ // continue;
+ //
+ // var rawName = rowParser.ReadColumn(col)!;
+ // var name = rawName.ToDalamudString();
+ // var text = name.TextValue;
+ // if (text.Length > 0)
+ // {
+ // list.Add(new AutoTranslateEntry(
+ // row.Group,
+ // (uint) i,
+ // text,
+ // name
+ // ));
+ //
+ // if (shouldAdd)
+ // ValidEntries.Add((row.Group, (uint) i));
+ // }
+ // }
+ // }
+ // }
+ // }
+ // else if (lookup is not "@")
+ // {
+ // var text = row.Text.ToDalamudString();
+ // list.Add(new AutoTranslateEntry(
+ // row.Group,
+ // row.RowId,
+ // text.TextValue,
+ // text
+ // ));
+ //
+ // if (shouldAdd)
+ // ValidEntries.Add((row.Group, row.RowId));
+ // }
+ // }
+ //
+ // Entries[Plugin.DataManager.Language] = list;
+ // return list;
}
internal static List Matching(string prefix, bool sort)
diff --git a/ChatTwo/Util/ChunkUtil.cs b/ChatTwo/Util/ChunkUtil.cs
index 10422f7..b42b4b0 100755
--- a/ChatTwo/Util/ChunkUtil.cs
+++ b/ChatTwo/Util/ChunkUtil.cs
@@ -38,14 +38,14 @@ internal static class ChunkUtil
case PayloadType.UIForeground:
var foregroundPayload = (UIForegroundPayload) payload;
if (foregroundPayload.IsEnabled)
- foreground.Push(foregroundPayload.UIColor.UIForeground);
+ foreground.Push(foregroundPayload.UIColor.Value.UIForeground);
else if (foreground.Count > 0)
foreground.Pop();
break;
case PayloadType.UIGlow:
var glowPayload = (UIGlowPayload) payload;
if (glowPayload.IsEnabled)
- glow.Push(glowPayload.UIColor.UIGlow);
+ glow.Push(glowPayload.UIColor.Value.UIGlow);
else if (glow.Count > 0)
glow.Pop();
break;
diff --git a/ChatTwo/Util/WrapperUtil.cs b/ChatTwo/Util/WrapperUtil.cs
index a5f3703..450ba92 100644
--- a/ChatTwo/Util/WrapperUtil.cs
+++ b/ChatTwo/Util/WrapperUtil.cs
@@ -1,4 +1,5 @@
-using ChatTwo.Resources;
+using System.Runtime.CompilerServices;
+using ChatTwo.Resources;
using Dalamud.Interface.ImGuiNotification;
namespace ChatTwo.Util;
@@ -26,4 +27,18 @@ public static class WrapperUtil
public static IEnumerable<(T Value, int Index)> WithIndex(this IEnumerable list)
=> list.Select((x, i) => (x, i));
+
+ /// Return the first object fulfilling the predicate or null for structs.
+ /// The enumerable.
+ /// The predicate.
+ /// The first object fulfilling the predicate, or a null-optional.
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+ public static T? FirstOrNull(this IEnumerable values, Func predicate) where T : struct
+ {
+ foreach(var val in values)
+ if (predicate(val))
+ return val;
+
+ return null;
+ }
}
\ No newline at end of file
diff --git a/ChatTwo/packages.lock.json b/ChatTwo/packages.lock.json
index ea40af7..d6fdde7 100644
--- a/ChatTwo/packages.lock.json
+++ b/ChatTwo/packages.lock.json
@@ -4,9 +4,9 @@
"net8.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
- "requested": "[2.1.13, )",
- "resolved": "2.1.13",
- "contentHash": "rMN1omGe8536f4xLMvx9NwfvpAc9YFFfeXJ1t4P4PE6Gu8WCIoFliR1sh07hM+bfODmesk/dvMbji7vNI+B/pQ=="
+ "requested": "[11.0.0, )",
+ "resolved": "11.0.0",
+ "contentHash": "bjT7XUlhIJSmsE/O76b7weUX+evvGQctbQB8aKXt94o+oPWxHpCepxAGMs7Thow3AzCyqWs7cOpp9/2wcgRRQA=="
},
"EmbedIO": {
"type": "Direct",
@@ -19,30 +19,31 @@
},
"MessagePack": {
"type": "Direct",
- "requested": "[2.5.140, )",
- "resolved": "2.5.140",
- "contentHash": "nkIsgy8BkIfv40bSz9XZb4q//scI1PF3AYeB5X66nSlIhBIqbdpLz8Qk3gHvnjV3RZglQLO/ityK3eNfLii2NA==",
+ "requested": "[3.0.238-rc.1, )",
+ "resolved": "3.0.238-rc.1",
+ "contentHash": "gAVmHb2gswXviGFpAmUgGBVvZEjYGph7Co5hp6IbshEooIuZT34Rv4YcBKvVnUCHdoqxQvK6DZIOPSLSYv3LjQ==",
"dependencies": {
- "MessagePack.Annotations": "2.5.140",
- "Microsoft.NET.StringTools": "17.6.3",
- "System.Runtime.CompilerServices.Unsafe": "6.0.0"
+ "MessagePack.Annotations": "3.0.238-rc.1",
+ "MessagePackAnalyzer": "3.0.238-rc.1",
+ "Microsoft.NET.StringTools": "17.11.4"
}
},
"Microsoft.Data.Sqlite": {
"type": "Direct",
- "requested": "[8.0.4, )",
- "resolved": "8.0.4",
- "contentHash": "vgLm03wS+CfsolO7qk4KVuvt0CtzgdjKmoORuwxMmiIF1ow1JlOo1vwfDHfwXnGa5+QEbvOUy3169bBcHshfTg==",
+ "requested": "[9.0.0, )",
+ "resolved": "9.0.0",
+ "contentHash": "lw6wthgXGx3r/U775k1UkUAWIn0kAT0wj4ZRq0WlhPx4WAOiBsIjgDKgWkXcNTGT0KfHiClkM+tyPVFDvxeObw==",
"dependencies": {
- "Microsoft.Data.Sqlite.Core": "8.0.4",
- "SQLitePCLRaw.bundle_e_sqlite3": "2.1.6"
+ "Microsoft.Data.Sqlite.Core": "9.0.0",
+ "SQLitePCLRaw.bundle_e_sqlite3": "2.1.10",
+ "SQLitePCLRaw.core": "2.1.10"
}
},
"Pidgin": {
"type": "Direct",
- "requested": "[3.2.3, )",
- "resolved": "3.2.3",
- "contentHash": "/1Q/f9asEZH7bogARG4EUxYT3LGB+mNC19db4unmx8gL04kkPzkg1VuX/BFk4UMJsqVopYComG/ydCrj1flCww=="
+ "requested": "[3.3.0, )",
+ "resolved": "3.3.0",
+ "contentHash": "2rvIoIogQG1+vqvXCuz1xiAVljaiacG/wCz/TNpN74TzWw+9iSCjhBLf7kVg24sBi6tArRdrcklHq49ovW2NLA=="
},
"SixLabors.ImageSharp": {
"type": "Direct",
@@ -52,18 +53,18 @@
},
"Watson.Lite": {
"type": "Direct",
- "requested": "[6.2.2, )",
- "resolved": "6.2.2",
- "contentHash": "yRYcaRFSnqwy/rrPd+WIFLyvNfgTANo447KiK7j1mKpgUIYPNDAKYxqj9wkDVfvGIHxzt4z3CFK6eWOGWUYsuQ==",
+ "requested": "[6.2.3, )",
+ "resolved": "6.2.3",
+ "contentHash": "NGVWwQTulT016tiSuwK/AUU+Ebgyq0r0xLaWxll29xv/LTV0w4pHtoPskUPRqnzV8Po+ZndCd5dsUzGCjP0BVA==",
"dependencies": {
- "CavemanTcp": "2.0.2",
- "Watson.Core": "6.2.2"
+ "CavemanTcp": "2.0.3",
+ "Watson.Core": "6.2.3"
}
},
"CavemanTcp": {
"type": "Transitive",
- "resolved": "2.0.2",
- "contentHash": "T161WxkgNTMC5SQPPDfLCGCD2j3YTvF0ZUGy/1pcGaYi6y7mcSzPymgVzG/6mOjAxJNGotK8hf1iOD8eT3bbhQ=="
+ "resolved": "2.0.3",
+ "contentHash": "/feSFO+5A1tS69Vv9XgD8+Ahz9iRcPj8r1kXIIVxeL+VjUzpPpVoAOtNG70oyu+b8M1RqthZAszaVQHpSPzuwg=="
},
"IpMatcher": {
"type": "Transitive",
@@ -72,21 +73,26 @@
},
"MessagePack.Annotations": {
"type": "Transitive",
- "resolved": "2.5.140",
- "contentHash": "JE3vwluOrsJ4t3hnfXzIxJUh6lhx6M/KR8Sark/HOUw1DJ5UKu5JsAnnuaQngg6poFkRx1lzHSLTkxHNJO7+uQ=="
+ "resolved": "3.0.238-rc.1",
+ "contentHash": "yvnpKGuxZuFHnYZ9N8WQXQn0J28w2f0evh0RekDtuxIEKGPw/qQLQXyQWFzMunfb/+pKTWYlUZR1rvvNcwl10A=="
+ },
+ "MessagePackAnalyzer": {
+ "type": "Transitive",
+ "resolved": "3.0.238-rc.1",
+ "contentHash": "qweXSZ+3mrf3RAqBs71vrF20SiNmqQdbrrt/L3749jh7OPpvdyZcHhOd20BSk+THQXgmmQfqF5F3o/J7S7tGCQ=="
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
- "resolved": "8.0.4",
- "contentHash": "x5FE5m1h31UIDEk0j3r38HtYvsa0fxd5jXzvE/SARI7LecXt/jm4z2SUl6TEoJGQOo9Ow2wg3a0MU2E1TVVAdA==",
+ "resolved": "9.0.0",
+ "contentHash": "cFfZjFL+tqzGYw9lB31EkV1IWF5xRQNk2k+MQd+Cf86Gl6zTeAoiZIFw5sRB1Z8OxpEC7nu+nTDsLSjieBAPTw==",
"dependencies": {
- "SQLitePCLRaw.core": "2.1.6"
+ "SQLitePCLRaw.core": "2.1.10"
}
},
"Microsoft.NET.StringTools": {
"type": "Transitive",
- "resolved": "17.6.3",
- "contentHash": "N0ZIanl1QCgvUumEL1laasU0a7sOE5ZwLZVTn0pAePnfhq8P7SvTjF8Axq+CnavuQkmdQpGNXQ1efZtu5kDFbA=="
+ "resolved": "17.11.4",
+ "contentHash": "mudqUHhNpeqIdJoUx2YDWZO/I9uEDYVowan89R6wsomfnUJQk6HteoQTlNjZDixhT2B4IXMkMtgZtoceIjLRmA=="
},
"RegexMatcher": {
"type": "Transitive",
@@ -95,32 +101,32 @@
},
"SQLitePCLRaw.bundle_e_sqlite3": {
"type": "Transitive",
- "resolved": "2.1.6",
- "contentHash": "BmAf6XWt4TqtowmiWe4/5rRot6GerAeklmOPfviOvwLoF5WwgxcJHAxZtySuyW9r9w+HLILnm8VfJFLCUJYW8A==",
+ "resolved": "2.1.10",
+ "contentHash": "UxWuisvZ3uVcVOLJQv7urM/JiQH+v3TmaJc1BLKl5Dxfm/nTzTUrqswCqg/INiYLi61AXnHo1M1JPmPqqLnAdg==",
"dependencies": {
- "SQLitePCLRaw.lib.e_sqlite3": "2.1.6",
- "SQLitePCLRaw.provider.e_sqlite3": "2.1.6"
+ "SQLitePCLRaw.lib.e_sqlite3": "2.1.10",
+ "SQLitePCLRaw.provider.e_sqlite3": "2.1.10"
}
},
"SQLitePCLRaw.core": {
"type": "Transitive",
- "resolved": "2.1.6",
- "contentHash": "wO6v9GeMx9CUngAet8hbO7xdm+M42p1XeJq47ogyRoYSvNSp0NGLI+MgC0bhrMk9C17MTVFlLiN6ylyExLCc5w==",
+ "resolved": "2.1.10",
+ "contentHash": "Ii8JCbC7oiVclaE/mbDEK000EFIJ+ShRPwAvvV89GOZhQ+ZLtlnSWl6ksCNMKu/VGXA4Nfi2B7LhN/QFN9oBcw==",
"dependencies": {
"System.Memory": "4.5.3"
}
},
"SQLitePCLRaw.lib.e_sqlite3": {
"type": "Transitive",
- "resolved": "2.1.6",
- "contentHash": "2ObJJLkIUIxRpOUlZNGuD4rICpBnrBR5anjyfUFQep4hMOIeqW+XGQYzrNmHSVz5xSWZ3klSbh7sFR6UyDj68Q=="
+ "resolved": "2.1.10",
+ "contentHash": "mAr69tDbnf3QJpRy2nJz8Qdpebdil00fvycyByR58Cn9eARvR+UiG2Vzsp+4q1tV3ikwiYIjlXCQFc12GfebbA=="
},
"SQLitePCLRaw.provider.e_sqlite3": {
"type": "Transitive",
- "resolved": "2.1.6",
- "contentHash": "PQ2Oq3yepLY4P7ll145P3xtx2bX8xF4PzaKPRpw9jZlKvfe4LE/saAV82inND9usn1XRpmxXk7Lal3MTI+6CNg==",
+ "resolved": "2.1.10",
+ "contentHash": "uZVTi02C1SxqzgT0HqTWatIbWGb40iIkfc3FpFCpE/r7g6K0PqzDUeefL6P6HPhDtc6BacN3yQysfzP7ks+wSQ==",
"dependencies": {
- "SQLitePCLRaw.core": "2.1.6"
+ "SQLitePCLRaw.core": "2.1.10"
}
},
"System.Memory": {
@@ -128,23 +134,10 @@
"resolved": "4.5.3",
"contentHash": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA=="
},
- "System.Runtime.CompilerServices.Unsafe": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
- },
- "System.Text.Encodings.Web": {
- "type": "Transitive",
- "resolved": "8.0.0",
- "contentHash": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ=="
- },
"System.Text.Json": {
"type": "Transitive",
- "resolved": "8.0.4",
- "contentHash": "bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==",
- "dependencies": {
- "System.Text.Encodings.Web": "8.0.0"
- }
+ "resolved": "8.0.5",
+ "contentHash": "0f1B50Ss7rqxXiaBJyzUu9bWFOO2/zSlifZ/UNMdiIpDYe4cY4LQQicP4nirK1OS31I43rn062UIJ1Q9bpmHpg=="
},
"System.ValueTuple": {
"type": "Transitive",
@@ -171,12 +164,12 @@
},
"Watson.Core": {
"type": "Transitive",
- "resolved": "6.2.2",
- "contentHash": "lqdT+foblghBKLXuvXBFLJmO9J0TkPCBiQFH4xg4txFM7osm1jvF2IzYjor6w1NL+kNDhvlCRkBNaPSSxfJO/A==",
+ "resolved": "6.2.3",
+ "contentHash": "ccdGhC60dHTV1CA+C+U8zZOTQD4yLoPUDV0ZyXqF4dYmQ/zgwhegAxBGkV3WIw+2fqnTKYwMhJFU/tbkykybvA==",
"dependencies": {
"IpMatcher": "1.0.4.4",
"RegexMatcher": "1.0.8",
- "System.Text.Json": "8.0.4",
+ "System.Text.Json": "8.0.5",
"Timestamps": "1.0.9",
"UrlMatcher": "3.0.0"
}