Thread Tools Display Modes
02-04-09, 02:40 PM   #621
Lysiander
An Aku'mai Servant
Join Date: Dec 2007
Posts: 37
Raid Targets and Filtering

Hi there, I am in desperate need of help. As always, my coding skills are limited, so if you have the time, I would be gratefull for simple yet explanatory answers.

I have spend the better part of the day trying to get Raid Targets to work. I started out by trying to use a template as suggested. This worked relatively good with the, IMO, huge problem that once you reload your UI, it doesn't find the table anymore. Took me a while to figure that one out. Restarting the game whenever I make a minor change is not an option for me.

First off, my raid targets are currently spawned like this:
Code:
	local raidtarget = {}
	for i = 1, 40 do	
		raidtarget[i] = oUF:Spawn('raid'..i..'target', 'oUF_Raid'..i..'Target')
		raidtarget[i]:SetPoint('LEFT', raid[i], 'RIGHT', 5, 0)
	end
When I spawn the raid frames like this, I get a distored picture, because for some reason oUF orders the raidmembers in a really weird way.

Code:
	local raid = {}
	for i = 1, 5 do
		local raidgroup = oUF:Spawn("header", "oUF_Raid"..i)
		raidgroup:SetManyAttributes('groupfilter', tostring(i), "showRaid", true, "yOffSet", -5)
		table.insert(raid, raidgroup)
		if(i==1) then
	        raidgroup:SetPoint("BOTTOMLEFT", UIPARENT, "BOTTOMLEFT", 100, 392)
		else
	        raidgroup:SetPoint("BOTTOM", raid[i-1], "TOP", 0, 5)
		end
		raidgroup:Show()
	end
I tried inserting: 'sortMethod', 'index', into it, but that didn't work/help.

So I went on and spawned the raidframes like this. This has the downside that I cannot order the raid by groups and hence the raidframes adjust whenever someone joins or leaves, but I could deal with that if I had to. Its more of a cosmetic downside. On the bright side, it does allow me to properly anchor the raid targets to their parents and get the expected results.

Code:
	local raid = {}
	for i = 1, 40 do
		raid[i] = oUF:Spawn('raid'..i, 'oUF_Raid'..i)
		if i == 1 then
			raid[i]:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 100, 392)
		else
			raid[i]:SetPoint('BOTTOM', raid[i-1], 'TOP', 0, 5)
		end
  	end
Now, since I have both raidframes and raid targets spawned, I want to build a filter that only spawns the approriate target when the parent unit is a MT. This is where I have hit a roadblock. I realize that I probably need a postupdate function tied to changing targets and possibly the MT status (which I have yet to find an event for, is there one) and that I need to filter the targets before they are actually spawned.

What I am wondering currently is:
- Can I even do this. Can oUF spawn and despawn frames in the blink of an eye in the middle of a raid?
- If the above is impossible, how would I go about to hide the frames when necessary? raid..i:Hide() doesnt seem to work.

I did get the whole thing working with tags like this:

Code:
oUF.Tags['[raidtargeticon]'] = function(u) if(not UnitExists(u)) then return '' end local i = GetRaidTargetIndex(u..'target'); return i and ICON_LIST[i]..'22|t' or ' ' end
oUF.Tags['[raidtargetname]'] = 	function(u)
if (not UnitExists(u)) or (not UnitExists(u..'target')) then return "" end
if not (GetPartyAssignment('MAINTANK', u)) and not (GetPartyAssignment('MAINASSIST', u)) then return '' 
elseif (GetPartyAssignment('MAINTANK', u)) and not (GetPartyAssignment('MAINASSIST', u)) then return UnitName(u..'target') and oUF.Tags['[raidtargeticon]'](u..'target') ..oUF.Tags['[perhp]'](u..'target')..' ' ..'|cffff6464' ..string.sub(UnitName(u..'target'),1,15)
elseif (GetPartyAssignment('MAINASSIST', u)) and not (GetPartyAssignment('MAINTANK', u)) then return UnitName(u..'target') and oUF.Tags['[raidtargeticon]'](u..'target') ..oUF.Tags['[perhp]'](u..'target')..' ' ..'|cff64ff64' ..string.sub(UnitName(u..'target'),1,15)
end
end

oUF.TagEvents['[raidtargeticon]'] = 'UNIT_TARGET RAID_TARGET_UPDATE'
oUF.TagEvents['[raidtargetname]'] = 'UNIT_TARGET RAID_TARGET_UPDATE UNIT_NAME_UPDATE UNIT_HEALTH'
However, all atempts to convert this to actual bars have failed so far. Help please?
 
02-04-09, 04:22 PM   #622
Dimpf
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 25
I seem to be having some issues with my raid frame mod. I'm trying to create frames that have a dark transparent overlay that indicates health over a background colored the same as the class color of the player.

The relevant bits that I have are:
Code:
	local hp = CreateFrame('StatusBar', nil, self)
	hp:SetWidth(raidWidth - powerWidth)
	hp:SetOrientation('VERTICAL')
	hp:SetParent(self)
	hp:SetPoint('TOPLEFT', self)
	hp:SetPoint('BOTTOMLEFT', self)
	hp:SetStatusBarTexture(texture)
	hp:SetStatusBarColor(0, 0, 0, .5)

	local hpbg = hp:CreateTexture(nil, "BORDER")
	hpbg:SetAllPoints(hp)
	hpbg:SetTexture(texture)
	hpbg.colorClass = true

	hp.bg = hpbg	
	self.Health = hp
...which doesn't color the frames.
Substitute
Code:
hpbg.colorClass = true
for:
Code:
hpbg:SetVertexColor(0, 0, 0)
and it'll spawn the frames, but it doesn't really do what I want it to (duh).

If I try
Code:
hpbg:SetVertexColor(unpack(colors.class[select(2, UnitClass(unit))]))
it doesn't spawn the frames (which it should, given that it's returning a RGB value, unless my syntax is off).

Any suggestions?
 
02-04-09, 04:28 PM   #623
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
There isn't any color* options on the background.
 
02-04-09, 04:40 PM   #624
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Dimpf View Post
I seem to be having some issues with my raid frame mod. I'm trying to create frames that have a dark transparent overlay that indicates health over a background colored the same as the class color of the player.

The relevant bits that I have are:
Code:
	local hp = CreateFrame('StatusBar', nil, self)
	hp:SetWidth(raidWidth - powerWidth)
	hp:SetOrientation('VERTICAL')
	hp:SetParent(self)
	hp:SetPoint('TOPLEFT', self)
	hp:SetPoint('BOTTOMLEFT', self)
	hp:SetStatusBarTexture(texture)
	hp:SetStatusBarColor(0, 0, 0, .5)

	local hpbg = hp:CreateTexture(nil, "BORDER")
	hpbg:SetAllPoints(hp)
	hpbg:SetTexture(texture)
	hpbg.colorClass = true

	hp.bg = hpbg	
	self.Health = hp
...which doesn't color the frames.
Substitute
Code:
hpbg.colorClass = true
for:
Code:
hpbg:SetVertexColor(0, 0, 0)
and it'll spawn the frames, but it doesn't really do what I want it to (duh).

If I try
Code:
hpbg:SetVertexColor(unpack(colors.class[select(2, UnitClass(unit))]))
it doesn't spawn the frames (which it should, given that it's returning a RGB value, unless my syntax is off).

Any suggestions?
I use this
Code:
local function OverrideUpdateHealth(self, event, unit, bar)
	local localized, english = UnitClass(unit)
	local color = self.colors.class[english]
	if(color) then bar.bg:SetVertexColor(unpack(color)) end
	self:SetAlpha(UnitIsDeadOrGhost(unit) and 0.25 or 1)
end
 
02-04-09, 04:56 PM   #625
Dimpf
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 25
Originally Posted by haste View Post
There isn't any color* options on the background.
Right, which I noticed...and I now have figured out (gogo updateHealth function).

I was unclear on how Freebgrid got the effect that I'm after, using:

Code:
	local hpbg = hp:CreateTexture(nil, "BORDER")
	hpbg:SetAllPoints(hp)
	hpbg:SetTexture(texture)
	hpbg.colorClass = true

	self:SetBackdrop(backdrop)
	self:SetBackdropColor(0, 0, 0, 1)

(code for health text was here)

	hp.bg = hpbg
	self.Health = hp
	self.OverrideUpdateHealth = updateHealth
...though looking over it again, it looks like the color gets set in the updateHealth function, and the colorClass is completely superfluous.



Hurrah borrowing code examples
 
02-05-09, 04:57 AM   #626
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
Hi there,

i have 2 little problems with the partypet frame :
i spawn them right with the xml, i anchor them in the right spot of my screen.
But when i try to move them a little with the anchor AbsDimension they don't seem to move, even if i set huge values for x and y.
My other problem is the dimension of the frame, can i change the frame size inside the xml file ? Because i want them smaller than their parents.

thanks in advance.
 
02-05-09, 11:38 AM   #627
Lysiander
An Aku'mai Servant
Join Date: Dec 2007
Posts: 37
Ok, I have gotten the Raidframes to work by spawning the raid in groups of 5 and anchoring them individually. With this, I get multiple groups, each displaying the targets properly. However, I have yet to manage to figure out how to hide the non MT Targets. I did get it to work for raidframes spawned by raidid (as in spawn raid1, anchor rest to i-1, same for targets) by using this:

Code:
		local MTT = CreateFrame('Frame')
		MTT:RegisterEvent('RAID_ROSTER_UPDATE')
		MTT:RegisterEvent('RAID_TARGET_UPDATE')
		MTT:RegisterEvent('UNIT_TARGET')
		MTT:SetScript('OnEvent', function(self)
			for i = 1,GetNumRaidMembers() do
				if GetPartyAssignment('MAINTANK', 'raid'..i) then
					raidtarget[i]:SetAlpha(1)
				else
					raidtarget[i]:SetAlpha(0)
				end
			end
		end)
I played around with the function, to adjust it to the new setup, but the major problem now is that I can't get ids to work. I have found out, that ingame, the who thing is called:
oUF_RaidxUnitButtony where x is the groupnumber and y the player in the list.

Is there a way to trace back the owner of a frame, as in the unit it was based on? Or maybe someone could point me where I can figure out how this order is build? All I need to achive my goal is to identify the main tanks in the raid and then tell their target frames to hide, but for the life of me, I cannot figure out a way to trace the frame back to the unit.

Edit:
Well, I did get it to work. It feels messy and needs a whole lot of repetitive code, but it's possible and workable. The below is of course only one frame. Imagine everything after the 2nd local repeated for every single possible raidmember. (So depending on the layout up to 40 time.)
Code:
	local MTT = CreateFrame('Frame')
	MTT:RegisterEvent('RAID_ROSTER_UPDATE')
	MTT:RegisterEvent('RAID_TARGET_UPDATE')
	MTT:RegisterEvent('PLAYER_LOGIN')
	MTT:RegisterEvent('UNIT_TARGET')
	MTT:SetScript('OnEvent', function(self)
	if oUF_Raid1UnitButton1 ~= nil then	
	local Lys 	= oUF_Raid1UnitButton1:GetAttribute('unit') 
		if GetPartyAssignment('MAINTANK', Lys) then 
			oUF_Raid1UnitButton1Target:SetAlpha(1) 
		else 
			oUF_Raid1UnitButton1Target:SetAlpha(0) 
		end 
	end
	end)
It does the trick, now the question is how to simplify it. I tried doing a
For i = 1,5 do
loop, but this spews the following error as soon as I include a variable in the oUF_Raid1UnitButton[i] part.
Code:
Date: 2009-02-06 01:23:32
ID: 50
Error occured in: Global
Count: 17
Message: ...nterface\AddOns\oUF_Lysiander\oUF_Lysiander_Raid.lua line 313:
   attempt to concatenate global 'oUF_Raid1UnitButton' (a nil value)
Debug:
   [C]: ?
   ...nterface\AddOns\oUF_Lysiander\oUF_Lysiander_Raid.lua:313:
      ...nterface\AddOns\oUF_Lysiander\oUF_Lysiander_Raid.lua:299
