-More LootButton Fixes

-Fixed sourcePage for Wishlist and Searching
-Fixed adding Spells and Searched items to Wishlist
This commit is contained in:
merstrax
2022-08-10 16:07:10 -04:00
parent c89e605e2d
commit 94784c5975
3 changed files with 30 additions and 24 deletions
+3 -3
View File
@@ -459,9 +459,6 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource, pFrame, tablenum)
-- Hide the map header lable
Atlasloot_HeaderLabel:Hide();
if dataID ~= "SearchResult" and dataID ~= "WishList" and dataSource ~= AtlasLoot_TokenData then
dataSource = AtlasLoot_Data;
end
if dataID == "SearchResult" then
dataSource = AtlasLootCharDB;
end
@@ -685,6 +682,9 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource, pFrame, tablenum)
itemButton.dressingroomID = IDfound;
end
itemButton.tablenum = tablenum;
itemButton.dataID = dataID;
itemButton.dataSource = dataSource;
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;
+16 -9
View File
@@ -243,14 +243,21 @@ function AtlasLootItem_OnClick(self ,arg1)
if AtlasLootItemsFrame.refresh[1] == "WishList" then
AtlasLoot_DeleteFromWishList(self.itemID);
else
AtlasLoot_ShowWishListDropDown(self.itemID, self.itemTexture, getglobal("AtlasLootItem_"..self:GetID().."_Name"):GetText(), AtlasLoot_BossName:GetText(), "", self);
if(AtlasLootItemsFrame.refresh[1] == "SearchResult") then
local datID, _, datPage = strsplit("|", self.sourcePage);
AtlasLoot_ShowWishListDropDown(self.itemID, self.itemTexture, getglobal("AtlasLootItem_"..self:GetID().."_Name"):GetText(),
AtlasLoot_Data[datID][tonumber(datPage)].Name, self.sourcePage, self);
else
AtlasLoot_ShowWishListDropDown(self.itemID, self.itemTexture, getglobal("AtlasLootItem_"..self:GetID().."_Name"):GetText(),
AtlasLoot_BossName:GetText(), self.dataID .. "|" .. "AtlasLoot_Data" .. "|" .. tostring(self.tablenum), self);
end
end
elseif((AtlasLootItemsFrame.refresh[1] == "SearchResult") and self.sourcePage) then
local dataID, dataSource = strsplit("|", self.sourcePage);
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, AtlasLootItemsFrame.refresh[3], 1);
AtlasLoot:ShowItemsFrame(dataID, AtlasLoot_Data, AtlasLootItemsFrame.refresh[3], tonumber(dataPage));
end
elseif (arg1=="LeftButton") and self.sourcePage ~= nil then
elseif (arg1=="LeftButton") and self.sourcePage then
--Create token table if there isnt one
if AtlasLoot_TokenData[self.sourcePage] == nil then
AtlasLoot:CreateToken(self.sourcePage)
@@ -268,14 +275,14 @@ function AtlasLootItem_OnClick(self ,arg1)
else
spellName, _, _, _, _, _, _, _, _ = GetSpellInfo(string.sub(self.itemID, 2));
--spellIcon = GetItemIcon(self.dressingroomID);
AtlasLoot_ShowWishListDropDown(self.itemID, self.dressingroomID, "=ds="..spellName, AtlasLootItemsFrame.refresh[1].."|"..AtlasLootItemsFrame.refresh[2],self);
AtlasLoot_ShowWishListDropDown(self.itemID, self.dressingroomID, "=ds="..spellName, AtlasLoot_BossName:GetText(), self.dataID .. "|" .. "AtlasLoot_Data" .. "|" .. tostring(self.tablenum), self);
end
elseif(IsControlKeyDown()) then
DressUpItemLink("item:"..self.dressingroomID..":0:0:0:0:0:0:0");
elseif((AtlasLootItemsFrame.refresh[1] == "SearchResult" or AtlasLootItemsFrame.refresh[1] == "WishList") and self.sourcePage) then
local dataID, dataSource = strsplit("|", self.sourcePage);
if(dataID and dataSource and AtlasLoot:IsLootTableAvailable(dataID)) then
AtlasLoot:ShowItemsFrame(dataID, dataSource, AtlasLootItemsFrame.refresh[3]);
local dataID, dataSource, dataPage = strsplit("|", self.sourcePage);
if(dataID and dataSource) then
AtlasLoot:ShowItemsFrame(dataID, AtlasLoot_Data, AtlasLootItemsFrame.refresh[3], tonumber(dataPage));
end
end
end
+11 -12
View File
@@ -625,7 +625,7 @@ end
local function DoSearch(searchText)
AtlasLootCharDB["SearchResult"] = {Name = "Search Result" , Type = "Search", Back = true};
AtlasLootCharDB.LastSearchedText = searchText;
local count = 1;
local count = 0;
local tablenum = 1;
local searchTerms = ParseQuery(searchText);
@@ -640,23 +640,22 @@ local function DoSearch(searchText)
return itemName, itemQuality, itemLvl, minLvl, itemEquipLoc, itemSubType, GetItemStats("item:" .. itemId)
end
local function AddItemToSearchResult(itemId, itemType, itemName, dataID, itemIdBackup, difCap)
local function AddItemToSearchResult(itemId, itemType, itemName, dataID, itemIdBackup, difCap, dataPage)
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 .. "|" .. "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 .. "|" .. "AtlasLoot_Data", itemIdBackup, [AtlasLoot_Difficulty.MAX_DIF] = difCap});
count = count + 1;
table.insert(AtlasLootCharDB["SearchResult"][tablenum], {(count % 30) + 1, itemId, itemType, itemName, lootPage, "", "", dataID .. "|" .. "AtlasLoot_Data" .. "|" .. tostring(dataPage), itemIdBackup, [AtlasLoot_Difficulty.MAX_DIF] = difCap});
if (count + 1) % 31 == 0 then
tablenum = tablenum + 1;
end
count = count + 1;
end
for dataID, data in pairs(AtlasLoot_Data) do
for _, t in ipairs(data) do
for dataPage, t in ipairs(data) do
for _, v in ipairs(t) do
if type(v) == "table" then
local _, itemId, itemType, atlasName = unpack(v)
@@ -672,10 +671,10 @@ local function DoSearch(searchText)
local itemDetails = {GetItemDetails(item.itemID, atlasName)};
if #searchTerms == 1 and searchTerms[1].name then
if nameMatches(atlasName, searchTerms[1].name) then
AddItemToSearchResult(itemId, itemType, atlasName, dataID, itemIdBackup, AtlasLoot_Difficulty:getMaxDifficulty(data.Type));
AddItemToSearchResult(itemId, itemType, atlasName, dataID, itemIdBackup, AtlasLoot_Difficulty:getMaxDifficulty(data.Type), dataPage);
end
elseif ItemMatchesAllTerms(searchTerms, itemDetails) then
AddItemToSearchResult(itemId, itemType, atlasName, dataID, itemIdBackup, AtlasLoot_Difficulty:getMaxDifficulty(data.Type));
AddItemToSearchResult(itemId, itemType, atlasName, dataID, itemIdBackup, AtlasLoot_Difficulty:getMaxDifficulty(data.Type), dataPage);
end
end
end)