Add class data and more menu detection

This commit is contained in:
Héctor Giménez
2023-05-12 21:44:42 +09:00
parent 26120205c9
commit 70d92d3df5
3 changed files with 20 additions and 1 deletions

View File

@@ -104,7 +104,17 @@ type Level struct {
CanInteract bool
}
type Class string
type Class uint
const (
Amazon Class = iota
Sorceress
Necromancer
Paladin
Barbarian
Druid
Assassin
)
type Corpse struct {
Found bool
@@ -124,6 +134,7 @@ type PlayerUnit struct {
Stats map[stat.ID]int
Skills map[skill.Skill]int
States state.States
Class Class
}
func (pu PlayerUnit) MaxGold() int {
@@ -205,4 +216,6 @@ type OpenMenus struct {
Stash bool
Waypoint bool
MapShown bool
SkillTree bool
Character bool
}

View File

@@ -69,6 +69,8 @@ func (gd *GameReader) openMenus() data.OpenMenus {
Stash: buffer[0x18] != 0,
Waypoint: buffer[0x13] != 0,
MapShown: isMapShown != 0,
SkillTree: buffer[0x04] != 0,
Character: buffer[0x02] != 0,
}
}

View File

@@ -116,6 +116,9 @@ func (gd *GameReader) GetPlayerUnit(playerUnit uintptr) data.PlayerUnit {
// Skills
skills := gd.getSkills(playerUnit + 0x100)
// Class
class := data.Class(gd.Process.ReadUInt(playerUnit+0x174, Uint32))
// Level number
pathPtr := uintptr(gd.Process.ReadUInt(playerUnit+0x38, Uint64))
room1Ptr := uintptr(gd.Process.ReadUInt(pathPtr+0x20, Uint64))
@@ -133,6 +136,7 @@ func (gd *GameReader) GetPlayerUnit(playerUnit uintptr) data.PlayerUnit {
Stats: stats,
Skills: skills,
States: states,
Class: class,
}
}