fix: poor tooltip for mailboxframe

This commit is contained in:
Salikh Gurgenidze
2025-12-27 22:59:42 +04:00
parent 0c2954d230
commit 6808a21479
4 changed files with 153 additions and 15 deletions
+42
View File
@@ -230,6 +230,48 @@ function DB:SaveMailbox(mailboxData)
end
end
-- Add a single mail entry to a character's mailbox
function DB:AddMailToCharacter(name, realm, mailRow)
local fullName = name .. "-" .. (realm or playerRealm)
local char = Guda_DB.characters[fullName]
if char then
if not char.mailbox then
char.mailbox = {}
end
-- Check if this exact mail already exists (simplistic check)
local exists = false
for _, m in ipairs(char.mailbox) do
if m.sender == mailRow.sender and m.subject == mailRow.subject and m.money == mailRow.money then
if (not m.item and not mailRow.item) or (m.item and mailRow.item and m.item.name == mailRow.item.name and m.item.count == mailRow.item.count) then
exists = true
-- Update link/itemID if missing in existing but present in new
if mailRow.item and m.item then
if not m.item.link and mailRow.item.link then
m.item.link = mailRow.item.link
addon:Debug("Updated link for existing mail item")
end
if not m.item.itemID and mailRow.item.itemID then
m.item.itemID = mailRow.item.itemID
addon:Debug("Updated itemID for existing mail item")
end
end
break
end
end
end
if not exists then
table.insert(char.mailbox, 1, mailRow) -- Add to beginning
char.lastUpdate = time()
addon:Debug("Added outgoing mail to %s's mailbox", fullName)
return true
end
end
return false
end
-- Get all characters (optionally filter by faction and/or realm)
function DB:GetAllCharacters(sameFactionOnly, currentRealmOnly)
local chars = {}