1. #1

    Weak Auras and tracking all shields help please!

    So, I've been having a friend help me with setting up a custom weak aura to track the total of all absorbs on me and the only one that doesn't work is Sacred Shield. Just wondering if someone more knowledgeable could take a look as we've been searching all over the internet for a solution. Basically, the weak auras icon shows up when the second sacred shield buff activates, but it isn't returning the proper amount. It's returning 0. It does work with all of the other included absorbs.

    Code:
    function()
        
        
        
        -- BLOOD SHIELD VALUE FUNCTION
        WA_GetBS = WA_GetBS or function()
            
            -- Check for Blood Shield
            local name = select(1, UnitAura("player", "Blood Shield"));
            
            -- If exists then check value
            if name then
                
                -- Query stack count and scan tooltip for "size" info
                local count = select(4, UnitAura("player", "Blood Shield"));
                local size = select(3, WeakAuras.GetAuraTooltipInfo("player", name, nil))
                
                -- Return either size, count, or 0            
                return size and size ~= 0 and size or count or 0;
                
                -- No buff
            else
                return 0;
            end
        end
        -- ***************************
        
        
        
        
        
        
        -- POWER WORD: SHIELD VALUE FUNCTION
        WA_GetPWS = WA_GetPWS or function()
            
            -- Check for Power Word: Shield
            local name = select(1, UnitAura("player", "Power Word: Shield"));
            
            -- If exists then check value
            if name then
                
                -- Query stack count and scan tooltip for "size" info
                local count = select(4, UnitAura("player", "Power Word: Shield"));
                local size = select(3, WeakAuras.GetAuraTooltipInfo("player", name, nil))
                
                -- Return either size, count, or 0            
                return size and size ~= 0 and size or count or 0;
                
                -- No buff
            else
                return 0;
            end
        end
        -- *********************************
        
        
        
        
        
        -- DIVINE AEGIS VALUE FUNCTION
        WA_GetDA = WA_GetDA or function()
            
            -- Check for Divine Aegis
            local name = select(1, UnitAura("player", "Divine Aegis"));
            
            -- If exists then check value
            if name then
                
                -- Query stack count and scan tooltip for "size" info
                local count = select(4, UnitAura("player", "Divine Aegis"));
                local size = select(3, WeakAuras.GetAuraTooltipInfo("player", name, nil))
                
                -- Return either size, count, or 0            
                return size and size ~= 0 and size or count or 0;
                
                -- No buff
            else
                return 0;
            end
        end
        -- ***************************
        
        
        
        
        -- ILLUMINATED HEALING  VALUE FUNCTION
        WA_GetIH = WA_GetIH or function()
            
            -- Check for Illuminated Healing
            local name = select(1, UnitAura("player", "Illuminated Healing" ));
            
            -- If exists then check value
            if name then
                
                -- Query stack count and scan tooltip for "size" info
                local count = select(4, UnitAura("player", "Illuminated Healing" ));
                local size = select(3, WeakAuras.GetAuraTooltipInfo("player", name, nil))
                
                -- Return either size, count, or 0            
                return size and size ~= 0 and size or count or 0;
                
                -- No buff
            else
                return 0;
            end
        end
        -- ***************************
        
        
        -- SPIRIT SHELL  VALUE FUNCTION
        WA_GetSS = WA_GetSS or function()
            
            -- Check for Spirit Shell
            local name = select(1, UnitAura("player", "Spirit Shell"));
            
            -- If exists then check value
            if name then
                
                -- Query stack count and scan tooltip for "size" info
                local count = select(4, UnitAura("player", "Spirit Shell"));
                local size = select(3, WeakAuras.GetAuraTooltipInfo("player", name, nil))
                
                -- Return either size, count, or 0            
                return size and size ~= 0 and size or count or 0;
                
                -- No buff
            else
                return 0;
            end
        end
        -- ***************************
        
        
        -- SACRED SHIELD SHIELD VALUE FUNCTION
        WA_GetSAS = WA_GetSAS or function()
            
            -- Check for Sacred Shield         
            local spellId = select(11, UnitAura("player","Sacred Shield"))
            
            -- since two auras exist, specify spellid
            if spellId == 65148 then
                
                -- If exists then check value
                if spellId then
                    
                    
                    -- Query stack count and scan tooltip for "size" info
                    local count = select(4, UnitAura("player", spellId ));
                    local size = select(3, WeakAuras.GetAuraTooltipInfo("player", spellId , nil))
                    
                    -- Return either size, count, or 0            
                    return size and size ~= 0 and size or count or 0;
                    
                    -- No buff
                else
                    return 0;
                end
            else  end
            
        end
        -- ***************************
        
        
        
        
        
        -- Create local value variables
        local bs = WA_GetBS();
        local pws = WA_GetPWS();
        local da = WA_GetDA();
        local ih = WA_GetIH();
        local ss = WA_GetSS();
        local sas = WA_GetSAS();
        
        -- Add all variables into total
        local total = bs+pws+da+ss+ih+sas
        
        -- Divide by 1k
        local totalK = total/1000
        
        -- Format return text
        WA_BS_Return = string.format("%.0fK", totalK);
        
        -- Return the text!
        return WA_BS_Return or "0";
    end


    <Stay Mad> 10/10M Nighthold 5/9M ToS

  2. #2
    Deleted
    Code:
    WA_GetSAS = WA_GetSAS or function()
        for i=1, 40, 1 do
            local spellId = select(11, UnitAura("player",i))
            if spellId==65148 then
                local size = select(3, WeakAuras.GetAuraTooltipInfo("player", i, nil))
                return size or 0 
            end
        end
        return 0
    end
    Problem is that UnitAura("player","Sacred Shield") only return the first instance of that buff and that's the long one. You have to loop through all active auras to get the right one. The code above should do the trick.

  3. #3
    Deleted
    Or just use:
    Code:
    function() return ("%0.1fk"):format(UnitGetTotalAbsorbs("player")/1000) end
    And update on UNIT_ABSORB_AMOUNT_CHANGED event.

  4. #4
    Just customize it yourself instead of writing code... This isnt a application your writing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •