Thread Tools Display Modes
10-11-10, 05:32 PM   #1
Elv22
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 6
Customizing Spawn Header

Hi all I have a very small issue I was hoping you could help me with, currently i have three different groups (party[raid 1-5 as well], raid 6-25, raid 26-40). I want to try to customize my spawn header so that if I am inside a raid that is not a 40 man, the raid 6-25 layout will always be shown.

Any help is appreciated, yes this is done with the oUF 1.5, which isn't complete yet.


Party [Raid 1-5] Spawnheader:

Code:
	local party = self:SpawnHeader("oUF_TukuiDPSParty", nil, "custom [@raid6,exists] hide;show", 
		'oUF-initialConfigFunction', [[
			local header = self:GetParent()
			self:SetWidth(header:GetAttribute('initial-width'))
			self:SetHeight(header:GetAttribute('initial-height'))
			RegisterUnitWatch(self)
		]],
		'initial-width', party_width,
		'initial-height', party_height,			
		"showParty", true, 
		"showPlayer", TukuiCF["raidframes"].showplayerinparty, 
		"showRaid", true, 
		"showSolo", false,
		"yOffset", TukuiDB.Scale(-8)
	)
Raid 6-25 Spawn Header:

Code:
	local raid = self:SpawnHeader("oUF_TukuiDPSR6R25", nil, "custom [@raid6,noexists][@raid26,exists] hide;show",
		'oUF-initialConfigFunction', [[
			local header = self:GetParent()
			self:SetWidth(header:GetAttribute('initial-width'))
			self:SetHeight(header:GetAttribute('initial-height'))
			RegisterUnitWatch(self)
		]],
		'initial-width', raidframe_width,
		'initial-height', raidframe_height,			
		"showRaid", true, 
		"showParty", true,
		"showSolo", false,
		"point", "BOTTOM",
		"showPlayer", TukuiCF["raidframes"].showplayerinparty,
		"groupFilter", "1,2,3,4,5",
		"groupingOrder", "1,2,3,4,5",
		"groupBy", "GROUP",	
		"yOffset", TukuiDB.Scale(6)
	)
and Raid 26-40 Layout
Code:
	local raid = self:SpawnHeader("oUF_TukuiDPSR26R40", nil, "custom [@raid26,exists] show;hide",
		'oUF-initialConfigFunction', [[
			local header = self:GetParent()
			self:SetWidth(header:GetAttribute('initial-width'))
			self:SetHeight(header:GetAttribute('initial-height'))
			RegisterUnitWatch(self)
		]],
		'initial-width', raid_width,
		'initial-height', raid_height,	
		"showSolo", false,
		"showRaid", true, 
		"showParty", true,
		"showPlayer", TukuiCF["raidframes"].showplayerinparty,
		"xoffset", TukuiDB.Scale(6),
		"groupFilter", "1,2,3,4,5,6,7,8",
		"groupingOrder", "1,2,3,4,5,6,7,8",
		"groupBy", "GROUP",	
		"yOffset", TukuiDB.Scale(-6)
	)

Also here is an example of the function I would run to check if the raid is proper:

Code:
function TukuiDB.Show25RaidLayout()
	local inInstance, instanceType = IsInInstance()
	local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo()
	if inInstance and instanceType == "raid" and maxPlayers ~= 40 then
		return true
	else
		return false
	end 
end

Last edited by Elv22 : 10-12-10 at 11:12 AM.
  Reply With Quote
10-12-10, 11:30 AM   #2
Taroven
A Cyclonian
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 49
What exactly is the issue?
__________________
Former author of EventHorizon Continued and Other Releases.
  Reply With Quote
10-12-10, 01:58 PM   #3
Elv22
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 6
Originally Posted by Taroven View Post
What exactly is the issue?


I'm trying to find a way to use my function i posted at the bottom there to determine if the 6-25 layout should be used inside an instance or not. I was wondering if theres any way to run a custom script inside the spawn header for that or not
  Reply With Quote
10-12-10, 03:36 PM   #4
Zilver
A Fallenroot Satyr
 
