View Single Post
08-26-14, 08:01 AM   #11
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Wimpface View Post
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.
I didn't pay enough attention to notice the shaman line has it's true/false assignments reversed compared to the others.

Try your code on a druid, monk, or paladin caster; or a melee shaman, and see if it works. The only reason it works now is because when GetSpecialization() returns nil the default fall through value is what you wanted anyway (for the classes you tested).

Also, the code I posted should be changed to:
Code:
local isCaster
local cbCheck = function()
	if playerClass == 'DRUID' then
		isCaster = (GetSpecialization() or 0) % 3 == 1
	elseif playerClass == 'MONK' then
		isCaster = GetSpecialization() == 2
	elseif playerClass == 'PALADIN' then
		isCaster = GetSpecialization() == 1
	elseif playerClass == 'SHAMAN' then
		isCaster = GetSpecialization() ~= 2
	else
		isCaster = playerClass == 'MAGE' or playerClass == 'PRIEST' or playerClass == 'WARLOCK'
	end
end
You will also have an issue with a druid, monk, paladin, or shaman who changes spec from caster to non-caster (or vice versa). They will need to /reload for the castbar to update as the code stands now.
  Reply With Quote