added modes to object (update) (#46)
* Added States for monsters and corpses
Now can properly identify if a corpse is interactable with a skill ( barbarian, necromancer)
Also getting states about monsters : Exemple Soul Killer with Conviction aura: State 28 // conviction
Also can tell if monster has a state after you used a skill on it Exemple: State 56 Terror ( After using Barbarian skill Howl to fear )
Another Exemple using Grief on Mephistos he now have states : 2 poison
52 Preventheal
will be very useful for further development.
* Added modes to player
Now accessible in koolo using : s.data.PlayerUnit.Mode
Those are Modes for player:
const Death: 0;
const StandingOutsideTown: 1;
const Walking: 2;
const Running: 3;
const GettingHit: 4;
const StandingInTown: 5;
const WalkingInTown: 6;
const Attacking1: 7;
const Attacking2: 8;
const Blocking: 9;
const CastingSkill: 10;
const ThrowingItem: 11;
const Kicking: 12;
const UsingSkill1: 13;
const UsingSkill2: 14;
const UsingSkill3: 15;
const UsingSkill4: 16;
const Dead: 17;
const SkillActionSequence: 18;
const KnockedBack: 19;
* update Added alias(const) for player modes
can be used like this s.data.PlayerUnit.Mode == mode.StandingInTown
* added modes to object
0 = Object idle
1 = Object operating
2 = Object opened
3 = Object special 1 ?? to be determined what it does exactly
4 = Object special 2 ?? to be determined what it does exactly
5 = Object special 3 ?? to be determined what it does exactly
6 = Object special 4 ?? to be determined what it does exactly
7 = Object special 5 ?? to be determined what it does exactly
* update object mode strings
* Update object_mode.go
* Update object_mode.go
* update object modes again. accurate now
This commit is contained in:
38
pkg/data/mode/object_mode.go
Normal file
38
pkg/data/mode/object_mode.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package mode
|
||||||
|
|
||||||
|
type ObjectMode uint32
|
||||||
|
|
||||||
|
const (
|
||||||
|
ObjectModeIdle ObjectMode = 0
|
||||||
|
ObjectModeOperating ObjectMode = 1
|
||||||
|
ObjectModeOpened ObjectMode = 2
|
||||||
|
ObjectModeSpecial1 ObjectMode = 3
|
||||||
|
ObjectModeSpecial2 ObjectMode = 4
|
||||||
|
ObjectModeSpecial3 ObjectMode = 5
|
||||||
|
ObjectModeSpecial4 ObjectMode = 6
|
||||||
|
ObjectModeSpecial5 ObjectMode = 7
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
func (m ObjectMode) String() string {
|
||||||
|
switch m {
|
||||||
|
case ObjectModeIdle:
|
||||||
|
return "Idle"
|
||||||
|
case ObjectModeOperating:
|
||||||
|
return "Operating"
|
||||||
|
case ObjectModeOpened:
|
||||||
|
return "Opened"
|
||||||
|
case ObjectModeSpecial1:
|
||||||
|
return "Special1"
|
||||||
|
case ObjectModeSpecial2:
|
||||||
|
return "Special2"
|
||||||
|
case ObjectModeSpecial3:
|
||||||
|
return "Special3"
|
||||||
|
case ObjectModeSpecial4:
|
||||||
|
return "Special4"
|
||||||
|
case ObjectModeSpecial5:
|
||||||
|
return "Special5"
|
||||||
|
default:
|
||||||
|
return "Unknown"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
package data
|
package data
|
||||||
|
|
||||||
import "github.com/hectorgimenez/d2go/pkg/data/object"
|
import (
|
||||||
|
"github.com/hectorgimenez/d2go/pkg/data/mode"
|
||||||
|
"github.com/hectorgimenez/d2go/pkg/data/object"
|
||||||
|
)
|
||||||
|
|
||||||
type Object struct {
|
type Object struct {
|
||||||
ID UnitID
|
ID UnitID
|
||||||
@@ -11,6 +14,7 @@ type Object struct {
|
|||||||
Shrine object.ShrineData
|
Shrine object.ShrineData
|
||||||
Position Position
|
Position Position
|
||||||
Owner string
|
Owner string
|
||||||
|
Mode mode.ObjectMode
|
||||||
}
|
}
|
||||||
|
|
||||||
type Objects []Object
|
type Objects []Object
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package memory
|
package memory
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/hectorgimenez/d2go/pkg/data/mode"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/hectorgimenez/d2go/pkg/data"
|
"github.com/hectorgimenez/d2go/pkg/data"
|
||||||
@@ -20,9 +21,10 @@ func (gd *GameReader) Objects(playerPosition data.Position, hover data.HoverData
|
|||||||
objectType := gd.Process.ReadUInt(objectUnitPtr+0x00, Uint32)
|
objectType := gd.Process.ReadUInt(objectUnitPtr+0x00, Uint32)
|
||||||
if objectType == 2 {
|
if objectType == 2 {
|
||||||
txtFileNo := gd.Process.ReadUInt(objectUnitPtr+0x04, Uint32)
|
txtFileNo := gd.Process.ReadUInt(objectUnitPtr+0x04, Uint32)
|
||||||
mode := gd.Process.ReadUInt(objectUnitPtr+0x0c, Uint32)
|
|
||||||
unitID := gd.Process.ReadUInt(objectUnitPtr+0x08, Uint32)
|
unitID := gd.Process.ReadUInt(objectUnitPtr+0x08, Uint32)
|
||||||
|
|
||||||
|
// Read the object mode
|
||||||
|
objectMode := mode.ObjectMode(gd.Process.ReadUInt(objectUnitPtr+0x0c, Uint32))
|
||||||
// Coordinates (X, Y)
|
// Coordinates (X, Y)
|
||||||
pathPtr := uintptr(gd.Process.ReadUInt(objectUnitPtr+0x38, Uint64))
|
pathPtr := uintptr(gd.Process.ReadUInt(objectUnitPtr+0x38, Uint64))
|
||||||
posX := gd.Process.ReadUInt(pathPtr+0x10, Uint16)
|
posX := gd.Process.ReadUInt(pathPtr+0x10, Uint16)
|
||||||
@@ -40,7 +42,6 @@ func (gd *GameReader) Objects(playerPosition data.Position, hover data.HoverData
|
|||||||
ShrineName: object.ShrineTypeNames[object.ShrineType(shrineType)],
|
ShrineName: object.ShrineTypeNames[object.ShrineType(shrineType)],
|
||||||
ShrineType: object.ShrineType(shrineType),
|
ShrineType: object.ShrineType(shrineType),
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
interactType = gd.Process.ReadUInt(unitDataPtr+0x08, Uint8)
|
interactType = gd.Process.ReadUInt(unitDataPtr+0x08, Uint8)
|
||||||
}
|
}
|
||||||
@@ -52,12 +53,13 @@ func (gd *GameReader) Objects(playerPosition data.Position, hover data.HoverData
|
|||||||
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),
|
||||||
Shrine: shrineData,
|
Shrine: shrineData,
|
||||||
Selectable: mode == 0,
|
Selectable: objectMode == mode.ObjectModeIdle,
|
||||||
Position: data.Position{
|
Position: data.Position{
|
||||||
X: int(posX),
|
X: int(posX),
|
||||||
Y: int(posY),
|
Y: int(posY),
|
||||||
},
|
},
|
||||||
Owner: owner,
|
Owner: owner,
|
||||||
|
Mode: objectMode,
|
||||||
}
|
}
|
||||||
objects = append(objects, obj)
|
objects = append(objects, obj)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user