diff --git a/ChatTwo/PayloadHandler.cs b/ChatTwo/PayloadHandler.cs index c712fa4..60aa1d0 100755 --- a/ChatTwo/PayloadHandler.cs +++ b/ChatTwo/PayloadHandler.cs @@ -232,6 +232,10 @@ internal sealed class PayloadHandler { this.Ui.Plugin.TargetManager.SetTarget(obj); } + ImGui.Separator(); + + ImGui.Checkbox("Screenshot mode", ref this.Ui.ScreenshotMode); + // Add to Blacklist 0x1C // View Party Finder 0x2E // Reply in Selected Chat Mode 0x64 diff --git a/ChatTwo/PluginUi.cs b/ChatTwo/PluginUi.cs index 24e2f1b..5e316d0 100755 --- a/ChatTwo/PluginUi.cs +++ b/ChatTwo/PluginUi.cs @@ -11,6 +11,8 @@ internal sealed class PluginUi : IDisposable { internal Plugin Plugin { get; } internal bool SettingsVisible; + internal bool ScreenshotMode; + internal string Salt { get; } internal ImFontPtr? RegularFont { get; private set; } internal ImFontPtr? ItalicFont { get; private set; } @@ -42,6 +44,7 @@ internal sealed class PluginUi : IDisposable { internal unsafe PluginUi(Plugin plugin) { this.Plugin = plugin; + this.Salt = new Random().Next().ToString(); this.Components = new List { new Settings(this), new ChatLog(this), diff --git a/ChatTwo/Ui/ChatLog.cs b/ChatTwo/Ui/ChatLog.cs index 445d6a6..0f5fdc5 100755 --- a/ChatTwo/Ui/ChatLog.cs +++ b/ChatTwo/Ui/ChatLog.cs @@ -1,6 +1,7 @@ using System.Numerics; using ChatTwo.Code; using ChatTwo.Util; +using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Interface; using ImGuiNET; using ImGuiScene; @@ -402,7 +403,18 @@ internal sealed class ChatLog : IUiComponent { ImGui.PushFont(this.Ui.ItalicFont.Value); } - ImGuiUtil.WrapText(text.Content, chunk, handler); + var content = text.Content; + if (this.Ui.ScreenshotMode) { + if (chunk.Link is PlayerPayload playerPayload) { + var hashCode = $"{this.Ui.Salt}{playerPayload.PlayerName}{playerPayload.World.RowId}".GetHashCode(); + content = $"Player {hashCode:X8}"; + } else if (this.Ui.Plugin.ClientState.LocalPlayer is { } player && content.Contains(player.Name.TextValue)) { + var hashCode = $"{this.Ui.Salt}{player.Name.TextValue}{player.HomeWorld.Id}".GetHashCode(); + content = content.Replace(player.Name.TextValue, $"Player {hashCode:X8}"); + } + } + + ImGuiUtil.WrapText(content, chunk, handler); if (text.Italic && this.Ui.ItalicFont.HasValue) { ImGui.PopFont();