View Single Post
08-26-14, 12:19 AM   #10
Wimpface
A Molten Giant
 
Wimpface's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 648
Originally Posted by Vrul View Post
Since GetSpecialization() returns nil on a fresh login I have a hard time believing the code posted works on a fresh login for any caster other than a mage, priest, or warlock.
I just tested, and it does seem to work on everything...
I even made a little video to show that it works on a fresh login on my caster Shaman, my caster Mage and my melee Monk.
Excuse shoddy framerate but text should be very readable atleast: http://www.youtube.com/watch?v=w6_gm2KBH5I

Is it because of what Phanx said earlier about oUF:Factory delaying the creation of frames until PLAYER_LOGIN?

Don't get me wrong, I'm really happy it works, I'm just curious why it does because it apparently shouldn't, and I simply don't have the knowledge to understand the logic behind it.

Originally Posted by Vrul View Post
The reason p3lim's version isn't working for you is that the isCaster variable is being redefined as local in the cbCheck function instead of reused. So basically you have two isCaster variables at two different scopes.

You can trim it down more with:
Code:
local isCaster
local cbCheck = function()
	if playerClass == 'DRUID' then
		isCaster = (GetSpecialization() or 0) % 3 == 1
	elseif playerClass == 'MONK' or playerClass == 'SHAMAN' then
		isCaster = GetSpecialization() == 2
	elseif playerClass == 'PALADIN' then
		isCaster = GetSpecialization() == 1
	else
		isCaster = playerClass == 'MAGE' or playerClass == 'PRIEST' or playerClass == 'WARLOCK'
	end
end
Ofcourse, I should've spotted that. I'll clean it up a bit more after I wake up properly.
__________________
All I see is strobe lights blinding me in my hindsight.
  Reply With Quote