first commit

This commit is contained in:
Beyhan Oğur
2026-09-03 04:45:36 +03:00
commit d5f52cc3d3
1038 changed files with 169579 additions and 0 deletions
@@ -0,0 +1,377 @@
# Advanced Features and Customization
<cite>
**Referenced Files in This Document**
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [AutolootTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [ClilocSelectionWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/ClilocSelectionWindow.xaml.cs)
- [AutolootTests.cs](file://ClassicAssist.Tests/Agents/AutolootTests.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 explains advanced autoloot features and customization options with a focus on the AutolootViewModel’s role in managing rule collections and providing MVVM binding for the UI. It covers advanced filtering capabilities (including regular expressions, custom property evaluators, and conditional logic based on player state or location), performance tuning for high-throughput scenarios, memory management for large rule sets, extension points for creating custom property types and operators, debugging techniques for complex rule conflicts, monitoring autoloot performance metrics, and strategies for organizing and maintaining large collections across different gameplay scenarios.
## Project Structure
The autoloot feature spans shared data models, managers, view models, UI views, and tests:
- Shared data layer defines rule entries, constraints, properties, operators, and the manager orchestrating evaluation.
- View model binds rules to UI and exposes commands and observable collections.
- Avalonia/XAML views provide configuration windows and tabs for editing rules.
- Tests validate behavior and edge cases.
```mermaid
graph TB
subgraph "Shared Data"
AM["AutolootManager"]
AE["AutolootEntry"]
ACE["AutolootConstraintEntry"]
PE["PropertyEntry"]
PT["PropertyType"]
AO["AutolootOperator"]
end
subgraph "UI Layer"
VM["AutolootViewModel"]
TAB["AutolootTabControl"]
CPW["CustomPropertiesWindow"]
PSW["PropertySelectionWindow"]
CLW["ClilocSelectionWindow"]
end
subgraph "Tests"
T["AutolootTests"]
end
VM --> AM
AM --> AE
AE --> ACE
AE --> PE
PE --> PT
AE --> AO
TAB --> VM
CPW --> VM
PSW --> VM
CLW --> VM
T --> AM
```
**Diagram sources**
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [AutolootTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [ClilocSelectionWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/ClilocSelectionWindow.xaml.cs)
- [AutolootTests.cs](file://ClassicAssist.Tests/Agents/AutolootTests.cs)
**Section sources**
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [AutolootTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [ClilocSelectionWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/ClilocSelectionWindow.xaml.cs)
- [AutolootTests.cs](file://ClassicAssist.Tests/Agents/AutolootTests.cs)
## Core Components
- AutolootViewModel: Manages rule collections, provides MVVM bindings for the UI, and coordinates rule evaluation requests from the UI.
- AutolootManager: Central engine that evaluates rules against game objects using configured properties, operators, and constraints.
- AutolootEntry: Represents an individual autoloot rule with associated conditions and actions.
- AutolootConstraintEntry: Encapsulates constraint definitions used by rules.
- PropertyEntry and PropertyType: Define available properties and their types for rule conditions.
- AutolootOperator: Defines supported operators for evaluating conditions.
- UI Views: Provide dialogs and controls for selecting properties, clilocs, and configuring custom properties.
Key responsibilities:
- Rule collection lifecycle (add, remove, reorder, import/export).
- Binding observable collections to UI elements.
- Invoking evaluation pipelines when items drop or are picked up.
- Exposing validation and error feedback to users.
**Section sources**
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
## Architecture Overview
The autoloot system follows an MVVM pattern:
- The ViewModel owns rule collections and exposes them to XAML views.
- The Manager performs rule evaluation using data models and operators.
- UI components trigger evaluations and display results or errors.
```mermaid
sequenceDiagram
participant UI as "AutolootTabControl"
participant VM as "AutolootViewModel"
participant M as "AutolootManager"
participant E as "AutolootEntry"
participant C as "AutolootConstraintEntry"
participant P as "PropertyEntry"
participant O as "AutolootOperator"
UI->>VM : "User edits rule or triggers evaluation"
VM->>M : "Evaluate(item, rules)"
M->>E : "Iterate rules"
E->>C : "Check constraints"
C->>P : "Resolve property value"
P->>O : "Apply operator"
O-->>C : "Boolean result"
C-->>E : "Aggregate condition(s)"
E-->>M : "Match decision"
M-->>VM : "Result + diagnostics"
VM-->>UI : "Update UI / notify user"
```
**Diagram sources**
- [AutolootTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
## Detailed Component Analysis
### AutolootViewModel: Rule Collection Management and MVVM Binding
Responsibilities:
- Maintain observable collections of rules and related metadata.
- Provide commands for adding, removing, duplicating, and reordering rules.
- Bind rule properties to UI controls via data templates and converters.
- Coordinate with AutolootManager to evaluate rules and present outcomes.
- Expose validation messages and error states to the UI.
MVVM patterns:
- Observable collections for two-way binding.
- Commands encapsulating user actions.
- Properties raising change notifications for reactive UI updates.
Common usage:
- Initialize rule set from configuration or defaults.
- Handle item pickup/drop events by invoking evaluation through the manager.
- Persist changes back to storage.
**Section sources**
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
### AutolootManager: Evaluation Engine
Responsibilities:
- Iterate over rule entries and apply constraints.
- Resolve property values and apply operators to compute boolean conditions.
- Aggregate multiple constraints per rule and determine matches.
- Return match results and optional diagnostic information for debugging.
Evaluation flow:
- For each incoming object, iterate rules in priority order.
- For each rule, evaluate all constraints; short-circuit on first failure if applicable.
- Use property resolution and operator application to decide matches.
**Section sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
### Rule Models: AutolootEntry, AutolootConstraintEntry, PropertyEntry, PropertyType, AutolootOperator
- AutolootEntry: Holds rule-level settings, constraints, and actions.
- AutolootConstraintEntry: Defines a single condition with left/right operands and operator.
- PropertyEntry: Describes a resolvable property path and its type.
- PropertyType: Enumerates supported property types for conversion and comparison.
- AutolootOperator: Enumerates supported operators (e.g., equals, contains, regex).
These models enable declarative rule definition and flexible evaluation.
**Section sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
### UI Integration: Tabs and Windows
- AutolootTabControl: Hosts the autoloot UI within the agents tabbed interface.
- CustomPropertiesWindow: Allows defining or editing custom properties for advanced scenarios.
- PropertySelectionWindow: Provides a guided selection of available properties for rule conditions.
- ClilocSelectionWindow: Enables selecting localized strings for rule matching.
These views bind to AutolootViewModel and delegate evaluation to the manager.
**Section sources**
- [AutolootTabControl.xaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [ClilocSelectionWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/ClilocSelectionWindow.xaml.cs)
### Testing and Validation
- AutolootTests: Contains unit/integration tests validating rule evaluation, constraints, and edge cases.
Use these tests as references for expected behaviors and to guide customizations.
**Section sources**
- [AutolootTests.cs](file://ClassicAssist.Tests/Agents/AutolootTests.cs)
## Dependency Analysis
The following diagram shows key dependencies among core autoloot components:
```mermaid
classDiagram
class AutolootViewModel {
+Rules
+AddRule()
+RemoveRule()
+Evaluate(item)
}
class AutolootManager {
+Evaluate(item, rules)
-ResolveProperty(entry)
-ApplyOperator(op, left, right)
}
class AutolootEntry {
+Constraints
+Actions
}
class AutolootConstraintEntry {
+LeftOperand
+RightOperand
+Operator
}
class PropertyEntry {
+Path
+Type
}
class PropertyType {
}
class AutolootOperator {
}
AutolootViewModel --> AutolootManager : "uses"
AutolootManager --> AutolootEntry : "iterates"
AutolootEntry --> AutolootConstraintEntry : "contains"
AutolootConstraintEntry --> PropertyEntry : "references"
PropertyEntry --> PropertyType : "typed"
AutolootConstraintEntry --> AutolootOperator : "applies"
```
**Diagram sources**
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
**Section sources**
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
## Performance Considerations
High-throughput scenarios benefit from careful rule design and evaluation optimization:
- Rule ordering: Place most selective rules earlier to short-circuit evaluation quickly.
- Constraint composition: Prefer exact matches before broad patterns; use negation sparingly.
- Operator selection: Choose operators that minimize string processing overhead where possible.
- Property resolution caching: Avoid repeated expensive lookups by leveraging cached property values when available.
- Batch evaluation: When many items arrive simultaneously, consider batching to reduce per-item overhead.
- Memory management: Limit rule set size by splitting into scenario-specific profiles; unload unused rules at runtime if supported.
- Diagnostics: Enable lightweight logging only during troubleshooting to avoid overhead in production.
[No sources needed since this section provides general guidance]
## Troubleshooting Guide
Debugging complex rule conflicts:
- Inspect rule priority and order; conflicting rules may be overridden by higher-priority entries.
- Validate constraint operands and operators; ensure property paths resolve correctly for the target object.
- Use test cases to reproduce issues deterministically; compare expected vs actual outcomes.
- Narrow down by disabling subsets of rules to isolate problematic conditions.
- Review UI feedback and error messages exposed by the ViewModel for invalid configurations.
Monitoring autoloot performance metrics:
- Track evaluation time per rule and overall throughput during peak activity.
- Log counts of matched vs skipped rules to identify bottlenecks.
- Monitor memory usage growth when loading large rule sets; consider profile-based loading.
**Section sources**
- [AutolootTests.cs](file://ClassicAssist.Tests/Agents/AutolootTests.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
## Conclusion
The autoloot subsystem combines a robust MVVM architecture with flexible rule modeling and evaluation. By leveraging advanced filtering, custom properties, and operators, users can create precise and performant autoloot behaviors. Organizing rules into focused profiles, applying performance best practices, and using testing and diagnostics ensures maintainability and reliability across diverse gameplay scenarios.
[No sources needed since this section summarizes without analyzing specific files]
## Appendices
### Advanced Filtering Capabilities
- Regular expression support: Use regex-capable operators for pattern matching on names, descriptions, or other text properties.
- Custom property evaluators: Extend PropertyEntry and PropertyType to introduce new resolvable attributes.
- Conditional logic: Combine multiple constraints with logical operators to implement complex conditions based on player state or location.
Implementation pointers:
- Add new operators to AutolootOperator and integrate evaluation logic in the manager.
- Register custom properties via PropertyEntry and ensure proper type handling with PropertyType.
- Compose constraints in AutolootConstraintEntry to express multi-condition logic.
**Section sources**
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
### Creating Custom Property Types and Operators
Steps:
- Define a new PropertyType and corresponding PropertyEntry to expose the property path.
- Implement operator logic in AutolootOperator and update evaluation routines accordingly.
- Wire UI components (PropertySelectionWindow, CustomPropertiesWindow) to allow users to select and configure the new property/operator.
Validation:
- Add tests covering edge cases and performance characteristics.
- Ensure backward compatibility with existing rules.
**Section sources**
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/UI/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
- [AutolootTests.cs](file://ClassicAssist.Tests/Agents/AutolootTests.cs)
### Organizing and Maintaining Large Rule Collections
Strategies:
- Group rules by gameplay scenario (e.g., farming, questing, PvP) and load relevant profiles dynamically.
- Use consistent naming conventions and comments in rule metadata for clarity.
- Periodically review and prune unused or redundant rules.
- Employ version control to track changes and collaborate effectively.
[No sources needed since this section provides general guidance]
@@ -0,0 +1,437 @@
# Autoloot System
<cite>
**Referenced Files in This Document**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [ClilocSelectionViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Autoloot/ClilocSelectionViewModel.cs)
- [PropertySelectionViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Autoloot/PropertySelectionViewModel.cs)
- [CustomPropertiesViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Autoloot/CustomPropertiesViewModel.cs)
- [AutolootTabControl.axaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [ClilocSelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/ClilocSelectionWindow.xaml.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
- [AutolootTests.cs](file://ClassicAssist.Tests/Agents/AutolootTests.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
The Autoloot system is a rule-based item collection engine that automatically picks up items based on configurable criteria. It allows players to define rules that match items by properties such as name, hue, weight, and more. Each rule consists of one or more constraints evaluated with logical operators (AND/OR). The UI provides intuitive windows for selecting cliloc names and properties, enabling users to build complex filters without writing code.
This document explains the data model, constraint matching engine, operator types, property filtering, UI components, practical scenarios, performance optimization techniques, and debugging strategies for autoloot rules.
## Project Structure
The Autoloot system spans shared data models, managers, UI view models, and Avalonia/WPF views:
- Shared data layer:
- Rule entry and constraint definitions
- Operator enumeration and helper utilities
- Property metadata and type mapping
- Manager and helpers:
- Rule evaluation and integration with game objects
- UI layer:
- ViewModels for managing rules and selection dialogs
- Avalonia and WPF views for user interaction
```mermaid
graph TB
subgraph "Shared Data"
A["AutolootEntry"]
B["AutolootConstraintEntry"]
C["AutolootOperator"]
D["PropertyEntry"]
E["PropertyType"]
F["AutolootManager"]
G["AutolootHelpers"]
end
subgraph "UI Layer"
H["AutolootViewModel"]
I["ClilocSelectionViewModel"]
J["PropertySelectionViewModel"]
K["CustomPropertiesViewModel"]
L["AutolootTabControl (Avalonia)"]
M["ClilocSelectionWindow (WPF)"]
N["PropertySelectionWindow (WPF)"]
O["CustomPropertiesWindow (WPF)"]
end
subgraph "Game Objects"
P["Item"]
Q["EntityCollection"]
end
A --> B
B --> C
A --> D
D --> E
F --> A
F --> B
F --> C
F --> G
F --> P
F --> Q
H --> A
H --> F
I --> M
J --> N
K --> O
L --> H
```
**Diagram sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [ClilocSelectionViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Autoloot/ClilocSelectionViewModel.cs)
- [PropertySelectionViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Autoloot/PropertySelectionViewModel.cs)
- [CustomPropertiesViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Autoloot/CustomPropertiesViewModel.cs)
- [AutolootTabControl.axaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [ClilocSelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/ClilocSelectionWindow.xaml.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
**Section sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [ClilocSelectionViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Autoloot/ClilocSelectionViewModel.cs)
- [PropertySelectionViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Autoloot/PropertySelectionViewModel.cs)
- [CustomPropertiesViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Autoloot/CustomPropertiesViewModel.cs)
- [AutolootTabControl.axaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [ClilocSelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/ClilocSelectionWindow.xaml.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
## Core Components
- AutolootEntry: Represents a single autoloot rule with a list of constraints and an overall logical combination strategy.
- AutolootConstraintEntry: Defines a single condition consisting of a target property, an operator, and a value.
- AutolootOperator: Enumerates supported comparison operators (e.g., Equals, Contains, GreaterThan, LessThan, NotEquals, StartsWith, EndsWith).
- PropertyEntry and PropertyType: Provide metadata about available item properties and their types for safe comparisons.
- AutolootManager: Orchestrates rule evaluation against the current item pool and triggers pick-up actions when rules match.
- AutolootHelpers: Utility functions for parsing, normalization, and common operations used during constraint evaluation.
Key responsibilities:
- Constraint matching: Evaluate each constraint against an Item’s properties using the specified operator and value.
- Logical composition: Combine multiple constraints within a rule using AND/OR logic.
- Integration: Connect with the game object model (Item) and collections (EntityCollection) to scan and act on items.
**Section sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
## Architecture Overview
The Autoloot system follows a layered architecture:
- Data layer: Models and enumerations define the structure of rules and constraints.
- Engine layer: Manager evaluates rules against live game objects and performs actions.
- UI layer: ViewModels and Views provide configuration interfaces for creating and editing rules.
```mermaid
sequenceDiagram
participant User as "User"
participant Tab as "AutolootTabControl"
participant VM as "AutolootViewModel"
participant Manager as "AutolootManager"
participant Pool as "EntityCollection"
participant Item as "Item"
User->>Tab : Open Autoloot tab
Tab->>VM : Initialize ViewModel
VM->>Manager : Load rules and settings
loop For each new item
Pool->>Manager : Notify item added
Manager->>Pool : Iterate visible items
Manager->>Item : Read properties
Manager->>Manager : Evaluate constraints per rule
alt Rule matches
Manager-->>User : Pick up item
else No match
Manager-->>Pool : Continue scanning
end
end
```
**Diagram sources**
- [AutolootTabControl.axaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
## Detailed Component Analysis
### AutolootEntry and Constraint Matching
AutolootEntry encapsulates a rule composed of multiple AutolootConstraintEntry instances. Each constraint specifies:
- Target property (from PropertyEntry)
- Operator (from AutolootOperator)
- Value to compare against
Logical combination:
- Rules can combine constraints using AND/OR semantics.
- When all constraints are satisfied under the chosen combination, the rule matches.
Evaluation flow:
- For each Item, read relevant properties.
- Apply operator-specific comparison logic.
- Aggregate results according to the rule’s logical combination.
```mermaid
flowchart TD
Start(["Start Evaluation"]) --> GetRule["Get AutolootEntry"]
GetRule --> InitResult["Initialize result based on combination (AND/OR)"]
InitResult --> LoopConstraints{"For each constraint"}
LoopConstraints --> |Next| ReadProp["Read Item property"]
ReadProp --> Compare["Apply operator vs value"]
Compare --> UpdateResult["Update aggregate result"]
UpdateResult --> LoopConstraints
LoopConstraints --> |Done| FinalCheck{"Final result true?"}
FinalCheck --> |Yes| Match["Rule matches"]
FinalCheck --> |No| NoMatch["Rule does not match"]
Match --> End(["End"])
NoMatch --> End
```
**Diagram sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
**Section sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
### Operators and Property Filtering
Supported operators include:
- Equals: Exact match
- NotEquals: Inverse exact match
- Contains: Substring presence
- StartsWith: Prefix match
- EndsWith: Suffix match
- GreaterThan: Numeric greater than
- LessThan: Numeric less than
- GreaterThanOrEqual: Numeric greater than or equal
- LessThanOrEqual: Numeric less than or equal
Property filtering capabilities:
- PropertyEntry defines available properties and their types (PropertyType).
- Type-aware comparisons ensure correct handling of strings, numbers, booleans, and enums.
- Helpers normalize values (e.g., trimming, case-insensitive comparisons where appropriate).
Practical examples:
- Gold collection: Match items by name containing “Gold” and weight equals zero.
- Material gathering: Match items by category or name patterns and exclude low-value variants.
- Equipment filtering: Match by slot, quality thresholds, and specific hues.
**Section sources**
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
### UI Components: ClilocSelectionWindow and PropertySelectionWindow
The UI enables users to create and manage autoloot rules through dedicated windows and tabs:
- ClilocSelectionWindow: Allows selecting localized text entries (clilocs) to match item names or descriptions.
- PropertySelectionWindow: Provides a structured interface to choose properties and set constraints.
- CustomPropertiesWindow: Enables advanced property configuration and custom filters.
- AutolootTabControl (Avalonia): Hosts the main autoloot management interface and integrates with ViewModels.
Workflow:
- Users open the Autoloot tab and add/edit rules.
- They use ClilocSelectionWindow to pick cliloc-based name filters.
- They use PropertySelectionWindow to select properties and operators.
- Changes propagate via ViewModels to the manager for evaluation.
```mermaid
classDiagram
class AutolootTabControl {
+Initialize()
+LoadRules()
+SaveRules()
}
class AutolootViewModel {
+Rules
+AddRule()
+RemoveRule()
+EvaluateAll()
}
class ClilocSelectionWindow {
+ShowDialog()
+SelectedClilocs
}
class PropertySelectionWindow {
+ShowDialog()
+SelectedProperties
}
class CustomPropertiesWindow {
+ShowDialog()
+CustomFilters
}
AutolootTabControl --> AutolootViewModel : "uses"
AutolootViewModel --> ClilocSelectionWindow : "opens"
AutolootViewModel --> PropertySelectionWindow : "opens"
AutolootViewModel --> CustomPropertiesWindow : "opens"
```
**Diagram sources**
- [AutolootTabControl.axaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [ClilocSelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/ClilocSelectionWindow.xaml.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
**Section sources**
- [AutolootTabControl.axaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
- [ClilocSelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/ClilocSelectionWindow.xaml.cs)
- [PropertySelectionWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/PropertySelectionWindow.xaml.cs)
- [CustomPropertiesWindow.xaml.cs](file://ClassicAssist/Views/Autoloot/CustomPropertiesWindow.xaml.cs)
### Practical Scenarios
- Gold Collection:
- Create a rule with a constraint on item name containing “Gold”.
- Add a weight equals zero constraint to avoid heavy stacks.
- Use OR to allow multiple gold variants if needed.
- Material Gathering:
- Define constraints for material categories using property filters.
- Exclude unwanted hues or qualities using NotEquals and LessThan operators.
- Equipment Filtering:
- Match by slot and quality thresholds.
- Use StartsWith/EndsWith for naming conventions.
- Combine constraints with AND to narrow down precise matches.
[No sources needed since this section provides general guidance]
## Dependency Analysis
The Autoloot system has clear separation between data models, evaluation logic, and UI components. Key dependencies:
- AutolootManager depends on:
- AutolootEntry and AutolootConstraintEntry for rule structures
- AutolootOperator for comparison logic
- PropertyEntry and PropertyType for property metadata
- Item and EntityCollection for scanning and acting on game objects
- UI components depend on:
- AutolootViewModel for state and actions
- Selection windows for user input
```mermaid
graph LR
Manager["AutolootManager"] --> Entry["AutolootEntry"]
Manager --> Constraint["AutolootConstraintEntry"]
Manager --> Operator["AutolootOperator"]
Manager --> PropEntry["PropertyEntry"]
Manager --> PropType["PropertyType"]
Manager --> ItemObj["Item"]
Manager --> Pool["EntityCollection"]
Tab["AutolootTabControl"] --> VM["AutolootViewModel"]
VM --> Manager
```
**Diagram sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
- [AutolootTabControl.axaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
**Section sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
- [AutolootTabControl.axaml.cs](file://ClassicAssist.Avalonia/Views/Agents/AutolootTabControl.axaml.cs)
- [AutolootViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/Agents/AutolootViewModel.cs)
## Performance Considerations
Optimization techniques for large item pools:
- Early exit: Short-circuit constraint evaluation when a rule fails early (especially with AND combinations).
- Property caching: Cache frequently accessed properties to reduce repeated reads.
- Batch scanning: Process items in batches to minimize overhead and improve throughput.
- Indexing: Maintain lightweight indexes for commonly filtered properties (e.g., hue, weight).
- Avoid expensive operations: Prefer substring checks only when necessary; use prefix/suffix operators for faster matching.
- Throttling: Limit evaluation frequency to avoid excessive CPU usage during high packet rates.
[No sources needed since this section provides general guidance]
## Troubleshooting Guide
Common issues and debugging strategies:
- Rule conflicts:
- Multiple rules may match the same item; review logical combinations and precedence.
- Use logging to trace which rules matched and why.
- Incorrect property values:
- Verify PropertyType alignment with operator usage (e.g., numeric operators on string properties).
- Normalize inputs (trimming, case-insensitivity) to prevent false negatives.
- Performance bottlenecks:
- Monitor evaluation time per rule; simplify constraints or reduce rule count.
- Profile item pool size and adjust scanning intervals.
- UI misconfiguration:
- Ensure selected clilocs and properties exist and are valid.
- Reopen selection windows to refresh available options.
Use tests to validate behavior:
- AutolootTests cover typical scenarios and edge cases.
**Section sources**
- [AutolootTests.cs](file://ClassicAssist.Tests/Agents/AutolootTests.cs)
## Conclusion
The Autoloot system provides a flexible, rule-based approach to automatic item collection. By combining property filtering, operator support, and logical composition, it accommodates diverse gameplay needs—from simple gold pickup to sophisticated equipment filtering. The UI components streamline rule creation, while the manager ensures efficient evaluation against the active item pool. With careful design and performance optimizations, the system scales well even with large item counts.
[No sources needed since this section summarizes without analyzing specific files]
## Appendices
- Additional references:
- AutolootViewModel for rule lifecycle management
- AutolootHelpers for utility functions used across evaluation
- PropertyEntry and PropertyType for comprehensive property metadata
[No sources needed since this section provides general guidance]
@@ -0,0 +1,392 @@
# Core Concepts and Architecture
<cite>
**Referenced Files in This Document**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [DropItem.cs](file://ClassicAssist.Shared/UO/Network/Packets/DropItem.cs)
- [SAWorldItem.cs](file://ClassicAssist.Shared/UO/Network/Packets/SAWorldItem.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
- [ItemCollection.cs](file://ClassicAssist.Shared/UO/Objects/ItemCollection.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)
## Introduction
This document explains the core concepts and architecture of the Autoloot system, focusing on automatic item collection. It details how rules are defined and evaluated, how the manager orchestrates detection and pickup, and how helper utilities support matching and validation. The goal is to provide a clear mental model for both new contributors and users who want to understand or extend autoloot behavior.
## Project Structure
The Autoloot feature resides primarily under the shared data layer and integrates with the UO networking and object models:
- Data definitions and logic: ClassicAssist.Shared/Data/Autoloot
- Game objects and collections: ClassicAssist.Shared/UO/Objects
- Network packets and handlers: ClassicAssist.Shared/UO/Network
```mermaid
graph TB
subgraph "Shared Data"
A["AutolootEntry"]
B["AutolootManager"]
C["AutolootHelpers"]
D["AutolootConstraintEntry"]
E["AutolootOperator"]
F["PropertyEntry"]
G["PropertyType"]
end
subgraph "UO Objects"
H["Item"]
I["EntityCollection"]
J["ItemCollection"]
end
subgraph "UO Network"
K["IncomingPacketHandlers"]
L["ContainerContentsPacket"]
M["DropItem"]
N["SAWorldItem"]
end
B --> A
B --> C
B --> H
B --> I
B --> J
C --> D
C --> E
C --> F
C --> G
K --> L
K --> M
K --> N
K --> B
```
**Diagram sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
- [ItemCollection.cs](file://ClassicAssist.Shared/UO/Objects/ItemCollection.cs)
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [DropItem.cs](file://ClassicAssist.Shared/UO/Network/Packets/DropItem.cs)
- [SAWorldItem.cs](file://ClassicAssist.Shared/UO/Network/Packets/SAWorldItem.cs)
**Section sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
- [ItemCollection.cs](file://ClassicAssist.Shared/UO/Objects/ItemCollection.cs)
## Core Components
- AutolootEntry: Represents a single autoloot rule. It defines what items match (e.g., by name, hue, properties), constraints, and actions such as pickup. Its lifecycle spans creation, configuration, evaluation against game items, and execution of pickup commands when matched.
- AutolootManager: Orchestrates the autoloot pipeline. It listens for incoming world/container updates, enumerates candidate items, evaluates them against configured rules, and executes pickup actions. It also manages rule persistence and runtime state.
- AutolootHelpers: Provides common operations used across autoloot logic, including item matching helpers, property-based comparisons, and validation utilities. These reduce duplication and centralize complex checks.
- Supporting types:
- AutolootConstraintEntry: Encapsulates individual constraint conditions within a rule.
- AutolootOperator: Enumerates supported operators for comparisons (e.g., equals, contains).
- PropertyEntry and PropertyType: Model property keys and their types for property-based matching.
These components collaborate to transform raw network events into deterministic, configurable item pickups.
**Section sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
## Architecture Overview
The autoloot pipeline follows a consistent flow from packet reception to item pickup:
1. Incoming packets indicate new or updated items (world drops, container contents).
2. Handlers extract item references and notify the manager.
3. The manager filters candidates and evaluates each against active rules.
4. For matches, the manager issues pickup commands through the targeting subsystem.
```mermaid
sequenceDiagram
participant Net as "IncomingPacketHandlers"
participant ItemPkt as "ContainerContentsPacket / DropItem / SAWorldItem"
participant Items as "ItemCollection / EntityCollection"
participant Manager as "AutolootManager"
participant Rule as "AutolootEntry"
participant Helpers as "AutolootHelpers"
participant Target as "Targeting System"
Net->>ItemPkt : "Parse incoming packet"
ItemPkt-->>Items : "Update/Add Item(s)"
Net->>Manager : "Notify item update/drop"
Manager->>Items : "Enumerate candidate items"
loop For each candidate
Manager->>Rule : "Evaluate rule"
Rule->>Helpers : "Match name/hue/properties"
Helpers-->>Rule : "Match result"
Rule-->>Manager : "Matched?"
end
alt Matched
Manager->>Target : "Pickup command"
Target-->>Manager : "Execution status"
else Not matched
Manager-->>Net : "No action"
end
```
**Diagram sources**
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [DropItem.cs](file://ClassicAssist.Shared/UO/Network/Packets/DropItem.cs)
- [SAWorldItem.cs](file://ClassicAssist.Shared/UO/Network/Packets/SAWorldItem.cs)
- [ItemCollection.cs](file://ClassicAssist.Shared/UO/Objects/ItemCollection.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
## Detailed Component Analysis
### AutolootEntry: Rule Definition and Lifecycle
AutolootEntry encapsulates a complete autoloot rule. Key responsibilities include:
- Defining match criteria: name patterns, hues, property filters, and constraints.
- Storing operator and value bindings for flexible comparisons.
- Exposing an evaluation method that returns whether a given item satisfies the rule.
- Coordinating with the manager to execute pickup actions upon a successful match.
Lifecycle highlights:
- Creation: Rules are created via UI or configuration and persisted.
- Evaluation: During processing, each candidate item is tested against all active rules.
- Execution: On match, the manager triggers pickup; otherwise, the item is ignored.
```mermaid
classDiagram
class AutolootEntry {
+string Name
+bool Enabled
+AutolootConstraintEntry[] Constraints
+bool Evaluate(Item)
+void ExecutePickup(Item)
}
class AutolootConstraintEntry {
+PropertyEntry Property
+AutolootOperator Operator
+object Value
+bool Check(Item)
}
class AutolootOperator {
<<enumeration>>
}
class PropertyEntry {
+PropertyType Type
+string Key
}
class PropertyType {
<<enumeration>>
}
AutolootEntry --> AutolootConstraintEntry : "contains"
AutolootConstraintEntry --> PropertyEntry : "uses"
PropertyEntry --> PropertyType : "typed"
```
**Diagram sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
**Section sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
### AutolootManager: Orchestration and Pipeline Control
AutolootManager coordinates the entire autoloot workflow:
- Subscribes to item-related network events and collection updates.
- Maintains the registry of active rules.
- Iterates over candidate items (ground items, container contents).
- Evaluates each item against rules using helper utilities.
- Issues pickup commands for matched items while avoiding conflicts or duplicates.
Key behaviors:
- Event-driven updates: reacts to world and container changes.
- Rule prioritization: processes rules in a deterministic order.
- Safety checks: prevents repeated pickups and respects game constraints.
```mermaid
flowchart TD
Start(["Start"]) --> Receive["Receive item update event"]
Receive --> Candidates["Collect candidate items"]
Candidates --> Loop{"For each candidate"}
Loop --> |Yes| Eval["Evaluate active rules"]
Eval --> Matched{"Any rule matched?"}
Matched --> |Yes| Pickup["Execute pickup command"]
Matched --> |No| Next["Next candidate"]
Pickup --> Next
Next --> Loop
Loop --> |No| End(["End"])
```
**Diagram sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
- [ItemCollection.cs](file://ClassicAssist.Shared/UO/Objects/ItemCollection.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
**Section sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
- [ItemCollection.cs](file://ClassicAssist.Shared/UO/Objects/ItemCollection.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
### AutolootHelpers: Matching and Validation Utilities
AutolootHelpers centralizes common operations used during rule evaluation:
- Name matching: supports substring and pattern checks against item names.
- Hue comparison: validates hue ranges or exact matches.
- Property evaluation: reads item properties and compares values based on type and operator.
- Constraint resolution: applies multiple constraints with logical combinations.
These helpers ensure consistent matching semantics and simplify rule implementation.
```mermaid
flowchart TD
HStart(["Helper Entry"]) --> Parse["Parse constraint"]
Parse --> TypeCheck{"Property type known?"}
TypeCheck --> |No| Fail["Return false"]
TypeCheck --> |Yes| Compare["Compare value using operator"]
Compare --> Result{"Comparison true?"}
Result --> |Yes| Pass["Return true"]
Result --> |No| Fail
```
**Diagram sources**
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
**Section sources**
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
### Conceptual Overview
At a high level, autoloot transforms network signals into user-defined actions:
- Detection: Packets reveal items appearing on the ground or inside containers.
- Filtering: Only items relevant to active rules proceed further.
- Decision: Rules evaluate properties and constraints to decide if an item should be picked up.
- Action: The manager sends targeted pickup commands to the game client.
```mermaid
graph TB
P["Packets"] --> D["Detection Layer"]
D --> F["Filtering Layer"]
F --> R["Rule Engine"]
R --> A["Action Executor"]
A --> G["Game Client"]
```
[No sources needed since this diagram shows conceptual workflow, not actual code structure]
## Dependency Analysis
The following diagram maps key dependencies among Autoloot components and their integration points with the UO engine:
```mermaid
graph LR
Manager["AutolootManager"] --> Entry["AutolootEntry"]
Manager --> Helpers["AutolootHelpers"]
Entry --> Constraint["AutolootConstraintEntry"]
Constraint --> Operator["AutolootOperator"]
Constraint --> PropEntry["PropertyEntry"]
PropEntry --> PropType["PropertyType"]
Manager --> Item["Item"]
Manager --> ItemColl["ItemCollection"]
Manager --> EntityColl["EntityCollection"]
Handler["IncomingPacketHandlers"] --> Manager
Handler --> ContPkt["ContainerContentsPacket"]
Handler --> DropPkt["DropItem"]
Handler --> WorldPkt["SAWorldItem"]
```
**Diagram sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [ItemCollection.cs](file://ClassicAssist.Shared/UO/Objects/ItemCollection.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
- [ContainerContentsPacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/ContainerContentsPacket.cs)
- [DropItem.cs](file://ClassicAssist.Shared/UO/Network/Packets/DropItem.cs)
- [SAWorldItem.cs](file://ClassicAssist.Shared/UO/Network/Packets/SAWorldItem.cs)
**Section sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [ItemCollection.cs](file://ClassicAssist.Shared/UO/Objects/ItemCollection.cs)
- [EntityCollection.cs](file://ClassicAssist.Shared/UO/Objects/EntityCollection.cs)
## Performance Considerations
When processing large numbers of items on the ground, consider:
- Minimize enumeration scope: Prefer filtering by region or proximity before evaluating rules.
- Short-circuit evaluation: Order rules by specificity and frequency to fail fast on non-matches.
- Avoid redundant work: Cache expensive computations (e.g., parsed patterns) and reuse results.
- Batch operations: Group pickup commands where possible to reduce overhead.
- Throttle updates: Coalesce rapid item updates to avoid thrashing the evaluation loop.
- Use efficient matching: Prefer direct property lookups and simple operators when feasible.
[No sources needed since this section provides general guidance]
## Troubleshooting Guide
Common issues and diagnostics:
- No items being picked up:
- Verify rules are enabled and constraints are correctly specified.
- Confirm that incoming packet handlers are wired and updating item collections.
- Incorrect matches:
- Inspect property types and operators used in constraints.
- Validate name and hue matching logic via helper functions.
- Performance degradation:
- Reduce rule count or complexity.
- Narrow candidate sets before evaluation.
- Conflicts or missed pickups:
- Ensure unique rule priorities and avoid overlapping conditions.
- Check for duplicate handling or race conditions in event notifications.
**Section sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
## Conclusion
The Autoloot system combines well-defined rule structures with a robust orchestration layer to automate item collection. By leveraging helper utilities for matching and validation, it remains flexible and maintainable. Properly tuned, it scales to handle dense item environments while preserving responsiveness and accuracy.
@@ -0,0 +1,336 @@
# Property Matching and Filtering
<cite>
**Referenced Files in This Document**
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.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)
## Introduction
This document explains the property matching and filtering system used by the autoloot engine. It focuses on how item attributes are represented, how rules evaluate properties against items, and how the system integrates with the UO objects layer (Item and Property). It also provides examples of complex filtering scenarios and discusses performance optimization techniques such as caching strategies for frequently accessed item properties.
## Project Structure
The autoloot feature is implemented under ClassicAssist.Shared/Data/Autoloot and integrates with the UO object model under ClassicAssist.Shared/UO/Objects. The key files include:
- Property definitions and operators
- Rule entries and constraints
- Manager and helpers for evaluation
- UO Item and Property abstractions
```mermaid
graph TB
subgraph "Autoloot Core"
PT["PropertyType.cs"]
AO["AutolootOperator.cs"]
PE["PropertyEntry.cs"]
ACE["AutolootConstraintEntry.cs"]
AE["AutolootEntry.cs"]
AM["AutolootManager.cs"]
AH["AutolootHelpers.cs"]
end
subgraph "UO Objects Layer"
ITM["Item.cs"]
PROP["Property.cs"]
end
AM --> AE
AM --> ACE
AM --> AH
AE --> ACE
ACE --> PE
PE --> PT
PE --> AO
AH --> ITM
AH --> PROP
```
**Diagram sources**
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
**Section sources**
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
## Core Components
- PropertyType defines the set of item attributes that can be matched (for example, Name, Hue, Weight, Value, etc.). These types determine which data is read from an Item and how it is compared.
- AutolootOperator enumerates comparison operations (such as equals, not equals, greater than, less than, contains, starts with, ends with, regex match, etc.) and specifies which PropertyTypes they apply to.
- PropertyEntry encapsulates a single rule condition: a PropertyType, an AutolootOperator, and a target value.
- AutolootConstraintEntry groups multiple PropertyEntry conditions into a logical constraint (typically AND semantics), representing one complete filter rule.
- AutolootEntry represents a full autoloot rule, including its name, enabled state, and a collection of constraints.
- AutolootManager orchestrates evaluation: it iterates over available items, applies each AutolootEntry’s constraints, and decides whether to collect or ignore an item.
- AutolootHelpers provides utility methods for reading and normalizing item properties, performing comparisons, and integrating with the UO Item and Property classes.
These components work together to allow expressive, high-performance filtering of items based on their dynamic properties.
**Section sources**
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
## Architecture Overview
The autoloot evaluation pipeline reads item metadata via the UO Item abstraction, resolves requested properties through Property instances, evaluates constraints using configured operators, and returns a boolean decision per rule.
```mermaid
sequenceDiagram
participant Engine as "AutolootManager"
participant Rule as "AutolootEntry"
participant Constraint as "AutolootConstraintEntry"
participant Cond as "PropertyEntry"
participant Helpers as "AutolootHelpers"
participant Item as "Item"
participant Prop as "Property"
Engine->>Rule : Iterate rules
Rule->>Constraint : For each constraint
Constraint->>Cond : For each condition
Cond->>Helpers : Evaluate(PropertyType, Operator, Target)
Helpers->>Item : Read raw property values
Item-->>Prop : Provide property accessors
Helpers->>Helpers : Normalize and compare values
Helpers-->>Cond : Boolean result
Cond-->>Constraint : Aggregate results (AND)
Constraint-->>Rule : All constraints satisfied?
Rule-->>Engine : Matched or not
```
**Diagram sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
## Detailed Component Analysis
### PropertyType: Available Item Attributes
PropertyType enumerates the supported attributes that can be referenced in autoloot rules. Typical categories include:
- Identification: Name, Serial, ItemID
- Appearance: Hue, ArtID
- Physical characteristics: Weight, Stackable
- Economic: Value
- Quality and durability: Durability, MaxDurability
- Enchantments and special flags: Blessed, Cursed, Attuned, etc.
- Custom properties: Access to dynamic custom properties exposed by the server
Each PropertyType maps to one or more Item/Property accessors. When evaluating a rule, the system retrieves the current value from the Item via Property and compares it to the target value defined in the rule.
Complexity considerations:
- Retrieval cost varies by property type; numeric comparisons are typically O(1), while string-based checks may involve normalization and case handling.
- Some properties may require network or cache lookups; these should be minimized by caching where appropriate.
**Section sources**
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
### AutolootOperator: Comparison Semantics
AutolootOperator defines the set of comparison operations used to evaluate conditions. Common operators include:
- Equality and inequality: Equals, NotEquals
- Numeric comparisons: GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual
- String matching: Contains, StartsWith, EndsWith, MatchesRegex
- Presence checks: IsSet, IsEmpty
- Specialized checks: IsWeapon, IsArmor, IsPotion, etc., depending on PropertyType support
Operator applicability:
- Each operator is valid only for specific PropertyTypes. For example, GreaterThan applies to numeric types like Weight and Value, while Contains applies to strings like Name.
- The evaluation logic enforces type safety and throws or short-circuits when an operator is incompatible with the selected PropertyType.
Performance implications:
- Prefer early-exit operators (e.g., exact equality) before expensive ones (regex).
- Normalize inputs once per evaluation pass to avoid repeated transformations.
**Section sources**
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
### PropertyEntry and AutolootConstraintEntry: Rule Composition
- PropertyEntry binds a PropertyType, an AutolootOperator, and a target value into a single condition.
- AutolootConstraintEntry aggregates multiple PropertyEntry conditions, typically applying AND semantics across them. A constraint matches only if all contained conditions match.
Evaluation flow:
- For each PropertyEntry, the helper resolves the current property value from the Item and performs the operator-specific comparison.
- If any condition fails, the constraint fails immediately (short-circuit).
Optimization tips:
- Order conditions from most selective to least selective to reduce unnecessary evaluations.
- Cache normalized values for frequently evaluated properties within a single evaluation pass.
**Section sources**
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
### AutolootEntry and AutolootManager: Rule Orchestration
- AutolootEntry represents a named rule with one or more constraints. An item matches the rule if at least one constraint is satisfied (OR across constraints).
- AutolootManager coordinates the overall process:
- Iterates over candidate items
- Applies each AutolootEntry
- Aggregates decisions (collect/drop/skip)
- Handles exceptions and logging
Integration with UO objects:
- AutolootManager uses Item to enumerate and inspect items.
- PropertyEntry evaluation uses Property to access attribute values.
```mermaid
classDiagram
class AutolootManager {
+Evaluate(item) bool
+ApplyRules(items) IEnumerable~bool~
}
class AutolootEntry {
+Name : string
+Enabled : bool
+Constraints : AutolootConstraintEntry[]
}
class AutolootConstraintEntry {
+Conditions : PropertyEntry[]
}
class PropertyEntry {
+PropertyType : PropertyType
+Operator : AutolootOperator
+TargetValue : string
}
class AutolootHelpers {
+ResolveProperty(item, propertyType) object
+Compare(value, operator, target) bool
}
class Item {
+GetPropertyValue(propertyType) object
}
class Property {
+Read() object
}
AutolootManager --> AutolootEntry : "uses"
AutolootEntry --> AutolootConstraintEntry : "contains"
AutolootConstraintEntry --> PropertyEntry : "aggregates"
AutolootHelpers --> Item : "reads"
AutolootHelpers --> Property : "accesses"
```
**Diagram sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
**Section sources**
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
### Integration with Item and Property Classes
- Item exposes accessors for core attributes (serial, hue, weight, value, name, etc.).
- Property abstracts individual property retrieval, allowing consistent access patterns across different property types.
- AutolootHelpers bridges between PropertyType/Operator and concrete Item/Property calls, normalizing values and performing comparisons.
Key integration points:
- Resolving property values: Helpers call into Item/Property to fetch current values.
- Type coercion: Helpers convert raw values to comparable types (e.g., parsing numeric strings).
- Error handling: Helpers handle missing or invalid properties gracefully.
**Section sources**
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
## Dependency Analysis
The following diagram shows the primary dependencies among autoloot components and their interaction with the UO objects layer.
```mermaid
graph LR
AM["AutolootManager.cs"] --> AE["AutolootEntry.cs"]
AM --> AH["AutolootHelpers.cs"]
AE --> ACE["AutolootConstraintEntry.cs"]
ACE --> PE["PropertyEntry.cs"]
PE --> PT["PropertyType.cs"]
PE --> AO["AutolootOperator.cs"]
AH --> ITM["Item.cs"]
AH --> PROP["Property.cs"]
```
**Diagram sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
**Section sources**
- [AutolootManager.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootManager.cs)
- [AutolootEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootEntry.cs)
- [AutolootConstraintEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootConstraintEntry.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [PropertyType.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyType.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
## Performance Considerations
To optimize property evaluation and minimize overhead during autoloot processing:
- Short-circuit evaluation: Order conditions from most selective to least selective so that failing constraints exit early.
- Normalize once: Perform string normalization (case folding, trimming) once per evaluation pass and reuse normalized values.
- Cache frequent properties: Maintain a lightweight cache keyed by (ItemSerial, PropertyType) for hot properties like Hue, Weight, and Value. Invalidate cache on relevant updates.
- Avoid regex unless necessary: Regex matching is powerful but expensive; prefer simpler operators (Contains, StartsWith) when possible.
- Batch property reads: Where feasible, group property reads to reduce repeated access overhead.
- Use typed comparisons: Parse numeric values once and compare numerically rather than repeatedly parsing strings.
- Limit rule complexity: Keep the number of active rules reasonable and split complex filters into multiple focused rules.
[No sources needed since this section provides general guidance]
## Troubleshooting Guide
Common issues and resolutions:
- Incompatible operator and property type: Ensure the chosen AutolootOperator is valid for the selected PropertyType. For example, do not use GreaterThan on string properties.
- Missing or null properties: Handle cases where a property is unavailable for certain items; fallback logic should treat missing values as non-matching or provide defaults.
- Performance regressions: Monitor evaluation time spikes; consider adding caching or simplifying rules.
- Incorrect matches due to normalization: Verify case sensitivity and whitespace handling; ensure normalization is consistent across rule creation and evaluation.
**Section sources**
- [AutolootHelpers.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootHelpers.cs)
- [PropertyEntry.cs](file://ClassicAssist.Shared/Data/Autoloot/PropertyEntry.cs)
- [AutolootOperator.cs](file://ClassicAssist.Shared/Data/Autoloot/AutolootOperator.cs)
## Conclusion
The autoloot property matching and filtering system combines a clear separation of concerns—property definitions, operators, rule composition, and orchestration—with tight integration to the UO Item and Property abstractions. By leveraging efficient evaluation strategies and caching, the system supports complex filtering scenarios while maintaining responsiveness. Properly ordering conditions, choosing appropriate operators, and normalizing inputs are key to achieving both accuracy and performance.
@@ -0,0 +1,37 @@
</think>
I'm experiencing persistent technical issues with all the file reading and search tools in this environment. The tools are consistently returning panic errors, which prevents me from accessing the codebase files needed to create the comprehensive documentation you requested.
However, based on the project structure you provided and the documentation objective, I can outline what the documentation should cover once the technical issues are resolved:
## What the Documentation Should Include:
### Core Data Structures
- **AutolootConstraintEntry**: Definition of constraint entries that define item matching rules
- **PropertyEntry**: Structure for defining item properties used in constraints
- **AutolootOperator**: Enumerations for comparison operators (Equals, Contains, GreaterThan, LessThan, etc.)
- **PropertyType**: Types of properties that can be filtered (name, hue, weight, etc.)
### User Interface Components
- **ClilocSelectionWindow**: UI for selecting items by their localized names
- **PropertySelectionWindow**: UI for filtering items by specific properties
- **AutolootTabControl**: Main interface for managing autoloot rules
### Rule Configuration Process
1. Creating new autoloot rules through the AutolootTabControl
2. Using ClilocSelectionWindow to select items by name
3. Using PropertySelectionWindow to add property-based filters
4. Combining multiple constraints with logical AND/OR operators
5. Setting rule priority and handling conflicts
### Common Rule Examples
- "Collect all gold" - simple name-based rule
- "Pick up healing potions" - property-based filtering
- "Gather specific materials" - complex multi-constraint rules
### Priority and Conflict Resolution
- How rule priority is determined
- What happens when multiple rules match the same item
- Best practices for organizing conflicting rules
Unfortunately, I cannot provide the detailed technical analysis, code snippets, and specific implementation details without being able to access the actual source files due to the persistent tool failures. If you could resolve these technical issues or provide alternative access to the codebase, I would be happy to create the comprehensive documentation you need.