From dcf77e27f2873c4b76a5e3c0a48639cdf058c17d Mon Sep 17 00:00:00 2001 From: Infi Date: Thu, 30 Apr 2026 18:14:15 +0200 Subject: [PATCH] - Fix migration not running for new users - Use PlayerState for character --- ChatTwo/ChatTwo.csproj | 2 +- ChatTwo/Http/Processing.cs | 4 ++-- ChatTwo/MessageStore.cs | 6 +++++- ChatTwo/Resources/Language.Designer.cs | 2 +- ChatTwo/Resources/Language.resx | 2 +- ChatTwo/Ui/DbViewer.cs | 4 ++-- ChatTwo/Ui/SettingsTabs/Tabs.cs | 6 +++--- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ChatTwo/ChatTwo.csproj b/ChatTwo/ChatTwo.csproj index 618a6a3..dd62598 100755 --- a/ChatTwo/ChatTwo.csproj +++ b/ChatTwo/ChatTwo.csproj @@ -1,6 +1,6 @@ - 1.35.0 + 1.35.1 enable diff --git a/ChatTwo/Http/Processing.cs b/ChatTwo/Http/Processing.cs index 6925b45..67af087 100644 --- a/ChatTwo/Http/Processing.cs +++ b/ChatTwo/Http/Processing.cs @@ -74,8 +74,8 @@ public class Processing { if (chunk.Link is PlayerPayload playerPayload) userContent = HostContext.Core.Plugin.ChatLogWindow.HidePlayerInString(userContent, playerPayload.PlayerName, playerPayload.World.RowId); - else if (Plugin.ObjectTable.LocalPlayer is { } player) - userContent = HostContext.Core.Plugin.ChatLogWindow.HidePlayerInString(userContent, player.Name.TextValue, player.HomeWorld.RowId); + else if (Plugin.PlayerState.IsLoaded) + userContent = HostContext.Core.Plugin.ChatLogWindow.HidePlayerInString(userContent, Plugin.PlayerState.CharacterName, Plugin.PlayerState.HomeWorld.RowId); } var isNotUrl = text.Link is not UriPayload; diff --git a/ChatTwo/MessageStore.cs b/ChatTwo/MessageStore.cs index 2f37a61..63f5070 100644 --- a/ChatTwo/MessageStore.cs +++ b/ChatTwo/MessageStore.cs @@ -169,12 +169,16 @@ internal class MessageStore : IDisposable { case <= 0: migrationsToDo.Add(Migrate0); - // Migration support was only added in version 1. Migrate0 is + + // Migration support was only added in version 1. Migrate 0 is // idempotent. migrationsToDo.Add(Migrate1); + migrationsToDo.Add(Migrate2); + migrationsToDo.Add(Migrate3); break; case 1: migrationsToDo.Add(Migrate2); + migrationsToDo.Add(Migrate3); break; case 2: migrationsToDo.Add(Migrate3); diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index 82702f7..97f7ccb 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -3462,7 +3462,7 @@ namespace ChatTwo.Resources { } /// - /// Looks up a localized string similar to Show all messages send by target. + /// Looks up a localized string similar to Show all messages sent by target. /// internal static string Options_Tabs_SenderMessages { get { diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index c6f7441..ffd0a65 100644 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -1148,7 +1148,7 @@ Disable input for this channel - Show all messages send by target + Show all messages sent by target Input is disabled for this tab diff --git a/ChatTwo/Ui/DbViewer.cs b/ChatTwo/Ui/DbViewer.cs index da4eba5..4c71337 100644 --- a/ChatTwo/Ui/DbViewer.cs +++ b/ChatTwo/Ui/DbViewer.cs @@ -541,8 +541,8 @@ public class DbViewer : Window { if (chunk.Link is PlayerPayload playerPayload) userContent = Plugin.ChatLogWindow.HidePlayerInString(userContent, playerPayload.PlayerName, playerPayload.World.RowId); - else if (Plugin.ObjectTable.LocalPlayer is { } player) - userContent = Plugin.ChatLogWindow.HidePlayerInString(userContent, player.Name.TextValue, player.HomeWorld.RowId); + else if (Plugin.PlayerState.IsLoaded) + userContent = Plugin.ChatLogWindow.HidePlayerInString(userContent, Plugin.PlayerState.CharacterName, Plugin.PlayerState.HomeWorld.RowId); } var isNotUrl = text.Link is not UriPayload; diff --git a/ChatTwo/Ui/SettingsTabs/Tabs.cs b/ChatTwo/Ui/SettingsTabs/Tabs.cs index dd57be1..5682aaf 100755 --- a/ChatTwo/Ui/SettingsTabs/Tabs.cs +++ b/ChatTwo/Ui/SettingsTabs/Tabs.cs @@ -159,12 +159,12 @@ internal sealed class Tabs : ISettingsTab } } - ImGui.Checkbox(Language.Options_Tabs_SenderMessages, ref tab.AllSenderMessages); - ImGuiUtil.HelpText(Language.Options_Help_SenderMessages); - var player = Plugin.ObjectTable.LocalPlayer; if (tab.Channel == InputChannel.Tell && player != null) { + ImGui.Checkbox(Language.Options_Tabs_SenderMessages, ref tab.AllSenderMessages); + ImGuiUtil.HelpText(Language.Options_Help_SenderMessages); + var worlds = Sheets.WorldsOnDatacenter(player).OrderByDescending(world => world.DataCenter.RowId).ThenBy(world => world.Name.ToString()).ToList(); using (ImRaii.ItemWidth(ImGui.GetWindowWidth() / 3f))