Quantcast
KGPanels Scripts target - Page 2 - WoWInterface
Thread Tools Display Modes
01-28-11, 01:45 AM   #21
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Yes! I can't believe I didn't change that, especially after the problems I had between panels and borders, I'm an idiot.
Thank you very much, hero, you've made my evening~


Last edited by Kendian : 01-28-11 at 01:46 AM. Reason: Spellcheck, ftl >.<
  Reply With Quote
01-28-11, 04:16 AM   #22
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
I hate to ask, Nibleheim, seeing as you've already repaired everything that I was unable to in my personal ui......but, would you happen to know the script, to call a panel based on stance? I.e., bear form, cat form, prot spec/ret spec, aspect of the suck (cheetah) etc? I would be ever so grateful, and would send loads of cookies.
  Reply With Quote
01-28-11, 04:42 AM   #23
Nibelheim
local roygbi-
 
Nibelheim's Avatar
Featured
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Kendian View Post
I hate to ask, Nibleheim, seeing as you've already repaired everything that I was unable to in my personal ui......but, would you happen to know the script, to call a panel based on stance? I.e., bear form, cat form, prot spec/ret spec, aspect of the suck (cheetah) etc? I would be ever so grateful, and would send loads of cookies.
Alright, this took me ages to type out, bleh!

To set color based on stance:

-- OnLoad
Code:
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
-- OnEvent
Code:
if not self.StanceTable then
	self.StanceTable = {
		["DEATHKNIGHT"] = {
			[1] = {r = 1, g = 1, b = 1},	-- Blood Presence
			[2] = {r = 1, g = 1, b = 1},	-- Frost Presence
			[3] = {r = 1, g = 1, b = 1},	-- Unholy Presence 
		},
		["DRUID"] = {
			[1] = {r = 1, g = 1, b = 1},	-- Bear/Dire Bear Form
			[2] = {r = 1, g = 1, b = 1},	-- Aquatic Form
			[3] = {r = 1, g = 1, b = 1},	-- Cat Form
			[4] = {r = 1, g = 1, b = 1},	-- Travel Form
			[5] = {r = 1, g = 1, b = 1},	-- Moonkin/Tree Form (Unless feral. If no moonkin/tree form present, (swift) flight form is form 5)
			[6] = {r = 1, g = 1, b = 1},	-- Flight Form 
		},
		["PALADIN"] = {
			[1] = {r = 1, g = 1, b = 1},	-- Devotion Aura
			[2] = {r = 1, g = 1, b = 1},	-- Retribution Aura
			[3] = {r = 1, g = 1, b = 1},	-- Concentration Aura
			[4] = {r = 1, g = 1, b = 1},	-- Shadow Resistance Aura
			[5] = {r = 1, g = 1, b = 1},	-- Frost Resistance Aura
			[6] = {r = 1, g = 1, b = 1},	-- Fire Resistance Aura
			[7] = {r = 1, g = 1, b = 1},	-- Crusader Aura
		},
		["PRIEST"] = {
			[1] = {r = 1, g = 1, b = 1},	-- Shadowform 
		},
		["ROGUE"] = {
			[1] = {r = 1, g = 1, b = 1},	-- Stealth
		},
		["SHAMAN"] = {
			[1] = {r = 1, g = 1, b = 1},	-- Ghost Wolf
		},
		["WARRIOR"] = {
			[1] = {r = 1, g = 1, b = 1},	-- Battle Stance
			[2] = {r = 1, g = 1, b = 1},	-- Defensive Stance
			[3] = {r = 1, g = 1, b = 1},	-- Berserker Stance 
		},
	}
end

local Stance = GetShapeshiftForm()
local _, Class = UnitClass("player")
local Color = {r = 1, g = 1, b = 1}

if Stance > 0 then
	Color = self.StanceTable[Class][Stance]
end

self.bg:SetVertexColor(Color.r, Color.g, Color.b, self.bg:GetAlpha())
Note, you'll have to set all the colors in the table. Values are between 0 and 1.


To show a panel based on stance:

