예제 #1
0
파일: WoWModel.cs 프로젝트: Eeglis/Artemis
        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;
            }
        }
예제 #2
0
        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;
            }
        }