vaoan avatar

snd-wrathcombo-integration

Use this skill when implementing combat rotation automation in SND macros using the WrathCombo plugi

作者 vaoan|オープンソース

WrathCombo Integration for SND

This skill covers integration with the WrathCombo plugin for combat rotation automation in SND macros.

Source: Verified from official repository

Prerequisites

-- Always check plugin availability first
if not HasPlugin("WrathCombo") then
    yield("/echo [Script] WrathCombo plugin not available")
    return
end

Important: IPC Leasing System

WrathCombo uses a leasing system for IPC control. You must register for a lease before making any Set calls. This allows users to maintain control and revoke external plugin access.

IPC API Reference

Initialization and Status

-- Check if IPC is ready (caches built, fully initialized)
IPC.WrathCombo.IPCReady() → boolean

-- Test IPC connection
IPC.WrathCombo.Test() → nil  -- Logs "IPC connection successful"

Lease Registration

-- Register for control of WrathCombo (required before Set calls)
-- Returns: Guid (lease ID) or nil if registration failed
IPC.WrathCombo.RegisterForLease(
    string internalPluginName,  -- Your plugin's internal name
    string pluginName           -- Display name shown to users
) → Guid?

-- Register with callback for lease cancellation
IPC.WrathCombo.RegisterForLeaseWithCallback(
    string internalPluginName,
    string pluginName,
    string? ipcPrefixForCallback  -- nil = same as internalPluginName
) → Guid?

-- Release your lease (call when done)
IPC.WrathCombo.ReleaseControl(Guid lease) → nil

Auto-Rotation Control

-- Get current auto-rotation state
IPC.WrathCombo.GetAutoRotationState() → boolean

-- Set auto-rotation state (requires lease)
IPC.WrathCombo.SetAutoRotationState(
    Guid lease,
    boolean enabled  -- default: true
) → SetResult

-- Check if current job is ready for auto-rotation
-- (has Single-Target and Multi-Target combos configured in Auto-Mode)
IPC.WrathCombo.IsCurrentJobAutoRotationReady() → boolean

-- Configure current job for auto-rotation (requires lease)
-- Enables ST/MT combos and Auto-Mode using user's existing settings
IPC.WrathCombo.SetCurrentJobAutoRotationReady(Guid lease) → SetResult

Job State Checks

-- Check if current job has ST/MT combos configured
IPC.WrathCombo.IsCurrentJobConfiguredOn() → Dictionary<ComboTargetTypeKeys, ComboSimplicityLevelKeys?>

-- Check if current job has ST/MT combos in Auto-Mode
IPC.WrathCombo.IsCurrentJobAutoModeOn() → Dictionary<ComboTargetTypeKeys, ComboSimplicityLevelKeys?>

Fine-Grained Combo Control

-- Get all combo names for a job
IPC.WrathCombo.GetComboNamesForJob(number jobID) → List<string>?

-- Get all combo option names for a job
IPC.WrathCombo.GetComboOptionNamesForJob(number jobID) → Dictionary<string, List<string>>?

-- Get combo state (enabled + auto-mode)
IPC.WrathCombo.GetComboState(string comboInternalName) → Dictionary<ComboStateKeys, bool>?

-- Set combo state (requires lease)
IPC.WrathCombo.SetComboState(
    Guid lease,
    string comboInternalName,
    boolean comboState,  -- default: true
    boolean autoState    -- default: true
) → SetResult

-- Get combo option state
IPC.WrathCombo.GetComboOptionState(string optionName) → boolean

-- Set combo option state (requires lease)
IPC.WrathCombo.SetComboOptionState(
    Guid lease,
    string optionName,
    boolean state  -- default: true
) → SetResult

Enums

SetResult (Return codes for Set operations)

local SetResult = {
    IGNORED = -1,           -- Default, shouldn't be seen
    Okay = 0,               -- Success
    OkayWorking = 1,        -- Success, working asynchronously
    IPCDisabled = 10,       -- IPC services disabled
    InvalidLease = 11,      -- Invalid lease ID
    BlacklistedLease = 12,  -- Lease is blacklisted
    Duplicate = 13,         -- Already set to this value
    PlayerNotAvailable = 14,-- Player object not available
    InvalidConfiguration = 15, -- Config not available
    InvalidValue = 16,      -- Invalid value provided
}

ComboStateKeys

local ComboStateKeys = {
    Enabled = 0,   -- Whether combo is enabled
    AutoMode = 1,  -- Whether combo is in Auto-Mode
}

ComboTargetTypeKeys

local ComboTargetTypeKeys = {
    SingleTarget = 0,
    MultiTarget = 1,
    HealST = 2,      -- Healer single-target
    HealMT = 3,      -- Healer multi-target
    Other = 4,
}

