fix: mailbox error

This commit is contained in:
Vati
2026-04-06 19:01:48 +04:00
parent 4b67cb2fbe
commit 7eaedbf115
7 changed files with 31 additions and 3315 deletions
+1 -4
View File
@@ -16,13 +16,10 @@ function Main:Initialize()
addon.Modules.DB:Initialize()
-- Initialize cross-account sharing (optional, requires GudaIO DLL)
if addon.Modules.SharedData then
if addon.Modules.SharedData and addon.Modules.SharedData.Initialize then
addon.Modules.SharedData:Initialize()
end
-- Clean up blacklist for deleted characters (after shared import)
addon.Modules.DB:CleanupBlacklist()
-- Initialize item detection (before scanners, as they may use it)
if addon.Modules.ItemDetection then
addon.Modules.ItemDetection:Initialize()
+6 -1
View File
@@ -14,15 +14,20 @@ addon.Modules.SharedData = SharedData
function SharedData:Initialize()
-- Clean up any leaked shared characters from the old approach
if Guda_DB and Guda_DB.characters then
-- Collect keys to remove first (can't modify table during pairs iteration)
local toRemove = {}
for fullName, data in pairs(Guda_DB.characters) do
if data.isShared then
Guda_DB.characters[fullName] = nil
table.insert(toRemove, fullName)
else
-- Strip leaked fields from own characters
data.isShared = nil
data.account = nil
end
end
for _, fullName in ipairs(toRemove) do
Guda_DB.characters[fullName] = nil
end
end
-- Initialize in-memory shared characters table
+9 -8
View File
@@ -277,9 +277,14 @@ function Tooltip:AddInventoryInfo(tooltip, link)
local currentPlayerName = addon.Modules.DB:GetPlayerFullName()
local currentRealm = GetRealmName()
-- Count items across characters on current realm only (own + shared)
local function countFromSource(source, isSharedSource)
for charName, charData in pairs(source) do
-- Count items across characters on current realm only
local sources = { { data = Guda_DB.characters, shared = false } }
if addon.sharedCharacters then
table.insert(sources, { data = addon.sharedCharacters, shared = true })
end
for _, source in ipairs(sources) do
for charName, charData in pairs(source.data) do
if type(charData) == "table" and charData.realm == currentRealm and not addon.Modules.DB:IsGoldBlacklisted(charName) then
local isCurrentChar = (charName == currentPlayerName)
local bagCount, bankCount, equippedCount, mailCount = CountItemsForCharacter(itemID, charData, isCurrentChar)
@@ -302,15 +307,11 @@ function Tooltip:AddInventoryInfo(tooltip, link)
entry.mailCount = mailCount
entry.equippedCount = equippedCount
entry.isCurrent = isCurrentChar
entry.isShared = isSharedSource
entry.isShared = source.shared
end
end
end
end
countFromSource(Guda_DB.characters, false)
if addon.sharedCharacters then
countFromSource(addon.sharedCharacters, true)
end
-- Clean up any stale entries beyond current count
for i = ccIndex + 1, table.getn(characterCounts) do
characterCounts[i] = nil