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
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: Guda
## Notes: All-in-one bag and bank addon for World of Warcraft 1.12.1 (Turtle WoW)
## Author: Vati
## Version: 2.2.1
## Version: 2.2.0
## SavedVariables: Guda_DB
## SavedVariablesPerCharacter: Guda_CharDB
## OptionalDeps: pfUI
+4 -3295
View File
File diff suppressed because it is too large Load Diff
+8 -4
View File
@@ -2653,8 +2653,10 @@ local function Guda_BagMailboxMenu_Initialize()
local info = {}
info.text = addon.Modules.Utils:ColorText(char.name, r, g, b)
info.func = function()
addon.Modules.MailboxFrame:ShowCharacter(charFullName)
if not Guda_MailboxFrame:IsShown() then
if addon.Modules.MailboxFrame and addon.Modules.MailboxFrame.ShowCharacter then
addon.Modules.MailboxFrame:ShowCharacter(charFullName)
end
if Guda_MailboxFrame and not Guda_MailboxFrame:IsShown() then
Guda_MailboxFrame:Show()
end
end
@@ -2673,8 +2675,10 @@ local function Guda_BagMailboxMenu_Initialize()
local info = {}
info.text = addon.Modules.Utils:ColorText(char.name, r, g, b)
info.func = function()
addon.Modules.MailboxFrame:ShowCharacter(charFullName)
if not Guda_MailboxFrame:IsShown() then
if addon.Modules.MailboxFrame and addon.Modules.MailboxFrame.ShowCharacter then
addon.Modules.MailboxFrame:ShowCharacter(charFullName)
end
if Guda_MailboxFrame and not Guda_MailboxFrame:IsShown() then
Guda_MailboxFrame:Show()
end
end
+2 -2
View File
@@ -379,7 +379,7 @@ local function Guda_MailboxCharacterMenu_Initialize()
local info = {}
info.text = addon.Modules.Utils:ColorText(char.name, r, g, b)
info.func = function() MailboxFrame:ShowCharacter(charFullName) end
local currentViewChar = MailboxFrame:GetCurrentViewChar and MailboxFrame:GetCurrentViewChar()
local currentViewChar = MailboxFrame.GetCurrentViewChar and MailboxFrame:GetCurrentViewChar()
info.checked = (currentViewChar == charFullName or (not currentViewChar and charFullName == currentPlayerFullName))
UIDropDownMenu_AddButton(info)
end
@@ -400,7 +400,7 @@ local function Guda_MailboxCharacterMenu_Initialize()
local info = {}
info.text = addon.Modules.Utils:ColorText(char.name, r, g, b)
info.func = function() MailboxFrame:ShowCharacter(charFullName) end
local currentViewChar = MailboxFrame:GetCurrentViewChar and MailboxFrame:GetCurrentViewChar()
local currentViewChar = MailboxFrame.GetCurrentViewChar and MailboxFrame:GetCurrentViewChar()
info.checked = (currentViewChar == charFullName)
UIDropDownMenu_AddButton(info)
end