I had a chance to look over 1.4. And please correct me if I'm wrong Haste (or someone else that know)
If all you want to do is show a frame (texture, text or whatever) then you can just define it as Castbar.Shield and it should show and hide automatically.
If you want to do something else, for example the code you posted sacrifice, then you will need to do the following.
Outside style function
Code:
local CastInterruptable = function(self, unit)
-- Do your thing here
end
local CastNonInterruptable = function(self, unit)
-- Do your thing here
end
local PostCastStart = function(self, unit, name, rank, castid)
if self.interrupt then
CastNonInterruptable(self, unit)
else
CastInterruptable(self, unit)
end
end
Inside style function
Code:
Castbar.PostCastStart = PostCastStart
Castbar.PostCastInterruptible = CastInterruptable
Castbar.PostCastNotInterruptible = CastNonInterruptable