WoWInterface SVN ristrettoPower

[/] [trunk/] [util.lua] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 Hoern-42580
addon, ns = ...
2 Hoern-42580
 
3 Hoern-42580
util = CreateFrame("Frame")
4 Hoern-42580
 
5 Hoern-42580
util.tmisses = function(tab, el)
6 Hoern-42580
        for k, v in pairs(tab) do
7 Hoern-42580
          if k == el then
8 Hoern-42580
            return false
9 Hoern-42580
          end
10 Hoern-42580
        end
11 Hoern-42580
        return true
12 Hoern-42580
end
13 Hoern-42580
 
14 Hoern-42580
util.currDP = function()
15 Hoern-42580
        local dp = GetSpellInfo(72330)
16 Hoern-42580
        local _, _, _, count, _, _, _, whodunnit = UnitAura("target", dp, nil, "HARMFUL")
17 Hoern-42580
        if count == nil then return 0 end
18 Hoern-42580
        return count
19 Hoern-42580
end
20 Hoern-42580
 
21 Hoern-42580
util.currMaelstrom = function ()
22 Hoern-42580
        local msw = GetSpellInfo(53817)
23 Hoern-42580
        local _, _, _, count, _, _, _, whodunnit = UnitAura("player", msw, nil, "HELPFUL")
24 Hoern-42580
        if count == nil then return 0 end
25 Hoern-42580
        if whodunnit == "player" then
26 Hoern-42580
                return count
27 Hoern-42580
        end
28 Hoern-42580
end
29 Hoern-42580
 
30 Hoern-42580
util.currOrbs = function()
31 Hoern-42580
        local orb = GetSpellInfo(77487)
32 Hoern-42580
        local _, _, _, count, _, _, _, whodunnit = UnitAura("player", orb, nil, "HELPFUL")
33 Hoern-42580
        if count == nil then return 0 end
34 Hoern-42580
        return count
35 Hoern-42580
end
36 Hoern-42580
 
37 Hoern-42580
util.currShards = function()
38 Hoern-42580
        return UnitPower("player", SPELL_POWER_SOUL_SHARDS)
39 Hoern-42580
end
40 Hoern-42580
 
41 Hoern-42580
util.currHolyPower = function()
42 Hoern-42580
        return UnitPower("player", SPELL_POWER_HOLY_POWER)
43 Hoern-42580
end
44 Hoern-42580
 
45 Hoern-42580
util.currCP = function()
46 Hoern-42580
        return GetComboPoints("player")
47 Hoern-42580
end
48 Hoern-42580
 
49 Hoern-42580
util.currLB = function()
50 Hoern-42580
        local lb = GetSpellInfo(324)
51 Hoern-42580
        local _, _, _, count, _, _, _, whodunnit = UnitAura("player", lb, nil, "HELPFUL")
52 Hoern-42580
        if count == nil then return 0 end
53 Hoern-42580
        if count < 3 then return 0 end
54 Hoern-42580
        return count - 3
55 Hoern-42580
end
56 Hoern-42580
 
57 Hoern-42580
util.updateBorder = function(max, curr, red, green, blue, redset, greenset, blueset)
58 Hoern-42580
        for i = 1, max do
59 Hoern-42580
                if i <= curr then
60 Hoern-42580
                        _G['powerframe'..i]:SetBackdropBorderColor(redset, greenset, blueset, 1)
61 Hoern-42580
                else
62 Hoern-42580
                        _G['powerframe'..i]:SetBackdropBorderColor(red, green, blue, 1)
63 Hoern-42580
                end
64 Hoern-42580
        end
65 Hoern-42580
end
66 Hoern-42580
 
67 Hoern-42580
util.updateVisuals = function(max, curr, red, green, blue)
68 Hoern-42580
        for i = 1, max do
69 Hoern-42580
                if i <= curr then
70 Hoern-42580
                        _G['powerframe'..i]:SetBackdropColor(red, green, blue,1)
71 Hoern-42580
                else
72 Hoern-42580
                        _G['powerframe'..i]:SetBackdropColor(red, green, blue,0.1)
73 Hoern-42580
                end
74 Hoern-42580
        end
75 Hoern-42580
end
76 Hoern-42580
 
77 Hoern-42580
ns.util = util