update WeakAuras.FindSpellActionButtons

This commit is contained in:
Bunny67
2020-08-25 20:57:08 +03:00
parent f4a801a3d7
commit d9a27f5e50
2 changed files with 60 additions and 24 deletions
+4 -23
View File
@@ -2,10 +2,9 @@ if not WeakAuras.IsCorrectVersion() then return end
-- Lua APIs
local tinsert, tsort = table.insert, table.sort
local tonumber, tostring = tonumber, tostring
local tostring = tostring
local select, pairs, type = select, pairs, type
local ceil, min = ceil, min
local match = string.match
-- WoW APIs
local GetTalentInfo = GetTalentInfo
@@ -14,7 +13,6 @@ local GetSpellInfo, GetItemInfo, GetItemCount, GetItemIcon = GetSpellInfo, GetIt
local GetShapeshiftFormInfo, GetShapeshiftForm = GetShapeshiftFormInfo, GetShapeshiftForm
local GetRuneCooldown, UnitCastingInfo, UnitChannelInfo = GetRuneCooldown, UnitCastingInfo, UnitChannelInfo
local UnitDetailedThreatSituation, UnitThreatSituation = UnitDetailedThreatSituation, UnitThreatSituation
local GetActionInfo, GetMacroSpell, GetSpellLink = GetActionInfo, GetMacroSpell, GetSpellLink
local WeakAuras = WeakAuras
local L = WeakAuras.L
@@ -652,26 +650,6 @@ function WeakAuras.IsSpellKnownIncludingPet(spell)
end
end
function WeakAuras.FindSpellActionButtons(spellID)
for i = 120, 1, -1 do
local actionType, id, _, globalID = GetActionInfo(i)
if actionType == "spell" and globalID and globalID == spellID then
return i
elseif actionType == "macro" then
local name, rank = GetMacroSpell(id)
if name then
local spellLink = GetSpellLink(name, rank or "")
if spellLink then
globalID = tonumber(match(spellLink, "spell:(%d+)"))
if globalID and globalID == spellID then
return i
end
end
end
end
end
end
local function valuesForTalentFunction(trigger)
return function()
local single_class;
@@ -5605,6 +5583,9 @@ WeakAuras.event_prototypes = {
"ACTIONBAR_PAGE_CHANGED"
},
name = L["Queued Action"],
loadFunc = function()
WeakAuras.WatchQueuedAction()
end,
init = function(trigger)
trigger.spellName = trigger.spellName or 0
local ret = [=[