iso-bot/plugins/d2r/plugin.go

80 lines
2 KiB
Go

// Package d2r implements the Diablo II: Resurrected game plugin.
package d2r
import (
"fmt"
"image"
"git.cloonar.com/openclawd/iso-bot/pkg/plugin"
"git.cloonar.com/openclawd/iso-bot/pkg/engine/resolution"
)
// Plugin implements plugin.Plugin for D2R.
type Plugin struct {
config Config
services plugin.EngineServices
detector *Detector
reader *Reader
resolutionRegistry *resolution.Registry
}
// New creates a new D2R plugin with default config.
func New() *Plugin {
return &Plugin{
config: DefaultConfig(),
resolutionRegistry: resolution.NewRegistry(),
}
}
// Info returns plugin metadata.
func (p *Plugin) Info() plugin.PluginInfo {
return plugin.PluginInfo{
ID: "d2r",
Name: "Diablo II: Resurrected",
Version: "0.1.0",
Description: "Bot plugin for Diablo II: Resurrected — MF runs, rune farming, and more",
Resolution: image.Point{X: 1920, Y: 1080},
}
}
// Init initializes the plugin with engine services.
func (p *Plugin) Init(services plugin.EngineServices) error {
p.services = services
// Register D2R resolution profiles
if err := RegisterProfiles(p.resolutionRegistry); err != nil {
return fmt.Errorf("failed to register D2R profiles: %w", err)
}
p.detector = NewDetector(p.config, services)
p.reader = NewReader(p.config, services)
return nil
}
// Detector returns the game state detector.
func (p *Plugin) Detector() plugin.GameDetector {
return p.detector
}
// Reader returns the screen reader.
func (p *Plugin) Reader() plugin.ScreenReader {
return p.reader
}
// Routines returns available farming routines.
func (p *Plugin) Routines() []plugin.Routine {
return []plugin.Routine{
// TODO: Initialize routines with plugin services
}
}
// DefaultLootFilter returns the default D2R loot filter.
func (p *Plugin) DefaultLootFilter() plugin.LootFilter {
// TODO: Return default rule engine
return nil
}
// SupportedResolutions returns resolutions available for D2R.
func (p *Plugin) SupportedResolutions() []image.Point {
return p.resolutionRegistry.SupportedResolutions("d2r")
}