Thread Tools Display Modes
10-08-12, 05:46 AM   #1
Psyborg
A Defias Bandit
Join Date: Feb 2012
Posts: 3
kgpanels help

Hi,

Is it possible to show/hide frames based on the character spec. e.g. only show a frame if you are Demonology spec and hide it if your Affliction or Destruction?

Thanks
  Reply With Quote
10-08-12, 07:08 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
OnLoad:
Code:
self:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")

if GetSpecialization() == 2 then
    self:Show()
else
    self:Hide()
end
OnEvent:
Code:
if GetSpecialization() == 2 then
    self:Show()
else
    self:Hide()
end
If you want to use it on other classes, you'll need to change the 2 to whichever spec you want to check for. They go in the same order as the panels in the talent frame, so for your warlock, 1 would be Affliction and 3 would be Destruction, while on a shaman 1 is Elemental, 2 is Enhancement, and 3 is Restoration.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 10-08-12 at 07:10 PM.
  Reply With Quote
10-08-12, 11:20 PM   #3
Psyborg
A Defias Bandit
Join Date: Feb 2012
Posts: 3
Thanks for the help really appreciate it.

If you don't mind could you see if this is how I should be making the scripts. This is to make Soul Shard 4 show / hide:

if GetSpecialization() == 1 and UnitPower("player",SPELL_POWER_SOUL_SHARDS) >= 4 then
self:Show()
else
self:Hide()
end

It works fine but is there a better way of doing this?

Also is there an archive of what each SPELL_POWER is? -- Think I found this but it says SPELL_POWER_CHI is obsolite. How would I make my frame work for Chi?

Last edited by Psyborg : 10-09-12 at 01:12 AM.
  Reply With Quote
10-09-12, 02:11 AM   #4
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Psyborg View Post
Thanks for the help really appreciate it.

If you don't mind could you see if this is how I should be making the scripts. This is to make Soul Shard 4 show / hide:

if GetSpecialization() == 1 and UnitPower("player",SPELL_POWER_SOUL_SHARDS) >= 4 then
self:Show()
else
self:Hide()
end

It works fine but is there a better way of doing this?

Also is there an archive of what each SPELL_POWER is? -- Think I found this but it says SPELL_POWER_CHI is obsolite. How would I make my frame work for Chi?
SPELL_POWER_LIGHT_FORCE is the one to look for.
  Reply With Quote
10-09-12, 11:05 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You can find a list of all the power types here:
http://wow.go-hero.net/framexml/16016/Constants.lua#119

Chi currently uses SPELL_POWER_LIGHT_FORCE. There is a corresponding SPELL_POWER_DARK_FORCE but it's not used for anything as far as I know.

Don't forget to register for the UNIT_POWER event in your panel's OnLoad, too.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
10-10-12, 08:09 AM   #6
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Phanx View Post
You can find a list of all the power types here:
http://wow.go-hero.net/framexml/16016/Constants.lua#119

Chi currently uses SPELL_POWER_LIGHT_FORCE. There is a corresponding SPELL_POWER_DARK_FORCE but it's not used for anything as far as I know.

Don't forget to register for the UNIT_POWER event in your panel's OnLoad, too.
At Blizzcon 2011 when they first let you try out monks on their Mists of Pandaria preview area, they originally gave monks abilities that gave both a light or a dark chi (which I really thought gave monks a very very unique combat system). Seems they stuck with the power names from back then.

Video for reference: with timestamp
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » kgpanels help


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