feat: screenshot mode
This commit is contained in:
parent
d056bb38ca
commit
a633b9541f
@ -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
|
||||
|
@ -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<IUiComponent> {
|
||||
new Settings(this),
|
||||
new ChatLog(this),
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user