made it check getiteminfo first

This commit is contained in:
Anch
2023-02-14 02:25:32 +13:00
parent 8d7e3cfae7
commit 7705032283
2 changed files with 20 additions and 11 deletions
+2
View File
@@ -0,0 +1,2 @@
.vscode/settings.json
+13 -6
View File
@@ -373,13 +373,8 @@ function AtlasLoot:CreateToken(dataID)
[1] = { Name = itemName }; [1] = { Name = itemName };
}; };
end end
--Fills table with items
local count = #AtlasLoot_Data[dataID][1] * #AtlasLoot_Data[dataID]; local count = #AtlasLoot_Data[dataID][1] * #AtlasLoot_Data[dataID];
for n, t in ipairs(AtlasLoot_Data[dataID]) do local function addItem(itemID, v, t)
for c, v in ipairs(t) do
if type(v) == "table" then
local item = Item:CreateFromID(v[2]);
item:ContinueOnLoad(function(itemID)
if itemType == select(9, GetItemInfo(itemID)) or itemType2 == select(9, GetItemInfo(itemID)) then if itemType == select(9, GetItemInfo(itemID)) or itemType2 == select(9, GetItemInfo(itemID)) then
table.insert(AtlasLoot_TokenData[orgID][1], {#AtlasLoot_TokenData[orgID][1] + 1, v[2], v[3], v[4], t.Name}); table.insert(AtlasLoot_TokenData[orgID][1], {#AtlasLoot_TokenData[orgID][1] + 1, v[2], v[3], v[4], t.Name});
end end
@@ -387,11 +382,23 @@ function AtlasLoot:CreateToken(dataID)
AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]); AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]);
end end
count = count - 1; count = count - 1;
end
--Fills table with items
for n, t in ipairs(AtlasLoot_Data[dataID]) do
for c, v in ipairs(t) do
if type(v) == "table" then
if GetItemInfo(v[2]) then
addItem(v[2], v, t)
else
local item = Item:CreateFromID(v[2]);
item:ContinueOnLoad(function(itemID)
addItem(itemID, v, t)
end) end)
end end
end end
end end
end end
end
--[[ --[[
AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum): AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum):