Files
ClassicAssist.Avalonia/.qoder/repowiki/en/content/Macro System/Built-in Commands/Object Commands.md
T
Beyhan Oğur d5f52cc3d3 first commit
2026-09-03 04:45:36 +03:00

619 lines
29 KiB
Markdown

# Object Commands
<cite>
**Referenced Files in This Document**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.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)
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [TargetCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TargetCommands.cs)
- [UseInHand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/UseInHand.cs)
- [DropHoldingObject.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/DropHoldingObject.cs)
- [EquipLastWeapon.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/EquipLastWeapon.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Mobile.cs](file://ClassicAssist.Shared/UO/Objects/Mobile.cs)
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
- [QueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/QueryProperties.cs)
- [BatchQueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/BatchQueryProperties.cs)
- [LookRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/LookRequest.cs)
- [UseObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/UseObject.cs)
- [EquipRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/EquipRequest.cs)
- [DisarmRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/DisarmRequest.cs)
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [ContainerContentUpdate.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentUpdate.cs)
- [RemoveObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/RemoveObject.cs)
- [MacroInvoker.cs](file://ClassicAssist.Shared/Data/Macros/MacroInvoker.cs)
- [MacroManager.cs](file://ClassicAssist.Shared/Data/Macros/MacroManager.cs)
- [ParameterType.cs](file://ClassicAssist.Shared/Data/Macros/ParameterType.cs)
- [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs)
- [ObjectInspector.cs](file://ClassicAssist/Data/Hotkeys/Commands/ObjectInspector.cs)
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
</cite>
## 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 object manipulation commands in the ClassicAssist macro system, focusing on inspecting objects, reading and modifying properties, inventory management, and equipment handling. It explains parameter specifications for object identification, property access, and value manipulation; demonstrates automated workflows such as inventory organization, equipment switching, and item analysis; and addresses lifecycle management, memory considerations, performance optimization for bulk operations, error handling for invalid objects, and data validation patterns.
## Project Structure
The object command surface is implemented across shared macro command modules and UO networking packets. The Avalonia UI exposes an Object Inspector that leverages the same underlying inspection capabilities.
```mermaid
graph TB
subgraph "Macro Commands"
OC["ObjectCommands.cs"]
PC["PropertiesCommands.cs"]
EC["EntityCommands.cs"]
MC["MobileCommands.cs"]
AC["ActionCommands.cs"]
TC["TargetCommands.cs"]
end
subgraph "UO Objects"
E["Entity.cs"]
I["Item.cs"]
M["Mobile.cs"]
P["Property.cs"]
end
subgraph "Networking Packets"
QP["QueryProperties.cs"]
BQP["BatchQueryProperties.cs"]
LR["LookRequest.cs"]
UO["UseObject.cs"]
ER["EquipRequest.cs"]
DR["DisarmRequest.cs"]
CCP["ContainerContentsPacket.cs"]
CCU["ContainerContentUpdate.cs"]
RO["RemoveObject.cs"]
end
subgraph "UI Inspector"
OI["ObjectInspector.cs"]
OIW["ObjectInspectorWindow.axaml.cs"]
OIVM["ObjectInspectorViewModel.cs"]
OID["ObjectInspectorData.cs"]
end
OC --> E
OC --> I
OC --> M
PC --> P
EC --> E
MC --> M
AC --> UO
AC --> ER
AC --> DR
TC --> UO
OI --> OC
OIW --> OIVM
OIVM --> OC
OIVM --> PC
OIVM --> OID
OC --> QP
OC --> BQP
OC --> LR
PC --> QP
PC --> BQP
AC --> CCP
AC --> CCU
AC --> RO
```
**Diagram sources**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.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)
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [TargetCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TargetCommands.cs)
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Mobile.cs](file://ClassicAssist.Shared/UO/Objects/Mobile.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
- [QueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/QueryProperties.cs)
- [BatchQueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/BatchQueryProperties.cs)
- [LookRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/LookRequest.cs)
- [UseObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/UseObject.cs)
- [EquipRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/EquipRequest.cs)
- [DisarmRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/DisarmRequest.cs)
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [ContainerContentUpdate.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentUpdate.cs)
- [RemoveObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/RemoveObject.cs)
- [ObjectInspector.cs](file://ClassicAssist/Data/Hotkeys/Commands/ObjectInspector.cs)
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
**Section sources**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.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)
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [TargetCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TargetCommands.cs)
- [ObjectInspector.cs](file://ClassicAssist/Data/Hotkeys/Commands/ObjectInspector.cs)
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
## Core Components
- Object inspection: Resolve entities by ID or filter, retrieve basic metadata (name, serial, location), and request detailed property sets via look or property queries.
- Property access: Read named properties with type-aware values; batch-read multiple properties efficiently; write supported properties where allowed.
- Inventory management: Enumerate containers, read contents, move items between containers, drop held items, and react to container updates.
- Equipment handling: Equip/disarm items, use items in hand, and manage last-used weapon state.
Key implementation anchors:
- Object resolution and high-level operations are exposed through macro commands.
- Networking layer uses specific packets for look, query/batch-query properties, equip/disarm, use, and container content synchronization.
- UI inspector integrates with the same APIs to present live object details.
**Section sources**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs)
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [TargetCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TargetCommands.cs)
- [QueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/QueryProperties.cs)
- [BatchQueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/BatchQueryProperties.cs)
- [LookRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/LookRequest.cs)
- [UseObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/UseObject.cs)
- [EquipRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/EquipRequest.cs)
- [DisarmRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/DisarmRequest.cs)
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [ContainerContentUpdate.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentUpdate.cs)
- [RemoveObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/RemoveObject.cs)
## Architecture Overview
The macro system invokes command handlers that operate on entity models and send network requests. Responses update local caches and collections, which are then surfaced to macros and UI components.
```mermaid
sequenceDiagram
participant Macro as "Macro Script"
participant Invoker as "MacroInvoker.cs"
participant Cmd as "ObjectCommands.cs"
participant Net as "Networking Packets"
participant Model as "Entity/Item/Mobile"
participant UI as "ObjectInspectorViewModel.cs"
Macro->>Invoker : Execute command with parameters
Invoker->>Cmd : Resolve target(s) and validate inputs
Cmd->>Net : Send LookRequest / QueryProperties / BatchQueryProperties
Net-->>Model : Update cached properties and metadata
Cmd-->>Macro : Return result or status
UI->>Cmd : Request object details for display
Cmd-->>UI : Provide inspected data
```
**Diagram sources**
- [MacroInvoker.cs](file://ClassicAssist.Shared/Data/Macros/MacroInvoker.cs)
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [LookRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/LookRequest.cs)
- [QueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/QueryProperties.cs)
- [BatchQueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/BatchQueryProperties.cs)
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Mobile.cs](file://ClassicAssist.Shared/UO/Objects/Mobile.cs)
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
## Detailed Component Analysis
### Object Inspection and Identification
- Purpose: Identify and inspect entities by serial or filters; fetch names, locations, and other attributes.
- Parameters:
- Object identifier: serial number or filter criteria (e.g., name pattern, body type).
- Depth: whether to include full property set or just basic metadata.
- Behavior:
- Resolves a single target or collection based on provided criteria.
- Sends look request if deeper info is required.
- Returns structured object information suitable for scripting or UI.
```mermaid
flowchart TD
Start(["Inspect Entry"]) --> Parse["Parse Identifier and Options"]
Parse --> Valid{"Valid Target?"}
Valid --> |No| Error["Return Error: Invalid Object"]
Valid --> |Yes| HasProps{"Has Cached Properties?"}
HasProps --> |Yes| UseCache["Use Cached Data"]
HasProps --> |No| SendLook["Send LookRequest"]
SendLook --> Update["Update Cache"]
UseCache --> Return["Return Inspected Data"]
Update --> Return
Error --> End(["Exit"])
Return --> End
```
**Diagram sources**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [LookRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/LookRequest.cs)
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
**Section sources**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [LookRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/LookRequest.cs)
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
### Property Reading and Writing
- Purpose: Access named properties with typed values; support batch reads for efficiency; write when permitted.
- Parameters:
- Target object identifier.
- Property name(s).
- For writes: new value and expected type.
- Behavior:
- Reads from cache if available; otherwise issues QueryProperties or BatchQueryProperties.
- Validates property existence and type before returning or writing.
- Writes trigger server-side updates only for writable properties.
```mermaid
sequenceDiagram
participant Macro as "Macro Script"
participant Props as "PropertiesCommands.cs"
participant Net as "Query/Batch Query"
participant Model as "Property.cs"
Macro->>Props : ReadProperty(target, name)
Props->>Model : Check cache for property
alt Not cached
Props->>Net : Send QueryProperties or BatchQueryProperties
Net-->>Model : Populate property list
end
Props-->>Macro : Typed property value
Macro->>Props : WriteProperty(target, name, value)
Props->>Model : Validate writability and type
Props->>Net : Send update packet (if applicable)
Props-->>Macro : Success/Failure
```
**Diagram sources**
- [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs)
- [QueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/QueryProperties.cs)
- [BatchQueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/BatchQueryProperties.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
**Section sources**
- [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs)
- [QueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/QueryProperties.cs)
- [BatchQueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/BatchQueryProperties.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
### Inventory Management
- Purpose: Enumerate containers, read contents, move items, drop held items, and respond to container updates.
- Key operations:
- List container contents using cached data or refresh via container packets.
- Move items between containers (server-driven actions).
- Drop held item to ground or target location.
- Parameters:
- Container identifier (serial).
- Source/target item identifiers.
- Optional quantity or destination coordinates.
```mermaid
flowchart TD
StartInv(["Inventory Operation"]) --> Identify["Identify Container and Items"]
Identify --> Refresh{"Need Refresh?"}
Refresh --> |Yes| WaitCC["Wait for ContainerContentsPacket"]
Refresh --> |No| Proceed["Proceed with Cached Data"]
WaitCC --> Proceed
Proceed --> Action{"Operation Type"}
Action --> |Move| SendMove["Send Move/Drop Packet"]
Action --> |Drop Held| DropHeld["DropHoldingObject"]
Action --> |List| ListItems["Enumerate Items"]
SendMove --> Update["Handle ContainerContentUpdate"]
DropHeld --> Update
ListItems --> Done(["Done"])
Update --> Done
```
**Diagram sources**
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [ContainerContentUpdate.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentUpdate.cs)
- [RemoveObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/RemoveObject.cs)
- [DropHoldingObject.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/DropHoldingObject.cs)
**Section sources**
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [ContainerContentUpdate.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentUpdate.cs)
- [RemoveObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/RemoveObject.cs)
- [DropHoldingObject.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/DropHoldingObject.cs)
### Equipment Handling
- Purpose: Equip/disarm items, use items in hand, and manage last-used weapon state.
- Operations:
- Equip item to appropriate slot.
- Disarm current equipped item.
- Use item currently held in hand.
- Equip last used weapon shortcut.
- Parameters:
- Item serial for equip/disarm/use.
- Slot selection when relevant.
```mermaid
sequenceDiagram
participant Macro as "Macro Script"
participant Act as "ActionCommands.cs"
participant HK as "Hotkey Commands"
participant Net as "Equip/Disarm/Use Packets"
Macro->>Act : Equip(itemSerial)
Act->>Net : Send EquipRequest
Net-->>Macro : Confirmation
Macro->>Act : Disarm(slot)
Act->>Net : Send DisarmRequest
Net-->>Macro : Confirmation
Macro->>HK : UseInHand()
HK->>Net : Send UseObject
Net-->>Macro : Confirmation
Macro->>HK : EquipLastWeapon()
HK->>Net : Send EquipRequest(lastWeapon)
Net-->>Macro : Confirmation
```
**Diagram sources**
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [UseInHand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/UseInHand.cs)
- [DropHoldingObject.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/DropHoldingObject.cs)
- [EquipLastWeapon.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/EquipLastWeapon.cs)
- [EquipRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/EquipRequest.cs)
- [DisarmRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/DisarmRequest.cs)
- [UseObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/UseObject.cs)
**Section sources**
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [UseInHand.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/UseInHand.cs)
- [DropHoldingObject.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/DropHoldingObject.cs)
- [EquipLastWeapon.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/EquipLastWeapon.cs)
- [EquipRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/EquipRequest.cs)
- [DisarmRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/DisarmRequest.cs)
- [UseObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/UseObject.cs)
### Automated Workflows
#### Inventory Organization Workflow
- Steps:
- Scan backpack contents.
- Filter items by criteria (type, hue, quality).
- Move matching items to designated containers.
- Confirm moves via container updates.
- Validation:
- Ensure target container exists and has capacity.
- Handle partial moves and errors gracefully.
```mermaid
flowchart TD
A["Start Organize"] --> B["Open Backpack"]
B --> C["Read Contents"]
C --> D{"Match Criteria?"}
D --> |Yes| E["Select Destination Container"]
D --> |No| F["Skip Item"]
E --> G["Move Item"]
G --> H["Verify Update"]
F --> I["Next Item"]
H --> I
I --> J{"More Items?"}
J --> |Yes| C
J --> |No| K["Finish"]
```
[No sources needed since this diagram shows conceptual workflow, not actual code structure]
#### Equipment Switching Workflow
- Steps:
- Identify desired weapon/item.
- Equip it to the correct slot.
- Optionally disarm previous item.
- Use item in hand if needed.
- Validation:
- Verify item is wearable/equippable.
- Handle conflicts (slot occupied).
```mermaid
sequenceDiagram
participant S as "Script"
participant AC as "ActionCommands.cs"
participant HK as "EquipLastWeapon.cs"
participant NET as "Equip/Disarm/Use"
S->>AC : Find item by filter
AC-->>S : Item serial
S->>AC : Equip(serial)
AC->>NET : EquipRequest
NET-->>S : Success
S->>AC : Disarm(currentSlot)
AC->>NET : DisarmRequest
NET-->>S : Success
S->>HK : UseInHand()
HK->>NET : UseObject
NET-->>S : Success
```
**Diagram sources**
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [EquipLastWeapon.cs](file://ClassicAssist.Shared/Data/Hotkeys/Commands/EquipLastWeapon.cs)
- [EquipRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/EquipRequest.cs)
- [DisarmRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/DisarmRequest.cs)
- [UseObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/UseObject.cs)
#### Item Analysis Workflow
- Steps:
- Select item for inspection.
- Request look and/or property query.
- Aggregate key attributes (name, stats, custom properties).
- Output summary for decision-making.
- Validation:
- Ensure object exists and is visible.
- Handle missing properties gracefully.
```mermaid
flowchart TD
X["Analyze Item"] --> Y["Resolve Serial"]
Y --> Z["Send LookRequest"]
Z --> AA["Send QueryProperties"]
AA --> AB["Aggregate Results"]
AB --> AC["Display Summary"]
```
**Diagram sources**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [LookRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/LookRequest.cs)
- [QueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/QueryProperties.cs)
**Section sources**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs)
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [TargetCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TargetCommands.cs)
## Dependency Analysis
Command implementations depend on core entity models and networking packets. UI components rely on the same command surface to provide interactive inspection.
```mermaid
classDiagram
class Entity {
+int Serial
+string Name
+Location Position
}
class Item {
+int Hue
+int Amount
+bool Equipped
}
class Mobile {
+int Body
+int Gold
}
class Property {
+string Name
+object Value
}
class ObjectCommands {
+Inspect(target)
+GetProperties(target, names)
}
class PropertiesCommands {
+ReadProperty(target, name)
+WriteProperty(target, name, value)
}
class ActionCommands {
+Equip(serial)
+Disarm(slot)
+UseInHand()
}
class QueryProperties
class BatchQueryProperties
class LookRequest
class EquipRequest
class DisarmRequest
class UseObject
class ContainerContentsPacket
class ContainerContentUpdate
class RemoveObject
ObjectCommands --> Entity : "uses"
ObjectCommands --> Item : "uses"
ObjectCommands --> Mobile : "uses"
PropertiesCommands --> Property : "reads/writes"
ObjectCommands --> QueryProperties : "requests"
ObjectCommands --> BatchQueryProperties : "batch requests"
ObjectCommands --> LookRequest : "look"
ActionCommands --> EquipRequest : "equips"
ActionCommands --> DisarmRequest : "disarms"
ActionCommands --> UseObject : "uses"
ActionCommands --> ContainerContentsPacket : "list contents"
ActionCommands --> ContainerContentUpdate : "updates"
ActionCommands --> RemoveObject : "removals"
```
**Diagram sources**
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Mobile.cs](file://ClassicAssist.Shared/UO/Objects/Mobile.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs)
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [QueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/QueryProperties.cs)
- [BatchQueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/BatchQueryProperties.cs)
- [LookRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/LookRequest.cs)
- [EquipRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/EquipRequest.cs)
- [DisarmRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/DisarmRequest.cs)
- [UseObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/UseObject.cs)
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [ContainerContentUpdate.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentUpdate.cs)
- [RemoveObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/RemoveObject.cs)
**Section sources**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs)
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Mobile.cs](file://ClassicAssist.Shared/UO/Objects/Mobile.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
- [QueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/QueryProperties.cs)
- [BatchQueryProperties.cs](file://ClassicAssist.Shared/UO/Network/Packets/BatchQueryProperties.cs)
- [LookRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/LookRequest.cs)
- [EquipRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/EquipRequest.cs)
- [DisarmRequest.cs](file://ClassicAssist.Shared/UO/Network/Packets/DisarmRequest.cs)
- [UseObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/UseObject.cs)
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [ContainerContentUpdate.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentUpdate.cs)
- [RemoveObject.cs](file://ClassicAssist.Shared/UO/Network/Packets/RemoveObject.cs)
## Performance Considerations
- Prefer batch property queries over individual queries to reduce network overhead.
- Cache frequently accessed properties and invalidate on relevant updates (container changes, look responses).
- Avoid polling loops; rely on event-driven updates from container content packets and removal events.
- Limit deep inspections to necessary objects; defer expensive look requests until required.
- For bulk operations, group actions and process results asynchronously to prevent blocking the macro thread.
[No sources needed since this section provides general guidance]
## Troubleshooting Guide
Common issues and resolutions:
- Invalid object identifier: Validate serials and ensure the object exists before operations.
- Missing properties: Trigger a look or property query to refresh cache; handle absent properties gracefully.
- Permission errors: Some properties are read-only; check writability before attempting writes.
- Network timeouts: Implement retries with backoff for look/query requests.
- Container desync: Listen for container content updates and remove events to keep local state consistent.
Error handling patterns:
- Always validate input parameters (serials, property names, types).
- Return meaningful statuses to macros and log actionable messages.
- Use try/catch around network calls and propagate user-friendly errors.
**Section sources**
- [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs)
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs)
## Conclusion
The object command surface in ClassicAssist provides robust capabilities for inspecting objects, managing properties, organizing inventory, and handling equipment. By leveraging batch queries, caching strategies, and event-driven updates, macros can perform efficient and reliable automation. Proper validation and error handling ensure resilience against invalid inputs and transient network conditions.
## Appendices
### Parameter Specifications Summary
- Object identification:
- Serial: integer identifier for precise targeting.
- Filters: name patterns, body types, and other attributes for selection.
- Property access:
- Property name: string key.
- Value type: strongly-typed representation returned by the engine.
- Writability: determined per property; only writable properties accept updates.
- Inventory operations:
- Container serial: target container.
- Item serials: source and destination items.
- Quantities: optional counts for partial moves.
- Equipment operations:
- Item serial: target item.
- Slot: optional slot specification for disarming/equipping.
**Section sources**
- [ObjectCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ObjectCommands.cs)
- [PropertiesCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/PropertiesCommands.cs)
- [ActionCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/ActionCommands.cs)
- [TargetCommands.cs](file://ClassicAssist.Shared/Data/Macros/Commands/TargetCommands.cs)