wishlist bug fixs

-wishlist bug fixs
-added button to take you to the current instance
This commit is contained in:
Anch
2022-10-14 20:46:25 +13:00
parent a956fa1a7f
commit 5a0d869d87
4 changed files with 82 additions and 48 deletions
+29 -7
View File
@@ -143,8 +143,8 @@ function AtlasLoot:OnEnable()
if IsAddOnLoaded("Atlas") then
AtlasLoot:LoadMapData();
ATLASLOOT_ATLASLOADED = true;
AtlasLootDefaultFrame_MapButton:Show();
AtlasLootDefaultFrame_MapSelectButton:Show();
AtlasLootDefaultFrame_MapButton:Enable();
AtlasLootDefaultFrame_MapSelectButton:Enable();
end
--Add the loot browser to the special frames tables to enable closing wih the ESC key
@@ -230,6 +230,12 @@ function AtlasLoot:OnEnable()
LibStub("LibAboutPanel").new(AL["AtlasLoot"], "AtlasLoot");
end
AtlasLoot_UpdateLootBrowserScale();
local playerName = UnitName("player");
if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then
AtlasLootItemsFrame_Wishlist_UnLock:Disable();
else
AtlasLootItemsFrame_Wishlist_UnLock:Enable();
end
end
function AtlasLoot_Reset(data)
@@ -477,19 +483,27 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum)
AtlasLoot:ScrollFrameUpdate();
end
-- Sets the main page lable
AtlasLoot_BossName:SetText(dataSource[dataID][tablenum].Name);
-- Finds the tablenumber to set where the difficulty slider should be.
local typeNumber = 1;
local function findTypeNumber()
for i,v in ipairs(AtlasLoot_Difficulty[dataSource[dataID].Type]) do
if v[2] == ItemindexID then
typeNumber = i;
return i;
end
end
end
-- Moves the difficulty scrollslider if the difficulty has changed
if dataSource[dataID].Type and difType and #AtlasLoot_Difficulty[dataSource[dataID].Type] > 5 then
if dataSource[dataID].Type and difType and #AtlasLoot_Difficulty[dataSource[dataID].Type] > 5 and findTypeNumber() > 5 then
local min, max = AtlasLootDefaultFrameScrollScrollBar:GetMinMaxValues();
AtlasLootDefaultFrameScrollScrollBar:SetValue(ItemindexID * (max / #AtlasLoot_Difficulty[dataSource[dataID].Type]));
AtlasLootDefaultFrameScrollScrollBar:SetValue(typeNumber * (max / #AtlasLoot_Difficulty[dataSource[dataID].Type]));
end
-- Moves the difficulty scrollslider if wishlist
if dataSource_backup == "AtlasLoot_CurrentWishList" and dataSource[dataID].ListNum > 5 then
local min, max = AtlasLootDefaultFrameScrollScrollBar:GetMinMaxValues();
AtlasLootDefaultFrameScrollScrollBar:SetValue(tablenum * (max / #AtlasLootWishList[dataSource[dataID].ListType][dataSource[dataID].ListNum]));
AtlasLootDefaultFrameScrollScrollBar:SetValue(dataSource[dataID].ListNum * (max / #AtlasLootWishList[dataSource[dataID].ListType][dataSource[dataID].ListNum]));
end
--For stopping the subtable from changing if its a token table
@@ -510,6 +524,14 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum)
_G["AtlasLootItem_"..i].spellitemID = 0;
end
-- Sets the main page lable
if dataSource[dataID][tablenum] and dataSource[dataID][tablenum].Name then
AtlasLoot_BossName:SetText(dataSource[dataID][tablenum].Name);
else
AtlasLoot_BossName:SetText("This Is Empty");
return
end
local function getProperItemConditionals(item)
isValid = false;
toShow = true;
+24 -19
View File
@@ -41,9 +41,6 @@ local ORANGE = "|cffFF8400";
function AtlasLoot:ShowWishList(listType,arg2,arg3)
AtlasLoot_CurrentWishList = {["Show"] = {ListType = listType, ListNum = arg2 ,Name = "WishLists", Icon = AtlasLootWishList[listType][arg2].Icon}};
if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then
AtlasLoot:SortWishList(true);
end
local numPages = math.ceil(#AtlasLootWishList[listType][arg2]/30);
for n = 1 ,numPages, 1 do
table.insert(AtlasLoot_CurrentWishList["Show"], {Name = "Page "..n})
@@ -81,6 +78,9 @@ function AtlasLoot_WishListAddDropClick(typ, arg2, arg3, arg4)
return;
end
table.insert(AtlasLootWishList["Own"][arg2], { #AtlasLootWishList["Own"][arg2] + 1, itemID, itemTexture, itemName, AtlasLoot_Data[AtlasLootItemsFrame.refresh[1]].Name, "", "", sourcePage});
if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then
AtlasLoot:SortWishList(nil,"Own", arg2);
end
DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..AtlasLoot_FixText(itemName)..GREY..AL[" added to the WishList."]..WHITE.." ("..AtlasLootWishList["Own"][arg2].Name..")");
AtlasLoot_WishListDrop:Close(1)
elseif typ == "addShared" then
@@ -89,6 +89,9 @@ function AtlasLoot_WishListAddDropClick(typ, arg2, arg3, arg4)
return;
end
table.insert(AtlasLootWishList["Shared"][arg2], { #AtlasLootWishList["Shared"][arg2] + 1, itemID, itemTexture, itemName, lootPage, "", "", sourcePage});
if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then
AtlasLoot:SortWishList(nil,"Shared", arg2);
end
DEFAULT_CHAT_FRAME:AddMessage(RED..AL["AtlasLoot"]..": "..AtlasLoot_FixText(itemName)..GREY..AL[" added to the WishList."]..WHITE.." ("..AtlasLootWishList["Shared"][arg2].Name..")");
AtlasLoot_WishListDrop:Close(1)
end
@@ -150,13 +153,13 @@ function AtlasLoot:MoveWishlistItem(pos,itemNum,replaceNum,replaceNum2)
end
--Sort wishlist
function AtlasLoot:SortWishList(refresh)
Sorted = {};
local name = AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name;
local icon = AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Icon;
for i,v in ipairs(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum]) do
function AtlasLoot:SortWishList(refresh,type,tNumb)
local sorted = {};
local name = AtlasLootWishList[type][tNumb].Name;
local icon = AtlasLootWishList[type][tNumb].Icon;
for i,v in ipairs(AtlasLootWishList[type][tNumb]) do
local function tableCheck()
for n,t in ipairs(Sorted) do
for n,t in ipairs(sorted) do
if t[2][5] == v[5] then
return t
end
@@ -165,25 +168,25 @@ function AtlasLoot:SortWishList(refresh)
if v[2] ~= 0 and tableCheck() then
table.insert(tableCheck(),v);
elseif v[2] ~= 0 then
table.insert(Sorted,{{0, 0, "INV_Box_01", WHITE..v[5], ""},v});
table.insert(sorted,{{0, 0, "INV_Box_01", WHITE..v[5], ""},v});
end
end
AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum] = {};
AtlasLootWishList[type][tNumb] = {};
local num = 1
for i,v in ipairs(Sorted) do
for i,v in ipairs(sorted) do
for n,t in ipairs(v) do
if num ~= 1 and t[3] == "INV_Box_01" then
table.insert(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum],{num, 0, "Blank", WHITE.." ", ""});
table.insert(AtlasLootWishList[type][tNumb],{num, 0, "Blank", WHITE.." ", ""});
num = num + 1;
end
table.insert(AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum],{num,t[2],t[3],t[4],t[5],t[6],t[7],t[8]});
table.insert(AtlasLootWishList[type][tNumb],{num,t[2],t[3],t[4],t[5],t[6],t[7],t[8]});
num = num + 1;
end
end
AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Name = name;
AtlasLootWishList[AtlasLoot_CurrentWishList["Show"].ListType][AtlasLoot_CurrentWishList["Show"].ListNum].Icon = icon;
if refresh == nil then
AtlasLoot:ShowWishList(AtlasLoot_CurrentWishList["Show"].ListType, AtlasLoot_CurrentWishList["Show"].ListNum);
AtlasLootWishList[type][tNumb].Name = name;
AtlasLootWishList[type][tNumb].Icon = icon;
if refresh then
AtlasLoot:ShowWishList(type, tNumb);
end
end
@@ -466,7 +469,7 @@ function AtlasLoot:WishListOptionsRegister()
);
AtlasLoot_WishListOptions:AddLine(
"text", AL["Sort Wishlist"],
"func", function() AtlasLoot:SortWishList() end,
"func", function() AtlasLoot:SortWishList(true,AtlasLoot_CurrentWishList["Show"].ListType,AtlasLoot_CurrentWishList["Show"].ListNum) end,
"notCheckable", true
);
if AtlasLootItemsFrame.refresh[2] == "AtlasLoot_CurrentWishList" and AtlasLoot_CurrentWishList["Show"].ListType == "Shared" then
@@ -903,8 +906,10 @@ function AtlasLoot_CreateWishlistOptions()
WishListAutoSort:SetScript("OnClick", function()
if AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] then
AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] = false;
AtlasLootItemsFrame_Wishlist_UnLock:Enable();
else
AtlasLootWishList["Options"][playerName]["AutoSortWishlist"] = true;
AtlasLootItemsFrame_Wishlist_UnLock:Disable();
end
end)
@@ -35,28 +35,11 @@ Called whenever the loot browser is shown and sets up buttons and loot tables
function AtlasLootDefaultFrame_OnShow()
--Definition of where I want the loot table to be shown
--Remove the selection of a loot table in Atlas
AtlasLootItemsFrame.activeBoss = nil;
-- checks to see if there is an instance to auto load its loottable
local function findInstance()
for i,v in pairs(AtlasLoot_SubMenus) do
for n,t in ipairs(v) do
if t[4] == BabbleZone[GetRealZoneText()] then
ATLASLOOT_CURRENTTABLE = v.SubMenu;
ATLASLOOT_LASTMODULE = v.Module;
AtlasLoot:IsLootTableAvailable(ATLASLOOT_LASTMODULE);
AtlasLoot:ShowItemsFrame(t[2], "AtlasLoot_Data", 1);
AtlasLoot_DewdropSubMenu:Unregister(AtlasLootDefaultFrame_SubMenu);
AtlasLoot:DewdropSubMenuRegister(AtlasLoot_SubMenus[ATLASLOOT_CURRENTTABLE]);
AtlasLoot:WishListOptionsRegister();
return true;
end
end
end
end
AtlasLootItemsFrame.activeBoss = nil;
--Set the item table to the loot table
--Show the last displayed loot table
local lastboss = AtlasLoot.db.profile.LastBoss;
if AtlasLoot.db.profile.AutoCurrentInstance and findInstance() then elseif lastboss and lastboss[4] then
if AtlasLoot.db.profile.AutoCurrentInstance and AtlasLoot:ShowInstance() then elseif lastboss and lastboss[4] then
ATLASLOOT_CURRENTTABLE = lastboss[5];
ATLASLOOT_LASTMODULE = lastboss[4];
AtlasLoot:IsLootTableAvailable(lastboss[4]);
@@ -69,6 +52,24 @@ function AtlasLootDefaultFrame_OnShow()
end
end
-- Show the Instance you are in
function AtlasLoot:ShowInstance()
for i,v in pairs(AtlasLoot_SubMenus) do
for n,t in ipairs(v) do
if t[4] == BabbleZone[GetRealZoneText()] then
ATLASLOOT_CURRENTTABLE = v.SubMenu;
ATLASLOOT_LASTMODULE = v.Module;
AtlasLoot:IsLootTableAvailable(ATLASLOOT_LASTMODULE);
AtlasLoot:ShowItemsFrame(t[2], "AtlasLoot_Data", 1);
AtlasLoot_DewdropSubMenu:Unregister(AtlasLootDefaultFrame_SubMenu);
AtlasLoot:DewdropSubMenuRegister(AtlasLoot_SubMenus[ATLASLOOT_CURRENTTABLE]);
AtlasLoot:WishListOptionsRegister();
return true;
end
end
end
end
--[[
AtlasLootDefaultFrame_OnHide:
When we close the loot browser, re-bind the item table to Atlas
@@ -306,6 +307,7 @@ function AtlasLoot:SetNewStyle(style)
"AtlasLootDefaultFrame_AdvancedSearchPanel_ClearButton",
"AtlasLootDefaultFrame_MapButton",
"AtlasLootDefaultFrame_MapSelectButton",
"AtlasLootDefaultFrame_LoadInstanceButton",
}
if style == "new" then
@@ -554,7 +554,7 @@ scrollSlider:SetScript("OnShow", function()
if scrollFrame.wishList then
AtlasLoot:ScrollFrameUpdate(nil,scrollFrame.wishList);
else
AtlasLoot:ScrollFrameUpdate()
AtlasLoot:ScrollFrameUpdate();
end
end)
@@ -704,7 +704,6 @@ local mapbtn = CreateFrame("Button","AtlasLootDefaultFrame_MapButton", AtlasLoot
mapbtn:SetPoint("BOTTOMLEFT",Atlasloot_SubTableFrame,0,-27.5);
mapbtn:SetText("Map");
mapbtn:SetScript("OnClick", function() AtlasLoot:MapOnShow(); end)
mapbtn:Hide();
-- Map Select Button
local mapSelbtn = CreateFrame("Button","AtlasLootDefaultFrame_MapSelectButton", AtlasLootDefaultFrame,"OptionsButtonTemplate");
@@ -718,4 +717,10 @@ local mapSelbtn = CreateFrame("Button","AtlasLootDefaultFrame_MapSelectButton",
end
end);
mapSelbtn:SetText("No Map");
mapSelbtn:Hide();
-- Load Current Instance Button
local currentInstance = CreateFrame("Button","AtlasLootDefaultFrame_LoadInstanceButton", AtlasLootDefaultFrame,"OptionsButtonTemplate");
currentInstance:SetSize(283,24);
currentInstance:SetPoint("BOTTOMRIGHT",Atlasloot_SubTableFrame,10,-58);
currentInstance:SetScript("OnClick", function() AtlasLoot:ShowInstance(); end)
currentInstance:SetText("Load Current Instance");