Thread Tools Display Modes
12-24-13, 01:03 AM   #21
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by 10leej View Post
Awesome saves me the trouble of finding an arena partner and a raid group, lmao
It may not work for raid frames if you're using group headers.

Originally Posted by 10leej View Post
Looks like eclipse bar is still a little bugged, shows on the focus and target frame using the script Phanx provided.
Check your code... you're adding the eclipse bar for all units, instead of only for the player unit.
__________________
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
12-24-13, 01:17 AM   #22
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Check your code... you're adding the eclipse bar for all units, instead of only for the player unit.
__________________
Tweets YouTube Website
  Reply With Quote
12-24-13, 01:43 AM   #23
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I like how I've infected everyone with meme-based communication today.
__________________
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
12-24-13, 01:50 AM   #24
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Phanx View Post
I like how I've infected everyone with meme-based communication today.
It was gonna come from me one way or another.

Anyways any idea on how to flip the target frame around? Or do I just have to make that one special?
__________________
Tweets YouTube Website

Last edited by 10leej : 12-24-13 at 01:52 AM.
  Reply With Quote
12-24-13, 02:07 AM   #25
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
There's no magic "flip this thing around" function. You just have to anchor everything to the opposite side for that frame.

You don't seem to have updated your SVN code (you're still creating the eclipse bar, druid mana bars, totem bars, and rune bars for all units) but in general you can simplify the "flipping" process like this:

Code:
local reverseUnits = {
	target = true,
	targettarget = true,
}

local function Shared(self, unit, isSingle)
	unit = gsub(unit, "%d+", "")

	local LEFT = reverseUnits[unit] and "RIGHT" or "LEFT"
	local RIGHT = reverseUnits[unit] and "LEFT" or "RIGHT"

	-- bla bla bla

	HealthText:SetPoint(RIGHT, Health, -5, 0)

	HealthText2:SetPoint(LEFT, Health, 5, 0)

	Debuffs:SetPoint("TOP", self, "BOTTOM"..LEFT, -height, 0)
Stuff in green is not directly related, but you will want to add it, otherwise your party/raid styles won't work, since "unit" will be something like "party3" which doesn't match the "party" key in your UnitSpecific table.

On a side note, I've never really understood the appeal of splitting things out into a shared function + unit specific functions. Other than player-specific elements like totem bars etc. almost everything is going to have some commonality between units, so you're either duplicating code for no reason (by having nearly identical code in each unit function that differs only in, say, how it anchors the buffs to the frame) or you're splitting code up for no reason (for example, having some of the buff code in the shared function, and some in the unit functions). "if" checks are not the end of the world!
__________________
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 : 12-31-13 at 12:47 AM.
  Reply With Quote
12-24-13, 03:54 PM   #26
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
Originally Posted by Phanx View Post
I like how I've infected everyone with meme-based communication today.
  Reply With Quote
12-24-13, 03:59 PM   #27
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
Originally Posted by Phanx View Post
Other than player-specific elements like totem bars etc. almost everything is going to have some commonality between units, so you're either duplicating code for no reason (by having nearly identical code in each unit function that differs only in, say, how it anchors the buffs to the frame) or you're splitting code up for no reason (for example, having some of the buff code in the shared function, and some in the unit functions). "if" checks are not the end of the world!
That's where I constantly fall into conflict... Do I put this into "Shared" or "UnitSpecific".
  Reply With Quote
12-24-13, 10:35 PM   #28
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Neither. The entire concept of "shared" vs "unit specific"is not even found in oUF. it's just some random idea Haste came up with and used in his layout. Just use a single spawn function, and wrap conditional things in "if" statements.
__________________
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
12-25-13, 12:12 AM   #29
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
Originally Posted by Phanx View Post
Neither. The entire concept of "shared" vs "unit specific"is not even found in oUF. it's just some random idea Haste came up with and used in his layout. Just use a single spawn function, and wrap conditional things in "if" statements.
You're kidding right??? This was -- random? ...


Last edited by MoonWitch : 12-25-13 at 12:14 AM.
  Reply With Quote
12-25-13, 05:30 AM   #30
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
__________________
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
12-25-13, 01:10 PM   #31
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Well it is a good idea imho. I might just break it all up and just run unit specific stuff for a bit more flexibility in the config options.
__________________
Tweets YouTube Website
  Reply With Quote
