Thread Tools Display Modes
11-18-10, 10:02 AM   #1
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
MainTank Target

If I wanted to show the MainTank Target on my layout is there a way to do this without a .xml template?

I don't think there is as oUF don't feed this unit (I looked into the ouf source code), but I could be wrong of course.

I'm spawning the MainTanks like this:

lua Code:
  1. -- Main Tank Frames
  2.         if cfg.show_MainTanks then
  3.             self:SetActiveStyle('lumen - Maintank')
  4.             local maintank = self:SpawnHeader("oUF_MainTank", nil, "raid, party, solo",
  5.             "showRaid", true,
  6.             "xoffset", 7,
  7.             "yOffset", 7,
  8.             "maxColumns", 1,
  9.             "unitsPerColumn", 5,
  10.             "columnSpacing", 7,
  11.             "point", "LEFT",
  12.             "columnAnchorPoint", "TOP",
  13.             "sortMethod", "NAME",
  14.             "groupFilter", "MAINTANK",
  15.             "oUF-initialConfigFunction", ([[
  16.             self:SetWidth(%d)
  17.             self:SetHeight(%d)
  18.             self:SetScale(%d)
  19.             ]]):format(cfg.mt_width, cfg.mt_height, cfg.scale))
  20.             maintank:SetPoint("TOPLEFT", oUF_lumenTarget, "BOTTOMRIGHT", cfg.mt_pos_x, cfg.mt_pos_y)
  21.         end
  22.     end)
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
11-18-10, 10:18 AM   #2
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
You will need to use an XML template for MT targets.

I'll not post my implementation, as last time I tried it there were a bucket load of errors due to changes in oUF 1.5 and the secure template stuff.

I'll get round to fixing it soon(TM), but work is kicking my arse at the moment.

If anyone has a nice working solution for oUF 1.5 then please post any info you have. I may end up 'borrowing' your ideas as well
  Reply With Quote
11-18-10, 10:22 AM   #3
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Thanks Evil, fast and direct as always.

Well I thought so, about not having alternative on the MT Target Template because of the secure headers, but one can always ask.

So... this being said, I'm always interested in an implementation that works! ^^

Thanks in advance.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
11-18-10, 11:29 AM   #4
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
This is what I'm using for ages. So not sure if this is broken now or something, because I haven't raided in months...

spawn in layout
Code:
	self:SetActiveStyle"Slim - MainTank"
	local Main_Tank = self:SpawnHeader("oUF_MainTank", nil, 'raid, party, solo', 
		'showRaid', true, 
		"groupFilter", "MAINTANK", 
		'yOffset', -10, 
		"template", "oUF_SlimMTartemplate",		-- MT Target
		'oUF-initialConfigFunction', ([[
			self:SetWidth(%d)
			self:SetHeight(%d)
		]]):format(cfg.widthM, cfg.heightM))		
	Main_Tank:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -80, -250)

xml template for Targets
Code:
	<Button name="oUF_SlimMTartemplate" inherits="SecureUnitButtonTemplate" hidden="true" virtual="true">
		<Frames>
			<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
				<Anchors>
					<Anchor point="RIGHT" relativePoint="LEFT" relativeTo="$parent">
					<Offset><AbsDimension x="-12" y="0"/></Offset>
					</Anchor>
				</Anchors>
				<Attributes>
					<Attribute name="unitsuffix" type="string" value="target"/>
					<Attribute name="useparent-unit" type="boolean" value="true"/>
					<Attribute name="type1" type="string" value="target"/>
					<Attribute name="initial-unitWatch" type="boolean" value="true"/>
				</Attributes>
			</Button>
		</Frames>
	</Button>
__________________
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
11-18-10, 12:47 PM   #5
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
You can actually do it without using templates through the magic that is oUF 1.5.x and WoW 4.x. It will only spawn the actual targets however, so you would have to spawn one header for the MainTanks and one for the targets.

Lua Code:
  1. local mtt = self:SpawnHeader(
  2.     nil, nil, 'raid,party',
  3.     'showRaid', true,
  4.     'groupFilter', 'MAINTANK',
  5.     'oUF-initialConfigFunction', [[
  6.         self:SetHeight(22)
  7.         self:SetWidth(220)
  8.     ]]
  9. )
  10. local mtt = self:SpawnHeader(
  11.     nil, nil, 'raid,party',
  12.     'showRaid', true,
  13.     'groupFilter', 'MAINTANK',
  14.     'oUF-initialConfigFunction', [[
  15.         self:SetHeight(22)
  16.         self:SetWidth(220)
  17.         self:SetAttribute('unitsuffix', 'target')
  18.     ]]
  19. )
__________________
「貴方は1人じゃないよ」

Last edited by haste : 11-20-10 at 06:53 AM. Reason: Added the dropped word.
  Reply With Quote
11-18-10, 12:50 PM   #6
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
That's very interesting, haste! Thanks. I am spawning another header just for the Main Tank anyway, so one more, one less... I guess the performance impact wouldn't be that great, right?

And duh, i tottally forgot about the Unitsuffix attribute.

@Dawn, thanks for the code.
__________________
My oUF Layout: oUF Lumen

Last edited by neverg : 11-18-10 at 12:58 PM.
  Reply With Quote
11-18-10, 02:41 PM   #7
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by neverg View Post
That's very interesting, haste! Thanks. I am spawning another header just for the Main Tank anyway, so one more, one less... I guess the performance impact wouldn't be that great, right?
The performance impact shouldn't be noticeable.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-18-10, 05:14 PM   #8
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Success!

Here they are, set and ready without a template. Thanks for the help.

__________________
My oUF Layout: oUF Lumen

Last edited by neverg : 11-19-10 at 03:34 AM.
  Reply With Quote
11-19-10, 12:55 AM   #9
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Just fyi, you can remove the type1 and initial-unitWatch attribute from the XML template. oUF does this by default in 1.5.x.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-19-10, 08:08 AM   #10
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
I found a slight bug with the Main Tank Target, the alpha doesn't work for it, it always shows as Out of Range for me, but I disabled the alpha on those units, don't need it anyway. Just for future reference.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
11-19-10, 08:44 AM   #11
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
It's not a bug, but just how the range checking is limited on Blizzards side.

The API given by Blizzard UnitInRange only returns values for party and raid members.

If you want to do range checking on target units then you'll need to use something like oUF_SpellRange
  Reply With Quote
11-19-10, 12:26 PM   #12
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Originally Posted by yj589794 View Post
It's not a bug, but just how the range checking is limited on Blizzards side.

The API given by Blizzard UnitInRange only returns values for party and raid members.

If you want to do range checking on target units then you'll need to use something like oUF_SpellRange
Ye, I thought it was Blizzard fault tbh, since the Range element is from Blizzard in Raid. I do use SpellRange so ye, there it is the solution. Thanks Paul.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
11-19-10, 06:59 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by haste View Post
It will only the actual targets however, so ...
I think you accidentally a word there.
  Reply With Quote
11-19-10, 10:43 PM   #14
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 268
Originally Posted by Phanx View Post
I think you accidentally a word there.
Like you did, right?
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
11-20-10, 06:54 AM   #15
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by Phanx View Post
I think you accidentally a word there.
I've had a splitting headache for the past three days due to my cold, so I'll just blame it on that :P. Today is actually the first day where I barely notice it \/.

I've edited the post and added the missing "spawn".
__________________
「貴方は1人じゃないよ」
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » MainTank Target


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