WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   castbar help (https://www.wowinterface.com/forums/showthread.php?t=45534)

Taet 12-30-12 03:12 AM

castbar help
 
First of all, sorry for my English.

I need help as see my cast bar to raid target on that i cast spell (heal).

This my code show cast bar on casting player in raidframe,but i need show player (my) cast bar on raid target.
Code:

raid = function(self, ...)
        Shared(self, ...)
               
                        createCastbar(self)
                        self.Castbar:SetAllPoints(self.Health)
                       
        self.Name:SetFont(cfg.NameFont, cfg.RaidFS, cfg.FontFormatRaid)
        self.Name:SetPoint("TOPRIGHT", self.Health, "BOTTOMRIGHT", 0, 14)
        self:Tag(self.Name, '[afkdnd][raidcolor][raidhpname]')

.....


haste 12-31-12 09:52 AM

I'm not really sure if I understand your question. Do you want the players castbar to be shown on the raid unit you are healing?

If so: You can't really spawn a player castbar on a raid frame, but you can move the player castbar to the raid frame on OnEnter/Onleave.

Something like:
Lua Code:
  1. OnEnter = function(self)
  2.    -- Move the player castbar to the raid frame we are hovering.
  3.    local castbar = YourPlayerFrame.Castbar
  4.  
  5.    castbar:ClearAllPoints()
  6.    castbar:SetAllPoints(self.Health)
  7. end
  8.  
  9. OnLeave = function(self)
  10.    -- Move the player castbar back to player.
  11.    local castbar = YourPlayerFrame.Castbar
  12.  
  13.    castbar:ClearAllPoints()
  14.    castbar:SetAllPoints(YourPlayerFrame.Health)
  15. end

Remember that you also need to :SetScript() these handlers.

Taet 01-03-13 09:08 PM

Very thanks for your answer.

I have second problem, i begin cast on raid player 1 (onenter), my cast bar is on this player, but when i move mouse (onLeave) on other raid player my cast bar is moved and end animation on this player.

I need, when i begin any cast on raidplayer1, this cast bar ended here when i move mouse over other raidplayers.

Again apologize for my English, and your lost time.

haste 01-06-13 06:18 PM

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.

p3lim 01-07-13 11:05 AM

Try this out

Lua Code:
  1. local queued, casting
  2.  
  3. local OnEnter = function(self)
  4.     if(not casting) then
  5.         local castbar = YourPlayerFrame.Castbar
  6.         castbar:ClearAllPoints()
  7.         castbar:SetAllPoints(self.Health)
  8.     else
  9.         queued = self
  10.     end
  11. end
  12.  
  13. local OnHide = function()
  14.     local castbar = YourPlayerFrame.Castbar
  15.     castbar:ClearAllPoints()
  16.     castbar:SetAllPoints(YourPlayerFrame.Health)
  17. end
  18.  
  19. local CastStarted = function()
  20.     casting = true
  21. end
  22.  
  23. local CastEnded = function()
  24.     if(queued) then
  25.         OnEnter(queued)
  26.         queued = nil
  27.         casting = nil
  28.     else
  29.         OnHide()
  30.     end
  31. end
  32.  
  33. -- on the raid frames:
  34. -- Return the castbar if the unit disappears.
  35. self:HookScript('OnHide', OnHide)
  36. self:HookScript('OnEnter', OnEnter)
  37.  
  38. -- on the player frame:
  39. castbar.PostCastFailed = CastEnded
  40. castbar.PostCastInterrupted = CastEnded
  41. castbar.PostCastStop = CastEnded
  42. castbar.PostChannelStop = CastEnded
  43. castbar.PostCastStart = CastStarted
  44. castbar.PostChannelStart = CastStarted

Taet 01-09-13 07:41 PM

P3lim : first cast is on raid frame, but all other is on Player frame.


All times are GMT -6. The time now is 07:12 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI