[Source] WPF Wow Object manager menu

User Tag List

Results 1 to 12 of 12
  1. #1
    !@^^@!'s Avatar Active Member
    Reputation
    23
    Join Date
    Feb 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Source] WPF Wow Object manager

    Well after 2 years leeching i thought it was about time i started to contribute a little.

    I just love wpf and databinding, therefore i started converting jbrauman's Object manager (http://www.mmowned.com/forums/wow-memory-editing/208754-guide-kind-how-i-handle-objects.htm) to .net 4.0, use shynds BlackMagic lib, and to support databinding...

    Shynd's precompiled dll's was build for 3.5 so i had to recompile BlackMagic.dll and fasmdll_managed.dll to 4.0... if you don't trust the dll files you can find the source for both dlls here and rebuild them yourself: GameDeception - A Development Site for Reverse Engineering
    GameDeception - A Development Site for Reverse Engineering

    New and improved version's source code in the attached zip!

    Todo list:

    • Use the structs and enums from the dump threads
    • Use the timestamp properties to implement the update priority code
    • Clean up the World Class
    • implement checking for logged in status etc...

    one last thing:
    Any ideas for a better way of optimizing this code?:
    Code:
    void BGW_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
            {
                BGW.ReportProgress(0);
                //Checks if process is loaded and opned in BM
                if (Helper.MagicHelper.BM.IsProcessOpen)
                {
                    var baseAddress = Helper.ValueAsigner.Misc.GetBaseAddress();
                    var NewReadDictionary = new Dictionary<ulong, bool>();
    
                    while (baseAddress != 0 && baseAddress % 2 == 0)
                    {
                        var currentGuid = Helper.ValueAsigner.BaseObjectValues.GetGuid(baseAddress);
                        bool AddToNewRead = false;
    
                        if (!BaseObjectDictionary.ContainsKey(currentGuid))
                        {
                            var tempObject = new Objects.BaseObject() { BaseAddress = baseAddress };
                            tempObject.UpdateProperties();
                            BaseObjectDictionary.Add(currentGuid, tempObject);
                            AddToNewRead = true;
                        }
    
                        NewReadDictionary.Add(currentGuid, AddToNewRead);
    
                        baseAddress = Helper.ValueAsigner.Misc.GetNextBaseAddress(baseAddress);
                    }
    
    
                    BGW.ReportProgress(33);
    
    
                    bool skip = false;
                    List<ulong> ToRemove = new List<ulong>();
                    foreach (var v in BaseObjectDictionary)
                    {
                        skip = false;
                        if (NewReadDictionary.ContainsKey(v.Key) == false)
                        {
                            //BaseObjectDictionary.Remove(v.Key);
                            ToRemove.Add(v.Key);
                            skip = true;
                            #region RemoveFromDicionaries
                            switch (v.Value.Type)
                            {
                                case Helper.Offsets.WoWObjectType.AiGroup:
                                    {
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.AreaTrigger:
                                    {
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Container:
                                    {
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Corpse:
                                    {
                                        CorpseDictionary.Remove(v.Key);
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.DynamicObject:
                                    {
                                        DynamicDictionary.Remove(v.Key);
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.GameObject:
                                    {
                                        GameObjectDictionary.Remove(v.Key);
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Item:
                                    {
    
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Object:
                                    {
    
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Player:
                                    {
                                        PlayerDictionary.Remove(v.Key);
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Unit:
                                    {
                                        break;
                                    }
                            }
                            #endregion
                        }
                        else
                        {
                            v.Value.UpdateProperties();
                        }
    
                        if (skip == false)
                        {
                            #region AddToDictionaries
                            switch (v.Value.Type)
                            {
                                case Helper.Offsets.WoWObjectType.AiGroup:
                                    {
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.AreaTrigger:
                                    {
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Container:
                                    {
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Corpse:
                                    {
                                        if (NewReadDictionary.ContainsKey(v.Key) && CorpseDictionary.ContainsKey(v.Key))
                                        {
                                            CorpseDictionary[v.Key].UpdateProperties();
                                        }
                                        else
                                        {
                                            var temp = new Objects.Corpse() { BaseAddress = v.Value.BaseAddress };
                                            temp.UpdateProperties();
                                            CorpseDictionary.Add(v.Key, temp);
                                        }
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.DynamicObject:
                                    {
                                        if (NewReadDictionary.ContainsKey(v.Key) && DynamicDictionary.ContainsKey(v.Key))
                                        {
                                            DynamicDictionary[v.Key].UpdateProperties();
                                        }
                                        else
                                        {
                                            var temp = new Objects.Dynamic() { BaseAddress = v.Value.BaseAddress };
                                            temp.UpdateProperties();
                                            DynamicDictionary.Add(v.Key, temp);
                                        }
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.GameObject:
                                    {
                                        if (NewReadDictionary.ContainsKey(v.Key) && GameObjectDictionary.ContainsKey(v.Key))
                                        {
                                            GameObjectDictionary[v.Key].UpdateProperties();
                                        }
                                        else
                                        {
                                            var temp = new Objects.GameObject() { BaseAddress = v.Value.BaseAddress };
                                            temp.UpdateProperties();
                                            GameObjectDictionary.Add(v.Key, temp);
                                        }
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Item:
                                    {
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Object:
                                    {
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Player:
                                    {
                                        if (NewReadDictionary.ContainsKey(v.Key) && PlayerDictionary.ContainsKey(v.Key))
                                        {
                                            PlayerDictionary[v.Key].UpdateProperties();
                                        }
                                        else
                                        {
                                            var temp = new Objects.PlayerCharacter() { BaseAddress = v.Value.BaseAddress };
                                            temp.UpdateProperties();
                                            PlayerDictionary.Add(v.Key, temp);
                                        }
                                        break;
                                    }
                                case Helper.Offsets.WoWObjectType.Unit:
                                    {
                                        if (NewReadDictionary.ContainsKey(v.Key) && NpcDictionary.ContainsKey(v.Key))
                                        {
                                            NpcDictionary[v.Key].UpdateProperties();
                                        }
                                        else
                                        {
                                            var temp = new Objects.Npc() { BaseAddress = v.Value.BaseAddress };
                                            temp.UpdateProperties();
                                            NpcDictionary.Add(v.Key, temp);
                                        }
                                        break;
                                    }
                            }
                            #endregion
                        }
                    }
    
                    BGW.ReportProgress(66);
    
                    foreach (var v in ToRemove)
                    {
                        BaseObjectDictionary.Remove(v);
                    }
    
                    BGW.ReportProgress(100);
                    OnPropertyChanged("PlayerDictionary");
                    OnPropertyChanged("NpcDictionary");
                    OnPropertyChanged("BaseObjectDictionary");
                    OnPropertyChanged("GameObjectDictionary");
                    OnPropertyChanged("DynamicDictionary");
                    OnPropertyChanged("CorpseDictionary");
                } 
            }
    Attached Files Attached Files
    Last edited by !@^^@!; 01-26-2010 at 04:11 PM. Reason: Fixed WOM.cs and added todo list

    [Source] WPF Wow Object manager
  2. #2
    nopz's Avatar Active Member
    Reputation
    67
    Join Date
    Aug 2009
    Posts
    56
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Nice to see that some people here are Using WPF and not some shi** windows from.

    And btw MvvM is nice, if you want to go further with MvvM i suggest 'mvvm foundation' ( MVVM Foundation ) by John Smith.

    The library is small and concentrated on providing only the most indispensable tools needed by most MVVM application developers.
    I use RelayCommand and ObservableObject.
    My blog: https://pimpmykitty.wordpress.com
    PyFasm: https://github.com/srounet/pyfasm
    Pymem: https://github.com/srounet/pymem

  3. #3
    XTZGZoReX's Avatar Active Member
    Reputation
    32
    Join Date
    Apr 2008
    Posts
    173
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WPF is probably the only decent GUI library in .NET, indeed.

    Just some tips on your code:

    * Use enums - i.e. object type
    Code:
    namespace WowPacketParser.Enums
    {
        public enum ObjectType : uint
        {
            Object = 0,
            Item = 1,
            Container = 2,
            Unit = 3,
            Player = 4,
            GameObject = 5,
            DynamicObject = 6,
            Corpse = 7
        }
    }
    * Use vectors - position X/Y/Z (Vector3) (and O (Vector4))
    Code:
    using System.Runtime.InteropServices;
    
    namespace WowPacketParser.Misc
    {
        [StructLayout(LayoutKind.Explicit, Size = 8)]
        public struct Vector2
        {
            public Vector2(float x, float y)
            {
                X = x;
                Y = y;
            }
    
            [FieldOffset(0)]
            public float X;
    
            [FieldOffset(4)]
            public float Y;
    
            public override string ToString()
            {
                return "X: " + X + " Y: " + Y;
            }
        }
    }
    
    using System.Runtime.InteropServices;
    
    namespace WowPacketParser.Misc
    {
        [StructLayout(LayoutKind.Explicit, Size = 12)]
        public struct Vector3
        {
            public Vector3(float x, float y, float z)
            {
                X = x;
                Y = y;
                Z = z;
            }
    
            [FieldOffset(0)]
            public float X;
    
            [FieldOffset(4)]
            public float Y;
    
            [FieldOffset(8)]
            public float Z;
    
            public override string ToString()
            {
                return "X: " + X + " Y: " + Y + " Z: " + Z;
            }
        }
    }
    
    using System.Runtime.InteropServices;
    
    namespace WowPacketParser.Misc
    {
        [StructLayout(LayoutKind.Explicit, Size = 16)]
        public struct Vector4
        {
            public Vector4(float x, float y, float z, float o)
            {
                X = x;
                Y = y;
                Z = z;
                O = o;
            }
    
            [FieldOffset(0)]
            public float X;
    
            [FieldOffset(4)]
            public float Y;
    
            [FieldOffset(8)]
            public float Z;
    
            [FieldOffset(12)]
            public float O;
    
            public override string ToString()
            {
                return "X: " + X + " Y: " + Y + " Z: " + Z + " O: " + O;
            }
        }
    }
    * You could consider making a wrapper class for GUIDs. Below is one I wrote, based on WCell's EntityId struct, and some searching around on retail.

    Code:
    using System;
    
    namespace WowPacketParser.Enums
    {
        public enum HighGuidMask : byte
        {
            MOTransport = 0x1F,
            Item = 0x40,
            FlagF1 = 0xF1,
            FlagF4 = 0xF4,
            FlagF5 = 0xF5,
            FlagF7 = 0xF7
        }
    }
    
    namespace WowPacketParser.Enums
    {
        public enum HighGuidType : byte
        {
            NoEntry = 0x00,
            GameObject = 0x10,
            Transport = 0x20,
            Unit = 0x30,
            Pet = 0x40,
            Vehicle = 0x50,
            Item = 0x80,
            MOTransport = 0xC0
        }
    }
    
    namespace WowPacketParser.Enums
    {
        public enum HighGuid : uint
        {
            UnitF130 = 0xF130,
            UnitF430 = 0xF430,
            UnitF730 = 0xF730,
            Pet = 0xF140,
            MOTransport = 0x1FC0,
            Transport = 0xF120,
            VehicleF550 = 0xF550,
            VehicleF150 = 0xF150,
            VehicleF450 = 0xF450,
            VehicleF750 = 0xF750,
            GameObjectF110 = 0xF110,
            GameObjectF410 = 0xF410,
            GameObjectF710 = 0xF710,
            GameObjectF009 = 0xF009,
            Item4000 = 0x4000,
            Item4100 = 0x4100,
            Item4180 = 0x4180,
            Player0100 = 0x0100,
            Player0180 = 0x0180,
            DynamicObjectF100 = 0xF100,
            DynamicObjectF500 = 0xF500,
            CorpseF101 = 0xF101,
            CorpseF400 = 0xF400,
            CorpseF700 = 0xF700,
        }
    }
    
    using System;
    using System.IO;
    using System.Runtime.InteropServices;
    using WowPacketParser.Enums;
    
    namespace WowPacketParser.Misc
    {
        [StructLayout(LayoutKind.Explicit, Size = 8)]
        public struct Guid
        {
            public const uint LowMask = 0x00FFFFFF;
            public const uint EntryMask = 0x00FFFFFF;
            public const uint HighTypeMask = 0x00FF0000;
            public const uint HighFlagMask = 0xFF000000;
    
            [FieldOffset(0)]
            public ulong Full;
    
            [FieldOffset(0)]
            public uint Low;
    
            [FieldOffset(3)]
            public uint Entry;
    
            [FieldOffset(4)]
            public uint High;
    
            public Guid(ulong id)
                : this()
            {
                Full = id;
            }
    
            public bool HasEntry
            {
                get { return GetHighType() != HighGuidType.NoEntry; }
            }
    
            public uint GetLow()
            {
                return Low & LowMask;
            }
    
            public uint GetEntry()
            {
                if (HasEntry)
                    return Entry & EntryMask;
    
                return 0;
            }
    
            public HighGuid GetHighGuid()
            {
                return (HighGuid)(High >> 16);
            }
    
            public HighGuidType GetHighType()
            {
                return (HighGuidType)((High & HighTypeMask) >> 16);
            }
    
            public HighGuidMask GetHighMask()
            {
                return (HighGuidMask)((High & HighFlagMask) >> 24);
            }
    
            public override bool Equals(object obj)
            {
                return obj != null && obj is Guid && Equals((Guid)obj);
            }
    
            public bool Equals(Guid other)
            {
                return other.Full == Full;
            }
    
            public override int GetHashCode()
            {
                return Full.GetHashCode();
            }
    
            public override string ToString()
            {
                var highHex = false;
                if (Enum.GetName(typeof(HighGuid), GetHighGuid()) == null)
                    highHex = true;
    
                var highStr = highHex ? "0x" + ((uint)GetHighGuid()).ToString("X4") : GetHighGuid().ToString();
    
                return "Full: " + Full + " High: " + highStr + " (" + GetHighType() + "/" +
                    GetHighMask() + ") Low: " + GetLow() + " Entry: " + GetEntry();
            }
        }
    }
    Last edited by XTZGZoReX; 01-20-2010 at 11:28 AM.

  4. #4
    !@^^@!'s Avatar Active Member
    Reputation
    23
    Join Date
    Feb 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Indeed windows forms are pure fail but nice i'll have a look at your link later

    Right now im doing a complete rewrite, for example instead of using tard timers i use a background worker to look at the object count and clear the collection if the count don't match, then look at each object and asign new value if needed, this way i can also move all the memory reading to ONE class and store the offsets there for easy changing.

    @nopz: btw could you pm me your msn if you have one? because it looks like you have a good grip at wpf and im still learning so it would be great to have one i could ask questions once in a while if can't solve it myself

    edit:

    Oh nice thanks for the tips XTZGZoReX, the enum thing was one of the things i already planned to change in the above mentioned rewrite
    Last edited by !@^^@!; 01-20-2010 at 11:44 AM.

  5. #5
    amadmonk's Avatar Active Member
    Reputation
    124
    Join Date
    Apr 2008
    Posts
    772
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I still really don't understand the "guids are a class! make a class!" brigade. Why?

    I can definitely see exposing bitwise manipulations on the guid field, for the occasions where you need to know that an object is a boat vs. a vehicle vs. a standard GO.

    But actually treating guids as a structure rather than a simple 64 bit value is just needless complication. As a 64 bit value, you don't have to think any further about them, you can compare them easily (without having to worry about identity vs. equality issues), and you don't have any concerns with boxing costs.

    Just treat them as a ulong, and if you REALLY need all those fields as dot members off of guids, make some extension methods off of the UInt64 type.
    Don't believe everything you think.

  6. #6
    !@^^@!'s Avatar Active Member
    Reputation
    23
    Join Date
    Feb 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    amadmonk i totally agree with you, however i think i understand why he would do it like that... we're talking about MvvM here so he's kinda just following the pattern of models consisting of models till we're down to simple types, and implementing special coding for your case of boat vs vehicle vs standard go would be considered "hack'ish" and make the code a bit too ugly for the perfectionists

  7. #7
    adaephon's Avatar Active Member
    Reputation
    76
    Join Date
    May 2009
    Posts
    167
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wpf has inbuilt 2d And 3d vector classes (system.windows.vector and system.windows.media.media3d.vector3d) that have complete implementations with operator overloading and cross product/dot product etc. Reading and writing to and from wow you might need casting as they are double vectors not floats but otherwise avoids reimplementing them yourself

  8. #8
    !@^^@!'s Avatar Active Member
    Reputation
    23
    Join Date
    Feb 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay i have a small problem, i would like to do some optimizing of updating the collections so instead of doing a full .clear() and readd all the items i would like to .remove(x) and .add(x) the difference in items BUT i have no idea how to implement this, any tips?

  9. #9
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by amadmonk View Post
    I still really don't understand the "guids are a class! make a class!" brigade. Why?

    I can definitely see exposing bitwise manipulations on the guid field, for the occasions where you need to know that an object is a boat vs. a vehicle vs. a standard GO.

    But actually treating guids as a structure rather than a simple 64 bit value is just needless complication. As a 64 bit value, you don't have to think any further about them, you can compare them easily (without having to worry about identity vs. equality issues), and you don't have any concerns with boxing costs.

    Just treat them as a ulong, and if you REALLY need all those fields as dot members off of guids, make some extension methods off of the UInt64 type.
    L2Descriptors!

    Code:
            private byte[] Bytes1 { get { return BitConverter.GetBytes(GetStorageField<uint>(GameObjectFields.GAMEOBJECT_BYTES_1)); } }
            public WoWGameObjectType SubType { get { return (WoWGameObjectType) Bytes1[1]; } }
    GAWD

  10. #10
    DaleCooper's Avatar Private
    Reputation
    1
    Join Date
    Jan 2010
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think
    Code:
    localGuid = Bm.ReadUInt((objectManagerBase + localGuidOffset));
    Should be:
    Code:
    localGuid = Bm.ReadUInt64((objectManagerBase + localGuidOffset));
    Are these offset up to date? I'm getting kind of weird values for x,y,z and rotation for PlayerObjects.
    Code:
    z = -223,35221
    y = -8934,521
    x = NaN
    rotation = 71,58186
    I'm just getting started, but i thought rotation would be the direction your facing in radians? The value does not seem to change if i rotate.. But it does if i walk in a straight line in one direction. And x being NaN is also quite suspicious..

    EDIT:
    I think i found working offsets:
    OM_OBJ_X = 0x798
    OM_OBJ_Y = 0x79C
    OM_OBJ_Z = 0x7A0
    OM_OBJ_ROTATION =0x7A8
    Last edited by DaleCooper; 01-21-2010 at 01:34 PM.

  11. #11
    !@^^@!'s Avatar Active Member
    Reputation
    23
    Join Date
    Feb 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh yep thats right DaleCooper, i forgot to update the source when i updated the offsets...
    Anyway don't worry too much about it because im doing a complete rewrite of it that works alot better so far, just need to figure some threading issues out and then some value updating code that needs rewriting then im done

  12. #12
    !@^^@!'s Avatar Active Member
    Reputation
    23
    Join Date
    Feb 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright first post updated! :O

    (filler and double SRY!)

Similar Threads

  1. [C#][Source] BlackRain - Simple Object Manager Library
    By Seifer in forum WoW Memory Editing
    Replies: 195
    Last Post: 04-08-2015, 03:02 PM
  2. [C#][Source] Radar and Object Manager Tester / Verifier
    By xochi in forum WoW Memory Editing
    Replies: 18
    Last Post: 01-08-2011, 02:04 AM
  3. [SOURCE] WoW Object Dumper
    By kynox in forum WoW Memory Editing
    Replies: 13
    Last Post: 05-29-2008, 04:54 PM
  4. WoW Object Manager ?
    By discorly in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 07-28-2007, 06:34 PM
All times are GMT -5. The time now is 08:58 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search