Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DAY_ONELETTER_ABBR = "%dd"
- HOUR_ONELETTER_ABBR = "%dh"
- MINUTE_ONELETTER_ABBR = "%dm"
- SECOND_ONELETTER_ABBR = "%ds"
- local buff, debuff = 1, 1
- local updateIcon = function(name, id)
- local base = _G[('%s%d'):format(name, id)]
- local icon = _G[('%s%dIcon'):format(name, id)]
- local duration = _G[('%s%dDuration'):format(name, id)]
- local count = _G[('%s%dCount'):format(name, id)]
- local border = _G[('%s%dBorder'):format(name, id)]
- local skin = _G[('%s%dSkin'):format(name, id)]
- if (base) then
- base:SetScale(1.02)
- end
- if(icon) then
- icon:SetTexCoord(0.03, 0.97, 0.02, 0.97)
- local font, size = duration:GetFont()
- duration:SetFont(font, 14, 'OUTLINE')
- duration:ClearAllPoints()
- -- We use x:1, due to my font
- duration:SetPoint('CENTER', base, 'BOTTOM', 0, 3)
- duration:SetDrawLayer'OVERLAY'
- -- We use y:-2, as the text is larger...
- count:ClearAllPoints()
- count:SetPoint('TOPRIGHT', base)
- count:SetDrawLayer'OVERLAY'
- -- Let's outsmart it!
- if(border) then
- border:SetDrawLayer'BORDER'
- border:SetParent(base)
- border:SetTexture('Interface\\Textures\\simplesquare_roth')
- border:SetPoint('TOPRIGHT', base, 2, 2)
- border:SetPoint('BOTTOMLEFT', base, -2, -2)
- border:SetTexCoord(0, 1, 0, 1)
- end
- if (base and not skin and not border) then
- local overlay = CreateFrame('Frame', base:GetName()..'Skin', button)
- overlay:SetAllPoints(base)
- overlay:SetParent(base)
- local texture = overlay:CreateTexture(nil, "BORDER")
- texture:SetParent(base)
- texture:SetTexture('Interface\\Textures\\simplesquare_roth')
- texture:SetPoint('TOPRIGHT', overlay, 2, 2)
- texture:SetPoint('BOTTOMLEFT', overlay, -2, -2)
- texture:SetVertexColor(0.3, 0.3, 0.3)
- end
- return true
- end
- end
- local addon = CreateFrame'Frame'
- function addon:UNIT_AURA(unit)
- if(unit == 'player') then
- if(buff ~= BUFF_MAX_DISPLAY) then
- while(updateIcon('BuffButton', buff)) do
- buff = buff + 1
- end
- end
- if(debuff ~= DEBUFF_MAX_DISPLAY) then
- while(updateIcon('DebuffButton', debuff)) do
- debuff = debuff + 1
- end
- end
- end
- if(buff == BUFF_MAX_DISPLAY and debuff == DEBUFF_MAX_DISPLAY) then
- self:UnregisterEvent'UNIT_AURA'
- self.UNIT_AURA = nil
- self:SetScript('OnEvent', nil)
- updateIcon = nil
- end
- end
- function addon:PLAYER_ENTERING_WORLD()
- self:UNIT_AURA'player'
- BuffFrame:ClearAllPoints()
- BuffFrame:SetPoint('TOPRIGHT', Minimap, 'TOPLEFT', -20, 0)
- ConsolidatedBuffs:ClearAllPoints()
- ConsolidatedBuffs:SetPoint('TOPRIGHT', Minimap, 'TOPLEFT', -20, 0)
- -- Do the temp enchants
- updateIcon('TempEnchant', 1)
- updateIcon('TempEnchant', 2)
- local r, g, b = 136/255, 57/255, 184/255
- TempEnchant1Border:SetTexture(1, 1, 1)
- TempEnchant1Border:SetVertexColor(r, g, b)
- TempEnchant1Border:SetBlendMode'MOD'
- TempEnchant1Duration:SetDrawLayer"OVERLAY"
- TempEnchant2Border:SetTexture(1, 1, 1)
- TempEnchant2Border:SetVertexColor(r, g, b)
- TempEnchant2Border:SetBlendMode'MOD'
- TempEnchant2Duration:SetDrawLayer"OVERLAY"
- self:UnregisterEvent'PLAYER_ENTERING_WORLD'
- self.PLAYER_ENTERING_WORLD = nil
- end
- addon:SetScript('OnEvent', function(self, event, unit)
- self[event](self, unit)
- end)
- addon:RegisterEvent'UNIT_AURA'
- addon:RegisterEvent'PLAYER_ENTERING_WORLD'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement