View Single Post
07-11-10, 01:32 PM   #42
Monolit
A Black Drake
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 81
Originally Posted by Sojik View Post
Please do. I'm curious.
so I finally managed to spawn and style them:
arena and arenatarget frames:

party pet frames:


alright, so thats how I spawn them:
lua Code:
  1. local function genStyle(self)
  2.     lib.init(self)
  3.     lib.moveme(self)
  4.     lib.gen_hpbar(self)
  5.     lib.gen_hpstrings(self)
  6.     lib.gen_ppbar(self)
  7.     lib.gen_highlight(self)
  8.   end
  9.   if cfg.showpartypet and oUF_Party:IsVisible() then
  10.     oUF:RegisterStyle("oUF_mono_PartyPet", CreatePartyPetStyle)
  11.     oUF:SetActiveStyle("oUF_mono_PartyPet")
  12.     local partypet = {}
  13.     for i = 1, 4 do
  14.         partypet[i] = oUF:Spawn('partypet'..i, 'oUF_PartyPet'..i)
  15.         if i == 1 then
  16.             partypet[i]:SetPoint('TOPLEFT', oUF_Party, 'TOPRIGHT', -7, 0)
  17.         else
  18.             partypet[i]:SetPoint('TOP', partypet[i-1], 'BOTTOM', 0, -27)
  19.         end
  20.     end
  21.   end
  22.  
  23.   local gap = 56
  24.   if cfg.showarena then
  25.     SetCVar("showArenaEnemyFrames", false)
  26.     oUF:RegisterStyle("oUF_mono_Arena", CreateArenaStyle)
  27.     oUF:SetActiveStyle("oUF_mono_Arena")
  28.     local arena = {}
  29.     local arenatarget = {}
  30.     for i = 1, 5 do
  31.         arena[i] = oUF:Spawn("arena"..i, "oUF_Arena"..i)
  32.         if i == 1 then
  33.             arena[i]:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -117, 372)
  34.         else
  35.             arena[i]:SetPoint("BOTTOMRIGHT", arena[i-1], "BOTTOMRIGHT", 0, gap)
  36.         end
  37.     end
  38.     oUF:RegisterStyle("oUF_mono_ArenaTarget", CreateArenaTargetStyle)
  39.     oUF:SetActiveStyle("oUF_mono_ArenaTarget")
  40.     for i = 1, 5 do
  41.         arenatarget[i] = oUF:Spawn("arena"..i.."target", "oUF_Arena"..i.."target"):SetPoint("TOPRIGHT",arena[i], "TOPLEFT", -4, 0)
  42.     end
  43.   end

I use specific style functions:
lua Code:
  1. --party pets
  2.   local function CreatePartyPetStyle(self)
  3.     self.width = 35
  4.     self.height = 35
  5.     self.scale = 0.9
  6.     self.mystyle = "partypet"
  7.     genStyle(self)
  8.     self.Range = {
  9.             insideAlpha = 1,
  10.             outsideAlpha = 0.6}
  11.     self.Health.frequentUpdates = true
  12.     self.Health.colorDisconnected = true
  13.     self.Health.colorHappiness = true
  14.     self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
  15.     self.Health.colorSmooth = true
  16.     self.Health.bg.multiplier = 0.1
  17.   end  
  18.  
  19.   --arena frames
  20.   local function CreateArenaStyle(self)
  21.     self.width = 196
  22.     self.height = 22
  23.     self.scale = 0.9
  24.     self.mystyle = "arena"
  25.     genStyle(self)
  26.     self.Health.Smooth = true
  27.     self.Health.frequentUpdates = true
  28.     self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
  29.     self.Health.colorSmooth = true
  30.     self.Health.bg.multiplier = 0.1
  31.     self.Power.frequentUpdates = true
  32.     self.Power.colorPower = true
  33.     self.Power.bg.multiplier = 0.3
  34.     lib.createBuffs(self)
  35.     lib.gen_ppstrings(self)
  36.     lib.gen_castbar(self)
  37.   end
  38.   --mini arena targets
  39.   local function CreateArenaTargetStyle(self)
  40.     self.width = 35
  41.     self.height = 35
  42.     self.scale = 0.9
  43.     self.mystyle = "arenatarget"
  44.     genStyle(self)
  45.     self.Health.frequentUpdates = true
  46.     self.Health.colorDisconnected = true
  47.     self.Health.colorHappiness = true
  48.     self.colors.smooth = {1,0,0, .7,.41,.44, .3,.3,.3}
  49.     self.Health.colorSmooth = true
  50.     self.Health.bg.multiplier = 0.1
  51.   end

example of how I address to those frames from functions lib:
lua Code:
  1. lib.gen_hpstrings = function(f, unit)
  2.     local h = CreateFrame("Frame", nil, f)
  3.     h:SetAllPoints(f.Health)
  4.     h:SetFrameLevel(10)
  5.     local valsize
  6.     if f.mystyle == "arenatarget" or f.mystyle == "partypet" then valsize = 11 else valsize = 13 end
  7.     local name = lib.gen_fontstring(h, cfg.font, 13, "THINOUTLINE")
  8.     local hpval = lib.gen_fontstring(h, cfg.font, valsize, "THINOUTLINE")
  9.  
  10.     if f.mystyle == "target" or f.mystyle == "tot" then
  11.         name:SetPoint("RIGHT", f.Health, "RIGHT",-3,0)
  12.         hpval:SetPoint("LEFT", f.Health, "LEFT",3,0)
  13.         name:SetJustifyH("RIGHT")
  14.         name:SetPoint("LEFT", hpval, "RIGHT", 5, 0)
  15.     elseif f.mystyle == "arenatarget" or f.mystyle == "partypet" then
  16.         name:SetPoint("CENTER", f.Health, "CENTER",0,6)
  17.         name:SetJustifyH("LEFT")
  18.         hpval:SetPoint("CENTER", f.Health, "CENTER",0,-6)
  19.     else
  20.         name:SetPoint("LEFT", f.Health, "LEFT",3,0)
  21.         hpval:SetPoint("RIGHT", f.Health, "RIGHT",-3,0)
  22.         name:SetJustifyH("LEFT")
  23.         name:SetPoint("RIGHT", hpval, "LEFT", -5, 0)
  24.     end
  25.     if f.mystyle == "arenatarget" or f.mystyle == "partypet" then
  26.       f:Tag(name, '[mono:color][mono:shortname]')
  27.       f:Tag(hpval, '[mono:hpraid]')
  28.     else
  29.       f:Tag(name, '[mono:color][mono:longname]')
  30.       f:Tag(hpval, '[mono:hp]')
  31.     end
  32.   end

Sorry for the long post, but I didn't manage to find [spoiler] BBtag on those boards. Please point me out if there is one :/
Anyway my layout is available to download as part of my UI pack if you want to check it out.



Originally Posted by Sojik View Post
Code:
custom [group:party,nogroup:raid][@raid6,noexists,group:raid] show;hide
for party and raid10 for the raid frames.
I'm curious how to implement this without editing oUF core. I mean is it possible to apply those conditions straight to the layout without using that party-toggle hack-ish script?
  Reply With Quote