SHARE
TWEET

Untitled

a guest Jun 19th, 2017 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ConsolidatedBuffs:ClearAllPoints()
  2. ConsolidatedBuffs:SetPoint("LEFT", Minimap, "LEFT", TukuiDB.Scale(0), TukuiDB.Scale(0))
  3. ConsolidatedBuffs:SetSize(16, 16)
  4. ConsolidatedBuffsIcon:SetTexture(nil)
  5. ConsolidatedBuffs.SetPoint = TukuiDB.dummy
  6.  
  7. if TukuiCF.unitframes.playerauras == true then return end
  8.  
  9. local mainhand, _, _, offhand = GetWeaponEnchantInfo()
  10. local rowbuffs = 3
  11.  
  12. TemporaryEnchantFrame:ClearAllPoints()
  13. TemporaryEnchantFrame:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", TukuiDB.Scale(-12), TukuiDB.Scale(2))
  14. TemporaryEnchantFrame.SetPoint = TukuiDB.dummy
  15.  
  16. TempEnchant1:ClearAllPoints()
  17. TempEnchant2:ClearAllPoints()
  18. TempEnchant1:SetPoint("TOPLEFT", Minimap, "BOTTOMLEFT", TukuiDB.Scale(-2), TukuiDB.Scale(-12))
  19. TempEnchant2:SetPoint("LEFT", TempEnchant1, "RIGHT", TukuiDB.Scale(4), 0)
  20.  
  21. for i = 1, 2 do
  22.     local f = CreateFrame("Frame", nil, _G["TempEnchant"..i])
  23.     TukuiDB.CreatePanel(f, 30*TukuiDB.raidscale, 30*TukuiDB.raidscale, "CENTER", _G["TempEnchant"..i], "CENTER", 0, 0) 
  24.     _G["TempEnchant"..i.."Border"]:Hide()
  25.     _G["TempEnchant"..i.."Icon"]:SetTexCoord(.08, .92, .08, .92)
  26.     _G["TempEnchant"..i.."Icon"]:SetPoint("TOPLEFT", _G["TempEnchant"..i], TukuiDB.Scale(2), TukuiDB.Scale(-2))
  27.     _G["TempEnchant"..i.."Icon"]:SetPoint("BOTTOMRIGHT", _G["TempEnchant"..i], TukuiDB.Scale(-2), TukuiDB.Scale(2))
  28.     _G["TempEnchant"..i]:SetHeight(TukuiDB.Scale(30*TukuiDB.raidscale))
  29.     _G["TempEnchant"..i]:SetWidth(TukuiDB.Scale(30*TukuiDB.raidscale)) 
  30.     _G["TempEnchant"..i.."Duration"]:ClearAllPoints()
  31.     _G["TempEnchant"..i.."Duration"]:SetPoint("BOTTOM", 0, TukuiDB.Scale(-4))
  32.     _G["TempEnchant"..i.."Duration"]:SetFont(TukuiCF["media"].font, 11, "OUTLINE")
  33.     _G["TempEnchant"..i.."Duration"]:SetTextColor(1,1,1)
  34. end
  35.  
  36. local function StyleBuffs(buttonName, index, debuff)
  37.     local buff      = _G[buttonName..index]
  38.     local icon      = _G[buttonName..index.."Icon"]
  39.     local border    = _G[buttonName..index.."Border"]
  40.     local duration  = _G[buttonName..index.."Duration"]
  41.     local count     = _G[buttonName..index.."Count"]
  42.     if icon and not _G[buttonName..index.."Panel"] then
  43.         icon:SetTexCoord(.08, .92, .08, .92)
  44.         icon:SetPoint("TOPLEFT", buff, TukuiDB.Scale(2), TukuiDB.Scale(-2))
  45.         icon:SetPoint("BOTTOMRIGHT", buff, TukuiDB.Scale(-2), TukuiDB.Scale(2))
  46.        
  47.         buff:SetHeight(TukuiDB.Scale(30)*TukuiDB.raidscale)
  48.         buff:SetWidth(TukuiDB.Scale(30)*TukuiDB.raidscale)
  49.                
  50.         duration:ClearAllPoints()
  51.         duration:SetPoint("BOTTOM", 0, TukuiDB.Scale(-4))
  52.         duration:SetFont(TukuiCF["media"].font, 11, "OUTLINE")
  53.        
  54.         count:ClearAllPoints()
  55.         count:SetPoint("TOPLEFT", TukuiDB.Scale(1), TukuiDB.Scale(-2))
  56.         count:SetFont(TukuiCF["media"].font, 12, "OUTLINE")
  57.        
  58.         local panel = CreateFrame("Frame", buttonName..index.."Panel", buff)
  59.         TukuiDB.CreatePanel(panel, 30*TukuiDB.raidscale, 30*TukuiDB.raidscale, "CENTER", buff, "CENTER", 0, 0)
  60.         panel:SetFrameLevel(buff:GetFrameLevel() - 1)
  61.         panel:SetFrameStrata(buff:GetFrameStrata())
  62.     end
  63.     if border then border:Hide() end
  64. end
  65.  
  66. local function UpdateBuffAnchors()
  67.     buttonName = "BuffButton"
  68.     local buff, previousBuff, aboveBuff;
  69.     local numBuffs = 0;
  70.     for index=1, BUFF_ACTUAL_DISPLAY do
  71.         local buff = _G[buttonName..index]
  72.         StyleBuffs(buttonName, index, false)
  73.        
  74.         -- Leaving this here just in case someone want to use it
  75.         -- This enable buff border coloring according to Type
  76.         --[[
  77.         local dtype = select(5, UnitBuff("player",index))      
  78.         local color
  79.         if (dtype ~= nil) then
  80.             color = DebuffTypeColor[dtype]
  81.         else
  82.             color = DebuffTypeColor["none"]
  83.         end
  84.         _G[buttonName..index.."Panel"]:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
  85.         --]]
  86.        
  87.         if ( buff.consolidated ) then
  88.             if ( buff.parent == BuffFrame ) then
  89.                 buff:SetParent(ConsolidatedBuffsContainer)
  90.                 buff.parent = ConsolidatedBuffsContainer
  91.             end
  92.         else
  93.             numBuffs = numBuffs + 1
  94.             index = numBuffs
  95.             buff:ClearAllPoints()
  96.             if ( (index >= 1) and (mod(index, rowbuffs) == 1) ) then
  97.                 if ( index == 1 ) then
  98.                     buff:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", TukuiDB.Scale(-12), TukuiDB.Scale(2))
  99.                 elseif ( index == rowbuffs+1 ) then
  100.                     buff:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", TukuiDB.Scale(-42), TukuiDB.Scale(2))
  101.                 elseif ( index == 2*rowbuffs+1 ) then
  102.                     buff:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", TukuiDB.Scale(-72), TukuiDB.Scale(2))
  103.                 elseif ( index == 3*rowbuffs+1 ) then
  104.                     buff:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", TukuiDB.Scale(-102), TukuiDB.Scale(2))
  105.                 elseif ( index == 4*rowbuffs+1 ) then
  106.                     buff:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", TukuiDB.Scale(-132), TukuiDB.Scale(2))
  107.                 elseif ( index == 5*rowbuffs+1 ) then
  108.                     buff:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", TukuiDB.Scale(-162), TukuiDB.Scale(2))
  109.                 else
  110.                     buff:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", TukuiDB.Scale(-12), TukuiDB.Scale(2))
  111.                 end
  112.                 aboveBuff = buff;
  113.             else
  114.                 buff:SetPoint("TOP", previousBuff, "BOTTOM", 0, TukuiDB.Scale(-5))
  115.             end
  116.             previousBuff = buff
  117.         end    
  118.     end
  119. end
  120.  
  121. local function UpdateDebuffAnchors(buttonName, index)
  122.     local debuff = _G[buttonName..index];
  123.     StyleBuffs(buttonName, index, true)
  124.     local dtype = select(5, UnitDebuff("player",index))      
  125.     local color
  126.     if (dtype ~= nil) then
  127.         color = DebuffTypeColor[dtype]
  128.     else
  129.         color = DebuffTypeColor["none"]
  130.     end
  131.     _G[buttonName..index.."Panel"]:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
  132.     debuff:ClearAllPoints()
  133.     if index == 1 then
  134.         debuff:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMLEFT", TukuiDB.Scale(-12), TukuiDB.Scale(-2))
  135.     else
  136.         debuff:SetPoint("RIGHT", _G[buttonName..(index-1)], "LEFT", TukuiDB.Scale(-4), 0)
  137.     end
  138. end
  139.  
  140. -- Always color buff's timer in white instead of yellow.
  141. local function UpdateTime(button)
  142.   local duration = _G[button:GetName().."Duration"]
  143.   if SHOW_BUFF_DURATIONS == "1" then
  144.     duration:SetTextColor(1, 1, 1)
  145.   end
  146. end
  147. hooksecurefunc("AuraButton_UpdateDuration", UpdateTime)
  148.  
  149. local f = CreateFrame("Frame")
  150. f:SetScript("OnEvent", function() mainhand, _, _, offhand = GetWeaponEnchantInfo() end)
  151. f:RegisterEvent("UNIT_INVENTORY_CHANGED")
  152. f:RegisterEvent("PLAYER_EVENTERING_WORLD")
  153.  
  154. hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", UpdateBuffAnchors)
  155. hooksecurefunc("DebuffButton_UpdateAnchors", UpdateDebuffAnchors)
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top