12-25-13, 09:25 PM   #32
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
My point was simply that the concept is not a required part of writing an oUF layout, and did not even come from oUF itself. As long as you understand that it's simply an optional paradigm, feel free to use it if you like it.
__________________
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
12-26-13, 04:10 AM   #33
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Phanx View Post
My point was simply that the concept is not a required part of writing an oUF layout, and did not even come from oUF itself. As long as you understand that it's simply an optional paradigm, feel free to use it if you like it.
Well after fiddling around I probably won't bother with it.
__________________
Tweets YouTube Website
  Reply With Quote
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
12-27-13, 12:53 AM   #35
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
(1) Go install BugSack. Do it right now. Do it for this kitten. You can't say no to this kitten:
http://tinyurl.com/mht7hz6

Edit: ugh, broken forums, that link should go to youtube [slash] watch?v=hUe9HzNK-0w

(2) You have a scoping problem:
Code:
Rune:SetPoint('TOPLEFT', Power, 'BOTTOMLEFT', index * 120 / 6 - 20, 0)
In the context of that line, inside your UnitSpecific.player function, there is no Power variable defined. Either change it to self.Power and change any other element references similarly, or just move all that into your spawn function, and wrap it in a good old-fashioned if unit == "player" then ... end statement.
__________________
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 : 12-27-13 at 03:36 AM.
  Reply With Quote
12-27-13, 01:09 AM   #36
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Phanx View Post
(1) Go install BugSack. Do it right now. Do it for this kitten. You can't say no to this kitten:
http://tinyurl.com/mht7hz6

(2) You have a scoping problem:
Code:
Rune:SetPoint('TOPLEFT', Power, 'BOTTOMLEFT', index * 120 / 6 - 20, 0)
In the context of that line, inside your UnitSpecific.player function, there is no Power variable defined. Either change it to self.Power and change any other element references similarly, or just move all that into your spawn function, and wrap it in a good old-fashioned if unit == "player" then ... end statement.
the scoping problem fixed it actually. I shoulda noticed that >.>

Also already got BugSack

so now that I got runes, eclipse and totems working, guess it's time for chi, holy power, and lock stuff.
__________________
Tweets YouTube Website

Last edited by 10leej : 12-27-13 at 01:19 AM.
  Reply With Quote
12-28-13, 04:05 PM   #37
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Alright got everything but raid frames and unit names (some my code wont work but I don't get any errors) done. Now just gotta look at those. Probably gonna have to setup their own frames but how would sorting work out for them?

core (no name tags in there yet as I removed em gonna take a different shot later)
raid--poor attempt at raid/party frames
lib
config
__________________
Tweets YouTube Website

Last edited by 10leej : 12-28-13 at 09:42 PM.
  Reply With Quote
12-29-13, 05:28 AM   #38
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
At a glance:

(1) In lib.lua, you have a global function named CreateBackdrop. Global bad. Local good. Fix.

(2) Also in lib.lua you have local addonName = select(1, GetAddOnInfo('!Beautycase')) -- What is this, I don't even. You should absolutely never use select to select the first argument. (I would argue that you should pretty much never use select for anything except looping over varargs, but that's another story...)

(3) You don't need that local _ on line 14, either. Not only did you already define a local underscore on line 1, but you should not be leaking variables anywhere to need this declaration at the file level anyway.

(4) You may want to make your frame checks a bit more robust. if (not self:IsObjectType('Frame')) then will work in most cases, but if you start trying to skin things that are using metatables for prototyping, you may end up with errors when you try to CreateTexture on self. A better check would be:
if type(self) ~= "table" or type(rawget(self, 0)) ~= "userdata" then
Also, I don't really like the !Beautycase approach which injects a bunch of functions into the Frame object metatable. There's really no need for it, and it seems likely to conflict with other addons using the same unnecessary technique.

(5) In units.lua you have self.Leader = Leadera -- remove the trailing "a" to get it working.

(6) Your party and raid frames are still not getting their UnitSpecific functions called. See my previous post about this for the solution.

(7) You have an entry in UnitSpecific for "raid" in units.lua, and an entry for "party" in raid.lua. No point in having these entries when those units aren't handled in those files.
__________________
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 : 12-29-13 at 05:30 AM.
  Reply With Quote
12-29-13, 09:19 AM   #39
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
I was eventually going to probably rewrite the CreateBorder function !Beautycase uses the current version works and I haven't found a suitable replacement probably can get away with making my own version nowadays though.
__________________
Tweets YouTube Website
  Reply With Quote
12-29-13, 09:54 AM   #40
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
If you're using !Beautycase in the rest of your UI, just use it in your oUF layout instead of duplicating its functionality.
__________________
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

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Trying my hand at ouf


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