Thread Tools Display Modes
08-27-16, 09:11 AM   #21
Joker119
A Flamescale Wyrmkin
 
Joker119's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 113
I'm sorry but I'm missing something crucial here..
I'm trying to impliment a similar feature into my UI addon, but
Code:
            local _, _, _, _, _, duration, expirationTime = UnitAura(PlayerFrame.unit, index, filter)
            if duration > 0 and expirationTime then
                  -- This aura has a duration:
                  BuffStatusBar:SetMinMaxValues(expirationTime - duration, expirationTime)
            else
                  -- This aura doesn't have a duration:
                  BuffStatusBar:SetMinMaxValues(0, 1)
                  BuffStatusBar:SetValue(1)
            end
gives me an error saying
Code:
 if duration > 0 and expirationTime then
is trying to compare a number to a nil.

I have everything else working except this.
  Reply With Quote
08-27-16, 12:04 PM   #22
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
There's still something wrong with the timers´

Lua Code:
  1. hooksecurefunc("AuraButton_Update", function(self, index, filter)
  2.     local ABuffFrame = _G[self..index]
  3.     if ABuffFrame then
  4.         ABuffFrame:SetSize(BuffSize, BuffSize)
  5.         A.CreateBorder(ABuffFrame, true, BuffSize, BuffSize)
  6.  
  7.         local BuffStatusBar = ABuffFrame.StatusBar
  8.         if not BuffStatusBar then
  9.             BuffStatusBar = CreateFrame("StatusBar", nil, ABuffFrame)
  10.             BuffStatusBar:SetFrameStrata("HIGH")
  11.             BuffStatusBar:SetSize(32, 6)
  12.             BuffStatusBar:SetPoint("BOTTOM", ABuffFrame, 0, -8)
  13.             BuffStatusBar:SetStatusBarTexture(C.Media.Texture)
  14.             BuffStatusBar:SetStatusBarColor(A.ClassColor.r, A.ClassColor.g, A.ClassColor.b)
  15.            
  16.             local _, _, _, _, _, duration, expirationTime = UnitAura(PlayerFrame.unit, index, filter)
  17.             if duration > 0 and expirationTime then
  18.                 BuffStatusBar:SetMinMaxValues(expirationTime - duration, expirationTime)
  19.             else
  20.                 BuffStatusBar:SetMinMaxValues(0, 1)
  21.                 BuffStatusBar:SetValue(1)
  22.             end
  23.            
  24.             A.Skin(BuffStatusBar)
  25.    
  26.             ABuffFrame.StatusBar = BuffStatusBar  
  27.         end
  28.     end
  29.    
  30.     local ABuffFrameIcon = _G[self..index.."Icon"]
  31.     if ABuffFrameIcon then
  32.         ABuffFrameIcon:SetTexCoord(0.03, 0.97, 0.03, 0.97)
  33.     end
  34.    
  35.     local ABuffFrameDuration = _G[self..index.."Duration"]
  36.     if ABuffFrameDuration then
  37.         ABuffFrameDuration:SetDrawLayer("OVERLAY")
  38.         ABuffFrameDuration:ClearAllPoints()
  39.         ABuffFrameDuration:SetPoint("BOTTOM", ABuffFrame, "BOTTOM", 1, -15.5)
  40.         ABuffFrameDuration:SetFont(C.Media.Font, 12, "THINOUTLINE")
  41.         ABuffFrameDuration:SetShadowOffset(1, -1)
  42.         ABuffFrameDuration:SetShadowColor(0, 0, 0)
  43.         ABuffFrameDuration:SetAlpha(0)
  44.     end
  45.    
  46.     local ABuffFrameCount = _G[self..index.."Count"]
  47.     if ABuffFrameCount then
  48.         ABuffFrameCount:SetDrawLayer("OVERLAY")
  49.         ABuffFrameCount:ClearAllPoints()
  50.         ABuffFrameCount:SetPoint("BOTTOMRIGHT", ABuffFrame, 1, 1)
  51.         ABuffFrameCount:SetFont(C.Media.Font, 12.5, "THINOUTLINE")
  52.         ABuffFrameCount:SetShadowOffset(1, -1)
  53.         ABuffFrameCount:SetShadowColor(0, 0, 0)
  54.     end
  55.    
  56.     local ABuffFrameBorder = _G[self..index.."Border"]
  57.     if ABuffFrameBorder then
  58.         local R, G, B = ABuffFrameBorder:GetVertexColor()
  59.         ABuffFrameBorder:Hide()
  60.         ABuffFrameBorder:SetTexture(nil)
  61.         A.ColorBorder(ABuffFrame, R, G, B)     
  62.     end
  63. end)
  64.  
  65. BuffFrame:HookScript("OnUpdate", function()
  66.     local GetDurationTime = GetTime()
  67.  
  68.     for i = 1, BUFF_ACTUAL_DISPLAY do
  69.         local button = _G["BuffButton"..i]
  70.         if button.timeLeft then
  71.             button.StatusBar:SetValue(GetDurationTime)
  72.         end
  73.     end
  74.  
  75.     for i = 1, DEBUFF_ACTUAL_DISPLAY do
  76.         local button = _G["DebuffButton"..i]
  77.         if button.timeLeft then
  78.             button.StatusBar:SetValue(GetDurationTime)
  79.         end
  80.     end
  81. end)
  Reply With Quote
