View Single Post
08-25-14, 02:46 AM   #6
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
You could also simplify the isCaster check a bit
Lua Code:
  1. local cbCheck = function()
  2.     local _, playerClass = UnitClass('player')
  3.     local spec = GetSpecialization()
  4.  
  5.     local isCaster = false
  6.     if(playerClass == 'DRUID' and (spec == 1 or spec == 4)) then
  7.         isCaster = true
  8.     elseif(playerClass == 'MONK' and spec == 2) then
  9.         isCaster = true
  10.     elseif(playerClass == 'PALADIN' and spec == 1) then
  11.         isCaster = true
  12.     elseif(playerClass == 'SHAMAN' and spec == 2) then
  13.         isCaster = true
  14.     elseif(playerClass == 'MAGE' or playerClass == 'PRIEST' or playerClass == 'WARLOCK') then
  15.         isCaster = true
  16.     end
  17. end

Also, you need the events to delay the check, on init the spec is not available yet, and will return nil.

Last edited by p3lim : 08-25-14 at 02:49 AM.
  Reply With Quote