diff SkeletonKey/KeyButton.lua @ 30:b0e4d04d428a

- use a fixed loop to parse GetProfessions() result so unlearned secondaries don't break the cache - removed a bad varaible reference that was causing confirmation popup to barf
author Nenue
date Fri, 05 Aug 2016 19:41:18 -0400
parents bb160c04de88
children daff39af0c6d
line wrap: on
line diff
--- a/SkeletonKey/KeyButton.lua	Fri Aug 05 12:25:18 2016 -0400
+++ b/SkeletonKey/KeyButton.lua	Fri Aug 05 19:41:18 2016 -0400
@@ -27,6 +27,15 @@
 
 }
 
+local PROFESSION_HEADERS = {
+  [1] = 'Profession 1',
+  [2] = 'Profession 2',
+  [3] = 10,
+  [4] = 7,
+  [5] = 9,
+  [6] = 5
+}
+
 -- This is needed to identify a spells that aren't reflected by GetCursorInfo()
 kb.OnPickupPetAction = function(slot, ...)
   local isPickup = GetCursorInfo()
@@ -387,7 +396,7 @@
     end
 
     if self.isDynamic == 'profession'  then
-      if self.isAvailable then
+      if self.profIndex then
 
         local profText = (self.spellNum == 1) and TRADE_SKILLS or (BUTTON_HEADERS[self.profIndex] or GetProfessionInfo(self.profIndex))
         print(self.profIndex, 'spnum', type(self.spellNum), (self.spellNum == 1))
@@ -396,7 +405,7 @@
         self.bindingText = kb.BindingString(GetBindingKey(self.command))
       else
 
-        self.statusText = '|cFFFF4400Profession|r'
+        self.statusText = '|cFFFF4400'..PROFESSION_HEADERS[self.professionNum]..'|r'
         self.actionName = '(#'..self.professionNum..')'
         self.bindingText ='?'
       end
@@ -529,6 +538,16 @@
           actionID = cacheInfo.spellID
           self.profIndex = cacheInfo.profIndex
           self.spellOffset = cacheInfo.spellOffset
+        else
+          print(professionNum, type(professionNum), PROFESSION_HEADERS[tonumber(professionNum)])
+          local profID = PROFESSION_HEADERS[tonumber(professionNum)]
+          if type(profID) == 'number' then
+            local pname, texture, _, _, numSpells, spellOffset = GetProfessionInfo(profID)
+            self.profIndex = profID
+          else
+            name = profID
+          end
+
         end
         print(' Special slot: |cFF00FFFFProfession|r', professionNum, spellNum, isDynamic, isAvailable)
 
@@ -548,7 +567,7 @@
       local specialType, specialNum = command:match(actionType..'_([%a%s]+)_(%d)')
 
       if kb.PetCache.subtext[specialType] and kb.PetCache.subtext[specialType][tonumber(specialNum)] then
-        print('***dynamic pet thign', specialType, specialNum)
+        print('***dynamic pet skill', specialType, specialNum)
         --[[ i, spellName, subText, spellID,  texture, specialNum[subText ]]
         pickupSlot, name, specialType, actionID, icon, specialNum = unpack(kb.PetCache.subtext[specialType][tonumber(specialNum)])
         pickupBook = BOOKTYPE_PET