diff --git a/LibRangeCheck-3.0/LibRangeCheck-3.0.lua b/LibRangeCheck-3.0/LibRangeCheck-3.0.lua index 9c8dd4b..afd1bc1 100644 --- a/LibRangeCheck-3.0/LibRangeCheck-3.0.lua +++ b/LibRangeCheck-3.0/LibRangeCheck-3.0.lua @@ -40,7 +40,7 @@ License: MIT -- @class file -- @name LibRangeCheck-3.0 local MAJOR_VERSION = "LibRangeCheck-3.0" -local MINOR_VERSION = 14 +local MINOR_VERSION = 15 ---@class lib local lib, oldminor = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION) @@ -67,11 +67,8 @@ local tremove = tremove local tostring = tostring local setmetatable = setmetatable local BOOKTYPE_SPELL = BOOKTYPE_SPELL -local GetSpellInfo = GetSpellInfo local GetSpellBookItemName = GetSpellBookItemName -local GetNumSpellTabs = GetNumSpellTabs -local GetSpellTabInfo = GetSpellTabInfo -local GetItemInfo = GetItemInfo +local C_Item = C_Item local UnitCanAttack = UnitCanAttack local UnitCanAssist = UnitCanAssist local UnitExists = UnitExists @@ -89,6 +86,32 @@ local HandSlotId = GetInventorySlotInfo("HANDSSLOT") local math_floor = math.floor local UnitIsVisible = UnitIsVisible +local GetSpellInfo = GetSpellInfo or function(spellID) + if not spellID then + return nil; + end + + local spellInfo = C_Spell.GetSpellInfo(spellID); + if spellInfo then + return spellInfo.name, nil, spellInfo.iconID, spellInfo.castTime, spellInfo.minRange, spellInfo.maxRange, spellInfo.spellID, spellInfo.originalIconID; + end +end + +local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines +local GetSpellTabInfo = GetSpellTabInfo or function(index) + local skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(index); + if skillLineInfo then + return skillLineInfo.name, + skillLineInfo.iconID, + skillLineInfo.itemIndexOffset, + skillLineInfo.numSpellBookItems, + skillLineInfo.isGuild, + skillLineInfo.offSpecID, + skillLineInfo.shouldHide, + skillLineInfo.specID; + end +end + -- << STATIC CONFIG local UpdateDelay = 0.5 @@ -676,7 +699,7 @@ local function createCheckerList(spellList, itemList, interactList) for range, items in pairs(itemList) do for i = 1, #items do local item = items[i] - if Item:CreateFromItemID(item):IsItemDataCached() and GetItemInfo(item) then + if Item:CreateFromItemID(item):IsItemDataCached() and C_Item.GetItemInfo(item) then addChecker(res, range, nil, checkers_Item[item], "item:" .. item) break end @@ -912,9 +935,9 @@ local function createSmartChecker(friendChecker, harmChecker, miscChecker) end local minItemChecker = function(item) - if GetItemInfo(item) then + if C_Item.GetItemInfo(item) then return function(unit) - return IsItemInRange(item, unit) + return C_Item.IsItemInRange(item, unit) end end end @@ -1271,7 +1294,7 @@ function lib:processItemRequests(itemRequests) tremove(items, i) elseif pendingItemRequest[item] and GetTime() < itemRequestTimeoutAt[item] then return true -- still waiting for server response - elseif GetItemInfo(item) then + elseif C_Item.GetItemInfo(item) then -- print("### processItemRequests: found: " .. tostring(item)) foundNewItems = true itemRequestTimeoutAt[item] = nil @@ -1409,7 +1432,7 @@ function lib:startMeasurement(unit, resultTable) for range, items in pairs(itemList) do for i = 1, #items do local item = items[i] - local name = GetItemInfo(item) + local name = C_Item.GetItemInfo(item) if name then self.itemsToMeasure[name] = item end @@ -1449,7 +1472,7 @@ function lib:checkItems(itemList, verbose, color) for range, items in pairsByKeys(itemList) do for i = 1, #items do local item = items[i] - local name = GetItemInfo(item) + local name = C_Item.GetItemInfo(item) if not name then print(MAJOR_VERSION .. ": |c" .. color .. tostring(item) .. "|r: " .. tostring(range) .. "yd: |cffeda500not in cache|r") else