Mercurial > wow > skeletonkey
comparison KeyButton.lua @ 71:ca3118127e5e
- Talent change detection
- Use stored assignments for inactive talent slots
| author | Nenue |
|---|---|
| date | Fri, 06 Jan 2017 16:21:49 -0500 |
| parents | 131d9190db6b |
| children | c48913c5924c |
comparison
equal
deleted
inserted
replaced
| 70:131d9190db6b | 71:ca3118127e5e |
|---|---|
| 354 self.statusText = '|cFFFF4400'..PROFESSION_HEADERS[self.dynamicIndex]..'|r' | 354 self.statusText = '|cFFFF4400'..PROFESSION_HEADERS[self.dynamicIndex]..'|r' |
| 355 self.actionName = '(#'..self.dynamicIndex..')' | 355 self.actionName = '(#'..self.dynamicIndex..')' |
| 356 self.bindingText ='?' | 356 self.bindingText ='?' |
| 357 end | 357 end |
| 358 elseif self.dynamicType == 'talent' then | 358 elseif self.dynamicType == 'talent' then |
| 359 | |
| 360 self.statusText = '|cFF00FFFF'.. TALENT .. '|r' | 359 self.statusText = '|cFF00FFFF'.. TALENT .. '|r' |
| 361 if self.isAvailable then | 360 if self.isAvailable then |
| 362 self.bindingText = kb.BindingString(GetBindingKey(self.command)) | 361 self.bindingText = kb.BindingString(GetBindingKey(self.command)) |
| 363 else | 362 else |
| 364 if kb.TalentBindings[self.actionID] then | 363 |
| 365 print(self.actionID, #kb.TalentBindings[self.actionID]) | 364 print('|cFFFF4400', self.actionName, #self.assignedKeys, self.assignedKeys) |
| 366 self.bindingText= kb.BindingString(unpack(kb.TalentBindings[self.actionID])) | 365 print(self.actionID) |
| 367 end | 366 self.bindingText= kb.BindingString(self.assignedKeys) |
| 368 | |
| 369 end | 367 end |
| 370 elseif self.dynamicType == 'petaction' then | 368 elseif self.dynamicType == 'petaction' then |
| 371 self.bindingText = kb.BindingString(GetBindingKey(self.command)) | 369 self.bindingText = kb.BindingString(GetBindingKey(self.command)) |
| 372 else | 370 else |
| 373 self.bindingText = kb.BindingString(GetBindingKey(self.command)) | 371 self.bindingText = kb.BindingString(GetBindingKey(self.command)) |
| 532 info = SkeletonKey_GetGenericSpell(spellName, spellID, internalIcon or icon) | 530 info = SkeletonKey_GetGenericSpell(spellName, spellID, internalIcon or icon) |
| 533 end | 531 end |
| 534 end | 532 end |
| 535 info.isAvailable = isAvailable | 533 info.isAvailable = isAvailable |
| 536 | 534 |
| 537 cprint('|cFF00FF88SpellDetails:|r', info.actionName, info.actionID, info.dynamicType) | 535 cprint('|cFF00FF88SpellDetails:|r', info.actionName, info.actionID, info.dynamicType, info.isAvailable) |
| 538 for k,v in pairs(info) do | 536 for k,v in pairs(info) do |
| 539 cprint(' ',k,v) | 537 --cprint(' ',k,v) |
| 540 self[k] = v | 538 self[k] = v |
| 541 end | 539 end |
| 542 | 540 |
| 543 return info | 541 return info |
| 544 end | 542 end |
| 563 | 561 |
| 564 isBound = kb.IsCommandBound(self, self.command) | 562 isBound = kb.IsCommandBound(self, self.command) |
| 565 if actionType == 'spell' then | 563 if actionType == 'spell' then |
| 566 local info = SkeletonKey_GetSpellDetails(self) | 564 local info = SkeletonKey_GetSpellDetails(self) |
| 567 name, icon, actionType, actionID, macroName, macroText, pickupSlot, pickupBook = self.actionName, self.iconPath, self.actionType, self.actionID, self.macroName, self.macroText, self.spellbookSlot, self.spellbookType | 565 name, icon, actionType, actionID, macroName, macroText, pickupSlot, pickupBook = self.actionName, self.iconPath, self.actionType, self.actionID, self.macroName, self.macroText, self.spellbookSlot, self.spellbookType |
| 568 | 566 self.isAvailable = info and info.isAvailable |
| 569 elseif actionType == 'petaction' then | 567 elseif actionType == 'petaction' then |
| 570 self.dynamicType = 'petaction' | 568 self.dynamicType = 'petaction' |
| 571 local specialType, specialNum = command:match(actionType..'_([%a%s]+)_(%d)') | 569 local specialType, specialNum = command:match(actionType..'_([%a%s]+)_(%d)') |
| 572 | 570 |
| 573 if kb.PetCache.subtext[specialType] then | 571 if kb.PetCache.subtext[specialType] then |
| 640 | 638 |
| 641 actionID = actionID or 0 | 639 actionID = actionID or 0 |
| 642 self:EnableKeyboard(true) | 640 self:EnableKeyboard(true) |
| 643 | 641 |
| 644 -- this is done to keep legacy key-values from breaking algorithm assumptions | 642 -- this is done to keep legacy key-values from breaking algorithm assumptions |
| 643 print(slotInfo.assignedKeys) | |
| 644 print(GetBindingKey(command)) | |
| 645 self.assignedKeys = slotInfo.assignedKeys or {GetBindingKey(command)} | |
| 646 | |
| 645 local slotInfo = { | 647 local slotInfo = { |
| 646 command = command, | 648 command = command, |
| 647 actionName = name, | 649 actionName = name, |
| 648 iconPath = icon, | 650 iconPath = icon, |
| 649 actionID = actionID, | 651 actionID = actionID, |
| 650 actionType = actionType, | 652 actionType = actionType, |
| 651 macroName = macroName, | 653 macroName = macroName, |
| 652 macroText = macroText, | 654 macroText = macroText, |
| 653 spellbookSlot = pickupSlot, | 655 spellbookSlot = pickupSlot, |
| 654 spellbookType = pickupBook, | 656 spellbookType = pickupBook, |
| 655 assignedKeys = {GetBindingKey(command)} | 657 assignedKeys = slotInfo.assignedKeys, |
| 658 dynamicType = self.dynamicType, | |
| 659 dynamicID = self.dynamicID, | |
| 660 dynamicIndex = self.dynamicIndex, | |
| 661 dynamicSubIndex = self.dynamicSubIndex | |
| 656 } | 662 } |
| 657 kb.currentProfile.buttons[slot] = slotInfo | 663 kb.currentProfile.buttons[slot] = slotInfo |
| 658 | 664 |
| 659 -- Clean up conflicting entries for loaded button | 665 -- Clean up conflicting entries for loaded button |
| 660 local previous = kb.currentProfile.commands[command] | 666 local previous = kb.currentProfile.commands[command] |
| 679 end | 685 end |
| 680 | 686 |
| 681 kb.currentProfile.commands[command] = slot | 687 kb.currentProfile.commands[command] = slot |
| 682 end | 688 end |
| 683 | 689 |
| 684 | 690 --self.assignedKeys = slotInfo.assignedKeys |
| 685 | |
| 686 self.isBound = isBound | 691 self.isBound = isBound |
| 687 self.pickupSlot = pickupSlot | 692 self.pickupSlot = pickupSlot |
| 688 self.pickupBook = pickupBook | 693 self.pickupBook = pickupBook |
| 689 self.macroText = macroText | 694 self.macroText = macroText |
| 690 self.macroName = macroName | 695 self.macroName = macroName |
