From 4f9a6cd5be391db2dd5aa342a16846ac50bbf9e1 Mon Sep 17 00:00:00 2001 From: Infi Date: Fri, 19 Dec 2025 06:49:18 +0100 Subject: [PATCH] - API 14 --- ChatTwo.Tests/ChatTwo.Tests.csproj | 2 +- ChatTwo/ChatTwo.csproj | 9 ++++----- ChatTwo/GameFunctions/Chat.cs | 1 + ChatTwo/Http/Processing.cs | 2 +- ChatTwo/MessageManager.cs | 4 ++-- ChatTwo/PayloadHandler.cs | 6 +++--- ChatTwo/Plugin.cs | 1 + ChatTwo/Ui/ChatLogWindow.cs | 4 ++-- ChatTwo/Ui/DbViewer.cs | 2 +- ChatTwo/Ui/SettingsTabs/Database.cs | 4 ++-- ChatTwo/Util/AutoTranslate.cs | 14 ++------------ ChatTwo/packages.lock.json | 30 ++++++++--------------------- 12 files changed, 28 insertions(+), 51 deletions(-) diff --git a/ChatTwo.Tests/ChatTwo.Tests.csproj b/ChatTwo.Tests/ChatTwo.Tests.csproj index 3af4180..68fabd5 100644 --- a/ChatTwo.Tests/ChatTwo.Tests.csproj +++ b/ChatTwo.Tests/ChatTwo.Tests.csproj @@ -1,7 +1,7 @@ - net9.0-windows + net10.0-windows false diff --git a/ChatTwo/ChatTwo.csproj b/ChatTwo/ChatTwo.csproj index 35c4a11..ffb2f73 100755 --- a/ChatTwo/ChatTwo.csproj +++ b/ChatTwo/ChatTwo.csproj @@ -1,7 +1,6 @@ - + - 1.32.0 - net9.0-windows + 1.34.0 enable enable true @@ -39,7 +38,7 @@ - + @@ -58,7 +57,7 @@ - + diff --git a/ChatTwo/GameFunctions/Chat.cs b/ChatTwo/GameFunctions/Chat.cs index 1b38605..2be3a10 100755 --- a/ChatTwo/GameFunctions/Chat.cs +++ b/ChatTwo/GameFunctions/Chat.cs @@ -368,6 +368,7 @@ internal sealed unsafe class Chat : IDisposable { RotateMode.Forward => 1, RotateMode.Reverse => -1, + _ => 1 }; // Iterate up to 8 times to find a valid linkshell. diff --git a/ChatTwo/Http/Processing.cs b/ChatTwo/Http/Processing.cs index dd81be7..9e0e706 100644 --- a/ChatTwo/Http/Processing.cs +++ b/ChatTwo/Http/Processing.cs @@ -74,7 +74,7 @@ public class Processing { if (chunk.Link is PlayerPayload playerPayload) userContent = HostContext.Core.Plugin.ChatLogWindow.HidePlayerInString(userContent, playerPayload.PlayerName, playerPayload.World.RowId); - else if (Plugin.ClientState.LocalPlayer is { } player) + else if (Plugin.ObjectTable.LocalPlayer is { } player) userContent = HostContext.Core.Plugin.ChatLogWindow.HidePlayerInString(userContent, player.Name.TextValue, player.HomeWorld.RowId); } diff --git a/ChatTwo/MessageManager.cs b/ChatTwo/MessageManager.cs index 91deb51..3292550 100644 --- a/ChatTwo/MessageManager.cs +++ b/ChatTwo/MessageManager.cs @@ -42,7 +42,7 @@ internal class MessageManager : IAsyncDisposable { get { - var contentId = Plugin.ClientState.LocalContentId; + var contentId = Plugin.PlayerState.ContentId; return contentId == 0 ? LastContentId : contentId; } } @@ -98,7 +98,7 @@ internal class MessageManager : IAsyncDisposable private void OnFrameworkUpdate(IFramework framework) { - var contentId = Plugin.ClientState.LocalContentId; + var contentId = Plugin.PlayerState.ContentId; if (contentId != 0) LastContentId = contentId; diff --git a/ChatTwo/PayloadHandler.cs b/ChatTwo/PayloadHandler.cs index 2a696bd..52f4031 100755 --- a/ChatTwo/PayloadHandler.cs +++ b/ChatTwo/PayloadHandler.cs @@ -572,8 +572,8 @@ public sealed class PayloadHandler var world = player.World; if (chunk.Message?.Code.Type == ChatType.FreeCompanyLoginLogout) - if (Plugin.ClientState.LocalPlayer?.HomeWorld.IsValid == true) - world = Plugin.ClientState.LocalPlayer.HomeWorld; + if (Plugin.PlayerState.HomeWorld.IsValid) + world = Plugin.PlayerState.HomeWorld; var name = new List { new TextChunk(ChunkSource.None, null, player.PlayerName) }; if (world.Value.IsPublic) @@ -611,7 +611,7 @@ public sealed class PayloadHandler { var party = Plugin.PartyList; var leader = (ulong?) party[(int) party.PartyLeaderIndex]?.ContentId; - var isLeader = party.Length == 0 || Plugin.ClientState.LocalContentId == leader; + var isLeader = party.Length == 0 || Plugin.PlayerState.ContentId == leader; var member = party.FirstOrDefault(member => member.Name.TextValue == player.PlayerName && member.World.RowId == world.RowId); var isInParty = member != null; var inInstance = GameFunctions.GameFunctions.IsInInstance(); diff --git a/ChatTwo/Plugin.cs b/ChatTwo/Plugin.cs index 7a6aaf5..dddc032 100755 --- a/ChatTwo/Plugin.cs +++ b/ChatTwo/Plugin.cs @@ -39,6 +39,7 @@ public sealed class Plugin : IDalamudPlugin [PluginService] internal static IGameConfig GameConfig { get; private set; } = null!; [PluginService] internal static INotificationManager Notification { get; private set; } = null!; [PluginService] internal static IAddonLifecycle AddonLifecycle { get; private set; } = null!; + [PluginService] internal static IPlayerState PlayerState { get; private set; } = null!; internal static Configuration Config = null!; diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs index d16c245..2d3ed43 100644 --- a/ChatTwo/Ui/ChatLogWindow.cs +++ b/ChatTwo/Ui/ChatLogWindow.cs @@ -1772,8 +1772,8 @@ 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.RowId); + else if (Plugin.PlayerState.IsLoaded) + content = HidePlayerInString(content, Plugin.PlayerState.CharacterName, Plugin.PlayerState.HomeWorld.RowId); } if (wrap) diff --git a/ChatTwo/Ui/DbViewer.cs b/ChatTwo/Ui/DbViewer.cs index 4e99bbe..8dd1a3b 100644 --- a/ChatTwo/Ui/DbViewer.cs +++ b/ChatTwo/Ui/DbViewer.cs @@ -128,7 +128,7 @@ public class DbViewer : Window { try { - ulong? character = OnlyCurrentCharacter ? Plugin.ClientState.LocalContentId : null; + ulong? character = OnlyCurrentCharacter ? Plugin.PlayerState.ContentId : null; var channels = ChatCodes.Select(c => (uint) c.Key).ToArray(); // We only want to fetch count if this is the first page diff --git a/ChatTwo/Ui/SettingsTabs/Database.cs b/ChatTwo/Ui/SettingsTabs/Database.cs index 111687d..219f865 100755 --- a/ChatTwo/Ui/SettingsTabs/Database.cs +++ b/ChatTwo/Ui/SettingsTabs/Database.cs @@ -161,8 +161,8 @@ 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.RowId ?? 0; + var playerName = Plugin.PlayerState.CharacterName; + var worldId = Plugin.PlayerState.HomeWorld.ValueNullable?.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 c419f45..c42c045 100644 --- a/ChatTwo/Util/AutoTranslate.cs +++ b/ChatTwo/Util/AutoTranslate.cs @@ -87,7 +87,7 @@ internal static class AutoTranslate lookup = lookup.Replace(" ", ""); var (sheetName, selector) = parser.ParseOrThrow(lookup); - var sheet = Plugin.DataManager.Excel.GetSheet(name: sheetName); + var sheet = Plugin.DataManager.Excel.GetSheet(name: sheetName); var columns = new List(); var rows = new List(); @@ -143,7 +143,7 @@ internal static class AutoTranslate foreach (var col in columns) { - var rawName = rowParser.RawRow.ReadStringColumn(col); + var rawName = rowParser.ReadStringColumn(col); var name = rawName.ToDalamudString(); var text = name.TextValue; if (text.Length > 0) @@ -253,16 +253,6 @@ internal static class AutoTranslate } } -[Sheet] -public readonly struct WorkingRawRow(RawRow row) : IExcelRow -{ - public uint RowId => row.RowId; - public RawRow RawRow => row; - - static WorkingRawRow IExcelRow.Create(ExcelPage page, uint offset, uint row) => - new(new RawRow(page, offset, row)); -} - internal interface ISelectorPart { } internal class SingleRow : ISelectorPart diff --git a/ChatTwo/packages.lock.json b/ChatTwo/packages.lock.json index aad3b57..d8dd85c 100644 --- a/ChatTwo/packages.lock.json +++ b/ChatTwo/packages.lock.json @@ -1,18 +1,18 @@ { "version": 1, "dependencies": { - "net9.0-windows7.0": { + "net10.0-windows7.0": { "DalamudPackager": { "type": "Direct", - "requested": "[13.1.0, )", - "resolved": "13.1.0", - "contentHash": "XdoNhJGyFby5M/sdcRhnc5xTop9PHy+H50PTWpzLhJugjB19EDBiHD/AsiDF66RETM+0qKUdJBZrNuebn7qswQ==" + "requested": "[14.0.1, )", + "resolved": "14.0.1", + "contentHash": "y0WWyUE6dhpGdolK3iKgwys05/nZaVf4ZPtIjpLhJBZvHxkkiE23zYRo7K7uqAgoK/QvK5cqF6l3VG5AbgC6KA==" }, "DotNet.ReproducibleBuilds": { "type": "Direct", - "requested": "[1.2.25, )", - "resolved": "1.2.25", - "contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg==" + "requested": "[1.2.39, )", + "resolved": "1.2.39", + "contentHash": "fcFN01tDTIQqDuTwr1jUQK/geofiwjG5DycJQOnC72i1SsLAk1ELe+apBOuZ11UMQG8YKFZG1FgvjZPbqHyatg==" }, "MessagePack": { "type": "Direct", @@ -108,10 +108,7 @@ "SQLitePCLRaw.core": { "type": "Transitive", "resolved": "2.1.10", - "contentHash": "Ii8JCbC7oiVclaE/mbDEK000EFIJ+ShRPwAvvV89GOZhQ+ZLtlnSWl6ksCNMKu/VGXA4Nfi2B7LhN/QFN9oBcw==", - "dependencies": { - "System.Memory": "4.5.3" - } + "contentHash": "Ii8JCbC7oiVclaE/mbDEK000EFIJ+ShRPwAvvV89GOZhQ+ZLtlnSWl6ksCNMKu/VGXA4Nfi2B7LhN/QFN9oBcw==" }, "SQLitePCLRaw.lib.e_sqlite3": { "type": "Transitive", @@ -126,16 +123,6 @@ "SQLitePCLRaw.core": "2.1.10" } }, - "System.Memory": { - "type": "Transitive", - "resolved": "4.5.3", - "contentHash": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==" - }, - "System.Text.Json": { - "type": "Transitive", - "resolved": "8.0.5", - "contentHash": "0f1B50Ss7rqxXiaBJyzUu9bWFOO2/zSlifZ/UNMdiIpDYe4cY4LQQicP4nirK1OS31I43rn062UIJ1Q9bpmHpg==" - }, "Timestamps": { "type": "Transitive", "resolved": "1.0.11", @@ -153,7 +140,6 @@ "dependencies": { "IpMatcher": "1.0.5", "RegexMatcher": "1.0.9", - "System.Text.Json": "8.0.5", "Timestamps": "1.0.11", "UrlMatcher": "3.0.1" }