mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-25 06:01:48 +01:00
Optional Addition: Include IPC to get the current state of Auto-Reload Gear, and an IPC Event call for when the option changes.
- Should help clear up ambiguity with any external plugins intending to call ReapplyState on a mod-change to themselves, to know if Glamourer has it handled for them.
This commit is contained in:
parent
d6c36ca4f7
commit
48bef12555
8 changed files with 68 additions and 13 deletions
|
|
@ -1,8 +1,5 @@
|
|||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Designs;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using OtterGui;
|
||||
using static Penumbra.GameData.Files.ShpkFile;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DebugTab.IpcTester;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@ public class IpcTesterPanel(
|
|||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted($"({major}.{minor:D4})");
|
||||
|
||||
ImGui.TextUnformatted(AutoReloadGearEnabled.Label);
|
||||
var autoRedraw = new AutoReloadGearEnabled(pluginInterface).Invoke();
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted(autoRedraw ? "Enabled" : "Disabled");
|
||||
|
||||
designs.Draw();
|
||||
items.Draw();
|
||||
state.Draw();
|
||||
|
|
@ -49,6 +54,7 @@ public class IpcTesterPanel(
|
|||
return;
|
||||
|
||||
Glamourer.Log.Debug("[IPCTester] Subscribed to IPC events for IPC tester.");
|
||||
state.AutoRedrawChanged.Enable();
|
||||
state.GPoseChanged.Enable();
|
||||
state.StateChanged.Enable();
|
||||
state.StateFinalized.Enable();
|
||||
|
|
@ -72,6 +78,7 @@ public class IpcTesterPanel(
|
|||
|
||||
Glamourer.Log.Debug("[IPCTester] Unsubscribed from IPC events for IPC tester.");
|
||||
_subscribed = false;
|
||||
state.AutoRedrawChanged.Disable();
|
||||
state.GPoseChanged.Disable();
|
||||
state.StateChanged.Disable();
|
||||
state.StateFinalized.Disable();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Plugin;
|
||||
using Glamourer.Api.Enums;
|
||||
using Glamourer.Api.Helpers;
|
||||
using Glamourer.Api.IpcSubscribers;
|
||||
using Glamourer.Designs;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
|
|
@ -31,6 +31,10 @@ public class StateIpcTester : IUiService, IDisposable
|
|||
private string _base64State = string.Empty;
|
||||
private string? _getStateString;
|
||||
|
||||
public readonly EventSubscriber<bool> AutoRedrawChanged;
|
||||
private bool _lastAutoRedrawChangeValue;
|
||||
private DateTime _lastAutoRedrawChangeTime;
|
||||
|
||||
public readonly EventSubscriber<nint, StateChangeType> StateChanged;
|
||||
private nint _lastStateChangeActor;
|
||||
private ByteString _lastStateChangeName = ByteString.Empty;
|
||||
|
|
@ -51,10 +55,12 @@ public class StateIpcTester : IUiService, IDisposable
|
|||
|
||||
public StateIpcTester(IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
StateChanged = StateChangedWithType.Subscriber(_pluginInterface, OnStateChanged);
|
||||
StateFinalized = Api.IpcSubscribers.StateFinalized.Subscriber(_pluginInterface, OnStateFinalized);
|
||||
GPoseChanged = Api.IpcSubscribers.GPoseChanged.Subscriber(_pluginInterface, OnGPoseChange);
|
||||
_pluginInterface = pluginInterface;
|
||||
AutoRedrawChanged = AutoReloadGearChanged.Subscriber(_pluginInterface, OnAutoRedrawChanged);
|
||||
StateChanged = StateChangedWithType.Subscriber(_pluginInterface, OnStateChanged);
|
||||
StateFinalized = Api.IpcSubscribers.StateFinalized.Subscriber(_pluginInterface, OnStateFinalized);
|
||||
GPoseChanged = Api.IpcSubscribers.GPoseChanged.Subscriber(_pluginInterface, OnGPoseChange);
|
||||
AutoRedrawChanged.Disable();
|
||||
StateChanged.Disable();
|
||||
StateFinalized.Disable();
|
||||
GPoseChanged.Disable();
|
||||
|
|
@ -62,6 +68,7 @@ public class StateIpcTester : IUiService, IDisposable
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
AutoRedrawChanged.Dispose();
|
||||
StateChanged.Dispose();
|
||||
StateFinalized.Dispose();
|
||||
GPoseChanged.Dispose();
|
||||
|
|
@ -83,6 +90,8 @@ public class StateIpcTester : IUiService, IDisposable
|
|||
|
||||
IpcTesterHelpers.DrawIntro("Last Error");
|
||||
ImGui.TextUnformatted(_lastError.ToString());
|
||||
IpcTesterHelpers.DrawIntro("Last Auto Redraw Change");
|
||||
ImGui.TextUnformatted($"{_lastAutoRedrawChangeValue} at {_lastAutoRedrawChangeTime.ToLocalTime().TimeOfDay}");
|
||||
IpcTesterHelpers.DrawIntro("Last State Change");
|
||||
PrintChangeName();
|
||||
IpcTesterHelpers.DrawIntro("Last State Finalization");
|
||||
|
|
@ -233,6 +242,12 @@ public class StateIpcTester : IUiService, IDisposable
|
|||
ImUtf8.Text($"at {_lastStateFinalizeTime.ToLocalTime().TimeOfDay}");
|
||||
}
|
||||
|
||||
private void OnAutoRedrawChanged(bool value)
|
||||
{
|
||||
_lastAutoRedrawChangeValue = value;
|
||||
_lastAutoRedrawChangeTime = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
private void OnStateChanged(nint actor, StateChangeType type)
|
||||
{
|
||||
_lastStateChangeActor = actor;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using Dalamud.Interface.Utility;
|
|||
using Dalamud.Plugin.Services;
|
||||
using Glamourer.Automation;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Events;
|
||||
using Glamourer.Gui.Tabs.DesignTab;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Interop.PalettePlus;
|
||||
|
|
@ -30,6 +31,7 @@ public class SettingsTab(
|
|||
CodeDrawer codeDrawer,
|
||||
Glamourer glamourer,
|
||||
AutoDesignApplier autoDesignApplier,
|
||||
AutoRedrawChanged autoRedraw,
|
||||
PcpService pcpService)
|
||||
: ITab
|
||||
{
|
||||
|
|
@ -91,7 +93,11 @@ public class SettingsTab(
|
|||
config.DisableFestivals == 0, v => config.DisableFestivals = v ? (byte)0 : (byte)2);
|
||||
Checkbox("Auto-Reload Gear"u8,
|
||||
"Automatically reload equipment pieces on your own character when changing any mod options in Penumbra in their associated collection."u8,
|
||||
config.AutoRedrawEquipOnChanges, v => config.AutoRedrawEquipOnChanges = v);
|
||||
config.AutoRedrawEquipOnChanges, v =>
|
||||
{
|
||||
config.AutoRedrawEquipOnChanges = v;
|
||||
autoRedraw.Invoke(v);
|
||||
});
|
||||
Checkbox("Attach to PCP-Handling"u8,
|
||||
"Add the actor's glamourer state when a PCP is created by Penumbra, and create a design and apply it if possible when a PCP is installed by Penumbra."u8,
|
||||
config.AttachToPcp, pcpService.Set);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue