Mercurial > wow > skeletonkey
diff KeyButton.lua @ 93:f9df7cd7bfd6 tip
revert pet spell subText collation
remove an empty script handler
author | Nenue |
---|---|
date | Tue, 04 Sep 2018 23:00:21 -0400 |
parents | 5005aecc2dc8 |
children |
line wrap: on
line diff
--- a/KeyButton.lua Tue Jul 17 20:48:19 2018 -0400 +++ b/KeyButton.lua Tue Sep 04 23:00:21 2018 -0400 @@ -77,34 +77,16 @@ } --- This is needed to identify a spells that aren't reflected by GetCursorInfo() +-- This is needed to identify spells that aren't reflected by GetCursorInfo() kb.OnPickupPetAction = function(slot, ...) - local isPickup = GetCursorInfo() - print(slot, ...) - if kb.PetCache.action[slot] then - if isPickup then - local key, _, texture = unpack(kb.PetCache.action[slot]) - local spellName = _G[key] or key - if spellName and kb.PetCache.spellslot[spellName] then - CURSOR_SPELLSLOT = kb.PetCache.spellslot[spellName][1] - CURSOR_BOOKTYPE = BOOKTYPE_PET - CURSOR_TEXTURE = _G[texture] or texture - end - else - CURSOR_SPELLSLOT = nil - CURSOR_BOOKTYPE = nil - CURSOR_TEXTURE = nil - end - print('|cFFFF4400PickupPetAction|r', isPickup, CURSOR_PETACTION) - end + local pickupType, texture, slot = GetCursorInfo() + print('|cFFFF4400PickupPetAction|r', GetCursorInfo()) - local name, subtext, texture, isToken = GetPetActionInfo(slot) - if name then - kb.PetCache.action[slot] = {name, subtext, texture, isToken} - end + CURSOR_SPELLSLOT = slot + CURSOR_BOOKTYPE = 'pet' + CURSOR_TEXTURE = texture - - print('current cursor info', CURSOR_SPELLSLOT, CURSOR_BOOKTYPE, CURSOR_TEXTURE) + print('[cursor book]', CURSOR_BOOKTYPE, CURSOR_SPELLSLOT, 'texture:', CURSOR_TEXTURE) end @@ -113,7 +95,7 @@ CURSOR_SPELLSLOT = slot CURSOR_BOOKTYPE = bookType CURSOR_TEXTURE = GetSpellBookItemTexture(slot, bookType) - print('current cursor info', CURSOR_SPELLSLOT, CURSOR_BOOKTYPE, CURSOR_TEXTURE) + print('[cursor book]', CURSOR_BOOKTYPE, CURSOR_SPELLSLOT, 'texture:', CURSOR_TEXTURE) end kb.CreateHooks = function() @@ -153,8 +135,6 @@ end end -function skb:OnUpdate() -end function skb:OnClick(click) print(self:GetName(), 'OnMouseDown', click) local cursorType = GetCursorInfo() @@ -187,12 +167,13 @@ end function skb:DropToSlot () - print(self:GetName(),'|cFF0088FFreceived|r') local actionType, actionID, subType, subData = GetCursorInfo() - print('GetCursorInfo', GetCursorInfo()) + print(self:GetName(),'|cFF0088FFDropToSlot|r', actionType, actionID, subType, subData) if actionType then + print('##', actionType) if actionType == 'flyout' then + print('## flyout button, abort') ClearCursor() ResetCursor() return @@ -202,70 +183,71 @@ local name, icon, _, macroName, macroText local pickupID, pickupBook - if actionType == 'spell' then - local realName = GetSpellInfo(subData) - name, _, icon, _, _, _, actionID = GetSpellInfo(subData) + if actionType == 'spell' then + local realName = GetSpellInfo(subData) + name, _, icon, _, _, _, actionID = GetSpellInfo(subData) - if TALENT_SPELLS[actionID] then - name = TALENT_SPELLS[actionID].actionName - actionID = TALENT_SPELLS[actionID].actionID - icon = TALENT_SPELLS[actionID].icon - elseif actionType == 'macro' then - name, icon, macroText = GetMacroInfo(actionID) - macroName = name - elseif actionType == 'petaction' then - if CURSOR_SPELLSLOT and CURSOR_BOOKTYPE then + if TALENT_SPELLS[actionID] then + name = TALENT_SPELLS[actionID].actionName + actionID = TALENT_SPELLS[actionID].actionID + icon = TALENT_SPELLS[actionID].icon + end - local spellType, spellID = GetSpellBookItemInfo(CURSOR_SPELLSLOT, CURSOR_BOOKTYPE) - local spellName, spellText = GetSpellBookItemName(CURSOR_SPELLSLOT, CURSOR_BOOKTYPE) - if spellType == 'PETACTION' then - name = spellName - actionID = spellText - icon = CURSOR_TEXTURE - else - name, _, icon = GetSpellInfo(spellID) - actionID = spellID - end + elseif actionType == 'macro' then + name, icon, macroText = GetMacroInfo(actionID) + macroName = name + elseif actionType == 'petaction' then - pickupID = CURSOR_SPELLSLOT - pickupBook = CURSOR_BOOKTYPE - else - end + --local spellType, spellID = GetSpellBookItemInfo(actionID, BOOKTYPE_PET) + local spellName, spellText = GetSpellBookItemName(actionID, BOOKTYPE_PET) - elseif actionType == 'mount' then - if subType == 0 then - name, _, icon = GetSpellInfo(SUMMON_RANDOM_FAVORITE_MOUNT_SPELL) - actionID = 0 - else - name, _, icon = GetMountInfoByID(actionID) - end - elseif actionType == 'item' then - name = GetItemInfo(actionID) - icon = GetItemIcon(actionID) - elseif actionType == 'battlepet' then + if subType then + actionID = subType + end - local speciesID, customName, level, xp, maxXp, displayID, isFavorite, petName, petIcon, petType, creatureID = GetPetInfoByPetID(actionID) - name = customName or petName - icon = petIcon + + print('##PET', actionID, '=>', spellName, spellText) + pickupID = actionID + name = GetSpellBookItemName(actionID, BOOKTYPE_PET) + icon = GetSpellBookItemTexture(actionID, BOOKTYPE_PET) + actionID = name + pickupBook = BOOKTYPE_PET + + elseif actionType == 'mount' then + if subType == 0 then + name, _, icon = GetSpellInfo(SUMMON_RANDOM_FAVORITE_MOUNT_SPELL) + actionID = 0 + else + name, _, icon = GetMountInfoByID(actionID) end - local _, macroBody, command = kb.RegisterAction(actionType, actionID, name) - local slotInfo = { - command = command, - actionName = name, - iconPath = icon, - actionType = actionType, - actionID = actionID, - macroName = macroName, - macroText = macroText or macroBody, - spellbookSlot = pickupID, - spellbookType = pickupBook, - assignedKeys = {GetBindingKey(command)} - } + elseif actionType == 'item' then + name = GetItemInfo(actionID) + icon = GetItemIcon(actionID) + elseif actionType == 'battlepet' then - local isAssigned, isBound, assignedBy, boundBy = kb.IsCommandBound(self, command) + local speciesID, customName, level, xp, maxXp, displayID, isFavorite, petName, petIcon, petType, creatureID = GetPetInfoByPetID(actionID) + name = customName or petName + icon = petIcon + + end + local _, macroBody, command = kb.RegisterAction(actionType, actionID, name) + local slotInfo = { + command = command, + actionName = name, + iconPath = icon, + actionType = actionType, + actionID = actionID, + macroName = macroName, + macroText = macroText or macroBody, + spellbookSlot = pickupID, + spellbookType = pickupBook, + assignedKeys = {GetBindingKey(command)} + } + + local isAssigned, isBound, assignedBy, boundBy = kb.IsCommandBound(self, command) if isAssigned then local popup = StaticPopupDialogs["SKELETONKEY_CONFIRM_ASSIGN_SLOT"] popup.slot = self @@ -284,7 +266,6 @@ ResetCursor() end end - end end