bugfixing, performance improvements and added casting frames formula

This commit is contained in:
Héctor Giménez
2024-05-09 20:27:31 +09:00
parent 0c6a2c17ab
commit c398062b57
14 changed files with 293 additions and 216 deletions

39
pkg/memory/player_unit.go Normal file
View File

@@ -0,0 +1,39 @@
package memory
import (
"github.com/hectorgimenez/d2go/pkg/data"
"github.com/hectorgimenez/d2go/pkg/data/area"
"github.com/hectorgimenez/d2go/pkg/data/state"
)
type RawPlayerUnit struct {
data.UnitID
Address uintptr
Name string
IsMainPlayer bool
IsCorpse bool
Area area.ID
Position data.Position
IsHovered bool
States state.States
}
type RawPlayerUnits []RawPlayerUnit
func (pu RawPlayerUnits) GetMainPlayer() RawPlayerUnit {
for _, p := range pu {
if p.IsMainPlayer {
return p
}
}
return RawPlayerUnit{}
}
func (pu RawPlayerUnits) GetCorpse() RawPlayerUnit {
for _, p := range pu {
if p.IsCorpse {
return p
}
}
return RawPlayerUnit{}
}