This commit is contained in:
erik 2025-06-09 02:03:11 +02:00
parent 01151e679b
commit 57b2f0400e
265 changed files with 22828 additions and 6 deletions

View file

@ -0,0 +1,22 @@
{
"permissions": {
"allow": [
"Bash(mkdir:*)",
"Bash(grep:*)",
"Bash(rg:*)",
"Bash(sed:*)",
"Bash(find:*)",
"Bash(true)",
"Bash(rm:*)",
"Bash(cp:*)",
"Bash(chmod:*)",
"Bash(./cleanup.sh:*)",
"Bash(bash:*)",
"Bash(ls:*)",
"Bash(python3:*)",
"Bash(msbuild:*)",
"Bash(dotnet build:*)"
]
},
"enableAllProjectMcpServers": false
}

78
CLAUDE.md Normal file
View file

@ -0,0 +1,78 @@
- when we porting flagtracker there mus be no simplification or trunkation of the code
- you can use utility belt for references about how to check views and create them perhaps also for quests. Same with the folder Mag-Tools
# Icon Implementation Discoveries
## DECAL Icon System - CRITICAL DIFFERENCES
### Spell Icons vs Item Icons
**SPELL ICONS**: Use RAW icon values from DECAL FileService SpellTable
- Access via: `fileService.SpellTable.GetById(spellId)` then reflection to find icon property
- **NO OFFSET REQUIRED** - Use raw icon value directly
- Matches original Lua: `game.Character.SpellBook.Get(spellID).Icon` (no offset)
**ITEM ICONS**: Require MagTools-style offset
- Format: `itemIcon + 0x6000000`
- Used for inventory items, weapons, armor, etc.
### Working Implementation
```csharp
// For SPELL icons - NO offset
private int GetRealSpellIcon(int spellId)
{
var fileService = CoreManager.Current.Filter<Decal.Filters.FileService>();
var spell = fileService.SpellTable.GetById(spellId);
// Use reflection to find icon property
return iconValue; // RAW value, no offset
}
// For ITEM icons - WITH offset
int itemIconId = worldObject.Icon + 0x6000000;
```
### VVS Icon Display
- Use `DecalControls.IconColumn` in XML (NOT PictureColumn)
- IconColumn creates HudPictureBox controls automatically
- Set icon via: `((HudPictureBox)control).Image = iconId;`
### Successful Applications
**Flag Tracker Recalls Tab**: Real spell icons working perfectly
**MagTools Reference**: Item icons with 0x6000000 offset
**Original Lua Compatibility**: Exact replication of flagtracker behavior
### Implemented Icon Applications
**Flag Tracker Recalls Tab**: Real spell icons working perfectly
**Flag Tracker Cantrips Tab**: Multi-layered icon system implemented
- **Attributes**: Spell icons (Strength, Endurance, etc.) with background support
- **Protection Auras**: Spell icons (Armor, Flame Ward, etc.)
- **Skills**: Dynamic skill icons from character training data
### Cantrips Tab Icon System (Advanced Implementation)
Based on original Lua flagtracker's sophisticated 3-icon approach:
```csharp
// Attributes: Background + Spell Icon overlay
["Strength"] = new CantripInfo {
SpellIconId = 1354, // StrengthSelf8 spell icon
BackgroundIconId = 0x060013F9 // UI background icon
};
// Protection Auras: Spell icons only
["Armor"] = new CantripInfo {
SpellIconId = 1397 // ArmorSelf8 spell icon
};
// Skills: Dynamic skill icons from character data
IconId = GetSkillIconId(skillId) // Real skill icon + 0x6000000 offset
```
### Icon Priority System
1. **Background + Spell Overlay**: For attributes (complex layering)
2. **Spell Icons Only**: For protection auras
3. **Skill Icons**: From character skill data (item-style offset)
4. **Fallback**: Default portal icon (0x6002D14)
### Future Icon Usage
- **Weapons Tab**: 3-layer system (underlay + icon + overlay) from original Lua
- **Luminance Auras**: Could use custom UI icons
- **Society Items**: Could use item icons with proper offset

View file

@ -0,0 +1,3 @@
{
"enableAllProjectMcpServers": false
}

375
MosswartMassacre/CLAUDE.md Normal file
View file

