View Single Post
10-12-16, 03:41 PM   #3
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 68
I know about the restrictions and none of the addons that I have tested touch SetTargetClampingInsets in any way. This is the entire Colorz addon and as you can see it shouldn't be interacting with that function that is only used in NamePlateDriverMixin:SetupClassNameplateBars().

Lua Code:
  1. -- Sets manabar color for default unit frames.
  2. local function CustomManaColor(manaBar)
  3.     local powerType = UnitPowerType(manaBar.unit);
  4.  
  5.     if ( powerType == 0 ) then
  6.         manaBar:SetStatusBarColor(0,0.55,1)
  7.     end
  8. end
  9. hooksecurefunc('UnitFrameManaBar_UpdateType',CustomManaColor)
  10.  
  11. CUSTOM_FACTION_BAR_COLORS = {
  12.     [1] = {r = 1, g = 0, b = 0},
  13.     [2] = {r = 1, g = 0, b = 0},
  14.     [3] = {r = 1, g = 1, b = 0},
  15.     [4] = {r = 1, g = 1, b = 0},
  16.     [5] = {r = 0, g = 1, b = 0},
  17.     [6] = {r = 0, g = 1, b = 0},
  18.     [7] = {r = 0, g = 1, b = 0},
  19.     [8] = {r = 0, g = 1, b = 0},
  20. }
  21.  
  22. function GameTooltip_UnitColor(unit)
  23.  
  24.     local r, g, b
  25.  
  26.     if (UnitIsDead(unit) or UnitIsGhost(unit) or UnitIsTapDenied(unit)) then
  27.         r = 0.5
  28.         g = 0.5
  29.         b = 0.5
  30.     elseif (UnitIsPlayer(unit)) then
  31.         if (UnitIsFriend(unit, 'player')) then
  32.             local _, class = UnitClass(unit)
  33.             if ( class ) then
  34.                 r = RAID_CLASS_COLORS[class].r
  35.                 g = RAID_CLASS_COLORS[class].g
  36.                 b = RAID_CLASS_COLORS[class].b
  37.             else
  38.                 r = 0.60
  39.                 g = 0.60
  40.                 b = 0.60
  41.             end
  42.         elseif (not UnitIsFriend(unit, 'player')) then
  43.             r = 1
  44.             g = 0
  45.             b = 0
  46.         end
  47.     elseif (UnitPlayerControlled(unit)) then
  48.         if (UnitCanAttack(unit, 'player')) then
  49.             if (not UnitCanAttack('player', unit)) then
  50.                 r = 157/255
  51.                 g = 197/255
  52.                 b = 255/255
  53.             else
  54.                 r = 1
  55.                 g = 0
  56.                 b = 0
  57.             end
  58.         elseif (UnitCanAttack('player', unit)) then
  59.             r = 1
  60.             g = 1
  61.             b = 0
  62.         elseif (UnitIsPVP(unit)) then
  63.             r = 0
  64.             g = 1
  65.             b = 0
  66.         else
  67.             r = 157/255
  68.             g = 197/255
  69.             b = 255/255
  70.         end
  71.     else
  72.         local reaction = UnitReaction(unit, 'player')
  73.  
  74.         if (reaction) then
  75.             r = CUSTOM_FACTION_BAR_COLORS[reaction].r
  76.             g = CUSTOM_FACTION_BAR_COLORS[reaction].g
  77.             b = CUSTOM_FACTION_BAR_COLORS[reaction].b
  78.         else
  79.             r = 157/255
  80.             g = 197/255
  81.             b = 255/255
  82.         end
  83.     end
  84.  
  85.     return r, g, b
  86. end
  87.  
  88. UnitSelectionColor = GameTooltip_UnitColor
__________________
Thomas aka Urnn