Zilver's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2006
Posts: 29
Originally Posted by Elv22 View Post
I'm trying to find a way to use my function i posted at the bottom there to determine if the 6-25 layout should be used inside an instance or not. I was wondering if theres any way to run a custom script inside the spawn header for that or not
To my knowledge this can't be done in the manner you are asking for, the reason is simple, the SpawnHeader function is run when you login to the game, then the newly spawned UnitFrames get's populated with units ... so it would be impossible for SpawnHeader to create frames based on information that doesn't exist when it's run ...

That being said you can always create a custom function that based on current information will show / hide different already created UnitFrames ... like so:

Code:
function ShowHideUnitFrames()
    if no party hide all but player (& pet) frames
    if party show party frames
    if raid but less or equal to 5 players show party frames
    if raid with less than 11 and more than 5 players show raid10 frames
    if raid with less than 26 and more then 10 player show raid25 frames
    if raid and more then 10 player show raid40 frames
end
Yeah that isn't real code, but you should get the idea behind it.
  Reply With Quote
10-12-10, 04:02 PM   #5
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
It is possible to write your own custom SecureStateDriver, but it is not an easy thing to implement.

For my own raid frames I just show all raid units and move the pet frames on any raid/party roster update.
  Reply With Quote
10-12-10, 04:13 PM   #6
Elv22
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 6
Originally Posted by yj589794 View Post
It is possible to write your own custom SecureStateDriver, but it is not an easy thing to implement.

For my own raid frames I just show all raid units and move the pet frames on any raid/party roster update.
if you or anyone could post an example on how to do this it would be appreciated.
  Reply With Quote
10-12-10, 04:31 PM   #7
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by Elv22 View Post
if you or anyone could post an example on how to do this it would be appreciated.
For the custom SecureStateDriver, or for moving the pet frames on raid update?
  Reply With Quote
10-14-10, 04:15 PM   #8
Elv22
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 6
Figured it out, was kinda tricky but hey it works..

Party:

