Thread Tools Display Modes
07-11-10, 01:17 AM   #41
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by Dawn View Post
Text
You'll have to put the if checks in the shared function or the unit-specific one.

I don't guess party{pet,target}N units for you as I've yet to find a good solution to it. We also can't do them through headers cleanly as they just are a child of the partyN unit, which makes separate styles annoying.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
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
07-11-10, 02:05 PM   #43
Sojik
A Wyrmkin Dreamwalker
 
Sojik's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 53
No you don't have to edit oUF. It supports custom show conditionals à la macros.

For example the header spawn would work something like this:
Code:
    party = self:SpawnHeader('oUF_Party',nil,'custom [group:party,nogroup:raid][@raid6,noexists,group:raid] show;hide',
        'showParty',true,
        'point','TOP',
        'xOffset',0,
        'yOffset',-4)
and
Code:
for i = 1,5 do
        local raid = self:SpawnHeader('oUF_Raid'..i,nil,'raid10',
            'groupFilter',tostring(i),
            'showRaid',true,
            'point','RIGHT',
            'xoffset',-4,
            'yOffset',0)
end
  Reply With Quote
07-11-10, 04:05 PM   #44
Monolit
A Black Drake
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 81
Originally Posted by Sojik View Post
No you don't have to edit oUF. It supports custom show conditionals à la macros.
...
Worked like a charm, thank you.
  Reply With Quote
07-12-10, 12:13 PM   #45
Goldpaw
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 56
Originally Posted by p3lim View Post
Code:
self.Range = {
    insideAlpha = 1,
    outsideAlpha = 0.3,
}
For some reason, all units except for the player is treated as out of range when using this. I can't find any reason for this behavior.

I'm using this exact code.

Last edited by Goldpaw : 07-12-10 at 01:49 PM.
  Reply With Quote
07-12-10, 08:15 PM   #46
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
The default range element only work for party and raid units.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
07-13-10, 12:41 AM   #47
Goldpaw
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 56
Originally Posted by haste View Post
The default range element only work for party and raid units.
Ah, I see. That explains it!
  Reply With Quote
07-13-10, 09:00 PM   #48
Cynyr
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 9
Runebar

Having taken a look at both lily and classic and p3lim, I cannot figure out how to get a rune bar working for my DK alt. If i use Lily I get bliz's runebar up in the upperleft. I'd really like something like p3lim's in oUF 1.3. The github wiki is still missing a page on runebars, and they don't work like combo points, despite the element files looking similar.

the bits out of runebar.lua seem to suggest it should be both an array and a frame at the same time...
Code:
local runes = self.Runes
	if(runes and unit == 'player') then
		for i=1, 6 do
			local rune = runes[i]
			rune:SetID(i)
			-- From my minor testing this is a okey solution. A full login always remove
			-- the death runes, or at least the clients knowledge about them.
			UpdateType(self, nil, i, math.floor((i+1)/2))

			if(not rune:GetStatusBarTexture()) then
				rune:SetStatusBarTexture[[Interface\TargetingFrame\UI-StatusBar]]
			end
		end

		self:RegisterEvent("RUNE_POWER_UPDATE", UpdateRune)
		self:RegisterEvent("RUNE_TYPE_UPDATE", UpdateType)

		runes:Show()
		RuneFrame:Hide()
how does "local rune = runes[i]" and "runes:Show()" both work at the same time? Any help would be appreciated.
  Reply With Quote
07-13-10, 11:23 PM   #49
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
Here's my RuneBar-function, hope it can help you:

Code:
 --[[ Creates a RuneFrame
FRAME CreateRuneFrame(FRAME self)
]]
core.CreateRuneFrame = function(self)
local i
local rf = CreateFrame('Frame', nil, self)

for i = 1, 6 do
rf[i] = CreateFrame('StatusBar', nil, rf)
rf[i]:SetHeight(10)
rf[i]:SetWidth(33)
rf[i]:SetStatusBarTexture(settings.src.textures.bartexture, 'BORDER')
rf[i]:SetBackdrop(settings.src.backdrop)
rf[i]:SetBackdropColor(0, 0, 0, 1)
rf[i]:SetBackdropBorderColor(0, 0, 0, 0)
rf[i].bg = rf[i]:CreateTexture(nil, 'BACKGROUND')
rf[i].bg:SetAllPoints(rf[i])
rf[i].bg:SetTexture(settings.src.textures.bartexture)
rf[i].bg:SetVertexColor(0.3, 0.3, 0.3, 0.5)
lib.CreateBorder(rf[i], 10)
for _, tex in ipairs(rf[i].borderTextures) do
tex:SetParent(rf[i])
end
if (i == 1) then
rf[i]:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 10)
else
rf[i]:SetPoint('LEFT', rf[i-1], 'RIGHT', 5, 0)
end
end

