From aea214bfea1fb2952416f108804575818c5981ef Mon Sep 17 00:00:00 2001 From: Anch Date: Mon, 1 Aug 2022 12:47:02 +1200 Subject: [PATCH] --- AtlasLoot/Core/AtlasDifficulty.lua | 82 ++- AtlasLoot/Core/AtlasLoot.lua | 95 ++- AtlasLoot/Core/HooksandAPI.lua | 32 +- AtlasLoot/Core/LootButtons.lua | 4 +- AtlasLoot/Core/Search.lua | 67 +- AtlasLoot/Core/SearchAdvanced.lua | 15 +- .../AtlaslootDefaultFrame copy.xml | 583 ------------------ .../AtlaslootDefaultFrameCreate.lua | 5 +- 8 files changed, 122 insertions(+), 761 deletions(-) delete mode 100644 AtlasLoot/DefaultFrame/AtlaslootDefaultFrame copy.xml diff --git a/AtlasLoot/Core/AtlasDifficulty.lua b/AtlasLoot/Core/AtlasDifficulty.lua index adf3b8a..963510a 100644 --- a/AtlasLoot/Core/AtlasDifficulty.lua +++ b/AtlasLoot/Core/AtlasDifficulty.lua @@ -15,16 +15,16 @@ AtlasLoot_Difficulty = { ["ClassicDungeonExt"] = { {"Bloodforged", 1}, {"Normal", 2}, - {"Heroic", 3, "=q4="}, - {"Mythic", 4, "=q4="}, - {"Mythic 1", 5, "=q4=" }, {"Mythic 2", 6, "=q4=" }, {"Mythic 3", 7, "=q4=" }, {"Mythic 4", 8, "=q4=" }, {"Mythic 5", 9, "=q4=" }, - {"Mythic 6", 10, "=q4=" }, {"Mythic 7", 11, "=q4=" }, {"Mythic 8", 12, "=q4=" }, {"Mythic 9", 13, "=q4=" }, {"Mythic 10", 14, "=q4=" }, - {"Mythic 11", 15, "=q4=" }, {"Mythic 12", 16, "=q4=" }, {"Mythic 13", 17, "=q4=" }, {"Mythic 14", 18, "=q4=" }, {"Mythic 15", 19, "=q4=" }, - {"Mythic 16", 20, "=q4=" }, {"Mythic 17", 21, "=q4=" }, {"Mythic 18", 22, "=q4=" }, {"Mythic 19", 23, "=q4=" }, {"Mythic 20", 24, "=q4=" }, - {"Mythic 21", 25, "=q4=" }, {"Mythic 22", 26, "=q4=" }, {"Mythic 23", 27, "=q4=" }, {"Mythic 24", 28, "=q4=" }, {"Mythic 25", 29, "=q4=" }, - {"Mythic 26", 30, "=q4=" }, {"Mythic 27", 31, "=q4=" }, {"Mythic 28", 32, "=q4=" }, {"Mythic 29", 33, "=q4=" }, {"Mythic 30", 34, "=q4=" }, - {"Mythic 31", 35, "=q4=" }, {"Mythic 32", 36, "=q4=" }, {"Mythic 33", 37, "=q4=" }, {"Mythic 34", 38, "=q4=" }, {"Mythic 35", 39, "=q4=" }, - {"Mythic 36", 40, "=q4=" }, {"Mythic 37", 41, "=q4=" }, {"Mythic 38", 42, "=q4=" }, {"Mythic 39", 43, "=q4=" }, {"Mythic 40", 44, "=q4=" }, + {"Heroic", 3}, + {"Mythic", 4}, + {"Mythic 1", 5 }, {"Mythic 2", 6 }, {"Mythic 3", 7 }, {"Mythic 4", 8 }, {"Mythic 5", 9 }, + {"Mythic 6", 10 }, {"Mythic 7", 11 }, {"Mythic 8", 12 }, {"Mythic 9", 13 }, {"Mythic 10", 14 }, + {"Mythic 11", 15 }, {"Mythic 12", 16 }, {"Mythic 13", 17 }, {"Mythic 14", 18 }, {"Mythic 15", 19 }, + {"Mythic 16", 20 }, {"Mythic 17", 21 }, {"Mythic 18", 22 }, {"Mythic 19", 23 }, {"Mythic 20", 24 }, + {"Mythic 21", 25 }, {"Mythic 22", 26 }, {"Mythic 23", 27 }, {"Mythic 24", 28 }, {"Mythic 25", 29 }, + {"Mythic 26", 30 }, {"Mythic 27", 31 }, {"Mythic 28", 32 }, {"Mythic 29", 33 }, {"Mythic 30", 34 }, + {"Mythic 31", 35 }, {"Mythic 32", 36 }, {"Mythic 33", 37 }, {"Mythic 34", 38 }, {"Mythic 35", 39 }, + {"Mythic 36", 40 }, {"Mythic 37", 41 }, {"Mythic 38", 42 }, {"Mythic 39", 43 }, {"Mythic 40", 44 }, }; ["ClassicRaid"] = { @@ -37,31 +37,17 @@ AtlasLoot_Difficulty = { ["BCDungeon"] = { {"Bloodforged", 1}, {"Normal/Heroic", 2}, - {"Mythic", 4, "=q4="}, - {"Mythic 1", 5, "=q4=" }, {"Mythic 2", 6, "=q4=" }, {"Mythic 3", 7, "=q4=" }, {"Mythic 4", 8, "=q4=" }, {"Mythic 5", 9, "=q4=" }, - {"Mythic 6", 10, "=q4=" }, {"Mythic 7", 11, "=q4=" }, {"Mythic 8", 12, "=q4=" }, {"Mythic 9", 13, "=q4=" }, {"Mythic 10", 14, "=q4=" }, - {"Mythic 11", 15, "=q4=" }, {"Mythic 12", 16, "=q4=" }, {"Mythic 13", 17, "=q4=" }, {"Mythic 14", 18, "=q4=" }, {"Mythic 15", 19, "=q4=" }, - {"Mythic 16", 20, "=q4=" }, {"Mythic 17", 21, "=q4=" }, {"Mythic 18", 22, "=q4=" }, {"Mythic 19", 23, "=q4=" }, {"Mythic 20", 24, "=q4=" }, - {"Mythic 21", 25, "=q4=" }, {"Mythic 22", 26, "=q4=" }, {"Mythic 23", 27, "=q4=" }, {"Mythic 24", 28, "=q4=" }, {"Mythic 25", 29, "=q4=" }, - {"Mythic 26", 30, "=q4=" }, {"Mythic 27", 31, "=q4=" }, {"Mythic 28", 32, "=q4=" }, {"Mythic 29", 33, "=q4=" }, {"Mythic 30", 34, "=q4=" }, - {"Mythic 31", 35, "=q4=" }, {"Mythic 32", 36, "=q4=" }, {"Mythic 33", 37, "=q4=" }, {"Mythic 34", 38, "=q4=" }, {"Mythic 35", 39, "=q4=" }, - {"Mythic 36", 40, "=q4=" }, {"Mythic 37", 41, "=q4=" }, {"Mythic 38", 42, "=q4=" }, {"Mythic 39", 43, "=q4=" }, {"Mythic 40", 44, "=q4=" }, + {"Mythic", 4}, + {"Mythic 1", 5 }, {"Mythic 2", 6 }, {"Mythic 3", 7 }, {"Mythic 4", 8 }, {"Mythic 5", 9 }, + {"Mythic 6", 10 }, {"Mythic 7", 11 }, {"Mythic 8", 12 }, {"Mythic 9", 13 }, {"Mythic 10", 14 }, + {"Mythic 11", 15 }, {"Mythic 12", 16 }, {"Mythic 13", 17 }, {"Mythic 14", 18 }, {"Mythic 15", 19 }, + {"Mythic 16", 20 }, {"Mythic 17", 21 }, {"Mythic 18", 22 }, {"Mythic 19", 23 }, {"Mythic 20", 24 }, + {"Mythic 21", 25 }, {"Mythic 22", 26 }, {"Mythic 23", 27 }, {"Mythic 24", 28 }, {"Mythic 25", 29 }, + {"Mythic 26", 30 }, {"Mythic 27", 31 }, {"Mythic 28", 32 }, {"Mythic 29", 33 }, {"Mythic 30", 34 }, + {"Mythic 31", 35 }, {"Mythic 32", 36 }, {"Mythic 33", 37 }, {"Mythic 34", 38 }, {"Mythic 35", 39 }, + {"Mythic 36", 40 }, {"Mythic 37", 41 }, {"Mythic 38", 42 }, {"Mythic 39", 43 }, {"Mythic 40", 44 }, }; - ["D3Set"] = { - {"Bloodforged", 1}, - {"Normal/Heroic", 2}, - {"Mythic", 4, "=q4="}, - {"Mythic 1", 5, "=q4=" }, {"Mythic 2", 6, "=q4=" }, {"Mythic 3", 7, "=q4=" }, {"Mythic 4", 8, "=q4=" }, {"Mythic 5", 9, "=q4=" }, - {"Mythic 6", 10, "=q4=" }, {"Mythic 7", 11, "=q4=" }, {"Mythic 8", 12, "=q4=" }, {"Mythic 9", 13, "=q4=" }, {"Mythic 10", 14, "=q4=" }, - {"Mythic 11", 15, "=q4=" }, {"Mythic 12", 16, "=q4=" }, {"Mythic 13", 17, "=q4=" }, {"Mythic 14", 18, "=q4=" }, {"Mythic 15", 19, "=q4=" }, - {"Mythic 16", 20, "=q4=" }, {"Mythic 17", 21, "=q4=" }, {"Mythic 18", 22, "=q4=" }, {"Mythic 19", 23, "=q4=" }, {"Mythic 20", 24, "=q4=" }, - {"Mythic 21", 25, "=q4=" }, {"Mythic 22", 26, "=q4=" }, {"Mythic 23", 27, "=q4=" }, {"Mythic 24", 28, "=q4=" }, {"Mythic 25", 29, "=q4=" }, - {"Mythic 26", 30, "=q4=" }, {"Mythic 27", 31, "=q4=" }, {"Mythic 28", 32, "=q4=" }, {"Mythic 29", 33, "=q4=" }, {"Mythic 30", 34, "=q4=" }, - {"Mythic 31", 35, "=q4=" }, {"Mythic 32", 36, "=q4=" }, {"Mythic 33", 37, "=q4=" }, {"Mythic 34", 38, "=q4=" }, {"Mythic 35", 39, "=q4=" }, - {"Mythic 36", 40, "=q4=" }, {"Mythic 37", 41, "=q4=" }, {"Mythic 38", 42, "=q4=" }, {"Mythic 39", 43, "=q4=" }, {"Mythic 40", 44, "=q4=" }, - }; - ["BCRaid"] = { {"Normal Flex", 2}, {"Heroic Flex", 3}, @@ -71,12 +57,12 @@ AtlasLoot_Difficulty = { ["WrathDungeon"] = { {"Normal/Heroic", 2}, - {"Mythic", 4, "=q4="}, + {"Mythic", 4}, {"Bloodforged", 1}, - {"Mythic 1", 5, "=q4=" }, {"Mythic 2", 6, "=q4=" }, {"Mythic 3", 7, "=q4=" }, {"Mythic 4", 8, "=q4=" }, {"Mythic 5", 9, "=q4=" }, - {"Mythic 6", 10, "=q4=" }, {"Mythic 7", 11, "=q4=" }, {"Mythic 8", 12, "=q4=" }, {"Mythic 9", 13, "=q4=" }, {"Mythic 10", 14, "=q4=" }, - {"Mythic 11", 15, "=q4=" }, {"Mythic 12", 16, "=q4=" }, {"Mythic 13", 17, "=q4=" }, {"Mythic 14", 18, "=q4=" }, {"Mythic 15", 19, "=q4=" }, - {"Mythic 16", 20, "=q4=" }, {"Mythic 17", 21, "=q4=" }, {"Mythic 18", 22, "=q4=" }, {"Mythic 19", 23, "=q4=" }, {"Mythic 20", 24, "=q4=" }, + {"Mythic 1", 5 }, {"Mythic 2", 6 }, {"Mythic 3", 7 }, {"Mythic 4", 8 }, {"Mythic 5", 9 }, + {"Mythic 6", 10 }, {"Mythic 7", 11 }, {"Mythic 8", 12 }, {"Mythic 9", 13 }, {"Mythic 10", 14 }, + {"Mythic 11", 15 }, {"Mythic 12", 16 }, {"Mythic 13", 17 }, {"Mythic 14", 18 }, {"Mythic 15", 19 }, + {"Mythic 16", 20 }, {"Mythic 17", 21 }, {"Mythic 18", 22 }, {"Mythic 19", 23 }, {"Mythic 20", 24 }, }; ["WrathRaid"] = { @@ -92,12 +78,20 @@ AtlasLoot_Difficulty = { {"Bloodforged", 1 }, }; - ["Search"] = {"Bloodforged", "Normal", "Heroic", "Mythic", - "Mythic 1", "Mythic 2","Mythic 3","Mythic 4","Mythic 5", "Mythic 6","Mythic 7", "Mythic 8","Mythic 9", "Mythic 10", - "Mythic 11", "Mythic 12","Mythic 13","Mythic 14","Mythic 15", "Mythic 16","Mythic 17","Mythic 18", "Mythic 19", "Mythic 20", - "Mythic 21", "Mythic 22","Mythic 23","Mythic 24","Mythic 25", "Mythic 26","Mythic 27", "Mythic 28","Mythic 29", "Mythic 30", - "Mythic 31", "Mythic 32","Mythic 33","Mythic 34","Mythic 35", "Mythic 36","Mythic 37","Mythic 38", "Mythic 39", "Mythic 40", - [99] = "Ascended"}; + ["Search"] = { + {"Bloodforged", 1}, + {"Normal", 2}, + {"Heroic", 3}, + {"Mythic/Ascended", 4}, + {"Mythic 1", 5 }, {"Mythic 2", 6 }, {"Mythic 3", 7 }, {"Mythic 4", 8 }, {"Mythic 5", 9 }, + {"Mythic 6", 10 }, {"Mythic 7", 11 }, {"Mythic 8", 12 }, {"Mythic 9", 13 }, {"Mythic 10", 14 }, + {"Mythic 11", 15 }, {"Mythic 12", 16 }, {"Mythic 13", 17 }, {"Mythic 14", 18 }, {"Mythic 15", 19 }, + {"Mythic 16", 20 }, {"Mythic 17", 21 }, {"Mythic 18", 22 }, {"Mythic 19", 23 }, {"Mythic 20", 24 }, + {"Mythic 21", 25 }, {"Mythic 22", 26 }, {"Mythic 23", 27 }, {"Mythic 24", 28 }, {"Mythic 25", 29 }, + {"Mythic 26", 30 }, {"Mythic 27", 31 }, {"Mythic 28", 32 }, {"Mythic 29", 33 }, {"Mythic 30", 34 }, + {"Mythic 31", 35 }, {"Mythic 32", 36 }, {"Mythic 33", 37 }, {"Mythic 34", 38 }, {"Mythic 35", 39 }, + {"Mythic 36", 40 }, {"Mythic 37", 41 }, {"Mythic 38", 42 }, {"Mythic 39", 43 }, {"Mythic 40", 44 }, + }; --Enums for comparisons in code Bloodforged = 1; diff --git a/AtlasLoot/Core/AtlasLoot.lua b/AtlasLoot/Core/AtlasLoot.lua index ceebd91..968fd93 100644 --- a/AtlasLoot/Core/AtlasLoot.lua +++ b/AtlasLoot/Core/AtlasLoot.lua @@ -45,6 +45,7 @@ ATLASLOOT_PREVIEW_ATLAS = {"1.17.3", "1.17.2"}; ATLASLOOT_POSITION = AL["Position:"]; ATLASLOOT_DEBUGMESSAGES = false; +ATLASLOOT_LOOP = false; --Standard indent to line text up with Atlas text ATLASLOOT_INDENT = " "; @@ -89,8 +90,8 @@ notPattern = false; Updated_dataID = ""; --Search panel open and close save variables ---dataID, dataSource, boss, pFrame -SearchPrevData = {"", "", "", ""}; +--dataID, dataSource, boss, pFrame, tablenumber +SearchPrevData = {"", "", "", "", ""}; AtlasLootCharDB={}; @@ -479,6 +480,12 @@ function AtlasLoot_OnLoad() end +--Used to refresh the page after its loaded all the items +function AtlasLoot:callShowloot() + ATLASLOOT_LOOP = true; + AtlasLoot_ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3], AtlasLootItemsFrame.refresh[4], AtlasLootItemsFrame.refresh[5]) +end + function AtlasLoot_CleandataID(newID, listnum) local cleanlist = { [1] = {"CLASSIC", "TBC", "WRATH"} }; for i = 1, #cleanlist[listnum] do @@ -512,23 +519,20 @@ function Atlasloot_CreateToken(dataID) newData.Back = true; newData[1] = {}; newData[1].Name = itemName; - --used to refresh the page after its loaded all the items - function AtlasLoot:callShowloot() - AtlasLoot_ShowItemsFrame(AtlasLootItemsFrame.refresh[1], AtlasLootItemsFrame.refresh[2], AtlasLootItemsFrame.refresh[3], AtlasLootItemsFrame.refresh[4], AtlasLootItemsFrame.refresh[5]) - end --Adds all the items to the new data set --Uses a timer so that AtlasLoot:callShowloot() only fires once after all then items have been loaded for i, v in ipairs(AtlasLoot_Data[dataID]) do for t, id in ipairs(v) do - local itemID = id[2]; + local itemID = AL_FindId(id[2], ItemindexID); local item = Item:CreateFromID(itemID); item:ContinueOnLoad(function(itemID) AtlasLoot:CancelTimer(AtlasLoot.refreshTimer); 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 - AtlasLoot.refreshTimer = AtlasLoot:ScheduleTimer("callShowloot", .5); + AtlasLoot.refreshTimer = AtlasLoot:ScheduleTimer("callShowloot", .1); end) end end @@ -541,7 +545,6 @@ dataSource - Table in the database where the loot table is stored boss - Text string to use as a title for the loot page pFrame - Data structure describing how and where to anchor the item frame (more details, see the function AtlasLoot_SetItemInfoFrame) tablenum - Table number of the loot table being displayed -This fuction is not normally called directly, it is usually invoked by AtlasLoot_ShowBossLoot. It is the workhorse of the mod and allows the loot tables to be displayed any way anywhere in any mod. ]] function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) @@ -575,27 +578,14 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) -- Hide the Filter Check-Box AtlasLootFilterCheck:Hide(); - - dataSource_backup = dataSource; - - if dataID == "SearchResult" or dataID == "WishList" then - ItemindexID = ""; - dataSource = {}; - -- Match the page number to display - wlPage = tonumber(dataSource_backup:match("%d+$")); - -- Aquiring items of the page - if dataID == "SearchResult" then - dataSource[dataID], wlPageMax = AtlasLoot:GetSearchResultPage(wlPage); - elseif dataID == "WishList" then - dataSource[dataID], wlPageMax = AtlasLoot_GetWishListPage(wlPage); - end - -- Make page number reasonable - if wlPage < 1 then wlPage = 1 end - if wlPage > wlPageMax then wlPage = wlPageMax end - else - dataSource = AtlasLoot_Data; + if dataID ~= "SearchResult" and dataID ~= "WishList" then + dataSource = AtlasLoot_Data; end + + AtlasLoot_CurrentType = dataSource[dataID].Type or ""; + AtlasLootDefaultFrame_ScrollFrameUpdate(); + --Hide UI objects so that only needed ones are shown for i = 1, 30, 1 do getglobal("AtlasLootItem_"..i.."_Unsafe"):Hide(); @@ -604,14 +594,8 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) getglobal("AtlasLootItem_"..i).spellitemID = 0; end ---[[ if AtlasLoot_TableNames[dataID] ~= nil and AtlasLoot_TableNames[dataID][2] == "Menu" then - AtlasLoot_GenerateAtlasMenu(dataID, pFrame); - lastType = dataSource[dataID].Type - return; - end ]] - AtlasLoot_CurrentType = dataSource[dataID].Type or ""; - AtlasLootDefaultFrame_ScrollFrameUpdate(); + -- Create the loottable if (dataID == "SearchResult") or (dataID == "WishList") or dataSource[dataID][tablenum] then @@ -809,10 +793,10 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) end end - AtlasLootItemsFrame.refresh = {dataID, dataSource_backup, boss, pFrame, tablenum}; - if dataID ~= "FilterList" and dataSource[dataID].Back ~= true then - AtlasLootItemsFrame.refreshOri = {dataID, dataSource_backup, boss, pFrame, tablenum}; - AtlasLoot.db.profile.LastBoss = {dataID, dataSource_backup, boss, pFrame, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE}; + AtlasLootItemsFrame.refresh = {dataID, dataSource, boss, pFrame, tablenum}; + if dataID ~= "WishList" and dataID ~= "SearchResult" and dataID ~= "FilterList" and dataSource[dataID].Back ~= true then + AtlasLootItemsFrame.refreshOri = {dataID, dataSource, boss, pFrame, tablenum}; + AtlasLoot.db.profile.LastBoss = {dataID, dataSource, boss, pFrame, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE}; end --This is a valid QuickLook, so show the UI objects @@ -846,36 +830,20 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) AtlasLootDefaultFrame_SubMenu:SetText(dataSource[dataID].Name); end - --Consult the button registry to determine what nav buttons are required - if dataID == "SearchResult" or dataID == "WishList" then - if wlPage < wlPageMax then + if tablenum + 1 ~= AtlasLoot_GetNumOfRows(dataSource[dataID]) then getglobal("AtlasLootItemsFrame_NEXT"):Show(); - getglobal("AtlasLootItemsFrame_NEXT").lootpage = dataID.."Page"..(wlPage + 1); - end - if wlPage > 1 then - getglobal("AtlasLootItemsFrame_PREV"):Show(); - getglobal("AtlasLootItemsFrame_PREV").lootpage = dataID.."Page"..(wlPage - 1); - end - else - local tablebase = dataID; - if ATLASLOOT_FILTER_ENABLE and dataID == "FilterList" then - tablebase = AtlasLootItemsFrame.refreshOri[1]; - end - - if tablenum + 1 ~= AtlasLoot_GetNumOfRows(dataSource[tablebase]) then - getglobal("AtlasLootItemsFrame_NEXT"):Show(); - getglobal("AtlasLootItemsFrame_NEXT").lootpage = tablebase; + getglobal("AtlasLootItemsFrame_NEXT").lootpage = dataID; getglobal("AtlasLootItemsFrame_NEXT").tablenum = tablenum + 1; end if tablenum -1 ~= 0 then getglobal("AtlasLootItemsFrame_PREV"):Show(); - getglobal("AtlasLootItemsFrame_PREV").lootpage = tablebase; + getglobal("AtlasLootItemsFrame_PREV").lootpage = dataID; getglobal("AtlasLootItemsFrame_PREV").tablenum = tablenum - 1; end - if dataSource[tablebase].Back then + if dataSource[dataID].Back then getglobal("AtlasLootItemsFrame_BACK"):Show(); end - end + end --Anchor the item frame where it is supposed to be @@ -884,7 +852,11 @@ function AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame, tablenum) AtlasLoot_HideNoUsableItems(); end + if ATLASLOOT_LOOP then + ATLASLOOT_LOOP = false; + else AtlasLoot_QueryLootPage(); + end end @@ -972,6 +944,7 @@ Called when 'Back'Button is pressed and calls up the appropriate loot page ]] function AtlasLoot_BackButton_OnClick() AtlasLoot_ShowItemsFrame(AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], AtlasLootItemsFrame.refreshOri[4], AtlasLootItemsFrame.refreshOri[5]); + AtlasLootDefaultFrame_SubTableScrollFrameUpdate(AtlasLootItemsFrame.refreshOri[1], AtlasLootItemsFrame.refreshOri[2], AtlasLootItemsFrame.refreshOri[3], AtlasLootItemsFrame.refreshOri[5]); end --[[ @@ -1168,9 +1141,11 @@ function AtlasLoot_QueryLootPage() if (queryitem) and (queryitem ~= nil) and (queryitem ~= "") and (queryitem ~= 0) and (string.sub(queryitem, 1, 1) ~= "s") then local item = Item:CreateFromID(queryitem); item:ContinueOnLoad(function(itemId) + AtlasLoot:CancelTimer(AtlasLoot.refreshTimer); if item:GetInfo() then AtlasLootTooltip:SetHyperlink("item:"..itemId..":0:0:0:0:0:0:0"); end + AtlasLoot.refreshTimer = AtlasLoot:ScheduleTimer("callShowloot", .1); end) end end diff --git a/AtlasLoot/Core/HooksandAPI.lua b/AtlasLoot/Core/HooksandAPI.lua index 049e70e..4417d51 100644 --- a/AtlasLoot/Core/HooksandAPI.lua +++ b/AtlasLoot/Core/HooksandAPI.lua @@ -294,34 +294,4 @@ function AtlasLoot_AtlasScrollBar_Update() else Hooked_AtlasScrollBar_Update(); end -end - ---[[ -AtlasLoot_ShowBossLoot(dataID, boss, pFrame): -dataID - Name of the loot table -boss - Text string to be used as the title for the loot page -pFrame - Data structure describing how and where to anchor the item frame (more details, see the function AtlasLoot_SetItemInfoFrame) -This is the intended API for external mods to use for displaying loot pages. -This function figures out where the loot table is stored, then sends the relevant info to AtlasLoot_ShowItemsFrame -]] -function AtlasLoot_ShowBossLoot(dataID, boss, pFrame) - - local tableavailable = AtlasLoot_IsLootTableAvailable(dataID); - - if (tableavailable) then - AtlasLootItemsFrame:Hide(); - - --If the loot table is already being displayed, it is hidden and the current table selection cancelled - if ( dataID == AtlasLootItemsFrame.externalBoss ) and (AtlasLootItemsFrame:GetParent() ~= AtlasFrame) and (AtlasLootItemsFrame:GetParent() ~= AtlasLootDefaultFrame_LootBackground) then - AtlasLootItemsFrame.externalBoss = nil; - else - --Use the original WoW instance data by default - local dataSource = AtlasLoot_TableNames[dataID][2]; - - --Set anchor point, set selected table and call AtlasLoot_ShowItemsFrame - AtlasLoot_AnchorFrame = pFrame; - AtlasLootItemsFrame.externalBoss = dataID; - AtlasLoot_ShowItemsFrame(dataID, dataSource, boss, pFrame); - end - end -end +end \ No newline at end of file diff --git a/AtlasLoot/Core/LootButtons.lua b/AtlasLoot/Core/LootButtons.lua index 5f3ff05..a5ff866 100644 --- a/AtlasLoot/Core/LootButtons.lua +++ b/AtlasLoot/Core/LootButtons.lua @@ -260,8 +260,8 @@ function AtlasLootItem_OnClick(arg1) end elseif((AtlasLootItemsFrame.refresh[1] == "SearchResult" or AtlasLootItemsFrame.refresh[1] == "WishList") and this.sourcePage) then local dataID, dataSource = strsplit("|", this.sourcePage); - if(dataID and dataSource and AtlasLoot_IsLootTableAvailable(dataID)) then - AtlasLoot_ShowItemsFrame(dataID, dataSource, AtlasLoot_TableNames[dataID][1], AtlasLootItemsFrame.refresh[4]); + if(dataID and dataSource) then + AtlasLoot_ShowItemsFrame(dataID, dataSource, dataSource[dataID].Name, AtlasLootItemsFrame.refresh[4], 1); end elseif (arg1=="LeftButton") and this.sourcePage ~= nil then --Holds AtlasLoot_Lastboss so back button works diff --git a/AtlasLoot/Core/Search.lua b/AtlasLoot/Core/Search.lua index 35758c1..69e7207 100644 --- a/AtlasLoot/Core/Search.lua +++ b/AtlasLoot/Core/Search.lua @@ -663,12 +663,23 @@ local function GetSpellName(itemId, atlasName) end local function DoSearch(searchText) - AtlasLootCharDB["SearchResult"] = {}; + AtlasLootCharDB["SearchResult"] = {Name = "Search Result" , Type = "Search", Back = true}; AtlasLootCharDB.LastSearchedText = searchText; - + local count = 1; + local tablenum = 1; local function AddItemToSearchResult(itemId, itemType, itemName, dataID) - local lootPage = AtlasLoot_TableNames[dataID] and AtlasLoot_TableNames[dataID][1] or "Argh!"; - table.insert(AtlasLootCharDB["SearchResult"], {0, itemId, itemType, itemName, lootPage, "", "", dataID .. "|" .. "\"\""}); + local lootPage = AtlasLoot_Data[dataID].Name or "Argh!"; + if AtlasLootCharDB["SearchResult"][tablenum] == nil then + AtlasLootCharDB["SearchResult"][tablenum] = {Name = "Page "..tablenum}; + end + if count == 30 then + table.insert(AtlasLootCharDB["SearchResult"][tablenum], {count, itemId, itemType, itemName, lootPage, "", "", dataID .. "|" .. "\"\""}); + tablenum = tablenum + 1 + count = 1; + else + table.insert(AtlasLootCharDB["SearchResult"][tablenum], {count, itemId, itemType, itemName, lootPage, "", "", dataID .. "|" .. "\"\""}); + count = count + 1; + end end local searchTerms = ParseQuery(searchText); @@ -676,30 +687,27 @@ local function DoSearch(searchText) local difficulty = TermsContainDifficulty(searchTerms); for dataID, data in pairs(AtlasLoot_Data) do - for _, datatable in pairs(data) do - for _, v in ipairs(datatable) do - local _, itemId, itemType, atlasName = unpack(v) + for _, t in ipairs(data) do + for _, v in ipairs(t) do + if type(v) == "table" then + local _, itemId, itemType, atlasName = unpack(v) + if type(itemId) == "number" and itemId > 0 then + local itemDetails = {GetItemDetails(itemId, atlasName)}; + --itemDetails[8] = ItemindexID; - if type(itemId) == "number" and itemId > 0 then - if difficulty ~= 2 then - itemId = AL_FindId(itemId, difficulty) or itemId; - end - - local itemDetails = {GetItemDetails(itemId, atlasName)}; - itemDetails[8] = difficulty; - - if #searchTerms == 1 and searchTerms[1].name then - if nameMatches(atlasName, searchTerms[1].name) then + if #searchTerms == 1 and searchTerms[1].name then + if nameMatches(atlasName, searchTerms[1].name) then + AddItemToSearchResult(itemId, itemType, atlasName, dataID); + end + elseif ItemMatchesAllTerms(searchTerms, itemDetails) then AddItemToSearchResult(itemId, itemType, atlasName, dataID); end - elseif ItemMatchesAllTerms(searchTerms, itemDetails) then - AddItemToSearchResult(itemId, itemType, atlasName, dataID); - end - elseif not equipableFilterOn and itemId and itemId ~= "" and string.sub(itemId, 1, 1) == "s" then - local spellName = GetSpellName(itemId, atlasName) - if nameMatches(spellName, searchText) then - spellName = string.sub(atlasName, 1, 4) .. spellName; - AddItemToSearchResult(itemId, itemType, spellName, dataID) + elseif not equipableFilterOn and itemId and itemId ~= "" and string.sub(itemId, 1, 1) == "s" then + local spellName = GetSpellName(itemId, atlasName) + if nameMatches(spellName, searchText) then + spellName = string.sub(atlasName, 1, 4) .. spellName; + AddItemToSearchResult(itemId, itemType, spellName, dataID) + end end end end @@ -708,7 +716,8 @@ local function DoSearch(searchText) end function AtlasLoot:ShowSearchResult() - AtlasLoot_ShowItemsFrame("SearchResult", "SearchResultPage" .. currentPage, (AL["Search Result: %s"]):format(AtlasLootCharDB.LastSearchedText or ""), pFrame); + AtlasLoot_ShowItemsFrame("SearchResult", AtlasLootCharDB, (AL["Search Result: %s"]):format(AtlasLootCharDB.LastSearchedText or ""), pFrame, 1); + AtlasLootDefaultFrame_SubTableScrollFrameUpdate("SearchResult", AtlasLootCharDB, pFrame, 1); end function AtlasLoot:Search(Text) @@ -759,9 +768,9 @@ You might also have to query the server for item informations to load them into end DEFAULT_CHAT_FRAME:AddMessage(RED .. AL["AtlasLoot"] .. ": " .. WHITE .. AL["No match found for"] .. " \"" .. Text .. "\"." .. itemFilterErrorMessage); else - currentPage = 1; - SearchResult = AtlasLoot_CategorizeWishList(AtlasLootCharDB["SearchResult"]); - AtlasLoot_ShowItemsFrame("SearchResult", "SearchResultPage1", (AL["Search Result: %s"]):format(AtlasLootCharDB.LastSearchedText or ""), pFrame); + --SearchResult = AtlasLoot_CategorizeWishList(AtlasLootCharDB["SearchResult"]); + AtlasLoot_ShowItemsFrame("SearchResult", AtlasLootCharDB, (AL["Search Result: %s"]):format(AtlasLootCharDB.LastSearchedText or ""), pFrame, 1); + AtlasLootDefaultFrame_SubTableScrollFrameUpdate("SearchResult", AtlasLootCharDB, pFrame, 1); end end diff --git a/AtlasLoot/Core/SearchAdvanced.lua b/AtlasLoot/Core/SearchAdvanced.lua index e02ce08..62d5bb0 100644 --- a/AtlasLoot/Core/SearchAdvanced.lua +++ b/AtlasLoot/Core/SearchAdvanced.lua @@ -290,8 +290,6 @@ function AtlasLoot_AdvancedSearchShow() AdvSearchSubMenuEnabled = 1; end - AtlasLootServerQueryButton:Hide(); - -- Ditch the Quicklook selector AtlasLoot_QuickLooks:Hide(); AtlasLootQuickLooksButton:Hide(); @@ -301,7 +299,6 @@ function AtlasLoot_AdvancedSearchShow() for i = 1, 30, 1 do getglobal("AtlasLootItem_" .. i .. "_Unsafe"):Hide(); - getglobal("AtlasLootMenuItem_" .. i):Hide(); getglobal("AtlasLootItem_" .. i):Hide(); getglobal("AtlasLootItem_" .. i).itemID = 0; getglobal("AtlasLootItem_" .. i).spellitemID = 0; @@ -314,22 +311,20 @@ function AtlasLoot_AdvancedSearchShow() AtlasLootAdvancedSearch:ClearAllPoints(); AtlasLootAdvancedSearch:SetPoint(pFrame[1], pFrame[2], pFrame[3], pFrame[4], pFrame[5]); AtlasLootAdvancedSearch:Show(); + + AtlasLoot_CurrentType = "Search"; + AtlasLootDefaultFrame_ScrollFrameUpdate(); + AtlasLootDefaultFrame_SubTableScrollFrameUpdate("", "", "", ""); end function AtlasLoot_AdvancedSearchClose() AtlasLootAdvancedSearch:Hide(); - AtlasLootServerQueryButton:Show(); - - if AdvSearchSubMenuEnabled then - AtlasLootDefaultFrame_SubMenu:Enable(); - AtlasLootDefaultFrame_SelectedTable:SetText(AdvSearchSubMenuText); - end AdvSearchSubMenuEnabled = 0; AdvSearchSubMenu2Enabled = 0; if (SearchPrevData[1] ~= "") then - AtlasLoot_ShowItemsFrame(SearchPrevData[1], SearchPrevData[2], SearchPrevData[3], SearchPrevData[4]); + AtlasLoot_ShowItemsFrame(SearchPrevData[1], SearchPrevData[2], SearchPrevData[3], SearchPrevData[4], SearchPrevData[5]); end end diff --git a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame copy.xml b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame copy.xml deleted file mode 100644 index 676958d..0000000 --- a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame copy.xml +++ /dev/null @@ -1,583 +0,0 @@ - -