AddOns:
  Swatter, v5.1.3715 (SnaggleTooth)
  Ampere, v3.0.3.14
  BadBoy, v2.2.0.4
  DevTools, v
  oUF, v1.3.4
  oUFBarFader, v30000.16
  oUFDebuffHighlight, v1.0
  oUFLysiander, v1.0
  oUFReadyCheck, v1.0
  PhanxChat, v3.0.2.21
  pStats, v30000.24
  tekticles, v3.0.3.8
  WowLua, v29 
  (ck=116)
I tried all methods known to me, but nothing but the simple but "wall of text"esque solution seems to work. Could anyone help me here?

Thanks in advance.

Last edited by Lysiander : 02-05-09 at 06:40 PM.
 
02-06-09, 06:50 AM   #628
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
Originally Posted by haste View Post
:PostUpdateAuraIcon() is called for every aura icon oUF shows. Your running your check on every single icon, thus hiding it.
Ok, thats what i thought, too. But how can i check and hide only a single debuff ? any idea ?
 
02-06-09, 08:08 AM   #629
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by coree View Post
Ok, thats what i thought, too. But how can i check and hide only a single debuff ? any idea ?
All you have to do is:
1. Use :PostUpdateAuraIcon()
2. Pseudo-code: if UnitAura(unit, index, filter) is blacklisted then icon:Hide() end
 
02-06-09, 08:35 AM   #630
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Hi everyone, need a bit of your knowledge here. I would like to make my raid and party frames moveable but as a block, not player by player.

The following come will make each player independant, but i want the whole party or the whole raid to move at once.

Code:
self:SetMovable(true)
self:RegisterForDrag("LeftButton")

self:SetScript("OnDragStart", function(self)
	if (IsShiftKeyDown()) then
		self:ClearAllPoints()
		self:StartMoving()
	end
end)

self:SetScript("OnDragStop", function(self)
	self:StopMovingOrSizing()
end)
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
 
02-06-09, 08:41 AM   #631
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Move the header frame .
 
02-06-09, 08:55 AM   #632
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by haste View Post
Move the header frame .
You mean like this ?

Code:
local party = oUF:Spawn('header', 'oUF_Party')
party:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', 15, -15)
party:SetManyAttributes('yOffset', -20, 'showParty', true)
party:SetMovable(true)
party:RegisterForDrag("LeftButton")

party:SetScript("OnDragStart", function(self)
	if (IsShiftKeyDown()) then
		party:ClearAllPoints()
		party:StartMoving()
	end
end)

party:SetScript("OnDragStop", function(self)
	party:StopMovingOrSizing()
end)
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
 
02-06-09, 08:58 AM   #633
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Yes.

"The message you have entered is too short. Please lengthen your message to at least 10 characters."
 
02-06-09, 08:59 AM   #634
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Well the above is exactly what i did but it did not work, i don't get why
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
 
02-06-09, 09:01 AM   #635
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
So... It does or does not work now?
 
02-06-09, 09:10 AM   #636
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
Originally Posted by haste View Post
All you have to do is:
1. Use :PostUpdateAuraIcon()
2. Pseudo-code: if UnitAura(unit, index, filter) is blacklisted then icon:Hide() end
big thx ! little difference, big result.
 
02-06-09, 09:11 AM   #637
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by haste View Post
So... It does or does not work now?
No it doesn't work, for it to work i have to "for example" do

Code:
if(not unit) then
move code here
end
And ofc then it moves players one by one.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 02-06-09 at 09:16 AM.
 
02-06-09, 09:24 AM   #638
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Try using LeftButtonUp instead of LeftButton. Might need a RegisterForClicks also as it's a frame, not a button.
 
02-06-09, 09:37 AM   #639
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by haste View Post
Try using LeftButtonUp instead of LeftButton. Might need a RegisterForClicks also as it's a frame, not a button.
Tried LeftButtonUp, even Down, didn't help, i don't understand why it works when i use (not unit) but one by one, and not here.

Basically i can move everything just fine as long as it's a single frame and not a group/raid
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 02-06-09 at 09:40 AM.
 
02-06-09, 09:46 AM   #640
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
It's all quite logical actually... You aren't actually clicking on the raid header, but the frame above.
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF - Layout discussion


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