public override void Update() { if ((Profile == null) || (DataModel == null) || (_process == null)) { return; } var dataModel = (WoWDataModel)DataModel; var objectManager = new WoWObjectManager(_process, _pointer.GameAddresses.First(a => a.Description == "ObjectManager").BasePointer); var nameCache = new WoWNameCache(_process, _pointer.GameAddresses.First(a => a.Description == "NameCache").BasePointer); var player = new WoWPlayer(_process, _pointer.GameAddresses.First(a => a.Description == "LocalPlayer").BasePointer, _pointer.GameAddresses.First(a => a.Description == "TargetGuid").BasePointer, true); dataModel.Player = player; if (dataModel.Player != null && dataModel.Player.Guid != Guid.Empty) { dataModel.Player.UpdateDetails(nameCache); var target = player.GetTarget(objectManager); if (target == null) { return; } dataModel.Target = new WoWUnit(target.Process, target.BaseAddress); dataModel.Target.UpdateDetails(nameCache); } else { dataModel.Target = null; } }
public override void Update() { if (_process == null) { var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessNames[0]); if (tempProcess == null) { return; } _process = new ProcessSharp(tempProcess, MemoryType.Remote); } if (ProfileModel == null || DataModel == null || _process == null) { return; } var dataModel = (WoWDataModel)DataModel; var objectManager = new WoWObjectManager(_process, _pointer.GameAddresses.First(a => a.Description == "ObjectManager").BasePointer); var nameCache = new WoWNameCache(_process, _pointer.GameAddresses.First(a => a.Description == "NameCache").BasePointer); var player = new WoWPlayer(_process, _pointer.GameAddresses.First(a => a.Description == "LocalPlayer").BasePointer, _pointer.GameAddresses.First(a => a.Description == "TargetGuid").BasePointer, true); dataModel.Player = player; if (dataModel.Player != null && dataModel.Player.Guid != Guid.Empty) { dataModel.Player.UpdateDetails(nameCache); var target = player.GetTarget(objectManager); if (target == null) { return; } dataModel.Target = new WoWUnit(target.Process, target.BaseAddress); dataModel.Target.UpdateDetails(nameCache); } else { dataModel.Target = null; } }