Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Cooldown Viewer (OmniCC)
- --[[
- Cooldown Viewer[Omnicc]
- cs = actionbar cooldown text size
- ps = player/focus/target/raid cooldown text size(disable if ps is 1)
- ctp = actionbar cooldown position(DEFAULT : CENTER)
- ptp = player cooldown position(DEFAULT : BOTTOMRIGHT)
- ct = font
- -- text position list
- CETNER / RIGHT / LEFT
- TOP / TOPRIGHT / TOPLEFT
- BOTTOM / BOTTOMRIGHT / BOTTOMLEFT
- -- font list
- DAMAGE_TEXT_FONT
- STANDARD_TEXT_FONT
- UNIT_NAME_FONT
- NAMEPLATE_FONT
- -- show cooldown text until 1 sec
- :: insert "elseif(e>0)then" -> "elseif(e>1)" in macro 3
- -- disable to show 0.x sec with enabling red text
- :: insert "return"%.1f",e" -> "return"%d",e" in macro 3
- -- DEATH KNIGHT RUNE COOLDOWN DISABLE
- instead of macro 6, use this two macro
- function gct(f)if not cDB[f]then local c=gict(f)c:SetSize(c.s*crt,c.s*crt)sf(c,1)cDB[f]=c;end return cDB[f]end
- function cvf(f,s,d)if(string.find(f:GetName(),"Rune") ~= nil)then return end local c=gct(f)if(s and d)then c.b=s;c.d=d;if(s>0 and d>1.5)then c.c=0;c.r=d-(GetTime()-s);suc(c)else rt(c)end end end
- -------------------------------------------------------------------
- -------------------------------------------------------------------]]--
- cs=21;
- ps=12;
- ctp="CENTER"
- ptp="CENTER"
- cp=5;
- ct=UNIT_NAME_FONT;
- crt=2;
- cDB={}
- action={}
- ccf=CreateFrame;
- gac=GetActionCooldown;
- ol="OUTLINE"
- cpe="PLAYER_ENTERING_WORLD"
- cau="ACTIONBAR_UPDATE_COOLDOWN"
- co="OnUpdate"
- function rt(f)
- f.e=nil
- f.t:SetText("")
- f:SetScript(co,nil)
- end
- function sf(f,v)
- f.t:SetFont(ct,f.s*v,ol)
- end
- function acv(b)
- local x=b.cooldown
- x.a=b.action
- action[x]=x
- end
- function scv(p,f,po,s)
- if(s>1)then
- f.t:SetPoint(po,p)
- end
- f.s=s;
- end
- function sr(f,e)
- if(e>60)then
- sf(f,0.7)
- if(f.s==cs)then
- return"%d:%02d",e,e
- else
- return"%dm",e+60,e
- end
- elseif(e>=cp)then
- sf(f,1)
- f.t:SetTextColor(1,1,0,1)
- return"%d",e
- elseif(e>0)then
- sf(f,0.9)
- f.t:SetTextColor(1,0,0,1)
- return"%.1f",e
- else
- return
- end
- end
- function suc(f)
- if not f.e then
- f.e=1;
- f:SetScript(co,function(s,e)
- f.c=f.c+e;
- local fo,v1,v2=sr(f,f.r-f.c)
- if not fo then
- rt(f)
- elseif not v2 then
- f.t:SetFormattedText(fo,v1)
- else
- f.t:SetTextColor(1,1,1,1)
- f.t:SetFormattedText(fo,v1/60,v2%60)
- end
- end)
- end
- end
- function scs(p,f)
- if(p:GetSize()<35)then
- scv(p,f,ptp,ps)
- else
- scv(p,f,ctp,cs)
- end
- end
- function gict(f)
- local c=ccf("Frame",nil,f)
- c:SetFrameLevel(f:GetFrameLevel()+5)
- c.t=c:CreateFontString(nil,"OVERLAY")
- c.t:SetAllPoints(c)
- scs(f:GetParent(),c)
- return c;
- end
- function gct(f)
- if not cDB[f] then
- local c=gict(f)
- c:SetSize(c.s*crt,c.s*crt)
- sf(c,1)
- cDB[f]=c;
- end
- return cDB[f]
- end
- function cvf(f,s,d)
- -- if(string.find(f:GetName(),"trinket") ~= nil) then
- -- return
- -- end
- local c=gct(f)
- if(s and d)then
- c.b=s;
- c.d=d;
- if(s>0 and d>1.5)then
- c.c=0;c.r=d-(GetTime()-s);
- suc(c)
- else
- rt(c)
- end
- end
- end
- function cvc(DB)
- for c in pairs(DB)do
- if c.a then
- local s,d=gac(c.a)
- cvf(c,s,d)
- end
- end
- end
- function pcv(_,e)
- if e==cau then
- cvc(action)
- else
- cvc(cDB)
- end
- end
- for _,b in pairs(ActionBarButtonEventsFrame.frames)do
- acv(b)
- end
- vc=ccf("Frame")
- vc:SetScript("OnEvent",pcv)
- vc:RegisterEvent(cpe)
- vc:RegisterEvent(cau)
- hooksecurefunc(getmetatable(ActionButton1Cooldown).__index,"SetCooldown",cvf)
- hooksecurefunc("SetActionUIButton",acv)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement