Originally Posted by Wimpface
I am using oUF:Factory, is this why it's working correctly despite not waiting for events to trigger the function? I don't know why, but it does work on a fresh login for both my melee Monk and my casters with the way I have it now, but changing to p3lim's check makes it behave the way you describe it, as in it doesn't work anymore.
|
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.
Originally Posted by Wimpface
|
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