From 94b460bbc8b7f87254cec8bbe14bc02f27901718 Mon Sep 17 00:00:00 2001 From: Boki Date: Wed, 4 Mar 2026 17:12:32 -0500 Subject: [PATCH] areatemplate added --- src/Automata.Ui/ViewModels/MemoryViewModel.cs | 46 ++++++++++++++ src/Automata.Ui/Views/MainWindow.axaml | 2 + .../Diagnostics/MemoryDiagnostics.cs | 60 +++++++++++++++++++ src/Roboto.Memory/GameMemoryReader.cs | 4 +- src/Roboto.Memory/GameOffsets.cs | 6 +- src/Roboto.Memory/Objects/AreaInstance.cs | 10 ++++ src/Roboto.Memory/Objects/InGameState.cs | 2 +- src/Roboto.Memory/Objects/WorldData.cs | 15 +---- 8 files changed, 125 insertions(+), 20 deletions(-) diff --git a/src/Automata.Ui/ViewModels/MemoryViewModel.cs b/src/Automata.Ui/ViewModels/MemoryViewModel.cs index af8a748..417ea0b 100644 --- a/src/Automata.Ui/ViewModels/MemoryViewModel.cs +++ b/src/Automata.Ui/ViewModels/MemoryViewModel.cs @@ -103,6 +103,13 @@ public partial class MemoryViewModel : ObservableObject private MemoryNodeViewModel? _entityListNode; private MemoryNodeViewModel? _skillsNode; private MemoryNodeViewModel? _questsNode; + private MemoryNodeViewModel? _areaRawName; + private MemoryNodeViewModel? _areaDisplayName; + private MemoryNodeViewModel? _areaAct; + private MemoryNodeViewModel? _areaIsTown; + private MemoryNodeViewModel? _areaHasWaypoint; + private MemoryNodeViewModel? _areaMonsterLevel; + private MemoryNodeViewModel? _worldAreaId; partial void OnIsEnabledChanged(bool value) { @@ -235,7 +242,25 @@ public partial class MemoryViewModel : ObservableObject terrain.Children.Add(_terrainGrid); terrain.Children.Add(_terrainWalkable); + // AreaTemplate (from WorldData — zone metadata) + var areaTemplateGroup = new MemoryNodeViewModel("AreaTemplate"); + _areaRawName = new MemoryNodeViewModel("RawName:"); + _areaDisplayName = new MemoryNodeViewModel("Name:"); + _areaAct = new MemoryNodeViewModel("Act:"); + _areaIsTown = new MemoryNodeViewModel("IsTown:"); + _areaHasWaypoint = new MemoryNodeViewModel("HasWaypoint:"); + _areaMonsterLevel = new MemoryNodeViewModel("MonsterLevel:"); + _worldAreaId = new MemoryNodeViewModel("WorldAreaId:"); + areaTemplateGroup.Children.Add(_areaRawName); + areaTemplateGroup.Children.Add(_areaDisplayName); + areaTemplateGroup.Children.Add(_areaAct); + areaTemplateGroup.Children.Add(_areaIsTown); + areaTemplateGroup.Children.Add(_areaHasWaypoint); + areaTemplateGroup.Children.Add(_areaMonsterLevel); + areaTemplateGroup.Children.Add(_worldAreaId); + inGameStateGroup.Children.Add(areaInstanceGroup); + inGameStateGroup.Children.Add(areaTemplateGroup); inGameStateGroup.Children.Add(player); inGameStateGroup.Children.Add(entitiesGroup); inGameStateGroup.Children.Add(terrain); @@ -437,6 +462,15 @@ public partial class MemoryViewModel : ObservableObject snap.EntityCount > 0 ? snap.EntityCount.ToString() : "—", snap.EntityCount > 0); + // AreaTemplate + _areaRawName!.Set(snap.AreaRawName ?? "—", snap.AreaRawName is not null); + _areaDisplayName!.Set(snap.AreaName ?? "—", snap.AreaName is not null); + _areaAct!.Set(snap.AreaAct > 0 ? snap.AreaAct.ToString() : "—", snap.AreaAct > 0); + _areaIsTown!.Set(snap.AreaIsTown ? "Yes" : "No", snap.AreaIsTown); + _areaHasWaypoint!.Set(snap.AreaHasWaypoint ? "Yes" : "No", snap.AreaHasWaypoint); + _areaMonsterLevel!.Set(snap.AreaMonsterLevel > 0 ? snap.AreaMonsterLevel.ToString() : "—", snap.AreaMonsterLevel > 0); + _worldAreaId!.Set(snap.WorldAreaId > 0 ? snap.WorldAreaId.ToString() : "—", snap.WorldAreaId > 0); + // Player position if (snap.HasPosition) _playerPos!.Set($"({snap.PlayerX:F1}, {snap.PlayerY:F1}, {snap.PlayerZ:F1})"); @@ -1355,4 +1389,16 @@ public partial class MemoryViewModel : ObservableObject ScanResult = _reader.Diagnostics!.ScanQuestStateObjects(); } + + [RelayCommand] + private void ScanAreaTemplateExecute() + { + if (_reader is null || !_reader.IsAttached) + { + ScanResult = "Error: not attached"; + return; + } + + ScanResult = _reader.Diagnostics!.ScanAreaTemplate(); + } } diff --git a/src/Automata.Ui/Views/MainWindow.axaml b/src/Automata.Ui/Views/MainWindow.axaml index 5106860..8239e31 100644 --- a/src/Automata.Ui/Views/MainWindow.axaml +++ b/src/Automata.Ui/Views/MainWindow.axaml @@ -784,6 +784,8 @@ Padding="10,4" FontWeight="Bold" Margin="0,0,6,4" />