- Added OnlineGame info ( game name/pass ) (#32)
- Added IsInGame bool - Added IsOnline bool :) - Added IsInCharacterCreation bool
This commit is contained in:
@@ -28,21 +28,27 @@ type Data struct {
|
|||||||
Corpse Corpse
|
Corpse Corpse
|
||||||
Monsters Monsters
|
Monsters Monsters
|
||||||
Corpses Monsters
|
Corpses Monsters
|
||||||
|
Game OnlineGame
|
||||||
// First slice represents X and second Y
|
// First slice represents X and second Y
|
||||||
CollisionGrid [][]bool
|
CollisionGrid [][]bool
|
||||||
PlayerUnit PlayerUnit
|
PlayerUnit PlayerUnit
|
||||||
NPCs NPCs
|
NPCs NPCs
|
||||||
Inventory Inventory
|
Inventory Inventory
|
||||||
Objects Objects
|
Objects Objects
|
||||||
AdjacentLevels []Level
|
AdjacentLevels []Level
|
||||||
Rooms []Room
|
Rooms []Room
|
||||||
OpenMenus OpenMenus
|
OpenMenus OpenMenus
|
||||||
Roster Roster
|
Roster Roster
|
||||||
HoverData HoverData
|
HoverData HoverData
|
||||||
TerrorZones []area.ID
|
TerrorZones []area.ID
|
||||||
Quests quest.Quests
|
Quests quest.Quests
|
||||||
KeyBindings KeyBindings
|
KeyBindings KeyBindings
|
||||||
LegacyGraphics bool
|
LegacyGraphics bool
|
||||||
|
IsOnline bool
|
||||||
|
IsIngame bool
|
||||||
|
IsInCharCreationScreen bool
|
||||||
|
IsInCharSelectionScreen bool
|
||||||
|
IsInLobby bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type Room struct {
|
type Room struct {
|
||||||
@@ -57,6 +63,11 @@ type HoverData struct {
|
|||||||
UnitType int
|
UnitType int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type OnlineGame struct {
|
||||||
|
LastGameName string
|
||||||
|
LastGamePassword string
|
||||||
|
}
|
||||||
|
|
||||||
func (r Room) GetCenter() Position {
|
func (r Room) GetCenter() Position {
|
||||||
return Position{
|
return Position{
|
||||||
X: r.Position.X + r.Width/2,
|
X: r.Position.X + r.Width/2,
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type GameReader struct {
|
type GameReader struct {
|
||||||
offset Offset
|
offset Offset
|
||||||
previousRead data.Data
|
|
||||||
Process
|
Process
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,9 +27,6 @@ func (gd *GameReader) GetData() data.Data {
|
|||||||
rawPlayerUnits := gd.GetRawPlayerUnits()
|
rawPlayerUnits := gd.GetRawPlayerUnits()
|
||||||
roster := gd.getRoster(rawPlayerUnits)
|
roster := gd.getRoster(rawPlayerUnits)
|
||||||
mainPlayerUnit := rawPlayerUnits.GetMainPlayer()
|
mainPlayerUnit := rawPlayerUnits.GetMainPlayer()
|
||||||
if mainPlayerUnit.Address == 0 {
|
|
||||||
return gd.previousRead
|
|
||||||
}
|
|
||||||
|
|
||||||
pu := gd.GetPlayerUnit(mainPlayerUnit)
|
pu := gd.GetPlayerUnit(mainPlayerUnit)
|
||||||
hover := gd.hoveredData()
|
hover := gd.hoveredData()
|
||||||
@@ -49,22 +45,29 @@ func (gd *GameReader) GetData() data.Data {
|
|||||||
IsHovered: corpseUnit.IsHovered,
|
IsHovered: corpseUnit.IsHovered,
|
||||||
Position: corpseUnit.Position,
|
Position: corpseUnit.Position,
|
||||||
},
|
},
|
||||||
Monsters: gd.Monsters(pu.Position, hover),
|
Game: data.OnlineGame{
|
||||||
Corpses: gd.Corpses(pu.Position, hover),
|
LastGameName: gd.LastGameName(),
|
||||||
PlayerUnit: pu,
|
LastGamePassword: gd.LastGamePass(),
|
||||||
Inventory: gd.Inventory(rawPlayerUnits, hover),
|
},
|
||||||
Objects: gd.Objects(pu.Position, hover),
|
Monsters: gd.Monsters(pu.Position, hover),
|
||||||
OpenMenus: gd.openMenus(),
|
Corpses: gd.Corpses(pu.Position, hover),
|
||||||
Roster: roster,
|
PlayerUnit: pu,
|
||||||
HoverData: hover,
|
Inventory: gd.Inventory(rawPlayerUnits, hover),
|
||||||
TerrorZones: gd.TerrorZones(),
|
Objects: gd.Objects(pu.Position, hover),
|
||||||
Quests: gd.getQuests(gameQuestsBytes),
|
OpenMenus: gd.openMenus(),
|
||||||
KeyBindings: gd.GetKeyBindings(),
|
Roster: roster,
|
||||||
LegacyGraphics: gd.LegacyGraphics(),
|
HoverData: hover,
|
||||||
|
TerrorZones: gd.TerrorZones(),
|
||||||
|
Quests: gd.getQuests(gameQuestsBytes),
|
||||||
|
KeyBindings: gd.GetKeyBindings(),
|
||||||
|
LegacyGraphics: gd.LegacyGraphics(),
|
||||||
|
IsOnline: gd.IsOnline(),
|
||||||
|
IsIngame: gd.IsIngame(),
|
||||||
|
IsInCharCreationScreen: gd.IsInCharacterCreationScreen(),
|
||||||
|
//IsInLobby: gd.IsInLobby(),
|
||||||
|
//IsInCharSelectionScreen: gd.IsInCharacterSelectionScreen(),
|
||||||
}
|
}
|
||||||
|
|
||||||
gd.previousRead = d
|
|
||||||
|
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,3 +202,35 @@ func (gd *GameReader) GetSelectedCharacterName() string {
|
|||||||
func (gd *GameReader) LegacyGraphics() bool {
|
func (gd *GameReader) LegacyGraphics() bool {
|
||||||
return gd.ReadUInt(gd.moduleBaseAddressPtr+0x21F6388, Uint64) == 1
|
return gd.ReadUInt(gd.moduleBaseAddressPtr+0x21F6388, Uint64) == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gd *GameReader) IsOnline() bool {
|
||||||
|
// This represents which tab (Online/Offline) we're on in the Character Selection Screen
|
||||||
|
return gd.ReadUInt(gd.moduleBaseAddressPtr+0x2154F50, 1) == 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gd *GameReader) IsIngame() bool {
|
||||||
|
return gd.ReadUInt(gd.moduleBaseAddressPtr+0x214CB48, 1) == 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
func (gd *GameReader) IsInLobby() bool {
|
||||||
|
return gd.ReadUInt(gd.moduleBaseAddressPtr+0x21CF488, 1) == 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gd *GameReader) IsInCharacterSelectionScreen() bool {
|
||||||
|
return gd.ReadUInt(gd.moduleBaseAddressPtr+0x1DC7276, 1) != 0
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
func (gd *GameReader) IsInCharacterCreationScreen() bool {
|
||||||
|
// This will bug out if you switch to legacy graphics in the character select screen and return 1 until you go back to character screen with d2r graphics
|
||||||
|
return gd.ReadUInt(gd.moduleBaseAddressPtr+0x234A1CE, 1) == 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gd *GameReader) LastGameName() string {
|
||||||
|
return gd.ReadStringFromMemory(gd.moduleBaseAddressPtr+0x29DBD10+0x8, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (gd *GameReader) LastGamePass() string {
|
||||||
|
return gd.ReadStringFromMemory(gd.moduleBaseAddressPtr+0x29DBD10+0x60, 0)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user