feat: mailbox bug
This commit is contained in:
@@ -131,6 +131,7 @@ function DB:Initialize()
|
||||
money = 0,
|
||||
bags = {},
|
||||
bank = {},
|
||||
mailbox = {}, -- Add mailbox storage
|
||||
equipped = {}, -- Add equipped items storage
|
||||
character = {}, -- Add character info storage
|
||||
lastUpdate = time(),
|
||||
@@ -153,6 +154,10 @@ function DB:Initialize()
|
||||
char.character = {}
|
||||
addon:Debug("Added character field to existing character")
|
||||
end
|
||||
if not char.mailbox then
|
||||
char.mailbox = {}
|
||||
addon:Debug("Added mailbox field to existing character")
|
||||
end
|
||||
end
|
||||
|
||||
addon:Debug("Database initialized for %s", fullName)
|
||||
@@ -215,6 +220,16 @@ function DB:SaveMoney(copper)
|
||||
end
|
||||
end
|
||||
|
||||
-- Save mailbox data
|
||||
function DB:SaveMailbox(mailboxData)
|
||||
local char = self:GetCurrentCharacter()
|
||||
if char then
|
||||
char.mailbox = mailboxData
|
||||
char.lastUpdate = time()
|
||||
addon:Debug("Saved mailbox data")
|
||||
end
|
||||
end
|
||||
|
||||
-- Get all characters (optionally filter by faction and/or realm)
|
||||
function DB:GetAllCharacters(sameFactionOnly, currentRealmOnly)
|
||||
local chars = {}
|
||||
@@ -256,6 +271,12 @@ function DB:GetCharacterBank(fullName)
|
||||
return char and char.bank or {}
|
||||
end
|
||||
|
||||
-- Get character's mailbox
|
||||
function DB:GetCharacterMailbox(fullName)
|
||||
local char = Guda_DB.characters[fullName]
|
||||
return char and char.mailbox or {}
|
||||
end
|
||||
|
||||
-- Get character's equipped items
|
||||
function DB:GetCharacterEquipped(fullName)
|
||||
local char = Guda_DB.characters[fullName]
|
||||
|
||||
@@ -79,3 +79,11 @@ end
|
||||
function Events:OnPlayerLogout(callback, owner)
|
||||
self:Register("PLAYER_LOGOUT", callback, owner)
|
||||
end
|
||||
|
||||
function Events:OnMailShow(callback, owner)
|
||||
self:Register("MAIL_SHOW", callback, owner)
|
||||
end
|
||||
|
||||
function Events:OnMailClosed(callback, owner)
|
||||
self:Register("MAIL_CLOSED", callback, owner)
|
||||
end
|
||||
|
||||
@@ -102,11 +102,13 @@ addon.Modules = {
|
||||
Tooltip = {},
|
||||
BagScanner = {},
|
||||
BankScanner = {},
|
||||
MailboxScanner = {},
|
||||
MoneyTracker = {},
|
||||
EquipmentScanner = {},
|
||||
SortEngine = {},
|
||||
BagFrame = {},
|
||||
BankFrame = {},
|
||||
MailboxFrame = {},
|
||||
QuestItemBar = {},
|
||||
TrackedItemBar = {},
|
||||
SettingsPopup = {},
|
||||
|
||||
@@ -18,6 +18,7 @@ function Main:Initialize()
|
||||
-- Initialize scanners
|
||||
addon.Modules.BagScanner:Initialize()
|
||||
addon.Modules.BankScanner:Initialize()
|
||||
addon.Modules.MailboxScanner:Initialize()
|
||||
addon.Modules.MoneyTracker:Initialize()
|
||||
addon.Modules.EquipmentScanner:Initialize()
|
||||
|
||||
@@ -25,6 +26,7 @@ function Main:Initialize()
|
||||
addon:Print("Initializing UI...")
|
||||
addon.Modules.BagFrame:Initialize()
|
||||
addon.Modules.BankFrame:Initialize()
|
||||
addon.Modules.MailboxFrame:Initialize()
|
||||
|
||||
addon:Debug("Checking QuestItemBar module...")
|
||||
if addon.Modules.QuestItemBar and addon.Modules.QuestItemBar.isLoaded then
|
||||
@@ -103,6 +105,10 @@ function Main:SetupSlashCommands()
|
||||
-- Toggle bank
|
||||
addon.Modules.BankFrame:Toggle()
|
||||
|
||||
elseif msg == "mail" or msg == "mailbox" then
|
||||
-- Toggle mailbox
|
||||
addon.Modules.MailboxFrame:Toggle()
|
||||
|
||||
elseif msg == "sort" then
|
||||
-- Sort bags
|
||||
addon.Modules.SortEngine:SortBags()
|
||||
@@ -143,6 +149,7 @@ function Main:SetupSlashCommands()
|
||||
addon:Print("Commands:")
|
||||
addon:Print("/guda - Toggle bags")
|
||||
addon:Print("/guda bank - Toggle bank")
|
||||
addon:Print("/guda mail - Toggle mailbox")
|
||||
addon:Print("/guda sort - Sort bags")
|
||||
addon:Print("/guda sortbank - Sort bank")
|
||||
addon:Print("/guda track - Toggle item tracking")
|
||||
|
||||
Reference in New Issue
Block a user