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
+18 -11
View File
@@ -373,21 +373,28 @@ 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];
local function addItem(itemID, v, t)
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});
end
if count == 1 then
AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]);
end
count = count - 1;
end
--Fills table with items
for n, t in ipairs(AtlasLoot_Data[dataID]) do for n, t in ipairs(AtlasLoot_Data[dataID]) do
for c, v in ipairs(t) do for c, v in ipairs(t) do
if type(v) == "table" then if type(v) == "table" then
local item = Item:CreateFromID(v[2]); if GetItemInfo(v[2]) then
item:ContinueOnLoad(function(itemID) addItem(v[2], v, t)
if itemType == select(9, GetItemInfo(itemID)) or itemType2 == select(9, GetItemInfo(itemID)) then else
table.insert(AtlasLoot_TokenData[orgID][1], {#AtlasLoot_TokenData[orgID][1] + 1, v[2], v[3], v[4], t.Name}); local item = Item:CreateFromID(v[2]);
end item:ContinueOnLoad(function(itemID)
if count == 1 then addItem(itemID, v, t)
AtlasLoot:ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3]); end)
end end
count = count - 1;
end)
end end
end end
end end