From ce1241473ce62b60f470be15111601a5c621e7cd Mon Sep 17 00:00:00 2001 From: dvipid Date: Sat, 23 Nov 2019 10:50:03 -0500 Subject: [PATCH] Fixes "#5 Game crash when trying to add spell on buttonforge bar". Thanks to Tyr62 for that fix! --- Util.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Util.lua b/Util.lua index 55a2c00..66f5373 100644 --- a/Util.lua +++ b/Util.lua @@ -1655,27 +1655,30 @@ function Util.GetSpellId(NameRank) end function Util.IsSpellIdTalent(SpellId) - local TalentInfoFuncs = {GetTalentInfo, GetPvpTalentInfo}; + -- local TalentInfoFuncs = {GetTalentInfo, GetPvpTalentInfo}; + local TalentInfoFuncs = GetTalentInfo; -- Scan both normal and PvP talents -- Note rather than assume number of talents, we just scan till the rows and columns till we hit a nil - for _, TalentInfoFunc in ipairs(TalentInfoFuncs) do + --for _, TalentInfoFunc in ipairs(TalentInfoFuncs) do local r = 1; local c = 1; - local TalentSpellID = select(6, TalentInfoFunc(r, c, 1)); - while (TalentSpellID) do - while (TalentSpellID) do + -- local TalentSpellID = select(6, TalentInfoFunc(r, c, 1)); + local TalentSpellID = select(6, TalentInfoFuncs(r, c)); + while (TalentSpellID <= 0) do + while (TalentSpellID <= 0) do if (TalentSpellID == SpellId) then return true; end c = c + 1; - TalentSpellID = select(6, TalentInfoFunc(r, c, 1)); + -- TalentSpellID = select(6, TalentInfoFunc(r, c, 1)); + TalentSpellID = select(6, TalentInfoFuncs(r, c)); end r = r + 1; c = 1; - TalentSpellID = select(6, TalentInfoFunc(r, c, 1)); + -- TalentSpellID = select(6, TalentInfoFunc(r, c, 1)); end - end + --end return false; end