-- OnLoad
Code:
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
-- OnEvent
Code:
local DefaultFrame = kgPanels:FetchFrame("MyDefaultPanelName")
if not self.StanceTable then
	self.StanceTable = {
		["DEATHKNIGHT"] = {
			[1] = "MyPanelName",	-- Blood Presence
			[2] = "MyPanelName",	-- Frost Presence
			[3] = "MyPanelName",	-- Unholy Presence 
		},
		["DRUID"] = {
			[1] = "MyPanelName",	-- Bear/Dire Bear Form
			[2] = "MyPanelName",	-- Aquatic Form
			[3] = "MyPanelName",	-- Cat Form
			[4] = "MyPanelName",	-- Travel Form
			[5] = "MyPanelName",	-- Moonkin/Tree Form (Unless feral. If no moonkin/tree form present, (swift) flight form is form 5)
			[6] = "MyPanelName",	-- Flight Form 
		},
		["PALADIN"] = {
			[1] = "MyPanelName",	-- Devotion Aura
			[2] = "MyPanelName",	-- Retribution Aura
			[3] = "MyPanelName",	-- Concentration Aura
			[4] = "MyPanelName",	-- Shadow Resistance Aura
			[5] = "MyPanelName",	-- Frost Resistance Aura
			[6] = "MyPanelName",	-- Fire Resistance Aura
			[7] = "MyPanelName",	-- Crusader Aura
		},
		["PRIEST"] = {
			[1] = "MyPanelName",	-- Shadowform 
		},
		["ROGUE"] = {
			[1] = "MyPanelName",	-- Stealth
		},
		["SHAMAN"] = {
			[1] = "MyPanelName",	-- Ghost Wolf
		},
		["WARRIOR"] = {
			[1] = "MyPanelName",	-- Battle Stance
			[2] = "MyPanelName",	-- Defensive Stance
			[3] = "MyPanelName",	-- Berserker Stance 
		},
	}
end

local Stance = GetShapeshiftForm()
local _, Class = UnitClass("player")

local ShowFrame
if Stance == 0 then
	ShowFrame = DefaultFrame
else
	ShowFrame = kgPanels:FetchFrame(self.StanceTable[Class][Stance])
end

if ( self.LastShownFrame and self.LastShownFrame ~= ShowFrame ) then
	self.LastShownFrame:Hide()
elseif ShowFrame ~= DefaultFrame then
	DefaultFrame:Hide()
end

ShowFrame:Show()
self.LastShownFrame = ShowFrame
You'll have to change all the MyPanelName to the names of the panels in kgPanels you want to show/hide.


Edit: All this is completely untested, but hopefully it works and/or it'll provide a base for you to get it to work. I think I'm out of here
  Reply With Quote
01-28-11, 05:31 AM   #24
Othgar
"That" Guy
 
Othgar's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 228
Perfect! Thanks Nibelheim that was exactly what I was looking for.Not Moving with a target.Idle no targetMoving. Much love...many cookies!
__________________


  Reply With Quote
12-05-11, 09:30 PM   #25
T4YR3L
A Deviate Faerie Dragon
Join Date: Dec 2009
Posts: 15
Originally Posted by Nibelheim View Post
Ahh, thought you were already accounting for no target situations. Here you go:

Code:
if UnitExists("target") then
  local _, Class = UnitClass("target")
  local Color = RAID_CLASS_COLORS[Class] or {r = 1, g = 1, b = 1}
  self:SetBackdropBorderColor(Color.r, Color.g, Color.b, self.bg:GetAlpha())
end
Hello Nibelheim,
ive found you scripts google'ing xD

i want to ask if this code can be done also for party/raid members.
i mean the classcolor border for each player in party or raid. it is possible?

ty very much ^^
__________________
  Reply With Quote
12-05-11, 09:44 PM   #26
Taryble
A Molten Giant
 
Taryble's Avatar
Join Date: Jan 2009
Posts: 811
Just change the part where it says "target" (UnitExists("target"), UnitClass("target")), to "party1", "party2", "party3", "party4", and then raid1 thru raid40 (or however high you want to go).
__________________
-- Taryble
  Reply With Quote
12-06-11, 08:00 AM   #27
T4YR3L
A Deviate Faerie Dragon
Join Date: Dec 2009
Posts: 15
Originally Posted by Taryble View Post
Just change the part where it says "target" (UnitExists("target"), UnitClass("target")), to "party1", "party2", "party3", "party4", and then raid1 thru raid40 (or however high you want to go).
ty for the rapid answer..

so, are something like that in the On Event section:

if UnitExists("party1") then
local _, Class = UnitClass("party1")
local Color = RAID_CLASS_COLORS[Class] or {r = 1, g = 1, b = 1}
self:SetBackdropBorderColor(Color.r, Color.g, Color.b, self.bg:GetAlpha())
end

and in On Load Section?

local _,class = UnitClass("party1") ? ^^'

EDIT: its work, but only with party1 frame :|
what's wrong?
__________________

Last edited by T4YR3L : 12-06-11 at 12:43 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » KGPanels Scripts target

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