Files
ConfigurableCombo/ConfigurableComboPlugin.cs
jorg 7c174efa70 feat: Per-combo reset options and preserve-position toggle
- Per-combo reset when: Game timer (default), Never, On target change,
  After X seconds. Never = cycle sequence without time/target reset.
  After seconds uses configurable 0.5–300s window.

- Per-combo 'Preserve position when using other actions' (default on):
  when on, using another combo or any ability never resets this combo's
  step; it only resets per its own 'Reset when' setting. When off
  (original), using an action not in this combo resets it to step 1.

- Optional ITargetManager via constructor for On target change; plugin
  loads if service unavailable (On target change no-op when null).

Made-with: Cursor
2026-03-02 10:50:52 -06:00

72 lines
2.5 KiB
C#

using System;
using Dalamud.Game.Command;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
namespace ConfigurableCombo;
public sealed class ConfigurableComboPlugin : IDalamudPlugin
{
private const string Command = "/ccombo";
private readonly WindowSystem _windowSystem;
private readonly ConfigWindow _configWindow;
public ConfigurableComboPlugin(
IDalamudPluginInterface pluginInterface,
ISigScanner sigScanner,
IGameInteropProvider gameInteropProvider,
ITargetManager? targetManager = null)
{
pluginInterface.Create<Service>();
Service.TargetManager = targetManager;
Service.Configuration = pluginInterface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration();
Service.Address = new PluginAddressResolver();
Service.Address.Setup(sigScanner);
Service.IconReplacer = new IconReplacer(gameInteropProvider);
_configWindow = new ConfigWindow();
_windowSystem = new WindowSystem("ConfigurableCombo");
_windowSystem.AddWindow(_configWindow);
pluginInterface.UiBuilder.OpenConfigUi += OnOpenConfigUi;
pluginInterface.UiBuilder.Draw += _windowSystem.Draw;
Service.CommandManager.AddHandler(Command, new CommandInfo(OnCommand)
{
HelpMessage = "Open ConfigurableCombo settings. Use '/ccombo debug' to toggle debug logging (for support).",
ShowInHelp = true,
});
}
public string Name => "ConfigurableCombo";
public void Dispose()
{
Service.CommandManager.RemoveHandler(Command);
Service.Interface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
Service.Interface.UiBuilder.Draw -= _windowSystem.Draw;
Service.IconReplacer?.Dispose();
}
private void OnOpenConfigUi() => _configWindow.Toggle();
private void OnCommand(string command, string args)
{
var arg = args.Trim();
if (arg.Equals("debug", StringComparison.OrdinalIgnoreCase))
{
Service.Configuration.EnableDebugLogging = !Service.Configuration.EnableDebugLogging;
Service.Configuration.Save();
Service.ChatGui.Print(
$"ConfigurableCombo: Debug logging is now {(Service.Configuration.EnableDebugLogging ? "ON" : "OFF")}. Check the plugin log (Dalamud → Log) when reporting issues.",
"ConfigurableCombo");
return;
}
_configWindow.Toggle();
}
}