Thread Tools Display Modes
04-20-18, 09:27 AM   #1
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
notInterruptible

Hey guys, can you help me to add a (not)interruptible color to a castbar?

i tried to edit this block of castbar file



...
...
elseif(self.mystyle == "target") then
core:setBackdrop(castbar, cfg.units.target.castbar.height + 4, 2, 2, 2)

if notInterruptible then
castbar:SetStatusBarColor(1.00, 0.00, 0.00)
else
castbar:SetStatusBarColor(0.00, 1.00, 0.00)
end

castbar:SetWidth(cfg.units.target.castbar.width - cfg.units.target.castbar.height + 6)
castbar:SetHeight(cfg.units.target.castbar.height)
castbar:SetPoint("CENTER", "UIParent", "CENTER", 0, 350)
...
...
...
But the color are not working for target mobs...

I have attached full castbar lua file if needed
Attached Files
File Type: lua castbar.lua (8.5 KB, 172 views)
  Reply With Quote
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
04-20-18, 10:05 AM   #3
GreyFox777
A Cliff Giant
Join Date: Jan 2017
Posts: 75
Maybe is there some easier way?



EDIT: I think it is working now...

Last edited by GreyFox777 : 04-20-18 at 10:22 AM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » notInterruptible

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off