changeset 86:d6831be74cf4

Partial functionality updates for 8.0
author Nenue
date Tue, 17 Jul 2018 14:46:43 -0400
parents 94a279e9c5a9
children b80e78f4a17b
files ActionTemplates.lua SkeletonKey.lua SkeletonKey.xml
diffstat 3 files changed, 72 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/ActionTemplates.lua	Tue Jul 17 14:38:50 2018 -0400
+++ b/ActionTemplates.lua	Tue Jul 17 14:46:43 2018 -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
 
@@ -472,6 +501,7 @@
     end
   end
 
+--[[
   for row = 1, MAX_PVP_TALENT_TIERS do
     for col = 1, MAX_PVP_TALENT_COLUMNS do
       local talentID, talentName, icon, selected, available, spellID, unlocked = GetPvpTalentInfo(row, col, 1)
@@ -480,6 +510,7 @@
       end
     end
   end
+  --]]
 
   local numTabs = GetNumSpellTabs()
   for i = 1, numTabs do
@@ -555,7 +586,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/SkeletonKey.lua	Tue Jul 17 14:38:50 2018 -0400
+++ b/SkeletonKey.lua	Tue Jul 17 14:46:43 2018 -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
--- a/SkeletonKey.xml	Tue Jul 17 14:38:50 2018 -0400
+++ b/SkeletonKey.xml	Tue Jul 17 14:46:43 2018 -0400
@@ -24,11 +24,11 @@
       <OnLoad method="OnLoad" />
       <OnEvent method="OnEvent" />
       <OnShow method="OnShow" />
-      <OnUpdate method="OnUpdate" />
+      <!--<OnUpdate method="OnUpdate" />-->
       <OnKeyDown method="OnKeyDown" />
       <OnKeyUp method="OnKeyUp" />
-      <OnMouseDown method="OnMouseDown" />
-      <OnMouseUp method="OnMouseUp" />
+      <!--<OnMouseDown method="OnMouseDown" />
+      <OnMouseUp method="OnMouseUp" />-->
       <OnMouseWheel method="OnMouseWheel" />
       <OnDragStart method="OnDragStart" />
       <OnDragStop method="OnDragStop" />
@@ -142,7 +142,7 @@
           <OnEvent method="OnEvent" />
         </Scripts>
       </Frame>
-
+<!--
       <Frame name="KeyBinderTutorial" parent="KeyBinder">
 
         <Size x="20" y="20" />
@@ -159,7 +159,7 @@
               </Anchors>
               <TexCoords left="0.0019531" right="0.1484375" top="0.4257813" bottom="0.6210938"/>
             </Texture>
-            <FontString inherits="KTLogString" text="to change a key binding.">
+            <FontString inherits="SkeletonKeyButtonFont" text="to change a key binding.">
               <Anchors>
                 <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentMouseLeftClick" x="2" y="0" />
               </Anchors>
@@ -172,7 +172,7 @@
               </Anchors>
               <TexCoords left="0.0019531" right="0.1484375" top="0.6269531" bottom="0.8222656"/>
             </Texture>
-            <FontString inherits="KTLogString" text="to remove actions from profile.">
+            <FontString inherits="SkeletonKeyButtonFont" text="to remove actions from profile.">
               <Anchors>
                 <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentMouseRightClick" x="2" y="0" />
               </Anchors>
@@ -180,7 +180,7 @@
 
           </Layer>
         </Layers>
-      </Frame>
+      </Frame>-->
 
       <Button inherits="UIPanelCloseButton" parentKey="CloseButton">
         <Anchors>
@@ -193,7 +193,7 @@
         <Size  y="32" x="32" />
         <Layers>
           <Layer level="OVERLAY">
-            <FontString parentKey="header" inherits="KTLogString" text="Sticky Mode:" />
+            <FontString parentKey="header" inherits="SkeletonKeyButtonFont" text="Sticky Mode:" />
           </Layer>
         </Layers>
       </CheckButton>
@@ -205,7 +205,7 @@
         </Anchors>
         <Layers>
           <Layer level="OVERLAY">
-            <FontString parentKey="header" inherits="KTLogString" text="Bind" />
+            <FontString parentKey="header" inherits="SkeletonKeyButtonFont" text="Bind" />
             <FontString inherits="SkeletonKeyHeaderFont" text="Settings">
               <Anchors>
                 <Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT" x="0" y="32" />
@@ -222,7 +222,7 @@
         </Anchors>
         <Layers>
           <Layer level="OVERLAY">
-            <FontString parentKey="header" inherits="KTLogString" text="Safe" />
+            <FontString parentKey="header" inherits="SkeletonKeyButtonFont" text="Safe" />
           </Layer>
         </Layers>
       </CheckButton>
@@ -329,7 +329,7 @@
     <Scripts>
       <OnLoad method="OnLoad" />
       <OnShow method="OnShow" />
-      <OnEvent method="OnEvent" />
+      <!--<OnEvent method="OnEvent" />-->
     </Scripts>
     <Layers>
       <Layer level="BACKGROUND">
@@ -391,8 +391,10 @@
       </Button>
     </Frames>
   </Frame>
+
+  <!--
   <Frame name="$parentSystemBindings" mixin="SkeletonKeySystemBindingsMixin" inherits="SkeletonKeyPanelTemplate" />
-
+-->
   <Button name="SkeletonKeyTabTemplate" parentArray="tabButtons" virtual="true">
     <Size x="48" y="32" />
     <Layers>