View Single Post
12-26-13, 10:49 PM   #34
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Looks like that when I toss the druid ecplipse and druidmana bars into the unit specific the bars don't load at all.

This includes runes and totems as well.

Also my svn isn't updating for some reason /cry

code:
Lua Code:
  1. local _, cfg = ... --import config
  2. local addon, ns = ... --get addon namespace
  3.  
  4. -----------------------------
  5. -- Add custom functions (overrides)
  6.  function CreateBackdrop(frame)
  7.     frame:SetBackdrop({bgFile = "Interface\\Buttons\\WHITE8x8", edgeFile = "Interface\\Buttons\\WHITE8x8", edgeSize = 2,
  8.         insets = {top = 2, left = 2, bottom = 2, right = 2}})
  9.     frame:SetBackdropColor(0,0,0,.5)
  10.     frame:SetBackdropBorderColor(0,0,0,1)
  11.     frame:CreateBorder(12,1,1,1)
  12.     frame:SetBorderPadding(1)
  13. end
  14.  
  15. ------------------------------------------------------------------------
  16. -- UnitSpecific settings
  17. ------------------------------------------------------------------------
  18. local UnitSpecific = {
  19.     player = function(self)
  20.         -- player specific stuff
  21.         self:SetSize(cfg.width,cfg.height)
  22.        
  23.         -- 3D Portrait
  24.         -- Position and size
  25.         local Portrait = CreateFrame('PlayerModel', nil, self)
  26.         Portrait:SetSize(cfg.height, cfg.height)
  27.         Portrait:SetPoint('RIGHT', self, 'LEFT', -2,0)
  28.         CreateBackdrop(Portrait)
  29.         -- Register it with oUF
  30.         self.Portrait = Portrait
  31.        
  32.         -----------------------------
  33.         -- Runes
  34.         local Runes = {}
  35.         for index = 1, 6 do
  36.             -- Position and size of the rune bar indicators
  37.             local Rune = CreateFrame('StatusBar', nil, Power)
  38.             Rune:SetSize(120 / 6, 20)
  39.             Rune:SetPoint('TOPLEFT', Power, 'BOTTOMLEFT', index * 120 / 6 - 20, 0)
  40.             Rune:CreateBorder(10,1,1,1)
  41.             Rune:SetBorderPadding(1)
  42.             Rune:SetStatusBarTexture(cfg.statusbar_texture)
  43.             CreateBackdrop(Rune)
  44.    
  45.             Runes[index] = Rune
  46.         end
  47.         -- Register with oUF
  48.         self.Runes = Runes
  49.        
  50.         -----------------------------
  51.         -- Eclipse Bar
  52.         local EclipseBar = CreateFrame("Frame", nil, self)
  53.         EclipseBar:SetPoint("TOP", Power, "BOTTOM", 0, -2) -- are you sure you want this overlapping your power bar by 2px?
  54.         EclipseBar:SetSize(cfg.width, 15)
  55.         self.EclipseBar = EclipseBar
  56.        
  57.         local LunarBar = CreateFrame("StatusBar", nil, EclipseBar)
  58.         LunarBar:SetPoint("LEFT")
  59.         LunarBar:SetSize(cfg.width, 15)
  60.         LunarBar:SetStatusBarTexture(cfg.statusbar_texture)
  61.         LunarBar:CreateBorder(12,1,1,1)
  62.         LunarBar:SetBorderPadding(1)
  63.         EclipseBar.LunarBar = LunarBar
  64.        
  65.         local SolarBar = CreateFrame("StatusBar", nil, EclipseBar)
  66.         SolarBar:SetPoint("LEFT", LunarBar:GetStatusBarTexture(), "RIGHT")
  67.         SolarBar:SetSize(cfg.width, 15)
  68.         EclipseBar.SolarBar = SolarBar
  69.        
  70.         -----------------------------
  71.         -- Druid Mana
  72.         -- Position and size
  73.         local DruidMana = CreateFrame('StatusBar', nil, Power)
  74.         DruidMana:SetSize(20, 20)
  75.         DruidMana:SetPoint('TOP',Power,'BOTTOM',0,-2)
  76.         DruidMana:SetPoint('LEFT')
  77.         DruidMana:SetPoint('RIGHT')
  78.         DruidMana:CreateBorder(8,1,1,1)
  79.         DruidMana:SetBorderPadding(1)
  80.         -- Add a background
  81.         local Background = DruidMana:CreateTexture(nil, 'BACKGROUND')
  82.         Background:SetAllPoints(DruidMana)
  83.         Background:SetTexture(0, 0, 0, .5)
  84.         -- Register it with oUF
  85.         self.DruidMana = DruidMana
  86.         self.DruidMana.bg = Background
  87.        
  88.         -----------------------------
  89.         -- Totems
  90.         local Totems = {}
  91.         for index = 1, MAX_TOTEMS do
  92.             -- Position and size of the totem indicator
  93.             local Totem = CreateFrame('Button', nil, self)
  94.             Totem:SetSize(40, 40)
  95.             Totem:SetPoint('TOPLEFT', Power, 'BOTTOMLEFT', index * Totem:GetWidth(), 0)
  96.             local Icon = Totem:CreateTexture(nil, "OVERLAY")
  97.             Icon:SetAllPoints()
  98.             local Cooldown = CreateFrame("Cooldown", nil, Totem)
  99.             Cooldown:SetAllPoints()
  100.        
  101.             Totem.Icon = Icon
  102.             Totem.Cooldown = Cooldown
  103.             Totems[index] = Totem
  104.         end
  105.    
  106.         -- Register with oUF
  107.         self.Totems = Totems
  108.        
  109.         -----------------------------
  110.         -- Castbar
  111.         -- Position and size
  112.         local Castbar = CreateFrame("StatusBar", nil, self)
  113.         Castbar:SetSize(200, 20)
  114.         Castbar:SetStatusBarTexture(cfg.statusbar_texture)
  115.         Castbar:SetPoint('CENTER',UIParent,0,-140)
  116.         Castbar:CreateBorder(12,1,1,1)
  117.         Castbar:SetBorderPadding(1)
  118.    
  119.         -- Add a background
  120.         local Background = Castbar:CreateTexture(nil, 'BACKGROUND')
  121.         Background:SetTexture(TEXTURE)
  122.         Background:SetAllPoints(Castbar)
  123.         Background:SetTexture(0, 0, 0, .5)
  124.    
  125.         -- Add a spark
  126.         local Spark = Castbar:CreateTexture(nil, "OVERLAY")
  127.         Spark:SetSize(20, 10)
  128.         Spark:SetBlendMode("ADD")
  129.    
  130.         -- Add a timer
  131.         local Time = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  132.         Time:SetPoint("RIGHT", Castbar, -3, 1)
  133.    
  134.         -- Add spell text
  135.         local Text = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  136.         Text:SetPoint("LEFT", Castbar, 3, 1)
  137.    
  138.         -- Add Shield
  139.         local Shield = Castbar:CreateTexture(nil, "OVERLAY")
  140.         Shield:SetSize(20, 10)
  141.         Shield:SetPoint("CENTER", Castbar)
  142.    
  143.         -- Add safezone
  144.         local SafeZone = Castbar:CreateTexture(nil, "OVERLAY")
  145.    
  146.         -- Register it with oUF
  147.         self.Castbar = Castbar
  148.         self.Castbar.bg = Background
  149.         self.Castbar.Spark = Spark
  150.         self.Castbar.Time = Time
  151.         self.Castbar.Text = Text
  152.         self.Castbar.SafeZone = SafeZone
  153.        
  154.     end,
  155.     target = function(self)
  156.         -- target specific stuff
  157.         self:SetSize(cfg.width,cfg.height)
  158.        
  159.         -- 3D Portrait
  160.         -- Position and size
  161.         local Portrait = CreateFrame('PlayerModel', nil, self)
  162.         Portrait:SetSize(cfg.height, cfg.height)
  163.         Portrait:SetPoint('LEFT', self, 'RIGHT', 2,0)
  164.         CreateBackdrop(Portrait)
  165.         -- Register it with oUF
  166.         self.Portrait = Portrait
  167.    
  168.         -----------------------------
  169.         -- Castbar
  170.         -- Position and size
  171.         local Castbar = CreateFrame("StatusBar", nil, self)
  172.         Castbar:SetSize(200, 20)
  173.         Castbar:SetStatusBarTexture(cfg.statusbar_texture)
  174.         Castbar:SetPoint('CENTER',UIParent,0,-115)
  175.         Castbar:CreateBorder(12,1,1,1)
  176.         Castbar:SetBorderPadding(1)
  177.    
  178.         -- Add a background
  179.         local Background = Castbar:CreateTexture(nil, 'BACKGROUND')
  180.         Background:SetTexture(cfg.statusbar_texture)
  181.         Background:SetAllPoints(Castbar)
  182.         Background:SetTexture(0, 0, 0, .5)
  183.    
  184.         -- Add a spark
  185.         local Spark = Castbar:CreateTexture(nil, "OVERLAY")
  186.         Spark:SetSize(20, 10)
  187.         Spark:SetBlendMode("ADD")
  188.    
  189.         -- Add a timer
  190.         local Time = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  191.         Time:SetPoint("RIGHT", Castbar, -3, 1)
  192.    
  193.         -- Add spell text
  194.         local Text = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  195.         Text:SetPoint("LEFT", Castbar, 3, 1)
  196.    
  197.         -- Add Shield
  198.         local Shield = Castbar:CreateTexture(nil, "OVERLAY")
  199.         Shield:SetSize(20, 10)
  200.         Shield:SetPoint("CENTER", Castbar)
  201.    
  202.         -- Add safezone
  203.         local SafeZone = Castbar:CreateTexture(nil, "OVERLAY")
  204.    
  205.         -- Register it with oUF
  206.         self.Castbar = Castbar
  207.         self.Castbar.bg = Background
  208.         self.Castbar.Spark = Spark
  209.         self.Castbar.Time = Time
  210.         self.Castbar.Text = Text
  211.         self.Castbar.SafeZone = SafeZone
  212.     end,
  213.     focus = function(self)
  214.         -- target specific stuff
  215.         self:SetSize(cfg.width,cfg.height)
  216.        
  217.         -- 3D Portrait
  218.         -- Position and size
  219.         local Portrait = CreateFrame('PlayerModel', nil, self)
  220.         Portrait:SetSize(cfg.height, cfg.height)
  221.         Portrait:SetPoint('RIGHT', self, 'LEFT', -2,0)
  222.         CreateBackdrop(Portrait)
  223.         -- Register it with oUF
  224.         self.Portrait = Portrait
  225.    
  226.         -----------------------------
  227.         -- Castbar
  228.         -- Position and size
  229.         local Castbar = CreateFrame("StatusBar", nil, self)
  230.         Castbar:SetSize(200, 20)
  231.         Castbar:SetStatusBarTexture(cfg.statusbar_texture)
  232.         Castbar:SetPoint('CENTER',UIParent,0,-165)
  233.         Castbar:CreateBorder(12,1,1,1)
  234.         Castbar:SetBorderPadding(1)
  235.    
  236.         -- Add a background
  237.         local Background = Castbar:CreateTexture(nil, 'BACKGROUND')
  238.         Background:SetTexture(cfg.statusbar_texture)
  239.         Background:SetAllPoints(Castbar)
  240.         Background:SetTexture(0, 0, 0, .5)
  241.    
  242.         -- Add a spark
  243.         local Spark = Castbar:CreateTexture(nil, "OVERLAY")
  244.         Spark:SetSize(20, 10)
  245.         Spark:SetBlendMode("ADD")
  246.    
  247.         -- Add a timer
  248.         local Time = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  249.         Time:SetPoint("RIGHT", Castbar, -3, 1)
  250.    
  251.         -- Add spell text
  252.         local Text = Castbar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
  253.         Text:SetPoint("LEFT", Castbar, 3, 1)
  254.    
  255.         -- Add Shield
  256.         local Shield = Castbar:CreateTexture(nil, "OVERLAY")
  257.         Shield:SetSize(20, 10)
  258.         Shield:SetPoint("CENTER", Castbar)
  259.    
  260.         -- Add safezone
  261.         local SafeZone = Castbar:CreateTexture(nil, "OVERLAY")
  262.    
  263.         -- Register it with oUF
  264.         self.Castbar = Castbar
  265.         self.Castbar.bg = Background
  266.         self.Castbar.Spark = Spark
  267.         self.Castbar.Time = Time
  268.         self.Castbar.Text = Text
  269.         self.Castbar.SafeZone = SafeZone
  270.     end,
  271.     boss = function(self)
  272.         -- boss frames
  273.     end,
  274.     arena = function(self)
  275.         -- arena frames
  276.     end,
  277.     party = function(self)
  278.         --party stuff
  279.     end
  280. }
  281. UnitSpecific.raid = UnitSpecific.party  -- raid is equal to party
  282.  
  283. ------------------------------------------------------------------------
  284. -- Shared settings
  285. ------------------------------------------------------------------------
  286. local function Shared(self, unit)
  287.     self:SetScript("OnEnter", UnitFrame_OnEnter)
  288.     self:SetScript("OnLeave", UnitFrame_OnLeave)
  289.  
  290.     self:RegisterForClicks"AnyUp"
  291.  
  292.     -- shared functions
  293.     -----------------------------
  294.     -- Health  
  295.     -- Your Health Statusbar
  296.     local Health = CreateFrame("StatusBar", nil, self)
  297.     Health:SetHeight(cfg.height/2)
  298.     Health:SetStatusBarTexture(cfg.statusbar_texture)
  299.     Health:SetPoint('TOP')
  300.     Health:SetPoint('LEFT')
  301.     Health:SetPoint('RIGHT')
  302.     Health:CreateBorder(12,1,1,1)
  303.     Health:SetBorderPadding(1)
  304.     CreateBackdrop(Health)
  305.     -- Options
  306.     Health.frequentUpdates = true
  307.     Health.colorTapping = true
  308.     Health.colorDisconnected = true
  309.     Health.colorClass = true
  310.     Health.colorReaction = true
  311.     Health.colorHealth = true
  312.     -- Register it with oUF
  313.     self.Health = Health
  314.     self.Health.bg = Healthbg
  315.     --Text
  316.     --Percent
  317.     local HealthText = Health:CreateFontString(nil, "OVERLAY", "TextStatusBarText") -- parent to last child to make sure it's on top
  318.     HealthText:SetPoint("RIGHT", Health, -5,0) -- but anchor to the base element so it doesn't wiggle
  319.     self:Tag(HealthText, "[perhp]") -- oUF will automagically update it!
  320.     Health.text = HealthText
  321.     --Value
  322.     local HealthText2 = Health:CreateFontString(nil, "OVERLAY", "TextStatusBarText") -- parent to last child to make sure it's on top
  323.     HealthText2:SetPoint("LEFT", Health, 5,0) -- but anchor to the base element so it doesn't wiggle
  324.     self:Tag(HealthText2, "[curhp]") -- oUF will automagically update it!
  325.     Health.text = HealthText2
  326.  
  327.     -----------------------------
  328.     -- Power
  329.     -- Your Power Statusbar
  330.     local Power = CreateFrame("StatusBar", nil, Health)
  331.     Power:SetHeight(cfg.height/2-11)
  332.     Power:SetStatusBarTexture(cfg.statusbar_texture)
  333.     Power:SetPoint('TOP',Health,'BOTTOM',0,-2)
  334.     Power:SetPoint('LEFT')
  335.     Power:SetPoint('RIGHT')
  336.     Power:CreateBorder(12,1,1,1)
  337.     Power:SetBorderPadding(1)
  338.     CreateBackdrop(Power)
  339.     -- Options
  340.     Power.frequentUpdates = true
  341.     Power.colorPower = true -- powertype colored bar
  342.     Power.colorClassNPC = false -- color power based on NPC
  343.     Power.colorClassPet = false -- color power based on pet type
  344.     -- Register it with oUF
  345.     self.Power = Power
  346.     self.Power.bg = Powerbg
  347.     --Text
  348.     --Percent
  349.     local PowerText = Power:CreateFontString(nil, "OVERLAY", "TextStatusBarText") -- parent to last child to make sure it's on top
  350.     PowerText:SetPoint("RIGHT", Power, -5,0) -- but anchor to the base element so it doesn't wiggle
  351.     self:Tag(PowerText, "[perpp]") -- oUF will automagically update it!
  352.     Power.text = PowerText
  353.     --Value
  354.     local PowerText2 = Power:CreateFontString(nil, "OVERLAY", "TextStatusBarText") -- parent to last child to make sure it's on top
  355.     PowerText2:SetPoint("LEFT", Power, 5,0) -- but anchor to the base element so it doesn't wiggle
  356.     self:Tag(PowerText2, "[curpp]") -- oUF will automagically update it!
  357.     Power.text = PowerText2
  358.    
  359.     -----------------------------
  360.     -- Buffs
  361.     local Buffs = CreateFrame("Frame", nil, self)
  362.     Buffs:SetPoint("BOTTOM", self, "TOPLEFT", -cfg.height,0)
  363.     Buffs:SetPoint'LEFT'
  364.     Buffs:SetPoint'RIGHT'
  365.     Buffs:SetHeight(17)
  366.  
  367.     Buffs.size = 17
  368.  
  369.     self.Buffs = Buffs
  370.  
  371.     -----------------------------
  372.     -- Debuffs
  373.     local Debuffs = CreateFrame("Frame", nil, self)
  374.     Debuffs:SetPoint("TOP", self, "BOTTOMLEFT", -cfg.height,-30)
  375.     Debuffs:SetPoint'LEFT'
  376.     Debuffs:SetPoint'RIGHT'
  377.     Debuffs:SetHeight(20)
  378.  
  379.     Debuffs.initialAnchor = "TOPLEFT"
  380.     Debuffs.size = 20
  381.     Debuffs.showDebuffType = true
  382.  
  383.     self.Debuffs = Debuffs
  384.    
  385.     -----------------------------
  386.     -- Rez Icon
  387.     -- Position and size
  388.     local ResurrectIcon = self:CreateTexture(nil, 'OVERLAY')
  389.     ResurrectIcon:SetSize(16, 16)
  390.     ResurrectIcon:SetPoint('TOPRIGHT', self)
  391.    
  392.     -- Register it with oUF
  393.     self.ResurrectIcon = ResurrectIcon
  394.    
  395.     -----------------------------
  396.     -- Raid icons
  397.     -- Position and size
  398.     local RaidIcon = self:CreateTexture(nil, 'OVERLAY')
  399.     RaidIcon:SetSize(16, 16)
  400.     RaidIcon:SetPoint('TOPRIGHT', self)
  401.    
  402.     -- Register it with oUF
  403.     self.RaidIcon = RaidIcon
  404.    
  405.     -----------------------------
  406.     -- Raid Roles
  407.     -- Position and size
  408.     local RaidRole = self:CreateTexture(nil, 'OVERLAY')
  409.     RaidRole:SetSize(16, 16)
  410.     RaidRole:SetPoint('TOPLEFT')
  411.    
  412.     -- Register it with oUF
  413.     self.RaidRole = RaidRole
  414.    
  415.     -----------------------------
  416.     -- LFD Role
  417.     -- Position and size
  418.     local LFDRole = self:CreateTexture(nil, "OVERLAY")
  419.     LFDRole:SetSize(16, 16)
  420.     LFDRole:SetPoint("LEFT", self)
  421.    
  422.     -- Register it with oUF
  423.     self.LFDRole = LFDRole
  424.    
  425.     -----------------------------
  426.     -- Quest Icon
  427.     -- Position and size
  428.     local QuestIcon = self:CreateTexture(nil, 'OVERLAY')
  429.     QuestIcon:SetSize(16, 16)
  430.     QuestIcon:SetPoint('TOPRIGHT', self)
  431.    
  432.     -- Register it with oUF
  433.     self.QuestIcon = QuestIcon
  434.    
  435.     -----------------------------
  436.     -- Leader Icon
  437.     -- Position and size
  438.     local Leader = self:CreateTexture(nil, "OVERLAY")
  439.     Leader:SetSize(16, 16)
  440.     Leader:SetPoint("BOTTOM", self, "TOP")
  441.    
  442.     -- Register it with oUF
  443.     self.Leader = Leadera
  444.    
  445.     -----------------------------
  446.     -- Master looter
  447.     -- Position and size
  448.     local MasterLooter = self:CreateTexture(nil, 'OVERLAY')
  449.     MasterLooter:SetSize(16, 16)
  450.     MasterLooter:SetPoint('TOPRIGHT', self)
  451.    
  452.     -- Register it with oUF
  453.     self.MasterLooter = MasterLooter
  454.    
  455.     -----------------------------
  456.     -- Class Icons
  457.     local ClassIcons = {}
  458.     for index = 1, 5 do
  459.         local Icon = self:CreateTexture(nil, 'BACKGROUND')
  460.    
  461.         -- Position and size.
  462.         Icon:SetSize(16, 16)
  463.         Icon:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', index * Icon:GetWidth(), 0)
  464.    
  465.         ClassIcons[index] = Icon
  466.     end
  467.    
  468.     -----------------------------
  469.     -- Combat
  470.     -- Position and size
  471.     local Combat = self:CreateTexture(nil, "OVERLAY")
  472.     Combat:SetSize(16, 16)
  473.     Combat:SetPoint('TOP', self)
  474.    
  475.     -- Register it with oUF
  476.     self.Combat = Combat
  477.    
  478.     -- leave this in!!
  479.     if(UnitSpecific[unit]) then
  480.         return UnitSpecific[unit](self)
  481.     end
  482. end
  483.  
  484. oUF:RegisterStyle('Bob', Shared)
  485. oUF:Factory(function(self)
  486.     self:SetActiveStyle('Bob')
  487.     self:Spawn('player'):SetPoint(unpack(cfg.player_position))
  488.     self:Spawn('target'):SetPoint(unpack(cfg.target_position))
  489.     self:Spawn('focus'):SetPoint(unpack(cfg.focus_position))
  490. end)
__________________
Tweets YouTube Website
  Reply With Quote