From 5012902cd04c2d2a6d3a5bd54f1bc348f14d85dd Mon Sep 17 00:00:00 2001 From: Anch Date: Fri, 12 Aug 2022 16:16:34 +1200 Subject: [PATCH] expansion menu now swaps current table --- AtlasLoot/Core/AtlasLoot.lua | 16 +++++++++++++ .../DefaultFrame/AtlaslootDefaultFrame.lua | 24 +++++++++++++++---- AtlasLoot/Menus/DungeonRaidMenus.lua | 6 ++--- AtlasLoot/Menus/Mainmenu.lua | 2 +- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/AtlasLoot/Core/AtlasLoot.lua b/AtlasLoot/Core/AtlasLoot.lua index 36ed0ff..37e3c0e 100644 --- a/AtlasLoot/Core/AtlasLoot.lua +++ b/AtlasLoot/Core/AtlasLoot.lua @@ -715,6 +715,7 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum) if dataID ~= "WishList" and dataID ~= "FilterList" and dataSource[dataID].Back ~= true then AtlasLootItemsFrame.refreshOri = {dataID, dataSource, tablenum}; AtlasLoot.db.profile.LastBoss = {dataID, dataSource, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE}; + AtlasLoot.db.profile[ATLASLOOT_CURRENTTABLE] = {dataID, dataSource, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE}; end --This is a valid QuickLook, so show the UI objects @@ -777,6 +778,21 @@ Called when <-, -> are pressed and calls up the appropriate loot page ]] function AtlasLoot:NavButton_OnClick(self) local tablenum, dataID, dataSource = self.tablenum, self.tablebase[1], self.tablebase[2]; + if #dataSource[dataID] > 26 then + local offset = math.floor(AtlasLootDefaultFrameSubTableScrollScrollBar:GetValue()); + local min, max = AtlasLootDefaultFrameSubTableScrollScrollBar:GetMinMaxValues(); + + + if self == AtlasLootItemsFrame_NEXT then + AtlasLootDefaultFrameSubTableScrollScrollBar:SetValue(offset * math.floor((max / #dataSource[dataID]))); + --AtlasLootDefaultFrameSubTableScrollScrollBarScrollDownButton:Click() + elseif self == AtlasLootItemsFrame_PREV then + AtlasLootDefaultFrameSubTableScrollScrollBar:SetValue(offset * math.floor((max / #dataSource[dataID]))); + --AtlasLootDefaultFrameSubTableScrollScrollBarScrollUpButton:Click() + end + AtlasLootDefaultFrameSubTableScroll.offset = math.floor(offset / 16.5) + --AtlasLoot:SubTableScrollFrameUpdate(dataID, dataSource, tablenum); + end AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum); end diff --git a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua index 2b8102e..df19eb7 100644 --- a/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua +++ b/AtlasLoot/DefaultFrame/AtlaslootDefaultFrame.lua @@ -80,7 +80,12 @@ function AtlasLoot:DewDropClick(tablename, text, tablenum) AtlasLoot:IsLootTableAvailable(AtlasLoot_SubMenus[tablename].Module); AtlasLoot_DewdropSubMenu:Unregister(AtlasLootDefaultFrame_SubMenu); AtlasLoot:DewdropSubMenuRegister(AtlasLoot_SubMenus[tablename]); - AtlasLoot:DewDropSubMenuClick(AtlasLoot_SubMenus[tablename][tablenum][2]) + local lasttable = AtlasLoot.db.profile[ATLASLOOT_CURRENTTABLE]; + if lasttable then + AtlasLoot:ShowItemsFrame(lasttable[1], lasttable[2], lasttable[3]); + else + AtlasLoot:DewDropSubMenuClick(AtlasLoot_SubMenus[tablename][tablenum][2]) + end AtlasLoot_Dewdrop:Close(1); end @@ -109,11 +114,20 @@ function AtlasLoot:DewdropExpansionMenuClick(expansion, name) AtlasLoot_DewdropExpansionMenu:Close(1); AtlasLoot_Expac = expansion; if ATLASLOOT_CURRENTTABLE then - local tablename = AtlasLoot:CleandataID(ATLASLOOT_CURRENTTABLE, 1) .. AtlasLoot_Expac; - AtlasLoot:IsLootTableAvailable(AtlasLoot_SubMenus[tablename].Module); - AtlasLoot_DewdropSubMenu:Unregister(AtlasLootDefaultFrame_SubMenu); - AtlasLoot:DewdropSubMenuRegister(AtlasLoot_SubMenus[tablename]); + ATLASLOOT_CURRENTTABLE = AtlasLoot:CleandataID(ATLASLOOT_CURRENTTABLE, 1) .. AtlasLoot_Expac; + AtlasLoot:IsLootTableAvailable(AtlasLoot_SubMenus[ATLASLOOT_CURRENTTABLE].Module); + local tablename = AtlasLoot_SubMenus[ATLASLOOT_CURRENTTABLE][1][2]; + local lasttable = AtlasLoot.db.profile[ATLASLOOT_CURRENTTABLE]; + AtlasLoot_DewdropSubMenu:Unregister(AtlasLootDefaultFrame_SubMenu); + AtlasLoot:DewdropSubMenuRegister(AtlasLoot_SubMenus[ATLASLOOT_CURRENTTABLE]); + if lasttable then + AtlasLoot:ShowItemsFrame(lasttable[1], lasttable[2], lasttable[3]); + else + local tablenum = AtlasLoot_Data[tablename].Loadfirst or 1; + AtlasLoot:ShowItemsFrame(tablename, AtlasLoot_Data, tablenum); + end end + end --[[ diff --git a/AtlasLoot/Menus/DungeonRaidMenus.lua b/AtlasLoot/Menus/DungeonRaidMenus.lua index c8ed9ee..9fe9737 100644 --- a/AtlasLoot/Menus/DungeonRaidMenus.lua +++ b/AtlasLoot/Menus/DungeonRaidMenus.lua @@ -7,7 +7,7 @@ local BabbleInventory = AtlasLoot_GetLocaleLibBabble("LibBabble-Inventory-3.0"); --Dungeon and Raid Menus - AtlasLoot_SubMenus["Dungeons and Raids CLASSIC"] = { + AtlasLoot_SubMenus["Dungeons and RaidsCLASSIC"] = { Module = "AtlasLootOriginalWoW"; {"Raids:", "OldKeys", "Header"}; {"", "MoltenCore"}; @@ -42,7 +42,7 @@ local BabbleInventory = AtlasLoot_GetLocaleLibBabble("LibBabble-Inventory-3.0"); {"", "ZulFarrak"}; }; - AtlasLoot_SubMenus["Dungeons and Raids TBC"] = { + AtlasLoot_SubMenus["Dungeons and RaidsTBC"] = { Module = "AtlasLootBurningCrusade"; {"Raids:", "BCKeys", "Header"}; {"", "Karazhan"}; @@ -74,7 +74,7 @@ local BabbleInventory = AtlasLoot_GetLocaleLibBabble("LibBabble-Inventory-3.0"); {"", "MagistersTerrace"}; }; - AtlasLoot_SubMenus["Dungeons and Raids WRATH"] = { + AtlasLoot_SubMenus["Dungeons and RaidsWRATH"] = { Module = "AtlasLootWotLK"; {"Raids:", "WrathKeys", "Header"}; {"", "Naxxramas80"}; diff --git a/AtlasLoot/Menus/Mainmenu.lua b/AtlasLoot/Menus/Mainmenu.lua index 3d9c692..4938dba 100644 --- a/AtlasLoot/Menus/Mainmenu.lua +++ b/AtlasLoot/Menus/Mainmenu.lua @@ -13,7 +13,7 @@ local BabbleInventory = AtlasLoot_GetLocaleLibBabble("LibBabble-Inventory-3.0") --This is a multi-layer table defining the main loot listing. --Entries have the text to display, loot table or sub table to link to and if the link is to a loot table or sub table AtlasLoot_Modules = { - {AL["Dungeons and Raids"], "Dungeons and Raids ", 2}; + {AL["Dungeons and Raids"], "Dungeons and Raids", 2}; {AL["Crafting"], "Crafting"}; {AL["Sets/Collections"], "Collections"}; {AL["PvP Rewards"], "PVP"};