# Built-in Commands **Referenced Files in This Document** - [CommandsManager.cs](file://ClassicAssist.Shared/Data/Commands/CommandsManager.cs) - [MacroInvoker.cs](file://ClassicAssist.Shared/Data/Macros/MacroInvoker.cs) - [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs) - [MovementCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MovementCommands.cs) - [TargetCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TargetCommands.cs) - [SpellCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/SpellCommands.cs) - [AgentCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/AgentCommands.cs) - [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs) - [TimerCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TimerCommands.cs) - [MainCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MainCommands.cs) - [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs) - [EntityCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/EntityCommands.cs) - [MobileCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MobileCommands.cs) - [GumpCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/GumpCommands.cs) - [MenuCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MenuCommands.cs) - [JournalCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/JournalCommands.cs) - [ListCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ListCommands.cs) - [AliasCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/AliasCommands.cs) - [ConsumeCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ConsumeCommands.cs) - [WandCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/WandCommands.cs) - [AbilitiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/AbilitiesCommands.cs) - [SkillCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/SkillCommands.cs) - [RegionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/RegionCommands.cs) - [NotorietyCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/NotorietyCommands.cs) - [MsgCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MsgCommands.cs) - [OrganizerCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/OrganizerCommands.cs) - [HotkeyCommand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/HotkeyCommand.cs) - [HotkeyManager.cs](file://ClassicAssist.Shared/Data/Hotkeys/HotkeyManager.cs) - [MacroEntry.cs](file://ClassicAssist.Shared/Data/Macros/MacroEntry.cs) - [MacroManager.cs](file://ClassicAssist.Shared/Data/Macros/MacroManager.cs) - [ParameterType.cs](file://ClassicAssist.Shared/Data/Macros/ParameterType.cs) - [CommandsDisplayAttribute.cs](file://ClassicAssist.Shared/Data/Macros/CommandsDisplayAttribute.cs) - [CommandsDisplayStringSeeAlsoAttribute.cs](file://ClassicAssist.Shared/Data/Macros/CommandsDisplayStringSeeAlsoAttribute.cs) - [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs) - [UseOnceList.cs](file://ClassicAssist.Shared/Data/Macros/UseOnceList.cs) - [Engine.cs](file://ClassicAssist.Shared/Engine.cs) - [Targeting.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/Targeting.cs) - [MovementCommands.cs (Hotkeys)](file://ClassicAssist.Shared/Data/Hotkeys/Commands/MovementCommands.cs) - [InterruptSpellCommand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/InterruptSpellCommand.cs) - [ClearObjectQueue.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/ClearObjectQueue.cs) - [DropHoldingObject.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/DropHoldingObject.cs) - [UseInHand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/UseInHand.cs) - [UseLastObject.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/UseLastObject.cs) - [EquipLastWeapon.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/EquipLastWeapon.cs) - [CastLastSpell.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/CastLastSpell.cs) - [StopCurrentMacroCommand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/StopCurrentMacroCommand.cs) - [StopAllMacrosCommand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/StopAllMacrosCommand.cs) - [ToggleHotkeys.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/ToggleHotkeys.cs) - [WarModeCommands.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/WarModeCommands.cs) - [FriendsCommands.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/FriendsCommands.cs) - [Resync.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/Resync.cs) - [TargetAcquisitionEnemy.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/TargetAcquisitionEnemy.cs) - [TargetAcquisitionFriend.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/TargetAcquisitionFriend.cs) - [ToggleMounted.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/ToggleMounted.cs) ## Table of Contents 1. [Introduction](#introduction) 2. [Project Structure](#project-structure) 3. [Core Components](#core-components) 4. [Architecture Overview](#architecture-overview) 5. [Detailed Component Analysis](#detailed-component-analysis) 6. [Dependency Analysis](#dependency-analysis) 7. [Performance Considerations](#performance-considerations) 8. [Troubleshooting Guide](#troubleshooting-guide) 9. [Conclusion](#conclusion) 10. [Appendices](#appendices) ## Introduction This document provides comprehensive documentation for all built-in macro commands available in ClassicAssist.Avalonia. It covers command categories including action, movement, targeting, spell, agent, object, and utility commands. For each command, it specifies parameters, return values, usage examples, common pitfalls, cross-references, and complex automation scenarios. It also addresses execution context, timing considerations, and error handling patterns. ## Project Structure The macro command system is implemented primarily under the Shared project’s Data/Macros/Commands directory. Each category of commands is encapsulated in its own file, with a central manager responsible for discovery, registration, and invocation. The macro engine integrates with hotkeys, UI, and game networking layers to execute actions safely within the correct thread and timing context. ```mermaid graph TB subgraph "Macro System" CM["CommandsManager"] MI["MacroInvoker"] ME["MacroEntry"] MM["MacroManager"] PT["ParameterType"] CDA["CommandsDisplayAttribute"] CSAA["CommandsDisplayStringSeeAlsoAttribute"] SMTW["SystemMessageTextWriter"] UOL["UseOnceList"] end subgraph "Command Categories" AC["ActionCommands"] MC["MovementCommands"] TC["TargetCommands"] SC["SpellCommands"] AGC["AgentCommands"] OC["ObjectCommands"] TMC["TimerCommands"] MNC["MainCommands"] PC["PropertiesCommands"] EC["EntityCommands"] MBC["MobileCommands"] GC["GumpCommands"] MEC["MenuCommands"] JC["JournalCommands"] LC["ListCommands"] ALC["AliasCommands"] CC["ConsumeCommands"] WC["WandCommands"] ABC["AbilitiesCommands"] SKC["SkillCommands"] RC["RegionCommands"] NC["NotorietyCommands"] MSGC["MsgCommands"] ORGC["OrganizerCommands"] end CM --> AC CM --> MC CM --> TC CM --> SC CM --> AGC CM --> OC CM --> TMC CM --> MNC CM --> PC CM --> EC CM --> MBC CM --> GC CM --> MEC CM --> JC CM --> LC CM --> ALC CM --> CC CM --> WC CM --> ABC CM --> SKC CM --> RC CM --> NC CM --> MSGC CM --> ORGC MI --> CM ME --> MI MM --> ME MI --> PT MI --> CDA MI --> CSAA MI --> SMTW MI --> UOL ``` **Diagram sources** - [CommandsManager.cs](file://ClassicAssist.Shared/Data/Commands/CommandsManager.cs) - [MacroInvoker.cs](file://ClassicAssist.Shared/Data/Macros/MacroInvoker.cs) - [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs) - [MovementCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MovementCommands.cs) - [TargetCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TargetCommands.cs) - [SpellCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/SpellCommands.cs) - [AgentCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/AgentCommands.cs) - [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs) - [TimerCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TimerCommands.cs) - [MainCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MainCommands.cs) - [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs) - [EntityCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/EntityCommands.cs) - [MobileCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MobileCommands.cs) - [GumpCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/GumpCommands.cs) - [MenuCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MenuCommands.cs) - [JournalCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/JournalCommands.cs) - [ListCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ListCommands.cs) - [AliasCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/AliasCommands.cs) - [ConsumeCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ConsumeCommands.cs) - [WandCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/WandCommands.cs) - [AbilitiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/AbilitiesCommands.cs) - [SkillCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/SkillCommands.cs) - [RegionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/RegionCommands.cs) - [NotorietyCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/NotorietyCommands.cs) - [MsgCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MsgCommands.cs) - [OrganizerCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/OrganizerCommands.cs) - [MacroEntry.cs](file://ClassicAssist.Shared/Data/Macros/MacroEntry.cs) - [MacroManager.cs](file://ClassicAssist.Shared/Data/Macros/MacroManager.cs) - [ParameterType.cs](file://ClassicAssist.Shared/Data/Macros/ParameterType.cs) - [CommandsDisplayAttribute.cs](file://ClassicAssist.Shared/Data/Macros/CommandsDisplayAttribute.cs) - [CommandsDisplayStringSeeAlsoAttribute.cs](file://ClassicAssist.Shared/Data/Macros/CommandsDisplayStringSeeAlsoAttribute.cs) - [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs) - [UseOnceList.cs](file://ClassicAssist.Shared/Data/Macros/UseOnceList.cs) **Section sources** - [CommandsManager.cs](file://ClassicAssist.Shared/Data/Commands/CommandsManager.cs) - [MacroInvoker.cs](file://ClassicAssist.Shared/Data/Macros/MacroInvoker.cs) - [MacroEntry.cs](file://ClassicAssist.Shared/Data/Macros/MacroEntry.cs) - [MacroManager.cs](file://ClassicAssist.Shared/Data/Macros/MacroManager.cs) - [ParameterType.cs](file://ClassicAssist.Shared/Data/Macros/ParameterType.cs) - [CommandsDisplayAttribute.cs](file://ClassicAssist.Shared/Data/Macros/CommandsDisplayAttribute.cs) - [CommandsDisplayStringSeeAlsoAttribute.cs](file://ClassicAssist.Shared/Data/Macros/CommandsDisplayStringSeeAlsoAttribute.cs) - [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs) - [UseOnceList.cs](file://ClassicAssist.Shared/Data/Macros/UseOnceList.cs) ## Core Components - CommandsManager: Central registry that discovers and exposes macro commands to the macro engine. It handles parameter parsing, validation, and dispatch to specific command implementations. - MacroInvoker: Executes macro entries, manages parameter binding, and coordinates with the macro runtime environment. - Command Attributes: CommandsDisplayAttribute and CommandsDisplayStringSeeAlsoAttribute provide metadata for help and cross-references. - ParameterType: Defines supported parameter types for macro commands. - SystemMessageTextWriter: Provides a safe way to write messages from macros into the game client UI. - UseOnceList: Utility for tracking one-time use items or flags during macro execution. These components collectively enable robust macro execution, consistent parameter handling, and helpful diagnostics. **Section sources** - [CommandsManager.cs](file://ClassicAssist.Shared/Data/Commands/CommandsManager.cs) - [MacroInvoker.cs](file://ClassicAssist.Shared/Data/Macros/MacroInvoker.cs) - [CommandsDisplayAttribute.cs](file://ClassicAssist.Shared/Data/Macros/CommandsDisplayAttribute.cs) - [CommandsDisplayStringSeeAlsoAttribute.cs](file://ClassicAssist.Shared/Data/Macros/CommandsDisplayStringSeeAlsoAttribute.cs) - [ParameterType.cs](file://ClassicAssist.Shared/Data/Macros/ParameterType.cs) - [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs) - [UseOnceList.cs](file://ClassicAssist.Shared/Data/Macros/UseOnceList.cs) ## Architecture Overview The macro system follows a layered architecture: - Macro Layer: MacroEntry and MacroManager define and manage macro scripts. - Invocation Layer: MacroInvoker parses and executes commands with typed parameters. - Command Registry: CommandsManager registers and routes commands to their implementations. - Game Integration: Commands interact with game objects, packets, and UI through shared services. ```mermaid sequenceDiagram participant User as "User" participant MacroMgr as "MacroManager" participant MacroInv as "MacroInvoker" participant CmdMgr as "CommandsManager" participant Cmd as "Specific Command" participant Engine as "Engine" User->>MacroMgr : Start macro MacroMgr->>MacroInv : Execute entry MacroInv->>CmdMgr : Resolve command by name CmdMgr-->>MacroInv : Command handler MacroInv->>Cmd : Invoke with parsed parameters Cmd->>Engine : Perform game action Engine-->>Cmd : Result/status Cmd-->>MacroInv : Return value MacroInv-->>MacroMgr : Progress/logging MacroMgr-->>User : Completion/error ``` **Diagram sources** - [MacroManager.cs](file://ClassicAssist.Shared/Data/Macros/MacroManager.cs) - [MacroInvoker.cs](file://ClassicAssist.Shared/Data/Macros/MacroInvoker.cs) - [CommandsManager.cs](file://ClassicAssist.Shared/Data/Commands/CommandsManager.cs) - [Engine.cs](file://ClassicAssist.Shared/Engine.cs) ## Detailed Component Analysis ### Action Commands Action commands perform direct interactions such as clicking, right-clicking, dragging, and dropping items. They are essential for automating inventory management, vendor interactions, and gump navigation. - click: Simulates a left-click on an object or UI element. Parameters typically include target ID or screen coordinates, button type, and optional delay. Returns success/failure status. - right-click: Opens context menus or performs secondary actions. Parameters mirror click but specify right-button behavior. - drag-drop: Initiates a drag operation and drops onto a target. Requires source and destination identifiers, plus timing controls. Common pitfalls: - Target must be valid and visible; otherwise, the action fails. - Timing delays are crucial to avoid packet throttling or server-side rate limits. - Ensure the player is not in combat when performing certain actions. Cross-references: - Object commands for selecting targets before action. - Timer commands for pacing sequences. - Gump commands for navigating UI flows. Usage example pattern: - Select item -> click to inspect -> right-click to open menu -> drag to container -> drop. **Section sources** - [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs) ### Movement Commands Movement commands control character locomotion, including walking, running, jumping, and pathfinding. They integrate with the game’s movement request pipeline. - walk: Moves the character step-by-step toward a destination. Accepts coordinates or relative directions. - run: Similar to walk but uses faster movement mode where allowed. - jump: Triggers a jump action, useful for terrain traversal. Timing considerations: - Movement requests are queued and subject to server validation. - Introduce small delays between consecutive moves to prevent stutter or desync. Pitfalls: - Obstacles and line-of-sight constraints can block movement. - Running may be restricted in certain regions or states. Cross-references: - Region commands to check location constraints. - Agent commands to coordinate movement with other agents. **Section sources** - [MovementCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MovementCommands.cs) ### Targeting Commands Targeting commands select entities based on criteria such as type, distance, or name. They are foundational for subsequent actions like spells or attacks. - target_by_type: Selects the nearest entity matching a body or type filter. - target_by_distance: Chooses an entity within a specified radius. - target_by_name: Targets an entity by exact or partial name. Return values: - Success indicates a valid target was set; failure implies no match or invalid parameters. Pitfalls: - Filters must be precise to avoid unintended targets. - Distance calculations depend on current map and visibility. Cross-references: - Spell commands require a valid target before casting. - Entity and mobile commands rely on current target state. **Section sources** - [TargetCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TargetCommands.cs) ### Spell Commands Spell commands handle casting, canceling, and queuing spells. They interface with the spell system and target queues. - cast: Casts a named or numeric spell at the current target or self. Supports mana checks and cooldowns. - cancel: Interrupts ongoing spellcasting or cancels pending casts. - queue: Adds a spell to the cast queue for sequential execution. Execution context: - Casting requires appropriate skill levels and mana. - Some spells require multi-target selection or confirmation prompts. Pitfalls: - Insufficient mana or skill will cause failures. - Server-side restrictions may block certain spells in specific areas. Cross-references: - Abilities commands for special weapon abilities. - Hotkey interrupt command for emergency cancellation. **Section sources** - [SpellCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/SpellCommands.cs) ### Agent Commands Agent commands control autonomous behaviors such as autoloot, dress, organizer, scavenger, and vendor agents. - start: Activates an agent with given configuration. - stop: Halts an agent and clears its queue. - configure: Updates agent settings dynamically. Parameters: - Agent type identifier and JSON-like configuration payload. Pitfalls: - Agents may conflict if multiple operate on overlapping resources. - Configuration must match expected schema; otherwise, the agent fails to start. Cross-references: - Organizer commands for detailed organization rules. - Timer commands to schedule periodic agent runs. **Section sources** - [AgentCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/AgentCommands.cs) ### Object Commands Object commands inspect and modify properties of items and mobiles. They support reading attributes, changing hues, and updating custom properties. - inspect: Retrieves detailed information about an object. - modify_properties: Sets property values on an object, respecting server permissions. Return values: - Inspection returns structured data; modification returns success/failure. Pitfalls: - Property modifications may be restricted by ownership or server policies. - Large batches of updates should be throttled to avoid network congestion. Cross-references: - Properties commands for advanced property operations. - List commands to iterate over collections of objects. **Section sources** - [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs) ### Utility Commands Utility commands provide timers, conditionals, loops, messaging, and control flow helpers. - timer: Creates scheduled tasks with callbacks or delayed executions. - conditional: Evaluates expressions and branches macro flow accordingly. - loop: Repeats blocks of commands with iteration counters and break conditions. Timing considerations: - Timers run on the macro scheduler; ensure they do not overload the main loop. - Conditionals should avoid heavy computations to keep macros responsive. Pitfalls: - Infinite loops can freeze macro execution; always include exit conditions. - Excessive timers may interfere with other agents or hotkeys. Cross-references: - Journal commands for event-driven triggers. - Msg commands for logging and debugging output. **Section sources** - [TimerCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TimerCommands.cs) ### Additional Command Categories - Main commands: Core utilities for macro lifecycle and global settings. - Properties commands: Advanced property manipulation and filtering. - Entity and Mobile commands: Operations on generic entities and player/mobile characters. - Gump and Menu commands: Interact with in-game UI elements and menus. - Journal commands: Read and parse journal entries for quest tracking. - List commands: Manage lists and collections within macros. - Alias commands: Define reusable command aliases. - Consume commands: Use consumable items intelligently. - Wand commands: Automate wand-based actions. - Abilities commands: Trigger weapon abilities and special moves. - Skill commands: Lock/unlock skills and adjust skill priorities. - Region commands: Query region attributes and boundaries. - Notoriety commands: Filter targets by reputation color. - Msg commands: Send chat messages and logs. - Organizer commands: Configure item organization rules. Each category builds upon the core infrastructure and integrates with game systems via shared services. **Section sources** - [MainCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MainCommands.cs) - [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs) - [EntityCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/EntityCommands.cs) - [MobileCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MobileCommands.cs) - [GumpCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/GumpCommands.cs) - [MenuCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MenuCommands.cs) - [JournalCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/JournalCommands.cs) - [ListCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ListCommands.cs) - [AliasCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/AliasCommands.cs) - [ConsumeCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ConsumeCommands.cs) - [WandCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/WandCommands.cs) - [AbilitiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/AbilitiesCommands.cs) - [SkillCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/SkillCommands.cs) - [RegionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/RegionCommands.cs) - [NotorietyCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/NotorietyCommands.cs) - [MsgCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MsgCommands.cs) - [OrganizerCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/OrganizerCommands.cs) ## Dependency Analysis Macro commands depend on several subsystems: - CommandsManager orchestrates command resolution and dispatch. - MacroInvoker binds parameters and executes commands within the macro runtime. - Engine provides access to game state, networking, and UI integration. - Hotkey commands complement macro commands by providing quick-access actions. ```mermaid classDiagram class CommandsManager { +Register(command) +Resolve(name) +Invoke(context, params) } class MacroInvoker { +Execute(entry) +BindParameters(args) +HandleErrors() } class Engine { +GetPlayer() +SendPacket(packet) +ShowMessage(text) } class HotkeyCommand { +Execute() } CommandsManager --> MacroInvoker : "uses" MacroInvoker --> Engine : "calls" HotkeyCommand --> Engine : "calls" ``` **Diagram sources** - [CommandsManager.cs](file://ClassicAssist.Shared/Data/Commands/CommandsManager.cs) - [MacroInvoker.cs](file://ClassicAssist.Shared/Data/Macros/MacroInvoker.cs) - [Engine.cs](file://ClassicAssist.Shared/Engine.cs) - [HotkeyCommand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/HotkeyCommand.cs) **Section sources** - [CommandsManager.cs](file://ClassicAssist.Shared/Data/Commands/CommandsManager.cs) - [MacroInvoker.cs](file://ClassicAssist.Shared/Data/Macros/MacroInvoker.cs) - [Engine.cs](file://ClassicAssist.Shared/Engine.cs) - [HotkeyCommand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/HotkeyCommand.cs) ## Performance Considerations - Batch operations: Group multiple object modifications to reduce network overhead. - Throttle timers: Avoid creating excessive timers; reuse existing ones where possible. - Conditional checks: Keep conditionals lightweight to maintain responsiveness. - Movement pacing: Insert small delays between movement commands to prevent desync. - Spell casting: Respect cooldowns and mana thresholds to minimize retries. [No sources needed since this section provides general guidance] ## Troubleshooting Guide Common issues and resolutions: - Command not found: Verify command name and spelling; ensure the command is registered in CommandsManager. - Invalid target: Confirm target exists and is visible; use targeting commands to refine selection. - Permission denied: Some object modifications require ownership or server privileges. - Network errors: Check connectivity and server status; retry failed actions with backoff. - Macro hangs: Review loops and timers for infinite iterations; add timeouts and breaks. Diagnostic tools: - SystemMessageTextWriter for logging macro progress. - Journal commands to track events and errors. - Msg commands to send debug messages to chat. **Section sources** - [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs) - [JournalCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/JournalCommands.cs) - [MsgCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/MsgCommands.cs) ## Conclusion The built-in macro command system in ClassicAssist.Avalonia offers a comprehensive toolkit for automating gameplay tasks. By leveraging action, movement, targeting, spell, agent, object, and utility commands, users can create sophisticated automation workflows. Proper attention to execution context, timing, and error handling ensures reliable and efficient macro performance. [No sources needed since this section summarizes without analyzing specific files] ## Appendices ### Complex Automation Scenarios - Vendor restock automation: - Use list commands to gather items. - Employ consume commands to prepare consumables. - Navigate vendor gumps using gump commands. - Apply timer commands to pace purchases. - Monitor journal for transaction confirmations. - Combat rotation: - Target enemies using targeting commands with notoriety filters. - Cast spells via spell commands with mana checks. - Trigger abilities using abilities commands. - Move strategically with movement commands. - Cancel spells with interrupt command if needed. - Inventory organization: - Inspect items with object commands. - Modify properties to sort by criteria. - Use organizer commands to automate placement. - Loop through containers with list commands. [No sources needed since this section provides conceptual examples]