View Single Post
03-21-12, 05:58 PM   #3
MiRai
A Warpwood Thunder Caller
Join Date: Jul 2011
Posts: 96
Originally Posted by Phanx View Post
I really wish people asking for help with a specific addon would provide a link to that addon's download page, so I didn't have to go hunt for it in order to try to help them... >_<
Apologies...


The only text I see in the code (eg. I did not load the addon in-game) is the health text, which you can remove by commenting out the line in core.lua that creates it:

Code:
329.		lib.gen_hpstrings(self)
If there is any other text, please describe what information it shows, so I can find it in the code. I did not spend a huge amount of time searching.
Thanks that seems to have done it. I don't know why I was hesitant to comment that out...

In lib.lua, comment out the section of code that creates it:
Code:
    if f.mystyle == "player" then
      --latency (only for player unit)
      local z = s:CreateTexture(nil,"OVERLAY")
      z:SetTexture(cfg.statusbar_texture)
      z:SetVertexColor(1,0.1,0,.6)
      z:SetPoint("TOPRIGHT")
      z:SetPoint("BOTTOMRIGHT")
	  s:SetFrameLevel(1)
      s.SafeZone = z
      -- custom latency display
      local l = lib.gen_fontstring(s, cfg.font, 10, "THINOUTLINE")
      l:SetPoint("CENTER", -2, 17)
      l:SetJustifyH("RIGHT")
	  l:Hide()
      s.Lag = l
      f:RegisterEvent("UNIT_SPELLCAST_SENT", cast.OnCastSent)
    end

Commenting that out throws up this error:


Code:
Message: Interface\AddOns\oUF_Fail\castbar.lua:102: attempt to index local 'sf' (a nil value)
Time: 03/21/12 18:52:58
Count: 1
Stack: Interface\AddOns\oUF_Fail\castbar.lua:102: in function `PostCastStart'
Interface\AddOns\oUF\elements\castbar.lua:61: in function `func'
Interface\AddOns\oUF\events.lua:18: in function <Interface\AddOns\oUF\events.lua:16>
(tail call): ?

Locals: self = oUF_failCastbarplayer {
 0 = <userdata>
 PostCastStop = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:120
 CastingColor = <table> {
 }
 ChannelingColor = <table> {
 }
 Time = <unnamed> {
 }
 interrupt = true
 PostChannelStart = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:94
 casting = true
 FailColor = <table> {
 }
 castid = 111
 CompleteColor = <table> {
 }
 delay = 0
 max = 1.5
 Text = <unnamed> {
 }
 duration = 0
 PostCastStart = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:94
 Spark = <unnamed> {
 }
 __owner = oUF_failPlayer {
 }
 ForceUpdate = <function> defined @Interface\AddOns\oUF\elements\castbar.lua:378
 Icon = <unnamed> {
 }
 PostCastInterrupted = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:135
 PostChannelStop = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:129
 PostCastFailed = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:135
 OnUpdate = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:54
}
unit = "player"
name = "Red Proto-Drake"
rank = nil
text = 111
pcolor = <table> {
 1 = 1
 2 = 0.50196078431373
 3 = 0.50196078431373
}
interruptcb = <table> {
 1 = 0.37254901960784
 2 = 0.71372549019608
 3 = 1
}
sf = nil
(*temporary) = 364466.943
(*temporary) = 364466.943
(*temporary) = 0.71372549019608
(*temporary) = 1
(*temporary) = <userdata>
(*temporary) = "attempt to index local 'sf' (a nil value)"
cast = <unnamed> {
 0 = <userdata>
 setBarTicks = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:32
 OnCastbarUpdate = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:54
 PostCastStart = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:94
 PostCastStop = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:120
 PostChannelStop = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:129
 PostCastFailed = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:135
 OnCastSent = <function> defined @Interface\AddOns\oUF_Fail\castbar.lua:89
}
channelingTicks = <table> {
 Mind Sear = 5
 Soul Harvest = 4
 Tranquility = 4
 Hurricane = 10
 Drain Soul = 5
 Earthquake = 8
 Mind Flay = 3
 Penance = 2
 Blizzard = 5
 Arcane Missiles = 5
 Evocation = 4
 Drain Life = 5
 Rain of Fire = 4
}


Here's the castbar.lua code:


lua Code:
  1. local addon, ns = ...
  2.   local cfg = ns.cfg
  3.   local cast = CreateFrame("Frame")  
  4.  
  5.   -----------------------------
  6.   -- FUNCTIONS
  7.   -----------------------------
  8.   -- special thanks to Allez for coming up with this solution
  9. local channelingTicks = {
  10.     -- warlock
  11.     [GetSpellInfo(1120)] = 5, -- drain soul
  12.     [GetSpellInfo(689)] = 5, -- drain life
  13.     [GetSpellInfo(5740)] = 4, -- rain of fire
  14.     [GetSpellInfo(79268)] = 4, -- soul harvest
  15.     -- druid
  16.     [GetSpellInfo(740)] = 4, -- Tranquility
  17.     [GetSpellInfo(16914)] = 10, -- Hurricane
  18.     -- priest
  19.     [GetSpellInfo(15407)] = 3, -- mind flay
  20.     [GetSpellInfo(48045)] = 5, -- mind sear
  21.     [GetSpellInfo(47540)] = 2, -- penance
  22.     -- mage
  23.     [GetSpellInfo(5143)] = 5, -- arcane missiles
  24.     [GetSpellInfo(10)] = 5, -- blizzard
  25.     [GetSpellInfo(12051)] = 4, -- evocation
  26.     -- shaman
  27.     [GetSpellInfo(61882)] = 8 -- earthquake
  28. }
  29.  
  30. local ticks = {}
  31.  
  32. cast.setBarTicks = function(castBar, ticknum)
  33.     if ticknum and ticknum > 0 then
  34.         local delta = castBar:GetWidth() / ticknum
  35.         for k = 1, ticknum do
  36.             if not ticks[k] then
  37.                 ticks[k] = castBar:CreateTexture(nil, 'OVERLAY')
  38.                 ticks[k]:SetTexture(cfg.statusbar_texture)
  39.                 ticks[k]:SetVertexColor(0, 0, 0)
  40.                 ticks[k]:SetWidth(1)
  41.                 ticks[k]:SetHeight(castBar:GetHeight())
  42.             end
  43.             ticks[k]:ClearAllPoints()
  44.             ticks[k]:SetPoint("CENTER", castBar, "LEFT", delta * k, 0 )
  45.             ticks[k]:Show()
  46.         end
  47.     else
  48.         for k, v in pairs(ticks) do
  49.             v:Hide()
  50.         end
  51.     end
  52. end
  53.  
  54. cast.OnCastbarUpdate = function(self, elapsed)
  55.     local currentTime = GetTime()
  56.     if self.casting or self.channeling then
  57.         local parent = self:GetParent()
  58.         local duration = self.casting and self.duration + elapsed or self.duration - elapsed
  59.         if (self.casting and duration >= self.max) or (self.channeling and duration <= 0) then
  60.             self.casting = nil
  61.             self.channeling = nil
  62.             return
  63.         end
  64.         if parent.unit == 'player' then
  65.             if self.delay ~= 0 then
  66.                 self.Time:SetFormattedText('%.1f / |cffff0000%.1f|r', duration, self.casting and self.max + self.delay or self.max - self.delay)
  67.             else
  68.                 self.Time:SetFormattedText('%.1f / %.1f', duration, self.max)
  69.                 self.Lag:SetFormattedText("%d ms", self.SafeZone.timeDiff * 1000)
  70.             end
  71.         else
  72.             self.Time:SetFormattedText('%.1f / %.1f', duration, self.casting and self.max + self.delay or self.max - self.delay)
  73.         end
  74.         self.duration = duration
  75.         self:SetValue(duration)
  76.         self.Spark:SetPoint('CENTER', self, 'LEFT', (duration / self.max) * self:GetWidth(), 0)
  77.     else
  78.         self.Spark:Hide()
  79.         local alpha = self:GetAlpha() - 0.02
  80.         if alpha > 0 then
  81.             self:SetAlpha(alpha)
  82.         else
  83.             self.fadeOut = nil
  84.             self:Hide()
  85.         end
  86.     end
  87. end
  88.  
  89. cast.OnCastSent = function(self, event, unit, spell, rank)
  90.     if self.unit ~= unit or not self.Castbar.SafeZone then return end
  91.     self.Castbar.SafeZone.sendTime = GetTime()
  92. end
  93.  
  94. cast.PostCastStart = function(self, unit, name, rank, text)
  95.     local pcolor = {255/255, 128/255, 128/255}
  96.     local interruptcb = {95/255, 182/255, 255/255}
  97.     self:SetAlpha(1.0)
  98.     self.Spark:Show()
  99.     self:SetStatusBarColor(unpack(self.casting and self.CastingColor or self.ChannelingColor))
  100.     if unit == "player"then
  101.         local sf = self.SafeZone
  102.         sf.timeDiff = GetTime() - sf.sendTime
  103.         sf.timeDiff = sf.timeDiff > self.max and self.max or sf.timeDiff
  104.         sf:SetWidth(self:GetWidth() * sf.timeDiff / self.max)
  105.         sf:Show()
  106.         if self.casting then
  107.             cast.setBarTicks(self, 0)
  108.         else
  109.             local spell = UnitChannelInfo(unit)
  110.             self.channelingTicks = channelingTicks[spell] or 0
  111.             cast.setBarTicks(self, self.channelingTicks)
  112.         end
  113.     elseif (unit == "target" or unit == "focus") and not self.interrupt then
  114.         self:SetStatusBarColor(interruptcb[1],interruptcb[2],interruptcb[3],1)
  115.     else
  116.         self:SetStatusBarColor(pcolor[1], pcolor[2], pcolor[3],1)
  117.     end
  118. end
  119.  
  120. cast.PostCastStop = function(self, unit, name, rank, castid)
  121.     if not self.fadeOut then
  122.         self:SetStatusBarColor(unpack(self.CompleteColor))
  123.         self.fadeOut = true
  124.     end
  125.     self:SetValue(self.max)
  126.     self:Show()
  127. end
  128.  
  129. cast.PostChannelStop = function(self, unit, name, rank)
  130.     self.fadeOut = true
  131.     self:SetValue(0)
  132.     self:Show()
  133. end
  134.  
  135. cast.PostCastFailed = function(self, event, unit, name, rank, castid)
  136.     self:SetStatusBarColor(unpack(self.FailColor))
  137.     self:SetValue(self.max)
  138.     if not self.fadeOut then
  139.         self.fadeOut = true
  140.     end
  141.     self:Show()
  142. end
  143.   --hand the lib to the namespace for further usage
  144.   ns.cast = cast


I have yet to play with the width of the buffs but thanks for pointing me in the right direction.
  Reply With Quote