Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions Tweaks/StickyCommandPanel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Dalamud.Game.ClientState.Conditions;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using SimpleTweaksPlugin.TweakSystem;
using SimpleTweaksPlugin.Utility;

namespace SimpleTweaksPlugin.Tweaks;

[TweakName("Sticky Command Panel")]
[TweakDescription("Automatically open/reopen command panel when it's closed.")]
[TweakAuthor("SubaruYashiro")]
[TweakAutoConfig]
public unsafe class StickyCommandPanel: UiAdjustments.SubTweak
{
public class Configs : TweakConfig
{
[TweakConfigOption("Auto (Re)Open While in Duty.")]
public bool AutoOpenInDuty = true;
[TweakConfigOption("Auto (Re)Open Anywhere.")]
public bool AutoOpenEverywhere = true;
}

public Configs Config { get; private set; }

protected override void Enable()
{
Service.Condition.ConditionChange += OnConditionChange;
}

protected override void Disable()
{
Service.Condition.ConditionChange -= OnConditionChange;
}
private void OnConditionChange(ConditionFlag flag, bool value)
{
if (Service.Condition[ConditionFlag.BoundByDuty] && Config.AutoOpenInDuty || Config.AutoOpenEverywhere) CheckCommandPanelCondition();
}

private void CheckCommandPanelCondition()
{
var unitBase = Common.GetUnitBase("QuickPanel");
if (unitBase != null) return;
AgentQuickPanel.Instance()->OpenPanel(AgentQuickPanel.Instance()->ActivePanel, false, false);
}
}