update merc data

This commit is contained in:
vietdungdev
2026-05-09 15:12:37 +07:00
parent 094eda658f
commit 070e47e460
3 changed files with 4 additions and 19 deletions

View File

@@ -100,25 +100,6 @@ func (r Room) IsInside(p Position) bool {
return false
}
func (d Data) MercHPPercent() int {
// for _, m := range d.Monsters {
// if m.IsMerc() {
// // Hacky thing to read merc life properly
// maxLife := m.Stats[stat.MaxLife] >> 8
// life := float64(m.Stats[stat.Life] >> 8)
// if m.Stats[stat.Life] <= 32768 {
// life = float64(m.Stats[stat.Life]) / 32768.0 * float64(maxLife)
// }
// return int(life / float64(maxLife) * 100)
// }
// }
if d.Mercenary.Found {
return d.Mercenary.HPPercent
}
return 0
}
type RosterMember struct {
Name string
Area area.ID

View File

@@ -19,6 +19,8 @@ type OwnMercenary struct {
Mode mode.NpcMode
IsCorpse bool
HPPercent int
Strength int
Dexterity int
}
type NPC struct {

View File

@@ -77,6 +77,8 @@ func (gd *GameReader) OwnMercenary() (OwnMercenary, bool) {
Mode: mode.NpcMode(ReadUIntFromBuffer(monsterDataBuffer, 0x0C, Uint32)),
IsCorpse: ReadUIntFromBuffer(monsterDataBuffer, 0x1AE, Uint8) != 0,
HPPercent: mercenaryHPPercent(stats),
Strength: stats[stat.Strength],
Dexterity: stats[stat.Dexterity],
})
monsterUnitPtr = uintptr(gd.Process.ReadUInt(monsterUnitPtr+0x158, Uint64))