diff --git a/pkg/memory/game_reader.go b/pkg/memory/game_reader.go index 694caf2..9679c44 100644 --- a/pkg/memory/game_reader.go +++ b/pkg/memory/game_reader.go @@ -97,7 +97,7 @@ func (gd *GameReader) GetData() data.Data { // q1 := uintptr(gd.Process.ReadUInt(gd.moduleBaseAddressPtr+0x22E2978, Uint64)) // q2 := uintptr(gd.Process.ReadUInt(q1, Uint64)) // q2 := uintptr(gd.Process.ReadUInt(gd.moduleBaseAddressPtr+0x22F1E79, Uint64)) - gameQuestsBytes := gd.Process.ReadBytesFromMemory(gd.moduleBaseAddressPtr+0x22D8369, 85) + gameQuestsBytes := gd.Process.ReadBytesFromMemory(gd.moduleBaseAddressPtr+gd.offset.Quests, 85) // gameQuestsBytes = gameQuestsBytes[3:] d := data.Data{ diff --git a/pkg/memory/offset.go b/pkg/memory/offset.go index 9bf5ffc..c94bb3a 100644 --- a/pkg/memory/offset.go +++ b/pkg/memory/offset.go @@ -18,6 +18,7 @@ type Offset struct { KeyBindingsOffset uintptr KeyBindingsSkillsOffset uintptr TZ uintptr + Quests uintptr } func calculateOffsets(process *Process) Offset { @@ -90,6 +91,12 @@ func calculateOffsets(process *Process) Offset { tzPtr := process.ReadUInt(pattern+3, Uint32) tzOffset := pattern - process.moduleBaseAddressPtr + 7 + uintptr(tzPtr) + // Quest Bytes Data + pattern = process.FindPattern(memory, "\x42\xc6\x84\x28\x00\x00\x00\x00\x00\x49\xff\xc5\x49\x83\xfd\x29", "xxxx?????xxxxxxx") + bytes = process.ReadBytesFromMemory(pattern+4, 4) + questOffset := uintptr(binary.LittleEndian.Uint32(bytes)) + questDataOffset := questOffset + 1 + return Offset{ GameData: gameDataOffset, UnitTable: unitTableOffset, @@ -104,5 +111,6 @@ func calculateOffsets(process *Process) Offset { KeyBindingsOffset: keyBindingsOffset, KeyBindingsSkillsOffset: keyBindingsSkillsOffset, TZ: tzOffset, + Quests: questDataOffset, } } diff --git a/pkg/memory/terrorzones.go b/pkg/memory/terrorzones.go index a72ba9b..3c07607 100644 --- a/pkg/memory/terrorzones.go +++ b/pkg/memory/terrorzones.go @@ -5,10 +5,12 @@ import ( ) func (gd *GameReader) TerrorZones() (areas []area.ID) { - tzPtr := uintptr(gd.ReadUInt(gd.moduleBaseAddressPtr+gd.offset.TZ, Uint64)) + structPtr := gd.moduleBaseAddressPtr + gd.offset.TZ + zonesPtr := uintptr(gd.ReadUInt(structPtr, Uint64)) + actualActiveZoneCount := int(gd.ReadUInt(structPtr+0x8, Uint8)) - for i := 0; i < 8; i++ { - tzArea := gd.ReadUInt(tzPtr+uintptr(i*Uint32), Uint32) + for i := 0; i < actualActiveZoneCount; i++ { + tzArea := gd.ReadUInt(zonesPtr+uintptr(i*Uint32), Uint32) if tzArea != 0 { areas = append(areas, area.ID(tzArea)) }