View Single Post
07-29-16, 02:23 PM   #1
Joker119
A Flamescale Wyrmkin
 
Joker119's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 113
Attempting to get player spec for addon if condition

So I have an UI addon that creates it's own Paladin Holy Power bar.

Since Only Ret pallies have it, logic would dictate that I should only display it to Ret pallies!!
Here's my problem.

I determine the player's class (this part works)
Code:
cfg.playerclass = select(2,UnitClass("player"))
in the holypower portion of the addon...
Code:
if cfg.playerclass == "PALADIN" and self.cfg.holypower.show then
bars.createHolyPowerBar(self)
end
that part works.
however, when I determine the players spec:
Code:
cfg.playerspec = GetSpecialization()
and try to work that into the Holy Power creation conditions:
Code:
if cfg.playerclass == "PALADIN" and cfg.playerspec == "3" then
bars.createHolyPowerBar(self)
end
then it breaks.
No errors.
Just breaks.

If I type the the following into the games chat:
Code:
/script print(GetSpecialization())
I get a result of 1 for Holy, 2 for Prot, 3 for Ret.

I've tried the code with all 3 specs and with the "cfg.playerspec == "3" condition, the holy power bar will not display in any pally spec.
  Reply With Quote