From 2c64c0b19966517d5c0988e1c7da2e1b0f4de852 Mon Sep 17 00:00:00 2001 From: Ivaria <ivaria@vuhdo.io> Date: Sat, 26 Aug 2017 10:03:46 +0000 Subject: [PATCH] Optimize common action validation on panel refresh. Should fix some "script ran too long" errors w/ talent spells --- VuhDoToolbox.lua | 17 ++++++++++++----- changelog.txt | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/VuhDoToolbox.lua b/VuhDoToolbox.lua index 0673535..54d67b1 100644 --- a/VuhDoToolbox.lua +++ b/VuhDoToolbox.lua @@ -462,6 +462,7 @@ end -- function VUHDO_isSpellKnown(aSpellName) return (type(aSpellName) == "number" and IsSpellKnown(aSpellName)) + or (type(aSpellName) == "number" and IsPlayerSpell(aSpellName)) or GetSpellBookItemInfo(aSpellName) ~= nil or VUHDO_NAME_TO_SPELL[aSpellName] ~= nil and GetSpellBookItemInfo(VUHDO_NAME_TO_SPELL[aSpellName]); end @@ -472,10 +473,11 @@ function VUHDO_getTalentSpellId(aTalentName) for tier=1,7 do for column=1,3 do -- as of Legion "active spec group" is always 1 - local id, name, _, selected, _ = GetTalentInfo(tier, column, 1); + local _, name, _, selected, _, spellId, _, _, _, _, _ = GetTalentInfo(tier, column, 1); - if selected and name == aTalentName then - return id; + if selected and (name == aTalentName + or (type(aTalentName) == "number" and spellId == aTalentName)) then + return spellId; end end end @@ -674,7 +676,9 @@ end -- local tActionLowerName; -local tIsMacroKnown, tIsSpellKnown, tIsTalentKnown +local tIsMacroKnown; +local tIsSpellKnown; +local tIsTalentKnown; function VUHDO_isActionValid(anActionName, anIsCustom) if (anActionName or "") == "" then @@ -696,7 +700,10 @@ function VUHDO_isActionValid(anActionName, anIsCustom) tIsMacroKnown = GetMacroIndexByName(anActionName) ~= 0; tIsSpellKnown = VUHDO_isSpellKnown(anActionName); - tIsTalentKnown = VUHDO_isTalentKnown(anActionName); + + if not tIsSpellKnown then + tIsTalentKnown = VUHDO_isTalentKnown(anActionName); + end if (tIsSpellKnown or tIsTalentKnown) and tIsMacroKnown then VUHDO_Msg(format(VUHDO_I18N_AMBIGUOUS_MACRO, anActionName), 1, 0.3, 0.3); diff --git a/changelog.txt b/changelog.txt index 619bef9..85486ab 100644 --- a/changelog.txt +++ b/changelog.txt @@ -24,6 +24,8 @@ Bugfixes: -- Use full player name including realm for tell command -- Check if GameTooltip is flagged forbidden before any interaction -- Should fix taints related to Blizzard lock down in 7.2.5 +-- Optimize common action validation on panel refresh +-- Should fix some "script ran too long" errors w/ talent spells Improvements: -- GitLab