made it so the dataSource is stored as a string

This commit is contained in:
Anch
2022-08-17 17:03:06 +12:00
parent df97a50654
commit 7709b8a208
8 changed files with 45 additions and 44 deletions
+21 -20
View File
@@ -68,6 +68,7 @@ SearchPrevData = {"", "", ""};
AtlasLootCharDB = {};
AtlasLoot_TokenData = {};
local AtlasLootDBDefaults = {
profile = {
SavedTooltips = {},
@@ -100,15 +101,6 @@ local AtlasLootDBDefaults = {
}
}
AtlasLoot_MenuList = {
"PVPSET",
"PVP70RepSET",
"ARENASET",
"ARENA2SET",
"ARENA3SET",
"ARENA4SET",
};
-- Popup Box for first time users
StaticPopupDialogs["ATLASLOOT_SETUP"] = {
text = AL["Welcome to Atlasloot Enhanced. Please take a moment to set your preferences."],
@@ -436,6 +428,7 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum)
SearchPrevData = {dataID, dataSource, tablenum};
--If the loot table name has not been passed, throw up a debugging statement
if dataID == nil then
DEFAULT_CHAT_FRAME:AddMessage("No dataID!");
@@ -459,8 +452,16 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum)
-- Hide the map header lable
Atlasloot_HeaderLabel:Hide();
if dataID == "SearchResult" then
local dataSource_backup = dataSource;
if dataID == "SearchResult" or dataSource == " AtlasLootCharDB" then
dataSource = AtlasLootCharDB;
elseif dataSource == "AtlasLoot_TokenData" then
dataSource = AtlasLoot_TokenData;
elseif dataSource == "AtlasLootWishList" then
dataSource = AtlasLootWishList;
else
dataSource = AtlasLoot_Data;
end
-- Check to see if Atlas is loaded and the table has a map
@@ -501,7 +502,7 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum)
--For stopping the subtable from changing if its a token table
if dataSource[dataID].NoSubt == nil and dataID ~= "FilterList" then
AtlasLootDefaultFrame_SubMenuText:SetText(dataSource[dataID].Name);
AtlasLoot:SubTableScrollFrameUpdate(dataID, dataSource, tablenum);
AtlasLoot:SubTableScrollFrameUpdate(dataID, dataSource_backup, tablenum);
end
--Hide UI objects so that only needed ones are shown
@@ -684,7 +685,7 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum)
itemButton.tablenum = tablenum;
itemButton.dataID = dataID;
itemButton.dataSource = dataSource;
itemButton.dataSource = dataSource_backup;
itemButton.desc = dataSource[dataID][tablenum][i][5] or nil;
itemButton.price = dataSource[dataID][tablenum][i][6] or nil;
itemButton.droprate = dataSource[dataID][tablenum][i][7] or nil;
@@ -710,12 +711,12 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum)
end
end
AtlasLootItemsFrame.refresh = {dataID, dataSource, tablenum};
AtlasLootItemsFrame.refresh = {dataID, dataSource_backup, tablenum};
if dataID ~= "WishList" and dataID ~= "FilterList" and dataSource[dataID].Back ~= true and dataID ~= "EmptyTable" 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};
AtlasLootItemsFrame.refreshOri = {dataID, dataSource_backup, tablenum};
AtlasLoot.db.profile.LastBoss = {dataID, dataSource_backup, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE};
AtlasLoot.db.profile[ATLASLOOT_CURRENTTABLE] = {dataID, dataSource_backup, tablenum, ATLASLOOT_LASTMODULE, ATLASLOOT_CURRENTTABLE};
end
--This is a valid QuickLook, so show the UI objects
@@ -742,12 +743,12 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum)
_G["AtlasLootItemsFrame_BACK"]:Hide();
_G["AtlasLootItemsFrame_NEXT"]:Hide();
_G["AtlasLootItemsFrame_PREV"]:Hide();
local tablebase = {dataID, dataSource};
local tablebase = {dataID, dataSource_backup};
if dataID == "FilterList" then
tablebase = {AtlasLootItemsFrame.refreshOri[1],AtlasLootItemsFrame.refreshOri[2]};
tablenum = AtlasLootItemsFrame.refreshOri[3];
end
if tablenum ~= #tablebase[2][tablebase[1]] then
if tablenum ~= #dataSource[dataID] then
_G["AtlasLootItemsFrame_NEXT"]:Show();
_G["AtlasLootItemsFrame_NEXT"].tablenum = tablenum + 1;
_G["AtlasLootItemsFrame_NEXT"].tablebase = tablebase;
@@ -778,9 +779,9 @@ 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
if #_G[dataSource][dataID] > 26 then
local min, max = AtlasLootDefaultFrameSubTableScrollScrollBar:GetMinMaxValues();
AtlasLootDefaultFrameSubTableScrollScrollBar:SetValue(tablenum * (max / #dataSource[dataID]));
AtlasLootDefaultFrameSubTableScrollScrollBar:SetValue(tablenum * (max / #_G[dataSource][dataID]));
end
AtlasLoot:ShowItemsFrame(dataID, dataSource, tablenum);
end
+2 -2
View File
@@ -55,7 +55,7 @@ function AtlasLoot:MapOnShow()
Atlasloot_HeaderLabel:Show();
AtlasLoot:ScrollFrameUpdate(true);
AtlasLootDefaultFrameScroll:Hide();
AtlasLoot:SubTableScrollFrameUpdate(ATLASLOOT_CURRENT_MAP, AtlasLoot_MapData);
AtlasLoot:SubTableScrollFrameUpdate(ATLASLOOT_CURRENT_MAP, "AtlasLoot_MapData");
end
end
end
@@ -74,7 +74,7 @@ end
function AtlasLoot:MapMenuClick(mapID)
if AtlasLootDefaultFrame_Map:IsVisible() then
AtlasLoot:SubTableScrollFrameUpdate(mapID, AtlasLoot_MapData);
AtlasLoot:SubTableScrollFrameUpdate(mapID, "AtlasLoot_MapData");
end
AtlasLoot:MapSelect(mapID);
AtlasLootDefaultFrame_MapSelectButton:SetText(AtlasLoot_MapData[mapID].ZoneName[1]);
+3 -3
View File
@@ -255,7 +255,7 @@ function AtlasLootItem_OnClick(self ,arg1)
elseif((AtlasLootItemsFrame.refresh[1] == "SearchResult" or AtlasLootItemsFrame.refresh[1] == "WishList") and self.sourcePage) then
local dataID, dataSource, dataPage = strsplit("|", self.sourcePage);
if(dataID and dataSource) then
AtlasLoot:ShowItemsFrame(dataID, AtlasLoot_Data, tonumber(dataPage));
AtlasLoot:ShowItemsFrame(dataID, "AtlasLoot_Data", tonumber(dataPage));
end
elseif (arg1=="LeftButton") and self.sourcePage then
--Create token table if there isnt one
@@ -263,7 +263,7 @@ function AtlasLootItem_OnClick(self ,arg1)
AtlasLoot:CreateToken(self.sourcePage)
end
--Show token table
AtlasLoot:ShowItemsFrame(self.sourcePage, AtlasLoot_TokenData, 1);
AtlasLoot:ShowItemsFrame(self.sourcePage, "AtlasLoot_TokenData", 1);
end
else
if IsShiftKeyDown() then
@@ -288,7 +288,7 @@ function AtlasLootItem_OnClick(self ,arg1)
elseif((AtlasLootItemsFrame.refresh[1] == "SearchResult" or AtlasLootItemsFrame.refresh[1] == "WishList") and self.sourcePage) then
local dataID, dataSource, dataPage = strsplit("|", self.sourcePage);
if(dataID and dataSource) then
AtlasLoot:ShowItemsFrame(dataID, AtlasLoot_Data, tonumber(dataPage));
AtlasLoot:ShowItemsFrame(dataID, "AtlasLoot_Data", tonumber(dataPage));
end
end
end
+2 -2
View File
@@ -704,7 +704,7 @@ local function DoSearch(searchText)
end
function AtlasLoot:ShowSearchResult()
AtlasLoot:ShowItemsFrame("SearchResult", AtlasLootCharDB, 1);
AtlasLoot:ShowItemsFrame("SearchResult", "AtlasLootCharDB", 1);
end
function AtlasLoot:Search(Text)
@@ -755,7 +755,7 @@ function AtlasLoot:Search(Text)
end
DEFAULT_CHAT_FRAME:AddMessage(RED .. AL["AtlasLoot"] .. ": " .. WHITE .. AL["No match found for"] .. " \"" .. Text .. "\"." .. itemFilterErrorMessage);
else
AtlasLoot:ShowItemsFrame("SearchResult", AtlasLootCharDB, 1);
AtlasLoot:ShowItemsFrame("SearchResult", "AtlasLootCharDB", 1);
end
end
+1 -1
View File
@@ -229,7 +229,7 @@ function AtlasLoot_AdvancedSearchShow()
ATLASLOOT_CURRENTTYPE = "Search";
AtlasLoot:ScrollFrameUpdate();
AtlasLoot:SubTableScrollFrameUpdate("EmptyTable",AtlasLoot_Data);
AtlasLoot:SubTableScrollFrameUpdate("EmptyTable","AtlasLoot_Data");
end
function AtlasLoot_AdvancedSearchClose()
+3 -3
View File
@@ -68,21 +68,21 @@ function AtlasLoot_ShowWishList()
AtlasLootWishList["WishList"].Name = "Wish List";
AtlasLootWishList["WishList"].Back = true;
AtlasLootWishList["WishList"][1].Name = AtlasLootWishList["Own"][playerName][lastWishListarg2]["info"][1];
AtlasLoot:ShowItemsFrame("WishList", AtlasLootWishList, 1);
AtlasLoot:ShowItemsFrame("WishList", "AtlasLootWishList", 1);
elseif lastWishListtyp == "addOther" then
AtlasLootWishList["WishList"] = AtlasLootWishList["Own"][lastWishListarg2];
sort();
AtlasLootWishList["WishList"].Name = "Wish List";
AtlasLootWishList["WishList"].Back = true;
AtlasLootWishList["WishList"][1].Name = AtlasLootWishList["Own"][lastWishListarg2][lastWishListarg3]["info"][1];
AtlasLoot:ShowItemsFrame("WishList", AtlasLootWishList, 1);
AtlasLoot:ShowItemsFrame("WishList", "AtlasLootWishList", 1);
elseif lastWishListtyp == "addShared" then
AtlasLootWishList["WishList"] = AtlasLootWishList["Shared"][lastWishListarg2];
sort();
AtlasLootWishList["WishList"].Name = "Wish List";
AtlasLootWishList["WishList"].Back = true;
AtlasLootWishList["WishList"][1].Name = AtlasLootWishList["Shared"][lastWishListarg2][lastWishListarg3]["info"][1];
AtlasLoot:ShowItemsFrame("WishList", AtlasLootWishList, 1);
AtlasLoot:ShowItemsFrame("WishList", "AtlasLootWishList", 1);
end
end
@@ -44,11 +44,11 @@ function AtlasLootDefaultFrame_OnShow()
ATLASLOOT_CURRENTTABLE = lastboss[5];
ATLASLOOT_LASTMODULE = lastboss[4];
AtlasLoot:IsLootTableAvailable(lastboss[4]);
AtlasLoot:ShowItemsFrame(lastboss[1], AtlasLoot_Data, lastboss[3]);
AtlasLoot:ShowItemsFrame(lastboss[1], "AtlasLoot_Data", lastboss[3]);
AtlasLoot_DewdropSubMenu:Unregister(AtlasLootDefaultFrame_SubMenu);
AtlasLoot:DewdropSubMenuRegister(AtlasLoot_SubMenus[lastboss[5]]);
else
AtlasLoot:ShowItemsFrame("EmptyTable", AtlasLoot_Data, 1);
AtlasLoot:ShowItemsFrame("EmptyTable", "AtlasLoot_Data", 1);
end
end
@@ -84,7 +84,7 @@ function AtlasLoot:DewDropClick(tablename, text, tablenum)
if lasttable then
AtlasLoot:ShowItemsFrame(lasttable[1], lasttable[2], lasttable[3]);
else
AtlasLoot:ShowItemsFrame(AtlasLoot_SubMenus[tablename][tablenum][2], AtlasLoot_Data, tablenum);
AtlasLoot:ShowItemsFrame(AtlasLoot_SubMenus[tablename][tablenum][2], "AtlasLoot_Data", tablenum);
end
AtlasLoot_Dewdrop:Close(1);
end
@@ -99,7 +99,7 @@ function AtlasLoot:DewDropSubMenuClick(tablename)
--Show the select loot table
local tablenum = AtlasLoot_Data[tablename].Loadfirst or 1;
--Show the table that has been selected
AtlasLoot:ShowItemsFrame(tablename, AtlasLoot_Data, tablenum);
AtlasLoot:ShowItemsFrame(tablename, "AtlasLoot_Data", tablenum);
AtlasLoot_DewdropSubMenu:Close(1);
end
@@ -124,7 +124,7 @@ function AtlasLoot:DewdropExpansionMenuClick(expansion, name)
AtlasLoot:ShowItemsFrame(lasttable[1], lasttable[2], lasttable[3]);
else
local tablenum = AtlasLoot_Data[tablename].Loadfirst or 1;
AtlasLoot:ShowItemsFrame(tablename, AtlasLoot_Data, tablenum);
AtlasLoot:ShowItemsFrame(tablename, "AtlasLoot_Data", tablenum);
end
end
@@ -490,7 +490,7 @@ local subtableFrame = CreateFrame("Frame", "Atlasloot_SubTableFrame", AtlasLootD
});
function AtlasLoot:SubTableScrollFrameUpdate(tablename, dataSource, tablenum)
local maxValue = #dataSource[tablename];
local maxValue = #_G[dataSource][tablename];
subtableFrame.tablename = tablename;
subtableFrame.dataSource = dataSource;
subtableFrame.tablenum = tablenum;
@@ -500,25 +500,25 @@ function AtlasLoot:SubTableScrollFrameUpdate(tablename, dataSource, tablenum)
local value = i + offset
subtableFrame.rows[i]:SetChecked(false);
subtableFrame.rows[i]:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight", "ADD");
if value <= maxValue and dataSource[tablename][value] and tablename ~= "SearchMENU" then
if value <= maxValue and _G[dataSource][tablename][value] and tablename ~= "SearchMENU" then
local row = subtableFrame.rows[i]
row.dataSource = dataSource;
row.tablename = tablename;
row.tablenum = value;
if dataSource == AtlasLoot_MapData then
row.Text:SetText(dataSource[tablename][value][1]);
if dataSource == "AtlasLoot_MapData" then
row.Text:SetText(_G[dataSource][tablename][value][1]);
row:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_TOP");
GameTooltip:SetText(dataSource[tablename][value][1]);
GameTooltip:SetText(_G[dataSource][tablename][value][1]);
GameTooltip:Show();
end)
row:SetScript("OnLeave", function() GameTooltip:Hide() end)
else
row.Text:SetText("|cffFFd200"..dataSource[tablename][value].Name);
row.Text:SetText("|cffFFd200".._G[dataSource][tablename][value].Name);
row:SetScript("OnEnter", function(self)
GameTooltip:Hide();
end)
if tablenum == value and dataSource ~= AtlasLoot_MapData then
if tablenum == value and dataSource ~= "AtlasLoot_MapData" then
row:SetChecked(true);
end
end
@@ -549,7 +549,7 @@ local rows2 = setmetatable({}, { __index = function(t, i)
row.Text:SetPoint("LEFT",row);
row.Text:SetJustifyH("LEFT");
row:SetScript("OnClick", function()
if row.dataSource ~= AtlasLoot_MapData then
if row.dataSource ~= "AtlasLoot_MapData" then
AtlasLoot:ShowItemsFrame(row.tablename, row.dataSource, row.tablenum);
else
row:SetChecked(false);