view Events.lua @ 75:e75a2fd448c0

- binding slot mixin: - store key binding definitions under their slot's data table - apply action button attributes when a slot is assigned - obtain correct macro body text when a macro is slotted - fix algorithm for resolving renamed macro indices - move spell detail lookup code out of mixin script - event chains: - initialize addon from PLAYER_LOGIN - reload keybinds from PLAYER_SPECIALIZATION_CHANGED, after spec profile is resolved - refresh interface content from SPELLS_CHANGED - hard refresh after PLAYER_SPECIALIZATION_CHANGED - hotkey text: - restore communication and detection of key binding updates and reflect them accordingly - properly respond to dynamic bindings that result from talent updates
author Nenue
date Mon, 23 Jan 2017 18:59:02 -0500
parents 9824d524a661
children 6623b7f2c1ca
line wrap: on
line source
-- KrakTool
-- Events.lua
-- Created: 7/24/2016 11:10 PM
-- %file-revision%
-- Event handlers, and the init block that sets them up; nothing else should be here

local _, kb = ...
local print = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('SkeletonKey', ...) end or function() end


kb.PLAYER_LOGIN = function(_, _, addon)

end

kb.PLAYER_REGEN_DISABLED = function()
  SkeletonKey:SetShown(false)
end

kb.UNIT_PORTRAIT_UPDATE = function()
  SkeletonKey:Update()
end

kb.PLAYER_REGEN_ENABLED = function()
  SkeletonKey:SetShown(kb.db.showUI)
end
kb.ACTIONBAR_SLOT_CHANGED = function(self, event, slot)
  --kb.HotKeyText(slot)
  return true
end

kb.PLAYER_TALENT_UPDATE = function()
  kb.TalentsChanged = true
end

-- only need to respond to this for pet actions
kb.PLAYER_SPECIALIZATION_CHANGED = function(self, event, unit)
  kb.UpdateSpecInfo()
  kb.UpdateTalentInfo()
  kb.UpdatePetInfo()
  kb.SelectProfileSet(kb.profileName)
  kb.ApplyAllBindings()
  SkeletonKey:Update(true)
end

kb.SPELLS_CHANGED = function()
  SkeletonKey:Update()
end

kb.UPDATE_MACROS = function()
  kb.UpdateMacroInfo()
end

kb.UPDATE_BINDINGS = function()
  kb.UpdateSystemBinds()
end