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
+12 -4
View File
@@ -33,9 +33,11 @@ function DB:Initialize()
showBankInBags = true,
showOtherChars = true,
bagColumns = 10,
bankColumns = 15,
bankBagColumns = 8,
bankColumns = 10,
sortMethod = "quality", -- quality, name, type
iconSize = addon.Constants and addon.Constants.BUTTON_SIZE or 37,
iconSize = 40,
iconSpacing = 0,
iconFontSize = 12,
},
}
@@ -45,11 +47,17 @@ function DB:Initialize()
if not Guda_CharDB.settings.bagColumns then
Guda_CharDB.settings.bagColumns = 10
end
if not Guda_CharDB.settings.bankBagColumns then
Guda_CharDB.settings.bankBagColumns = 8
end
if not Guda_CharDB.settings.bankColumns then
Guda_CharDB.settings.bankColumns = 15
Guda_CharDB.settings.bankColumns = 10
end
if not Guda_CharDB.settings.iconSize then
Guda_CharDB.settings.iconSize = addon.Constants and addon.Constants.BUTTON_SIZE or 37
Guda_CharDB.settings.iconSize = 40
end
if not Guda_CharDB.settings.iconSpacing then
Guda_CharDB.settings.iconSpacing = 0
end
if not Guda_CharDB.settings.iconFontSize then
Guda_CharDB.settings.iconFontSize = 12
+5 -3
View File
@@ -47,9 +47,11 @@ addon.Constants = {
SAVE_INTERVAL = 1800, -- 30 minutes in seconds
-- UI Constants
BUTTON_SIZE = 37,
BUTTON_SPACING = 4,
BUTTONS_PER_ROW = 8,
BUTTON_SIZE = 40,
BUTTON_SPACING = 0,
BUTTONS_PER_ROW = 10,
MIN_ICON_SIZE = 30,
MAX_ICON_SIZE = 64,
}
-- Initialize modules storage
+6 -38
View File
@@ -6,24 +6,9 @@ local addon = Guda
local Main = {}
addon.Modules.Main = Main
-- Auto-save timer
local autoSaveFrame = CreateFrame("Frame")
local timeSinceLastSave = 0
local SAVE_INTERVAL = addon.Constants.SAVE_INTERVAL
-- Auto-save update
autoSaveFrame:SetScript("OnUpdate", function()
timeSinceLastSave = timeSinceLastSave + arg1
if timeSinceLastSave >= SAVE_INTERVAL then
Main:AutoSave()
timeSinceLastSave = 0
end
end)
-- Perform auto-save
function Main:AutoSave()
addon:Debug("Auto-saving data...")
-- Manual save function (for slash command)
function Main:SaveData()
addon:Debug("Saving data...")
-- Save bags
addon.Modules.BagScanner:SaveToDatabase()
@@ -36,7 +21,7 @@ function Main:AutoSave()
-- Save money
addon.Modules.MoneyTracker:Update()
addon:Debug("Auto-save complete")
addon:Debug("Save complete")
end
-- Initialize addon
@@ -58,28 +43,11 @@ function Main:Initialize()
addon.Modules.BankFrame:Initialize()
addon.Modules.SettingsPopup:Initialize()
-- Save on logout
addon.Modules.Events:OnPlayerLogout(function()
addon:Print("Saving data on logout...")
Main:AutoSave()
end, "Main")
-- Setup slash commands
Main:SetupSlashCommands()
addon:Debug("Initialization complete")
-- Delay initial save to ensure everything is loaded
local frame = CreateFrame("Frame")
local elapsed = 0
frame:SetScript("OnUpdate", function()
elapsed = elapsed + arg1
if elapsed >= 5 then
frame:SetScript("OnUpdate", nil)
Main:AutoSave()
addon:Print("Ready! Type /guda to open bags")
end
end)
addon:Print("Ready! Type /guda to open bags")
end, "Main")
end
@@ -114,7 +82,7 @@ function Main:SetupSlashCommands()
elseif msg == "save" then
-- Manual save
Main:AutoSave()
Main:SaveData()
addon:Print("Data saved manually")
elseif msg == "debug" then