wishlist bug fix

This commit is contained in:
Spit
2025-06-20 11:55:36 +03:00
parent 5e98f67bb8
commit bd6be81d72
2 changed files with 40 additions and 31 deletions
+36 -29
View File
@@ -252,6 +252,12 @@ function AtlasLoot_OnVariablesLoaded()
-- AtlasLootCharDB.AutoQuery = false; -- AtlasLootCharDB.AutoQuery = false;
-- AtlasLootOptions_Init(); -- AtlasLootOptions_Init();
-- end -- end
for k, v in pairs(AtlasLootCharDB["WishList"]) do
if type(v[2]) == "table" then
v[2] = v[2][3] or "INV_Misc_QuestionMark"
break
end
end
--Adds an AtlasLoot button to the Feature Frame in Cosmos --Adds an AtlasLoot button to the Feature Frame in Cosmos
if(EarthFeature_AddButton) then if(EarthFeature_AddButton) then
EarthFeature_AddButton( EarthFeature_AddButton(
@@ -2139,34 +2145,34 @@ function AtlasLootMinimapButton_SetPosition(v)
AtlasLootMinimapButton_UpdatePosition(); AtlasLootMinimapButton_UpdatePosition();
end end
function AtlasLoot_Strsplit(delim, str, maxNb, onlyLast) -- function AtlasLoot_Strsplit(delim, str, maxNb, onlyLast)
-- Eliminate bad cases... -- -- Eliminate bad cases...
if string.find(str, delim) == nil then -- if string.find(str, delim) == nil then
return { str } -- return { str }
end -- end
if maxNb == nil or maxNb < 1 then -- if maxNb == nil or maxNb < 1 then
maxNb = 0 -- maxNb = 0
end -- end
local result = {} -- local result = {}
local pat = "(.-)" .. delim .. "()" -- local pat = "(.-)" .. delim .. "()"
local nb = 0 -- local nb = 0
local lastPos -- local lastPos
for part, pos in string.gfind(str, pat) do -- for part, pos in string.gfind(str, pat) do
nb = nb + 1 -- nb = nb + 1
result[nb] = part -- result[nb] = part
lastPos = pos -- lastPos = pos
if nb == maxNb then break end -- if nb == maxNb then break end
end -- end
-- Handle the last field -- -- Handle the last field
if nb ~= maxNb then -- if nb ~= maxNb then
result[nb+1] = string.sub(str, lastPos) -- result[nb+1] = string.sub(str, lastPos)
end -- end
if onlyLast then -- if onlyLast then
return result[nb+1] -- return result[nb+1]
else -- else
return result[1], result[2] -- return result[1], result[2]
end -- end
end -- end
--This is a multi-layer table defining the main loot listing. --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 --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
@@ -3113,7 +3119,8 @@ function AtlasLootItem_OnClick(arg1)
local color = strsub(getglobal("AtlasLootItem_"..this:GetID().."_Name"):GetText(), 1, 10); local color = strsub(getglobal("AtlasLootItem_"..this:GetID().."_Name"):GetText(), 1, 10);
local id = this:GetID(); local id = this:GetID();
local name = strsub(getglobal("AtlasLootItem_"..this:GetID().."_Name"):GetText(), 11); local name = strsub(getglobal("AtlasLootItem_"..this:GetID().."_Name"):GetText(), 11);
local texture = AtlasLoot_Strsplit("\\", getglobal("AtlasLootItem_"..this:GetID().."_Icon"):GetTexture(), 0, true) local _, _, texture = strfind(getglobal("AtlasLootItem_"..this:GetID().."_Icon"):GetTexture() or "", ".+\\(.+)$")
texture = texture or "INV_Misc_QuestionMark"
local dataID = AtlasLootItemsFrame.refresh[1] local dataID = AtlasLootItemsFrame.refresh[1]
local dataSource = AtlasLootItemsFrame.refresh[2] local dataSource = AtlasLootItemsFrame.refresh[2]
local bossName = AtlasLootItemsFrame.refresh[3] local bossName = AtlasLootItemsFrame.refresh[3]
+4 -2
View File
@@ -201,6 +201,7 @@ function AtlasLoot_GetWishListSubheadingBoss(dataID)
end end
function GetLootTableParent(dataID) function GetLootTableParent(dataID)
if not dataID then return end
local parentID ; local parentID ;
for i, v in pairs(AtlasLoot_TableNamesBoss) do for i, v in pairs(AtlasLoot_TableNamesBoss) do
for j,k in pairs(v) do for j,k in pairs(v) do
@@ -224,7 +225,7 @@ function AtlasLoot_CategorizeWishList(wlTable)
for _, v in pairs(wlTable) do for _, v in pairs(wlTable) do
if v[5] and v[5] ~= "" then if v[5] and v[5] ~= "" then
local dataID = AtlasLoot_Strsplit("|", v[5]); local _, _, dataID = strfind(v[5], "^(.+)|.+");
-- Build subheading table -- Build subheading table
if not subheadings[dataID] then if not subheadings[dataID] then
subheadings[dataID] = AtlasLoot_GetWishListSubheadingBoss(dataID); subheadings[dataID] = AtlasLoot_GetWishListSubheadingBoss(dataID);
@@ -252,7 +253,8 @@ function AtlasLoot_CategorizeWishList(wlTable)
-- some debug code that I've used to fix WishList errors before due to people adding drops to AtlasLoot incorrectly. -- some debug code that I've used to fix WishList errors before due to people adding drops to AtlasLoot incorrectly.
local box = k or "Unknown" local box = k or "Unknown"
local cat = categories[k][1][5] or "Unknown" local cat = categories[k][1][5] or "Unknown"
local parent = GetLootTableParent(AtlasLoot_Strsplit("|", cat)) or "Unknown" _, _, cat = strfind(cat, "^(.+)|.+")
local parent = GetLootTableParent(cat) or "Unknown"
--print("box: "..box.." - cat: "..cat) --print("box: "..box.." - cat: "..cat)
table.insert(result, { 0, "INV_Box_01", "=q6="..box, "=q0="..parent }); table.insert(result, { 0, "INV_Box_01", "=q6="..box, "=q0="..parent });