return rf
end
  Reply With Quote
07-14-10, 08:06 AM   #50
Cynyr
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 9
Originally Posted by Mischback View Post
Here's my RuneBar-function, hope it can help you:
Thanks, I got it showing up. Now i just need to finish updating for 1.4 I'll post a more concise howto once I get things working well. :SetPoint() isn't working like it should yet.
  Reply With Quote
07-14-10, 01:18 PM   #51
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Outside of addons like BarFader is there a way to hide the Runebar in oUF when all runes are out of Cooldown and you are out of combat? I guess not since there is no postUpdate to the Runes, but just checking.
  Reply With Quote
07-14-10, 03:06 PM   #52
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
You could try to anchor the runes to a frame anchored to UIParent and than hide/show this frame.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
07-14-10, 05:12 PM   #53
Cynyr
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 9
Rune Frames

I finally got my rune frames working, thanks Mischback for the jumping off point.

Code:
local i
local runes = CreateFrame('Frame', nil, self)
for i = 1, 6 do
    runes[i] = CreateFrame('StatusBar', nil, runes)
    runes[i]:SetHeight(5)
    runes[i]:SetWidth((cfg.width-5)/6)
    runes[i]:SetStatusBarTexture(cfg.texture, 'BORDER')
    runes[i]:SetBackdrop(cfg.backdrop)
    runes[i]:SetBackdropColor(0, 0, 0, 1)
    runes[i]:SetBackdropBorderColor(0, 0, 0, 0)
    runes[i].bg = runes[i]:CreateTexture(nil, 'BACKGROUND')
    runes[i].bg:SetAllPoints(runes[i])
    runes[i].bg:SetTexture(cfg.texture)
    runes[i].bg:SetVertexColor(0.3, 0.3, 0.3, 0.5)
    if (i == 1) then
        runes[i]:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, 5)
        --runes[i]:SetPoint('BOTTOMLEFT', runes, 'BOTTOMLEFT', 0,0)
        --The above does not work for some reason. 
    else
        runes[i]:SetPoint('LEFT', runes[i-1], 'RIGHT', 1, 0)
    end
end
self.Runes = runes
documentation for things in other files.
Code:
cfg.width = 155
cfg.texture = [=[Interface\ChatFrame\ChatFrameBackground]=]
cfg.backdrop = {
	bgFile = TEXTURE, insets = {top = -1, bottom = -1, left = -1, right = -1}
}
The odd bit for me was that I couldn't SetPoint() the runes[i] to runes, but had to do it to self. I'm also getting a space for runeframes in all of my units, not just player when a DK. http://github.com/cynyr/oUF_Cynyr/tree/oUF1.4 for current full source. It's basicly lily, with narrower frames, no buffs/debuffs, and a rune bar for DKs. Master is a 1.3 p3lim modification.
  Reply With Quote
07-14-10, 06:59 PM   #54
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Originally Posted by Dawn View Post
You could try to anchor the runes to a frame anchored to UIParent and than hide/show this frame.
Nice idea. Might try that. :]
  Reply With Quote
07-15-10, 01:33 AM   #55
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
Originally Posted by Cynyr View Post
The odd bit for me was that I couldn't SetPoint() the runes[i] to runes, but had to do it to self.
Yeah, you can't SetPosition() anything to something, which is not positioned itsself (runes has no SetPoint() in your snippet).

Originally Posted by Cynyr View Post
I'm also getting a space for runeframes in all of my units, not just player when a DK.
Without looking at your code: Of course you should only build that Rune-frame on those units, you need it.
If you're using one function for all units, surround your rune-block with something like

Code:
local _, pclass = UnitClass('player')
if ((unit == 'player') and (pclass == 'DEATHKNIGHT')) then
-- Rune-code here
end

Last edited by Mischback : 07-15-10 at 01:36 AM.
  Reply With Quote
07-16-10, 02:34 PM   #56
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
ia there a way to change the default reaction colors, in 1.4

I use to define the colors with