08-28-16, 07:12 AM   #23
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Game92 View Post
When i actually remove the check it give errors for some reason

Lua Code:
  1. ...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:180: attempt to index local 'ABuffFrame' (a nil value)
1. When you post an error message, please also post the entire file where the error is originating. Without knowing what line 180 is, that error isn't very helpful.

2. As a general tip, it can be helpful to add some print statements to let you see when things are happening and what data the API is giving you. For example:

Code:
hooksecurefunc("AuraButton_Update", function(self, index, filter)
    local ABuffFrame = _G[self..index]
    print("AuraButton_Update", self, index, filter, ABuffFrame)
On second look, it looks like AuraButton_Update can actually be called for buttons that don't exist, but it would be better (easier to read at a glance) to do the check like this:

Code:
hooksecurefunc("AuraButton_Update", function(self, index, filter)
    local ABuffFrame = _G[self..index]
    if not ABuffFrame then return end
If that's not what line 180 is, please post the rest of the code.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-28-16, 08:22 AM   #24
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Heres my full code: http://hastebin.com/uresuxiyug.lua

and
Lua Code:
  1. if not ABuffFrame then return end

Worked all fine to remove all other if ... then besides

Lua Code:
  1. local ABuffFrameBorder = _G[self..index.."Border"]

So i just added like you said and works all fine

Lua Code:
  1. if not ABuffFrameBorder then return end

But yet theres a mystery with the statubar buff timer, it doesn't seem to be updating correctly, whenever i first logg on or reload my ui, it works perfect, until i get my 2nd buff, it doesn't update correctly anymore.
  Reply With Quote
08-28-16, 01:58 PM   #25
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You still have the same problem I already told you about several posts back:

Code:
    local BuffStatusBar = ABuffFrame.StatusBar
    if not BuffStatusBar then
        -- Everything in here only runs the FIRST TIME a button is used!	
    end
    -- Code out here runs every time the button updates.
The code that updates your statusbar is in that "only run the first time" section. Anything has to do with a specific aura (eg. calling UnitAura and doing stuff with the values you get back) needs to be outside of that section, or you will continue to have the problem you're describing.

Edit:
Also, you should move lines 212-237 into the "only run the first time" section. There's no need to run all that stuff over and over.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 08-28-16 at 02:00 PM.
  Reply With Quote
08-28-16, 02:20 PM   #26
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Got this error.

Full Code:http://hastebin.com/edadejohag.lua

Lua Code:
  1. Message: ...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:233: attempt to compare number with nil
  2. Time: 08/28/16 22:19:17
  3. Count: 1
  4. Stack: ...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:233: in function <...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:178>
  5. [C]: in function `AuraButton_Update'
  6. Interface\FrameXML\BuffFrame.lua:98: in function `BuffFrame_Update'
  7. Interface\FrameXML\PlayerFrame.lua:452: in function `PlayerFrame_ToPlayerArt'
  8. Interface\FrameXML\PlayerFrame.lua:213: in function `OnEvent'
  9. Interface\FrameXML\UnitFrame.lua:917: in function <Interface\FrameXML\UnitFrame.lua:915>
  10.  
  11. Locals: self = "DebuffButton"
  12. index = 1
  13. filter = "HARMFUL"
  14. ABuffFrame = DebuffButton1 {
  15.  0 = <userdata>
  16.  parent = BuffFrame {
  17.  }
  18.  duration = DebuffButton1Duration {
  19.  }
  20.  timeMod = 1
  21.  ABorderShadow = <unnamed> {
  22.  }
  23.  HasBorder = true
  24.  ABorderShadow2 = <unnamed> {
  25.  }
  26.  timeLeft = 594.18
  27.  StatusBar = <unnamed> {
  28.  }
  29.  symbol = <unnamed> {
  30.  }
  31.  expirationTime = 43981.366
  32.  count = DebuffButton1Count {
  33.  }
  34.  filter = "HARMFUL"
  35.  AShadowOverlay = <unnamed> {
  36.  }
  37.  offsetY = 60
  38.  unit = "player"
  39.  ABorder = <unnamed> {
  40.  }
  41. }
  42. BuffStatusBar = <unnamed> {
  43.  0 = <userdata>
  44.  ABorderShadow = <unnamed> {
  45.  }
  46.  HasBorder = true
  47.  ABorderShadow2 = <unnamed> {
  48.  }
  49.  ABorder = <unnamed> {
  50.  }
  51. }
  52. _ = nil
  53. _ = nil
  54. _ = nil
  55. _ = nil
  56. _ = nil
  57. Duration = nil
  58. ExpirationTime = nil
  59. _ = nil
  60. _ = nil
  61. ShouldConsolidate = nil
  62. _ = nil
  63. _ = nil
  64. _ = nil
  65. (*temporary) = <unnamed> {
  66.  0 = <userdata>
  67. }
  68. (*temporary) = 0.79999822378159
  69. (*temporary) = 0
  70. (*temporary) = 0
  71. (*temporary) = "attempt to compare number with nil"
  72. BuffSize = 32
  73. A = <unnamed> {
  74.  0 = <userdata>
  75.  Kill = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:100
  76.  Zone = "Stormshield"
  77.  ColorGradientNeav = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:40
  78.  ColorGradient = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:14
  79.  Func = <function> defined @Interface\AddOns\AftermathhUI\Core\Init.lua:32
  80.  Resolution = "1920x1080"
  81.  Mult = 0.79012345679012
  82.  Skin = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:54
  83.  FormVal = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:68
  84.  Level = 100
  85.  StripTexture = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:106
  86.  Realm = "Darksorrow"
  87.  CloseButton = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:110
  88.  RGBToHex = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:60
  89.  KillButton = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:97
  90.  Region = "enUS"
  91.  SkinButton = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:64
  92.  ColorBorder = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:50
  93.  CreateBorder = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:8
  94.  TexCoords = <table> {
  95.  }
  96.  ClassColor = <table> {
  97.  }
  98.  FormatTime = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:84
  99.  Version = "1.38"
  100.  Scale = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:6
  101.  Round = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:76
  102.  RaidDebuffsTracking = <table> {
  103.  }
  104.  Class = "DEMONHUNTER"
  105.  Name = "Alassaelyane"
  106. }
  107. C = <table> {
  108.  Nameplate = <table> {
  109.  }
  110.  Misc = <table> {
  111.  }
  112.  General = <table> {
  113.  }
  114.  Media = <table> {
  115.  }
  116.  Tooltip = <table> {
  117.  }
  118.  UnitFrames = <table> {
  119.  }
  120.  DataTexts = <table> {
  121.  }
  122.  Bags = <table> {
  123.  }
  124.  Auras = <table> {
  125.  }
  126. }

Lua Code:
  1. Message: ...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:233: attempt to compare number with nil
  2. Time: 08/28/16 22:19:20
  3. Count: 2
  4. Stack: ...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:233: in function <...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:178>
  5. [C]: in function `AuraButton_Update'
  6. Interface\FrameXML\BuffFrame.lua:98: in function `BuffFrame_Update'
  7. Interface\FrameXML\BuffFrame.lua:48: in function <Interface\FrameXML\BuffFrame.lua:44>
  8.  
  9. Locals: self = "DebuffButton"
  10. index = 1
  11. filter = "HARMFUL"
  12. ABuffFrame = DebuffButton1 {
  13.  0 = <userdata>
  14.  parent = BuffFrame {
  15.  }
  16.  duration = DebuffButton1Duration {
  17.  }
  18.  timeMod = 1
  19.  ABorderShadow = <unnamed> {
  20.  }
  21.  HasBorder = true
  22.  ABorderShadow2 = <unnamed> {
  23.  }
  24.  timeLeft = 587.352
  25.  StatusBar = <unnamed> {
  26.  }
  27.  symbol = <unnamed> {
  28.  }
  29.  expirationTime = 43981.366
  30.  count = DebuffButton1Count {
  31.  }
  32.  filter = "HARMFUL"
  33.  AShadowOverlay = <unnamed> {
  34.  }
  35.  offsetY = 60
  36.  unit = "player"
  37.  ABorder = <unnamed> {
  38.  }
  39. }
  40. BuffStatusBar = <unnamed> {
  41.  0 = <userdata>
  42.  ABorderShadow = <unnamed> {
  43.  }
  44.  HasBorder = true
  45.  ABorderShadow2 = <unnamed> {
  46.  }
  47.  ABorder = <unnamed> {
  48.  }
  49. }
  50. _ = nil
  51. _ = nil
  52. _ = nil
  53. _ = nil
  54. _ = nil
  55. Duration = nil
  56. ExpirationTime = nil
  57. _ = nil
  58. _ = nil
  59. ShouldConsolidate = nil
  60. _ = nil
  61. _ = nil
  62. _ = nil
  63. (*temporary) = DebuffButton1 {
  64.  0 = <userdata>
  65.  parent = BuffFrame {
  66.  }
  67.  duration = DebuffButton1Duration {
  68.  }
  69.  timeMod = 1
  70.  ABorderShadow = <unnamed> {
  71.  }
  72.  HasBorder = true
  73.  ABorderShadow2 = <unnamed> {
  74.  }
  75.  timeLeft = 587.352
  76.  StatusBar = <unnamed> {
  77.  }
  78.  symbol = <unnamed> {
  79.  }
  80.  expirationTime = 43981.366
  81.  count = DebuffButton1Count {
  82.  }
  83.  filter = "HARMFUL"
  84.  AShadowOverlay = <unnamed> {
  85.  }
  86.  offsetY = 60
  87.  unit = "player"
  88.  ABorder = <unnamed> {
  89.  }
  90. }
  91. (*temporary) = true
  92. (*temporary) = nil
  93. (*temporary) = true
  94. (*temporary) = "attempt to compare number with nil"
  95. BuffSize = 32
  96. A = <unnamed> {
  97.  0 = <userdata>
  98.  Kill = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:100
  99.  Zone = "Stormshield"
  100.  ColorGradientNeav = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:40
  101.  ColorGradient = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:14
  102.  Func = <function> defined @Interface\AddOns\AftermathhUI\Core\Init.lua:32
  103.  Resolution = "1920x1080"
  104.  Mult = 0.79012345679012
  105.  Skin = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:54
  106.  FormVal = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:68
  107.  Level = 100
  108.  StripTexture = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:106
  109.  Realm = "Darksorrow"
  110.  CloseButton = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:110
  111.  RGBToHex = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:60
  112.  KillButton = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:97
  113.  Region = "enUS"
  114.  SkinButton = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:64
  115.  ColorBorder = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:50
  116.  CreateBorder = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:8
  117.  TexCoords = <table> {
  118.  }
  119.  ClassColor = <table> {
  120.  }
  121.  FormatTime = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:84
  122.  Version = "1.38"
  123.  Scale = <function> defined @Interface\AddOns\AftermathhUI\Core\Api.lua:6
  124.  Round = <function> defined @Interface\AddOns\AftermathhUI\Core\Core.lua:76
  125.  RaidDebuffsTracking = <table> {
  126.  }
  127.  Class = "DEMONHUNTER"
  128.  Name = "Alassaelyane"
  129. }
  130. C = <table> {
  131.  Nameplate = <table> {
  132.  }
  133.  Misc = <table> {
  134.  }
  135.  General = <table> {
  136.  }
  137.  Media = <table> {
  138.  }
  139.  Tooltip = <table> {
  140.  }
  141.  UnitFrames = <table> {
  142.  }
  143.  DataTexts = <table> {
  144.  }
  145.  Bags = <table> {
  146.  }
  147.  Auras = <table> {
  148.  }
  149. }
  Reply With Quote
08-28-16, 02:36 PM   #27
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Got this error now.

Full Code: http://hastebin.com/cacosemema.lua

Lua Code:
  1. Message: ...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:249: attempt to index field 'StatusBar' (a nil value)
  2. Time: 08/28/16 22:35:54
  3. Count: 2469
  4. Stack: ...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:249: in function <...nterface\AddOns\AftermathhUI\Modules\Auras\Auras.lua:243>
  5.  
  6. Locals: GetDurationTime = 44388.013
  7. (for index) = 1
  8. (for limit) = 1
  9. (for step) = 1
  10. i = 1
  11. BuffButton = BuffButton1 {
  12.  0 = <userdata>
  13.  expirationTime = 44388.073
  14.  timeMod = 1
  15.  parent = BuffFrame {
  16.  }
  17.  duration = BuffButton1Duration {
  18.  }
  19.  ABorderShadow = <unnamed> {
  20.  }
  21.  unit = "player"
  22.  AShadowOverlay = <unnamed> {
  23.  }
  24.  ABorder = <unnamed> {
  25.  }
  26.  filter = "HELPFUL"
  27.  HasBorder = true
  28.  ABorderShadow2 = <unnamed> {
  29.  }
  30.  timeLeft = 0.060000000004948
  31.  count = BuffButton1Count {
  32.  }
  33. }
  34. (*temporary) = nil
  35. (*temporary) = nil
  36. (*temporary) = nil
  37. (*temporary) = "attempt to index field 'StatusBar' (a nil value)"
  Reply With Quote
08-30-16, 07:10 AM   #28
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
bump still has issue!

Hope everyone had a good legion launch!
  Reply With Quote
08-30-16, 10:52 PM   #29
Joker119
A Flamescale Wyrmkin
 
Joker119's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 113
Originally Posted by Game92 View Post
bump still has issue!

Hope everyone had a good legion launch!
I just resorted to using ShinyBuffs instead of my old buff frame, and I rather like it.

Also I noticed zork's 7.0 git has a rBuffDurationBar? Not sure if published yet, but maybe you can get with him about using it if it is, he's great at those module addons that can just fit in whereever you need them :P
  Reply With Quote
08-31-16, 08:28 AM   #30
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I like how I'm doing 100% of the work here, and you don't seem to be making any effort to debug or learn how any of the code is actually working.

I have neither the time nor the interest in figuring out exactly why you're actually getting that error, so just band-aid it:

Code:
if BuffButton.timeLeft and BuffButton.StatusBar then
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-31-16, 09:30 AM   #31
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Phanx View Post
I like how I'm doing 100% of the work here, and you don't seem to be making any effort to debug or learn how any of the code is actually working.

I have neither the time nor the interest in figuring out exactly why you're actually getting that error, so just band-aid it:

Code:
if BuffButton.timeLeft and BuffButton.StatusBar then
Well really sorry... Not easy when you really dont know what to do or have no idea how to figure out this.
  Reply With Quote
02-15-17, 04:55 AM   #32
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Managed to fix this yesterday, thanks Vlad & Phanx!

Lua Code:
  1. hooksecurefunc("AuraButton_Update", function(self, index, filter)  
  2.     local ABuffFrame = _G[self..index]
  3.     if not ABuffFrame then return end
  4.  
  5.     ABuffFrame:SetSize(BuffSize, BuffSize)
  6.     A.CreateBorder(ABuffFrame, true, BuffSize, BuffSize)
  7.    
  8.     local ABuffFrameIcon = _G[self..index.."Icon"]
  9.     ABuffFrameIcon:SetTexCoord(unpack(A.TexCoords))
  10.  
  11.     local BuffStatusBar = ABuffFrame.StatusBar
  12.     if not BuffStatusBar then      
  13.         BuffStatusBar = CreateFrame("StatusBar", nil, ABuffFrame)
  14.         BuffStatusBar:SetSize(BuffSize, 6)
  15.         BuffStatusBar:SetPoint("BOTTOM", ABuffFrame, 0, -9)
  16.        
  17.         BuffStatusBar:SetStatusBarTexture("Interface\\Buttons\\WHITE8x8")
  18.         BuffStatusBar:SetMinMaxValues(0, 1)
  19.        
  20.         BuffStatusBar:SetBackdrop({
  21.             bgFile = "Interface\\Buttons\\WHITE8x8",
  22.             insets = {top = A.Scale(1), left = A.Scale(1), bottom = A.Scale(1), right = A.Scale(1)},
  23.         })
  24.        
  25.         A.CreateBorder(BuffStatusBar)
  26.  
  27.         ABuffFrame.StatusBar = BuffStatusBar
  28.     end
  29.    
  30.     local TimeLeft = 0
  31.    
  32.     BuffStatusBar:SetScript("OnUpdate", function(self, Elapsed)
  33.         TimeLeft = TimeLeft - Elapsed
  34.    
  35.         if (TimeLeft <= 0) then
  36.        
  37.             local Name, Rank, Texture, Count, DType, Duration, ExpirationTime, Caster, IsStealable, IsConsolidate, SpellID, CanApplyAura, IsBossDebuff = UnitAura(ABuffFrame.unit, index, filter)
  38.             if (Duration > 0 and ExpirationTime and not IsConsolidate) then
  39.                 local GetDurationTime = GetTime()
  40.                 BuffStatusBar:SetValue((ExpirationTime - GetDurationTime) / Duration)
  41.                
  42.                 local R, G, B = A.ColorGradient((ExpirationTime - GetDurationTime), Duration, 0.8, 0, 0, 0.8, 0.8, 0, 0, 0.8, 0)
  43.                 BuffStatusBar:SetStatusBarColor(R, G, B)
  44.                 BuffStatusBar:SetBackdropColor(R*0.5, G*0.5, B*0.5)
  45.             else
  46.                 local Min, Max = BuffStatusBar:GetMinMaxValues()
  47.                 BuffStatusBar:SetValue(Max)
  48.                 BuffStatusBar:SetStatusBarColor(0, 0.8, 0)
  49.             end
  50.            
  51.             TimeLeft = 0.01
  52.         end
  53.     end)
  54.  
  55.     local ABuffFrameDuration = _G[self..index.."Duration"]
  56.     --ABuffFrameDuration:ClearAllPoints()
  57.     --ABuffFrameDuration:SetPoint("BOTTOM", ABuffFrame, "BOTTOM", 1, -15.5)
  58.     --ABuffFrameDuration:SetFont(Font2, 12, "THINOUTLINE")
  59.     --ABuffFrameDuration:SetShadowOffset(1, -1)
  60.     --ABuffFrameDuration:SetShadowColor(0, 0, 0)
  61.     ABuffFrameDuration:SetAlpha(0)
  62.  
  63.     local ABuffFrameCount = _G[self..index.."Count"]
  64.     ABuffFrameCount:ClearAllPoints()
  65.     ABuffFrameCount:SetPoint("BOTTOMRIGHT", ABuffFrame, -1.5, 4)
  66.     ABuffFrameCount:SetFont(Font2, 12.5, "THINOUTLINE")
  67.     ABuffFrameCount:SetShadowOffset(1, -1)
  68.     ABuffFrameCount:SetShadowColor(0, 0, 0)
  69.  
  70.     local ABuffFrameBorder = _G[self..index.."Border"]
  71.     if ABuffFrameBorder then
  72.         ABuffFrameBorder:SetTexture(nil)
  73.         ABuffFrameBorder:Hide()
  74.        
  75.         local R, G, B = ABuffFrameBorder:GetVertexColor()
  76.         A.ColorBorder(ABuffFrame, R, G, B)
  77.         A.ColorBorder(BuffStatusBar, R, G, B)
  78.     end
  79. end)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Buff Timer to be Statusbar instead of text

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