Code:
oUF:RegisterStyle('TukuiDPSParty', Shared)
oUF:Factory(function(self)
	oUF:SetActiveStyle("TukuiDPSParty")

	local party = self:SpawnHeader("oUF_TukuiDPSParty", nil, "custom [@raid6,exists] hide;show", 
		'oUF-initialConfigFunction', [[
			local header = self:GetParent()
			self:SetWidth(header:GetAttribute('initial-width'))
			self:SetHeight(header:GetAttribute('initial-height'))
			RegisterUnitWatch(self)
		]],
		'initial-width', party_width,
		'initial-height', party_height,			
		"showParty", true, 
		"showPlayer", TukuiCF["raidframes"].showplayerinparty, 
		"showRaid", true, 
		"showSolo", false,
		"yOffset", TukuiDB.Scale(-8)
	)
	party:SetPoint("BOTTOMLEFT", ChatLBackground, "TOPLEFT", TukuiDB.Scale(2), TukuiDB.Scale(40))
	
	local partyToggle = CreateFrame("Frame")
	partyToggle:RegisterEvent("PLAYER_ENTERING_WORLD")
	partyToggle:RegisterEvent("ZONE_CHANGED_NEW_AREA")
	partyToggle:SetScript("OnEvent", function(self)
		local inInstance, instanceType = IsInInstance()
		local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo()
		if inInstance and instanceType == "raid" and maxPlayers ~= 40 then
			oUF_TukuiDPSParty:SetAttribute("showRaid", false)
			oUF_TukuiDPSParty:SetAttribute("showParty", false)			
		else
			oUF_TukuiDPSParty:SetAttribute("showParty", true)
			oUF_TukuiDPSParty:SetAttribute("showRaid", true)
		end
	end)
end)
Raid 6-25
Code:
oUF:RegisterStyle('TukuiDPSR6R25', Shared)
oUF:Factory(function(self)
	oUF:SetActiveStyle("TukuiDPSR6R25")	
	local raid = self:SpawnHeader("oUF_TukuiDPSR6R25", nil, "custom [@raid6,noexists][@raid26,exists] hide;show",
		'oUF-initialConfigFunction', [[
			local header = self:GetParent()
			self:SetWidth(header:GetAttribute('initial-width'))
			self:SetHeight(header:GetAttribute('initial-height'))
			RegisterUnitWatch(self)
		]],
		'initial-width', raidframe_width,
		'initial-height', raidframe_height,			
		"showRaid", true, 
		"showParty", true,
		"showSolo", false,
		"point", "BOTTOM",
		"showPlayer", TukuiCF["raidframes"].showplayerinparty,
		"groupFilter", "1,2,3,4,5",
		"groupingOrder", "1,2,3,4,5",
		"groupBy", "GROUP",	
		"yOffset", TukuiDB.Scale(6)
	)	
	raid:SetPoint("BOTTOMLEFT", ChatLBackground, "TOPLEFT", TukuiDB.Scale(2), TukuiDB.Scale(40))
	
	local function ChangeVisibility(visibility)
		if(visibility) then
			local type, list = string.split(' ', visibility, 2)
			if(list and type == 'custom') then
				RegisterAttributeDriver(oUF_TukuiDPSR6R25, 'state-visibility', list)
			end
		end	
	end
	
	local raidToggle = CreateFrame("Frame")
	raidToggle:RegisterEvent("PLAYER_ENTERING_WORLD")
	raidToggle:RegisterEvent("ZONE_CHANGED_NEW_AREA")
	raidToggle:SetScript("OnEvent", function(self)
		local inInstance, instanceType = IsInInstance()
		local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo()
		if inInstance and instanceType == "raid" and maxPlayers ~= 40 then
			ChangeVisibility("custom [group:party,nogroup:raid][group:raid] show;hide")
		else
			ChangeVisibility("custom [@raid6,noexists][@raid26,exists] hide;show")
		end
	end)
end)
Raid 26-40
Code:
oUF:RegisterStyle('TukuiDPSR26R40', Shared)
oUF:Factory(function(self)
	oUF:SetActiveStyle("TukuiDPSR26R40")	
	local raid = self:SpawnHeader("oUF_TukuiDPSR26R40", nil, "custom [@raid26,exists] show;hide",
		'oUF-initialConfigFunction', [[
			local header = self:GetParent()
			self:SetWidth(header:GetAttribute('initial-width'))
			self:SetHeight(header:GetAttribute('initial-height'))
			RegisterUnitWatch(self)
		]],
		'initial-width', raid_width,
		'initial-height', raid_height,	
		"showSolo", false,
		"showRaid", true, 
		"showParty", true,
		"showPlayer", TukuiCF["raidframes"].showplayerinparty,
		"xoffset", TukuiDB.Scale(6),
		"groupFilter", "1,2,3,4,5,6,7,8",
		"groupingOrder", "1,2,3,4,5,6,7,8",
		"groupBy", "GROUP",	
		"yOffset", TukuiDB.Scale(-6)
	)	
	raid:SetPoint("BOTTOMLEFT", ChatLBackground, "TOPLEFT", TukuiDB.Scale(2), TukuiDB.Scale(40))
	
	local partyToggle = CreateFrame("Frame")
	partyToggle:RegisterEvent("PLAYER_ENTERING_WORLD")
	partyToggle:RegisterEvent("ZONE_CHANGED_NEW_AREA")
	partyToggle:SetScript("OnEvent", function(self)
		local inInstance, instanceType = IsInInstance()
		local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo()
		if inInstance and instanceType == "raid" and maxPlayers ~= 40 then
			oUF_TukuiDPSR26R40:SetAttribute("showRaid", false)
			oUF_TukuiDPSR26R40:SetAttribute("showParty", false)			
		else
			oUF_TukuiDPSR26R40:SetAttribute("showParty", true)
			oUF_TukuiDPSR26R40:SetAttribute("showRaid", true)
		end
	end)
end)
Now when I enter an instance, my Raid 6-25 layout will be shown, and the other two will be hidden.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Customizing Spawn Header


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