comparison SkeletonKey/ActionTemplates.lua @ 34:daff39af0c6d

changeset logjam
author Nenue
date Tue, 16 Aug 2016 10:24:55 -0400
parents b0e4d04d428a
children 9a9d7f2a7c07
comparison
equal deleted inserted replaced
33:d5e6b2265d6f 34:daff39af0c6d
12 local PetHasSpellbook, PetHasActionBar, GetPetActionInfo, HasPetSpells = PetHasSpellbook, PetHasActionBar, GetPetActionInfo, HasPetSpells 12 local PetHasSpellbook, PetHasActionBar, GetPetActionInfo, HasPetSpells = PetHasSpellbook, PetHasActionBar, GetPetActionInfo, HasPetSpells
13 local GetProfessions, GetProfessionInfo, GetTalentInfo = GetProfessions, GetProfessionInfo, GetTalentInfo 13 local GetProfessions, GetProfessionInfo, GetTalentInfo = GetProfessions, GetProfessionInfo, GetTalentInfo
14 local GetNumBindings, GetBinding = GetNumBindings, GetBinding 14 local GetNumBindings, GetBinding = GetNumBindings, GetBinding
15 15
16 local kb, print, wrap = LibStub('LibKraken').register(KeyBinder, 'Info') 16 local kb, print, wrap = LibStub('LibKraken').register(KeyBinder, 'Info')
17 local cprint = DEVIAN_WORKSPACE and function(...) _G.print('Cfg', ...) end or function() end 17 local cprint = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('Cfg', ...) end or function() end
18 18
19 local CLICK_KEYBINDER_MACRO = "CLICK KeyBinderMacro:" 19 local CLICK_KEYBINDER_MACRO = "CLICK KeyBinderMacro:"
20 local CLICK_KEYBINDER_KEY = "CLICK KeyBinderKey:" 20 local CLICK_KEYBINDER_KEY = "CLICK KeyBinderKey:"
21 local PET_BASIC_SUBTEXT = 'Basic Attack' 21 local PET_BASIC_SUBTEXT = 'Basic Attack'
22 local PET_SPECIAL_SUBTEXT = 'Special Ability' 22 local PET_SPECIAL_SUBTEXT = 'Special Ability'
300 300
301 301
302 302
303 kb.UpdatePetInfo = function() 303 kb.UpdatePetInfo = function()
304 local hasPetSpells, petType = HasPetSpells() 304 local hasPetSpells, petType = HasPetSpells()
305
306 --kb.PetCache.specNum = GetSpecialization(nil, true)
307 --kb.PetCache.specID, kb.PetCache.specName = GetSpecializationInfo(petSpec, nil, true)
308
305 if PetHasSpellbook() then 309 if PetHasSpellbook() then
306 print('PET SPELLBOOK') 310 print('PET SPELLBOOK')
307 local i = 1 311 local i = 1
308 local specialNum = {} 312 local specialNum = {}
309 repeat 313 repeat
316 if spellName then 320 if spellName then
317 kb.PetCache.spellslot[spellName] = {i, spellName, subText, spellID, texture} 321 kb.PetCache.spellslot[spellName] = {i, spellName, subText, spellID, texture}
318 print('|cFF00FF88spellslot['..spellName..']|r', '=>', i, subText) 322 print('|cFF00FF88spellslot['..spellName..']|r', '=>', i, subText)
319 323
320 if subText then 324 if subText then
325 -- make sure that pet specialization subtext maps correctly
326 --if match(subText, kb.PetCache.specName) then
327 -- subText = 'specialization'
328 --end
329
321 kb.PetCache.subtext[subText] = kb.PetCache.subtext[subText] or {} 330 kb.PetCache.subtext[subText] = kb.PetCache.subtext[subText] or {}
322 specialNum[subText] = (specialNum[subText] or 0) + 1 331 specialNum[subText] = (specialNum[subText] or 0) + 1
323 332
324 local entry = {i, spellName, subText, spellID, texture, specialNum[subText]} 333 local entry = {i, spellName, subText, spellID, texture, specialNum[subText]}
325 334
372 kb.UpdateSystemBinds = function() 381 kb.UpdateSystemBinds = function()
373 wipe(kb.SystemBindings) 382 wipe(kb.SystemBindings)
374 local n = GetNumBindings() 383 local n = GetNumBindings()
375 for i=1, n do 384 for i=1, n do
376 local command, key1, key2 = GetBinding(i) 385 local command, key1, key2 = GetBinding(i)
377 if key1 then 386 if not command:match('ACTION.*%d+') then
378 kb.SystemBindings[key1] = command 387 if key1 then
379 end 388 kb.SystemBindings[key1] = command
380 if key2 then 389 end
381 kb.SystemBindings[key2] = command 390 if key2 then
391 kb.SystemBindings[key2] = command
392 end
393 else
394 print('ignoring action button binding', command)
382 end 395 end
383 end 396 end
384 end 397 end
385 398
386 kb.UpdateDynamicButtons = function(dynamicType) 399 kb.UpdateDynamicButtons = function(dynamicType)
392 end 405 end
393 406
394 kb.pendingAttributes = {} 407 kb.pendingAttributes = {}
395 kb.SecureAttribute = function(target, name, value) 408 kb.SecureAttribute = function(target, name, value)
396 if InCombatLockdown() then 409 if InCombatLockdown() then
410 if #kb.pendingAttributes == 0 then
411 kb:Print(kb.L('Key bindings will be applied when you exit combat.'))
412 end
413
397 tinsert(kb.pendingAttributes, {target, name, value}) 414 tinsert(kb.pendingAttributes, {target, name, value})
398 kb:RegisterEvent('PLAYER_REGEN_ENABLED') 415 kb:RegisterEvent('PLAYER_REGEN_ENABLED')
416
399 else 417 else
400 418
401 print(target:GetName(), 'attribute', '"'.. tostring(name)..'" = "'..tostring(value)..'"') 419 print(target:GetName(), 'attribute', '"'.. tostring(name)..'" = "'..tostring(value)..'"')
402 target:SetAttribute(name, value) 420 target:SetAttribute(name, value)
403 end 421 end