Browse Source

Epoch lua error fix

pull/25/head
Szyler 7 months ago
parent
commit
97c5fabc8a
  1. 12
      TradeSkillMaster/Core/Groups.lua
  2. 8
      TradeSkillMaster/Core/Options.lua
  3. 8
      TradeSkillMaster/TradeSkillMaster.lua

12
TradeSkillMaster/Core/Groups.lua

@ -1315,6 +1315,7 @@ function TSM:ImportGroup(importStr, groupPath)
local items = {} local items = {}
local currentSubPath = "" local currentSubPath = ""
local itemID, randomEnchant = nil, nil
for _, str in ipairs(TSMAPI:SafeStrSplit(importStr, ",")) do for _, str in ipairs(TSMAPI:SafeStrSplit(importStr, ",")) do
str = str:trim() str = str:trim()
local noSpaceStr = gsub(str, " ", "") -- forums like to add spaces local noSpaceStr = gsub(str, " ", "") -- forums like to add spaces
@ -1327,7 +1328,7 @@ function TSM:ImportGroup(importStr, groupPath)
elseif strfind(noSpaceStr, "p") then elseif strfind(noSpaceStr, "p") then
itemString = gsub(noSpaceStr, "p", "battlepet") itemString = gsub(noSpaceStr, "p", "battlepet")
elseif strfind(noSpaceStr, ":") then elseif strfind(noSpaceStr, ":") then
local itemID, randomEnchant = (":"):split(noSpaceStr) itemID, randomEnchant = (":"):split(noSpaceStr)
if not tonumber(itemID) or not tonumber(randomEnchant) then return end if not tonumber(itemID) or not tonumber(randomEnchant) then return end
itemString = "item:"..tonumber(itemID)..":0:0:0:0:0:"..tonumber(randomEnchant) itemString = "item:"..tonumber(itemID)..":0:0:0:0:0:"..tonumber(randomEnchant)
end end
@ -1336,8 +1337,13 @@ function TSM:ImportGroup(importStr, groupPath)
currentSubPath = subPath currentSubPath = subPath
elseif itemString then elseif itemString then
items[itemString] = currentSubPath items[itemString] = currentSubPath
local item = Item:CreateFromID(tonumber(noSpaceStr)) itemID = itemID or noSpaceStr
item:Query() if Item then
local item = Item:CreateFromID(tonumber(itemID))
item:Query()
else
TSMAPI:GetSafeItemInfo(tonumber(itemID))
end
else else
return return
end end

8
TradeSkillMaster/Core/Options.lua

@ -943,8 +943,12 @@ function private:LoadProfilesPage(container)
-- 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) if Item then
item:Query() local item = Item:CreateFromID(itemID)
item:Query()
else
TSMAPI:GetSafeItemInfo(tonumber(itemID))
end
end end
end end

8
TradeSkillMaster/TradeSkillMaster.lua

@ -239,8 +239,12 @@ function TSM:OnInitialize()
-- 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) if Item then
item:Query() local item = Item:CreateFromID(itemID)
item:Query()
else
TSMAPI:GetSafeItemInfo(tonumber(itemID))
end
end end
if strfind(itemString, " ") then if strfind(itemString, " ") then
local newItemString = gsub(itemString, " ", "") local newItemString = gsub(itemString, " ", "")

Loading…
Cancel
Save