Browse Source

BulkContinueOnLoad is no longer necessary or exists

pull/21/head
xanthics 7 months ago
parent
commit
e9a45323c0
  1. 4
      TradeSkillMaster/Core/Groups.lua
  2. 4
      TradeSkillMaster/Core/Options.lua
  3. 16
      TradeSkillMaster/TradeSkillMaster.lua

4
TradeSkillMaster/Core/Groups.lua

@ -1314,7 +1314,6 @@ function TSM:ImportGroup(importStr, groupPath)
end end
local items = {} local items = {}
local bulkquerybuffer = {}
local currentSubPath = "" local currentSubPath = ""
for _, str in ipairs(TSMAPI:SafeStrSplit(importStr, ",")) do for _, str in ipairs(TSMAPI:SafeStrSplit(importStr, ",")) do
str = str:trim() str = str:trim()
@ -1338,12 +1337,11 @@ function TSM:ImportGroup(importStr, groupPath)
elseif itemString then elseif itemString then
items[itemString] = currentSubPath items[itemString] = currentSubPath
local item = Item:CreateFromID(tonumber(noSpaceStr)) local item = Item:CreateFromID(tonumber(noSpaceStr))
if not item:IsCached() then bulkquerybuffer[#bulkquerybuffer+1] = item.itemID end if not item:IsCached() then item:Query() end
else else
return return
end end
end end
TSMAPI:BulkQuery(bulkquerybuffer)
local num = 0 local num = 0
for itemString, subPath in pairs(items) do for itemString, subPath in pairs(items) do

4
TradeSkillMaster/Core/Options.lua

@ -939,16 +939,14 @@ function private:LoadProfilesPage(container)
end end
end end
local bulkquerybuffer = {}
for itemString, _ in pairs(TSM.db.profile.items) do for itemString, _ in pairs(TSM.db.profile.items) do
-- check if item is cached -- check if item is cached
local _,_,itemID = itemString:find("item:(%d+)") local _,_,itemID = itemString:find("item:(%d+)")
if itemID then if itemID then
local item = Item:CreateFromID(itemID) local item = Item:CreateFromID(itemID)
if not item:IsCached() then bulkquerybuffer[#bulkquerybuffer+1] = item.itemID end if not item:IsCached() then item:Query() end
end end
end end
TSMAPI:BulkQuery(bulkquerybuffer)
return profiles return profiles
end end

16
TradeSkillMaster/TradeSkillMaster.lua

@ -234,14 +234,13 @@ function TSM:OnInitialize()
-- create the main TSM frame -- create the main TSM frame
TSM:CreateMainFrame() TSM:CreateMainFrame()
local bulkquerybuffer = {}
-- fix any items with spaces in them -- fix any items with spaces in them
for itemString, groupPath in pairs(TSM.db.profile.items) do for itemString, groupPath in pairs(TSM.db.profile.items) do
-- check if item is cached -- check if item is cached
local _,_,itemID = itemString:find("item:(%d+)") local _,_,itemID = itemString:find("item:(%d+)")
if itemID then if itemID then
local item = Item:CreateFromID(itemID) local item = Item:CreateFromID(itemID)
if not item:IsCached() then bulkquerybuffer[#bulkquerybuffer+1] = item.itemID end if not item:IsCached() then item:Query() end
end end
if strfind(itemString, " ") then if strfind(itemString, " ") then
local newItemString = gsub(itemString, " ", "") local newItemString = gsub(itemString, " ", "")
@ -249,7 +248,6 @@ function TSM:OnInitialize()
TSM.db.profile.items[itemString] = nil TSM.db.profile.items[itemString] = nil
end end
end end
TSMAPI:BulkQuery(bulkquerybuffer)
if TSM.db.profile.deValueSource then if TSM.db.profile.deValueSource then
TSM.db.profile.destroyValueSource = TSM.db.profile.deValueSource TSM.db.profile.destroyValueSource = TSM.db.profile.deValueSource
@ -714,18 +712,6 @@ function TSM:GetAuctionPlayer(player, player_full)
end end
end end
-- Bulk load uncached IDs. Divides in to buckets of 50
function TSMAPI:BulkQuery(items)
if not items or #items == 0 then return end
self.QueryTicker = Timer.NewTicker(1, function()
Item:BulkContinueOnLoad(table.take(items, 50), function(id) end, function(id) return GetItemInfo(id) == nil end) -- 3rd parameter (validator) is optional
if #items == 0 then
self.QueryTicker:Cancel()
self.QueryTicker = nil
end
end)
end
-- GetItemPrice TSMAPI-Extension -- GetItemPrice TSMAPI-Extension
function TSMAPI:GetItemPrices(itemLink) function TSMAPI:GetItemPrices(itemLink)
if not itemLink then return nil end if not itemLink then return nil end

Loading…
Cancel
Save