107 lines
2.9 KiB
Go
107 lines
2.9 KiB
Go
// D2R-specific configuration: screen regions, colors, timings.
|
|
package d2r
|
|
|
|
import "image"
|
|
|
|
// ScreenRegions defines UI element positions at 1920x1080.
|
|
type ScreenRegions struct {
|
|
HealthOrb image.Rectangle
|
|
ManaOrb image.Rectangle
|
|
XPBar image.Rectangle
|
|
Belt image.Rectangle
|
|
Minimap image.Rectangle
|
|
Inventory image.Rectangle
|
|
Stash image.Rectangle
|
|
SkillLeft image.Rectangle
|
|
SkillRight image.Rectangle
|
|
}
|
|
|
|
// HSVRange defines a color range in HSV space.
|
|
type HSVRange struct {
|
|
LowerH, LowerS, LowerV int
|
|
UpperH, UpperS, UpperV int
|
|
}
|
|
|
|
// Colors defines HSV ranges for game elements.
|
|
type Colors struct {
|
|
HealthFilled HSVRange
|
|
ManaFilled HSVRange
|
|
ItemUnique HSVRange
|
|
ItemSet HSVRange
|
|
ItemRare HSVRange
|
|
ItemRuneword HSVRange
|
|
PortalBlue HSVRange
|
|
}
|
|
|
|
// Timings defines game-specific delay constants.
|
|
type Timings struct {
|
|
LoadingScreenMaxMs int
|
|
TownPortalCastMs int
|
|
TeleportDelayMs int
|
|
PotionCooldownMs int
|
|
PickupDelayMs int
|
|
}
|
|
|
|
// Config holds all D2R-specific configuration.
|
|
type Config struct {
|
|
Resolution image.Point
|
|
Regions ScreenRegions
|
|
Colors Colors
|
|
Timings Timings
|
|
|
|
// Loot settings
|
|
PickupUniques bool
|
|
PickupSets bool
|
|
PickupRares bool
|
|
PickupRunes bool
|
|
MinRuneTier int
|
|
PickupGems bool
|
|
|
|
// Safety thresholds (0.0 - 1.0)
|
|
HealthPotionThreshold float64
|
|
ManaPotionThreshold float64
|
|
ChickenThreshold float64 // exit game if health below this
|
|
}
|
|
|
|
// DefaultConfig returns the default D2R config for 1920x1080.
|
|
func DefaultConfig() Config {
|
|
return Config{
|
|
Resolution: image.Point{X: 1920, Y: 1080},
|
|
Regions: ScreenRegions{
|
|
HealthOrb: image.Rect(28, 545, 198, 715),
|
|
ManaOrb: image.Rect(1722, 545, 1892, 715),
|
|
XPBar: image.Rect(0, 1058, 1920, 1080),
|
|
Belt: image.Rect(838, 1010, 1082, 1058),
|
|
Minimap: image.Rect(1600, 0, 1920, 320),
|
|
Inventory: image.Rect(960, 330, 1490, 770),
|
|
Stash: image.Rect(430, 330, 960, 770),
|
|
SkillLeft: image.Rect(194, 1036, 246, 1088),
|
|
SkillRight: image.Rect(1674, 1036, 1726, 1088),
|
|
},
|
|
Colors: Colors{
|
|
HealthFilled: HSVRange{0, 100, 100, 10, 255, 255},
|
|
ManaFilled: HSVRange{100, 100, 100, 130, 255, 255},
|
|
ItemUnique: HSVRange{15, 100, 180, 30, 255, 255},
|
|
ItemSet: HSVRange{35, 100, 150, 55, 255, 255},
|
|
ItemRare: HSVRange{15, 50, 200, 25, 150, 255},
|
|
ItemRuneword: HSVRange{15, 100, 180, 30, 255, 255},
|
|
PortalBlue: HSVRange{90, 150, 150, 120, 255, 255},
|
|
},
|
|
Timings: Timings{
|
|
LoadingScreenMaxMs: 15000,
|
|
TownPortalCastMs: 3500,
|
|
TeleportDelayMs: 150,
|
|
PotionCooldownMs: 1000,
|
|
PickupDelayMs: 300,
|
|
},
|
|
PickupUniques: true,
|
|
PickupSets: true,
|
|
PickupRares: true,
|
|
PickupRunes: true,
|
|
MinRuneTier: 10,
|
|
PickupGems: false,
|
|
HealthPotionThreshold: 0.5,
|
|
ManaPotionThreshold: 0.3,
|
|
ChickenThreshold: 0.2,
|
|
}
|
|
}
|