From c1c5392981c5a9856fae067f54c2ee4d9a2b5e15 Mon Sep 17 00:00:00 2001 From: merstrax Date: Thu, 4 Aug 2022 14:29:41 -0400 Subject: [PATCH] -Fixed page linking with search -Fixed?/Finished? token tables --- AtlasLoot/Core/AtlasLoot.lua | 76 ++++++++++++--------- AtlasLoot/Core/LootButtons.lua | 4 +- AtlasLoot/Core/Search.lua | 4 +- AtlasLoot_BurningCrusade/burningcrusade.lua | 2 +- 4 files changed, 48 insertions(+), 38 deletions(-) diff --git a/AtlasLoot/Core/AtlasLoot.lua b/AtlasLoot/Core/AtlasLoot.lua index ae77f35..4297493 100644 --- a/AtlasLoot/Core/AtlasLoot.lua +++ b/AtlasLoot/Core/AtlasLoot.lua @@ -117,7 +117,6 @@ AtlasLoot_MenuList = { "ARENA4SET", }; - -- Popup Box for first time users StaticPopupDialogs["ATLASLOOT_SETUP"] = { text = AL["Welcome to Atlasloot Enhanced. Please take a moment to set your preferences."], @@ -396,6 +395,7 @@ function AtlasLoot_OnLoad() AtlasLoot_Expac = xpaclist[GetAccountExpansionLevel()+1]; end getExpac(); + AtlasLoot:GenerateTokenTables() end @@ -407,6 +407,17 @@ function AtlasLoot:CleandataID(newID, listnum) return newID; end +function AtlasLoot:GenerateTokenTables() + local Tiers = {"T1", "T2", "T2.5", "T3", "T4", "T5", "T6"}; + local Slots = {"HEAD", "SHOULDERS", "CHEST", "WRIST", "HAND", "WAIST", "LEGS", "FEET", "FINGER"}; + + for v = 1, #Tiers do + for k = 1, #Slots do + AtlasLoot:CreateToken(Tiers[v]..Slots[k]); + end + end +end + --Creates tables for raid tokens from the collections tables function AtlasLoot:CreateToken(dataID) local itemType, slotType, itemName, itemType2 @@ -414,45 +425,44 @@ function AtlasLoot:CreateToken(dataID) local orgID = dataID; --list of item types to find local names = { {"HEAD", "INVTYPE_HEAD", "Head"}, {"SHOULDER", "INVTYPE_SHOULDER", "Shoulders"}, {"CHEST", "INVTYPE_CHEST", "Chest", "INVTYPE_ROBE"}, {"WRIST", "INVTYPE_WRIST", "Wrists"}, {"HAND", "INVTYPE_HAND", "Hands"}, {"WAIST", "INVTYPE_WAIST", "Waist"}, {"LEGS", "INVTYPE_LEGS", "Legs"}, {"FEET", "INVTYPE_FEET", "Feet"}, {"FINGER", "INVTYPE_FINGER", "Rings"}}; - --finds the item type to create a list of - for a, b in pairs(names) do - dataID = gsub(dataID, b[1], ""); - slotType = gsub(orgID, dataID, ""); - if slotType == b[1] then - itemType = b[2]; - itemType2 = b[4]; - itemName = b[3]; - end + --finds the item type to create a list of + for a, b in pairs(names) do + dataID = gsub(dataID, b[1], ""); + slotType = gsub(orgID, dataID, ""); + if slotType == b[1] then + itemType = b[2]; + itemType2 = b[4]; + itemName = b[3]; + break; end + end --Creates data set of the item type - AtlasLoot_TokenData[orgID] = {}; - local newData = AtlasLoot_TokenData[orgID]; - newData.Name = itemName; - newData.Type = AtlasLoot_Data[dataID].Type; - newData.Back = true; - newData.NoSubt = true; - newData[1] = {}; - newData[1].Name = itemName; - --Adds all the items to the new data set - local keyNumber = AtlasLoot_GetNumOfRows(AtlasLoot_Data[dataID]); - local tableNumber; - for i, v in ipairs(AtlasLoot_Data[dataID]) do - tableNumber = AtlasLoot_GetNumOfRows(v); - for t, id in ipairs(v) do - local itemID = AL_FindId(id[2], ItemindexID); + if (AtlasLoot_TokenData[orgID] == nil) then + AtlasLoot_TokenData[orgID] = { + Name = itemName; + Type = AtlasLoot_Difficulty.Ascended; + Back = true; + NoSubt = true; + }; + end + + AtlasLoot_TokenData[orgID][1] = { + Name = itemName; + }; + + for _, t in ipairs(AtlasLoot_Data[dataID]) do + for _, v in ipairs(t) do + if type(v) == "table" then + local itemID = v[2]; --AL_FindId(id[2], ItemindexID); local item = Item:CreateFromID(itemID); item:ContinueOnLoad(function(itemID) - if itemType == select(9,GetItemInfo(itemID)) or itemType2 == select(9,GetItemInfo(itemID)) then - local newTable = rawset(id, 1, i); - newTable = rawset(id, 5, v.Name); - table.insert(newData[1],newTable); - end - if i == keyNumber and tableNumber == t then - AtlasLoot_ShowItemsFrame(orgID, AtlasLoot_TokenData, AtlasLootItemsFrame.refresh[3], AtlasLootItemsFrame.refresh[4], 1) + 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], v[5]}); end end) end end + end end --[[ @@ -501,7 +511,7 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) -- Hide the Filter Check-Box AtlasLootFilterCheck:Hide(); - if dataID ~= "SearchResult" and dataID ~= "WishList" then + if dataID ~= "SearchResult" and dataID ~= "WishList" and dataSource ~= AtlasLoot_TokenData then dataSource = AtlasLoot_Data; end if dataID == "SearchResult" then diff --git a/AtlasLoot/Core/LootButtons.lua b/AtlasLoot/Core/LootButtons.lua index 24e3779..b825bb2 100644 --- a/AtlasLoot/Core/LootButtons.lua +++ b/AtlasLoot/Core/LootButtons.lua @@ -248,7 +248,7 @@ function AtlasLootItem_OnClick(arg1) elseif((AtlasLootItemsFrame.refresh[1] == "SearchResult") and this.sourcePage) then local dataID, dataSource = strsplit("|", this.sourcePage); if(dataID and dataSource) then - AtlasLoot_ShowItemsFrame(dataID, dataSource, dataSource[dataID].Name, AtlasLootItemsFrame.refresh[4], 1); + AtlasLoot_ShowItemsFrame(dataID, AtlasLoot_Data, dataID, AtlasLootItemsFrame.refresh[4], 1); end elseif (arg1=="LeftButton") and this.sourcePage ~= nil then --Create token table if there isnt one @@ -256,7 +256,7 @@ function AtlasLootItem_OnClick(arg1) AtlasLoot:CreateToken(this.sourcePage) end --Show token table - AtlasLoot_ShowItemsFrame(this.sourcePage, AtlasLoot_TokenData,this.sourcePage, pFrame,1); + AtlasLoot_ShowItemsFrame(this.sourcePage, AtlasLoot_TokenData, "", AtlasLootItemsFrame.refresh[4], 1); end else if IsShiftKeyDown() then diff --git a/AtlasLoot/Core/Search.lua b/AtlasLoot/Core/Search.lua index 2bf11db..1595fdd 100644 --- a/AtlasLoot/Core/Search.lua +++ b/AtlasLoot/Core/Search.lua @@ -646,11 +646,11 @@ local function DoSearch(searchText) AtlasLootCharDB["SearchResult"][tablenum] = {Name = "Page "..tablenum}; end if count == 30 then - table.insert(AtlasLootCharDB["SearchResult"][tablenum], {count, itemId, itemType, itemName, lootPage, "", "", dataID .. "|" .. "\"\"", itemIdBackup, [AtlasLoot_Difficulty.MAX_DIF] = difCap}); + table.insert(AtlasLootCharDB["SearchResult"][tablenum], {count, itemId, itemType, itemName, lootPage, "", "", dataID .. "|" .. "AtlasLoot_Data", itemIdBackup, [AtlasLoot_Difficulty.MAX_DIF] = difCap}); tablenum = tablenum + 1 count = 1; else - table.insert(AtlasLootCharDB["SearchResult"][tablenum], {count, itemId, itemType, itemName, lootPage, "", "", dataID .. "|" .. "\"\"", itemIdBackup, [AtlasLoot_Difficulty.MAX_DIF] = difCap}); + table.insert(AtlasLootCharDB["SearchResult"][tablenum], {count, itemId, itemType, itemName, lootPage, "", "", dataID .. "|" .. "AtlasLoot_Data", itemIdBackup, [AtlasLoot_Difficulty.MAX_DIF] = difCap}); count = count + 1; end end diff --git a/AtlasLoot_BurningCrusade/burningcrusade.lua b/AtlasLoot_BurningCrusade/burningcrusade.lua index bcc57d6..4adcb41 100644 --- a/AtlasLoot_BurningCrusade/burningcrusade.lua +++ b/AtlasLoot_BurningCrusade/burningcrusade.lua @@ -1893,7 +1893,7 @@ local BabbleInventory = AtlasLoot_GetLocaleLibBabble("LibBabble-Inventory-3.0"); { 11, 28773, "", "=q4=Gorehowl", "=ds=#h2#, #w1#", "", "12.63%"}; { 12, 28771, "", "=q4=Light's Justice", "=ds=#h3#, #w6#", "", "11.17%"}; { 13, 28772, "", "=q4=Sunfury Bow of the Phoenix", "=ds=#w2#", "", "9.97%"}; - { 16, 29761, "", "=q4=Helm of the Fallen Defender", "=ds=#tt4#", "", "100%", "=LT=T5HEAD"}; + { 16, 29761, "", "=q4=Helm of the Fallen Defender", "=ds=#tt4#", "", "100%", "=LT=T4HEAD"}; { 18, 29434, "", "=q4=Badge of Justice", "=ds=#e15#", "", "100%"}; { 20, 499438, "", "=q4=Smoldering Emberwyrm", "=ds=#e12#", [AtlasLoot_Difficulty.MIN_DIF] = AtlasLoot_Difficulty.Heroic, "" }; };