Skip to content

Commit

Permalink
Try to fix the error items loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zesming committed Sep 22, 2021
1 parent 6a0baec commit 6c94ce4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion BestInSlot/BISBrowser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ bb.items = {}
bb.classItems = {}
bb.showedClassTitle = {}
bb.selectedClass = {}
local needIndexItems = {}
local gearItems = {}
local listIndex = 1

Expand All @@ -32,6 +33,7 @@ local function resetContainer()
end
end
wipe(gearItems)
wipe(needIndexItems)
listIndex = 1
end

Expand Down Expand Up @@ -86,6 +88,9 @@ local function gearItem(itemInfo, index)
end

local function prepareItemInfo(itemID)
if not needIndexItems[itemID] then
return nil
end
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemSellPrice = GetItemInfo(itemID)
if not itemName or not itemLink or not itemRarity or not itemLevel or not itemSubType or not itemEquipLoc then
return nil
Expand Down Expand Up @@ -113,6 +118,7 @@ local function gearList(items)
if items then
for i = 1, #items do
local ID = items[i].ID
needIndexItems[ID] = {}
local info = prepareItemInfo(ID)
if info then
gearItem(info, listIndex)
Expand Down Expand Up @@ -280,7 +286,9 @@ bb.container:SetScript("OnEvent", function(self, event, ...)
if event == "GET_ITEM_INFO_RECEIVED" then
local itemID = ...
local info = prepareItemInfo(itemID)
gearItem(info, listIndex)
if info then
gearItem(info, listIndex)
end
end
end)

Expand Down

0 comments on commit 6c94ce4

Please sign in to comment.