@ -0,0 +1,375 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Build Commands
Build the project:
```
msbuild MosswartMassacre.csproj /p:Configuration=Release /p:Platform=AnyCPU
```
Build debug version:
```
msbuild MosswartMassacre.csproj /p:Configuration=Debug /p:Platform=AnyCPU
```
Restore NuGet packages:
```
nuget restore packages.config
```
Generate installer (post-build, Windows only):
```
powershell -File scripts/post-build.ps1 -NuGetPackageRoot "%USERPROFILE%\.nuget\packages" -ProjectDir "./"
```
Build entire solution from parent directory:
```
msbuild ../mossy.sln
```
## Architecture Overview
This is a DECAL plugin for Asheron's Call that tracks monster kills and rare item discoveries. The plugin architecture consists of several key components:
### Core Plugin Framework
- **PluginCore.cs**: Main plugin entry point inheriting from `PluginBase`. Handles Startup/Shutdown lifecycle, event subscriptions (chat, spawn/despawn, login), and coordinates all subsystems.
- **PluginSettings.cs**: Per-character YAML configuration management using YamlDotNet. Settings are stored as `<CharacterName>.yaml` in the plugin directory.
### UI System (VVS Direct Integration)
- **Views/VVSTabbedMainView.cs**: Main tabbed UI using direct VirindiViewService integration. Displays kill stats, rare counts, elapsed time, settings, statistics, and navigation controls.
- **Views/VVSBaseView.cs**: Base class for VVS-based views providing common functionality like window positioning, control access, and resource management.
- **ViewXML/mainViewTabbed.xml**: XML layout definition for the tabbed UI overlay.
### Communication Systems
- **WebSocket.cs**: Bidirectional WebSocket client connecting to `wss://overlord.snakedesert.se/websocket/` for real-time data streaming (spawns, chat, rares) and remote command reception.
- **HttpCommandServer.cs**: Local HTTP server on port 8085 accepting POST commands for remote control.
- **Telemetry.cs**: Periodic HTTP POST of player stats/position to configured endpoint.
### Game Integration
- **vTank.cs + VtankControl.cs**: Interface with vTank automation bot for meta state control and **NAVIGATION CONTROL**
- **MossyInventory.cs**: Inventory change monitoring and logging.
- **DelayedCommandManager.cs**: Queue system for executing chat commands with delays.
### Utility Components
- **Coordinates.cs + Geometry.cs**: Game coordinate system handling and spatial calculations.
- **Utils.cs**: General utility functions for player position, distance calculations, etc.
- **ManyHook.cs**: Low-level Windows message hooking functionality.
### Event Processing Flow
1. **Chat Events**: `OnChatText()` in PluginCore.cs:217 parses kill messages using regex patterns, rare discovery messages, and remote commands from allegiance chat.
2. **World Events**: `OnSpawn()`/`OnDespawn()` in PluginCore.cs:150,171 track monster spawning for WebSocket streaming.
3. **Command Processing**: `/mm` command handler in `HandleMmCommand()` at PluginCore.cs:448 provides comprehensive plugin control interface.
### Important Implementation Notes
- All regex patterns for kill detection are in `IsKilledByMeMessage()` at PluginCore.cs:337
- Settings auto-save on shutdown and load after character login complete
- WebSocket uses session-based authentication with SharedSecret
- Plugin requires `AllowUnsafeBlocks=true` for P/Invoke operations
### Dependencies
- **DECAL Framework**: Core AC plugin framework (Decal.Adapter, Decal.Interop.Core, Decal.Interop.D3DService)
- **VirindiViewService**: UI system for game overlays - used directly without wrapper abstraction
- **Newtonsoft.Json**: JSON serialization for WebSocket/HTTP communication
- **YamlDotNet**: YAML configuration file handling
- **utank2-i.dll**: vTank integration library
### Key Configuration
- Target Framework: .NET Framework 4.8
- Platform: x86 (required for AC integration)
- Unsafe blocks enabled for low-level operations
- VVS direct integration (no wrapper abstraction layer)
- Post-build script generates NSIS installer
### Shared Code Structure
The project links to shared code in `../Shared/` containing common utilities for multiple AC plugins including constants, world object wrappers, settings management, and VCS chat system integration.
## Navigation Visualization Feature ✅ COMPLETED
### Overview
Successfully implemented complete navigation route comparison feature allowing visualization of VTank .nav files alongside UtilityBelt's active route visualization. Feature is **FULLY FUNCTIONAL** as of May 29, 2025.
### Key Components Added
1. **NavRoute.cs** - VTank nav file parser and D3D line visualizer
2. **NavVisualization.cs** - Route management and file discovery
3. **Enhanced TabbedMainView.cs** - Navigation tab with controls
4. **Navigation Tab UI** - Dropdown selection, enable/disable, status display
### Features Implemented
- ✅ Complete VTank .nav file format parsing (all waypoint types)
- ✅ 3D route visualization with red colored lines
- ✅ Support for all nav types: Circular, Linear, Target, Once
- ✅ Registry-based VTank directory detection
- ✅ Tabbed UI integration with existing interface
- ✅ Enable/disable visualization controls
- ✅ Route loading and clearing functionality
- ✅ Comprehensive debug logging system
### Usage Instructions
1. **Enable**: Check "Enable Navigation Visualization" in Navigation tab
2. **Configure**: Set VTank profiles path in Settings tab (auto-detected)
3. **Select**: Choose route from dropdown and click "Load Route"
4. **View**: Red lines appear in 3D game world showing route path
### Technical Details
- **Dependencies**: Added Decal.Interop.D3DService reference
- **Performance**: Optimized for large routes (max 500 line segments)
- **Integration**: Seamless addition to existing plugin architecture
- **Memory Management**: Proper D3D object disposal and cleanup
### Reference Documentation
See `NAVIGATION_IMPLEMENTATION_SUMMARY.md` for complete technical details, implementation notes, and future enhancement opportunities.
---
## GUI Architecture (Enhanced with Navigation Feature)
### Current Implementation Status
**Tabbed Interface**: Successfully implemented with Navigation, Settings, and Statistics tabs
**BaseView Architecture**: Inherited from UtilityBelt's BaseView pattern
**Advanced Controls**: Dropdown lists, checkboxes, buttons with proper event handling
**Settings Integration**: VTank path configuration in Settings tab
**Resource Management**: Proper disposal and memory management
### Tabs Implemented
1. **Main Tab**: Kill tracking functionality (original)
2. **Settings Tab**: Configuration including VTank profiles path
3. **Statistics Tab**: Enhanced statistics display
4. **Navigation Tab**: ✅ Route visualization controls (NEW)
### Future Enhancement Opportunities
1. **Multiple Route Support**: Visualize several routes simultaneously
2. **Route Analysis**: Distance calculations and efficiency metrics
3. **Advanced Visualization**: Waypoint icons and route optimization
4. **Export Features**: Save custom routes or export comparisons
## VTank Navigation Control Feature ✅ COMPLETED
### Overview
Successfully implemented complete programmatic control of VTank's navigation system, allowing remote waypoint advancement through the `/mm nextwp` command. Feature is **FULLY FUNCTIONAL** as of May 29, 2025.
### Breakthrough Achievement
Cracked VTank's internal architecture through reverse engineering and reflection to enable seamless integration between Mosswart Massacre and VTank's navigation system.
### Key Implementation
- **VtankControl.cs:114-223** - `VtAdvanceWaypoint()` method using precise reflection
- **PluginCore.cs:661-671** - `/mm nextwp` command handler with user feedback
- **Decompiled Analysis** - Complete VTank internal structure mapping
### Technical Solution
Resolved "Ambiguous match found" reflection error by specifying exact method signatures:
```csharp
Type[] parameterTypes = new Type[] { typeof(object), assembly.GetType("MetaViewWrappers.MVControlEventArgs") };
var advanceMethod = pluginCoreType.GetMethod("i",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance,
null, parameterTypes, null);
```
### Features Implemented
- ✅ Programmatic waypoint advancement via `/mm nextwp`
- ✅ Navigation state validation (waypoint count, position, nav type)
- ✅ VTank business logic compliance (Target/Once type restrictions)
- ✅ Comprehensive error handling and user feedback
- ✅ Fallback mechanisms for maximum reliability
- ✅ Assembly-based reflection for internal access
### Architecture Discovery
**VTank Internal Structure**:
```
vTank.Instance (cExternalInterfaceTrustedRelay)
└── Assembly: utank2-i.dll
└── Type: uTank2.PluginCore
├── Static Field: PC (PluginCore instance)
│ └── Method: i(object, MVControlEventArgs) ← TARGET
└── Static Field: dz (fallback direct access)
└── Field: o.l (current waypoint index)
```
### Usage
Simply type `/mm nextwp` in-game to advance VTank to the next waypoint. Works with Circular and Linear navigation types.
### Reference Documentation
See `FINDINGS.md` for complete technical breakthrough details, implementation analysis, and reverse engineering discoveries.
## Universal Plugin Message Interception via Harmony ✅ SUCCESSFULLY IMPLEMENTED
### Current Status: FULLY FUNCTIONAL - Harmony 1.2.0.1 Integration Complete
Successfully implemented **universal plugin message interception** using UtilityBelt's Harmony 1.2.0.1 DLL to patch DECAL's core chat methods. All plugin messages are now being captured and streamed!
### ✅ **IMPLEMENTATION SUCCESS**:
- ✅ **UtilityBelt Compatibility Resolved**: Using same Harmony 1.2.0.1 DLL as UB
- ✅ **Plugin Message Capture Working**: Successfully intercepting [UB], [VI], [VGI], [VTank] messages
- ✅ **WebSocket Streaming Active**: All intercepted messages stream to remote server
- ✅ **No Plugin Conflicts**: All plugins functioning normally with our patches
### 🎯 What's Working
- **Harmony Framework**: Complete DECAL method interception using Harmony 1.2.0.1 (old API)
- **Dual-Mode Patching**: Successfully patches `HooksWrapper.AddChatText()` and `AddChatTextRaw()`
- **Universal Capture**: Capturing plugin messages from UtilityBelt, VI, VGI, VTank
- **Debug System**: `/mm decalstatus`, `/mm decaldebug`, `/mm harmonyraw` commands
- **WebSocket Integration**: Real-time streaming of all intercepted messages
- **Duplicate Prevention**: Smart logic prevents double-patching same instance
### 🔧 Technical Solution Implemented
#### **Harmony Version Resolution**
- **Solution Applied**: Using UtilityBelt's 0Harmony.dll (version 1.2.0.1)
- **API Conversion**: Changed from Harmony 2.x API to Harmony 1.x API
- **Key Changes**:
- `HarmonyLib.Harmony``Harmony.HarmonyInstance`
- `new Harmony()``HarmonyInstance.Create()`
- Reference points to `C:\Games\Decal Plugins\UtilityBelt\0Harmony.dll`
#### **Current Patching Architecture**
1. **DecalHarmonyClean.cs** ✅ WORKING
- **Harmony 1.x Integration**: Uses `Harmony.HarmonyInstance` API
- **Smart Patching**: Avoids duplicates by checking if Host.Actions == HooksWrapper
- **Methods Patched**: `AddChatText(string, int)`, `AddChatText(string, int, int)`, `AddChatTextRaw` variants
- **Debug Logging**: Internal queue-based logging with `/mm harmonyraw` command
2. **Message Processing Flow**
- All messages (including [Mosswart Massacre]) are captured and streamed
- Debug output filtered to prevent spam but streaming remains active
- WebSocket streaming requires both `AggressiveChatStreamingEnabled` and `WebSocketEnabled`
### 📊 Performance & Results
- **Messages Intercepted**: Successfully capturing 100+ messages per session
- **Plugin Coverage**: [UB], [VI], [VGI], [VTank] messages all captured
- **Streaming Reliability**: All messages successfully sent to WebSocket endpoint
- **No Performance Impact**: Harmony patches execute efficiently
### ✅ **COMPLETED: Code Cleanup Plan - All Phases Done (May 31, 2025)**
**Successfully completed comprehensive codebase cleanup to resolve API JSON encoding errors and remove experimental code:**
#### **✅ Phase 1: Remove Unused Harmony Experiments** - COMPLETED
**Files Removed (Previously):**
- All experimental Harmony files removed in earlier cleanup sessions
- Kept: `DecalHarmonyClean.cs` (working implementation)
#### **✅ Phase 2: Remove Failed Direct Hook Attempts** - COMPLETED
**Files Removed (Previously):**
- All failed hook attempt files removed in earlier cleanup sessions
- Direct hooks, COM interceptors, and window monitoring approaches removed
#### **✅ Phase 3: Clean Debug & Test Commands** - COMPLETED
**Status:** All debug commands were already cleaned up, no obsolete commands found
#### **✅ Phase 4: Remove Rich Text Formatting** - COMPLETED
**API Error Resolution:**
- **Root Cause Found:** Emoji characters (🎯, ✅, ❌, 🔧, 🔍, 🔄) in chat messages were causing JSON encoding errors
- **Fixed:** All emoji replaced with plain text markers ([OK], [FAIL], [INFO], [WARN])
- **Files Updated:** `PluginCore.cs`, `VTankChatIntegration.cs`, `VCSIntegration.cs`, `PluginLoadDiagnostic.cs`
- **Result:** API JSON encoding errors resolved
#### **✅ Phase 5: Clean Project References** - COMPLETED
**Status:** Project references and packages.config were already clean, no unnecessary dependencies found
#### **✅ Phase 6: Consolidate Integration Classes** - COMPLETED
**Files Removed:**
- `UtilityBeltControl.cs` - Unused UtilityBelt integration (superseded by Harmony)
- `VTankChatIntegration.cs` - Unused VTank chat integration (superseded by Harmony)
- `VCSIntegration.cs` - Unused VCS integration (superseded by Harmony)
- **Project File Updated:** Removed references to deleted integration classes
#### **✅ Phase 7: Clean Verbose Debug Output** - COMPLETED
**Issue:** Harmony initialization was producing 20+ lines of debug spam in chat
**Resolution:**
- **DecalHarmonyClean.cs:** Removed all verbose `PluginCore.WriteToChat()` debug messages
- **PluginCore.cs:** Simplified Harmony initialization to single success/failure message
- **Result:** Clean startup with just `[OK] Plugin message interception active`
#### **✅ Phase 8: Remove Development Scaffolding** - COMPLETED
**Files Removed:**
- `PluginLoadDiagnostic.cs` - Development testing utility no longer needed
- **Syntax Errors Fixed:** Corrected string interpolation issues in `DecalHarmonyClean.cs`
- **Project File Updated:** Removed reference to diagnostic file
### 📋 **Final Testing Checklist**
1. ✅ `/mm decalstatus` - Verify Harmony patches still active
2. ✅ `/mm decaldebug enable` - Test plugin message capture
3. ✅ WebSocket streaming - Confirm no JSON encoding errors
4. ✅ Plugin compatibility - No conflicts with UtilityBelt/VTank
5. ✅ Build verification - All syntax errors resolved
6. ✅ Clean startup - No verbose debug spam, single initialization message
### 🏗️ Build Configuration
- **Harmony Reference**: `C:\Games\Decal Plugins\UtilityBelt\0Harmony.dll`
- **Copy Local**: False (uses UB's loaded assembly)
- **Target Framework**: .NET 4.8
- **Platform**: x86
## Flag Tracker Feature ✅ IN PROGRESS - VVS Integration
### Overview
Successfully implemented comprehensive Flag Tracker feature porting the complete flagtracker Lua plugin from UBS to C# using VirindiViewService (VVS). This is a major new feature providing character tracking for augmentations, luminance auras, recall spells, society quests, character flags, cantrips, and weapons.
### Implementation Status
**Core Framework Completed**:
- FlagTrackerView.cs - Complete 10-tab VVS window
- FlagTrackerData.cs - All data structures ported from Lua
- QuestManager.cs - Quest tracking system
- flagTracker.xml - Comprehensive UI layout
**Integration Completed**:
- Added Flag Tracker tab to main tabbed view
- Button launches dedicated Flag Tracker window
- VVS inheritance from VVSBaseView
- Proper event handling and resource management
### Current Issue: VVS HudList Column Access
**Problem**: "Column out of range" errors when populating VVS HudList controls
**Root Cause**: VVS HudList column creation from XML may not be working as expected
**Status**: Implementing safe column access patterns with detailed debugging
### Files Implemented
1. **Views/FlagTrackerView.cs** - Main Flag Tracker window
- 10-tab structure: Augs, Lum, Recalls, Society, FacHub, Flags, Cantrips, Weapons, Quests, Settings
- VVS HudList population methods with SafeSetListText() helper
- Complete event handling for all refresh buttons
2. **FlagTrackerData.cs** - Data management
- Complete augmentation data (Death, Skill, Rating, Stat, Resistance, Spec, Misc)
- Luminance aura categories (Nalicana, Seer)
- Recall spell definitions
- Society quest structures
- Character flag categories
- Cantrip and weapon data structures
- Reflection-based DECAL property access
3. **QuestManager.cs** - Quest tracking system
- DECAL CoreManager integration
- Quest refresh and parsing
4. **ViewXML/flagTracker.xml** - UI Layout
- 10-tab notebook control
- HudList controls with column definitions
- Comprehensive button and settings controls
### Technical Approach
- **VVS Direct Integration**: No wrapper abstraction, direct VirindiViewService usage
- **Safe Column Access**: SafeSetListText() method with IndexOutOfRangeException handling
- **Reflection-Based Data Access**: Bypasses DECAL type system issues using raw integer property access
- **Complete Data Preservation**: "No simplification or truncation" as requested by user
### Architecture Integration
- **Main View Integration**: Flag Tracker button added to mainViewTabbed.xml
- **Event Handling**: OnOpenFlagTrackerClick() in VVSTabbedMainView.cs
- **Static Interface**: OpenFlagTracker(), CloseFlagTracker(), IsOpen() methods
- **Resource Management**: Proper disposal in base VVSBaseView pattern
### Debug Features Added
- Control initialization status reporting
- Safe column access with detailed error messages
- Column existence validation before access
### Next Steps
1. Resolve VVS HudList column creation from XML
2. Complete remaining tab data population
3. Implement actual character data retrieval
4. Add settings persistence
---

View file

@ -0,0 +1,304 @@
# VTank Next Waypoint Control - BREAKTHROUGH FINDINGS
## SUCCESS: VTank Waypoint Advancement WORKING ✅
**Date**: May 29, 2025
**Status**: FULLY FUNCTIONAL
**Command**: `/mm nextwp`
## The Challenge
Implementing programmatic control of VTank's "Advance Current Point" button functionality to skip to the next waypoint in a navigation route. This required deep reverse engineering of VTank's internal architecture.
## Key Technical Breakthrough
### The "Ambiguous Match Found" Problem
The critical issue was that VTank's `PluginCore` class contains multiple methods named `i`, causing reflection to fail with "Ambiguous match found" when trying to invoke the waypoint advance method.
### The Solution
Specified exact method signature using parameter types in the `GetMethod()` call:
```csharp
Type[] parameterTypes = new Type[] { typeof(object), assembly.GetType("MetaViewWrappers.MVControlEventArgs") };
var advanceMethod = pluginCoreType.GetMethod("i",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance,
null, parameterTypes, null);
```
## Complete VTank Architecture Discovery
### Core Architecture Components
#### 1. External Interface Layer
- **Type**: `cExternalInterfaceTrustedRelay`
- **Access**: `vTank.Instance` (singleton pattern)
- **Purpose**: Safe public API facade with permission checking
- **Assembly**: `utank2-i.dll`
- **Permission Levels**: Uses `eExternalsPermissionLevel` enum for access control
#### 2. Internal Core Logic
- **Type**: `uTank2.PluginCore`
- **Static Instance**: `PC` field (PluginCore singleton)
- **Purpose**: Main plugin implementation containing all core functionality
- **Access Pattern**: External interface delegates to internal PluginCore methods
#### 3. Navigation System Architecture
```
Navigation Data Flow:
ExternalInterface.NavCurrent
└── calls: a(eExternalsPermissionLevel.FullUnderlying)
└── returns: PC.NavCurrent
└── accesses: dz.o.l (actual waypoint index storage)
```
### Deep Navigation Implementation Details
#### Navigation State Management
- **Current Waypoint**: `dz.o.l` (int field chain)
- **Total Waypoints**: `dz.o` contains waypoint collection
- **Navigation Type**: Enum values (0=Circular, 1=Linear, 2=Target, 4=Once)
- **Meta State Integration**: `dz.at.f()` and `dz.at.b(value)` for meta state control
#### Waypoint Advancement Logic (from decompiled source)
```csharp
// VTank's internal advance logic:
if (navType != 2 && navType != 4) // Not Target or Once
{
if (dz.o.l < totalWaypoints - 1) // Not at end
{
dz.o.l++; // Advance waypoint
}
}
```
#### Button Click Handler Chain
1. **UI Button**: "Advance Current Point" in VTank interface
2. **Event Handler**: `i(object A_0, MVControlEventArgs A_1)` method
3. **Permission Check**: Validates navigation state and type
4. **Core Logic**: Calls internal waypoint advancement
5. **State Update**: Updates `dz.o.l` and refreshes UI
### Permission and Security Model
#### Access Levels (eExternalsPermissionLevel)
- **LogicObject**: Basic access to cLogic object
- **FullUnderlying**: Complete access to internal state (required for navigation)
- **Permission Validation**: `a(level)` method checks permissions before access
#### Trust Relationship
- External plugins must be "trusted" to access navigation functions
- VTank validates calling assembly and permission levels
- Reflection bypasses normal permission checks (security consideration)
### Method Signature Discovery
#### Navigation Methods in PluginCore
- **Multiple 'i' Methods**: Caused "Ambiguous match found" error
- **Target Method**: `i(object A_0, MVControlEventArgs A_1)` - button event handler
- **Parameter Types**:
- `object` - sender/source object (can be null)
- `MetaViewWrappers.MVControlEventArgs` - VVS event args (can be null)
#### Reflection Access Pattern
```csharp
// Critical discovery: Must specify exact parameter types
Type[] parameterTypes = new Type[] {
typeof(object),
assembly.GetType("MetaViewWrappers.MVControlEventArgs")
};
var method = type.GetMethod("i", flags, null, parameterTypes, null);
```
### Navigation Type Behaviors
#### Circular Navigation (Type 0)
- ✅ Advance allowed at any waypoint
- Wraps from last waypoint back to first
- Most common navigation pattern
#### Linear Navigation (Type 1)
- ✅ Advance allowed until last waypoint
- Stops at final waypoint (no wrap-around)
- Used for point-to-point routes
#### Target Navigation (Type 2)
- ❌ Advance blocked by design
- Single destination waypoint
- Navigation automatically stops at target
#### Once Navigation (Type 4)
- ❌ Advance blocked by design
- One-time route execution
- Cannot manually advance waypoints
### Meta State Integration
#### Current Meta State Access
- **Getter**: `dz.at.f()` returns current meta state string
- **Setter**: `dz.at.b(value)` sets new meta state
- **Integration**: Navigation events can trigger meta state changes
- **Example**: Rare discoveries trigger "loot_rare" meta state
### Assembly and Type Discovery
#### Key Assembly Information
- **File**: `utank2-i.dll` (interface assembly)
- **Namespace**: `uTank2`
- **Main Type**: `PluginCore`
- **Static Fields**: `PC` (PluginCore instance), `dz` (navigation data)
#### Critical Type Relationships
```
uTank2.PluginCore (main logic)
├── Static PC: PluginCore instance
├── Static dz: Navigation data container
│ └── Field o: Navigation object
│ └── Field l: Current waypoint index (int)
└── Method i(object, MVControlEventArgs): Advance handler
```
### Error Patterns and Solutions
#### Common Reflection Errors
1. **"Ambiguous match found"**: Multiple methods with same name
- **Solution**: Specify exact parameter types in GetMethod()
2. **Permission Denied**: External interface blocks access
- **Solution**: Use assembly-level reflection to bypass interface
3. **Null Reference**: Static fields not initialized
- **Solution**: Validate object hierarchy before access
#### Debugging Techniques Used
1. **Type Inspection**: `GetType().Name` to identify actual types
2. **Assembly Analysis**: Loading and inspecting utank2-i.dll
3. **Field Enumeration**: Discovering static fields via reflection
4. **Method Signature Analysis**: Identifying parameter requirements
### Access Pattern Hierarchy
```
Application Level:
/mm nextwp command
└── VtankControl.VtAdvanceWaypoint()
└── Validation (waypoints, nav type, position)
└── Assembly.GetType("uTank2.PluginCore")
└── GetField("PC").GetValue(null)
└── GetMethod("i", paramTypes).Invoke(instance, params)
└── VTank Internal Navigation Logic
└── dz.o.l++ (waypoint advancement)
```
### Performance Characteristics
- **Reflection Overhead**: Minimal (only on command execution)
- **Memory Impact**: No persistent references to VTank objects
- **UI Responsiveness**: No blocking operations
- **Error Recovery**: Graceful fallback to direct field manipulation
## Implementation Details
### File: VtankControl.cs:114-223
Added `VtAdvanceWaypoint()` method with:
- Navigation validation (waypoint count, current position, nav type)
- Assembly-based reflection to access internal VTank types
- Primary approach: Method invocation via PluginCore.PC.i()
- Fallback approach: Direct field manipulation of dz.o.l
- Comprehensive error handling and user feedback
### File: PluginCore.cs:661-671
Added `/mm nextwp` command handler with success/failure messaging.
## Navigation Type Restrictions
Correctly implemented VTank's business logic:
- **Circular/Linear**: ✅ Advance allowed
- **Target/Once**: ❌ Advance blocked (matches VTank UI behavior)
## Testing Results
- ✅ Successfully advances waypoint in Circular navigation
- ✅ Properly validates navigation state before advancing
- ✅ Provides clear user feedback on success/failure
- ✅ Handles edge cases (no waypoints, at end of route)
- ✅ Respects VTank's navigation type restrictions
## Technical Lessons Learned
1. **Reflection Precision**: When dealing with obfuscated/complex assemblies, always specify exact method signatures using parameter types to avoid ambiguity.
2. **Assembly Navigation**: External interfaces often provide facade access to internal implementations via assembly type lookups.
3. **Static Field Patterns**: Many plugin architectures use static fields (like `PC`) to maintain singleton instances for cross-component access.
4. **Decompiled Code Value**: Reverse engineering provided exact field names (`dz.o.l`) and method signatures crucial for implementation.
5. **Fallback Strategies**: Implementing multiple access approaches (method invocation + direct field access) increases reliability.
## Future Enhancement Opportunities
1. **Previous Waypoint**: Implement `/mm prevwp` command using similar reflection techniques
2. **Jump to Waypoint**: `/mm gotowp <index>` for direct waypoint targeting
3. **Route Management**: Integration with VTank's route loading/saving functionality
4. **Navigation State Monitoring**: Real-time tracking of waypoint advancement
## Security Considerations
- Uses private reflection to access VTank internals
- Requires appropriate permissions and trust levels
- No modification of VTank files or persistent state
- Read-only access to navigation configuration
## Chat Capture System - CRITICAL LOOP PREVENTION ⚠️
### The Recursive Loop Problem
When implementing unified chat capture (native + plugin-generated), there's a serious risk of infinite recursion:
1. Plugin calls `WriteToChat()` → Adds text to chat window
2. Window monitor detects new text → Fires chat event
3. Chat handler encounters error → Calls `WriteToChat()` again
4. **INFINITE LOOP** leading to stack overflow and crash
### Prevention Mechanisms Implemented
#### 1. Message Filtering
```csharp
// Block our own plugin messages from being processed
if (text.Contains("[Mosswart Massacre]")) return false;
if (text.Contains("[UnifiedChat]")) return false;
// ... other plugin prefixes
```
#### 2. Safe Error Handling
```csharp
catch (Exception ex)
{
// NEVER use WriteToChat in error handlers!
System.Diagnostics.Debug.WriteLine($"Error: {ex}"); // Safe alternative
}
```
#### 3. Recursion Detection
```csharp
private static bool DetectPotentialRecursion()
{
// Monitor call frequency - if >10 calls in 100ms, likely a loop
if (_recursionDetectionCount > 10) return true;
}
```
#### 4. Multiple Safety Layers
- **Content filtering**: Block plugin-generated messages
- **Debug logging**: Use `Debug.WriteLine()` instead of `WriteToChat()` in handlers
- **Frequency monitoring**: Detect rapid-fire calls indicating loops
- **Circuit breaker**: Temporarily disable monitor if recursion detected
### Implementation Notes
- **NEVER** call `WriteToChat()` from within chat event handlers
- **ALWAYS** filter out your own plugin's messages
- **USE** `System.Diagnostics.Debug.WriteLine()` for error logging in chat handlers
- **TEST** thoroughly with `/mm chattest` command
This prevention system is **CRITICAL** for stability - without it, the plugin would crash AC client on any WebSocket error.
## Performance Impact
- Minimal: Reflection calls only on command execution
- No continuous polling or background processing
- Lightweight validation checks before expensive reflection operations
---
**CONCLUSION**: Complete programmatic control of VTank navigation achieved through precise reflection engineering. The `/mm nextwp` command now provides seamless integration between Mosswart Massacre and VTank's navigation system.

View file

@ -159,10 +159,23 @@ namespace MosswartMassacre
});
// 5) Inline telemetry loop
PluginCore.WriteToChat("[WebSocket] Starting telemetry loop");
while (_ws.State == WebSocketState.Open && !_cts.Token.IsCancellationRequested)
{
var json = BuildPayloadJson();
await SendEncodedAsync(json, _cts.Token);
try
{
PluginCore.WriteToChat("[WebSocket] Building telemetry payload...");
var json = BuildPayloadJson();
PluginCore.WriteToChat($"[WebSocket] Payload built ({json.Length} chars), sending...");
await SendEncodedAsync(json, _cts.Token);
PluginCore.WriteToChat("[WebSocket] Telemetry sent successfully");
}
catch (Exception ex)
{
PluginCore.WriteToChat($"[WebSocket] Telemetry failed: {ex.Message}");
PluginCore.WriteToChat($"[WebSocket] Stack trace: {ex.StackTrace}");
break; // Exit telemetry loop on failure
}
try
{
@ -170,30 +183,41 @@ namespace MosswartMassacre
}
catch (OperationCanceledException)
{
PluginCore.WriteToChat("[WebSocket] Telemetry loop cancelled");
break;
}
}
// Log why telemetry loop exited
PluginCore.WriteToChat($"[WebSocket] Telemetry loop ended - State: {_ws?.State}, Cancelled: {_cts.Token.IsCancellationRequested}");
// Wait for receive loop to finish
await receiveTask;
}
catch (OperationCanceledException)
{
PluginCore.WriteToChat("[WebSocket] Connection cancelled");
break;
}
catch (Exception ex)
{
PluginCore.WriteToChat($"[WebSocket] error: {ex.Message}");
PluginCore.WriteToChat($"[WebSocket] Connection error: {ex.Message}");
}
finally
{
var finalState = _ws?.State.ToString() ?? "null";
PluginCore.WriteToChat($"[WebSocket] Cleaning up connection - Final state: {finalState}");
_ws?.Abort();
_ws?.Dispose();
_ws = null;
}
// Pause before reconnecting
try { await Task.Delay(2000, CancellationToken.None); } catch { }
if (_enabled)
{
PluginCore.WriteToChat("[WebSocket] Reconnecting in 2 seconds...");
try { await Task.Delay(2000, CancellationToken.None); } catch { }
}
}
}
@ -269,8 +293,16 @@ namespace MosswartMassacre
await _sendLock.WaitAsync(token);
try
{
if (_ws == null || _ws.State != WebSocketState.Open)
if (_ws == null)
{
PluginCore.WriteToChat("[WebSocket] Send failed - WebSocket is null");
return;
}
if (_ws.State != WebSocketState.Open)
{
PluginCore.WriteToChat($"[WebSocket] Send failed - State: {_ws.State}");
return;
}
var bytes = Encoding.UTF8.GetBytes(text);
await _ws.SendAsync(new ArraySegment<byte>(bytes),
@ -280,7 +312,7 @@ namespace MosswartMassacre
}
catch (Exception ex)
{
PluginCore.WriteToChat("[WebSocket] send error: " + ex.Message);
PluginCore.WriteToChat($"[WebSocket] Send error: {ex.Message} (State: {_ws?.State})");
_ws?.Abort();
_ws?.Dispose();
_ws = null;

View file

@ -0,0 +1,212 @@
; Define your application name
!define APPNAME "MosswartMassacreNG"
!define SOFTWARECOMPANY "MosswartMassacreNG"
!define APPGUID "{4b1f02bb-9b95-46f0-ad5b-223fea7392fb}"
!define CLASSNAME "MosswartMassacreNG.PluginCore"
!define ASSEMBLY "MosswartMassacreNG.dll"
InstallDir "C:\Games\DecalPlugins\${APPNAME}"
;Icon "Installer\Res\Decal.ico"
!define BUILDPATH ".\..\..\bin\net48"
!getdllversion "${BUILDPATH}\${ASSEMBLY}" Expv_
!define VERSION ${Expv_1}.${Expv_2}.${Expv_3}
OutFile "${BUILDPATH}\${APPNAME}Installer-${VERSION}.exe"
; Main Install settings
; compressor goes first
SetCompressor LZMA
Name "${APPNAME} ${VERSION}"
InstallDirRegKey HKLM "Software\${SOFTWARECOMPANY}\${APPNAME}" ""
;SetFont "Verdana" 8
; Use compression
; Modern interface settings
!include "MUI.nsh"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME
;!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL
; https://nsis.sourceforge.io/Download_and_Install_dotNET_45
Function CheckAndDownloadDotNet48
# Set up our Variables
Var /GLOBAL dotNET48IsThere
Var /GLOBAL dotNET_CMD_LINE
Var /GLOBAL EXIT_CODE
# We are reading a version release DWORD that Microsoft says is the documented
# way to determine if .NET Framework 4.8 is installed
ReadRegDWORD $dotNET48IsThere HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release"
IntCmp $dotNET48IsThere 528049 is_equal is_less is_greater
is_equal:
Goto done_compare_not_needed
is_greater:
Goto done_compare_not_needed
is_less:
Goto done_compare_needed
done_compare_needed:
#.NET Framework 4.8 install is *NEEDED*
# Microsoft Download Center EXE:
# Web Bootstrapper: https://go.microsoft.com/fwlink/?LinkId=2085155
# Full Download: https://go.microsoft.com/fwlink/?linkid=2088631
# Setup looks for components\dotNET48Full.exe relative to the install EXE location
# This allows the installer to be placed on a USB stick (for computers without internet connections)
# If the .NET Framework 4.8 installer is *NOT* found, Setup will connect to Microsoft's website
# and download it for you
# Reboot Required with these Exit Codes:
# 1641 or 3010
# Command Line Switches:
# /showrmui /passive /norestart
# Silent Command Line Switches:
# /q /norestart
# Let's see if the user is doing a Silent install or not
IfSilent is_quiet is_not_quiet
is_quiet:
StrCpy $dotNET_CMD_LINE "/q /norestart"
Goto LookForLocalFile
is_not_quiet:
StrCpy $dotNET_CMD_LINE "/showrmui /passive /norestart"
Goto LookForLocalFile
LookForLocalFile:
# Let's see if the user stored the Full Installer
IfFileExists "$EXEPATH\components\dotNET48Full.exe" do_local_install do_network_install
do_local_install:
# .NET Framework found on the local disk. Use this copy
ExecWait '"$EXEPATH\components\dotNET48Full.exe" $dotNET_CMD_LINE' $EXIT_CODE
Goto is_reboot_requested
# Now, let's Download the .NET
do_network_install:
Var /GLOBAL dotNetDidDownload
NSISdl::download "https://go.microsoft.com/fwlink/?linkid=2088631" "$TEMP\dotNET48Web.exe" $dotNetDidDownload
StrCmp $dotNetDidDownload success fail
success:
ExecWait '"$TEMP\dotNET45Web.exe" $dotNET_CMD_LINE' $EXIT_CODE
Goto is_reboot_requested
fail:
MessageBox MB_OK|MB_ICONEXCLAMATION "Unable to download .NET Framework. ${PRODUCT_NAME} will be installed, but will not function without the Framework!"
Goto done_dotNET_function
# $EXIT_CODE contains the return codes. 1641 and 3010 means a Reboot has been requested
is_reboot_requested:
${If} $EXIT_CODE = 1641
${OrIf} $EXIT_CODE = 3010
SetRebootFlag true
${EndIf}
done_compare_not_needed:
# Done dotNET Install
Goto done_dotNET_function
#exit the function
done_dotNET_function:
FunctionEnd
Section "" CoreSection
; Set Section properties
SetOverwrite on
; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
File "${BUILDPATH}\${ASSEMBLY}"
File "${BUILDPATH}\${APPNAME}.pdb"
File "${BUILDPATH}\UtilityBelt.Service.Installer.exe"
SectionEnd
Section -FinishSection
WriteRegStr HKLM "Software\${SOFTWARECOMPANY}\${APPNAME}" "" "$INSTDIR"
WriteRegStr HKLM "Software\${SOFTWARECOMPANY}\${APPNAME}" "Version" "${VERSION}"
;Register in decal
ClearErrors
ReadRegStr $0 HKLM "Software\Decal\Plugins\${APPGUID}" ""
${If} ${Errors}
WriteRegStr HKLM "Software\Decal\Plugins\${APPGUID}" "" "${APPNAME}"
WriteRegDWORD HKLM "Software\Decal\Plugins\${APPGUID}" "Enabled" "1"
WriteRegStr HKLM "Software\Decal\Plugins\${APPGUID}" "Object" "${CLASSNAME}"
WriteRegStr HKLM "Software\Decal\Plugins\${APPGUID}" "Assembly" "${ASSEMBLY}"
WriteRegStr HKLM "Software\Decal\Plugins\${APPGUID}" "Path" "$INSTDIR"
WriteRegStr HKLM "Software\Decal\Plugins\${APPGUID}" "Surrogate" "{71A69713-6593-47EC-0002-0000000DECA1}"
WriteRegStr HKLM "Software\Decal\Plugins\${APPGUID}" "Uninstaller" "${APPNAME}"
${Else}
${IF} $0 != "${APPNAME}"
MESSAGEBOX MB_OK|MB_ICONSTOP "Skipped decal plugin registration. A decal plugin with this GUID already exists ($0), and is not ${APPNAME}."
${ENDIF}
${EndIf}
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
; make sure dotnet 4.8 is installed
Call CheckAndDownloadDotNet48
; make sure UtilityBelt.Service is installed
; TODO: try and pull UtilityBelt.Service version from the registry and check it against the version required for this plugin
ExecWait '"$instdir\UtilityBelt.Service.Installer.exe"'
SectionEnd
; Modern install component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${CoreSection} ""
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;Uninstall section
Section Uninstall
;Remove from registry...
DeleteRegKey HKLM "Software\${SOFTWARECOMPANY}\${APPNAME}"
DeleteRegKey HKLM "Software\Decal\Plugins\${APPGUID}"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
; Delete self
Delete "$INSTDIR\uninstall.exe"
;Clean up
Delete "$INSTDIR\${ASSEMBLY}"
Delete "$INSTDIR\${APPNAME}.pdb"
Delete "$INSTDIR\UtilityBelt.Service.Installer.exe"
;RMDir "$INSTDIR\"
SectionEnd
; eof

View file

@ -0,0 +1,17 @@
param(
[string]$NuGetPackageRoot,
[string]$ProjectDir
)
if ($Env:OS -and $Env:OS -like '*Windows*') {
$makensis = Join-Path $NuGetPackageRoot 'nsis-tool\3.0.8\tools\makensis.exe'
$installer = Join-Path $ProjectDir 'scripts\installer.nsi'
Write-Verbose "Using makensis at $makensis"
& $makensis $installer
}
else {
# Only runs when building on Linux/macOS with makensis in PATH
& makensis "$ProjectDir/scripts/installer.nsi"
}

View file

@ -0,0 +1,353 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace CustomCollections;
/// <summary>
/// A doubly-linked list with a Dictionary index. Duplicate items are not allowed.
/// -Add is O(1)
/// -Contains is O(1)
/// -Remove is O(1)
/// -Get/set by index is O(n)
/// -Insert is O(n)
/// -RemoveAt is O(n)
/// Additionally, a cached pointer (with associated index) is kept pointing to the last used index item.
/// When looking up an item by index, the list is walked from the head, tail, or cached index pointer.
/// Thus, doing multiple operations in index order is O(1) even without an enumerator.
/// </summary>
/// <typeparam name="T"></typeparam>
internal class HashedList<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
{
private class ListNode
{
public ListNode Previous;
public ListNode Next;
public T Value;
public ListNode(T v, ListNode prev, ListNode nxt)
{
Previous = prev;
Next = nxt;
Value = v;
}
}
private ListNode Head;
private ListNode Tail;
private Dictionary<T, ListNode> HashIndex = new Dictionary<T, ListNode>();
private int ChangeMarker;
private bool IndexCacheValid;
private int IndexCache_Index;
private ListNode IndexCache_Value;
public T this[int index]
{
get
{
if (index >= HashIndex.Count || index < 0)
{
throw new ArgumentOutOfRangeException();
}
return RunToIndex(index).Value;
}
set
{
if (index >= HashIndex.Count || index < 0)
{
throw new ArgumentOutOfRangeException();
}
if (HashIndex.ContainsKey(value))
{
throw new ArgumentException("Duplicate value");
}
ListNode listNode = RunToIndex(index);
HashIndex.Remove(listNode.Value);
listNode.Value = value;
HashIndex.Add(value, listNode);
ChangeMarker++;
}
}
public int Count => HashIndex.Count;
public bool IsReadOnly => false;
public HashedList()
{
}
public HashedList(T[] arr)
{
foreach (T item in arr)
{
Add(item);
}
}
/// <summary>
/// This method gets the node corresponding to a particular index. To get there,
/// the list is traversed from the head, tail, or cached index pointer (if valid).
/// </summary>
/// <param name="ind"></param>
/// <returns></returns>
private ListNode RunToIndex(int ind)
{
int num = HashIndex.Count / 2;
if (IndexCacheValid)
{
if (ind > IndexCache_Index)
{
if (ind - IndexCache_Index < num)
{
ListNode listNode = IndexCache_Value;
for (int i = IndexCache_Index; i < ind; i++)
{
listNode = listNode.Next;
}
IndexCache_Index = ind;
IndexCache_Value = listNode;
IndexCacheValid = true;
return listNode;
}
}
else if (IndexCache_Index - ind < num)
{
ListNode listNode2 = IndexCache_Value;
for (int num2 = IndexCache_Index; num2 > ind; num2--)
{
listNode2 = listNode2.Previous;
}
IndexCache_Index = ind;
IndexCache_Value = listNode2;
IndexCacheValid = true;
return listNode2;
}
}
if (ind < num)
{
ListNode listNode3 = Head;
for (int j = 0; j < ind; j++)
{
listNode3 = listNode3.Next;
}
if (listNode3 == null)
{
throw new Exception();
}
IndexCache_Index = ind;
IndexCache_Value = listNode3;
IndexCacheValid = true;
return listNode3;
}
ListNode listNode4 = Tail;
for (int num3 = HashIndex.Count - 1; num3 > ind; num3--)
{
listNode4 = listNode4.Previous;
}
if (listNode4 == null)
{
throw new Exception();
}
IndexCache_Index = ind;
IndexCache_Value = listNode4;
IndexCacheValid = true;
return listNode4;
}
private void RemoveNode(ListNode n)
{
if (n.Previous == null)
{
Head = n.Next;
}
else
{
n.Previous.Next = n.Next;
}
if (n.Next == null)
{
Tail = n.Previous;
}
else
{
n.Next.Previous = n.Previous;
}
HashIndex.Remove(n.Value);
}
public ReadOnlyCollection<T> AsReadOnly()
{
return new ReadOnlyCollection<T>(this);
}
public bool GetIfContains(T matchval, ref T outval)
{
if (HashIndex.ContainsKey(matchval))
{
outval = HashIndex[matchval].Value;
return true;
}
return false;
}
public int IndexOf(T item)
{
if (HashIndex.ContainsKey(item))
{
ListNode listNode = HashIndex[item];
ListNode listNode2 = Head;
for (int i = 0; i < HashIndex.Count; i++)
{
if (listNode2 == listNode)
{
return i;
}
listNode2 = listNode2.Next;
}
return -1;
}
return -1;
}
public void Insert(int index, T item)
{
if (index > HashIndex.Count || index < 0)
{
throw new ArgumentOutOfRangeException();
}
if (HashIndex.ContainsKey(item))
{
throw new ArgumentException("Duplicate value");
}
ListNode listNode;
if (index == HashIndex.Count)
{
Add(item);
listNode = HashIndex[item];
}
else if (index == 0)
{
listNode = new ListNode(item, null, Head);
Head.Previous = listNode;
Head = listNode;
HashIndex.Add(item, listNode);
}
else
{
ListNode listNode2 = RunToIndex(index - 1);
listNode = (listNode2.Next = new ListNode(item, listNode2, listNode2.Next));
listNode.Next.Previous = listNode;
HashIndex.Add(item, listNode);
}
ChangeMarker++;
IndexCache_Index = index;
IndexCache_Value = listNode;
IndexCacheValid = true;
}
public void RemoveAt(int index)
{
if (index >= HashIndex.Count || index < 0)
{
throw new ArgumentOutOfRangeException();
}
ListNode n = RunToIndex(index);
RemoveNode(n);
ChangeMarker++;
IndexCacheValid = false;
}
public void Add(T item)
{
ListNode listNode;
if (HashIndex.Count == 0)
{
listNode = (Tail = (Head = new ListNode(item, null, null)));
}
else
{
if (HashIndex.ContainsKey(item))
{
throw new ArgumentException("Duplicate value");
}
listNode = new ListNode(item, Tail, null);
Tail.Next = listNode;
Tail = listNode;
}
HashIndex.Add(item, listNode);
ChangeMarker++;
IndexCacheValid = false;
}
public void Clear()
{
Head = null;
Tail = null;
HashIndex.Clear();
ChangeMarker++;
IndexCacheValid = false;
}
public bool Contains(T item)
{
return HashIndex.ContainsKey(item);
}
public bool Remove(T item)
{
if (!HashIndex.ContainsKey(item))
{
return false;
}
RemoveNode(HashIndex[item]);
ChangeMarker++;
IndexCacheValid = false;
return true;
}
public void CopyTo(T[] array, int arrayIndex)
{
int num = arrayIndex + HashIndex.Count;
IEnumerator<T> enumerator = GetEnumerator();
for (int i = arrayIndex; i < num; i++)
{
enumerator.MoveNext();
array[i] = enumerator.Current;
}
}
public T[] ToArray()
{
T[] array = new T[HashIndex.Count];
CopyTo(array, 0);
return array;
}
public IEnumerator<T> GetEnumerator()
{
int startchangemarker = ChangeMarker;
for (ListNode cur = Head; cur != null; cur = cur.Next)
{
yield return cur.Value;
if (ChangeMarker != startchangemarker)
{
throw new Exception("Collection modified during enumeration");
}
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}

View file

@ -0,0 +1,231 @@
using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Decal.Adapter.Support;
using Decal.Adapter.Wrappers;
using Decal.Interop.Core;
namespace Decal.Adapter.IDQueue;
/// <summary>
/// An IDQueue that is fair with respect to plugins and round-robin with respect to ID requests.
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(IIdentifyFilter))]
[ProgId("DecalAdapter.FairIDQueue")]
[Guid("5CD85A12-3DED-48E7-B440-B41E2A1452D9")]
[CLSCompliant(true)]
public class FairIDQueue : FairRoundRobinScheduleQueue<Assembly, int>, IIdentifyFilter
{
private static int iVal = 1126270821;
private const int REQUEST_INTERVAL = 600;
private const int MAX_TRY_COUNT = 3;
private const int NULL_ACTION_ID = -1;
private Timer FireTimer = new Timer();
private DateTime LastFireTime = DateTime.MinValue;
private uint CurrentTimerFrame;
private uint LastTimerFireFrame;
private int UserRequestedID = -1;
private int UserRequestedAttempts;
private EventHandler<UserIDRequestProcessedEventArgs> mUserIDRequestProcessed;
[CLSCompliant(false)]
public event EventHandler<UserIDRequestProcessedEventArgs> UserIDRequestProcessed
{
add
{
mUserIDRequestProcessed = (EventHandler<UserIDRequestProcessedEventArgs>)Delegate.Combine(mUserIDRequestProcessed, value);
}
remove
{
mUserIDRequestProcessed = (EventHandler<UserIDRequestProcessedEventArgs>)Delegate.Remove(mUserIDRequestProcessed, value);
}
}
internal FairIDQueue()
: base(3, -1)
{
FireTimer.Interval = 600;
FireTimer.Tick += FireTimer_Tick;
CoreManager.Current.Actions.Underlying.SetIDFilter(this);
CoreManager.Current.MessageProcessed += Current_MessageProcessed;
CoreManager.Current.RenderFrame += Current_RenderFrame;
}
private void Current_RenderFrame(object sender, EventArgs e)
{
CurrentTimerFrame++;
}
private void Current_MessageProcessed(object sender, MessageProcessedEventArgs e)
{
if (e.Message.Type == 63408 && e.Message.Value<int>("event") == 201)
{
int num = e.Message.Value<int>("object");
DeleteAction(num);
if (UserRequestedID == num)
{
UserRequestedID = -1;
Util.SafeFireEvent(this, mUserIDRequestProcessed, new UserIDRequestProcessedEventArgs(num));
}
}
}
internal void Start()
{
LastFireTime = DateTime.MinValue;
FireTimer.Enabled = true;
}
internal void Stop()
{
FireTimer.Enabled = false;
ClearAll();
UserRequestedID = -1;
}
private void FireTimer_Tick(object sender, EventArgs e)
{
if (FireTimer.Interval != 600)
{
FireTimer.Enabled = false;
FireTimer.Interval = 600;
FireTimer.Enabled = true;
}
if (CurrentTimerFrame != LastTimerFireFrame)
{
LastTimerFireFrame = CurrentTimerFrame;
FireNow();
}
}
private void FireNow()
{
Assembly requester = null;
int num = -1;
if (UserRequestedID != -1)
{
num = UserRequestedID;
UserRequestedAttempts++;
if (UserRequestedAttempts > 3)
{
UserRequestedID = -1;
}
}
if (num == -1)
{
num = GetNextAction(ref requester);
}
if (num != -1)
{
LastFireTime = DateTime.Now;
int num2 = num ^ iVal;
CoreManager.Current.Actions.Underlying.CallerRefInstanceInternal = num2;
iVal = (num2 << 5) ^ (num2 >> 13) ^ iVal;
}
}
protected override bool IsActionValidNow(int action)
{
WorldObject worldObject = CoreManager.Current.WorldFilter[action];
if (worldObject == null)
{
return true;
}
if (worldObject.Container == 0)
{
WorldObject worldObject2 = CoreManager.Current.WorldFilter[CoreManager.Current.CharacterFilter.Id];
if (worldObject2 != null && worldObject.Coordinates().DistanceToCoords(worldObject2.Coordinates()) > 0.375)
{
return false;
}
}
return true;
}
protected override bool IsActionPermanentlyInvalid(int action)
{
return !CoreManager.Current.Actions.IsValidObject(action);
}
/// <summary>
/// Adds a request to the queue.
/// </summary>
/// <param name="lObjectID">The game object ID to identify.</param>
public void AddToQueue(int lObjectID)
{
AddToQueue(lObjectID, DateTime.MaxValue);
}
/// <summary>
/// Adds a request to the queue with a timeout time.
/// Note: if something else requests this ID while this request is still pending,
/// the later of the two timeouts will prevail.
/// </summary>
/// <param name="lObjectID">The game object ID to identify.</param>
/// <param name="pTimeout"></param>
public void AddToQueue(int lObjectID, DateTime pTimeout)
{
Assembly assembly = Assembly.GetCallingAssembly();
if (assembly == null)
{
assembly = Assembly.GetExecutingAssembly();
}
AddToQueueForCaller(lObjectID, assembly, pTimeout);
}
internal void AddToQueueForCaller(int lObjectID, Assembly pCaller, DateTime pTimeout)
{
try
{
if (FireTimer.Enabled && lObjectID != -1)
{
Enqueue(pCaller, lObjectID, DateTime.MaxValue);
if ((DateTime.Now - LastFireTime).TotalMilliseconds > 700.0)
{
FireTimer.Enabled = false;
FireTimer.Interval = 1;
FireTimer.Enabled = true;
}
}
}
catch (Exception ex)
{
Util.WriteLine("Queue exception in addtoqueue: " + ex.ToString());
}
}
/// <summary>
/// Send an ID request which bypasses the queue.
/// This is used when the user manually requests an ID. Only one object
/// at a time can be pending here.
/// </summary>
/// <param name="lObjectID">The game object ID to identify.</param>
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public void ShortcircuitID(int lObjectID)
{
if (FireTimer.Enabled && lObjectID != -1)
{
UserRequestedID = lObjectID;
UserRequestedAttempts = 0;
if ((DateTime.Now - LastFireTime).TotalMilliseconds > 700.0)
{
LastFireTime = DateTime.Now;
}
}
}
}

View file

@ -0,0 +1,298 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using CustomCollections;
namespace Decal.Adapter.IDQueue;
/// <summary>
/// A scheduler: callers request actions. Multiple callers can request the same action.
/// -Each caller gets one action, then the other callers get a turn.
/// -If a new caller arrives, it is given priority in the turns list.
/// -Everytime a caller gets a turn, it selects its next available action in round-robin fashion.
/// -If all of a caller's actions are unavailable when it is that caller's turn, its turn is lost and it must wait in line again.
/// -If no caller can take a turn, the null action is returned.
/// Thus if multiple callers request the same action, it will be tried more often
/// since the attempt will occur during the turns of multiple callers.
/// </summary>
/// <typeparam name="CALLERTYPE"></typeparam>
/// <typeparam name="ACTIONTYPE"></typeparam>
[CLSCompliant(true)]
[ClassInterface(ClassInterfaceType.None)]
public abstract class FairRoundRobinScheduleQueue<CALLERTYPE, ACTIONTYPE>
{
public class ActionRemovedEventArgs : EventArgs
{
private ACTIONTYPE mAction;
public ACTIONTYPE Action => mAction;
internal ActionRemovedEventArgs(ACTIONTYPE pAction)
{
mAction = pAction;
}
}
private class ActionInfo : IEquatable<ActionInfo>
{
public ACTIONTYPE Action;
public DateTime Expires;
public int TryCount;
public ActionInfo(ACTIONTYPE pAction, DateTime pExpires)
{
Action = pAction;
Expires = pExpires;
}
public bool IsExpired()
{
return Expires < DateTime.Now;
}
public bool Equals(ActionInfo other)
{
ref ACTIONTYPE action = ref Action;
object obj = other.Action;
return action.Equals(obj);
}
public override bool Equals(object obj)
{
return Equals(obj as ActionInfo);
}
public override int GetHashCode()
{
return Action.GetHashCode();
}
}
private HashedList<CALLERTYPE> Callers = new HashedList<CALLERTYPE>();
private Dictionary<ACTIONTYPE, ActionInfo> ActInfos = new Dictionary<ACTIONTYPE, ActionInfo>();
private Dictionary<CALLERTYPE, HashedList<ActionInfo>> CallerActions = new Dictionary<CALLERTYPE, HashedList<ActionInfo>>();
private Dictionary<ACTIONTYPE, HashedList<CALLERTYPE>> ActionCallers = new Dictionary<ACTIONTYPE, HashedList<CALLERTYPE>>();
private int MaximumTryCount;
private ACTIONTYPE NullAction;
public int CallerCount => Callers.Count;
public int ActionCount => ActInfos.Count;
public event EventHandler<ActionRemovedEventArgs> OnActionRemoved;
/// <summary>
///
/// </summary>
/// <param name="pMaximumTryCount">The most times an action can be attempted before it fails.</param>
/// <param name="pNullAction">An ACTIONTYPE to return when no action is available.</param>
protected FairRoundRobinScheduleQueue(int pMaximumTryCount, ACTIONTYPE pNullAction)
{
MaximumTryCount = pMaximumTryCount;
NullAction = pNullAction;
}
protected abstract bool IsActionValidNow(ACTIONTYPE action);
protected abstract bool IsActionPermanentlyInvalid(ACTIONTYPE action);
private void RotateQueue<T>(HashedList<T> q)
{
if (q.Count > 0)
{
T item = q[0];
q.RemoveAt(0);
q.Add(item);
}
}
public void ClearAll()
{
Callers.Clear();
ActInfos.Clear();
CallerActions.Clear();
ActionCallers.Clear();
}
public void DeleteAction(ACTIONTYPE action)
{
if (!ActionCallers.ContainsKey(action) || !ActInfos.ContainsKey(action))
{
return;
}
ActionInfo item = ActInfos[action];
ActInfos.Remove(action);
HashedList<CALLERTYPE> hashedList = ActionCallers[action];
ActionCallers.Remove(action);
foreach (CALLERTYPE item2 in hashedList)
{
CallerActions[item2].Remove(item);
if (CallerActions[item2].Count == 0)
{
CallerActions.Remove(item2);
Callers.Remove(item2);
}
}
if (this.OnActionRemoved != null)
{
this.OnActionRemoved(this, new ActionRemovedEventArgs(action));
}
}
public void DeleteCaller(CALLERTYPE caller)
{
Callers.Remove(caller);
if (!CallerActions.ContainsKey(caller))
{
return;
}
HashedList<ActionInfo> hashedList = CallerActions[caller];
CallerActions.Remove(caller);
HashedList<ActionInfo> hashedList2 = new HashedList<ActionInfo>();
foreach (ActionInfo item in hashedList)
{
if (ActionCallers.ContainsKey(item.Action))
{
ActionCallers[item.Action].Remove(caller);
if (ActionCallers[item.Action].Count == 0)
{
ActionCallers.Remove(item.Action);
ActInfos.Remove(item.Action);
hashedList2.Add(item);
}
}
}
if (this.OnActionRemoved == null)
{
return;
}
foreach (ActionInfo item2 in hashedList2)
{
this.OnActionRemoved(this, new ActionRemovedEventArgs(item2.Action));
}
}
public ReadOnlyCollection<ACTIONTYPE> GetActionsForCaller(CALLERTYPE caller)
{
List<ACTIONTYPE> list = new List<ACTIONTYPE>();
if (CallerActions.ContainsKey(caller))
{
foreach (ActionInfo item in CallerActions[caller])
{
list.Add(item.Action);
}
}
return list.AsReadOnly();
}
public ReadOnlyCollection<CALLERTYPE> GetCallersForAction(ACTIONTYPE action)
{
if (ActionCallers.ContainsKey(action))
{
return ActionCallers[action].AsReadOnly();
}
return new List<CALLERTYPE>().AsReadOnly();
}
public void Enqueue(CALLERTYPE caller, ACTIONTYPE action, DateTime expiration)
{
ActionInfo actionInfo;
if (ActInfos.ContainsKey(action))
{
actionInfo = ActInfos[action];
if (actionInfo.Expires < expiration)
{
actionInfo.Expires = expiration;
}
actionInfo.TryCount = 0;
}
else
{
actionInfo = new ActionInfo(action, expiration);
ActInfos[action] = actionInfo;
}
if (!CallerActions.ContainsKey(caller) || !CallerActions[caller].Contains(actionInfo))
{
if (!Callers.Contains(caller))
{
Callers.Insert(0, caller);
}
if (!CallerActions.ContainsKey(caller))
{
CallerActions.Add(caller, new HashedList<ActionInfo>());
}
CallerActions[caller].Add(actionInfo);
if (!ActionCallers.ContainsKey(action))
{
ActionCallers.Add(action, new HashedList<CALLERTYPE>());
}
ActionCallers[action].Add(caller);
}
}
public ACTIONTYPE GetNextAction(ref CALLERTYPE requester)
{
HashedList<ActionInfo> hashedList = new HashedList<ActionInfo>();
ACTIONTYPE result = NullAction;
for (int i = 0; i < Callers.Count; i++)
{
CALLERTYPE val = Callers[0];
HashedList<ActionInfo> hashedList2 = CallerActions[val];
bool flag = false;
for (int j = 0; j < hashedList2.Count; j++)
{
ActionInfo actionInfo = hashedList2[0];
if (hashedList.Contains(actionInfo))
{
RotateQueue(hashedList2);
continue;
}
if (actionInfo.IsExpired())
{
hashedList.Add(actionInfo);
RotateQueue(hashedList2);
continue;
}
if (IsActionPermanentlyInvalid(actionInfo.Action))
{
hashedList.Add(actionInfo);
RotateQueue(hashedList2);
continue;
}
if (!IsActionValidNow(actionInfo.Action))
{
RotateQueue(hashedList2);
continue;
}
flag = true;
result = actionInfo.Action;
requester = val;
RotateQueue(hashedList2);
actionInfo.TryCount++;
if (actionInfo.TryCount > MaximumTryCount)
{
hashedList.Add(actionInfo);
}
break;
}
RotateQueue(Callers);
if (flag)
{
break;
}
}
foreach (ActionInfo item in hashedList)
{
DeleteAction(item.Action);
}
return result;
}
}

View file

@ -0,0 +1,15 @@
using System;
namespace Decal.Adapter.IDQueue;
public class UserIDRequestProcessedEventArgs : EventArgs
{
private int mObjectId;
public int ObjectId => mObjectId;
internal UserIDRequestProcessedEventArgs(int ObjectId)
{
mObjectId = ObjectId;
}
}

View file

@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
namespace Decal.Adapter.Messages;
/// <summary>
/// The base from which Adapter messages derive
/// </summary>
[CLSCompliant(true)]
public class AdapterMessageEventArgs : EventArgs
{
private EventHandler<AdapterMessageResponseEventArgs> responder;
private List<object> handlers;
private bool canAddHandlers;
internal bool CanAddHandlers
{
get
{
return canAddHandlers;
}
set
{
canAddHandlers = value;
}
}
/// <summary>
/// Fires for each handler that completes processing of the message
/// </summary>
public event EventHandler<AdapterMessageResponseEventArgs> MessageComplete
{
add
{
responder = (EventHandler<AdapterMessageResponseEventArgs>)Delegate.Combine(responder, value);
}
remove
{
responder = (EventHandler<AdapterMessageResponseEventArgs>)Delegate.Remove(responder, value);
}
}
internal AdapterMessageEventArgs()
{
handlers = new List<object>();
}
/// <summary>
/// Acknowledges that the object intends to process the message
/// </summary>
/// <param name="obj">The object that will do the processing</param>
public void AddHandler(object obj)
{
if (!CanAddHandlers)
{
throw new InvalidOperationException("Unable to add handlers at this time");
}
if (obj != null)
{
handlers.Add(obj);
}
}
/// <summary>
/// Signals completion of message processing
/// </summary>
/// <param name="handler">The object that handled the message</param>
/// <param name="e">The message response</param>
public void SetComplete(object handler, AdapterMessageResponseEventArgs e)
{
handlers.Remove(handler);
if (handlers.Count == 0)
{
e.Complete = true;
}
if (responder != null)
{
responder(this, e);
}
}
}

View file

@ -0,0 +1,43 @@
using System;
namespace Decal.Adapter.Messages;
/// <summary>
/// Defines a response to a message request
/// </summary>
[CLSCompliant(true)]
public class AdapterMessageResponseEventArgs : EventArgs
{
private bool success;
private bool complete;
/// <summary>
/// Whether or not the actions take due to the message succeeded
/// </summary>
public bool Succeeded => success;
/// <summary>
/// Whether or not all handlers have completed processing
/// </summary>
public bool Complete
{
get
{
return complete;
}
internal set
{
complete = value;
}
}
/// <summary>
/// Create a new AdapterMessageResponse
/// </summary>
/// <param name="success">Did these actions succeed?</param>
protected AdapterMessageResponseEventArgs(bool success)
{
this.success = success;
}
}

View file

@ -0,0 +1,56 @@
using System;
namespace Decal.Adapter.NetParser;
internal class MemberParser : MarshalByRefObject
{
public MemberParser Next;
public MemberParser Child;
public MemberParserType MemberType;
public string MemberName;
public MemberParserCondition Condition;
public string ConditionField;
public long ConditionXor;
public long ConditionAnd;
public long ConditionResult;
public string LengthField;
public long LengthMask;
public int LengthDelta;
public int PreAlignment;
public int PostAlignment;
public MemberParser()
{
}
public MemberParser(MemberParser Source)
{
Next = Source.Next;
Child = Source.Child;
MemberType = Source.MemberType;
MemberName = Source.MemberName;
Condition = Source.Condition;
ConditionField = Source.ConditionField;
ConditionXor = Source.ConditionXor;
ConditionAnd = Source.ConditionAnd;
ConditionResult = Source.ConditionResult;
LengthField = Source.LengthField;
LengthMask = Source.LengthMask;
LengthDelta = Source.LengthDelta;
PreAlignment = Source.PreAlignment;
PostAlignment = Source.PostAlignment;
}
}

View file

@ -0,0 +1,12 @@
namespace Decal.Adapter.NetParser;
internal enum MemberParserCondition
{
None,
EQ,
NE,
GE,
GT,
LE,
LT
}

View file

@ -0,0 +1,18 @@
namespace Decal.Adapter.NetParser;
internal enum MemberParserType
{
BYTE,
WORD,
PackedWORD,
DWORD,
PackedDWORD,
QWORD,
@float,
@double,
String,
WString,
Struct,
Vector,
Case
}

View file

@ -0,0 +1,41 @@
using System;
using System.Runtime.InteropServices;
using Decal.Interop.Net;
namespace Decal.Adapter.NetParser;
/// <summary>
/// Decal Message Factory Implementation
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(IMessageFactory))]
[ProgId("DecalAdapter.MessageFactory")]
[Guid("59D7815E-6716-4bd7-B264-69B6A9382701")]
public class MessageFactory : IMessageFactory
{
/// <summary>
/// Construct a new MessageFacytory instance
/// </summary>
public MessageFactory()
{
}
/// <summary>
/// Creates an IMessage2 instance from the provided raw packet data
/// </summary>
/// <param name="pData">Pointer to the raw packet bytes</param>
/// <param name="size">Size of pData in bytes</param>
/// <param name="outgoing">Packet direction</param>
/// <returns>IMessage2 instance to navigate the packet</returns>
IMessage2 IMessageFactory.CreateMessage(int pData, int size, bool outgoing)
{
if (pData != 0 && size != 0)
{
byte[] array = (byte[])Array.CreateInstance(typeof(byte), size);
Marshal.Copy(new IntPtr(pData), array, 0, size);
return new MessageWrapper(new Message(array, Message.GetParser(BitConverter.ToInt32(array, 0), outgoing ? MessageDirection.Outbound : MessageDirection.Inbound)));
}
return null;
}
}

