From 444f4b0e9b01634c8ea520f276487e834ce981ed Mon Sep 17 00:00:00 2001 From: elb <51070858+elobo91@users.noreply.github.com> Date: Fri, 20 Dec 2024 03:50:33 -0500 Subject: [PATCH] Added a few OpenMenus, also HasMerc() (#60) * wpList, LoadingScreen, GetSelectedCharacterName Credits to gogigogi1 * Class offset updated * TZ online * IsCorpse Offset * Added a few OpenMenus, also HasMerc() PortraitsShown,BeltRows,QuestLog,MercInventory,NewStats then func HasMerc() return true if we have merc. --- pkg/data/data.go | 36 ++++++++++++++++++++++-------------- pkg/memory/game_reader.go | 36 +++++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/pkg/data/data.go b/pkg/data/data.go index 8697386..a87e8bb 100644 --- a/pkg/data/data.go +++ b/pkg/data/data.go @@ -1,10 +1,11 @@ package data import ( - "github.com/hectorgimenez/d2go/pkg/data/mode" "math" "strings" + "github.com/hectorgimenez/d2go/pkg/data/mode" + "github.com/hectorgimenez/d2go/pkg/data/quest" "github.com/hectorgimenez/d2go/pkg/data/area" @@ -49,6 +50,7 @@ type Data struct { IsInCharCreationScreen bool IsInCharSelectionScreen bool IsInLobby bool + HasMerc bool } type Room struct { @@ -275,19 +277,25 @@ type PointOfInterest struct { } type OpenMenus struct { - Inventory bool - LoadingScreen bool - NPCInteract bool - NPCShop bool - Stash bool - Waypoint bool - MapShown bool - SkillTree bool - Character bool - QuitMenu bool - Cube bool - SkillSelect bool - Anvil bool + Inventory bool + LoadingScreen bool + NPCInteract bool + NPCShop bool + Stash bool + Waypoint bool + MapShown bool + NewSkills bool + NewStats bool + SkillTree bool + Character bool + QuitMenu bool + Cube bool + SkillSelect bool + Anvil bool + MercInventory bool + BeltRows bool + QuestLog bool + PortraitsShown bool } func (om OpenMenus) IsMenuOpen() bool { diff --git a/pkg/memory/game_reader.go b/pkg/memory/game_reader.go index 448c56a..c0e411b 100644 --- a/pkg/memory/game_reader.go +++ b/pkg/memory/game_reader.go @@ -70,6 +70,7 @@ func (gd *GameReader) GetData() data.Data { IsInCharCreationScreen: gd.IsInCharacterCreationScreen(), IsInLobby: gd.IsInLobby(), IsInCharSelectionScreen: gd.IsInCharacterSelectionScreen(), + HasMerc: gd.HasMerc(), } return d @@ -89,19 +90,25 @@ func (gd *GameReader) openMenus() data.OpenMenus { isMapShown := gd.Process.ReadUInt(gd.Process.moduleBaseAddressPtr+gd.offset.UI, Uint8) return data.OpenMenus{ - Inventory: buffer[0x01] != 0, - LoadingScreen: buffer[0x168] != 0, - NPCInteract: buffer[0x08] != 0, - NPCShop: buffer[0x0B] != 0, - Stash: buffer[0x18] != 0, - Waypoint: buffer[0x13] != 0, - MapShown: isMapShown != 0, - SkillTree: buffer[0x04] != 0, - Character: buffer[0x02] != 0, - QuitMenu: buffer[0x09] != 0, - Cube: buffer[0x19] != 0, - SkillSelect: buffer[0x03] != 0, - Anvil: buffer[0x0D] != 0, + Inventory: buffer[0x01] != 0, + LoadingScreen: buffer[0x168] != 0, + NPCInteract: buffer[0x08] != 0, + NPCShop: buffer[0x0B] != 0, + Stash: buffer[0x18] != 0, + Waypoint: buffer[0x13] != 0, + MapShown: isMapShown != 0, + SkillTree: buffer[0x04] != 0, + NewSkills: buffer[0x07] != 0, + NewStats: buffer[0x06] != 0, + Character: buffer[0x02] != 0, + QuitMenu: buffer[0x09] != 0, + Cube: buffer[0x19] != 0, + SkillSelect: buffer[0x03] != 0, + Anvil: buffer[0x0D] != 0, + MercInventory: buffer[0x1E] != 0, + BeltRows: buffer[0x1A] != 0, + QuestLog: buffer[0xE] != 0, + PortraitsShown: buffer[0x1D] != 0, } } @@ -257,6 +264,9 @@ func (gd *GameReader) FPS() int { return int(gd.ReadUInt(gd.moduleBaseAddressPtr+0x2140DF4, 4)) } +func (gd *GameReader) HasMerc() bool { + return gd.ReadUInt(gd.moduleBaseAddressPtr+0x22e51d0+0x12, Uint8) != 0 +} func (gd *GameReader) UpdateWidgets() map[string]map[string]interface{} { widgets := map[string]map[string]interface{}{}