Mercurial > wow > skeletonkey
comparison KeyButton.lua @ 80:b9a53385462c
- 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.
| author | Nick@Zahhak |
|---|---|
| date | Tue, 21 Mar 2017 02:23:23 -0400 |
| parents | d4c100b0fd01 |
| children | 9a206b105ea5 |
comparison
equal
deleted
inserted
replaced
| 79:ac9e48125660 | 80:b9a53385462c |
|---|---|
| 20 local CURSOR_SPELLSLOT, CURSOR_BOOKTYPE, CURSOR_PETACTION, CURSOR_TEXTURE | 20 local CURSOR_SPELLSLOT, CURSOR_BOOKTYPE, CURSOR_PETACTION, CURSOR_TEXTURE |
| 21 local SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544 | 21 local SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544 |
| 22 local BORDER_UNASSIGNED = {0.6,0.6,0.6,1} | 22 local BORDER_UNASSIGNED = {0.6,0.6,0.6,1} |
| 23 local BORDER_ASSIGNED = {1,1,1,1} | 23 local BORDER_ASSIGNED = {1,1,1,1} |
| 24 local BORDER_DYNAMIC = {1,1,0,1} | 24 local BORDER_DYNAMIC = {1,1,0,1} |
| 25 local BORDER_PENDING = {1,0.5,0,1 } | 25 local BORDER_PENDING = {1,0.5,0,1} |
| 26 local BORDER_REPLACED = {0,1,.5,1} | |
| 26 local BUTTON_HEADERS = { | 27 local BUTTON_HEADERS = { |
| 27 ['spell'] = SPELLS, | 28 ['spell'] = SPELLS, |
| 28 ['macro'] = MACRO, | 29 ['macro'] = MACRO, |
| 29 ['petaction'] = PET, | 30 ['petaction'] = PET, |
| 30 ['mount'] = MOUNT, | 31 ['mount'] = MOUNT, |
| 142 end | 143 end |
| 143 end | 144 end |
| 144 elseif click == 'RightButton' then | 145 elseif click == 'RightButton' then |
| 145 self:ReleaseSlot() | 146 self:ReleaseSlot() |
| 146 else | 147 else |
| 147 kb.ProcessInput(strupper(click)) | 148 SkeletonKey:ProcessInput(strupper(click)) |
| 148 end | 149 end |
| 149 SkeletonKey:Update() | 150 SkeletonKey:Update() |
| 150 end | 151 end |
| 151 | 152 |
| 152 function skb:OnDragStart() | 153 function skb:OnDragStart() |
| 172 | 173 |
| 173 local name, icon, _, macroName, macroText | 174 local name, icon, _, macroName, macroText |
| 174 local pickupID, pickupBook | 175 local pickupID, pickupBook |
| 175 | 176 |
| 176 if actionType == 'spell' then | 177 if actionType == 'spell' then |
| 177 actionID = subData | 178 local realName = GetSpellInfo(subData) |
| 178 name, _, icon = GetSpellInfo(actionID) | 179 name, _, icon, _, _, _, actionID = GetSpellInfo(subData) |
| 179 | |
| 180 elseif actionType == 'macro' then | 180 elseif actionType == 'macro' then |
| 181 name, icon, macroText = GetMacroInfo(actionID) | 181 name, icon, macroText = GetMacroInfo(actionID) |
| 182 macroName = name | 182 macroName = name |
| 183 elseif actionType == 'petaction' then | 183 elseif actionType == 'petaction' then |
| 184 if CURSOR_SPELLSLOT and CURSOR_BOOKTYPE then | 184 if CURSOR_SPELLSLOT and CURSOR_BOOKTYPE then |
| 309 self:ReleaseSlot() | 309 self:ReleaseSlot() |
| 310 end | 310 end |
| 311 end | 311 end |
| 312 | 312 |
| 313 local borderType = BORDER_UNASSIGNED | 313 local borderType = BORDER_UNASSIGNED |
| 314 | 314 local displayName = self.actionName |
| 315 local displayTexture = self.iconPath | |
| 316 local altName, altTexture | |
| 315 if self.command then | 317 if self.command then |
| 316 | 318 |
| 317 print('|cFFFF4400', self.actionName, #self.assignedKeys, table.concat(self.assignedKeys, ',')) | 319 print('|cFFFF4400:', self.actionName, #self.assignedKeys, table.concat(self.assignedKeys, ',')) |
| 318 print(self.isAvailable) | 320 print('|cFF00FF88:', self.isAvailable, self.actionID) |
| 319 print(self.actionID) | 321 |
| 320 self.bindingText= kb.BindingString(unpack(self.assignedKeys)) | 322 self.bindingText= kb.BindingString(unpack(self.assignedKeys)) |
| 323 | |
| 321 if not self.isAvailable then | 324 if not self.isAvailable then |
| 322 borderType = BORDER_DYNAMIC | 325 borderType = BORDER_DYNAMIC |
| 323 self.ignoreTexture:Show() | 326 self.ignoreTexture:Show() |
| 324 else | 327 else |
| 325 self.ignoreTexture:Hide() | 328 self.ignoreTexture:Hide() |
| 336 if self.actionType == 'macro' then | 339 if self.actionType == 'macro' then |
| 337 self.macro:Show() | 340 self.macro:Show() |
| 338 else | 341 else |
| 339 self.macro:Hide() | 342 self.macro:Hide() |
| 340 if self.actionType == 'spell' then | 343 if self.actionType == 'spell' then |
| 341 self.isAvailable = GetSpellInfo(self.actionName) and true or false | 344 altName, _, altTexture = GetSpellInfo(self.actionName) |
| 345 self.isAvailable = displayName and true or false | |
| 346 if altName and (altName ~= self.actionName) then | |
| 347 displayName = '|cFFFFFF00'..altName..'|r ('..self.actionName..')' | |
| 348 displayTexture = altTexture | |
| 349 borderType = BORDER_REPLACED | |
| 350 end | |
| 351 | |
| 342 end | 352 end |
| 343 end | 353 end |
| 344 | 354 |
| 345 | 355 |
| 346 if self.dynamicType == 'profession' then | 356 if self.dynamicType == 'profession' then |
| 361 else | 371 else |
| 362 self.icon:SetAlpha(1) | 372 self.icon:SetAlpha(1) |
| 363 end | 373 end |
| 364 | 374 |
| 365 | 375 |
| 366 if self.actionType == 'spell' then | |
| 367 self.icon:SetTexture(GetSpellTexture(self.actionID)) | |
| 368 end | |
| 369 print('|cFF00BBFFUpdateSlot|r:', '['..slot..'] =', self.command, self.bindingText, self.dynamicType, self.isAvailable, self.actionID) | 376 print('|cFF00BBFFUpdateSlot|r:', '['..slot..'] =', self.command, self.bindingText, self.dynamicType, self.isAvailable, self.actionID) |
| 370 else | |
| 371 if kb.saveTarget == self then | |
| 372 kb.DeactivateSlot(self) | |
| 373 end | |
| 374 | 377 |
| 375 end | 378 end |
| 376 | 379 |
| 377 if not self.isAvailable then | 380 if not self.isAvailable then |
| 378 self.bind:SetTextColor(.7,.7,.7,1) | 381 self.bind:SetTextColor(.7,.7,.7,1) |
| 392 self:SetAlpha(1) | 395 self:SetAlpha(1) |
| 393 end | 396 end |
| 394 | 397 |
| 395 --self.alert:SetShown(self.command and not self.isBound) | 398 --self.alert:SetShown(self.command and not self.isBound) |
| 396 | 399 |
| 397 self.icon:SetTexture(self.iconPath) | 400 self.icon:SetTexture(displayTexture) |
| 398 | 401 |
| 399 self.border:SetColorTexture(unpack(borderType)) | 402 self.border:SetColorTexture(unpack(borderType)) |
| 400 self.header:SetText(self.statusText) | 403 self.header:SetText(self.statusText) |
| 401 self.bind:SetText(self.bindingText) | 404 self.bind:SetText(self.bindingText) |
| 402 self.details:SetText(self.actionName) | 405 self.details:SetText(displayName) |
| 403 end | 406 end |
| 404 | 407 |
| 405 --- Resets button command | 408 --- Resets button command |
| 406 function skb:ReleaseSlot () | 409 function skb:ReleaseSlot () |
| 407 local slot = self:GetID() | 410 local slot = self:GetID() |
| 408 | 411 |
| 412 -- keep right click from deleting an assignment during bind mode | |
| 413 if kb.saveTarget == self then | |
| 414 self:GetParent():DeactivateSlot(self) | |
| 415 return | |
| 416 end | |
| 409 | 417 |
| 410 if kb.currentProfile.buttons[slot] then | 418 if kb.currentProfile.buttons[slot] then |
| 411 kb.currentProfile.buttons[slot] = nil | 419 kb.currentProfile.buttons[slot] = nil |
| 412 end | 420 end |
| 413 if self.command then | 421 if self.command then |
| 595 | 603 |
| 596 actionID = actionID or 0 | 604 actionID = actionID or 0 |
| 597 self:EnableKeyboard(true) | 605 self:EnableKeyboard(true) |
| 598 | 606 |
| 599 -- this is done to keep legacy key-values from breaking algorithm assumptions | 607 -- this is done to keep legacy key-values from breaking algorithm assumptions |
| 600 print(slotInfo.assignedKeys) | 608 print('assigned', table.concat(slotInfo.assignedKeys,', ')) |
| 601 print(GetBindingKey(command)) | 609 |
| 602 self.assignedKeys = slotInfo.assignedKeys or {GetBindingKey(command)} | 610 if #slotInfo.assignedKeys == 0 then |
| 611 print('updating assigned table to:', GetBindingKey(command)) | |
| 612 slotInfo.assignedKeys = {GetBindingKey(command) } | |
| 613 end | |
| 614 | |
| 615 self.assignedKeys = slotInfo.assignedKeys | |
| 603 | 616 |
| 604 local slotInfo = { | 617 local slotInfo = { |
| 605 command = command, | 618 command = command, |
| 606 actionName = name, | 619 actionName = name, |
| 607 iconPath = icon, | 620 iconPath = icon, |
