Created
September 13, 2014 21:26
-
-
Save nefftd/4359f6b93eb8b2aab564 to your computer and use it in GitHub Desktop.
Early prototype
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local WHITELIST = {[8122]=1,[408]=1,[1833]=1,[6770]=1,[2094]=1,[118]=1,[82691]=1,[71757]=1,[12598]=1,[122]=1,[33395]=1,[83302]=1,[76577]=1,[12357]=1,[44572]=1,[55021]=1, | |
[2823]=1,[108215]=1,[108212]=1,[137573]=1, -- REMOVE FOR FINAL. ONLY FOR TESTING | |
} | |
--[=[ | |
local buttons = {} | |
for i = 1,5 do | |
local i = i -- Store the unit ID in an upvalue | |
buttons['arena'..i] = setmetatable({},{__index = function(self,b) | |
--[[ build button i ]] | |
local btn = CreateFrame('Frame','nfaDB'..i..b,'ArenaEnemyFrame'..i,'TargetDebuffFrameTemplate') | |
btn:SetPoint(--[[ calculate point with i, b ]]) | |
local T=CreateFontString(nil,'OVERLAY') | |
T:SetAllPoints() | |
T:SetFont(UNIT_NAME_FONT,10,'OUTLINE') | |
btn:SetScript('OnUpdate',function(s) | |
T:SetText(ceil(s.e-GetTime())) | |
end) | |
end}) | |
end | |
--]=] | |
local i=1 | |
local buttons = {} | |
buttons['player'] = setmetatable({},{__index = function(self,b) | |
--[[ build button i ]] | |
local btn = CreateFrame('Frame','nfaDB'..i..b,UIParent,'TargetDebuffFrameTemplate') | |
btn:SetPoint('CENTER',24*b,0) | |
local T=btn:CreateFontString(nil,'OVERLAY') | |
T:SetPoint'CENTER' | |
T:SetFont(UNIT_NAME_FONT,10,'OUTLINE') | |
btn:SetScript('OnUpdate',function(s) | |
local left = s.e-GetTime() | |
if left >= 60 then | |
T:SetFormattedText('%dm',floor(left/60+.5)) | |
else | |
T:SetText(ceil(left)) | |
end | |
end) | |
btn.unit='player' btn:SetID(b) | |
self[b]=btn | |
return btn | |
end}) | |
local function UNIT_AURA(unit) | |
local B = buttons[unit] | |
if not B then return end | |
local i = 1 | |
local b = 1 | |
local n,I,d,e,s,_ | |
while true do | |
n,_,I,_,_,d,e,_,_,_,s = UnitAura(unit,i,'HELPFUL') | |
if not n then break end | |
if WHITELIST[s] then | |
local btn = B[b] | |
--[[ show btn, apply properties ]] | |
btn:Show() | |
_G[btn:GetName()..'Icon']:SetTexture(I) | |
btn.e=e | |
b = b + 1 | |
end | |
i = i + 1 | |
end | |
for i = b,#B do B[i]:Hide() end | |
end | |
local f = CreateFrame'Frame'; f:RegisterEvent'UNIT_AURA' f:RegisterEvent'ARENA_OPPONENT_UPDATE' f:RegisterEvent'PLAYER_ENTERING_WORLD' | |
f:SetScript('OnEvent',function()for i = 1,5 do UNIT_AURA('player')end end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment