Files
ConfigurableCombo/UserComboDefinition.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

78 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace ConfigurableCombo;
/// <summary>When to reset the combo sequence back to step 1.</summary>
[Serializable]
public enum ComboResetMode
{
/// <summary>Reset when the game combo timer expires (default, ~15s).</summary>
GameTimer = 0,
/// <summary>Never reset from time; always advance through the sequence (cycle after last step).</summary>
Never = 1,
/// <summary>Reset when the current target changes.</summary>
OnTargetChange = 2,
/// <summary>Reset after the configured number of seconds of inactivity.</summary>
AfterSeconds = 3,
}
/// <summary>
/// A single user-defined combo: put the first action on your hotbar; pressing it advances through the sequence.
/// </summary>
[Serializable]
public class UserComboDefinition
{
/// <summary>
/// Display name for this combo (e.g. "WAR ST Combo").
/// </summary>
public string Name { get; set; } = "New Combo";
/// <summary>
/// Ordered list of action IDs. The first action is the one you place on the hotbar; each press advances to the next.
/// Combo resets to the first action when the game combo timer expires or the sequence is broken.
/// </summary>
public List<uint> ActionIds { get; set; } = new();
/// <summary>
/// Whether this combo is enabled.
/// </summary>
public bool Enabled { get; set; } = true;
/// <summary>
/// ClassJob.RowId this combo belongs to. 0 = Unspecified (shown when "Unspecified" job is selected).
/// </summary>
public uint JobId { get; set; }
/// <summary>
/// Unique id for this combo (for UI and serialization).
/// </summary>
public Guid Id { get; set; } = Guid.NewGuid();
/// <summary>
/// The action ID that is "on the bar" — i.e. the trigger. This is ActionIds[0] when the list is non-empty.
/// </summary>
public uint TriggerActionId => ActionIds.Count > 0 ? ActionIds[0] : 0;
/// <summary>
/// When to reset this combo to step 1. Per-combo; e.g. one combo can use "Never" while another uses "After seconds".
/// </summary>
public ComboResetMode ResetMode { get; set; } = ComboResetMode.GameTimer;
/// <summary>
/// Seconds after which the combo resets when <see cref="ResetMode"/> is <see cref="ComboResetMode.AfterSeconds"/>.
/// Ignored for other modes.
/// </summary>
public float ResetAfterSeconds { get; set; } = 15f;
/// <summary>
/// When true (default): using another combo or any action never clears this combo's position; it only resets per its own "Reset when" setting.
/// When false (original): using an action that is not part of this combo clears this combo's state back to step 1.
/// </summary>
public bool PreservePositionWhenUsingOtherActions { get; set; } = true;
}