/Tukui/modules/unitframes/core/oUF/units.lua

http://github.com/Asphyxia/Tukui · Lua · 20 lines · 16 code · 3 blank · 1 comment · 10 complexity · 2e8f7a485e8b2d404c91e4953a544341 MD5 · raw file

  1. local parent, ns = ...
  2. local oUF = ns.oUF
  3. local Private = oUF.Private
  4. local enableTargetUpdate = Private.enableTargetUpdate
  5. -- Handles unit specific actions.
  6. function oUF:HandleUnit(object, unit)
  7. local unit = object.unit or unit
  8. if(unit == 'target') then
  9. object:RegisterEvent('PLAYER_TARGET_CHANGED', object.UpdateAllElements)
  10. elseif(unit == 'mouseover') then
  11. object:RegisterEvent('UPDATE_MOUSEOVER_UNIT', object.UpdateAllElements)
  12. elseif(unit == 'focus') then
  13. object:RegisterEvent('PLAYER_FOCUS_CHANGED', object.UpdateAllElements)
  14. elseif(unit:match'%w+target' or unit:match'(boss)%d?$' == 'boss') then
  15. enableTargetUpdate(object)
  16. end
  17. end