[C#, Idea] Direct access to object manager menu

User Tag List

Results 1 to 14 of 14
  1. #1
    Kryso's Avatar Active Member
    Reputation
    40
    Join Date
    Jul 2009
    Posts
    97
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C#, Idea] Direct access to object manager

    So I was thinking.. why make local copy of all objects in object manager each x seconds when we can directly interate through them? Yes, saving local copy every x seconds and then work with it is probably in most cases faster, but I dont really need to loop through whole array that often so it makes big difference.

    Code:
    public class BaseObjectCollection : IEnumerable<BaseObject> {
        internal BaseObjectCollection( uint firstNodeAddress ) {
            this.firstNodeAddress = firstNodeAddress;
        }
    
        private uint firstNodeAddress;
    
        public BaseObject FindByGuid( ulong guid ) {
            foreach ( BaseObject obj in this )
                if ( obj.Guid == guid )
                    return obj;
    
            return null;
        }
    
        #region IEnumerable
        public IEnumerator<BaseObject> GetEnumerator() {
            return new BaseObjectCollectionEnumerator( firstNodeAddress );
        }
    
        IEnumerator IEnumerable.GetEnumerator() {
            return new BaseObjectCollectionEnumerator( firstNodeAddress );
        }
        #endregion
    }
    
    public class BaseObjectCollectionEnumerator : MemoryManager, IEnumerator<BaseObject> {
        private const uint nextNodeOffset = 0x3c;
        private const uint guidOffset = 0x30;
        private const uint typeOffset = 0x14;
    
        internal BaseObjectCollectionEnumerator( uint firstNodeAddress ) {
            this.firstNodeAddress = firstNodeAddress;
        }
    
        private uint firstNodeAddress;
        private uint lastNodeAddress;
        private BaseObject current;
    
        #region IEnumerator
        public void Reset() {
            current = null;
            lastNodeAddress = firstNodeAddress;
        }
    
        public bool MoveNext() {
            uint pCurrent;
            if ( current == null )
                pCurrent = firstNodeAddress;
            else
                pCurrent = reader.ReadUInt( ( IntPtr )( lastNodeAddress + nextNodeOffset ) );
    
            if ( pCurrent == 0 || pCurrent % 2 != 0 )
                return false;
    
            lastNodeAddress = pCurrent;
    
            ulong guid = reader.ReadULong( ( IntPtr )( pCurrent + guidOffset ) );
            BaseObjectType type = ( BaseObjectType )reader.ReadUInt( ( IntPtr )( pCurrent + typeOffset ) );
    
            switch ( type ) {
                case BaseObjectType.Container:
                    current = new BaseObject( pCurrent );
                    break;
    
                case BaseObjectType.Corpse:
                    current = new BaseObject( pCurrent );
                    break;
    
                case BaseObjectType.DynamicObject:
                    current = new BaseObject( pCurrent );
                    break;
    
                case BaseObjectType.GameObject:
                    current = new BaseObject( pCurrent );
                    break;
    
                case BaseObjectType.Item:
                    current = new BaseObject( pCurrent );
                    break;
    
                case BaseObjectType.Player:
                    current = new Player( pCurrent );
                    break;
    
                case BaseObjectType.Unit:
                    current = new Unit( pCurrent );
                    break;
    
                default:
                    throw new Exception( "Unknown object type " + type );
            }
            return true;
        }
    
        public BaseObject Current {
            get { return current; }
        }
    
        object IEnumerator.Current {
            get { return current; }
        }
        #endregion
    
        #region IDisposable
        public void Dispose() {
            current = null;
        }
        #endregion
    }
    
    public enum BaseObjectType {
        Item = 1,
        Container = 2,
        Unit = 3,
        Player = 4,
        GameObject = 5,
        DynamicObject = 6,
        Corpse = 7
    }
    My projects is just at begining, so I have only defined BaseObject, Unit and Player, but I think everyone who reads this section can write those objects on its own. Also class MemoryManager is just little helper that allows me to read with "reader.xxx" instead of "WowClient.Reader.xxx" cuz I dont want to make reader static nor keep reference in every class.

    Is there something that I forgot, that makes this way of accessing objects bad?

    [C#, Idea] Direct access to object manager
  2. #2
    Bareno's Avatar Contributor
    Reputation
    195
    Join Date
    Sep 2006
    Posts
    477
    Thanks G/R
    5/11
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, for the technically challenged, what would that mean for others? What could we do with this that we couldn't do already? >_>

  3. #3
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why would you do this?
    Doesn't it complicate stuff alot?
    Storing the objects in a dictionary or list is still direct access, all you do is find all the base addresses for the objects, and store those.
    In all your properties you then just implement the memory reading using that base object that you already stored.
    That means you will only read the memory when it's necessary, and the initial loop of getting the baseaddresses is really fast (my tests said 1 ms).
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  4. #4
    ggg898's Avatar Member
    Reputation
    10
    Join Date
    Jan 2009
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont understand, looks to me that you do exactly what you trying to avoid, youre creating your baseobject for every object in the manager you are iterating over.

    Dont worry (too much) bout performance when creating copies of the objects in the manager. They arent that many, you dont need to do it too often, and youre not on a c64 counting rasterinterrupt sweeps and timing them with NOPs anymore... When you start having hundreds of thousands of objects then you can start worrying and start using object caches.

  5. #5
    Kryso's Avatar Active Member
    Reputation
    40
    Join Date
    Jul 2009
    Posts
    97
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes thats direct access for objects (that i'm using too), but not the actual list. With this method I should have almost* always the actual array.

    The BaseObject is just wrapper like you said

    Code:
    public class BaseObject : MemoryManager {
        internal BaseObject( uint address ) {
            this.address = address;
        }
    
        private uint address;
    
        internal uint Address {
            get { return address; }
        }
    
        public Serial Guid {
            get { return new Serial( reader.ReadULong( ( IntPtr )( address + 0x30 ) ) ); }
        }
    
        internal uint Fields {
            get { return reader.ReadUInt( ( IntPtr )( address + 0x8 ) ); }
        }
    
        public BaseObjectType Type {
            get { return ( BaseObjectType )reader.ReadUInt( ( IntPtr )( address + 0x14 ) ); }
        }
    }

    * I'm not sure how exactly wowclient handles object lists, if nodes after object removal got somehow erased or something - that would break this a little bit cuz I would loose reference to next node.

  6. #6
    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)
    You're early optimizing.
    Don't believe everything you think.

  7. #7
    furang's Avatar Member
    Reputation
    19
    Join Date
    Jul 2009
    Posts
    84
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone happen to know offsets from ObjectManager (i hope i find it correctly ) to LocalGUID, FirstObject and NextObject?
    Have to say i've searched for it. And found 0xC0, 0xAC and 0x30. Are they right?
    And offsets to objects's XYZ. I've found 0x7D0 0x7D4 0x7D8 but it seems to be 0x7D4 0x7D8 0x7DC as i look it in wow process.

  8. #8
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They are correct

  9. #9
    furang's Avatar Member
    Reputation
    19
    Join Date
    Jul 2009
    Posts
    84
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. it's nice to hear that. I'm not surprised.
    But i wonder why i've got GUIDs with 0 0 0 coords. Like this
    GUID: 4780000100DFDA92 Location: 0.000000 0.000000 0.000000
    GUID: 4780000100DFDAC9 Location: 0.000000 0.000000 0.000000
    GUID: 4780000102057C57 Location: 0.000000 0.000000 0.000000
    GUID: 4780000102058C5A Location: 0.000000 0.000000 0.000000
    GUID: 4780000102154AA2 Location: 0.000000 0.000000 0.000000
    GUID: 07800000018B69B3 Location: 10438.055664 782.408997 1322.679932
    GUID: 4780000102B98A79 Location: 0.000000 0.000000 0.000000
    GUID: F110003040000059 Location: 0.000000 0.000000 0.000000
    GUID: F11000303F0003B6 Location: 0.000000 0.000000 0.000000
    GUID: F13000081D001722 Location: 10389.803711 763.477112 1319.954102
    GUID: F130002F80000678 Location: 10394.998047 743.602966 1319.880127
    GUID: F11000806F0000B2 Location: 0.000000 0.000000 0.000000
    GUID: F11000080D0000B3 Location: 0.000000 0.000000 0.000000
    GUID: F1300021870012D9 Location: 10407.167969 713.794189 1321.617065
    GUID: F130000E0500067D Location: 10436.689453 794.837341 1322.701904
    Or maybe they are some kind of abstract objects (i'm not a wow player so i don't know if something like this exists) or maybe it's because of wrong ObjectManager manager pointer?

  10. #10
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Guess the coords of your items.

  11. #11
    Sel3n's Avatar Member
    Reputation
    10
    Join Date
    Jul 2009
    Posts
    115
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Even if abstrac object exists, there are coordinates (no?), I think it's because of wrong ObjectManager manager pointer too.

  12. #12
    furang's Avatar Member
    Reputation
    19
    Join Date
    Jul 2009
    Posts
    84
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've sold almost all i had, but the number of "zero coords" GUID didn't become less. (And imho it's reasonable that items have the same coords, that you have).
    I'm using 0x2C as offset from ThreadBase to TLS, and 0x10 as offset from TLS to ObjectManager. Maybe they are wrong?

  13. #13
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dont use that old method

  14. #14
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Stop using s_curMgr and all that crap. Learn how to use EnumVisibleObjects. It's far faster than the crap you guys are doing. (And more controlled)

    Certain objects won't have locations; as they're unnecessary. (See; items)

Similar Threads

  1. [APP] - Malu05's Ingame Object Manager.
    By UnknOwned in forum WoW ME Tools & Guides
    Replies: 16
    Last Post: 05-30-2009, 01:42 PM
  2. Mobs missing from object manager.
    By RawrSnarl in forum WoW Memory Editing
    Replies: 23
    Last Post: 12-31-2008, 01:31 PM
  3. Object Manager
    By Shamun in forum WoW Memory Editing
    Replies: 11
    Last Post: 11-28-2008, 02:06 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 05:59 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search