WoWInterface

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

martiniovi 07-16-21 08:54 AM

Target castbar question
 
Hello,
i have created an ouf layout for TBC Classic.

to add castbars i created a function which is called within player and target function. The player castbar works just fine but the target castbar does not work at all. Here are the issues:
- The target castbar does not appear for any target casts of other players or npcs with exception of my casts (if I target myself)
- if I interrupt my spellcast the target castbar will still continue the spellcast.
- if I cast a spell and switch to another target than myself the target castbar (with my currently casted spell) wont disappear or update to the new targets casted spell.

Here is the code for my castbar

The Castbar Code
Lua Code:
  1. createCastBar = function(self, x, y, w, h, unit)
  2.  
  3.     local Castbar = CreateFrame('StatusBar', nil, self, "BackdropTemplate")
  4.     Castbar:SetStatusBarTexture(bartex)
  5.     Castbar:SetStatusBarColor(1.0, 0.5, 0.3)
  6.     Castbar:SetHeight(w)
  7.     Castbar:SetWidth(h)
  8.     Castbar:SetBackdrop({
  9.         bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
  10.         insets = {top = 0, left = 0, bottom = 0, right = 0}})
  11.  
  12.     Castbar:SetBackdropColor(0.045, 0.045, 0.045, 1)
  13.  
  14.     Castbar.Border = CreateFrame('Frame', nil, Castbar)
  15.     Castbar.Border:SetAllPoints(Castbar)
  16.     Castbar.Border:SetFrameLevel(Castbar:GetFrameLevel() + 5)
  17.     CreateBorder(Castbar.Border, borderradius)
  18.  
  19.     Castbar.SafeZone = Castbar:CreateTexture(nil,"ARTWORK")
  20.     Castbar.SafeZone:SetTexture(bartex)
  21.     Castbar.SafeZone:SetVertexColor(.75,.10,.10,.2)
  22.     Castbar.SafeZone:SetPoint("TOPRIGHT")
  23.     Castbar.SafeZone:SetPoint("BOTTOMRIGHT")
  24.  
  25.     Castbar:SetPoint('LEFT', self.Health, x, y)
  26.  
  27.     Castbar.Spark = Castbar:CreateTexture(nil,'OVERLAY')
  28.     Castbar.Spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]])
  29.     Castbar.Spark:SetBlendMode('Add')
  30.     Castbar.Spark:SetHeight(Castbar:GetHeight() + 10)
  31.     Castbar.Spark:SetWidth(30)
  32.     Castbar.Spark:SetVertexColor(1, 1, 1)
  33.  
  34.     Castbar.Icon = Castbar:CreateTexture(nil, 'OVERLAY')
  35.     Castbar.Icon:SetPoint("RIGHT", Castbar, "LEFT", -13, -3)
  36.     Castbar.Icon:SetHeight(33)
  37.     Castbar.Icon:SetWidth(33)
  38.     Castbar.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
  39.  
  40.     Castbar.Text = Castbar:CreateFontString(nil, 'OVERLAY')
  41.     Castbar.Text:SetPoint('LEFT', Castbar, -1, -25)
  42.     Castbar.Text:SetFont(font, fontsize, "OUTLINE")
  43.     Castbar.Text:SetShadowOffset(1, -1)
  44.     Castbar.Text:SetTextColor(1, 1, 1)
  45.     Castbar.Text:SetJustifyH('LEFT')
  46.  
  47.     Castbar.Time = Castbar:CreateFontString(nil, 'OVERLAY')
  48.     Castbar.Time:SetPoint('RIGHT', Castbar, 5, -25)
  49.     Castbar.Time:SetFont(font, fontsize, "OUTLINE")
  50.     Castbar.Time:SetTextColor(1, 1, 1)
  51.     Castbar.Time:SetJustifyH('RIGHT')
  52.  
  53.     Castbar.PostChannelUpdate = PostChannelUpdate
  54.     Castbar.PostCastStart = PostCastStart
  55.     Castbar.PostChannelStart = PostCastStart
  56.     Castbar.PostChannelStop = PostChannelStop
  57.     Castbar.PostCastInterrupted = PostCastInterrupted
  58.     Castbar.PostCastFailed = PostCastFailed
  59.  
  60.     self.Castbar = Castbar
  61. end

The Target Code
Lua Code:
  1. function martinioUF:Target(unit)
  2.  
  3.     self:SetParent(UIParent)
  4.  
  5.     eventListeners(self)
  6.  
  7.     self:SetWidth(250)
  8.     self:SetHeight(19)
  9.    
  10.     ...CODE ...
  11.  
  12.     createCastBar(self, 0, -40, 15, 228, unit)
  13.  
  14.     self.LeaderIndicator = self.Leader
  15.     self.RaidTargetIndicator = self.RaidIcon
  16.     self.ReadyCheckIndicator = self.ReadyCheck
  17.  
  18.     return self
  19. end

Did I miss something or make something wrong?

best,
Martin


All times are GMT -6. The time now is 06:40 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI