--[[ |
##AddOn : KeyboardAccess |
##Subfile : core.lua |
##Author : Hati-EK |
--]] |
--[[Logic Rules: |
FIFO Principe |
Example: |
1. Ready-Check comes in. |
2. Rogue wants to swap poison on MH. |
3. !No Rule Conflict! |
=> Rule#1: |
What shows up first -> Gets handled first |
|
|
informations |
>>readycheck module |
ReadyCheckFrameYesButton --yes |
ReadyCheckFrameNoButton --no |
|
|
>>npc/enchant module |
StaticPopup1Button1 --yes |
StaticPopup1Button2 --no |
up to StaticPopup4 |
|
>>LFD tool (role) |
LFDRoleCheckPopupAcceptButton |
LFDRoleCheckPopupDeclineButton |
|
>>LFD tool (join) |
LFDDungeonReadyDialogEnterDungeonButton --Enter |
LFDDungeonReadyDialogLeaveQueueButton --Leave |
]] |
KeyboardAccess = { } --just for personal debugging issues |
local KA = KeyboardAccess -- 4b6579626f617264416363657373 = Hex-CODE for KeyboarAccess |
KA.name = 'KeyboardAccess' |
KA.ver = GetAddOnMetadata( KA.name, 'Version') |
if KA.ver=='rwowi:revision' then KA.ver='SVN' end |
KA.MODShift=false |
KA.handleT = {} |
local events = {} |
|
function events:MODIFIER_STATE_CHANGED(modi,state) --required for still opening chat or config |
if modi=='LSHIFT' or modi=='RSHIFT' then |
KA.MODShift=state |
end |
end |
|
function events:READY_CHECK(...) --ReadyCheck PopUp |
--print('READY_CHECK') |
end |
|
function events:LFG_PROPOSAL_SHOW(...) --LFD Tool PopUp |
--print('LFG_PROPOSAL_SHOW') |
end |
|
KA.handler = CreateFrame('Frame',KA.name.."_Handler") |
KA.handler:SetScript('OnEvent',function(self,event,...) |
events[event](self, ...) |
end) |
for k, v in pairs(events) do |
KA.handler:RegisterEvent(k); -- Register all events for which handlers have been defined |
end |
|
|
--overwriting all possible frames |
local popups = { |
LFDRoleCheckPopup, --rolecheck |
StaticPopup1, --default |
StaticPopup2, --popup frames |
StaticPopup3, --for enchants |
StaticPopup4 --buying items |
} |
KA.oldShow = { } |
--storing old shows & creating new ones |
for _,k in ipairs(popups) do |
local name = k:GetName() |
KA.oldShow[name] = k:GetScript('OnShow') |
k:SetScript('OnShow',function(...) |
tinsert(KA.handleT,name) |
KA.oldShow[name](...) |
end) |
end |
|
|