GetSpellCharges menu

User Tag List

Results 1 to 1 of 1
  1. #1
    counted's Avatar Contributor Authenticator enabled
    Reputation
    203
    Join Date
    Mar 2008
    Posts
    183
    Thanks G/R
    11/108
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    GetSpellCharges

    I wanted to add SpellCharges to my bot for spells like Savage Defense, Dark Soul: Misery, Shield Block ...

    you need to get the spell category from SpellDB. I do not have an OOP sub for that so I dumped the column using TomRus's DB Tool and made a sub that returns spell category from spell ID. Then you use that number to get the SpellCatagoryDB row field 9 and then search the SpellChargesHistory table. You count up the number of times you find it and subtract that from the max available.

    You can find all of the code you need in the 20726 binary sub 67172b.

    -counted

    Code:
     public int UsedCharges
            {
                get
                {
                    // from Script_GetSpellCharges
                    //20726 sub 67172b
                    //pSpellRow = GetEncryptedRow(spellID)
                    //val GetRow(g_DB_SpellCategories, pSpellRow + 0x30)  // Field 0xc 
                    // val = spelldb catagory => spellcatagoryDB => val
    
                    uint pCurrentEntry = TC.Pmr.Read<uint>(Offsets.SpellChargesBase + 8 * 4);
                    int count = 0;
                    int v4 = 0;
                    int catagoryIndex = BarMapper.GetSpellCatagory(SpellId);
    
                    CGDBC.CGDBCTable db = CGDBC.Instance.GetDb(eCGDBC.SpellCategories);
    
                    CGDBC.Row cataRow = db.GetRow(catagoryIndex);
    
                    int spellcatagory = cataRow.GetField<int>(9);
    
                    while ((pCurrentEntry & 1) == 0 && pCurrentEntry > 0)
                    {
                        uint pNextEntry = TC.Pmr.Read<uint>(pCurrentEntry + 4);
                        int currentcatagory = TC.Pmr.Read<int>(pCurrentEntry + 8);
    
                        if (currentcatagory == spellcatagory)
                        {
                            count = count + TC.Pmr.Read<byte>(pCurrentEntry + 0xc);
                            //todo [BarSpell] what the heck is v4 doing??
                            if (v4 == 0 || TC.Pmr.Read<uint>(pCurrentEntry + 0x10) - v4 < 0)                  
                                v4 = TC.Pmr.Read<int>(pCurrentEntry + 0x10);                     
                        }
                        pCurrentEntry = pNextEntry;
                    }
    
                    return count;
                }
            }

    GetSpellCharges

Similar Threads

  1. GetSpellCharges reversing
    By NitroGlycerine in forum WoW Memory Editing
    Replies: 4
    Last Post: 09-05-2014, 05:06 PM
All times are GMT -5. The time now is 03:34 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