A very efficient object enumeration method~ menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    qop1832's Avatar Active Member

    Reputation
    34
    Join Date
    Dec 2021
    Posts
    69
    Thanks G/R
    19/21
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    A very efficient object enumeration method~

    This method has a qualitative leap compared to traditional object traversal, even in languages like Python that are far less efficient than C, traversing 100 objects only takes about 0.002 seconds
    Code:
    import pymem
    
    
    def enum_object():
        obj_dict = {}
        chain_entry = pm.read_longlong(pm.base_address + 0x31c5600) + 0x120
        cur_chain_ptr = pm.read_longlong(chain_entry)
        if cur_chain_ptr == chain_entry:
            return obj_dict
        while True:
            object_entry = cur_chain_ptr - 0x68
            object_type = pm.read_bytes(object_entry + 0x10, 1)[0]
            guid = int.from_bytes(pm.read_bytes(object_entry + 0x18, 0x10), "little", signed=False)
            obj_dict[guid] = (object_type, hex(object_entry))
            cur_chain_ptr = pm.read_longlong(cur_chain_ptr)
            if cur_chain_ptr == chain_entry or cur_chain_ptr == 0:
                return obj_dict
    
    
    pm = pymem.Pymem("WowClassic.exe")
    object_dict = enum_object()
    obj_list.png
    Last edited by qop1832; 12-11-2023 at 06:25 AM.
    叼毛

    A very efficient object enumeration method~
  2. Thanks wesdjkl02 (1 members gave Thanks to qop1832 for this useful post)
  3. #2
    scizzydo's Avatar Established Member
    Reputation
    193
    Join Date
    Oct 2019
    Posts
    129
    Thanks G/R
    5/86
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Isn't what you're doing there already the traditional way? I'm confused

  4. #3
    qop1832's Avatar Active Member

    Reputation
    34
    Join Date
    Dec 2021
    Posts
    69
    Thanks G/R
    19/21
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Maybe I'm lagging behind,,, before this I saw that almost all (including myself) object traversal requires the use of Count, and then
    (Array + 0x8 * i) to traverse, this often requires nested loops, and does not jump out until enough Count has been read. This occasionally causes some problems and is very time-consuming. However, this does not require Count, and the code looks more concise and More efficient.
    叼毛

  5. Thanks wesdjkl02 (1 members gave Thanks to qop1832 for this useful post)
  6. #4
    Razzue's Avatar Elite User Avid Ailurophile

    CoreCoins Purchaser Authenticator enabled
    Reputation
    398
    Join Date
    Jun 2017
    Posts
    608
    Thanks G/R
    193/283
    Trade Feedback
    2 (100%)
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Edit** (foot in mouth moment)

    You're just iterating over the enum visible objects TsList While quicker, is still not the fastest.
    Code:
    internal Entity Search(Guid input)
    {
        var result = new Entity();
        try
        {
            if (input.IsEmpty()) return result;
    
    
            var hash = unchecked((0xA2AA033B * input.Value2) + (0xD6D018F5 * input.Value1));
    
    
            var index = hash & (tsArray.Maximum - 1);
            var pointer = tsArray.Entry<IntPtr>(index);
    
    
            if (pointer.ToInt64() == 0) return default;
            var wowObject = Memory.Read<Entity>(pointer);
            do
            {
                if (wowObject.Guid.Equals(input))
                {
                    result = wowObject;
                    break;
                }
    
    
                if (wowObject.Next.ToInt64() == 0) break;
                Memory.Read(wowObject.Next, ref wowObject);
            } while (true);
        }
        catch (Exception e) { Console.WriteLine(e); }
        return result;
    }
    Is a variation on chases Guid search method they posted a few months back, Is still the quickest call I've used for fetching entities at a whim.
    Using this I've all but abolished most of my entity caching (no point when I can grab specific entity in < 0.001 ms)

    Similar hashes also happen for WDB entry access, and DB2 field access internally (though different keys)
    Last edited by Razzue; 12-12-2023 at 06:10 AM.
    "May all your bacon burn"

  7. #5
    qop1832's Avatar Active Member

    Reputation
    34
    Join Date
    Dec 2021
    Posts
    69
    Thanks G/R
    19/21
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Does this method pass in the GUID to return the object pointer? Or am I understanding it wrong?~ If this is the case, is there any efficient way to get the GUID of all visible objects?
    叼毛

Similar Threads

  1. [Selling] Very efficient and safe GB2 profile! (My own personal)
    By Nke in forum World of Warcraft Buy Sell Trade
    Replies: 0
    Last Post: 10-28-2013, 05:06 AM
  2. Perfecting 800x600 DH Sarkoth, very efficient.
    By eter123 in forum D3 Gold profiles
    Replies: 7
    Last Post: 06-30-2012, 07:45 PM
  3. Endless Mob Farming (Very Efficient)
    By serioux in forum Diablo 3 Exploits
    Replies: 8
    Last Post: 06-18-2012, 02:17 PM
All times are GMT -5. The time now is 10:50 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