fix: show money for all characters

This commit is contained in:
Salikh Gurgenidze
2025-11-16 15:41:03 +04:00
parent af2483ff05
commit 12e55039f3
9 changed files with 66 additions and 91 deletions
+2 -19
View File
@@ -78,24 +78,7 @@ function BagScanner:SaveToDatabase()
addon.Modules.DB:SaveBags(bagData)
end
-- Auto-scan on bag updates
-- Initialize (no auto-save, only save when bags are opened)
function BagScanner:Initialize()
addon.Modules.Events:OnBagUpdate(function()
BagScanner:SaveToDatabase()
end, "BagScanner")
-- Initial scan on login
addon.Modules.Events:OnPlayerLogin(function()
-- Delay to ensure bags are loaded
local frame = CreateFrame("Frame")
local elapsed = 0
frame:SetScript("OnUpdate", function()
elapsed = elapsed + arg1
if elapsed >= 1 then
frame:SetScript("OnUpdate", nil)
BagScanner:SaveToDatabase()
addon:Debug("Initial bag scan complete")
end
end)
end, "BagScanner")
addon:Debug("Bag scanner initialized")
end
+1 -8
View File
@@ -61,7 +61,7 @@ end
-- Initialize bank scanner
function BankScanner:Initialize()
-- Bank opened
-- Bank opened - save bank data
addon.Modules.Events:OnBankOpen(function()
bankOpen = true
addon:Debug("Bank opened")
@@ -83,13 +83,6 @@ function BankScanner:Initialize()
bankOpen = false
addon:Debug("Bank closed")
end, "BankScanner")
-- Update on bag changes while bank is open
addon.Modules.Events:OnBagUpdate(function()
if bankOpen then
BankScanner:SaveToDatabase()
end
end, "BankScanner")
end
-- Check if bank is currently open
+3 -7
View File
@@ -31,12 +31,12 @@ end
-- Initialize money tracker
function MoneyTracker:Initialize()
-- Track money changes
-- Track money changes and save immediately
addon.Modules.Events:OnMoneyChanged(function()
MoneyTracker:Update()
end, "MoneyTracker")
-- Initial update on login
-- Initial update and save on login
addon.Modules.Events:OnPlayerLogin(function()
local frame = CreateFrame("Frame")
local elapsed = 0
@@ -45,12 +45,8 @@ function MoneyTracker:Initialize()
if elapsed >= 1 then
frame:SetScript("OnUpdate", nil)
MoneyTracker:Update()
addon:Debug("Initial money saved")
end
end)
end, "MoneyTracker")
-- Save on logout
addon.Modules.Events:OnPlayerLogout(function()
MoneyTracker:Update()
end, "MoneyTracker")
end