Mercurial > wow > skeletonkey
comparison SkeletonKey/KeyButton.lua @ 30:b0e4d04d428a
- use a fixed loop to parse GetProfessions() result so unlearned secondaries don't break the cache
- removed a bad varaible reference that was causing confirmation popup to barf
author | Nenue |
---|---|
date | Fri, 05 Aug 2016 19:41:18 -0400 |
parents | bb160c04de88 |
children | daff39af0c6d |
comparison
equal
deleted
inserted
replaced
29:bb160c04de88 | 30:b0e4d04d428a |
---|---|
23 [5] = PROFESSIONS_FIRST_AID, | 23 [5] = PROFESSIONS_FIRST_AID, |
24 [7] = PROFESSIONS_COOKING, | 24 [7] = PROFESSIONS_COOKING, |
25 [9] = PROFESSIONS_FISHING, | 25 [9] = PROFESSIONS_FISHING, |
26 [10] = PROFESSIONS_ARCHAEOLOGY, | 26 [10] = PROFESSIONS_ARCHAEOLOGY, |
27 | 27 |
28 } | |
29 | |
30 local PROFESSION_HEADERS = { | |
31 [1] = 'Profession 1', | |
32 [2] = 'Profession 2', | |
33 [3] = 10, | |
34 [4] = 7, | |
35 [5] = 9, | |
36 [6] = 5 | |
28 } | 37 } |
29 | 38 |
30 -- This is needed to identify a spells that aren't reflected by GetCursorInfo() | 39 -- This is needed to identify a spells that aren't reflected by GetCursorInfo() |
31 kb.OnPickupPetAction = function(slot, ...) | 40 kb.OnPickupPetAction = function(slot, ...) |
32 local isPickup = GetCursorInfo() | 41 local isPickup = GetCursorInfo() |
385 if self.isDynamic then | 394 if self.isDynamic then |
386 print('|cFF00BBFFUpdateSlot|r:', self.isDynamic, self.isAvailable, self.actionID) | 395 print('|cFF00BBFFUpdateSlot|r:', self.isDynamic, self.isAvailable, self.actionID) |
387 end | 396 end |
388 | 397 |
389 if self.isDynamic == 'profession' then | 398 if self.isDynamic == 'profession' then |
390 if self.isAvailable then | 399 if self.profIndex then |
391 | 400 |
392 local profText = (self.spellNum == 1) and TRADE_SKILLS or (BUTTON_HEADERS[self.profIndex] or GetProfessionInfo(self.profIndex)) | 401 local profText = (self.spellNum == 1) and TRADE_SKILLS or (BUTTON_HEADERS[self.profIndex] or GetProfessionInfo(self.profIndex)) |
393 print(self.profIndex, 'spnum', type(self.spellNum), (self.spellNum == 1)) | 402 print(self.profIndex, 'spnum', type(self.spellNum), (self.spellNum == 1)) |
394 | 403 |
395 self.statusText = '|cFFFFFF00'..tostring(profText)..'|r' | 404 self.statusText = '|cFFFFFF00'..tostring(profText)..'|r' |
396 self.bindingText = kb.BindingString(GetBindingKey(self.command)) | 405 self.bindingText = kb.BindingString(GetBindingKey(self.command)) |
397 else | 406 else |
398 | 407 |
399 self.statusText = '|cFFFF4400Profession|r' | 408 self.statusText = '|cFFFF4400'..PROFESSION_HEADERS[self.professionNum]..'|r' |
400 self.actionName = '(#'..self.professionNum..')' | 409 self.actionName = '(#'..self.professionNum..')' |
401 self.bindingText ='?' | 410 self.bindingText ='?' |
402 end | 411 end |
403 elseif self.isDynamic == 'talent' then | 412 elseif self.isDynamic == 'talent' then |
404 | 413 |
527 name = cacheInfo.spellName | 536 name = cacheInfo.spellName |
528 icon = cacheInfo.icon | 537 icon = cacheInfo.icon |
529 actionID = cacheInfo.spellID | 538 actionID = cacheInfo.spellID |
530 self.profIndex = cacheInfo.profIndex | 539 self.profIndex = cacheInfo.profIndex |
531 self.spellOffset = cacheInfo.spellOffset | 540 self.spellOffset = cacheInfo.spellOffset |
541 else | |
542 print(professionNum, type(professionNum), PROFESSION_HEADERS[tonumber(professionNum)]) | |
543 local profID = PROFESSION_HEADERS[tonumber(professionNum)] | |
544 if type(profID) == 'number' then | |
545 local pname, texture, _, _, numSpells, spellOffset = GetProfessionInfo(profID) | |
546 self.profIndex = profID | |
547 else | |
548 name = profID | |
549 end | |
550 | |
532 end | 551 end |
533 print(' Special slot: |cFF00FFFFProfession|r', professionNum, spellNum, isDynamic, isAvailable) | 552 print(' Special slot: |cFF00FFFFProfession|r', professionNum, spellNum, isDynamic, isAvailable) |
534 | 553 |
535 self.professionNum = tonumber(professionNum) | 554 self.professionNum = tonumber(professionNum) |
536 self.spellNum = tonumber(spellNum) | 555 self.spellNum = tonumber(spellNum) |
546 elseif actionType == 'petaction' then | 565 elseif actionType == 'petaction' then |
547 isDynamic = 'petaction' | 566 isDynamic = 'petaction' |
548 local specialType, specialNum = command:match(actionType..'_([%a%s]+)_(%d)') | 567 local specialType, specialNum = command:match(actionType..'_([%a%s]+)_(%d)') |
549 | 568 |
550 if kb.PetCache.subtext[specialType] and kb.PetCache.subtext[specialType][tonumber(specialNum)] then | 569 if kb.PetCache.subtext[specialType] and kb.PetCache.subtext[specialType][tonumber(specialNum)] then |
551 print('***dynamic pet thign', specialType, specialNum) | 570 print('***dynamic pet skill', specialType, specialNum) |
552 --[[ i, spellName, subText, spellID, texture, specialNum[subText ]] | 571 --[[ i, spellName, subText, spellID, texture, specialNum[subText ]] |
553 pickupSlot, name, specialType, actionID, icon, specialNum = unpack(kb.PetCache.subtext[specialType][tonumber(specialNum)]) | 572 pickupSlot, name, specialType, actionID, icon, specialNum = unpack(kb.PetCache.subtext[specialType][tonumber(specialNum)]) |
554 pickupBook = BOOKTYPE_PET | 573 pickupBook = BOOKTYPE_PET |
555 end | 574 end |
556 | 575 |