Code:
local FACTION_BAR_COLORS = {
	[0] = {r = 1, g = 0.3, b = 0.22}, 
	[1] = {r = 0.8, g = 0.3, b = 0.22}, -- hated, dark red
	[2] = {r = 1, g = 0, b = 0},		-- hostile, bright red
	[3] = {r = 1, g = 0.5, b = 0},		-- unfriendly, orange
	[4] = {r = 0.9, g = 0.7, b = 0},	-- neutral, yellow
	[5] = {r = 0, g = 0.6, b = 0.1},	-- friendly, dark green
	[6] = {r = 0, g = 1, b = 0},		-- honored,	bright green
	[7] = {r = 0.25, g = 0.4, b = 0.9},	-- reverted, blue
	[8] = {r = 0.6, g = 0.2, b = 0.8},	-- exalted, purple
}
I did try to change it to 1.4
Code:
local fcolors = setmetatable({
	fraction = setmetatable({
	[0] = {r = 1, 0.3, 0.22}, 
	[1] = {r = 0.8, 0.3, 0.22},  -- hated, dark red
	[2] = {r = 1,  0, 0},		  -- hostile, bright red
	[3] = {r = 1, 0.5, 0},	  -- unfriendly, orange
	[4] = {r = 0.9, 0.7, 0},	  -- neutral, yellow
	[5] = {r = 0, 0.6, 0.1},	  -- friendly, dark green
	[6] = {r = 0, 1, 0},		  -- honored,	bright green
	[7] = {r = 0.25, 0.4, 0.9},  -- reverted, blue
	[8] = {r = 0.6, 0.2, 0.8},	  -- exalted, purple
	}, {__index = oUF.colors.fraction}),
}, {__index = oUF.fcolors})
the idear behind this is to color the powerbar if

Code:
self.Power.colorReaction = true
  Reply With Quote
07-16-10, 06:24 PM   #57
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
oUF doesn't do reputation coloring of units by default, so you would have to handle that yourself in a post-update.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
07-22-10, 07:08 AM   #58
OmeCorn
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 15
I managed to make my Raid Pets spawn, but there are a few problems with them: When they spawn they spawn like they're "out of range" and I don't know how to edit the size of them, since they're parented to my raidframe they have the same size.

I've tried it with the following code from oUF_Noob, but it gave me a .lua error for "self".

Code:
		if(self:GetAttribute('unitsuffix') == 'pet') then --it's a pet  (need to change these, power bars not showing?)
			self:SetWidth(40)
			self:SetHeight(20)
			self.Health:SetWidth(40)
			self.Health:SetHeight(15)
			self.Health.value:Hide()
			self.Auras:Hide()
			self.Debuffs:Hide()
			self.Health.colorTapping = false
			self.Health.colorClass = false
			self.Health.colorReaction = true
			self.Health.colorDisconnected = false
			self.PostUpdateHealth = updateHealth
			self.PostUpdatePower = updatePower -- let the colors be
			self.Power:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 0, 0)
			self.Power:SetWidth(40)
			self.Power:SetHeight(5)
			self.Power:SetAlpha(0.8)
			self.Power.value:Hide()
			self.Name:Hide()
			self.Level:Hide()
			self.ignoreBanzai = false
			self.ignoreDruidHots = false
Is there another way to resize the raidpet frames and show them like they're in my range?
  Reply With Quote
07-22-10, 07:36 AM   #59
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
Could you please show us
a) how you spawn them
b) the function to style them

It's hard to say anything by only seeing fragments.

Oh, and to range-checking on pets: I got something on my mind, that oUFs default-range-checking is only working for player-controlled units in party/raid, perhaps it's not working for pets. You can deactivate range-checking for the pets, if you find out, how to address the frames.

Last edited by Mischback : 07-22-10 at 07:42 AM.
  Reply With Quote
07-22-10, 08:04 AM   #60
OmeCorn
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 15
Originally Posted by Mischback View Post
Could you please show us
a) how you spawn them
b) the function to style them

It's hard to say anything by only seeing fragments.

Oh, and to range-checking on pets: I got something on my mind, that oUFs default-range-checking is only working for player-controlled units in party/raid, perhaps it's not working for pets. You can deactivate range-checking for the pets, if you find out, how to address the frames.
Spawning:

Code:
    local raid = {}
    for i = 1, oUF_Neav.units.raid.numGroups do
        table.insert(raid, self:SpawnHeader('oUF_Neav_Raid'..i, nil, 'solo,party,raid',
            'showParty', true,
            'showPlayer', true,
            'showSolo', true,
            'showRaid', true,
            'columnSpacing', 7,
            'unitsPerColumn', 1,
            'maxColumns', 5,
            'columnAnchorPoint', 'TOP',
            'groupFilter', i,
            'template', 'oUF_NoobRaid'
            )
        )
Range-checking code:

Code:
        -- range check

	self.Range = {
		insideAlpha = 1,
		outsideAlpha = 0.3,
	}

    self.SpellRange = {
        insideAlpha = 1,
        outsideAlpha = 0.3,
    }

    return self
end
And not sure what the function to style them is, but I think it's the following:

Code:
oUF:RegisterStyle('oUF_Neav_Raid', CreateRaidLayout)
oUF:Factory(function(self)
	self:SetActiveStyle('oUF_Neav_Raid')
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF 1.4 documentation thread

Thread Tools
Display Modes

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