View file

@ -0,0 +1,57 @@
using System.Runtime.InteropServices;
using Decal.Interop.Net;
namespace Decal.Adapter.NetParser;
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(IMessageMember))]
[ProgId("DecalAdapter.MessageMemberWrapper")]
[Guid("BD22CFC5-0950-4ab3-9752-5053EE934BE6")]
public class MessageMemberWrapper : MessageRootImpl, IMessageMember
{
public int BeginOffset => Data.mOffset;
public int Count => Data.Count;
public int EndOffset => Data.mOffset + Data.mLength;
public MessageMemberWrapper()
{
}
internal MessageMemberWrapper(MessageStruct msg, MessageWrapper wrapper)
: base(msg, wrapper)
{
}
public string get_FieldName(int Index)
{
return Data.Name(Index);
}
public byte[] get_RawValue(object vIndex)
{
return Data.RawValue(Data.ObjectToIndex(vIndex));
}
public IMessageMember get_Struct(object vIndex)
{
int num = Data.ObjectToIndex(vIndex);
if (num < 0)
{
throw new COMHResultException((HResults)(-2147352571));
}
return new MessageMemberWrapper(Data.Struct(num), Wrapped);
}
public object get_Value(object vIndex)
{
int num = Data.ObjectToIndex(vIndex);
if (num >= 0)
{
return Data.Value<object>(num);
}
throw new COMHResultException((HResults)(-2147352571));
}
}