ComboSimplicityLevelKeys

local ComboSimplicityLevelKeys = {
    Simple = 0,
    Advanced = 1,
    Other = 2,
}

CancellationReason (Why lease was cancelled)

local CancellationReason = {
    WrathUserManuallyCancelled = 0,  -- User revoked lease
    LeaseePluginDisabled = 1,        -- Your plugin was disabled
    WrathPluginDisabled = 2,         -- Wrath is being disabled
    LeaseeReleased = 3,              -- You released the lease
    AllServicesSuspended = 4,        -- IPC disabled remotely
    JobChanged = 5,                  -- Player changed jobs
}

Chat Commands

-- Open WrathCombo window
yield("/wrath")

-- Enable/disable auto-rotation
yield("/wrath auto")      -- Toggle
yield("/wrath auto on")   -- Enable
yield("/wrath auto off")  -- Disable

Usage Patterns

Basic Auto-Rotation Control

function EnableWrathAutoRotation()
    if not HasPlugin("WrathCombo") then
        yield("/echo [Script] WrathCombo not available")
        return false
    end

    -- Check if ready
    if not IPC.WrathCombo.IPCReady() then
        yield("/echo [Script] WrathCombo IPC not ready")
        return false
    end

    -- Use chat command for simple toggle (no lease needed)
    yield("/wrath auto on")
    return true
end

Full IPC Control with Lease

local wrathLease = nil

function RegisterWrathControl()
    if not HasPlugin("WrathCombo") then
        return false
    end

    if not IPC.WrathCombo.IPCReady() then
        return false
    end

    -- Register for lease
    wrathLease = IPC.WrathCombo.RegisterForLease(
        "YourPluginName",
        "Your Plugin Display Name"
    )

    if not wrathLease then
        yield("/echo [Script] Failed to get Wrath lease")
        return false
    end

    return true
end

function SetupAutoRotation()
    if not wrathLease then
        if not RegisterWrathControl() then
            return false
        end
    end

    -- Check if job is ready
    if not IPC.WrathCombo.IsCurrentJobAutoRotationReady() then
        -- Configure job for auto-rotation
        local result = IPC.WrathCombo.SetCurrentJobAutoRotationReady(wrathLease)
        if result ~= 0 and result ~= 1 then  -- Not Okay or OkayWorking
            yield("/echo [Script] Failed to setup job: " .. result)
            return false
        end
    end

    -- Enable auto-rotation
    local result = IPC.WrathCombo.SetAutoRotationState(wrathLease, true)
    return result == 0 or result == 1
end

function ReleaseWrathControl()
    if wrathLease then
        IPC.WrathCombo.ReleaseControl(wrathLease)
        wrathLease = nil
    end
end

Check Job Readiness

function IsJobReadyForCombat()
    if not HasPlugin("WrathCombo") then
        return false
    end

    return IPC.WrathCombo.IsCurrentJobAutoRotationReady()
end

Auto-Rotation Config Options

These options can be configured via IPC (from AutoRotationConfigOption enum):

OptionTypeDescription
InCombatOnlyboolOnly run in combat
DPSRotationModeenumDPS rotation behavior
HealerRotationModeenumHealer rotation behavior
FATEPriorityboolPrioritize FATE targets
QuestPriorityboolPrioritize quest targets
SingleTargetHPPintSingle target HP% threshold
AoETargetHPPintAoE target HP% threshold
SingleTargetRegenHPPintRegen HP% threshold
ManageKardiaboolAuto-manage Kardia (SGE)
AutoRezboolAuto-resurrect
AutoRezDPSJobsboolRez as DPS jobs
AutoCleanseboolAuto-cleanse debuffs
IncludeNPCsboolInclude NPCs in healing
OnlyAttackInCombatboolOnly attack in combat
OrbwalkerIntegrationboolOrbwalker integration
AutoRezOutOfPartyboolAuto-rez out of party members
DPSAoETargetsintAoE target count threshold
SingleTargetExcogHPPintExcogitation HP% threshold
AutoRezDPSJobsHealersOnlyboolRez DPS jobs only when healer

Best Practices

  1. Always check IPCReady() before using IPC methods
  2. Register for a lease before making any Set calls
  3. Release your lease when done to be a good citizen
  4. Handle lease cancellation - users can revoke at any time
  5. Check IsCurrentJobAutoRotationReady() before expecting auto-rotation to work
  6. Use chat commands for simple on/off toggles without needing a lease
  7. Don't mix IPC with PvP - IPC doesn't work correctly in PvP

Notes

  • IPC uses a leasing system to give users control over external access
  • Leases can be revoked by users at any time
  • Job changes will cancel leases (reason: JobChanged)
  • SetCurrentJobAutoRotationReady works asynchronously and may take several seconds