Senit

Lib

Aug 20th, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.94 KB | None | 0 0
  1.  
  2. --oUF_Senit 2012--
  3.  
  4. --Gets Namespace
  5. local addon, ns = ...
  6.  
  7. --Gets Config
  8. local config = ns.config
  9.  
  10. --An Abbreviation
  11. local lib = CreateFrame("Frame")
  12.  
  13. --FUNCTIONS--
  14.  
  15. local backdrop = {
  16.     bgFile = "Interface\\Addons\\oUF_Senit\\media\\backdrop",
  17.     tile = true,
  18.     tileSize = 32,
  19.     insets = {
  20.         left = -1,
  21.         right = -1,
  22.         top = -1,
  23.         bottom = -1,
  24.         },
  25.     }  
  26. local backdrop2 = {
  27.     bgFile = "Interface\\Addons\\oUF_Senit\\media\\backdrop",
  28.     tile = true,
  29.     tileSize = 32,
  30.     insets = {
  31.         left = -1,
  32.         right = -.6,
  33.         top = -.6,
  34.         bottom = -.7,
  35.         },
  36.     }
  37. lib.gen_backdrop = function(f)
  38.     f:SetBackdrop(backdrop)
  39.     f:SetBackdropColor(0, 0, 0, 1)
  40. end
  41. local updateTooltip = function(self)
  42.     GameTooltip:SetUnitAura(self.parent:GetParent().unit, self:GetID(), self.filter)
  43.  
  44.     GameTooltip:Show()
  45. end
  46. local dropdown = CreateFrame("Frame", addon.."DropDown", UIParent, "UIDropDownMenuTemplate")
  47. UIDropDownMenu_Initialize(dropdown, function(self)
  48.     local unit = self:GetParent().unit
  49.         if not unit then return end  
  50.     local menu, name, id
  51.         if UnitIsUnit(unit, "player") then
  52.             menu = "SELF"
  53.         elseif UnitIsUnit(unit, "vehicle") then
  54.             menu = "VEHICLE"
  55.         elseif UnitIsUnit(unit, "pet") then
  56.             menu = "PET"
  57.         elseif UnitIsPlayer(unit) then
  58.             id = UnitInRaid(unit)
  59.         if id then
  60.             menu = "RAID_PLAYER"
  61.             name = GetRaidRosterInfo(id)
  62.         elseif UnitInParty(unit) then
  63.             menu = "PARTY"
  64.         else
  65.             menu = "PLAYER"
  66.         end
  67.     else
  68.         menu = "TARGET"
  69.         name = RAID_TARGET_ICON
  70.     end
  71.     if menu then
  72.         UnitPopup_ShowMenu(self, menu, unit, name, id)
  73.     end
  74. end, "MENU")
  75. lib.menu = function(self)
  76.     dropdown:SetParent(self)
  77.     ToggleDropDownMenu(1, nil, dropdown, "cursor", 0, 0)
  78. end
  79. do
  80.     for k,v in pairs(UnitPopupMenus) do
  81.         for x,y in pairs(UnitPopupMenus[k]) do
  82.             if y == "SET_FOCUS" then
  83.                 table.remove(UnitPopupMenus[k],x)
  84.             elseif y == "CLEAR_FOCUS" then
  85.                 table.remove(UnitPopupMenus[k],x)
  86.             end
  87.         end
  88.     end
  89. end
  90. lib.gen_fontstring = function(f, name, size, outline)
  91.     local fs = f:CreateFontString(nil, "OVERLAY")
  92.     fs:SetFont(name, size, outline)
  93.     return fs
  94. end  
  95. lib.gen_hpbar = function(f)
  96.     --Statusbar
  97.     local s = CreateFrame("StatusBar", nil, f)
  98.     s:SetStatusBarTexture(config.statusbar_texture)
  99.     s:SetBackdrop(backdrop)
  100.     s:SetBackdropColor(0, 0, 0, 1)
  101.    
  102.     s:SetHeight(f.height)
  103.     s:SetWidth(f.width)
  104.     s:SetPoint("CENTER",0,0)
  105.    
  106.     --background (["name" [, "layer" [, "inherits" [, sublevel]]]])
  107.     local b = s:CreateTexture(nil, "BACKGROUND", _, 1)
  108.     b:SetTexture(config.statusbar_texture)
  109.     b:SetAllPoints(s)
  110.     f.Health = s
  111.     f.Health.bg = b
  112. end
  113. lib.tar_fontstrings = function(f)
  114.     local name, hpval
  115.     --health/name text strings
  116.     if not f.hidename then
  117.         name = lib.gen_fontstring(f.Health, config.font, 8, "OUTLINEMONOCHROME")
  118.         name:SetPoint("LEFT", f.Health, "LEFT", 19, 1)
  119.         name:SetJustifyH("LEFT")
  120.     end
  121.    
  122.     hpval = lib.gen_fontstring(f.Health, config.font, 8, "OUTLINEMONOCHROME")
  123.     hpval:SetPoint("RIGHT", f.Health, "RIGHT", -19, 1)
  124.     hpval.frequentUpdates = 0.1
  125.    
  126.     hpperc = lib.gen_fontstring(f.Health, config.font, 8, "OUTLINEMONOCHROME")
  127.     hpperc:SetPoint("RIGHT", f.Health, "RIGHT", -19, 1)
  128.     hpperc.frequentUpdates = 0.1
  129.  
  130.     if f.hidename then
  131.         hpval:SetJustifyH("CENTER")
  132.         hpval:SetPoint("LEFT", f.Health, "LEFT", 2, 0)
  133.     else
  134.         --this will make the name go "..." when its to long
  135.         name:SetPoint("RIGHT", hpval, "LEFT", -5, 0)
  136.         hpval:SetJustifyH("RIGHT")
  137.     if f.nametag then
  138.         f:Tag(name, f.nametag)
  139.     else
  140.         f:Tag(name, "[name]")
  141.     end
  142. end      
  143.    
  144.     if f.hptag then
  145.         f:Tag(hpval, f.hptag)
  146.     else
  147.         f:Tag(hpval, "[senit:hpdefault] : [senit:hpperc]")
  148.     end
  149.  
  150. end
  151. lib.pla_fontstrings = function(f)
  152.     local ppdefault
  153.    
  154.     ppdefault = lib.gen_fontstring(f.Health, config.font, 8, "OUTLINEMONOCHROME")
  155.     ppdefault:SetPoint("CENTER", f.Health, "CENTER", -2, 0)
  156.     ppdefault.frequentUpdates = 0.1
  157.  
  158.     if f.hidename then
  159.         ppdefault:SetJustifyH("CENTER")
  160.         ppdefault:SetPoint("LEFT", f.Health, "LEFT", 2, 0)
  161.     else
  162.         ppdefault:SetAlpha(0)
  163.         ppdefault:SetJustifyH("CENTER")
  164.     if f.nametag then
  165.         f:Tag(name, f.nametag)
  166.     else
  167.         f:Tag(name, "[name]")
  168.     end
  169. end      
  170.    
  171.     if f.hptag then
  172.         f:Tag(ppdefault, f.hptag)
  173.     else
  174.         f:Tag(ppdefault, "[senit:ppdefault]")
  175.     end
  176.  
  177.     f:SetScript("OnEnter", function(self) ppdefault:SetAlpha(1); UnitFrame_OnEnter(self) end)
  178.     f:SetScript("OnLeave", function(self) ppdefault:SetAlpha(0); UnitFrame_OnLeave(self) end)
  179. end
  180. lib.cps_fontstrings = function(f)
  181.     local name = lib.gen_fontstring(f.Health, config.font, 8, "OUTLINEMONOCHROME")
  182.     name:SetPoint("CENTER", f.Health, "CENTER", 80, 1)
  183.     name:SetJustifyH("CENTER")
  184.    
  185.     f:Tag(name, "[myComboPoints]")
  186. end
  187. lib.tot_fontstrings = function(f)
  188.     local name = lib.gen_fontstring(f.Health, config.font, 8, "OUTLINEMONOCHROME")
  189.     name:SetPoint("LEFT", f.Health, _, 2, 1)
  190.     name:SetPoint("RIGHT", f.Health, _, -2, 1)
  191.     name:SetJustifyH("CENTER")
  192.    
  193.     f:Tag(name, "[name]")
  194. end
  195. lib.raid_fontstrings = function(f)
  196.     local name = lib.gen_fontstring(f.Health, config.font, 8, "OUTLINEMONOCHROME")
  197.     name:SetPoint("LEFT", f.Health, _, 2, 0)
  198.     name:SetPoint("RIGHT", f.Health, _, -2, 0)
  199.     name:SetJustifyH("CENTER")
  200.    
  201.     f:Tag(name, "[unitcolor][name]")
  202. end
  203. lib.gen_ppbar = function(f)
  204.     --Statusbar
  205.     local s = CreateFrame("StatusBar", nil, f)
  206.     s:SetStatusBarTexture(config.statusbar_texture)
  207.     s:SetFrameLevel(0)
  208.     s:SetHeight(f.height/4)
  209.     s:SetWidth(f.width/1.2)
  210.     s:SetPoint("TOP",f,"BOTTOM",0,1)
  211.     s:SetBackdrop(backdrop)
  212.     s:SetBackdropColor(0, 0, 0, 1)
  213.    
  214.     local b = s:CreateTexture(nil, "BACKGROUND", _, 1)
  215.     b:SetTexture(config.statusbar_texture)
  216.     b:SetAllPoints(s)
  217.    
  218.     f.Power = s
  219.     f.Power.bg = b
  220. end
  221. lib.gen_ppbar2 = function(f)
  222.     --Statusbar
  223.     local s = CreateFrame("StatusBar", nil, f)
  224.     s:SetStatusBarTexture(config.statusbar_texture)
  225.     s:SetHeight(f.height/8)
  226.     s:SetWidth(f.width)
  227.     --s:SetPoint("TOP",f,"BOTTOM",0,-1)
  228.     s:SetBackdrop(backdrop)
  229.     s:SetBackdropColor(0, 0, 0, 1)
  230.    
  231.     local b = s:CreateTexture(nil, "BACKGROUND", _, 1)
  232.     b:SetTexture(config.statusbar_texture)
  233.     b:SetAllPoints(s)
  234.    
  235.     f.Power = s
  236.     f.Power.bg = b
  237. end
  238. lib.gen_castbar = function(f)
  239.  
  240.     local s = CreateFrame("StatusBar", "oUF_SenitCastbar")
  241.     s:SetHeight(f.height/3)
  242.     s:SetWidth(f.width/1.41)
  243.     s:SetBackdrop(backdrop2)
  244.     s:SetBackdropColor(0, 0, 0, 1)
  245.     if f.mystyle == "player" then
  246.       s:SetPoint("CENTER",UIParent,0,0)
  247.     elseif f.mystyle == "target" then
  248.       s:SetPoint("CENTER",UIParent,0,-20)
  249.       s:SetParent(target)
  250.     else
  251.       s:SetPoint("BOTTOM",f,"TOP",0,-25)
  252.     end
  253.     s:SetStatusBarTexture(config.statusbar_texture)
  254.     s:SetStatusBarColor(20/255, 20/255, 20/255, 1)
  255.    
  256.     local b = s:CreateTexture(nil, "BACKGROUND", _, 1)
  257.     b:SetTexture(config.statusbar_texture)
  258.     b:SetAllPoints(s)
  259.     b:SetVertexColor(100/255, 100/255, 100/255)
  260.    
  261.     if f.mystyle == "player" then
  262.         local z = s:CreateTexture(nil,"OVERLAY")
  263.             z:SetTexture(config.statusbar_texture)
  264.             z:SetVertexColor(250/255,30/255,30/255,.6)
  265.             z:SetPoint("TOPRIGHT")
  266.             z:SetPoint("BOTTOMRIGHT")
  267.             s:SetFrameLevel(10)
  268.             s.SafeZone = z
  269.     end
  270.    
  271.     local txt = lib.gen_fontstring(s, config.font, 6, "OUTLINE MONOCHROME")
  272.     txt:SetPoint("LEFT", 2, -5)
  273.     txt:SetJustifyH("LEFT")
  274.     --time
  275.     local t = lib.gen_fontstring(s, config.font, 6, "OUTLINE MONOCHROME")
  276.     t:SetPoint("RIGHT", -2, -5)
  277.     txt:SetPoint("RIGHT", t, "LEFT", -5, 0)
  278.    
  279.     f.Castbar = s
  280.     f.Castbar.Text = txt
  281.     f.Castbar.Time = t
  282.     f.Castbar.bg = b
  283. end
  284. lib.PostUpdateRaidFrame = function(Health, unit, min, max)
  285.     local disconnnected = not UnitIsConnected(unit)
  286.     local dead = UnitIsDead(unit)
  287.     local ghost = UnitIsGhost(unit)
  288.     if disconnnected or dead or ghost then
  289.         Health:SetValue(max)   
  290.         if(disconnnected) then
  291.             Health:SetStatusBarColor(0,0,0,0.6)
  292.         elseif(ghost) then
  293.             Health:SetStatusBarColor(0,0,0,0.6)
  294.         elseif(dead) then
  295.             Health:SetStatusBarColor(100/255,100/255,100/255,1)
  296.         end
  297.     else
  298.         Health:SetValue(min)
  299.         if(unit == 'vehicle') then
  300.             Health:SetStatusBarColor(22/255, 106/255, 44/255)
  301.         end
  302.     end
  303. end  
  304.  
  305. --[[
  306. lib.PostCreateIcon = function(self, button)
  307.     button.remaining = lib.gen_fontstring(button, config.font, 8, "OUTLINEMONOCHROME")
  308.     button.remaining:SetPoint("CENTER", 1, 0)
  309.     button.cd:SetReverse(true)
  310.     button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
  311.     button.icon:SetDrawLayer("BACKGROUND")
  312.     --Count
  313.     button.count:ClearAllPoints()
  314.     button.count:SetFont(config.font, 8, "OUTLINEMONOCHROME")
  315.     button.count:SetJustifyH("RIGHT")
  316.     button.count:SetPoint("TOPRIGHT", button, "TOPRIGHT", 0, 0)
  317.     button.count:SetTextColor(1,1,1)
  318.    
  319.     --Helper
  320.     local h = CreateFrame("Frame", nil, button)
  321.     h:SetFrameLevel(0)
  322.     h:SetPoint("TOPLEFT", -0, 0)
  323.     h:SetPoint("BOTTOMRIGHT", 0, -0)
  324.     lib.gen_backdrop(h)
  325. end--]]
  326. --[[
  327. local myPostCreateIcon = function(self, button)
  328.     self.showDebuffType = true
  329.     self.disableCooldown = true
  330.     button.cd.noOCC = true
  331.     button.cd.noCooldownCount = true
  332.     button.icon:SetTexCoord(.07, .93, .07, .93)
  333.     button.icon:SetPoint("TOPLEFT", button, "TOPLEFT", 0, 0)
  334.     button.icon:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 0, 0)
  335.     button.overlay:SetTexture(border)
  336.     button.overlay:SetTexCoord(0,1,0,1)
  337.     button.overlay.Hide = function(self) self:SetVertexColor(0.3, 0.3, 0.3) end
  338.     button.time = lib.gen_fontstring(button, config.font, 8, "OUTLINEMONOCHROME")
  339.     button.time:SetPoint("CENTER", button, 2, 0)
  340.     button.time:SetJustifyH('CENTER')
  341.     button.time:SetVertexColor(1,1,1)
  342.     button.count = lib.gen_fontstring(button, config.font, 8, "OUTLINEMONOCHROME")
  343.     button.count:ClearAllPoints()
  344.     button.count:SetPoint("BOTTOMRIGHT", button, 7, -5)
  345.     button.count:SetVertexColor(1,1,1) 
  346.     local h = CreateFrame("Frame", nil, button)
  347.     h:SetFrameLevel(0)
  348.     h:SetPoint("TOPLEFT",-5,5)
  349.     h:SetPoint("BOTTOMRIGHT",5,-5)
  350.     lib.gen_backdrop(h)
  351. end--]]
  352.  
  353. local formatTime = function(s)
  354.     local day, hour, minute = 86400, 3600, 60
  355.     if s >= day then
  356.         return format("%dd", floor(s/day + 0.5)), s % day
  357.     elseif s >= hour then
  358.         return format("%dh", floor(s/hour + 0.5)), s % hour
  359.     elseif s >= minute then
  360.         return format("%dm", floor(s/minute + 0.5)), s % minute
  361.     elseif s >= minute / 1200 then
  362.         return floor(s), (s * 100 - floor(s * 100))/100
  363.     end
  364.     return format("%.1f", s), (s * 100 - floor(s * 100))/100
  365. end
  366. local setTimer = function (self, elapsed)
  367.     if self.timeLeft then
  368.         self.elapsed = (self.elapsed or 0) + elapsed
  369.         if self.elapsed >= 0.1 then
  370.             if not self.first then
  371.                 self.timeLeft = self.timeLeft - self.elapsed
  372.             else
  373.                 self.timeLeft = self.timeLeft - GetTime()
  374.                 self.first = false
  375.             end
  376.             if self.timeLeft > 0 then
  377.                 local time = formatTime(self.timeLeft)
  378.                     self.time:SetText(time)
  379.                 if self.timeLeft < 5 then
  380.                     self.time:SetTextColor(1, .2, 0)
  381.                 else
  382.                     self.time:SetTextColor(1, 1, 1)
  383.                 end
  384.             else
  385.                 self.time:Hide()
  386.                 self:SetScript("OnUpdate", nil)
  387.             end
  388.             self.elapsed = 0
  389.         end
  390.     end
  391. end
  392. local postCreateIcon = function(element, button)
  393.     local diffPos = 0
  394.     local self = element:GetParent()
  395.     if self.mystyle == "target" then diffPos = 1 end
  396.    
  397.     element.disableCooldown = true
  398.     button.cd.noOCC = true
  399.     button.cd.noCooldownCount = true
  400.    
  401.     local h = CreateFrame("Frame", nil, button)
  402.     h:SetFrameLevel(0)
  403.     h:SetPoint("TOPLEFT",0,0)
  404.     h:SetPoint("BOTTOMRIGHT",0,0)
  405.     lib.gen_backdrop(h)
  406.    
  407.     local time = lib.gen_fontstring(button, config.font, 8, "OUTLINEMONOCHROME")
  408.     time:SetPoint("CENTER", button, "CENTER", 1, 0)
  409.     time:SetJustifyH("CENTER")
  410.     time:SetVertexColor(1,1,1)
  411.     button.time = time
  412.    
  413.     local count = lib.gen_fontstring(button, config.font, 8, "OUTLINEMONOCHROME")
  414.     count:SetPoint("CENTER", button, "BOTTOMRIGHT", 0, 3)
  415.     count:SetJustifyH("RIGHT")
  416.     button.count = count
  417.  
  418.     button.UpdateTooltip = updateTooltip
  419.    
  420.     button.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
  421.     button.icon:SetDrawLayer("ARTWORK")
  422. end
  423. local postUpdateIcon = function(element, unit, button, index)
  424.     local _, _, _, _, _, duration, expirationTime, unitCaster, _ = UnitAura(unit, index, button.filter)
  425.    
  426.     if duration and duration > 0 then
  427.         button.time:Show()
  428.         button.timeLeft = expirationTime   
  429.         button:SetScript("OnUpdate", setTimer)         
  430.     else
  431.         button.time:Hide()
  432.         button.timeLeft = math.huge
  433.         button:SetScript("OnUpdate", nil)
  434.     end
  435.    
  436.     -- [[ Desaturate non-Player Debuffs ]] --
  437.    
  438.     if(button.debuff) then
  439.         if(unit == "target") then  
  440.             if (unitCaster == "player" or unitCaster == "vehicle") then
  441.                 button.icon:SetDesaturated(false)                
  442.             elseif(not UnitPlayerControlled(unit)) then -- If Unit is Player Controlled don"t desaturate debuffs
  443.                 button:SetBackdropColor(0, 0, 0)
  444.                 button.overlay:SetVertexColor(0.3, 0.3, 0.3)      
  445.                 button.icon:SetDesaturated(true)  
  446.             end
  447.         end
  448.     end
  449.     button:SetScript('OnMouseUp', function(self, mouseButton)
  450.         if mouseButton == 'RightButton' then
  451.             CancelUnitBuff('player', index)
  452.     end end)
  453.     button.first = true
  454. end
  455.  
  456. --AURAS--
  457.  
  458. local SortAuras = function(a, b)
  459.     if (a and b and a.timeLeft and b.timeLeft) then
  460.         return a.timeLeft > b.timeLeft
  461.     end
  462. end
  463. local PreSetPosition = function(Auras)
  464.     table.sort(Auras, SortAuras)
  465. end
  466.  
  467. lib.playBuffs = function(f)
  468.     b = CreateFrame("Frame", nil, f)
  469.     b.size = 30
  470.     if f.mystyle == "target" then
  471.         b.num = 40
  472.     elseif f.mystyle == "player" then
  473.         b.num = 10
  474.         b.onlyShowPlayer = true
  475.     else
  476.         b.num = 5
  477.     end
  478.     b.spacing = 5
  479.     b.onlyShowPlayer = false
  480.     b:SetHeight((b.size+b.spacing)*4)
  481.     b:SetWidth(f.width)
  482.     b:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 0, 500)
  483.     b.initialAnchor = "TOPRIGHT"
  484.     b["growth-x"] = "LEFT"
  485.     b["growth-y"] = "DOWN"
  486.     b.PostCreateIcon = postCreateIcon
  487.     b.PostUpdateIcon = postUpdateIcon
  488.    
  489.     f.Buffs = b
  490.     f.Buffs.PreSetPosition = PreSetPosition
  491.  
  492.     BuffFrame:UnregisterEvent("UNIT_AURA")
  493.     BuffFrame:Hide()
  494.     TemporaryEnchantFrame:Hide()
  495. end
  496. lib.createBuffs = function(f)
  497.     b = CreateFrame("Frame", nil, f)
  498.     b.size = 18.8
  499.     if f.mystyle == "target" then
  500.         b.num = 8
  501.     elseif f.mystyle == "player" then
  502.         b.num = 8
  503.         b.onlyShowPlayer = true
  504.     else
  505.         b.num = 8
  506.     end
  507.     b.spacing = 5
  508.     b.onlyShowPlayer = false
  509.     b:SetHeight((b.size+b.spacing)*4)
  510.     b:SetWidth(f.width)
  511.     b:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 20, 5)
  512.     b.initialAnchor = "BOTTOMLEFT"
  513.     b["growth-x"] = "RIGHT"
  514.     b["growth-y"] = "UP"
  515.     b.PostCreateIcon = postCreateIcon
  516.     b.PostUpdateIcon = postUpdateIcon
  517.     f.Buffs = b
  518.     --f.Buffs.PreSetPosition = PreSetPosition
  519. end
  520. lib.createDebuffs = function(f)
  521.     b = CreateFrame("Frame", nil, f)
  522.     b.size = 20
  523.     if f.mystyle == "target" then
  524.         b.num = 40
  525.         b.spacing = 5
  526.         b.onlyShowPlayer = false
  527.         b:SetHeight((b.size+b.spacing)*4)
  528.         b:SetWidth(f.width)
  529.         b:SetPoint("TOPLEFT", f, "BOTTOMLEFT", 0, -5)
  530.         b.initialAnchor = "TOPLEFT"
  531.         b["growth-x"] = "RIGHT"
  532.         b["growth-y"] = "DOWN"
  533.     elseif f.mystyle == "player" then
  534.         b.num = 10
  535.         b.spacing = 5
  536.         b.onlyShowPlayer = false
  537.         b:SetHeight((b.size+b.spacing)*4)
  538.         b:SetWidth(f.width)
  539.         b:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 0, 5)
  540.         b.initialAnchor = "BOTTOMLEFT"
  541.         b["growth-x"] = "RIGHT"
  542.         b["growth-y"] = "UP"
  543.     else
  544.         b.num = 5
  545.     end
  546.     b.PostCreateIcon = lib.PostCreateIcon
  547.     f.Debuffs = b
  548. end
  549. lib.customfilter = function(Buffs, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID)
  550.     if config.auras[spellID] then
  551.         return true
  552.     end
  553. end
  554. lib.debufftracker = function(f)
  555.     b = CreateFrame("Frame", nil, f)
  556.     b.size = 30
  557.     if f.mystyle == "target" then
  558.         b.num = 40
  559.     elseif f.mystyle == "player" then
  560.         b.num = 10
  561.         b.onlyShowPlayer = true
  562.     else
  563.         b.num = 5
  564.     end
  565.     b.spacing = 5
  566.     b.onlyShowPlayer = false
  567.     b:SetHeight((b.size+b.spacing)*4)
  568.     b:SetWidth(f.width)
  569.     b:SetPoint("BOTTOMRIGHT", f, "TOPRIGHT", 0, 50)
  570.     b.initialAnchor = "BOTTOMRIGHT"
  571.     b["growth-x"] = "LEFT"
  572.     b["growth-y"] = "UP"
  573.     b.PostCreateIcon = postCreateIcon
  574.     b.PostUpdateIcon = postUpdateIcon
  575.    
  576.     f.Debuffs = b
  577.     --f.Debuffs.PreSetPosition = PreSetPosition
  578.    
  579.     b.CustomFilter = lib.customfilter
  580. end
  581. lib.bufftracker = function(f)
  582.     b = CreateFrame("Frame", nil, f)
  583.     b.size = 30
  584.     if f.mystyle == "target" then
  585.         b.num = 40
  586.     elseif f.mystyle == "player" then
  587.         b.num = 10
  588.         b.onlyShowPlayer = true
  589.     else
  590.         b.num = 5
  591.     end
  592.     b.spacing = 5
  593.     b.onlyShowPlayer = false
  594.     b:SetHeight((b.size+b.spacing)*4)
  595.     b:SetWidth(f.width)
  596.     b:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 0, 15)
  597.     b.initialAnchor = "BOTTOMLEFT"
  598.     b["growth-x"] = "RIGHT"
  599.     b["growth-y"] = "UP"
  600.     b.PostCreateIcon = postCreateIcon
  601.     b.PostUpdateIcon = postUpdateIcon
  602.    
  603.     f.Buffs = b
  604.     --f.Buffs.PreSetPosition = PreSetPosition
  605.    
  606.     b.CustomFilter = lib.customfilter
  607.     --[[    
  608.     local t = lib.gen_fontstring(b, config.font, 6, "OUTLINE MONOCHROME")
  609.     t:SetPoint("CENTER", 0, 0)
  610.  
  611.     f.Buffs = b
  612.     f.Buffs.Time = t
  613.     --]]
  614. end
  615.    
  616. --SPECIAL POWER--
  617. ns.lib = lib
Advertisement
Add Comment
Please, Sign In to add comment