changeset 32:34a2e8d93448

Backed out changeset: 67db6b712bf3
author Nenue
date Fri, 05 Aug 2016 19:50:52 -0400
parents ea92db3bd1a5
children d5e6b2265d6f
files .pkgmeta LibKraken/LibKraken-1.0.xml SkeletonKey/DynamicTypes.lua
diffstat 3 files changed, 177 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/.pkgmeta	Fri Aug 05 19:41:44 2016 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-externals:
-    libs/LibStub:
-        url: svn://svn.wowace.com/wow/libstub/mainline/trunk
-        tag: latest
-move-folders:
-    LibKraken: libs/LibKraken-1.0
-ignore:
-    .idea
-    SkeletonKey.iml
-
-package-as: SkeletonKey
-enable-nolib-creation: no
\ No newline at end of file
--- a/LibKraken/LibKraken-1.0.xml	Fri Aug 05 19:41:44 2016 -0400
+++ b/LibKraken/LibKraken-1.0.xml	Fri Aug 05 19:50:52 2016 -0400
@@ -7,7 +7,7 @@
     <Color a="1" r="1" g="1" b="1" />
   </Font>
 
-  <Font name="KTHeaderFont" height="18" font="Fonts\skurri.ttf" outline="NORMAL" justifyH="LEFT" justifyV="TOP" virtual="true" inherits="NumberFont_Outline_Huge" />
+  <Font name="KTHeaderFont" height="18" justifyH="LEFT" justifyV="TOP" virtual="true" inherits="NumberFont_Outline_Huge" />
   <Font name="KTHeader2Font" height="14" font="Fonts\skurri.ttf" outline="NORMAL" justifyH="LEFT" justifyV="TOP" virtual="true" />
   <Font name="KTUIPanelFont" justifyH="LEFT" virtual="true"  inherits="NumberFontNormal"  />
   <Font name="KTMacroButtonFont" height="12" font="Fonts\ARIALN.TTF" justifyH="LEFT" virtual="true" >
--- a/SkeletonKey/DynamicTypes.lua	Fri Aug 05 19:41:44 2016 -0400
+++ b/SkeletonKey/DynamicTypes.lua	Fri Aug 05 19:50:52 2016 -0400
@@ -4,3 +4,179 @@
 -- %file-revision%
 -- Logic related to dynamic handlers
 local kb, print = LibStub('LibKraken').register(KeyBinder, 'PlayerInfo')
