Getting player buffs on 3.3.5, sometimes worng results menu

User Tag List

Results 1 to 6 of 6
  1. #1
    dlablo's Avatar Active Member Authenticator enabled
    Reputation
    55
    Join Date
    Nov 2014
    Posts
    91
    Thanks G/R
    11/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting player buffs on 3.3.5, sometimes worng results

    First of all, the way im doing it is exactly how wow does it. Im making a PQR bot that will stay out of process, so this is how i read the aura fields.
    PHP Code:
            public bool checkForBuff2(uint auraField1int buffID)
            {
                
    //auraField1 = This is the address of the current object in the object manager
                
    try
                {
                    
    int auraCount lib.ReadInt(auraField1 0xDD0);
                    
    uint auraTable auraField1 0xC50;

                    if (
    auraCount == -1)
                    {
                        
    auraCount lib.ReadInt(auraField1 0xC54);
                        
    auraTable auraField1 0xC58;
                    }
                    
    int SpellID;
                    for (
    uint i 0auraCounti++)
                    {
                        
    SpellID lib.ReadInt((uint)auraTable + ((uint)0x18 i) + (uint)0x8);
                        if (
    spellRipperIsOn)
                        {
                            if (!
    spells_DBC.ContainsKey(SpellID) && !spells_temporary_DBC.ContainsKey(SpellID) && !spells_forScan.ContainsKey(SpellID)){
                                
    spells_forScan.Add(SpellID0);
                            }
                        }
                        if (
    SpellID 0)
                        {
                            if (
    SpellID == buffID){
                                
    //log("Buff was found");
                                
    return true;
                            }
                        }
                    }
                }
                catch (
    Exception e)
                {
                    
    log("[860]Failed to read buff. Exception : "+e.ToString());
                }
                return 
    false;
            } 
    Reading the buffs is the most important thing of a PQR bot. So i'm trying to make this 100% accuarate. When i restart the game i start with my spell rotation, everything is working perfectly. However, when some time passes or the amount of buffs is getting bigger, i don't seem to get correct results. This function is the C# version of (0x00556E10 CGUnit_C__GetAura). The offsets && addresses are 100% the same as in this wow function. So i just don't get what's wrong?

    While i was debugging, i decided to manually increase the "auraCount" variable by 3, and i started to get valid results (only for some spells). Which means that im not using the right "count" offset. It has to be dynamic offset because sometimes the count is correct and sometimes it isnt. And the offset is the same as in the wow function. If someone had the same problem please give me some advice. I made such a complex stuff(pathfinding system, 1click level 80 bot, world2screen), and yet nothing was more complex than those aura fields.... in my experience as a programmer i was never stuck for so long on something, PLEASE HELP ME!!

    Getting player buffs on 3.3.5, sometimes worng results
  2. Thanks Corthezz (1 members gave Thanks to dlablo for this useful post)
  3. #2
    dlablo's Avatar Active Member Authenticator enabled
    Reputation
    55
    Join Date
    Nov 2014
    Posts
    91
    Thanks G/R
    11/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fixed it. Posting my code for future reference.

    Code:
    // auraField1 = this is the address for the current object in the object mngr
            public bool checkForBuff3(uint auraField1, int buffID)
            {
                var auraCount = lib.ReadInt(auraField1 + 0xDD0);
                if (auraCount == -1)
                {
                    auraCount = lib.ReadInt(auraField1 + 0xC54); ;
                }
                int SpellID = 0;
                for (uint i = 0; i < auraCount; i++)
                {
                    if (lib.ReadInt(auraField1 + 0xDD0) == -1)
                    {
                        var auraTable = lib.ReadUInt(auraField1 + 0xC58);
                        SpellID = lib.ReadInt((uint)auraTable + ((uint)0x18 * i) + (uint)0x8);
                        if (SpellID == buffID){
                            return true;
                        }
                    }
                    else
                    {
                        SpellID = lib.ReadInt((uint)auraField1 + 0xC50 + ((uint)0x18 * i) + (uint)0x8);
                        if (SpellID == buffID)
                        {
                            return true;
                        }
                    }
                }
                return false;
            }
    This function returns 100% accurate results if someone has a specific buff or not(Tested on 3.3.5 an and 4.3.4, not sure if there are any changes in future versions). However, i copy/paste that function from lazybot's source code(4.3 version). Many thanks to the users who upgraded lazybot to it's current version, and many thanks to Arthua for making it. I would've never fixed my issue without copying from your code.... the problem with my previous function was that line.

    Code:
    if (lib.ReadInt(auraField1 + 0xDD0) == -1)
                    {
                        var auraTable = lib.ReadUInt(auraField1 + 0xC58); // <-- (THAT'S WHAT I WAS MISSING IN MY CODE) AuraTable2 becomes a pointer when the buff count increases, and when the buff count decreases it still remains a pointer
                        SpellID = lib.ReadInt((uint)auraTable + ((uint)0x18 * i) + (uint)0x8);
                        if (SpellID == buffID){
                            return true;
                        }
                    }
    Last edited by dlablo; 03-08-2022 at 06:26 AM.

  4. Thanks Corthezz (1 members gave Thanks to dlablo for this useful post)
  5. #3
    dlablo's Avatar Active Member Authenticator enabled
    Reputation
    55
    Join Date
    Nov 2014
    Posts
    91
    Thanks G/R
    11/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    + Checking if the caster is you
    Code:
            public bool checkForBuffCasterIsMe(uint auraField1, int buffID)
            {
                var auraCount = lib.ReadInt(auraField1 + 0xDD0);
                if (auraCount == -1)
                {
                    auraCount = lib.ReadInt(auraField1 + 0xC54); ;
                }
                int SpellID;
                for (uint i = 0; i < auraCount; i++)
                {
                    if (lib.ReadInt(auraField1 + 0xDD0) == -1)
                    {
                        var auraTable = lib.ReadUInt(auraField1 + 0xC58);
                        SpellID = lib.ReadInt((uint)auraTable + ((uint)0x18 * i) + (uint)0x8);
                        if (SpellID == buffID)
                        {
                            //log("Looking for " + buffID + " found " + SpellID);
                            ulong casterGuid = lib.ReadUInt64((uint)auraTable + ((uint)0x18 * i));
                            if (casterGuid == myGuid)
                            {
                                //log("Found " + SpellID + ", Caster is " + casterGuid + " My guid is " + myGuid);
                                return true;
                            }
                        }
                    }
                    else
                    {
                        SpellID = lib.ReadInt((uint)auraField1 + 0xC50 + ((uint)0x18 * i) + (uint)0x8);
                        if (SpellID == buffID)
                        {
                            //log("Looking for "+buffID+" found "+SpellID);
                            ulong casterGuid = lib.ReadUInt64((uint)auraField1 + 0xC50 + ((uint)0x18 * i));
                            if (casterGuid == myGuid)
                            {
                                //log("Found "+SpellID+", Caster is "+casterGuid+" My guid is "+myGuid);
                                return true;
                            }
                        }
                    }
                }
                return false;
            }
    If this bool returns false, the caster is not you. This check is required if you are boting in raid, and you have multiple people the same class as you. You won't only check if target has a buff, but if the caster is you also. So you won't lose DPS durring your spell rotation = )

  6. Thanks Corthezz (1 members gave Thanks to dlablo for this useful post)
  7. #4
    Razzue's Avatar Contributor Avid Ailurophile

    CoreCoins Purchaser Authenticator enabled
    Reputation
    378
    Join Date
    Jun 2017
    Posts
    588
    Thanks G/R
    184/267
    Trade Feedback
    2 (100%)
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kopoil View Post
    + Checking if the caster is you
    Code:
            public bool checkForBuffCasterIsMe(uint auraField1, int buffID)
            {
                var auraCount = lib.ReadInt(auraField1 + 0xDD0);
                if (auraCount == -1)
                {
                    auraCount = lib.ReadInt(auraField1 + 0xC54); ;
                }
                int SpellID;
                for (uint i = 0; i < auraCount; i++)
                {
                    if (lib.ReadInt(auraField1 + 0xDD0) == -1)
                    {
                        var auraTable = lib.ReadUInt(auraField1 + 0xC58);
                        SpellID = lib.ReadInt((uint)auraTable + ((uint)0x18 * i) + (uint)0x8);
                        if (SpellID == buffID)
                        {
                            //log("Looking for " + buffID + " found " + SpellID);
                            ulong casterGuid = lib.ReadUInt64((uint)auraTable + ((uint)0x18 * i));
                            if (casterGuid == myGuid)
                            {
                                //log("Found " + SpellID + ", Caster is " + casterGuid + " My guid is " + myGuid);
                                return true;
                            }
                        }
                    }
                    else
                    {
                        SpellID = lib.ReadInt((uint)auraField1 + 0xC50 + ((uint)0x18 * i) + (uint)0x8);
                        if (SpellID == buffID)
                        {
                            //log("Looking for "+buffID+" found "+SpellID);
                            ulong casterGuid = lib.ReadUInt64((uint)auraField1 + 0xC50 + ((uint)0x18 * i));
                            if (casterGuid == myGuid)
                            {
                                //log("Found "+SpellID+", Caster is "+casterGuid+" My guid is "+myGuid);
                                return true;
                            }
                        }
                    }
                }
                return false;
            }
    If this bool returns false, the caster is not you. This check is required if you are boting in raid, and you have multiple people the same class as you. You won't only check if target has a buff, but if the caster is you also. So you won't lose DPS durring your spell rotation = )
    You can also just read the aura as a struct instead of looping the list on every needed call. struct for live of course but meh :shrug:
    Code:
    [StructLayout(LayoutKind.Explicit)]
    public struct UnitAura
    {
        [FieldOffset(0x68)]
        public GUID Caster;
    
        [FieldOffset(0x88)]
        public uint SpellID;
    
        [FieldOffset(0x90)]
        public short Flag;
    
        [FieldOffset(0x91)]
        public byte Stack1;
    
        [FieldOffset(0x91)]
        public byte Stack2;
    
        [FieldOffset(0x94)]
        public byte Level;
    
        [FieldOffset(0x98)]
        public uint Duration;
    
        [FieldOffset(0x9C)]
        public uint Expiration;
    
    }
    Code:
    private static bool GetAuras(GameUnit u, out List<UnitAura> Auras)
    {
        try
        {
            var c = Ven.Read<int>(u.Base + Fields.Aura.Table1);
            if (c == -1) c = Ven.Read<int>(u.Base + Fields.Aura.Table2);
            var Base = c == -1 ? u.Base + Fields.Aura.Table1 : u.Base + Fields.Aura.Table2;
    
            Auras = new List<UnitAura>();
            if (Base == IntPtr.Zero || u.Base == IntPtr.Zero) return false;
            for (var Index = 0; Index < c; Index++)
            {
                var Aura = Ven.Read<UnitAura>(Base + (Index * Fields.Aura.Size));
                if (Aura.SpellID != 0)
                    Auras.Add(Aura);
    
            }
            return Auras.Count > 0;
        }
        catch (Exception)
        {
            Auras = new List<UnitAura>();
            return false;
        }
    }
    
    

  8. #5
    dlablo's Avatar Active Member Authenticator enabled
    Reputation
    55
    Join Date
    Nov 2014
    Posts
    91
    Thanks G/R
    11/18
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im making this for a PQR bot, in which you have menu to add spells and conditions for them. When i am checking for a certain condition, i want to get only the value i aim at.
    Example, i got 2 conditions for some spell.
    Condition 1, check if target has buff Corruption
    Condition 2, check if target's Corruption buff caster is not me

    Each condition scans the entire object manager on the go. Storing stuff in lists just slows down my program. I was able to make spell rotation with lots of spells and lots of conditions. Yet, only 3% CPU usage. I scan object manager 30 times per 0.1 second(300 times a second). And i get 3% CPU usage on my 4 core processor. I think that's good.
    Last edited by dlablo; 03-09-2022 at 10:35 AM.

  9. #6
    ZMYZY's Avatar Member
    Reputation
    1
    Join Date
    Sep 2023
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice!你的程序看上去非常简洁明了,可读性非常高!

Similar Threads

  1. [How To] PQR cast spell based on player buff
    By AnimatedHF1 in forum WoW Bots Questions & Requests
    Replies: 8
    Last Post: 01-16-2018, 09:44 AM
  2. Replies: 0
    Last Post: 03-14-2014, 06:05 AM
  3. Northrend well fed buff on any level player
    By steveor in forum World of Warcraft Exploits
    Replies: 7
    Last Post: 11-29-2008, 07:35 PM
  4. [Exploit] Level 65 Buff on Level 1 player.
    By atticus589 in forum World of Warcraft Exploits
    Replies: 7
    Last Post: 03-10-2008, 04:23 PM
  5. Queue in AB or WSG with deserter buff on
    By Matt in forum World of Warcraft Exploits
    Replies: 0
    Last Post: 04-07-2006, 07:28 AM
All times are GMT -5. The time now is 09:46 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