Mercurial > wow > skeletonkey
changeset 83:1605319122ce
- Added a list of special-cases for replaced abilities that can't be detected internally (Carve, Blink, etc.)
author | Nenue |
---|---|
date | Sun, 28 May 2017 12:45:32 -0400 |
parents | cc082ee22c4c |
children | 1407e3a2cd1f b80e78f4a17b |
files | ActionTemplates.lua KeyButton.lua SkeletonKey.lua |
diffstat | 3 files changed, 71 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/ActionTemplates.lua Mon Apr 17 13:28:20 2017 -0400 +++ b/ActionTemplates.lua Sun May 28 12:45:32 2017 -0400 @@ -106,7 +106,10 @@ --- Resolves the SecureActionButton attribute names used for the given action kb.RegisterAction = function(actionType, id, name) - assert(atype[actionType], 'Missing actionType handler for `'..tostring(actionType)..'`') + if not atype[actionType]then + kb.print('Missing actionType handler for `'..tostring(actionType)..'`') + return + end local prefix, attributeName, attributeValue, button = atype[actionType](id, name) local command = prefix .. attributeName return attributeName, attributeValue, command, prefix, button @@ -194,42 +197,60 @@ configTable.command = configTable.command:gsub('KeyBinder', 'SkeletonKey') end + cprint('|cFF0088FFLoadBinding()|r', configTable.actionName, configTable.dynamicType) + local isAvailable + local dynamicType = configTable.dynamicType + if dynamicType == 'profession' then + local dynamicIndex, dynamicSubIndex = tonumber(configTable.dynamicIndex), tonumber(configTable.dynamicSubIndex) + cprint(' |cFF00FFFFDynamicInfo:|r', dynamicType, dynamicIndex, dynamicSubIndex) + + local extendedTable = kb.DynamicSpells[dynamicType][dynamicIndex] + + if extendedTable then + cprint(extendedTable) + for k,v in pairs(extendedTable) do + cprint(type(k), k) + end + local subTable = extendedTable[dynamicSubIndex] + + if subTable then + for k,v in pairs(subTable) do + cprint(' override', k, '=', v, '(was', configTable[k]) + configTable[k] = subTable[k] + end + --isAvailable = configTable.isAvailabl + --name, actionID = configTable.actionName, configTable.actionID + cprint(subTable.actionName, subTable.actionID) + isAvailable = true + end + end + end + local command, name, icon, actionType, actionID, macroName, macroText = configTable.command, configTable.actionName, configTable.iconPath, configTable.actionType, configTable.actionID, configTable.macroName, configTable.macroText - - local indexKey = actionType..'_'..actionID - local actionPrefix = "*"..actionType.."-" + local indexKey = tostring(actionType)..'_'..tostring(actionID) + local actionPrefix = "*"..tostring(actionType).."-" local button = SkeletonKeyKey - local isAvailable local specialButtonType if actionType == 'spell' then local realName, _, _, _, _, _, realID = GetSpellInfo(name) + if realName then if (realName ~= name) then - print(' *** "', name, '" is replaced by...', realName, realID) + cprint(' *** "', name, '" is replaced by...', realName, realID) --name, actionID = realName, realID indexKey = actionType .. '_'.. realID end - elseif configTable.dynamicType == 'talent' then - print(' *** "', name, '" is a non-selected talent.') + elseif dynamicType == 'talent' then + cprint(' |cFF00FFFFDynamicInfo:|r', dynamicType, table.concat(configTable.assignedKeys, ',')) + cprint(' *** "', name, '" is a non-selected talent.') return end + if GetSpellInfo(realName or name) then - - local dynamicInfo = kb.DynamicSpells[name] - if dynamicInfo then - configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command) } - - cprint('|cFF00FFFFDynamicInfo:|r', dynamicInfo.dynamicType, table.concat(configTable.assignedKeys, ',')) - for k, v in pairs(dynamicInfo) do - --cprint(' --', k, v) - configTable[k] = v - end - isAvailable = configTable.isAvailable - elseif GetSpellInfo(actionID) then isAvailable = true end @@ -247,22 +268,30 @@ end if isAvailable then + cprint(' available', actionType, actionID, name) local attributeSuffix, attributeValue, command, target, button = kb.RegisterAction(actionType, actionID, name) - local actionKey = actionPrefix .. attributeSuffix - cprint('|cFF00FF88LoadBinding()|r', button:GetName(), "*type-"..attributeSuffix, actionType, '|cFFFFFF00'..actionKey, attributeValue, isAvailable) + local actionKey = tostring(actionPrefix) .. tostring(attributeSuffix) + + if not attributeSuffix then + cprint('failed to generate button attribute') + return + end + + + cprint('|cFF00FF88 result:|r', button and button:GetName(), "*type-"..tostring(attributeSuffix), actionType, '|cFFFFFF00'..actionKey, attributeValue, isAvailable) kb.SecureAttribute(button, "*type-"..attributeSuffix, specialButtonType or actionType) kb.SecureAttribute(button, actionKey, attributeValue) - cprint('|cFFFF4400add', name, isAvailable, indexKey, unpack(configTable.assignedKeys)) + cprint(' |cFFFF4400add', name, isAvailable, indexKey, unpack(configTable.assignedKeys)) kb.bindings[indexKey] = configTable.assignedKeys commandActions[command] = kb.bindings[indexKey] return command, kb.bindings[indexKey] else if kb.bindings[indexKey] then - cprint('|cFFFF4400remove', name, isAvailable, indexKey, unpack(configTable.assignedKeys)) + cprint(' |cFFFF4400remove', name, isAvailable, indexKey, unpack(configTable.assignedKeys)) kb.bindings[indexKey] = nil end @@ -555,7 +584,7 @@ kb.DynamicSpells.profession[spellID] = profInfo kb.DynamicSpells.profession[i] = kb.DynamicSpells.profession[i] or {} kb.DynamicSpells.profession[i][j] = profInfo - --print(' |cFF0088FF['..i..']|r|cFFFF44BB['..spellOffset+i..']|r', spellName, "profession_"..i .. '_' ..j) + cprint(' |cFF0088FF['..i..']|r|cFFFF44BB['..j..']|r', spellName, "profession_"..i .. '_' ..j) end end
--- a/KeyButton.lua Mon Apr 17 13:28:20 2017 -0400 +++ b/KeyButton.lua Sun May 28 12:45:32 2017 -0400 @@ -54,16 +54,25 @@ [212653] = { actionName = 'Blink', actionID = 1953, + icon = [[Interface\\ICONS\\spell_arcane_blink]] }, -- Sidewinders; have to assume arcane sadly [214579] = { actionName = 'Arcane Shot', actionID = 185358, + icon = [[Interface\\ICONS\\ability_impalingbolt]] }, -- Serenity [152173] = { actionName = 'Storm, Earth, and Fire', - actionID = 137639 + actionID = 137639, + icon = [[Interface\\ICONS\\spell_nature_giftofthewild]] + }, + -- Carve + [212436] = { + actionName = 'Carve', + actionID = 187708, + icon = [[Interface\\ICONS\\ability_hunter_carve]] } } @@ -196,6 +205,11 @@ if actionType == 'spell' then local realName = GetSpellInfo(subData) name, _, icon, _, _, _, actionID = GetSpellInfo(subData) + + if TALENT_SPELLS[actionID] then + name = TALENT_SPELLS[actionID].actionName + actionID = TALENT_SPELLS[actionID].actionID + icon = TALENT_SPELLS[actionID].icon elseif actionType == 'macro' then name, icon, macroText = GetMacroInfo(actionID) macroName = name
--- a/SkeletonKey.lua Mon Apr 17 13:28:20 2017 -0400 +++ b/SkeletonKey.lua Sun May 28 12:45:32 2017 -0400 @@ -320,7 +320,7 @@ print('|cFF0088FF'..self:GetName()..':OnLoad()') self.CloseButton:SetScript('OnClick', CloseButton_OnClick) - self:RegisterEvent('PLAYER_ENTERING_WORLD') + --self:RegisterEvent('PLAYER_ENTERING_WORLD') self:RegisterEvent('ADDON_LOADED') self:RegisterEvent('PLAYER_LOGIN') self:RegisterUnitEvent('PLAYER_SPECIALIZATION_CHANGED', 'player') @@ -375,6 +375,7 @@ kb.UpdateSpecInfo() kb.UpdateTalentInfo() + kb.UpdateProfessionInfo() kb.SelectProfileSet(kb.profileName) self:SetShown(kb.db.showUI) -- todo: redo import checking