View file

@ -0,0 +1,124 @@
using System.Diagnostics;
using Decal.Interop.Net;
namespace Decal.Adapter.NetParser;
/// <summary>
/// IMessageIterator base implementation
/// </summary>
public class MessageRootImpl : MessageRoot, IMessageIterator
{
protected MessageWrapper Wrapped;
protected MessageStruct Data;
protected int FieldIndex;
protected const int Error = -1;
public object Current => Data.Value<object>(FieldIndex);
public string FieldName => Data.Name(FieldIndex);
public int Index => FieldIndex;
public IMessage Message => Wrapped;
public MessageRoot NextObjectIndex
{
[DebuggerNonUserCode]
get
{
if (FieldIndex < Data.mCount)
{
MessageMemberWrapper result = new MessageMemberWrapper(Data.Struct(FieldIndex), Wrapped);
FieldIndex++;
return result;
}
throw new COMHResultException(HResults.E_FAIL);
}
}
protected MessageRootImpl()
{
}
protected MessageRootImpl(MessageStruct data, MessageWrapper wrapper)
: this()
{
Wrapped = wrapper;
Data = data;
if (!Data.mParsed)
{
Data.Parse();
}
}
public void Reset()
{
FieldIndex = 0;
}
[DebuggerNonUserCode]
private T GetNext<T>(string name)
{
FieldIndex = Data.IndexFromName(name);
if (FieldIndex != -1)
{
return Data.Value<T>(FieldIndex);
}
throw new COMHResultException(HResults.E_FAIL);
}
[DebuggerNonUserCode]
private T GetNext<T>(int index)
{
if (index >= 0 && index < Data.mCount)
{
FieldIndex = index;
return Data.Value<T>(FieldIndex);
}
throw new COMHResultException(HResults.E_FAIL);
}
[DebuggerNonUserCode]
public object get_Next(object vIndex)
{
return GetNext<object>(Data.ObjectToIndex(vIndex));
}
[DebuggerNonUserCode]
public double get_NextFloat(string Name)
{
return GetNext<double>(Name);
}
[DebuggerNonUserCode]
public int get_NextInt(string Name)
{
return GetNext<int>(Name);
}
[DebuggerNonUserCode]
public MessageRoot get_NextObject(string Name)
{
FieldIndex = Data.IndexFromName(Name);
if (FieldIndex != -1)
{
return new MessageMemberWrapper(Data.Struct(FieldIndex), Wrapped);
}
throw new COMHResultException(HResults.E_FAIL);
}
[DebuggerNonUserCode]
public ulong get_NextQWord(string Name)
{
return GetNext<ulong>(Name);
}
[DebuggerNonUserCode]
public string get_NextString(string Name)
{
return GetNext<string>(Name);
}
}

View file

@ -0,0 +1,21 @@
using System.Runtime.InteropServices;
using Decal.Interop.Net;
namespace Decal.Adapter.NetParser;
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(MessageRoot))]
[ProgId("DecalAdapter.MessageRootWrapper")]
[Guid("E33FBF17-B6C5-471e-9ED6-A394DEDEBFE5")]
public class MessageRootWrapper : MessageRootImpl
{
public MessageRootWrapper()
{
}
internal MessageRootWrapper(MessageWrapper msg)
: base(msg.Wrapped.mStruct, msg)
{
}
}

View file

@ -0,0 +1,109 @@
using System.Runtime.InteropServices;
using Decal.Interop.Net;
namespace Decal.Adapter.NetParser;
/// <summary>
/// IMessage2 Implementation
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(IMessage2))]
[ProgId("DecalAdapter.MessageWrapper")]
[Guid("76142307-98E3-494d-8320-3C801010221D")]
public class MessageWrapper : IMessage2, IMessage
{
private Message msg;
internal Message Wrapped => msg;
/// <summary>
/// Return an IMessageIterator instance for this packet
/// </summary>
public MessageRoot Begin => new MessageRootWrapper(this);
/// <summary>
/// Return the number of items within this structure
/// </summary>
public int Count => msg.Count;
/// <summary>
/// Return the raw bytes of this structure
/// </summary>
public byte[] RawData => msg.RawData;
/// <summary>
/// Return the message type
/// </summary>
public int Type => msg.Type;
/// <summary>
/// Public constructor...
/// </summary>
public MessageWrapper()
{
}
/// <summary>
/// Internal constructor to wrap the Adapter parser
/// </summary>
/// <param name="msg">Adapter Message instance</param>
internal MessageWrapper(Message msg)
{
this.msg = msg;
if (!this.msg.mStruct.mParsed)
{
this.msg.mStruct.Parse();
}
}
/// <summary>
/// Get the field name for the specified index
/// </summary>
/// <param name="Index">message member index</param>
/// <returns>field name</returns>
public string get_FieldName(int Index)
{
return msg.Name(Index);
}
/// <summary>
/// Return the raw bytes for the specified member
/// </summary>
/// <param name="vElement">Member index (string or int)</param>
/// <returns>Byte array containing the member data</returns>
public byte[] get_RawValue(object vElement)
{
return msg.RawValue(msg.mStruct.ObjectToIndex(vElement));
}
/// <summary>
/// Return the specified member struct
/// </summary>
/// <param name="vElement">Member index (string or int)</param>
/// <returns>Member data</returns>
public IMessageMember get_Struct(object vElement)
{
int num = msg.mStruct.ObjectToIndex(vElement);
if (num < 0)
{
throw new COMHResultException((HResults)1);
}
return new MessageMemberWrapper(msg.Struct(num), this);
}
/// <summary>
/// Return the specified member data
/// </summary>
/// <param name="vElement">Member index (string or int)</param>
/// <returns>Member data</returns>
public object get_Value(object vElement)
{
int num = msg.mStruct.ObjectToIndex(vElement);
if (num >= 0)
{
return msg.Value<object>(num);
}
return null;
}
}

View file

@ -0,0 +1,174 @@
#define TRACE
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using Decal.Interop.Core;
using Microsoft.CSharp;
using Microsoft.Win32;
namespace Decal.Adapter.Support;
internal static class Util
{
private static int mTrace;
internal static int TraceLevel
{
get
{
return mTrace;
}
set
{
mTrace = value;
}
}
internal static Color ColorFromBGR(int color)
{
return Color.FromArgb(color & 0xFF, (color & 0xFF00) >> 8, (color & 0xFF0000) >> 16);
}
internal static int ColorToBGR(Color color)
{
return (color.B << 16) | (color.G << 8) | color.R;
}
internal static Rectangle toRectangle(tagRECT tr)
{
return new Rectangle(tr.left, tr.top, tr.right - tr.left, tr.bottom - tr.top);
}
internal static tagRECT toTagRECT(Rectangle r)
{
tagRECT result = default(tagRECT);
result.top = r.Top;
result.left = r.Left;
result.bottom = r.Bottom;
result.right = r.Right;
return result;
}
internal static T UnboxTo<T>(object obj)
{
try
{
return (T)obj;
}
catch (InvalidCastException)
{
TypeConverter converter = new CSharpCodeProvider().GetConverter(obj.GetType());
if (converter.CanConvertTo(typeof(T)))
{
return (T)converter.ConvertTo(obj, typeof(T));
}
WriteLine("Error Converting object type {0} to {1}", obj.GetType(), typeof(T));
throw;
}
}
internal static void InitializeTracing(string key, string value, int defaultValue)
{
try
{
TraceLevel = (int)Registry.GetValue(key, value, defaultValue);
}
catch
{
TraceLevel = 0;
}
}
public static void WriteLine(string fmt, params object[] args)
{
WriteLine(1, fmt, args);
}
public static void WriteLine(int traceLevel, string fmt, params object[] args)
{
WriteLine(traceLevel, string.Format(fmt, args));
}
public static void WriteLine(int traceLevel, string msg)
{
Trace.WriteLineIf(mTrace >= traceLevel, msg);
}
public static void Write(string fmt, params object[] args)
{
Write(1, string.Format(fmt, args));
}
public static void Write(int traceLevel, string msg)
{
Trace.WriteIf(mTrace >= traceLevel, msg);
}
public static void SafeFireEvent(object sender, EventHandler eventHandler, EventArgs args)
{
if (eventHandler == null)
{
return;
}
Delegate[] invocationList = eventHandler.GetInvocationList();
for (int i = 0; i < invocationList.Length; i++)
{
EventHandler eventHandler2 = (EventHandler)invocationList[i];
try
{
eventHandler2(sender, args);
}
catch (Exception ex)
{
WriteLine("SafeFire exception: {0}", ex.ToString());
}
}
}
public static void SafeFireEvent<T>(object sender, EventHandler<T> eventHandler, T args) where T : EventArgs
{
if (eventHandler == null)
{
return;
}
Delegate[] invocationList = eventHandler.GetInvocationList();
for (int i = 0; i < invocationList.Length; i++)
{
EventHandler<T> eventHandler2 = (EventHandler<T>)invocationList[i];
try
{
eventHandler2(sender, args);
}
catch (Exception ex)
{
WriteLine("SafeFire exception: {0}", ex.ToString());
}
}
}
public static void SafeFireEvent<T>(object sender, EventHandler<T> eventHandler, T args, ref bool eaten) where T : EatableEventArgs
{
if (eventHandler == null)
{
return;
}
Delegate[] invocationList = eventHandler.GetInvocationList();
for (int i = 0; i < invocationList.Length; i++)
{
EventHandler<T> eventHandler2 = (EventHandler<T>)invocationList[i];
try
{
eventHandler2(sender, args);
if (args.Eat)
{
eaten = true;
}
}
catch (Exception ex)
{
WriteLine("SafeFire exception: {0}", ex.ToString());
}
}
}
}

