Thread: castbar help
View Single Post
01-06-13, 06:18 PM   #4
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
That requires quite a lot more work:
Lua Code:
  1. ReturnCastbar = function()
  2.    -- Move the player castbar back to player.
  3.    local castbar = YourPlayerFrame.Castbar
  4.  
  5.    castbar:ClearAllPoints()
  6.    castbar:SetAllPoints(YourPlayerFrame.Health)
  7. end
  8.  
  9. OnEnter = function(self)
  10.    -- Move the player castbar to the raid frame we are hovering.
  11.    local castbar = YourPlayerFrame.Castbar
  12.  
  13.    castbar.activeFrame = self
  14.    castbar:ClearAllPoints()
  15.    castbar:SetAllPoints(self.Health)
  16. end
  17.  
  18. OnHide = function(self)
  19.    if(castbar.activeFrame == self) then
  20.       ReturnCastbar()
  21.       castbar.activeFrame = nil
  22.    end
  23. end
  24.  
  25. -- on the raid frames:
  26. -- Return the castbar if the unit disappears.
  27. self:HookScript("OnHide", OnHide)
  28.  
  29. -- on the player frame:
  30. -- Force it back when we stop casting.
  31. castbar.PostCastFailed = ReturnCastbar
  32. castbar.PostCastInterrupted = ReturnCastbar
  33. castbar.PostCastStop = ReturnCastbar
  34. castbar.PostChannelStop = ReturnCastbar

Might work.

Edit: No it won't, I'm completely missing the actual problem here being the initial anchoring, followed by re-anchoring when targeting a new unit. I'll throw some time at it tomorrow night or so.
__________________
「貴方は1人じゃないよ」
  Reply With Quote