Last active
August 29, 2015 14:06
-
-
Save nefftd/d9cc51bb43f8c90fb610 to your computer and use it in GitHub Desktop.
Minified clean-room reimplementation of OmniCC, written as a series of macros, for the arena tournament.
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
The below code is hereby released into the Public Domain. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
OTHER DEALINGS IN THE SOFTWARE. | |
In other words, you can't sue me if it breaks. ;) | |
/run _mcc={a={},A=ActionBarButtonEventsFrame.frames,U=function(f)local a,s,d=f.action if a then s,d=GetActionCooldown(a)if s>0 and d>2 then _mcc.a[f]=(s+d)-GetTime()return end end _mcc.a[f]=0 end,H=CreateFrame'Frame'} | |
/run for _,f in ipairs(_mcc.A)do f.mfsc=CreateFrame('Frame',nil,f)f.mfsc:SetFrameLevel(f:GetFrameLevel()+5)f.mfs=f.mfsc:CreateFontString()f.mfs:SetAllPoints(f)f.mfs:SetFont(UNIT_NAME_FONT,20,'OUTLINE')_mcc.a[f]=0 end | |
/run local h=_mcc.H;h:RegisterEvent'PLAYER_ENTERING_WORLD'h:RegisterEvent'ACTIONBAR_UPDATE_COOLDOWN'h:SetScript('OnEvent',function()for _,f in ipairs(_mcc.A)do _mcc.U(f)end end)hooksecurefunc('SetActionUIButton',_mcc.U) | |
/run function _mcc.C(t,l)if l>=60 then t:SetTextColor(1,1,1)elseif l>4 then t:SetTextColor(1,1,0)else t:SetTextColor(1,0,0)end end | |
/run _mcc.H:SetScript('OnUpdate',function(s,e)for f,l in pairs(_mcc.a)do l=l-e;_mcc.a[f]=l if l>=60 then f.mfs:SetFormattedText('%dm',floor(l/60+.5))elseif l>0 then f.mfs:SetText(ceil(l))else f.mfs:SetText''end _mcc.C(f.mfs,l)end end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment