add object owner
This commit is contained in:
@@ -3,11 +3,13 @@ package data
|
|||||||
import "github.com/hectorgimenez/d2go/pkg/data/object"
|
import "github.com/hectorgimenez/d2go/pkg/data/object"
|
||||||
|
|
||||||
type Object struct {
|
type Object struct {
|
||||||
|
ID UnitID
|
||||||
Name object.Name
|
Name object.Name
|
||||||
IsHovered bool
|
IsHovered bool
|
||||||
Selectable bool
|
Selectable bool
|
||||||
InteractType object.InteractType
|
InteractType object.InteractType
|
||||||
Position Position
|
Position Position
|
||||||
|
Owner string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Objects []Object
|
type Objects []Object
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ func (gd *GameReader) Objects(playerPosition data.Position, hover data.HoverData
|
|||||||
|
|
||||||
unitDataPtr := uintptr(gd.Process.ReadUInt(objectUnitPtr+0x10, Uint64))
|
unitDataPtr := uintptr(gd.Process.ReadUInt(objectUnitPtr+0x10, Uint64))
|
||||||
interactType := gd.Process.ReadUInt(unitDataPtr+0x08, Uint8)
|
interactType := gd.Process.ReadUInt(unitDataPtr+0x08, Uint8)
|
||||||
|
owner := gd.Process.ReadStringFromMemory(unitDataPtr+0x34, 32)
|
||||||
|
|
||||||
obj := data.Object{
|
obj := data.Object{
|
||||||
|
ID: data.UnitID(unitID),
|
||||||
Name: object.Name(int(txtFileNo)),
|
Name: object.Name(int(txtFileNo)),
|
||||||
IsHovered: data.UnitID(unitID) == hover.UnitID && hover.UnitType == 2 && hover.IsHovered,
|
IsHovered: data.UnitID(unitID) == hover.UnitID && hover.UnitType == 2 && hover.IsHovered,
|
||||||
InteractType: object.InteractType(interactType),
|
InteractType: object.InteractType(interactType),
|
||||||
@@ -40,6 +42,7 @@ func (gd *GameReader) Objects(playerPosition data.Position, hover data.HoverData
|
|||||||
X: int(posX),
|
X: int(posX),
|
||||||
Y: int(posY),
|
Y: int(posY),
|
||||||
},
|
},
|
||||||
|
Owner: owner,
|
||||||
}
|
}
|
||||||
objects = append(objects, obj)
|
objects = append(objects, obj)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user