View Single Post
04-20-18, 09:45 AM   #2
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by GreyFox777 View Post
Hey guys, can you help me to add a (not)interruptible color to a castbar?

i tried to edit this block of castbar file




But the color are not working for target mobs...

I have attached full castbar lua file if needed
Here are the functions i use...

Lua Code:
  1. function UnitFrames:CheckInterrupt(unit)
  2.     if (unit == "vehicle") or (unit == "player") then
  3.         return
  4.     end
  5.  
  6.     if (self.notInterruptible and UnitCanAttack("player", unit)) then
  7.         self:SetStatusBarColor(unpack(C.UnitFrames.InterruptColor))
  8.        
  9.         if (self.Icon) then
  10.             self.Icon:SetDesaturated(1)
  11.         end
  12.     else
  13.         self:SetStatusBarColor(unpack(C.UnitFrames.CastBarColor))
  14.        
  15.         if (self.Icon) then
  16.             self.Icon:SetDesaturated(false)
  17.         end
  18.     end
  19. end
  20.  
  21. function UnitFrames:CheckCast(unit, name, rank, castid)
  22.     UnitFrames.CheckInterrupt(self, unit)
  23. end
  24.  
  25. function UnitFrames:CheckChannel(unit, name, rank)
  26.     UnitFrames.CheckInterrupt(self, unit)
  27. end

And you need to add this into your layout

Lua Code:
  1. Castbar.PostCastStart = UnitFrames.CheckCast
  2. Castbar.PostChannelStart = UnitFrames.CheckChannel
  Reply With Quote