View Single Post
10-27-14, 10:49 AM   #22
Tuller
A Warpwood Thunder Caller
 
Tuller's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 91
So might I suggest something completely horrible to work around the lack of cooldown:GetSwipeColor? I've not actually tested this at all.
Lua Code:
  1. do
  2.     local mt = getmetatable(_G['ActionButton1Cooldown']).__index
  3.  
  4.     if not mt.GetSwipeColor then
  5.         local swipeColors = setmetatable({}, {
  6.             __index = function(t, cooldown)
  7.                 local color = t[cooldown]
  8.  
  9.                 if not color then
  10.                     color = { r = 0, g = 0, b = 0, a = 1 }
  11.                     t[cooldown] = color
  12.                 end
  13.  
  14.                 return color
  15.             end
  16.         })
  17.  
  18.         mt.GetSwipeColor = function(self)
  19.             local color = swipeColors[self]
  20.  
  21.             return color.r, color.g, color.b, color.a
  22.         end
  23.  
  24.         hooksecurefunc(mt, 'SetSwipeColor', function(self, r, g, b, a)
  25.             local color = swipeColors[self]
  26.  
  27.             color.r = r
  28.             color.g = g
  29.             color.b = b
  30.             color.a = a
  31.         end)
  32.     end
  33. end
  Reply With Quote