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;
-- AtlasLootOptions_Init();
-- 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
if(EarthFeature_AddButton) then
EarthFeature_AddButton(
@@ -2139,34 +2145,34 @@ function AtlasLootMinimapButton_SetPosition(v)
AtlasLootMinimapButton_UpdatePosition();
end
function AtlasLoot_Strsplit(delim, str, maxNb, onlyLast)
-- Eliminate bad cases...
if string.find(str, delim) == nil then
return { str }
end
if maxNb == nil or maxNb < 1 then
maxNb = 0
end
local result = {}
local pat = "(.-)" .. delim .. "()"
local nb = 0
local lastPos
for part, pos in string.gfind(str, pat) do
nb = nb + 1
result[nb] = part
lastPos = pos
if nb == maxNb then break end
end
-- Handle the last field
if nb ~= maxNb then
result[nb+1] = string.sub(str, lastPos)
end
if onlyLast then
return result[nb+1]
else
return result[1], result[2]
end
end
-- function AtlasLoot_Strsplit(delim, str, maxNb, onlyLast)
-- -- Eliminate bad cases...
-- if string.find(str, delim) == nil then
-- return { str }
-- end
-- if maxNb == nil or maxNb < 1 then
-- maxNb = 0
-- end
-- local result = {}
-- local pat = "(.-)" .. delim .. "()"
-- local nb = 0
-- local lastPos
-- for part, pos in string.gfind(str, pat) do
-- nb = nb + 1
-- result[nb] = part
-- lastPos = pos
-- if nb == maxNb then break end
-- end
-- -- Handle the last field
-- if nb ~= maxNb then
-- result[nb+1] = string.sub(str, lastPos)
-- end
-- if onlyLast then
-- return result[nb+1]
-- else
-- return result[1], result[2]
-- end
-- end
--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
@@ -3113,7 +3119,8 @@ function AtlasLootItem_OnClick(arg1)
local color = strsub(getglobal("AtlasLootItem_"..this:GetID().."_Name"):GetText(), 1, 10);
local id = this:GetID();
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 dataSource = AtlasLootItemsFrame.refresh[2]
local bossName = AtlasLootItemsFrame.refresh[3]
+4 -2
View File
@@ -201,6 +201,7 @@ function AtlasLoot_GetWishListSubheadingBoss(dataID)
end
function GetLootTableParent(dataID)
if not dataID then return end
local parentID ;
for i, v in pairs(AtlasLoot_TableNamesBoss) do
for j,k in pairs(v) do
@@ -224,7 +225,7 @@ function AtlasLoot_CategorizeWishList(wlTable)
for _, v in pairs(wlTable) do
if v[5] and v[5] ~= "" then
local dataID = AtlasLoot_Strsplit("|", v[5]);
local _, _, dataID = strfind(v[5], "^(.+)|.+");
-- Build subheading table
if not subheadings[dataID] then
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.
local box = k 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)
table.insert(result, { 0, "INV_Box_01", "=q6="..box, "=q0="..parent });