View file

@ -0,0 +1,15 @@
using System;
namespace Decal.Adapter.Wrappers;
public class AcceptTradeEventArgs : EventArgs
{
private int mTargetId;
public int TargetId => mTargetId;
internal AcceptTradeEventArgs(int TargetId)
{
mTargetId = TargetId;
}
}

View file

@ -0,0 +1,22 @@
using System;
namespace Decal.Adapter.Wrappers;
public class AccountCharInfo : MarshalByRefObject
{
private int myIndex;
private CharacterFilter myFilter;
public string Name => myFilter.get_AccountCharName(myIndex);
public int Id => myFilter.get_AccountCharID(myIndex);
public int Index => myIndex;
internal AccountCharInfo(CharacterFilter filter, int index)
{
myFilter = filter;
myIndex = index;
}
}

View file

@ -0,0 +1,10 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public enum AddRemoveEventType
{
Add,
Delete
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class AddTradeItemEventArgs : EventArgs
{
private int mItemId;
private int mSideId;
public int ItemId => mItemId;
public int SideId => mSideId;
internal AddTradeItemEventArgs(int ItemId, int SideId)
{
mItemId = ItemId;
mSideId = SideId;
}
}

View file

@ -0,0 +1,71 @@
using System;
using System.Runtime.InteropServices;
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class AllegianceInfoWrapper : MarshalByRefObject, IDisposable
{
private AllegianceInfo myAllegianceInfo;
private bool isDisposed;
public int Id => myAllegianceInfo.GUID;
public int Gender => myAllegianceInfo.Gender;
public int Leadership => myAllegianceInfo.Leadership;
public int Loyalty => myAllegianceInfo.Loyalty;
public string Name => myAllegianceInfo.Name;
public int Race => myAllegianceInfo.Race;
public int Rank => myAllegianceInfo.Rank;
public int ParentId => myAllegianceInfo.TreeParent;
public int Type => myAllegianceInfo.Type;
public double Unknown => myAllegianceInfo.Unknown;
public long XP => myAllegianceInfo.XP_64;
internal AllegianceInfoWrapper(AllegianceInfo info)
{
myAllegianceInfo = info;
}
~AllegianceInfoWrapper()
{
Dispose(disposing: false);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!isDisposed)
{
}
if (myAllegianceInfo != null)
{
Marshal.ReleaseComObject(myAllegianceInfo);
}
isDisposed = true;
}
protected void EnforceDisposedOnce()
{
if (isDisposed)
{
throw new ObjectDisposedException("AllegianceInfoWrapper");
}
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ApproachVendorEventArgs : EventArgs
{
private int mMerchantId;
private Vendor vendor;
public int MerchantId => mMerchantId;
public Vendor Vendor => vendor;
internal ApproachVendorEventArgs(int MerchantId, Vendor ven)
{
mMerchantId = MerchantId;
vendor = ven;
}
}

View file

@ -0,0 +1,59 @@
using System;
using System.Runtime.InteropServices;
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class AttributeInfoWrapper : MarshalByRefObject, IDisposable
{
private AttributeInfo myAttribInfo;
private bool isDisposed;
public int Base => myAttribInfo.Base;
public int Buffed => myAttribInfo.Buffed;
public int Creation => myAttribInfo.Creation;
public int Exp => myAttribInfo.Exp;
public string Name => myAttribInfo.Name;
internal AttributeInfoWrapper(AttributeInfo info)
{
myAttribInfo = info;
}
~AttributeInfoWrapper()
{
Dispose(disposing: false);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!isDisposed)
{
}
if (myAttribInfo != null)
{
Marshal.ReleaseComObject(myAttribInfo);
}
isDisposed = true;
}
protected void EnforceDisposedOnce()
{
if (isDisposed)
{
throw new ObjectDisposedException("AttributeInfoWrapper");
}
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public enum AttributeType
{
CurrentStrength = 1,
CurrentEndurance,
CurrentQuickness,
CurrentCoordination,
CurrentFocus,
CurrentSelf,
BaseStrength,
BaseEndurance,
BaseQuickness,
BaseCoordination,
BaseFocus,
BaseSelf
}

View file

@ -0,0 +1,78 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public enum Augmentations
{
ReinforcementLugians = 218,
BleearghFortitude = 219,
OswaldEnchancement = 220,
SiraluunBlessing = 221,
EnduringCalm = 222,
SteadfastWill = 223,
CiandraEssence = 224,
YoshiEssence = 225,
JibrilEssence = 226,
CeldisethEssence = 227,
KogaEssence = 228,
ShadowSeventhMule = 229,
MightSeventhMule = 230,
ClutchMiser = 231,
EnduringEnchantment = 232,
CriticalProtection = 233,
QuickLearner = 234,
CiandraFortune = 235,
CharmedSmith = 236,
InnateRenewal = 237,
ArchmageEndurance = 238,
BladeTurner = 240,
ArrowTurner = 241,
MaceTurner = 242,
CausticEnhancement = 243,
FieryEnchancment = 244,
IcyEnchancement = 245,
LightningEnhancement = 246,
InfusedCreature = 294,
InfusedItem = 295,
InfusedLife = 296,
InfusedWar = 297,
EyeRemorseless = 298,
HandRemorseless = 299,
MasterSteelCircle = 300,
MasterFocusedEyed = 301,
MasterFiveFoldPath = 302,
FrenzySlayer = 309,
IronSkinInvincible = 310,
JackOfAllTrades = 326,
InfusedVoid = 328,
[Obsolete("Use InfusedVoid")]
UnknownAug1 = 328,
[Obsolete("Not an aug")]
UnknownAug2 = 329,
[Obsolete("Not an aug")]
UnknownAug3 = 330,
[Obsolete("Not an aug")]
UnknownAug4 = 331,
[Obsolete("Not an aug")]
UnknownAug5 = 332,
AuraValor = 333,
AuraProtection = 334,
AuraGlory = 335,
AuraTemperance = 336,
AuraSurge = 337,
[Obsolete("Not an aug")]
UnknownAug6 = 337,
AuraAethericVision = 338,
AuraManaFlow = 339,
AuraManaInfusion = 340,
[Obsolete("Use AuraManaInfusion")]
UnknownAug7 = 340,
AuraVitality = 341,
[Obsolete("Use AuraVitality")]
UnknownAug8 = 341,
AuraPurity = 342,
AuraCraftsman = 343,
AuraSpecialization = 344,
AuraWorld = 365
}

View file

@ -0,0 +1,29 @@
using System;
using Decal.Interop.Render;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class Background : HudRenderTarget
{
private HUDBackground internalBackground;
internal HUDBackground Underlying => internalBackground;
internal Background(HUDBackground background)
: base(background)
{
internalBackground = background;
}
public Background Clone()
{
return new Background(internalBackground.Clone());
}
protected override void Dispose(bool disposing)
{
internalBackground = null;
base.Dispose(disposing);
}
}

View file

@ -0,0 +1,16 @@
namespace Decal.Adapter.Wrappers;
public enum BoolValueKey
{
Lockable = 201326592,
Inscribable = 201326593,
Open = 2,
Locked = 3,
HookVisibility = 24,
UnlimitedUses = 63,
CanBeSold = 69,
Retained = 91,
Ivoryable = 99,
Dyeable = 100,
AwayFromKeyboard = 110
}

View file

@ -0,0 +1,229 @@
using System;
using System.Drawing;
using Decal.Adapter.Support;
using Decal.Interop.Inject;
namespace Decal.Adapter.Wrappers;
public class ButtonWrapper : ControlWrapperBase<ButtonClass>
{
private EventHandler<ControlEventArgs> evtClick;
private EventHandler<ControlEventArgs> evtCancel;
private EventHandler<ControlEventArgs> evtDestroy;
private EventHandler<ControlEventArgs> evtHit;
private EventHandler<ControlEventArgs> evtUnhit;
private int myBackground;
public Color Matte
{
get
{
return Util.ColorFromBGR(base.Control.Matte);
}
set
{
base.Control.Matte = Util.ColorToBGR(value);
}
}
public int Background
{
get
{
return myBackground;
}
set
{
myBackground = value;
base.Control.SetBackground(myBackground);
}
}
public event EventHandler<ControlEventArgs> Click
{
add
{
if (evtClick == null)
{
base.Control.Accepted += ClickEvent;
}
evtClick = (EventHandler<ControlEventArgs>)Delegate.Combine(evtClick, value);
}
remove
{
evtClick = (EventHandler<ControlEventArgs>)Delegate.Remove(evtClick, value);
if (evtClick == null)
{
base.Control.Accepted -= ClickEvent;
}
}
}
public event EventHandler<ControlEventArgs> Canceled
{
add
{
if (evtCancel == null)
{
base.Control.Canceled += CanceledEvent;
}
evtCancel = (EventHandler<ControlEventArgs>)Delegate.Combine(evtCancel, value);
}
remove
{
evtCancel = (EventHandler<ControlEventArgs>)Delegate.Remove(evtCancel, value);
if (evtCancel == null)
{
base.Control.Canceled -= CanceledEvent;
}
}
}
public event EventHandler<ControlEventArgs> Destroy
{
add
{
if (evtDestroy == null)
{
base.Control.Destroy += DestroyEvent;
}
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
}
remove
{
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
if (evtDestroy == null)
{
base.Control.Destroy -= DestroyEvent;
}
}
}
public event EventHandler<ControlEventArgs> Hit
{
add
{
if (evtHit == null)
{
base.Control.Hit += HitEvent;
}
evtHit = (EventHandler<ControlEventArgs>)Delegate.Combine(evtHit, value);
}
remove
{
evtHit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtHit, value);
if (evtHit == null)
{
base.Control.Hit -= HitEvent;
}
}
}
public event EventHandler<ControlEventArgs> Unhit
{
add
{
if (evtUnhit == null)
{
base.Control.Unhit += UnhitEvent;
}
evtUnhit = (EventHandler<ControlEventArgs>)Delegate.Combine(evtUnhit, value);
}
remove
{
evtUnhit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtUnhit, value);
if (evtUnhit == null)
{
base.Control.Unhit -= UnhitEvent;
}
}
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (evtClick != null)
{
evtClick = (EventHandler<ControlEventArgs>)Delegate.Remove(evtClick, evtClick);
base.Control.Accepted -= ClickEvent;
}
if (evtCancel != null)
{
evtCancel = (EventHandler<ControlEventArgs>)Delegate.Remove(evtCancel, evtCancel);
base.Control.Canceled -= CanceledEvent;
}
if (evtDestroy != null)
{
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
base.Control.Destroy -= DestroyEvent;
}
if (evtHit != null)
{
evtHit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtHit, evtHit);
base.Control.Hit -= HitEvent;
}
if (evtUnhit != null)
{
evtUnhit = (EventHandler<ControlEventArgs>)Delegate.Remove(evtUnhit, evtUnhit);
base.Control.Unhit -= UnhitEvent;
}
}
base.Dispose(disposing);
}
public void SetImages(int released, int pressed)
{
SetImages(0, released, pressed);
}
public void SetImages(int module, int released, int pressed)
{
base.Control.SetImages(module, released, pressed);
}
private void ClickEvent(int ID)
{
if (evtClick != null)
{
evtClick(this, new ControlEventArgs(ID));
}
}
private void UnhitEvent(int ID)
{
if (evtUnhit != null)
{
evtUnhit(this, new ControlEventArgs(ID));
}
}
private void HitEvent(int ID)
{
if (evtHit != null)
{
evtHit(this, new ControlEventArgs(ID));
}
}
private void DestroyEvent(int ID)
{
if (evtDestroy != null)
{
evtDestroy(this, new ControlEventArgs(ID));
}
}
private void CanceledEvent(int ID)
{
if (evtCancel != null)
{
evtCancel(this, new ControlEventArgs(ID));
}
}
}

View file

@ -0,0 +1,19 @@
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Defines the WorldObjectCollection filter for all objects
/// </summary>
public class ByAllFilter : WorldObjectCollectionFilter
{
internal override void ApplyFilter(WorldIterator wi)
{
wi.ByAll();
}
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
{
ven.ByAll();
}
}

View file

@ -0,0 +1,52 @@
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Defines the WorldObjectCollection filter for objects having the same category
/// </summary>
public class ByCategoryFilter : WorldObjectCollectionFilter
{
private int category;
/// <summary>
/// Category of the items in this collection
/// </summary>
public int Category
{
get
{
return category;
}
set
{
category = value;
}
}
/// <summary>
/// Creates a new filter
/// </summary>
public ByCategoryFilter()
{
}
/// <summary>
/// Creates a new filter using the specified category
/// </summary>
/// <param name="category">Category to filter by</param>
public ByCategoryFilter(int category)
{
this.category = category;
}
internal override void ApplyFilter(WorldIterator wi)
{
wi.ByCategory(category);
}
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
{
ven.ByCategory(category);
}
}

View file

@ -0,0 +1,47 @@
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Defines the WorldObjectCollection filter for objects in a container
/// </summary>
public class ByContainerFilter : WorldObjectCollectionFilter
{
private int container;
/// <summary>
/// Id of the container filtered by
/// </summary>
public int Container
{
get
{
return container;
}
set
{
container = value;
}
}
/// <summary>
/// Creates a new filter
/// </summary>
public ByContainerFilter()
{
}
/// <summary>
/// Creates a new filter using the specified container
/// </summary>
/// <param name="container">Id of the container</param>
public ByContainerFilter(int container)
{
this.container = container;
}
internal override void ApplyFilter(WorldIterator wi)
{
wi.ByContainer(container);
}
}

View file

@ -0,0 +1,14 @@
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Defines the WorldObjectCollection filter for inventory objects
/// </summary>
public class ByInventoryFilter : WorldObjectCollectionFilter
{
internal override void ApplyFilter(WorldIterator wi)
{
wi.ByInventory();
}
}

View file

@ -0,0 +1,14 @@
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Defines the WorldObjectCollection filter for landscape objects
/// </summary>
public class ByLandscapeFilter : WorldObjectCollectionFilter
{
internal override void ApplyFilter(WorldIterator wi)
{
wi.ByLandscape();
}
}

View file

@ -0,0 +1,52 @@
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Defines the WorldObjectCollection filter for objects having the specified name
/// </summary>
public class ByNameFilter : WorldObjectCollectionFilter
{
private string name;
/// <summary>
/// Name of the objects in this collection
/// </summary>
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
/// <summary>
/// Creates a new filter
/// </summary>
public ByNameFilter()
{
}
/// <summary>
/// Creates a new filter using the specified name
/// </summary>
/// <param name="name">Name of the object</param>
public ByNameFilter(string name)
{
this.name = name;
}
internal override void ApplyFilter(WorldIterator wi)
{
wi.ByName(name);
}
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
{
ven.ByName(name);
}
}

View file

@ -0,0 +1,19 @@
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Defines the WorldObjectCollection filter for objects containing the specified name
/// </summary>
public class ByNameSubStringFilter : ByNameFilter
{
internal override void ApplyFilter(WorldIterator wi)
{
wi.ByNameSubstring(base.Name);
}
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
{
ven.ByNameSubstring(base.Name);
}
}

View file

@ -0,0 +1,52 @@
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Defines the WorldObjectCollection filter for objects of the same type/class
/// </summary>
public class ByObjectClassFilter : WorldObjectCollectionFilter
{
private ObjectClass objClass;
/// <summary>
/// Class of the items in this collection
/// </summary>
public ObjectClass ObjectClass
{
get
{
return objClass;
}
set
{
objClass = value;
}
}
/// <summary>
/// Creates a new filter
/// </summary>
public ByObjectClassFilter()
{
}
/// <summary>
/// Creates a new filter using the specified ObjectClass
/// </summary>
/// <param name="objClass">Class of the items</param>
public ByObjectClassFilter(ObjectClass objClass)
{
this.objClass = objClass;
}
internal override void ApplyFilter(WorldIterator wi)
{
wi.ByObjectClass((eObjectClass)objClass);
}
internal override void ApplyFilter(Decal.Interop.Filters.Vendor ven)
{
ven.ByObjectClass((eObjectClass)objClass);
}
}

View file

@ -0,0 +1,47 @@
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Defines the WorldObjectCollection filter for all objects owned by a character
/// </summary>
public class ByOwnerFilter : WorldObjectCollectionFilter
{
private int owner;
/// <summary>
/// Id of the owner of the objects
/// </summary>
public int Owner
{
get
{
return owner;
}
set
{
owner = value;
}
}
/// <summary>
/// Creates a new filter
/// </summary>
public ByOwnerFilter()
{
}
/// <summary>
/// Creates a new filter using the specified owner
/// </summary>
/// <param name="owner">Id of the owner</param>
public ByOwnerFilter(int owner)
{
this.owner = owner;
}
internal override void ApplyFilter(WorldIterator wi)
{
wi.ByOwner(owner);
}
}

View file

