Nikita
09-19-2011, 05:06 AM
Hi there
Been wanting to setup some kind of proc handling system for my elemental shamans.
What I would like to do is handle procs like Maat does.
Simply have a button which spams Earth Shock, this button wont be clickable until I have 7-9 stacks of Lightning Orbs.
Been toying with Maats script, but with no succsess at all. Any1 got any ideas how to go forward with this?
-------------------------------------------------------------------------
-- FRAMES
-------------------------------------------------------------------------
local addon = CreateFrame("Frame", UIParent)
local numFrames = 4
-- Global table for debugging purpsoe
mh = {}
local mhKey = "mh%d"
for i=1, numFrames do
mh[mhKey:format(i)] = true
mh[mhKey:format(i).."bg"] = true
end
-- Action bar slot size
local posXoffset = 26
local posX = 0
-- generate frames and background
for i=1, numFrames do
mh[mhKey:format(i)] = CreateFrame("Frame", UIParent)
mh[mhKey:format(i).."bg"] = mh[mhKey:format(i)]:CreateTexture("Background", "BACKGROUND")
mh[mhKey:format(i).."bg"]:SetTexture(1, 1, 1, 0.05)
mh[mhKey:format(i).."bg"]:SetAllPoints()
mh[mhKey:format(i)]:SetSize(24,24)
mh[mhKey:format(i)]:SetScript("OnMouseDown", function() end)
posX = posX + posXoffset
mh[mhKey:format(i)]:SetPoint("CENTER", WorldFrame, "CENTER", posX, 375)
end
-------------------------------------------------------------------------
-- Utility
-------------------------------------------------------------------------
local function OnUpdate()
-- Shaman section
if select(2,UnitClass("player")) == "SHAMAN" then
if select(8,GetTalentInfo(3,10)) == 0 then mh.mh1:Hide() mh.mh2:Hide() mh.mh3:Hide() mh.mh4:Hide() return end
-- Ele shaman section
if not UnitBuff("player", "Lightning Shield") then
if UnitPower("player", 9) == 3 then
mh.mh2:Hide()
else
mh.mh2:Show()
end
----------------------------------------------------------------
-- EVENT HANDLING
-------------------------------------------------------------------------
do
local f = CreateFrame("Frame")
local total = 0
f:SetScript("OnUpdate", function(self, elapsed)
total = total + elapsed
if total > 0.2 then
OnUpdate()
total = 0
end
end)
end
addon:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
addon:RegisterEvent("UNIT_POWER")
addon:SetScript("OnEvent", function(self, event, ...)
self[event](self, ...)
end)
Would the lua script be similar to this?
Regards Nikita
Been wanting to setup some kind of proc handling system for my elemental shamans.
What I would like to do is handle procs like Maat does.
Simply have a button which spams Earth Shock, this button wont be clickable until I have 7-9 stacks of Lightning Orbs.
Been toying with Maats script, but with no succsess at all. Any1 got any ideas how to go forward with this?
-------------------------------------------------------------------------
-- FRAMES
-------------------------------------------------------------------------
local addon = CreateFrame("Frame", UIParent)
local numFrames = 4
-- Global table for debugging purpsoe
mh = {}
local mhKey = "mh%d"
for i=1, numFrames do
mh[mhKey:format(i)] = true
mh[mhKey:format(i).."bg"] = true
end
-- Action bar slot size
local posXoffset = 26
local posX = 0
-- generate frames and background
for i=1, numFrames do
mh[mhKey:format(i)] = CreateFrame("Frame", UIParent)
mh[mhKey:format(i).."bg"] = mh[mhKey:format(i)]:CreateTexture("Background", "BACKGROUND")
mh[mhKey:format(i).."bg"]:SetTexture(1, 1, 1, 0.05)
mh[mhKey:format(i).."bg"]:SetAllPoints()
mh[mhKey:format(i)]:SetSize(24,24)
mh[mhKey:format(i)]:SetScript("OnMouseDown", function() end)
posX = posX + posXoffset
mh[mhKey:format(i)]:SetPoint("CENTER", WorldFrame, "CENTER", posX, 375)
end
-------------------------------------------------------------------------
-- Utility
-------------------------------------------------------------------------
local function OnUpdate()
-- Shaman section
if select(2,UnitClass("player")) == "SHAMAN" then
if select(8,GetTalentInfo(3,10)) == 0 then mh.mh1:Hide() mh.mh2:Hide() mh.mh3:Hide() mh.mh4:Hide() return end
-- Ele shaman section
if not UnitBuff("player", "Lightning Shield") then
if UnitPower("player", 9) == 3 then
mh.mh2:Hide()
else
mh.mh2:Show()
end
----------------------------------------------------------------
-- EVENT HANDLING
-------------------------------------------------------------------------
do
local f = CreateFrame("Frame")
local total = 0
f:SetScript("OnUpdate", function(self, elapsed)
total = total + elapsed
if total > 0.2 then
OnUpdate()
total = 0
end
end)
end
addon:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
addon:RegisterEvent("UNIT_POWER")
addon:SetScript("OnEvent", function(self, event, ...)
self[event](self, ...)
end)
Would the lua script be similar to this?
Regards Nikita