Add ping to game_reader

This commit is contained in:
CarlPoppa
2025-10-18 23:03:47 +01:00
parent e5a60b63dd
commit fafcbc8728

View File

@@ -111,6 +111,7 @@ func (gd *GameReader) GetData() data.Data {
LastGameName: gd.LastGameName(),
LastGamePassword: gd.LastGamePass(),
FPS: gd.FPS(),
Ping: gd.Ping(),
},
Monsters: monsters,
Corpses: gd.Corpses(pu.Position, hover),
@@ -441,6 +442,12 @@ func (gd *GameReader) FPS() int {
return int(gd.ReadUInt(gd.moduleBaseAddressPtr+gd.offset.FPS, Uint32))
}
func (gd *GameReader) Ping() int {
ptrToStructPtr := gd.moduleBaseAddressPtr + gd.offset.Ping
structPtrAddr := gd.ReadUInt(ptrToStructPtr, Uint64)
return int(gd.ReadUInt(uintptr(structPtrAddr+36), Uint32))
}
func (gd *GameReader) HasMerc() bool {
return gd.ReadUInt(gd.Process.moduleBaseAddressPtr+gd.offset.UI+0x8, Uint8) != 0
}