# HG changeset patch # User Nick@Zahhak # Date 1490077403 14400 # Node ID b9a53385462cbd78faa2c9de616aaa62c6999ecf # Parent ac9e48125660ff2a93b7b4fbd471966999ee3db7 - Fixed Demon Hunter Vengeance bindings, along with other spells that are replaced by specialization variants. - Spells replaced by a specialization now display the replacing name along with the original name in their binding slot. diff -r ac9e48125660 -r b9a53385462c ActionTemplates.lua --- a/ActionTemplates.lua Thu Jan 26 20:27:06 2017 -0500 +++ b/ActionTemplates.lua Tue Mar 21 02:23:23 2017 -0400 @@ -125,25 +125,27 @@ return spells[spellID] end --- tries to resolve spells from talent overrides/profession book/etc +-- verifies binding slot data local dynamicTypes = {['profession'] = 'ProfessionCache', ['talent'] = 'TalentCache', ['petaction'] = 'PetInfoCache'} kb.ResolveSpellSlot = function(self) local spellName, spellID, command, icon = self.actionName, self.actionID, self.command, self.iconPath - --print(' In:', spellName, spellID, command) + --print(GetSpellInfo(spellName or spellID)) - local internalName, _, internalIcon, _, _, _, _ = GetSpellInfo(spellName or spellID) + local internalName, _, internalIcon, _, _, _, _ = GetSpellInfo(spellID) + local replacerName, _, _, _, _, _, replacerID = GetSpellInfo(internalName) + print('Resolve Slot: id =', spellID, 'nameFromID =', internalName, 'nameFromName =', replacerName) local isAvailable = internalName and true - if internalName and (internalName ~= spellName) then - -- it's a binding for the originating spell, leave it as is - print(' |cFFFF4400spell is an override(', internalName, '~=', spellName,') leave the name info alone') + -- keep current slotInfo if it's a spell that has been replaced by spec/talent + if internalName and (internalName ~= replacerName) then + print(' |cFFFF4400spell name is overridden by', replacerName, '(was', internalName,')') self.statusText = '|cFFFFFF00Spell|r' self.isAvailable = true return end - -- let's us match spells replaced by talents - local info = kb.DynamicSpells[internalName or spellName] + -- resolve spell name + local info = kb.DynamicSpells[spellName] if not info then local dynamicType, dynamicIndex, dynamicSubIndex = command:match("(%a+)_(%S+)_(%S+)") if kb.DynamicSpells[dynamicType] then @@ -198,8 +200,16 @@ local isAvailable local specialButtonType if actionType == 'spell' then - cprint(GetSpellInfo(actionID)) - local dynamicInfo = kb.DynamicSpells[name] + local realName, _, _, _, _, _, realID = GetSpellInfo(name) + if realName and (realName ~= name) then + print(' *** "', name, '" resolves to something else...', realName, realID) + --name, actionID = realName, realID + indexKey = actionType .. '_'.. realID + end + + + + local dynamicInfo = kb.DynamicSpells[spellName] if dynamicInfo then configTable.assignedKeys = configTable.assignedKeys or {GetBindingKey(configTable.command) } diff -r ac9e48125660 -r b9a53385462c BindingsFrame.lua --- a/BindingsFrame.lua Thu Jan 26 20:27:06 2017 -0500 +++ b/BindingsFrame.lua Tue Mar 21 02:23:23 2017 -0400 @@ -508,7 +508,7 @@ --- Associate processed input with the given slot's metadata function skb:SaveSlot (key) - + print('SaveSlot()', key) if not self.command then return end @@ -564,6 +564,7 @@ SetBinding(binding, self.command) SaveBindings(GetCurrentBindingSet()) self.assignedKeys = {GetBindingKey(self.command) } + print(' new assigns:', unpack(self.assignedKeys)) kb.UpdateBindingsCache(self.actionType, self.actionID, self.assignedKeys) kb:print(L('BINDING_ASSIGNED', binding, self.actionName, kb.currentHeader)) else diff -r ac9e48125660 -r b9a53385462c KeyButton.lua --- a/KeyButton.lua Thu Jan 26 20:27:06 2017 -0500 +++ b/KeyButton.lua Tue Mar 21 02:23:23 2017 -0400 @@ -22,7 +22,8 @@ local BORDER_UNASSIGNED = {0.6,0.6,0.6,1} local BORDER_ASSIGNED = {1,1,1,1} local BORDER_DYNAMIC = {1,1,0,1} -local BORDER_PENDING = {1,0.5,0,1 } +local BORDER_PENDING = {1,0.5,0,1} +local BORDER_REPLACED = {0,1,.5,1} local BUTTON_HEADERS = { ['spell'] = SPELLS, ['macro'] = MACRO, @@ -144,7 +145,7 @@ elseif click == 'RightButton' then self:ReleaseSlot() else - kb.ProcessInput(strupper(click)) + SkeletonKey:ProcessInput(strupper(click)) end SkeletonKey:Update() end @@ -174,9 +175,8 @@ local pickupID, pickupBook if actionType == 'spell' then - actionID = subData - name, _, icon = GetSpellInfo(actionID) - + local realName = GetSpellInfo(subData) + name, _, icon, _, _, _, actionID = GetSpellInfo(subData) elseif actionType == 'macro' then name, icon, macroText = GetMacroInfo(actionID) macroName = name @@ -311,13 +311,16 @@ end local borderType = BORDER_UNASSIGNED - + local displayName = self.actionName + local displayTexture = self.iconPath + local altName, altTexture if self.command then - print('|cFFFF4400', self.actionName, #self.assignedKeys, table.concat(self.assignedKeys, ',')) - print(self.isAvailable) - print(self.actionID) + print('|cFFFF4400:', self.actionName, #self.assignedKeys, table.concat(self.assignedKeys, ',')) + print('|cFF00FF88:', self.isAvailable, self.actionID) + self.bindingText= kb.BindingString(unpack(self.assignedKeys)) + if not self.isAvailable then borderType = BORDER_DYNAMIC self.ignoreTexture:Show() @@ -338,7 +341,14 @@ else self.macro:Hide() if self.actionType == 'spell' then - self.isAvailable = GetSpellInfo(self.actionName) and true or false + altName, _, altTexture = GetSpellInfo(self.actionName) + self.isAvailable = displayName and true or false + if altName and (altName ~= self.actionName) then + displayName = '|cFFFFFF00'..altName..'|r ('..self.actionName..')' + displayTexture = altTexture + borderType = BORDER_REPLACED + end + end end @@ -363,14 +373,7 @@ end - if self.actionType == 'spell' then - self.icon:SetTexture(GetSpellTexture(self.actionID)) - end print('|cFF00BBFFUpdateSlot|r:', '['..slot..'] =', self.command, self.bindingText, self.dynamicType, self.isAvailable, self.actionID) - else - if kb.saveTarget == self then - kb.DeactivateSlot(self) - end end @@ -394,18 +397,23 @@ --self.alert:SetShown(self.command and not self.isBound) - self.icon:SetTexture(self.iconPath) + self.icon:SetTexture(displayTexture) self.border:SetColorTexture(unpack(borderType)) self.header:SetText(self.statusText) self.bind:SetText(self.bindingText) - self.details:SetText(self.actionName) + self.details:SetText(displayName) end --- Resets button command function skb:ReleaseSlot () local slot = self:GetID() + -- keep right click from deleting an assignment during bind mode + if kb.saveTarget == self then + self:GetParent():DeactivateSlot(self) + return + end if kb.currentProfile.buttons[slot] then kb.currentProfile.buttons[slot] = nil @@ -597,9 +605,14 @@ self:EnableKeyboard(true) -- this is done to keep legacy key-values from breaking algorithm assumptions - print(slotInfo.assignedKeys) - print(GetBindingKey(command)) - self.assignedKeys = slotInfo.assignedKeys or {GetBindingKey(command)} + print('assigned', table.concat(slotInfo.assignedKeys,', ')) + + if #slotInfo.assignedKeys == 0 then + print('updating assigned table to:', GetBindingKey(command)) + slotInfo.assignedKeys = {GetBindingKey(command) } + end + + self.assignedKeys = slotInfo.assignedKeys local slotInfo = { command = command,