+
+local PET_SPECIAL_SUBTEXT = 'Special Ability'
+local SECONDARY_PROFESSIONS = {
+  [5] = 3,
+  [7] = 4,
+  [9] = 5,
+  [10] = 6
+}
+
+kb.TalentCache = {}
+kb.ProfessionCache = {}
+kb.PetCache = {}
+kb.specInfo = {}
+kb.UpdateSpecInfo = function()
+  kb.specInfo.id = GetSpecialization()
+  kb.specInfo.globalID, kb.specInfo.name, kb.specInfo.desc, kb.specInfo.texture = GetSpecializationInfo(kb.specInfo.id)
+  print('|cFF00FF00current spec:|r', kb.specInfo.id, 'of', GetNumSpecializations())
+end
+
+kb.UpdateTalentInfo = function()
+  if kb.talentsPushed then
+    return
+  end
+  table.wipe(kb.TalentCache)
+  for row =1, MAX_TALENT_TIERS do
+    for col = 1, NUM_TALENT_COLUMNS do
+      local talentID, talentName, icon, selected, available, spellID = GetTalentInfo(row, col, 1)
+      local talentInfo = kb.TalentCache[spellID] or {}
+      talentInfo.row = 1
+      talentInfo.col = col
+      talentInfo.name = talentName
+      talentInfo.talentID = talentID
+      talentInfo.selected = selected
+      talentInfo.available = available
+      talentInfo.spellID = spellID
+      kb.TalentCache[spellID] = talentInfo
+      kb.TalentCache[talentName] = talentInfo
+      print('Talent ', row, col, spellID, talentName)
+    end
+  end
+  kb.talentsPushed = true
+
+  kb.UpdateDynamicButtons('talent')
+end
+
+kb.UpdateProfessionInfo = function()
+  table.wipe(kb.ProfessionCache)
+  local profs = {GetProfessions() }
+  local primaryNum = 0
+  for i, index in ipairs(profs) do
+    local profName, texture, rank, maxRank, numSpells, spellOffset = GetProfessionInfo(index)
+    print(i, index, profName, numSpells, spellOffset)
+    if not SECONDARY_PROFESSIONS[index] then
+      primaryNum = primaryNum + 1
+    end
+    local profNum = SECONDARY_PROFESSIONS[index] or primaryNum
+
+
+    kb.ProfessionCache[profNum] = kb.ProfessionCache[i] or {}
+
+    for j = 1, numSpells do
+      local spellName, _, icon, _, _, _, spellID = GetSpellInfo(spellOffset+j, BOOKTYPE_PROFESSION)
+
+      local profInfo = {
+        spellName = spellName,
+        spellID = spellID,
+        icon = icon,
+        profOffset = i,
+        profIndex = index,
+        spellOffset = (spellOffset+j),
+        spellNum = j
+      }
+      KeyBinderKey:SetAttribute("*type-profession_"..i .. '_' ..j, "spell")
+      KeyBinderKey:SetAttribute("*spell-profession_"..i .. '_' ..j, spellName)
+
+      kb.ProfessionCache[i .. '_' .. j] = profInfo
+      kb.ProfessionCache[spellName] = profInfo
+      kb.ProfessionCache[spellID] = profInfo
+      print('  |cFF0088FF['..i..']|r|cFFFF44BB['..spellOffset+i..']|r', spellName, "profession_"..i .. '_' ..j)
+    end
+
+  end
+
+  kb.UpdateDynamicButtons('profession')
+end
+
+
+
+kb.UpdatePetInfo = function()
+  kb.PetCache.spell = kb.PetCache.spell or {}
+  kb.PetCache.spellslot = kb.PetCache.spellslot or {}
+  kb.PetCache.action = kb.PetCache.action or {}
+  kb.PetCache.special = kb.PetCache.action or {}
+  local hasPetSpells, petType = HasPetSpells()
+  if PetHasSpellbook() then
+    print('PET SPELLBOOK')
+    local i = 1
+    local specialNum = 0
+    repeat
+
+      local spellType, spellID = GetSpellBookItemInfo(i, BOOKTYPE_PET)
+      local spellName, subText = GetSpellBookItemName(i, BOOKTYPE_PET)
+      local isPassive = IsPassiveSpell(i, BOOKTYPE_PET)
+      if not isPassive then
+        if spellName then
+          kb.PetCache.spellslot[spellName] = {i, spellName, subText}
+          print('|cFF00FF88spellslot['..spellName..']|r', '=>', i, subText)
+
+          if subText == PET_SPECIAL_SUBTEXT then
+            specialNum = specialNum + 1
+            kb.PetCache.special[spellName] = {i, specialNum, spellID, subText }
+            print('|cFF00FFFFspecial['..spellName..']|r', '=>', i, specialNum, spellID, subText)
+          end
+
+          if spellID then
+            kb.PetCache.spell[i] = {spellID, spellName, subText}
+            print('|cFF0088FFspell['..i..']|r', '=>', spellID, spellName, subText)
+          end
+        end
+
+
+      end
+
+      i = i + 1
+    until spellType == nil
+  else
+    print('NO PET SPELLBOOK')
+    table.wipe(kb.PetCache.spell)
+    table.wipe(kb.PetCache.spellslot)
+  end
+
+  if PetHasActionBar() then
+    print('PET ACTION BAR')
+    for i = 1, 10 do
+
+
+      local name, subtext, texture, isToken, isActive = GetPetActionInfo(i)
+      if name then
+        kb.PetCache.action[i] = {name, subtext, texture, isToken, isActive }
+
+
+      end
+      print('|cFFFFFF00action['..i..']|r', name, subtext, texture)
+    end
+  else
+    print('NO PET ACTION BAR')
+    table.wipe(kb.PetCache.action)
+  end
+
+  kb.UpdateDynamicButtons('petaction')
+
+end
+
+kb.SystemBinds = {}
+kb.UpdateSystemBinds = function()
+  table.wipe(kb.SystemBinds)
+  local n = GetNumBindings()
+  for i=1, n do
+    local command, key1, key2 = GetBinding(i)
+    if key1 then
+      kb.SystemBinds[key1] = command
+    end
+    if key2 then
+      kb.SystemBinds[key2] = command
+    end
+  end
+
+end
+
+kb.UpdateDynamicButtons = function(dynamicType)
+  for i, button in ipairs(kb.buttons) do
+    if button.isDynamic == dynamicType then
+      kb.UpdateSlot(button, true)
+    end
+  end
+end
\ No newline at end of file