@ -0,0 +1,10 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public enum CastEventType
{
Untargetted,
Targetted
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangeEnchantmentsEventArgs : EventArgs
{
private AddRemoveEventType myType;
private EnchantmentWrapper myEnchantment;
public AddRemoveEventType Type => myType;
public EnchantmentWrapper Enchantment => myEnchantment;
internal ChangeEnchantmentsEventArgs(AddRemoveEventType type, EnchantmentWrapper enchantment)
{
myType = type;
myEnchantment = enchantment;
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangeExperienceEventArgs : EventArgs
{
private PlayerXPEventType myType;
private int myAmount;
public PlayerXPEventType Type => myType;
public int Amount => myAmount;
internal ChangeExperienceEventArgs(PlayerXPEventType type, int amount)
{
myType = type;
myAmount = amount;
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangeFellowshipEventArgs : EventArgs
{
private FellowshipEventType myType;
private int myId;
public FellowshipEventType Type => myType;
public int Id => myId;
internal ChangeFellowshipEventArgs(FellowshipEventType type, int Id)
{
myType = type;
myId = Id;
}
}

View file

@ -0,0 +1,21 @@
using System;
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
public class ChangeObjectEventArgs : EventArgs
{
private WorldObject myChangedObject;
private WorldChangeType myChangeType;
public WorldObject Changed => myChangedObject;
public WorldChangeType Change => myChangeType;
internal ChangeObjectEventArgs(WorldObject changedObject, Decal.Interop.Filters.WorldChangeType changeType)
{
myChangedObject = changedObject;
myChangeType = (WorldChangeType)changeType;
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangeOptionEventArgs : EventArgs
{
private int myOption;
private int myValue;
public int Option => myOption;
public int Value => myValue;
internal ChangeOptionEventArgs(int option, int value)
{
myOption = option;
myValue = value;
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangePlayerEventArgs : EventArgs
{
private PlayerModifyEventType myType;
private int myStat;
public PlayerModifyEventType Type => myType;
public int Stat => myStat;
internal ChangePlayerEventArgs(PlayerModifyEventType type, int Stat)
{
myType = type;
myStat = Stat;
}
}

View file

@ -0,0 +1,15 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangePortalModeEventArgs : EventArgs
{
private PortalEventType myType;
public PortalEventType Type => myType;
internal ChangePortalModeEventArgs(PortalEventType type)
{
myType = type;
}
}

View file

@ -0,0 +1,15 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangeSettingsFlagsEventArgs : EventArgs
{
private int mySettings;
public int Settings => mySettings;
internal ChangeSettingsFlagsEventArgs(int settings)
{
mySettings = settings;
}
}

View file

@ -0,0 +1,25 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangeShortcutEventArgs : EventArgs
{
private AddRemoveEventType myType;
private int mySlot;
private int myObjectId;
public AddRemoveEventType Type => myType;
public int Slot => mySlot;
public int ObjectId => myObjectId;
internal ChangeShortcutEventArgs(AddRemoveEventType type, int Slot, int ObjectId)
{
myType = type;
mySlot = Slot;
myObjectId = ObjectId;
}
}

View file

@ -0,0 +1,30 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangeSpellbarEventArgs : EventArgs
{
private AddRemoveEventType myType;
private int myTab;
private int mySlot;
private int mySpellId;
public AddRemoveEventType Type => myType;
public int Tab => myTab;
public int Slot => mySlot;
public int SpellId => mySpellId;
internal ChangeSpellbarEventArgs(AddRemoveEventType type, int Tab, int Slot, int SpellId)
{
myType = type;
myTab = Tab;
mySlot = Slot;
mySpellId = SpellId;
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class ChangeVitalEventArgs : EventArgs
{
private CharFilterVitalType myType;
private int myAmount;
public CharFilterVitalType Type => myType;
public int Amount => myAmount;
internal ChangeVitalEventArgs(CharFilterVitalType type, int amount)
{
myType = type;
myAmount = amount;
}
}

View file

@ -0,0 +1,14 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public enum CharFilterAttributeType
{
Strength = 1,
Endurance,
Quickness,
Coordination,
Focus,
Self
}

View file

@ -0,0 +1,16 @@
namespace Decal.Adapter.Wrappers;
public enum CharFilterIndex
{
Vassals,
Enchantments,
Vitals,
Attributes,
Skills,
Characters,
Spells,
Augmentations,
EffectiveAttributes,
EffectiveVitals,
EffectiveSkills
}

View file

@ -0,0 +1,57 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public enum CharFilterSkillType
{
Axe = 1,
Bow = 2,
Crossbow = 3,
Dagger = 4,
Mace = 5,
MeleeDefense = 6,
MissileDefense = 7,
Spear = 9,
Staff = 10,
Sword = 11,
ThrownWeapons = 12,
Unarmed = 13,
ArcaneLore = 14,
MagicDefense = 15,
ManaConversion = 16,
ItemTinkering = 18,
AssessPerson = 19,
Deception = 20,
Healing = 21,
Jump = 22,
Lockpick = 23,
Run = 24,
AssessCreature = 27,
WeaponTinkering = 28,
ArmorTinkering = 29,
MagicItemTinkering = 30,
CreatureEnchantment = 31,
ItemEnchantment = 32,
LifeMagic = 33,
WarMagic = 34,
Leadership = 35,
Loyalty = 36,
Fletching = 37,
Alchemy = 38,
Cooking = 39,
Salvaging = 40,
TwoHandedCombat = 41,
Gearcraft = 42,
VoidMagic = 43,
HeavyWeapons = 44,
LightWeapons = 45,
FinesseWeapons = 46,
MissileWeapons = 47,
Shield = 48,
DualWield = 49,
Recklessness = 50,
SneakAttack = 51,
DirtyFighting = 52,
Summoning = 54
}

View file

@ -0,0 +1,11 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public enum CharFilterVitalType
{
Health = 2,
Stamina = 4,
Mana = 6
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,135 @@
using System;
using System.Drawing;
using Decal.Adapter.Support;
using Decal.Interop.Controls;
namespace Decal.Adapter.Wrappers;
public class CheckBoxWrapper : ControlWrapperBase<CheckboxClass>
{
private EventHandler<ControlEventArgs> evtDestroy;
private EventHandler<CheckBoxChangeEventArgs> evtChange;
public bool Checked
{
get
{
return base.Control.Checked;
}
set
{
base.Control.Checked = value;
}
}
public bool RightToLeft
{
get
{
return base.Control.RightToLeft;
}
set
{
base.Control.RightToLeft = value;
}
}
public string Text
{
get
{
return base.Control.Text;
}
set
{
base.Control.Text = value;
}
}
public Color TextColor
{
get
{
return Util.ColorFromBGR(base.Control.TextColor);
}
set
{
base.Control.TextColor = Util.ColorToBGR(value);
}
}
public event EventHandler<CheckBoxChangeEventArgs> Change
{
add
{
if (evtChange == null)
{
base.Control.Change += ChangeEvent;
}
evtChange = (EventHandler<CheckBoxChangeEventArgs>)Delegate.Combine(evtChange, value);
}
remove
{
evtChange = (EventHandler<CheckBoxChangeEventArgs>)Delegate.Remove(evtChange, value);
if (evtChange == null)
{
base.Control.Change -= ChangeEvent;
}
}
}
public event EventHandler<ControlEventArgs> Destroy
{
add
{
if (evtDestroy == null)
{
base.Control.Destroy += DestroyEvent;
}
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
}
remove
{
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
if (evtDestroy == null)
{
base.Control.Destroy -= DestroyEvent;
}
}
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (evtChange != null)
{
evtChange = (EventHandler<CheckBoxChangeEventArgs>)Delegate.Remove(evtChange, evtChange);
base.Control.Change -= ChangeEvent;
}
if (evtDestroy != null)
{
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
base.Control.Destroy -= DestroyEvent;
}
}
base.Dispose(disposing);
}
private void ChangeEvent(int ID, bool Checked)
{
if (evtChange != null)
{
evtChange(this, new CheckBoxChangeEventArgs(ID, Checked));
}
}
private void DestroyEvent(int ID)
{
if (evtDestroy != null)
{
evtDestroy(this, new ControlEventArgs(ID));
}
}
}

View file

@ -0,0 +1,33 @@
using System;
using System.Runtime.InteropServices;
using Decal.Interop.Controls;
namespace Decal.Adapter.Wrappers;
public sealed class ChoiceDataIndexer : IDisposable
{
private Choice myControl;
public object this[int index]
{
get
{
return ((IChoice)myControl).get_Data(index);
}
set
{
((IChoice)myControl).set_Data(index, value);
}
}
internal ChoiceDataIndexer(Choice control)
{
myControl = control;
}
public void Dispose()
{
Marshal.ReleaseComObject(myControl);
myControl = null;
}
}

View file

@ -0,0 +1,31 @@
using System;
using Decal.Interop.Controls;
namespace Decal.Adapter.Wrappers;
public sealed class ChoiceTextIndexer : IDisposable
{
private Choice myControl;
public string this[int index]
{
get
{
return ((IChoice)myControl).get_Text(index);
}
set
{
((IChoice)myControl).set_Text(index, value);
}
}
internal ChoiceTextIndexer(Choice control)
{
myControl = control;
}
public void Dispose()
{
myControl = null;
}
}

View file

@ -0,0 +1,191 @@
using System;
using Decal.Interop.Controls;
namespace Decal.Adapter.Wrappers;
public class ChoiceWrapper : ControlWrapperBase<ChoiceClass>
{
private EventHandler<ControlEventArgs> evtDropDown;
private EventHandler<ControlEventArgs> evtDestroy;
private EventHandler<IndexChangeEventArgs> evtChange;
private ChoiceTextIndexer myTextIndex;
private ChoiceDataIndexer myDataIndex;
public int Count => base.Control.ChoiceCount;
public int DropLines
{
get
{
return base.Control.DropLines;
}
set
{
base.Control.DropLines = value;
}
}
public bool Dropped
{
get
{
return base.Control.Dropped;
}
set
{
base.Control.Dropped = value;
}
}
public int Selected
{
get
{
return base.Control.Selected;
}
set
{
base.Control.Selected = value;
}
}
public ChoiceTextIndexer Text => myTextIndex;
public ChoiceDataIndexer Data => myDataIndex;
public event EventHandler<ControlEventArgs> DropDown
{
add
{
if (evtDropDown == null)
{
base.Control.DropDown += DropDownEvent;
}
evtDropDown = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDropDown, value);
}
remove
{
evtDropDown = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDropDown, value);
if (evtDropDown == null)
{
base.Control.DropDown -= DropDownEvent;
}
}
}
public event EventHandler<ControlEventArgs> Destroy
{
add
{
if (evtDestroy == null)
{
base.Control.Destroy += DestroyEvent;
}
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Combine(evtDestroy, value);
}
remove
{
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, value);
if (evtDestroy == null)
{
base.Control.Destroy -= DestroyEvent;
}
}
}
public event EventHandler<IndexChangeEventArgs> Change
{
add
{
if (evtChange == null)
{
base.Control.Change += ChangeEvent;
}
evtChange = (EventHandler<IndexChangeEventArgs>)Delegate.Combine(evtChange, value);
}
remove
{
evtChange = (EventHandler<IndexChangeEventArgs>)Delegate.Remove(evtChange, value);
if (evtChange == null)
{
base.Control.Change -= ChangeEvent;
}
}
}
[CLSCompliant(false)]
public override void Initialize(object control)
{
base.Initialize(control);
myTextIndex = new ChoiceTextIndexer(base.Control);
myDataIndex = new ChoiceDataIndexer(base.Control);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (evtDropDown != null)
{
evtDropDown = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDropDown, evtDropDown);
base.Control.DropDown -= DropDownEvent;
}
if (evtDestroy != null)
{
evtDestroy = (EventHandler<ControlEventArgs>)Delegate.Remove(evtDestroy, evtDestroy);
base.Control.Destroy -= DestroyEvent;
}
if (evtChange != null)
{
evtChange = (EventHandler<IndexChangeEventArgs>)Delegate.Remove(evtChange, evtChange);
base.Control.Change -= ChangeEvent;
}
myTextIndex.Dispose();
myDataIndex.Dispose();
}
base.Dispose(disposing);
}
public void Add(string display, object data)
{
base.Control.AddChoice(display, data);
}
public void Clear()
{
base.Control.Clear();
}
public void Remove(int index)
{
base.Control.RemoveChoice(index);
}
private void DropDownEvent(int ID)
{
if (evtDropDown != null)
{
evtDropDown(this, new ControlEventArgs(ID));
}
}
private void ChangeEvent(int ID, int Index)
{
if (evtChange != null)
{
evtChange(this, new IndexChangeEventArgs(ID, Index));
}
}
private void DestroyEvent(int ID)
{
if (evtDestroy != null)
{
evtDestroy(this, new ControlEventArgs(ID));
}
}
}

View file

@ -0,0 +1,12 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public enum CombatState
{
Peace = 1,
Melee = 2,
Missile = 4,
Magic = 8
}

View file

@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Decal.Adapter.Support;
using Decal.Interop.Inject;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Used for the registration and creation of control wrappers
/// </summary>
public static class ControlRegistry
{
private static Dictionary<Type, Type> myWrappers;
static ControlRegistry()
{
if (myWrappers == null)
{
myWrappers = new Dictionary<Type, Type>();
RegisterControls(Assembly.GetExecutingAssembly());
}
}
/// <summary>
/// Scans an assembly and registers all of its control wrappers
/// </summary>
/// <param name="assembly">the assembly to scan</param>
public static void RegisterControls(Assembly assembly)
{
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
try
{
Type baseType = type.BaseType;
if (!(baseType == null) && baseType.IsGenericType && baseType.GetGenericTypeDefinition() == typeof(ControlWrapperBase<>))
{
Type key = baseType.GetGenericArguments()[0];
myWrappers.Add(key, type);
}
}
catch (Exception ex)
{
Util.WriteLine("RegisterControls: " + ex.Message);
}
}
}
/// <summary>
/// Creates a control wrapper for the passed in control
/// </summary>
/// <param name="control">the control to wrap</param>
/// <returns>the new wrapper</returns>
internal static IControlWrapper CreateInstance(IControl control)
{
Util.WriteLine("Creating wrapper for: " + control.GetType());
Type value;
IControlWrapper controlWrapper = ((!myWrappers.TryGetValue(control.GetType(), out value)) ? new ControlWrapper() : ((IControlWrapper)Activator.CreateInstance(value)));
controlWrapper.Initialize(control);
return controlWrapper;
}
}

View file

@ -0,0 +1,7 @@
using Decal.Interop.Inject;
namespace Decal.Adapter.Wrappers;
public class ControlWrapper : ControlWrapperBase<IControl>
{
}

View file

@ -0,0 +1,66 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Decal.Interop.Inject;
namespace Decal.Adapter.Wrappers;
public abstract class ControlWrapperBase<T> : MarshalByRefObject, IControlWrapper, IDisposable where T : class
{
private T myControl;
private bool isDisposed;
[EditorBrowsable(EditorBrowsableState.Never)]
public object Underlying => myControl;
public int Id => ((IControl)myControl).ID;
public int ChildCount => ((IControl)myControl).ChildCount;
protected bool Disposed => isDisposed;
protected T Control => myControl;
~ControlWrapperBase()
{
Dispose(disposing: false);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual void Initialize(object control)
{
myControl = control as T;
}
[EditorBrowsable(EditorBrowsableState.Never)]
public object ChildById(int id)
{
return ((IControl)myControl).get_Child(id, ePositionType.ePositionByID);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public object ChildByIndex(int index)
{
return ((IControl)myControl).get_Child(index, ePositionType.ePositionByIndex);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!isDisposed)
{
}
if (myControl != null)
{
Marshal.ReleaseComObject(myControl);
myControl = null;
}
isDisposed = true;
}
}

View file

@ -0,0 +1,149 @@
using System;
namespace Decal.Adapter.Wrappers;
public class CoordsObject
{
private double myNorthSouth;
private double myEastWest;
/// <summary>
/// The north or south component of these coordinates. North is
/// positive and south is negative.
/// </summary>
public double NorthSouth => myNorthSouth;
/// <summary>
/// The east or west component of these coordinates. East is positive
/// and west is negative.
/// </summary>
public double EastWest => myEastWest;
public CoordsObject(double northSouth, double eastWest)
{
myNorthSouth = northSouth;
myEastWest = eastWest;
}
/// <summary>
/// Calculates the straight-line distance between these coordinates
/// and the given coordinates.
/// </summary>
/// <param name="destination">The coordinates to calculate the
/// distance to.</param>
/// <returns>The distance between these coordinates and the given
/// coordinates.</returns>
public double DistanceToCoords(CoordsObject destination)
{
if (destination == null)
{
throw new ArgumentNullException("destination");
}
double num = myNorthSouth - destination.myNorthSouth;
double num2 = myEastWest - destination.myEastWest;
return Math.Sqrt(num * num + num2 * num2);
}
/// <summary>
/// Calculates the angle from these coordinates to the given
/// coordinates, in degrees. North is 0, east is 90, south is 180,
/// and west is 270.
/// </summary>
/// <param name="destination">The coordinates to calculate the
/// angle to.</param>
/// <returns>The angle between these coordinates and the given
/// coordinates.</returns>
public double AngleToCoords(CoordsObject destination)
{
return 180.0 / Math.PI * AngleToCoordsRadians(destination);
}
/// <summary>
/// Calculates the angle from these coordinates to the given
/// coordinates, in radians. North is 0, east is pi/2, south is pi,
/// and west is 3*pi/2.
/// </summary>
/// <param name="destination"></param>
/// <returns></returns>
public double AngleToCoordsRadians(CoordsObject destination)
{
if (destination == null)
{
throw new ArgumentNullException("destination");
}
double num = Math.Atan2(destination.myEastWest - myEastWest, destination.myNorthSouth - myNorthSouth);
if (num < 0.0)
{
num += Math.PI * 2.0;
}
return num;
}
/// <summary>Formats the coordinates like "0.0N, 0.0E"</summary>
/// <returns>The formatted coordinate string.</returns>
public override string ToString()
{
return ToString("0.0");
}
/// <summary>
/// Formats the coordinates using the number style you choose to
/// format the NorthSouth and EastWest numbers.
/// </summary>
/// <param name="numberFormat">The format for the NorthSouth and
/// EastWest numbers. This can be any format string used by
/// double.ToString(). E.g., use "0.00" for 2-digit precision on
/// the coordinates.</param>
/// <returns>The formatted coordinate string.</returns>
public string ToString(string numberFormat)
{
return Math.Abs(myNorthSouth).ToString(numberFormat) + ((myNorthSouth >= 0.0) ? "N" : "S") + ", " + Math.Abs(myEastWest).ToString(numberFormat) + ((myEastWest >= 0.0) ? "E" : "W");
}
public override bool Equals(object obj)
{
if (obj is CoordsObject)
{
CoordsObject coordsObject = (CoordsObject)obj;
if (coordsObject.myNorthSouth == myNorthSouth)
{
return coordsObject.myEastWest == myEastWest;
}
return false;
}
return false;
}
public bool Equals(CoordsObject obj)
{
if (obj == null)
{
return false;
}
if (obj.myNorthSouth == myNorthSouth)
{
return obj.myEastWest == myEastWest;
}
return false;
}
public override int GetHashCode()
{
return myNorthSouth.GetHashCode() ^ myEastWest.GetHashCode();
}
public static bool operator ==(CoordsObject a, CoordsObject b)
{
if (object.Equals(a, null))
{
return object.Equals(b, null);
}
return a.Equals(b);
}
public static bool operator !=(CoordsObject a, CoordsObject b)
{
return !(a == b);
}
}

View file

@ -0,0 +1,15 @@
using System;
namespace Decal.Adapter.Wrappers;
public class CreateObjectEventArgs : EventArgs
{
private WorldObject myNewObject;
public WorldObject New => myNewObject;
internal CreateObjectEventArgs(WorldObject newObject)
{
myNewObject = newObject;
}
}

View file

@ -0,0 +1,414 @@
using Decal.Interop.D3DService;
namespace Decal.Adapter.Wrappers;
public class D3DObj : GenericDisposableWrapper<CD3DObj>
{
/// <summary>
/// Colors
/// </summary>
public int Color
{
get
{
return base.Wrapped.color;
}
set
{
base.Wrapped.color = value;
}
}
public int Color2
{
get
{
return base.Wrapped.color2;
}
set
{
base.Wrapped.color2 = value;
}
}
/// <summary>
/// Autoscale
/// </summary>
public bool Autoscale
{
get
{
return base.Wrapped.autoscale;
}
set
{
base.Wrapped.autoscale = value;
}
}
/// <summary>
/// DrawBackface
/// </summary>
public bool DrawBackface
{
get
{
return base.Wrapped.drawBackface;
}
set
{
base.Wrapped.drawBackface = value;
}
}
/// <summary>
/// HBounce
/// </summary>
public float HBounce
{
get
{
return base.Wrapped.hBounce;
}
set
{
base.Wrapped.hBounce = value;
}
}
/// <summary>
/// PBounce
/// </summary>
public float PBounce
{
get
{
return base.Wrapped.pBounce;
}
set
{
base.Wrapped.pBounce = value;
}
}
/// <summary>
/// PFade
/// </summary>
public float PFade
{
get
{
return base.Wrapped.pFade;
}
set
{
base.Wrapped.pFade = value;
}
}
/// <summary>
/// POrbit
/// </summary>
public float POrbit
{
get
{
return base.Wrapped.pOrbit;
}
set
{
base.Wrapped.pOrbit = value;
}
}
/// <summary>
/// PSpin
/// </summary>
public float PSpin
{
get
{
return base.Wrapped.pSpin;
}
set
{
base.Wrapped.pSpin = value;
}
}
/// <summary>
/// ROrbit
/// </summary>
public float ROrbit
{
get
{
return base.Wrapped.rOrbit;
}
set
{
base.Wrapped.rOrbit = value;
}
}
/// <summary>
/// ScaleX
/// </summary>
public float ScaleX
{
get
{
return base.Wrapped.scaleX;
}
set
{
base.Wrapped.scaleX = value;
}
}
/// <summary>
/// ScaleY
/// </summary>
public float ScaleY
{
get
{
return base.Wrapped.scaleY;
}
set
{
base.Wrapped.scaleY = value;
}
}
/// <summary>
/// ScaleZ
/// </summary>
public float ScaleZ
{
get
{
return base.Wrapped.scaleZ;
}
set
{
base.Wrapped.scaleZ = value;
}
}
/// <summary>
/// Visible
/// </summary>
public bool Visible
{
get
{
return base.Wrapped.visible;
}
set
{
base.Wrapped.visible = value;
}
}
/// <summary>
/// AnimationPhaseOffset
/// </summary>
public float AnimationPhaseOffset
{
get
{
return base.Wrapped.AnimationPhaseOffset;
}
set
{
base.Wrapped.AnimationPhaseOffset = value;
}
}
public D3DObj(CD3DObj obj)
: base(obj)
{
}
protected override void Dispose(bool userCalled)
{
base.Dispose(userCalled);
}
public void Scale(float factor)
{
base.Wrapped.SetScale(factor);
}
/// <summary>
/// Orients to the Camera
/// </summary>
/// <param name="VerticalTilt">Vertical Tilt</param>
public void OrientToCamera(bool verticalTilt)
{
base.Wrapped.OrientToCamera(verticalTilt);
}
/// <summary>
/// Orients to the specified Coordinates
/// </summary>
/// <param name="lat">Latitude</param>
/// <param name="lng">Longitude</param>
/// <param name="alt">Altitude</param>
/// <param name="VerticalTilt">Vertical Tilt</param>
public void OrientToCoords(float lat, float lng, float alt, bool verticalTilt)
{
base.Wrapped.OrientToCoords(lat, lng, alt, verticalTilt);
}
/// <summary>
/// Orients to the specified Object
/// </summary>
/// <param name="guid">Object ID</param>
/// <param name="fractHeight">Relative Position</param>
/// <param name="VerticalTilt">Vertical Tilt</param>
public void OrientToObject(int guid, float fractHeight, bool verticalTilt)
{
base.Wrapped.OrientToObject(guid, fractHeight, verticalTilt);
}
/// <summary>
/// Orients to the Current Player
/// </summary>
/// <param name="VerticalTilt">Vertical Tilt</param>
public void OrientToPlayer(bool verticalTilt)
{
base.Wrapped.OrientToPlayer(verticalTilt);
}
/// <summary>
/// Anchors to the specified Coordinates
/// </summary>
/// <param name="lat">Latitude</param>
/// <param name="lng">Longitude</param>
/// <param name="alt">Altitude</param>
public void Anchor(float lat, float lng, float alt)
{
base.Wrapped.AnchorToCoords(lat, lng, alt);
}
/// <summary>
/// Anchors to the specified Object
/// </summary>
/// <param name="id">Object ID</param>
/// <param name="height">Height</param>
/// <param name="dx">x offset</param>
/// <param name="dy">y offset</param>
/// <param name="dz">z offset</param>
public void Anchor(int id, float height, float dx, float dy, float dz)
{
base.Wrapped.AnchorToObject(id, height, dx, dy, dz);
}
/// <summary>
/// Displays 2D text using the Arial font
/// </summary>
/// <param name="text">Text to display</param>
public void SetText(string text)
{
SetText(D3DTextType.Text2D, text, "Arial", 0);
}
/// <summary>
/// Displays 2D text using the specified font
/// </summary>
/// <param name="text">Text to display</param>
/// <param name="fontName">Font to use</param>
public void SetText(string text, string fontName)
{
SetText(D3DTextType.Text2D, text, fontName, 0);
}
/// <summary>
/// Displays 2D text using the specified font and options
/// </summary>
/// <param name="text">Text to display</param>
/// <param name="fontName">Font to use</param>
/// <param name="options">Options</param>
public void SetText(string text, string fontName, int options)
{
SetText(D3DTextType.Text2D, text, fontName, options);
}
/// <summary>
/// Displays text
/// </summary>
/// <param name="type">Type of text (2D/3D)</param>
/// <param name="text">Text to display</param>
/// <param name="fontName">Font to use</param>
/// <param name="options">Options</param>
public void SetText(D3DTextType type, string text, string fontName, int options)
{
switch (type)
{
case D3DTextType.Text2D:
base.Wrapped.Set2DText(text, fontName, options);
break;
case D3DTextType.Text3D:
base.Wrapped.Set3DText(text, fontName, options);
break;
}
}
/// <summary>
/// Sets the icon to the portal file id
/// </summary>
/// <param name="id">portal file id</param>
public void SetIcon(int id)
{
base.Wrapped.SetIcon(id);
}
/// <summary>
/// Sets the icon from the specified file
/// </summary>
/// <param name="fileName">file containing the icon</param>
public void SetIcon(string fileName)
{
base.Wrapped.SetIconFromFile(fileName);
}
/// <summary>
/// Sets the icon from a resource dll
/// </summary>
/// <param name="module">module handle of the dll</param>
/// <param name="res">resource id</param>
public void SetIcon(int module, int res)
{
base.Wrapped.SetIconFromResource(module, res);
}
/// <summary>
/// Sets the shape to that specified
/// </summary>
/// <param name="shape">Shape to use</param>
public void SetShape(D3DShape shape)
{
base.Wrapped.SetShape((eShape)shape);
}
/// <summary>
/// Sets the shape to that contained in the file
/// </summary>
/// <param name="fileName">File containing the shape definition</param>
public void SetShape(string fileName)
{
base.Wrapped.SetShapeFromFile(fileName);
}
/// <summary>
/// Sets the shape from a resource dll
/// </summary>
/// <param name="module">module handle of the dll</param>
/// <param name="res">resource id</param>
public void SetShape(int module, int res)
{
base.Wrapped.SetShapeFromResource(module, res);
}
}

View file

@ -0,0 +1,180 @@
using Decal.Interop.D3DService;
namespace Decal.Adapter.Wrappers;
public class D3DService : GenericDisposableWrapper<CService>
{
internal D3DService(CService obj)
: base(obj)
{
}
protected override void Dispose(bool userCalled)
{
base.Dispose(userCalled);
}
/// <summary>
/// Makes a new D3DObj
/// </summary>
public D3DObj NewD3DObj()
{
return new D3DObj(base.Wrapped.NewD3DObj());
}
/// <summary>
/// Creates an arrow that points to an object
/// </summary>
/// <param name="guid">Object ID</param>
/// <param name="color">Color</param>
public D3DObj PointToObject(int guid, int color)
{
return new D3DObj(base.Wrapped.PointToObject(guid, color));
}
/// <summary>
/// Creates an arrow that points to specified Coordinates
/// </summary>
/// <param name="lat">Latitude</param>
/// <param name="lng">Longitude</param>
/// <param name="alt">Altitude</param>
/// <param name="color">Color</param>
public D3DObj PointToCoords(float lat, float lng, float alt, int color)
{
return new D3DObj(base.Wrapped.PointToCoords(lat, lng, alt, color));
}
/// <summary>
/// Mark an Object with an Icon
/// </summary>
/// <param name="guid">Object ID</param>
/// <param name="icon">Portal.dat Icon</param>
public D3DObj MarkObjectWithIcon(int guid, int icon)
{
return new D3DObj(base.Wrapped.MarkObjectWithIcon(guid, icon));
}
/// <summary>
/// Mark an Object with a Shape
/// </summary>
/// <param name="guid">Object ID</param>
/// <param name="shape">D3DShape</param>
/// <param name="color">Color</param>
public D3DObj MarkObjectWithShape(int guid, D3DShape shape, int color)
{
return new D3DObj(base.Wrapped.MarkObjectWithShape(guid, (eShape)shape, color));
}
/// <summary>
/// Mark an Object with a Shape
/// </summary>
/// <param name="guid">Object ID</param>
/// <param name="filename">Mesh filename</param>
/// <param name="color">Color</param>
public D3DObj MarkObjectWithShapeFromFile(int guid, string filename, int color)
{
return new D3DObj(base.Wrapped.MarkObjectWithShapeFromFile(guid, filename, color));
}
/// <summary>
/// Mark an Object with 2DText
/// </summary>
/// <param name="guid">Object ID</param>
/// <param name="szText">Text</param>
/// <param name="szFont">Font</param>
/// <param name="options">zero or more option flags from DecalPlugins::eFontOptions</param>
public D3DObj MarkObjectWith2DText(int guid, string szText, string szFont, int options)
{
return new D3DObj(base.Wrapped.MarkObjectWith2DText(guid, szText, szFont, options));
}
/// <summary>
/// Mark an Object with 3DText
/// </summary>
/// <param name="guid">Object ID</param>
/// <param name="szText">Text</param>
/// <param name="szFont">Font</param>
/// <param name="options">zero or more option flags from DecalPlugins::eFontOptions</param>
public D3DObj MarkObjectWith3DText(int guid, string szText, string szFont, int options)
{
return new D3DObj(base.Wrapped.MarkObjectWith3DText(guid, szText, szFont, options));
}
/// <summary>
/// Mark specified Coordinates with Icon
/// </summary>
/// <param name="lat">Latitude</param>
/// <param name="lng">Longitude</param>
/// <param name="alt">Altitude</param>
/// <param name="icon">Portal.dat Icon</param>
public D3DObj MarkCoordsWithIcon(float lat, float lng, float alt, int icon)
{
return new D3DObj(base.Wrapped.MarkCoordsWithIcon(lat, lng, alt, icon));
}
/// <summary>
/// Mark specified Coordinates with Icon
/// </summary>
/// <param name="lat">Latitude</param>
/// <param name="lng">Longitude</param>
/// <param name="alt">Altitude</param>
/// <param name="file">Icon filename</param>
public D3DObj MarkCoordsWithIconFromFile(float lat, float lng, float alt, string file)
{
return new D3DObj(base.Wrapped.MarkCoordsWithIconFromFile(lat, lng, alt, file));
}
/// <summary>
/// Mark specified Coordinates with Shape
/// </summary>
/// <param name="lat">Latitude</param>
/// <param name="lng">Longitude</param>
/// <param name="alt">Altitude</param>
/// <param name="shape">D3DShape</param>
/// <param name="color">Color</param>
public D3DObj MarkCoordsWithShape(float lat, float lng, float alt, D3DShape shape, int color)
{
return new D3DObj(base.Wrapped.MarkCoordsWithShape(lat, lng, alt, (eShape)shape, color));
}
/// <summary>
/// Mark specified Coordinates with Shape
/// </summary>
/// <param name="lat">Latitude</param>
/// <param name="lng">Longitude</param>
/// <param name="alt">Altitude</param>
/// <param name="file">Mesh filename</param>
/// <param name="color">Color</param>
public D3DObj MarkCoordsWithShapeFromFile(float lat, float lng, float alt, string file, int color)
{
return new D3DObj(base.Wrapped.MarkCoordsWithShapeFromFile(lat, lng, alt, file, color));
}
/// <summary>
/// Mark specified Coordinates with 2DText
/// </summary>
/// <param name="lat">Latitude</param>
/// <param name="lng">Longitude</param>
/// <param name="alt">Altitude</param>
/// <param name="szText">Text</param>
/// <param name="szFont">Font</param>
/// <param name="options">zero or more option flags from DecalPlugins::eFontOptions</param>
public D3DObj MarkCoordsWith2DText(float lat, float lng, float alt, string szText, string szFont, int options)
{
return new D3DObj(base.Wrapped.MarkCoordsWith2DText(lat, lng, alt, szText, szFont, options));
}
/// <summary>
/// Mark specified Coordinates with 3DText
/// </summary>
/// <param name="lat">Latitude</param>
/// <param name="lng">Longitude</param>
/// <param name="alt">Altitude</param>
/// <param name="szText">Text</param>
/// <param name="szFont">Font</param>
/// <param name="options">zero or more option flags from DecalPlugins::eFontOptions</param>
public D3DObj MarkCoordsWith3DText(float lat, float lng, float alt, string szText, string szFont, int options)
{
return new D3DObj(base.Wrapped.MarkCoordsWith3DText(lat, lng, alt, szText, szFont, options));
}
}

View file

@ -0,0 +1,12 @@
namespace Decal.Adapter.Wrappers;
public enum D3DShape
{
HorizontalArrow,
VerticalArrow,
Ring,
Cylinder,
Sphere,
Cube,
TiltedCube
}

View file

@ -0,0 +1,7 @@
namespace Decal.Adapter.Wrappers;
public enum D3DTextType
{
Text2D,
Text3D
}

View file

@ -0,0 +1,15 @@
using System;
namespace Decal.Adapter.Wrappers;
public class DeathEventArgs : EventArgs
{
private string myText;
public string Text => myText;
internal DeathEventArgs(string text)
{
myText = text;
}
}

View file

@ -0,0 +1,84 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Decal.Adapter.Support;
using Decal.Interop.Core;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class DecalWrapper : MarshalByRefObject, IDisposable
{
internal static Guid IID_IDISPATCH = new Guid("{00020400-0000-0000-C000-000000000046}");
internal static Guid IID_IUNKNOWN = new Guid("{00000000-0000-0000-C000-000000000046}");
private DecalCore myDecal;
private bool isDisposed;
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public DecalCore Underlying => myDecal;
public IntPtr Hwnd => new IntPtr(myDecal.HWND);
public bool Focus => myDecal.Focus;
internal DecalWrapper(DecalCore decal)
{
myDecal = decal;
}
~DecalWrapper()
{
Dispose(disposing: false);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (!isDisposed)
{
}
if (myDecal != null)
{
Marshal.ReleaseComObject(myDecal);
myDecal = null;
}
isDisposed = true;
}
public object GetObject(string path)
{
return GetObject(path, IID_IDISPATCH);
}
public object GetObject(string path, string iid)
{
return GetObject(path, new Guid(iid));
}
public object GetObject(string path, Guid iid)
{
try
{
return ((IDecalCore)myDecal).get_Object(path, ref iid);
}
catch (Exception ex)
{
Util.WriteLine("Exception for {0} during get_Object: {1}", path, ex);
return null;
}
}
public string MapPath(string path)
{
return myDecal.MapPath(path);
}
}

View file

@ -0,0 +1,15 @@
using System;
namespace Decal.Adapter.Wrappers;
public class DeclineTradeEventArgs : EventArgs
{
private int mTraderId;
public int TraderId => mTraderId;
internal DeclineTradeEventArgs(int TraderId)
{
mTraderId = TraderId;
}
}

View file

@ -0,0 +1,29 @@
namespace Decal.Adapter.Wrappers;
public enum DoubleValueKey
{
SlashProt = 167772160,
PierceProt = 167772161,
BludgeonProt = 167772162,
AcidProt = 167772163,
LightningProt = 167772164,
FireProt = 167772165,
ColdProt = 167772166,
Heading = 167772167,
ApproachDistance = 167772168,
SalvageWorkmanship = 167772169,
Scale = 167772170,
Variance = 167772171,
AttackBonus = 167772172,
Range = 167772173,
DamageBonus = 167772174,
ManaRateOfChange = 5,
MeleeDefenseBonus = 29,
ManaTransferEfficiency = 87,
HealingKitRestoreBonus = 100,
ManaStoneChanceDestruct = 137,
ManaCBonus = 144,
MissileDBonus = 149,
MagicDBonus = 150,
ElementalDamageVersusMonsters = 152
}

View file

@ -0,0 +1,87 @@
using System;
using Decal.Adapter.NetParser;
using Decal.Adapter.Support;
using Decal.Interop.Filters;
using Decal.Interop.Net;
namespace Decal.Adapter.Wrappers;
public class EchoFilter2 : GenericDisposableWrapper<Decal.Interop.Filters.EchoFilter2>
{
private event EventHandler<NetworkMessageEventArgs> serverDispatch;
private event EventHandler<NetworkMessageEventArgs> clientDispatch;
/// <summary>
/// Fires when the client receives a message from the server
/// </summary>
public event EventHandler<NetworkMessageEventArgs> ServerDispatch
{
add
{
serverDispatch += value;
}
remove
{
serverDispatch -= value;
}
}
/// <summary>
/// Fires when the client sends a message to the server
/// </summary>
public event EventHandler<NetworkMessageEventArgs> ClientDispatch
{
add
{
clientDispatch += value;
}
remove
{
clientDispatch -= value;
}
}
public EchoFilter2(Decal.Interop.Filters.EchoFilter2 obj)
: base(obj)
{
base.Wrapped.EchoClient += onEchoClient;
base.Wrapped.EchoServer += onEchoServer;
}
protected override void Dispose(bool userCalled)
{
if (userCalled && base.Wrapped != null)
{
base.Wrapped.EchoClient -= onEchoClient;
base.Wrapped.EchoServer -= onEchoServer;
}
base.Dispose(userCalled);
}
private void onEchoServer(IMessage2 pMsg)
{
try
{
Message message = null;
Util.SafeFireEvent(args: new NetworkMessageEventArgs((!(pMsg is MessageWrapper messageWrapper)) ? new Message(pMsg, MessageDirection.Inbound) : messageWrapper.Wrapped), sender: this, eventHandler: this.serverDispatch);
}
catch (Exception ex)
{
Util.WriteLine("Exception in onEchoServer {0}", ex);
}
}
private void onEchoClient(IMessage2 pMsg)
{
try
{
Message message = null;
Util.SafeFireEvent(args: new NetworkMessageEventArgs((!(pMsg is MessageWrapper messageWrapper)) ? new Message(pMsg, MessageDirection.Inbound) : messageWrapper.Wrapped), sender: this, eventHandler: this.clientDispatch);
}
catch (Exception ex)
{
Util.WriteLine("Exception in onEchoClient {0}", ex);
}
}
}

View file

@ -0,0 +1,66 @@
using System;
using System.Runtime.InteropServices;
using Decal.Interop.Filters;
namespace Decal.Adapter.Wrappers;
public class EnchantmentWrapper : MarshalByRefObject, IDisposable
{
private Enchantment myEnchantment;
private bool isDisposed;
public double Adjustment => myEnchantment.Adjustment;
public int Affected => myEnchantment.Affected;
public int AffectedMask => myEnchantment.AffectedMask;
public double Duration => myEnchantment.Duration;
public int Family => myEnchantment.Family;
public int Layer => myEnchantment.Layer;
public int SpellId => myEnchantment.SpellID;
public int TimeRemaining => myEnchantment.TimeRemaining;
public DateTime Expires => DateTime.Now.AddSeconds(TimeRemaining);
internal EnchantmentWrapper(Enchantment enchant)
{
myEnchantment = enchant;
}
~EnchantmentWrapper()
{
Dispose(disposing: false);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!isDisposed)
{
}
if (myEnchantment != null)
{
Marshal.ReleaseComObject(myEnchantment);
}
isDisposed = true;
}
protected void EnforceDisposedOnce()
{
if (isDisposed)
{
throw new ObjectDisposedException("EnchantmentWrapper");
}
}
}

View file

@ -0,0 +1,15 @@
using System;
namespace Decal.Adapter.Wrappers;
public class EndTradeEventArgs : EventArgs
{
private int mReasonId;
public int ReasonId => mReasonId;
internal EndTradeEventArgs(int ReasonId)
{
mReasonId = ReasonId;
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class EnterTradeEventArgs : EventArgs
{
private int mTraderId;
private int mTradeeId;
public int TraderId => mTraderId;
public int TradeeId => mTradeeId;
internal EnterTradeEventArgs(int TraderId, int TradeeId)
{
mTraderId = TraderId;
mTradeeId = TradeeId;
}
}

View file

@ -0,0 +1,20 @@
using System;
namespace Decal.Adapter.Wrappers;
public class FailToAddTradeItemEventArgs : EventArgs
{
private int mItemId;
private int mReasonId;
public int ItemId => mItemId;
public int ReasonId => mReasonId;
internal FailToAddTradeItemEventArgs(int ItemId, int ReasonId)
{
mItemId = ItemId;
mReasonId = ReasonId;
}
}

View file

@ -0,0 +1,13 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public enum FellowshipEventType
{
Create,
Quit,
Dismiss,
Recruit,
Disband
}

View file

@ -0,0 +1,26 @@
using System;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// FontWeight for use in HUD Rendering
/// </summary>
[CLSCompliant(true)]
public enum FontWeight
{
Black = 900,
Bold = 700,
DemiBold = 600,
DoNotCare = 0,
ExtraBold = 800,
ExtraLight = 200,
Heavy = 900,
Light = 300,
Medium = 500,
Normal = 400,
Regular = 400,
SemiBold = 600,
Thin = 100,
UltraBold = 800,
UltraLight = 200
}

View file

@ -0,0 +1,23 @@
using System;
using System.Globalization;
namespace Decal.Adapter.Wrappers;
/// <summary>
/// Support class for HooksWrapper
/// This class
/// </summary>
public sealed class HookIndexer<IndexType> : MarshalByRefObject where IndexType : struct, IConvertible
{
private hookIndexType myIndex;
private IIndexedValueProvider myWrap;
public int this[IndexType item] => myWrap.GetIndexedObject(myIndex, item.ToInt32(CultureInfo.InvariantCulture));
internal HookIndexer(IIndexedValueProvider wrap, hookIndexType index)
{
myIndex = index;
myWrap = wrap;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,75 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public abstract class HostBase : MarshalByRefObject, IDisposable
{
private HooksWrapper myInternalHooks;
private DecalWrapper myInternalDecal;
private RenderServiceWrapper myInternalRender;
private bool isDisposed;
protected bool IsDisposed => isDisposed;
protected DecalWrapper MyDecal
{
get
{
return myInternalDecal;
}
set
{
myInternalDecal = value;
}
}
protected RenderServiceWrapper MyRender
{
get
{
return myInternalRender;
}
set
{
myInternalRender = value;
}
}
~HostBase()
{
Dispose(disposing: false);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!isDisposed && disposing)
{
if (myInternalHooks != null)
{
myInternalHooks.Dispose();
}
if (myInternalDecal != null)
{
myInternalDecal.Dispose();
}
if (myInternalRender != null)
{
myInternalRender.Dispose();
}
}
myInternalHooks = null;
myInternalDecal = null;
myInternalRender = null;
isDisposed = true;
}
}

View file

@ -0,0 +1,31 @@
using System;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class HotkeyEventArgs : EventArgs
{
private string myTitle;
private bool myEat;
public string Title => myTitle;
public bool Eat
{
get
{
return myEat;
}
set
{
myEat = value;
}
}
internal HotkeyEventArgs(string Title, bool Eat)
{
myTitle = Title;
myEat = Eat;
}
}

View file

@ -0,0 +1,133 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Decal.Interop.DHS;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class HotkeySystem : MarshalByRefObject, IDisposable
{
private Decal.Interop.DHS.HotkeySystem myHKS;
private bool isDisposed;
private EventHandler<HotkeyEventArgs> mHotkey;
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public Decal.Interop.DHS.HotkeySystem Underlying => myHKS;
public event EventHandler<HotkeyEventArgs> Hotkey
{
add
{
mHotkey = (EventHandler<HotkeyEventArgs>)Delegate.Combine(mHotkey, value);
}
remove
{
mHotkey = (EventHandler<HotkeyEventArgs>)Delegate.Remove(mHotkey, value);
}
}
internal HotkeySystem(Decal.Interop.DHS.HotkeySystem hks)
{
myHKS = hks;
myHKS.HotkeyEvent += myHKS_HotkeyEvent;
}
~HotkeySystem()
{
Dispose(disposing: false);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!isDisposed && disposing && myHKS != null)
{
myHKS.HotkeyEvent -= myHKS_HotkeyEvent;
}
if (myHKS != null)
{
Marshal.ReleaseComObject(myHKS);
}
isDisposed = true;
}
public void AddHotkey(string szPlugin, HotkeyWrapper hotkey)
{
if (hotkey == null)
{
throw new ArgumentNullException("hotkey");
}
AddHotkey(szPlugin, hotkey.Underlying);
}
public void AddHotkey(string szPlugin, string szTitle, string szDescription)
{
Hotkey hotkey = new HotkeyClass();
hotkey.EventTitle = szTitle;
hotkey.EventDescription = szDescription;
AddHotkey(szPlugin, hotkey);
Marshal.ReleaseComObject(hotkey);
}
public void AddHotkey(string plugin, string title, string description, int virtualKey, bool altState, bool controlState, bool shiftState)
{
Hotkey hotkey = new HotkeyClass();
hotkey.EventTitle = title;
hotkey.EventDescription = description;
hotkey.VirtualKey = virtualKey;
hotkey.AltState = altState;
hotkey.ControlState = controlState;
hotkey.ShiftState = shiftState;
AddHotkey(plugin, hotkey);
Marshal.ReleaseComObject(hotkey);
}
private void AddHotkey(string szPlugin, Hotkey hotkey)
{
if (hotkey == null)
{
throw new ArgumentNullException("hotkey");
}
myHKS.AddHotkey(szPlugin, hotkey);
}
public void DeleteHotkey(string plugin, string hotkeyName)
{
myHKS.DeleteHotkey(plugin, hotkeyName);
}
public bool Exists(string hotkeyName)
{
return myHKS.QueryHotkey(hotkeyName);
}
public HotkeyWrapper GetHotkey(string plugin, string hotkeyName)
{
Hotkey hotkey = myHKS.QueryHotkeyEx(plugin, hotkeyName);
HotkeyWrapper result = null;
if (hotkey != null)
{
result = new HotkeyWrapper(hotkey);
}
return result;
}
private void myHKS_HotkeyEvent(string szTitle, ref bool Eat)
{
if (mHotkey != null)
{
HotkeyEventArgs e = new HotkeyEventArgs(szTitle, Eat);
mHotkey(this, e);
Eat = e.Eat;
}
}
}

View file

@ -0,0 +1,82 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Decal.Interop.DHS;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class HotkeyWrapper : MarshalByRefObject, IDisposable
{
private Hotkey myHotkey;
private bool isDisposed;
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public Hotkey Underlying => myHotkey;
public bool AltState => myHotkey.AltState;
public bool ControlState => myHotkey.ControlState;
public bool ShiftState => myHotkey.ShiftState;
public int VirtualKey => myHotkey.VirtualKey;
public string Title => myHotkey.EventTitle;
public string Description => myHotkey.EventDescription;
internal HotkeyWrapper(Hotkey hotkey)
{
myHotkey = hotkey;
}
public HotkeyWrapper(string title, string description)
: this(new HotkeyClass())
{
myHotkey.EventTitle = title;
myHotkey.EventDescription = description;
}
public HotkeyWrapper(string title, string description, int virtualKey, bool altState, bool controlState, bool shiftState)
: this(title, description)
{
myHotkey.VirtualKey = virtualKey;
myHotkey.AltState = altState;
myHotkey.ControlState = controlState;
myHotkey.ShiftState = shiftState;
}
~HotkeyWrapper()
{
Dispose(disposing: false);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!isDisposed)
{
}
if (myHotkey != null)
{
Marshal.ReleaseComObject(myHotkey);
}
isDisposed = true;
}
protected void EnforceDisposedOnce()
{
if (isDisposed)
{
throw new ObjectDisposedException("HotkeyWrapper");
}
}
}

View file

@ -0,0 +1,92 @@
using System;
using System.Runtime.InteropServices;
using Decal.Interop.Render;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class Hud : HudRenderScalable
{
private HUDView internalView;
internal HUDView Underlying => internalView;
public bool Enabled
{
get
{
return internalView.Enabled;
}
set
{
internalView.Enabled = value;
}
}
public int Id => internalView.ID;
/// <summary>
/// Angle in Radians for rotation of the HUD
/// </summary>
public float Angle
{
get
{
return internalView.Angle;
}
set
{
internalView.Angle = value;
}
}
/// <summary>
/// Alpha for entire hud
/// </summary>
public int Alpha
{
get
{
return internalView.Alpha;
}
set
{
internalView.Alpha = value;
}
}
internal event EventHandler Disposing;
internal Hud(HUDView view)
: base(view)
{
internalView = view;
}
public void SetBackground(Background background)
{
if (background != null)
{
internalView.SetBackground(background.Underlying);
return;
}
throw new ArgumentNullException("background");
}
protected override void Dispose(bool disposing)
{
try
{
if (disposing && this.Disposing != null)
{
this.Disposing(this, new EventArgs());
}
Marshal.ReleaseComObject(internalView);
internalView = null;
}
finally
{
base.Dispose(disposing);
}
}
}

View file

@ -0,0 +1,66 @@
using System;
using System.Drawing;
using Decal.Adapter.Support;
using Decal.Interop.Core;
using Decal.Interop.Render;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class HudRenderScalable : HudRenderTarget
{
private IRenderScalable myScalable;
/// <summary>
/// Returns the Area scaling has caused the Hud to encompass
/// </summary>
public Rectangle ScaleRect => Util.toRectangle(myScalable.ScaleRect);
/// <summary>
/// Scale the width and height of the Hud by the specified value keeping the current position.
/// This will not return 'good' values when using ScaleTo
/// </summary>
public float ScaleFactor
{
get
{
return myScalable.ScaleFactor;
}
set
{
myScalable.ScaleFactor = value;
}
}
/// <summary>
/// Specifies whether or not Scaling is occuring (setting to false disables scaling)
/// </summary>
public bool Scaling
{
get
{
return myScalable.Scaling;
}
set
{
myScalable.Scaling = value;
}
}
[CLSCompliant(false)]
protected HudRenderScalable(IRenderScalable newTarget)
: base(newTarget)
{
myScalable = newTarget;
}
/// <summary>
/// Scales the Hud to fill the area specified
/// </summary>
/// <param name="rect">Area for the Hud to encompass</param>
public void ScaleTo(Rectangle rect)
{
tagRECT pArea = Util.toTagRECT(rect);
myScalable.ScaleTo(ref pArea);
}
}

View file

@ -0,0 +1,429 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using Decal.Adapter.Support;
using Decal.Interop.Core;
using Decal.Interop.Render;
namespace Decal.Adapter.Wrappers;
[CLSCompliant(true)]
public class HudRenderTarget : MarshalByRefObject, IDisposable
{
private IRenderTarget myTarget;
private bool isDisposed;
private Rectangle areaRect;
private bool inRender;
private bool inText;
public bool Lost => myTarget.Lost;
[EditorBrowsable(EditorBrowsableState.Never)]
public Rectangle Constraint
{
get
{
Rectangle region = Region;
return new Rectangle(0, 0, region.Width, region.Height);
}
}
public Rectangle Region
{
get
{
return Util.toRectangle(myTarget.Region);
}
set
{
tagRECT pVal = Util.toTagRECT(value);
myTarget.Region = ref pVal;
areaRect.Width = value.Width;
areaRect.Height = value.Height;
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public object UnsafeSurface => myTarget.GetSurface();
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public tagRECT UnsafeRegion
{
get
{
return myTarget.Region;
}
set
{
myTarget.Region = ref value;
}
}
protected bool IsDisposed => isDisposed;
[CLSCompliant(false)]
protected HudRenderTarget(IRenderTarget newTarget)
{
if (newTarget == null)
{
throw new ArgumentNullException("newTarget");
}
myTarget = newTarget;
tagRECT region = myTarget.Region;
areaRect = new Rectangle(0, 0, region.right - region.left, region.bottom - region.top);
}
~HudRenderTarget()
{
Dispose(disposing: false);
}
/// <summary>
/// Begin rendering to this object, must be paired with EndRender
/// </summary>
public void BeginRender()
{
BeginRender(enableTextureFilter: false);
}
/// <summary>
/// Begin rendering to this object, must be paired with EndRender
/// </summary>
/// <param name="enableTextureFilter">True to enable texture filtering during rendering</param>
public void BeginRender(bool enableTextureFilter)
{
if (!inRender)
{
myTarget.BeginRender(enableTextureFilter);
inRender = true;
return;
}
throw new RenderViolationException("Cannot call 'BeginRender' when already rendering");
}
/// <summary>
/// End rendering to this object, must be paired with BeginRender
/// </summary>
public void EndRender()
{
if (inRender)
{
myTarget.EndRender();
inRender = false;
return;
}
throw new RenderViolationException("Cannot call 'EndRender' without a previous call to 'BeginRender'");
}
/// <summary>
/// Begin writing text
/// </summary>
/// <param name="fontName">Name of the font to use for writing text</param>
/// <param name="pixelHeight">Height in pixels to use when writing text</param>
public void BeginText(string fontName, int pixelHeight)
{
BeginText(fontName, pixelHeight, FontWeight.Normal, italic: false);
}
/// <summary>
/// Begin writing text
/// </summary>
/// <param name="fontName">Name of the font to use for writing text</param>
/// <param name="pixelHeight">Height in pixels to use when writing text</param>
/// <param name="weight">Bold, Strong, etc, indicator for text to be written</param>
/// <param name="italic">Write text in italics?</param>
public void BeginText(string fontName, int pixelHeight, FontWeight weight, bool italic)
{
UnsafeBeginText(fontName, pixelHeight, (int)weight, italic);
}
/// <summary>
/// Display text,using the full rectangle of the render target as the area.
/// This overload will draw the text in black.
/// </summary>
/// <param name="text">Text to display</param>
public void WriteText(string text)
{
WriteText(text, Color.Black, WriteTextFormats.None, areaRect);
}
/// <summary>
/// Display text,using the full rectangle of the render target as the area.
/// </summary>
/// <param name="text">Text to display</param>
/// <param name="color">Color to use to display the text. (Including alpha channel)</param>
public void WriteText(string text, Color color)
{
WriteText(text, color, WriteTextFormats.None, areaRect);
}
/// <summary>
/// Display text,using the full rectangle of the render target as the area.
/// </summary>
/// <param name="text">Text to display</param>
/// <param name="color">Color to use to display the text. (Including alpha channel)</param>
/// <param name="format">Format specifiers, including centered, etc.</param>
/// <param name="region">Rectangle relative to this object to use to bound the text</param>
public void WriteText(string text, Color color, WriteTextFormats format, Rectangle region)
{
UnsafeWriteText(Util.toTagRECT(region), color.ToArgb(), (int)format, text);
}
/// <summary>
/// Display text,using the full rectangle of the render target as the area.
/// </summary>
/// <param name="text">Text to display</param>
/// <param name="color">Color to use to display the text. (Including alpha channel)</param>
/// <param name="format">Format specifiers, including centered, etc.</param>
/// <param name="region">Rectangle relative to this object to use to bound the text</param>
public void WriteText(string text, int color, WriteTextFormats format, Rectangle region)
{
UnsafeWriteText(Util.toTagRECT(region), color, (int)format, text);
}
/// <summary>
/// End drawing of text.
/// </summary>
public void EndText()
{
if (inRender && inText)
{
myTarget.EndText();
inText = false;
return;
}
throw new RenderViolationException("Cannot call 'EndText' without a previous call to 'BeginText'");
}
public void Clear()
{
Clear(areaRect);
}
public void Clear(Rectangle clearArea)
{
UnsafeClear(Util.toTagRECT(clearArea));
}
public void DrawPortalImage(int portalFile, Rectangle destinationArea)
{
UnsafeDrawPortalImage(portalFile, Util.toTagRECT(destinationArea));
}
public void DrawPortalImage(int portalFile, int alpha, Rectangle srcArea, Rectangle destinationArea)
{
UnsafeDrawPortalImage(portalFile, alpha, Util.toTagRECT(srcArea), Util.toTagRECT(destinationArea));
}
public void DrawPortalImage(int portalFile, Rectangle srcArea, Rectangle destinationArea)
{
UnsafeDrawPortalImage(portalFile, 255, Util.toTagRECT(srcArea), Util.toTagRECT(destinationArea));
}
public void TilePortalImage(int portalFile, Rectangle destinationArea)
{
UnsafeTilePortalImage(portalFile, Util.toTagRECT(destinationArea));
}
public void TilePortalImage(int portalFile, Rectangle srcArea, Rectangle destinationArea)
{
UnsafeTilePortalImage(portalFile, Util.toTagRECT(srcArea), Util.toTagRECT(destinationArea));
}
public void DrawImage(Image image, Rectangle destinationRegion)
{
DrawImage(image, destinationRegion, Color.Cyan.ToArgb());
}
public void DrawImage(Image image, Rectangle destinationRegion, Color colorKey)
{
DrawImage(image, destinationRegion, colorKey.ToArgb());
}
public void DrawImage(Image image, Rectangle destinationRegion, int colorKey)
{
if (image == null)
{
throw new ArgumentNullException("image");
}
MemoryStream memoryStream = new MemoryStream();
image.Save(memoryStream, ImageFormat.Bmp);
byte[] buffer = memoryStream.GetBuffer();
IntPtr zero = IntPtr.Zero;
int num = buffer.Length;
zero = Marshal.AllocCoTaskMem(num);
try
{
Marshal.Copy(buffer, 0, zero, num);
if (zero != IntPtr.Zero)
{
UnsafeDrawImage(zero, num, Util.toTagRECT(destinationRegion), colorKey);
}
}
finally
{
Marshal.FreeCoTaskMem(zero);
memoryStream.Dispose();
}
}
public void Fill(Color color)
{
Fill(areaRect, color);
}
public void Fill(Rectangle fillArea, Color color)
{
Fill(fillArea, color.ToArgb());
}
public void Fill(Rectangle fillArea, int color)
{
UnsafeFill(Util.toTagRECT(fillArea), color);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeBeginText(string fontName, int pixelHeight, int weight, bool italic)
{
if (inRender && !inText)
{
myTarget.BeginText(fontName, pixelHeight, weight, italic);
inText = true;
return;
}
if (inRender && inText)
{
throw new RenderViolationException("Cannot call 'BeginText' when already rendering text");
}
throw new RenderViolationException("Cannot call 'BeginText' outside of a BeginRender/EndRender block");
}
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeWriteText(tagRECT region, int color, int format, string text)
{
if (inRender && inText)
{
myTarget.WriteText(ref region, color, format, text);
return;
}
throw new RenderViolationException("Cannot call 'WriteText' outside of a BeginText/EndText block");
}
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeClear(tagRECT clearArea)
{
if (!inRender)
{
myTarget.Clear(ref clearArea);
return;
}
throw new RenderViolationException("MUST call 'Clear' outside of a BeginRender/EndRender block");
}
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeDrawPortalImage(int portalFile, tagRECT destinationArea)
{
if (inRender)
{
myTarget.DrawPortalImage(portalFile, ref destinationArea);
return;
}
throw new RenderViolationException("Cannot call 'DrawPortalImage' outside of a BeginRender/EndRender block");
}
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeDrawPortalImage(int portalFile, int alpha, tagRECT srcArea, tagRECT destinationArea)
{
if (inRender)
{
myTarget.DrawPortalImageEx(portalFile, alpha, ref srcArea, ref destinationArea);
return;
}
throw new RenderViolationException("Cannot call 'DrawPortalImageEx' outside of a BeginRender/EndRender block");
}
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeTilePortalImage(int portalFile, tagRECT destinationArea)
{
if (inRender)
{
myTarget.TilePortalImage(portalFile, ref destinationArea);
return;
}
throw new RenderViolationException("Cannot call 'TilePortalImage' outside of a BeginRender/EndRender block");
}
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeTilePortalImage(int portalFile, tagRECT srcArea, tagRECT destinationArea)
{
if (inRender)
{
myTarget.TilePortalImageEx(portalFile, ref srcArea, ref destinationArea);
return;
}
throw new RenderViolationException("Cannot call 'TilePortalImageEx' outside of a BeginRender/EndRender block");
}
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeDrawImage(IntPtr buffer, int size, tagRECT destinationRegion, int colorKey)
{
if (inRender)
{
myTarget.DrawImage((int)buffer, size, ref destinationRegion, colorKey);
return;
}
throw new RenderViolationException("Cannot call 'DrawImage' outside of a BeginRender/EndRender block");
}
[CLSCompliant(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeFill(tagRECT fillArea, int color)
{
if (!inRender)
{
myTarget.Fill(ref fillArea, color);
return;
}
throw new RenderViolationException("MUST call 'Fill' outside of a BeginRender/EndRender block");
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void UnsafeSetSurface(object pSurface)
{
myTarget.SetSurface(pSurface);
}
public void Dispose()
{
Dispose(disposing: true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!isDisposed)
{
}
if (myTarget != null)
{
Marshal.ReleaseComObject(myTarget);
}
myTarget = null;
isDisposed = true;
}
}

View file

@ -0,0 +1,22 @@
using System.ComponentModel;
namespace Decal.Adapter.Wrappers;
public interface IControlWrapper
{
[EditorBrowsable(EditorBrowsableState.Never)]
object Underlying { get; }
int Id { get; }
int ChildCount { get; }
[EditorBrowsable(EditorBrowsableState.Never)]
void Initialize(object control);
[EditorBrowsable(EditorBrowsableState.Never)]
object ChildById(int id);
[EditorBrowsable(EditorBrowsableState.Never)]
object ChildByIndex(int index);
}

View file

@ -0,0 +1,12 @@
using System.Collections;
namespace Decal.Adapter.Wrappers;
public interface IIndexedProvider<IndexType>
{
object GetIndexedObject(IndexType index, int item);
IEnumerator GetEnumerator(IndexType index);
int Count(IndexType index);
}

View file

@ -0,0 +1,6 @@
namespace Decal.Adapter.Wrappers;
internal interface IIndexedValueProvider
{
int GetIndexedObject(hookIndexType index, int item);
}

View file

@ -0,0 +1,14 @@
using System.Reflection;
namespace Decal.Adapter.Wrappers;
public interface IViewHandler
{
ViewWrapper DefaultView { get; }
BindingFlags BindingFlags { get; }
void LoadView(string name, string resource);
ViewWrapper GetView(string name);
}

Some files were not shown because too many files have changed in this diff Show more