Advertisement
Guest User

Furbish - Ailae

a guest
Nov 14th, 2010
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.27 KB | None | 0 0
  1. DAY_ONELETTER_ABBR = "%dd"
  2. HOUR_ONELETTER_ABBR = "%dh"
  3. MINUTE_ONELETTER_ABBR = "%dm"
  4. SECOND_ONELETTER_ABBR = "%ds"
  5.  
  6. local buff, debuff = 1, 1
  7.  
  8. local updateIcon = function(name, id)
  9.     local base = _G[('%s%d'):format(name, id)]
  10.     local icon = _G[('%s%dIcon'):format(name, id)]
  11.     local duration = _G[('%s%dDuration'):format(name, id)]
  12.     local count = _G[('%s%dCount'):format(name, id)]
  13.     local border = _G[('%s%dBorder'):format(name, id)]
  14.     local skin = _G[('%s%dSkin'):format(name, id)]
  15.    
  16.     if (base) then
  17.         base:SetScale(1.02)
  18.     end
  19.    
  20.     if(icon) then
  21.         icon:SetTexCoord(0.03, 0.97, 0.02, 0.97)
  22.  
  23.         local font, size = duration:GetFont()
  24.         duration:SetFont(font, 14, 'OUTLINE')
  25.         duration:ClearAllPoints()
  26.        
  27.         -- We use x:1, due to my font
  28.         duration:SetPoint('CENTER', base, 'BOTTOM', 0, 3)
  29.         duration:SetDrawLayer'OVERLAY'
  30.  
  31.         -- We use y:-2, as the text is larger...
  32.         count:ClearAllPoints()
  33.         count:SetPoint('TOPRIGHT', base)
  34.         count:SetDrawLayer'OVERLAY'
  35.  
  36.         -- Let's outsmart it!
  37.         if(border) then
  38.             border:SetDrawLayer'BORDER'
  39.             border:SetParent(base)
  40.             border:SetTexture('Interface\\Textures\\simplesquare_roth')
  41.             border:SetPoint('TOPRIGHT', base, 2, 2)
  42.             border:SetPoint('BOTTOMLEFT', base, -2, -2)
  43.             border:SetTexCoord(0, 1, 0, 1)
  44.         end
  45.        
  46.         if (base and not skin and not border) then
  47.             local overlay = CreateFrame('Frame', base:GetName()..'Skin', button)
  48.             overlay:SetAllPoints(base)
  49.             overlay:SetParent(base)
  50.            
  51.             local texture = overlay:CreateTexture(nil, "BORDER")
  52.             texture:SetParent(base)
  53.             texture:SetTexture('Interface\\Textures\\simplesquare_roth')
  54.             texture:SetPoint('TOPRIGHT', overlay, 2, 2)
  55.             texture:SetPoint('BOTTOMLEFT', overlay, -2, -2)
  56.             texture:SetVertexColor(0.3, 0.3, 0.3)          
  57.         end
  58.  
  59.         return true
  60.     end
  61. end
  62.  
  63. local addon = CreateFrame'Frame'
  64.  
  65. function addon:UNIT_AURA(unit)
  66.     if(unit == 'player') then
  67.         if(buff ~= BUFF_MAX_DISPLAY) then
  68.             while(updateIcon('BuffButton', buff)) do
  69.                 buff = buff + 1
  70.             end
  71.         end
  72.  
  73.         if(debuff ~= DEBUFF_MAX_DISPLAY) then
  74.             while(updateIcon('DebuffButton', debuff)) do
  75.                 debuff = debuff + 1
  76.             end
  77.         end
  78.     end
  79.  
  80.     if(buff == BUFF_MAX_DISPLAY and debuff == DEBUFF_MAX_DISPLAY) then
  81.         self:UnregisterEvent'UNIT_AURA'
  82.         self.UNIT_AURA = nil
  83.         self:SetScript('OnEvent', nil)
  84.         updateIcon = nil
  85.     end
  86. end
  87.  
  88. function addon:PLAYER_ENTERING_WORLD()
  89.     self:UNIT_AURA'player'
  90.    
  91.     BuffFrame:ClearAllPoints()
  92.     BuffFrame:SetPoint('TOPRIGHT', Minimap, 'TOPLEFT', -20, 0)
  93.    
  94.     ConsolidatedBuffs:ClearAllPoints()
  95.     ConsolidatedBuffs:SetPoint('TOPRIGHT', Minimap, 'TOPLEFT', -20, 0)
  96.    
  97.     -- Do the temp enchants
  98.     updateIcon('TempEnchant', 1)
  99.     updateIcon('TempEnchant', 2)
  100.  
  101.     local r, g, b = 136/255, 57/255, 184/255
  102.     TempEnchant1Border:SetTexture(1, 1, 1)
  103.     TempEnchant1Border:SetVertexColor(r, g, b)
  104.     TempEnchant1Border:SetBlendMode'MOD'
  105.     TempEnchant1Duration:SetDrawLayer"OVERLAY"
  106.  
  107.     TempEnchant2Border:SetTexture(1, 1, 1)
  108.     TempEnchant2Border:SetVertexColor(r, g, b)
  109.     TempEnchant2Border:SetBlendMode'MOD'
  110.     TempEnchant2Duration:SetDrawLayer"OVERLAY"
  111.  
  112.     self:UnregisterEvent'PLAYER_ENTERING_WORLD'
  113.     self.PLAYER_ENTERING_WORLD = nil
  114. end
  115.  
  116. addon:SetScript('OnEvent', function(self, event, unit)
  117.     self[event](self, unit)
  118. end)
  119.  
  120. addon:RegisterEvent'UNIT_AURA'
  121. addon:RegisterEvent'PLAYER_ENTERING_WORLD'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement