View Single Post
04-06-12, 09:47 PM   #13
MiRai
A Warpwood Thunder Caller
Join Date: Jul 2011
Posts: 96
The last post I made didn't work. I also tried to copy the entire chunk of code and rename the MirrorTimer parts to TimerTrackerTimer like so:

Lua Code:
  1. -- timer tracker!
  2.   lib.gen_timertracker = function(f)
  3.     for _, bar in pairs({'TimerTrackerTimer1','TimerTrackerTimer2','TimerTrackerTimer3','TimerTrackerTimer4','TimerTrackerTimer5'}) do
  4.       for i, region in pairs({_G[bar]:GetRegions()}) do
  5.         if (region.GetTexture and region:GetTexture() == 'SolidTexture') then
  6.           region:Hide()
  7.         end
  8.       end
  9.       _G[bar..'Border']:Hide()
  10.       _G[bar]:SetParent(UIParent)
  11.       _G[bar]:SetScale(1)
  12.       _G[bar]:SetHeight(16)
  13.       _G[bar]:SetWidth(280)
  14.       _G[bar]:SetBackdropColor(.1,.1,.1)
  15.       _G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar])
  16.       _G[bar..'Background']:SetTexture(cfg.statusbar_texture)
  17.       _G[bar..'Background']:SetAllPoints(bar)
  18.       _G[bar..'Background']:SetVertexColor(.15,.15,.15,.75)
  19.       _G[bar..'Text']:SetFont(cfg.font, 14, "THINOUTLINE")
  20.       _G[bar..'Text']:ClearAllPoints()
  21.       _G[bar..'Text']:SetPoint('CENTER', TimerTrackerTimer1StatusBar, 0, 1)
  22.       _G[bar..'StatusBar']:SetAllPoints(_G[bar])
  23.       --glowing borders
  24.       local h = CreateFrame("Frame", nil, _G[bar])
  25.       h:SetFrameLevel(0)
  26.       h:SetPoint("TOPLEFT",-5,5)
  27.       h:SetPoint("BOTTOMRIGHT",5,-5)
  28.       lib.gen_backdrop(h)
  29.     end
  30.   end

And then add lib.gen_timertracker(self) right next to where lib.gen_mirrorcb(self) is in core.lua. That didn't work either and broke the target and targettarget frame of oUF_Fail. I recruited someone in an IRC channel who knows ~20% more Lua than I do (not much) and he couldn't figure it out either. He did point me towards a section of Skinner which skins the mirror castbar and battleground countdown timer like so:

Lua Code:
  1. function aObj:MirrorTimers()
  2.     if not self.db.profile.MirrorTimers.skin or self.initialized.MirrorTimers then return end
  3.     self.initialized.MirrorTimers = true
  4.  
  5.     self:add2Table(self.uiKeys2, "MirrorTimers")
  6.  
  7.     local objBG, objSB
  8.     for i = 1, MIRRORTIMER_NUMTIMERS do
  9.         objName = "MirrorTimer"..i
  10.         obj = _G[objName]
  11.         objBG = self:getRegion(obj, 1)
  12.         objSB = _G[objName.."StatusBar"]
  13.         self:removeRegions(obj, {3})
  14.         obj:SetHeight(obj:GetHeight() * 1.25)
  15.         self:moveObject{obj=_G[objName.."Text"], y=-2}
  16.         objBG:SetWidth(objBG:GetWidth() * 0.75)
  17.         objSB:SetWidth(objSB:GetWidth() * 0.75)
  18.         if self.db.profile.MirrorTimers.glaze then
  19.             self:glazeStatusBar(objSB, 0, objBG)
  20.         end
  21.     end
  22.  
  23.     -- Battleground/Arena Start Timer (4.1)
  24.     local function skinTT(tT)
  25.  
  26.         -- aObj:Debug("skinTT: [%s, %s]", tT, #tT.timerList)
  27.         for _, timer in pairs(tT.timerList) do
  28.             -- aObj:Debug("skinTT#2: [%s]", timer)
  29.             if not aObj.sbGlazed[timer.bar] then
  30.                 local bg = aObj:getRegion(timer.bar, 1)
  31.                 _G[timer.bar:GetName().."Border"]:SetTexture(nil) -- animations
  32.                 aObj:glazeStatusBar(timer.bar, 0, bg)
  33.                 aObj:moveObject{obj=bg, y=2} -- align bars
  34.             end
  35.         end
  36.  
  37.     end
  38.     self:SecureHookScript(TimerTracker, "OnEvent", function(this, event, ...)
  39.         -- self:Debug("TT_OE: [%s, %s]", this, event)
  40.         if event == "START_TIMER" then
  41.             skinTT(this)
  42.         end
  43.     end)
  44.     -- skin existing timers
  45.     skinTT(TimerTracker)
  46.  
  47. end

Looking at that I'm really not sure where to go from there.
  Reply With Quote