View Single Post
03-31-17, 09:47 PM   #6
kurapica.igas
A Chromatic Dragonspawn
Join Date: Aug 2011
Posts: 152
Originally Posted by Layback_ View Post
Hi kurapica.iga,

Thank you for your advice

What about the borders for debuffs?

As you know some debuffs have a different border colors based on their types (like red or blue).

Would this be considered on BuffButton_OnLoad or SetTexture functions?
Well, I make some problem, write it again :
Lua Code:
  1. local original_SetVertexColor   -- Keep a copy so it won't trigger the hook again
  2.  
  3. hooksecurefunc("BuffButton_OnLoad", function(self)
  4.     -- the self is aura button
  5.  
  6.     -- For cut icon
  7.     local icon = _G[self:GetName() .. "Icon"]  -- miss this
  8.     hooksecurefunc(icon, "SetTexture", function(self, path)
  9.         if path then
  10.             -- Cut the icon
  11.             self:SetTexCoord(0.06, 0.94, 0.06, 0.94)
  12.         end
  13.     end)
  14.  
  15.     -- For the debuff border color
  16.     local debuffSlot = _G[self:GetName().."Border"]
  17.     if not original_SetVertexColor then original_SetVertexColor = debuffSlot.SetVertexColor end
  18.  
  19.     hooksecurefunc(debuffSlot, "SetVertexColor", function(self, r, g, b)
  20.         -- You can only use original_SetVertexColor  to change border color
  21.         -- debuffSlot:SetVertexColor(1, 0, 0)  wrong, it'll cause Infinite loop
  22.         original_SetVertexColor(debuffSlot, 1, 0, 0)   -- that's okay
  23.     end)
  24.  
  25.     -- do other skin job
  26. end)

Don't try to replace the methods directly, it'll cause taint error.

Last edited by kurapica.igas : 03-31-17 at 10:32 PM.
  Reply With Quote