fix: show money for all characters
This commit is contained in:
+12
-4
@@ -33,9 +33,11 @@ function DB:Initialize()
|
|||||||
showBankInBags = true,
|
showBankInBags = true,
|
||||||
showOtherChars = true,
|
showOtherChars = true,
|
||||||
bagColumns = 10,
|
bagColumns = 10,
|
||||||
bankColumns = 15,
|
bankBagColumns = 8,
|
||||||
|
bankColumns = 10,
|
||||||
sortMethod = "quality", -- quality, name, type
|
sortMethod = "quality", -- quality, name, type
|
||||||
iconSize = addon.Constants and addon.Constants.BUTTON_SIZE or 37,
|
iconSize = 40,
|
||||||
|
iconSpacing = 0,
|
||||||
iconFontSize = 12,
|
iconFontSize = 12,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -45,11 +47,17 @@ function DB:Initialize()
|
|||||||
if not Guda_CharDB.settings.bagColumns then
|
if not Guda_CharDB.settings.bagColumns then
|
||||||
Guda_CharDB.settings.bagColumns = 10
|
Guda_CharDB.settings.bagColumns = 10
|
||||||
end
|
end
|
||||||
|
if not Guda_CharDB.settings.bankBagColumns then
|
||||||
|
Guda_CharDB.settings.bankBagColumns = 8
|
||||||
|
end
|
||||||
if not Guda_CharDB.settings.bankColumns then
|
if not Guda_CharDB.settings.bankColumns then
|
||||||
Guda_CharDB.settings.bankColumns = 15
|
Guda_CharDB.settings.bankColumns = 10
|
||||||
end
|
end
|
||||||
if not Guda_CharDB.settings.iconSize then
|
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
|
end
|
||||||
if not Guda_CharDB.settings.iconFontSize then
|
if not Guda_CharDB.settings.iconFontSize then
|
||||||
Guda_CharDB.settings.iconFontSize = 12
|
Guda_CharDB.settings.iconFontSize = 12
|
||||||
|
|||||||
+5
-3
@@ -47,9 +47,11 @@ addon.Constants = {
|
|||||||
SAVE_INTERVAL = 1800, -- 30 minutes in seconds
|
SAVE_INTERVAL = 1800, -- 30 minutes in seconds
|
||||||
|
|
||||||
-- UI Constants
|
-- UI Constants
|
||||||
BUTTON_SIZE = 37,
|
BUTTON_SIZE = 40,
|
||||||
BUTTON_SPACING = 4,
|
BUTTON_SPACING = 0,
|
||||||
BUTTONS_PER_ROW = 8,
|
BUTTONS_PER_ROW = 10,
|
||||||
|
MIN_ICON_SIZE = 30,
|
||||||
|
MAX_ICON_SIZE = 64,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Initialize modules storage
|
-- Initialize modules storage
|
||||||
|
|||||||
+6
-38
@@ -6,24 +6,9 @@ local addon = Guda
|
|||||||
local Main = {}
|
local Main = {}
|
||||||
addon.Modules.Main = Main
|
addon.Modules.Main = Main
|
||||||
|
|
||||||
-- Auto-save timer
|
-- Manual save function (for slash command)
|
||||||
local autoSaveFrame = CreateFrame("Frame")
|
function Main:SaveData()
|
||||||
local timeSinceLastSave = 0
|
addon:Debug("Saving data...")
|
||||||
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...")
|
|
||||||
|
|
||||||
-- Save bags
|
-- Save bags
|
||||||
addon.Modules.BagScanner:SaveToDatabase()
|
addon.Modules.BagScanner:SaveToDatabase()
|
||||||
@@ -36,7 +21,7 @@ function Main:AutoSave()
|
|||||||
-- Save money
|
-- Save money
|
||||||
addon.Modules.MoneyTracker:Update()
|
addon.Modules.MoneyTracker:Update()
|
||||||
|
|
||||||
addon:Debug("Auto-save complete")
|
addon:Debug("Save complete")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Initialize addon
|
-- Initialize addon
|
||||||
@@ -58,28 +43,11 @@ function Main:Initialize()
|
|||||||
addon.Modules.BankFrame:Initialize()
|
addon.Modules.BankFrame:Initialize()
|
||||||
addon.Modules.SettingsPopup: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
|
-- Setup slash commands
|
||||||
Main:SetupSlashCommands()
|
Main:SetupSlashCommands()
|
||||||
|
|
||||||
addon:Debug("Initialization complete")
|
addon:Debug("Initialization complete")
|
||||||
|
addon:Print("Ready! Type /guda to open bags")
|
||||||
-- 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)
|
|
||||||
end, "Main")
|
end, "Main")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -114,7 +82,7 @@ function Main:SetupSlashCommands()
|
|||||||
|
|
||||||
elseif msg == "save" then
|
elseif msg == "save" then
|
||||||
-- Manual save
|
-- Manual save
|
||||||
Main:AutoSave()
|
Main:SaveData()
|
||||||
addon:Print("Data saved manually")
|
addon:Print("Data saved manually")
|
||||||
|
|
||||||
elseif msg == "debug" then
|
elseif msg == "debug" then
|
||||||
|
|||||||
+2
-19
@@ -78,24 +78,7 @@ function BagScanner:SaveToDatabase()
|
|||||||
addon.Modules.DB:SaveBags(bagData)
|
addon.Modules.DB:SaveBags(bagData)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Auto-scan on bag updates
|
-- Initialize (no auto-save, only save when bags are opened)
|
||||||
function BagScanner:Initialize()
|
function BagScanner:Initialize()
|
||||||
addon.Modules.Events:OnBagUpdate(function()
|
addon:Debug("Bag scanner initialized")
|
||||||
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")
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ end
|
|||||||
|
|
||||||
-- Initialize bank scanner
|
-- Initialize bank scanner
|
||||||
function BankScanner:Initialize()
|
function BankScanner:Initialize()
|
||||||
-- Bank opened
|
-- Bank opened - save bank data
|
||||||
addon.Modules.Events:OnBankOpen(function()
|
addon.Modules.Events:OnBankOpen(function()
|
||||||
bankOpen = true
|
bankOpen = true
|
||||||
addon:Debug("Bank opened")
|
addon:Debug("Bank opened")
|
||||||
@@ -83,13 +83,6 @@ function BankScanner:Initialize()
|
|||||||
bankOpen = false
|
bankOpen = false
|
||||||
addon:Debug("Bank closed")
|
addon:Debug("Bank closed")
|
||||||
end, "BankScanner")
|
end, "BankScanner")
|
||||||
|
|
||||||
-- Update on bag changes while bank is open
|
|
||||||
addon.Modules.Events:OnBagUpdate(function()
|
|
||||||
if bankOpen then
|
|
||||||
BankScanner:SaveToDatabase()
|
|
||||||
end
|
|
||||||
end, "BankScanner")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check if bank is currently open
|
-- Check if bank is currently open
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ end
|
|||||||
|
|
||||||
-- Initialize money tracker
|
-- Initialize money tracker
|
||||||
function MoneyTracker:Initialize()
|
function MoneyTracker:Initialize()
|
||||||
-- Track money changes
|
-- Track money changes and save immediately
|
||||||
addon.Modules.Events:OnMoneyChanged(function()
|
addon.Modules.Events:OnMoneyChanged(function()
|
||||||
MoneyTracker:Update()
|
MoneyTracker:Update()
|
||||||
end, "MoneyTracker")
|
end, "MoneyTracker")
|
||||||
|
|
||||||
-- Initial update on login
|
-- Initial update and save on login
|
||||||
addon.Modules.Events:OnPlayerLogin(function()
|
addon.Modules.Events:OnPlayerLogin(function()
|
||||||
local frame = CreateFrame("Frame")
|
local frame = CreateFrame("Frame")
|
||||||
local elapsed = 0
|
local elapsed = 0
|
||||||
@@ -45,12 +45,8 @@ function MoneyTracker:Initialize()
|
|||||||
if elapsed >= 1 then
|
if elapsed >= 1 then
|
||||||
frame:SetScript("OnUpdate", nil)
|
frame:SetScript("OnUpdate", nil)
|
||||||
MoneyTracker:Update()
|
MoneyTracker:Update()
|
||||||
|
addon:Debug("Initial money saved")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end, "MoneyTracker")
|
end, "MoneyTracker")
|
||||||
|
|
||||||
-- Save on logout
|
|
||||||
addon.Modules.Events:OnPlayerLogout(function()
|
|
||||||
MoneyTracker:Update()
|
|
||||||
end, "MoneyTracker")
|
|
||||||
end
|
end
|
||||||
|
|||||||
+5
-1
@@ -44,6 +44,10 @@ end
|
|||||||
|
|
||||||
-- OnShow
|
-- OnShow
|
||||||
function Guda_BagFrame_OnShow(self)
|
function Guda_BagFrame_OnShow(self)
|
||||||
|
-- Save bag data when opening bags
|
||||||
|
addon.Modules.BagScanner:SaveToDatabase()
|
||||||
|
addon.Modules.MoneyTracker:Update()
|
||||||
|
|
||||||
-- Restore saved position if it exists (only if saved as BOTTOMRIGHT)
|
-- Restore saved position if it exists (only if saved as BOTTOMRIGHT)
|
||||||
if addon and addon.Modules and addon.Modules.DB then
|
if addon and addon.Modules and addon.Modules.DB then
|
||||||
local pos = addon.Modules.DB:GetSetting("bagFramePosition")
|
local pos = addon.Modules.DB:GetSetting("bagFramePosition")
|
||||||
@@ -340,7 +344,7 @@ end
|
|||||||
|
|
||||||
-- Money tooltip handler
|
-- Money tooltip handler
|
||||||
function Guda_BagFrame_MoneyOnEnter(self)
|
function Guda_BagFrame_MoneyOnEnter(self)
|
||||||
GameTooltip:SetOwner(self, "ANCHOR_TOP")
|
GameTooltip:SetOwner(self, "ANCHOR_BOTTOM")
|
||||||
GameTooltip:ClearLines()
|
GameTooltip:ClearLines()
|
||||||
|
|
||||||
-- Get all characters and total
|
-- Get all characters and total
|
||||||
|
|||||||
+25
-4
@@ -59,8 +59,10 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
-- Resize empty slot background to match icon size (slightly larger to ensure coverage)
|
-- Resize empty slot background to match icon size (slightly larger to ensure coverage)
|
||||||
if emptySlotBg then
|
if emptySlotBg then
|
||||||
emptySlotBg:ClearAllPoints()
|
emptySlotBg:ClearAllPoints()
|
||||||
emptySlotBg:SetPoint("TOPLEFT", self, "TOPLEFT", -2, 2)
|
-- Use smaller padding for small icons
|
||||||
emptySlotBg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 2, -2)
|
local bgPadding = iconSize < 44 and 1 or 2
|
||||||
|
emptySlotBg:SetPoint("TOPLEFT", self, "TOPLEFT", -bgPadding, bgPadding)
|
||||||
|
emptySlotBg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", bgPadding, -bgPadding)
|
||||||
-- Crop texture edges slightly to remove any built-in padding
|
-- Crop texture edges slightly to remove any built-in padding
|
||||||
emptySlotBg:SetTexCoord(0.1, 0.9, 0.1, 0.9)
|
emptySlotBg:SetTexCoord(0.1, 0.9, 0.1, 0.9)
|
||||||
end
|
end
|
||||||
@@ -114,6 +116,16 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
local font, _, flags = countText:GetFont()
|
local font, _, flags = countText:GetFont()
|
||||||
local fontSize = Guda.Modules.DB:GetSetting("iconFontSize") or 12
|
local fontSize = Guda.Modules.DB:GetSetting("iconFontSize") or 12
|
||||||
countText:SetFont(font, fontSize, flags)
|
countText:SetFont(font, fontSize, flags)
|
||||||
|
|
||||||
|
-- Adjust count text position based on icon size for better alignment
|
||||||
|
countText:ClearAllPoints()
|
||||||
|
if iconSize < 44 then
|
||||||
|
-- Smaller offset for small icons
|
||||||
|
countText:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -3, 3)
|
||||||
|
else
|
||||||
|
-- Standard offset for larger icons
|
||||||
|
countText:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -8, 8)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if itemData then
|
if itemData then
|
||||||
@@ -204,8 +216,17 @@ function Guda_ItemButton_SetItem(self, bagID, slotID, itemData, isBank, otherCha
|
|||||||
|
|
||||||
if iconTexture then
|
if iconTexture then
|
||||||
if self.hasItem then
|
if self.hasItem then
|
||||||
-- Make icon 3px smaller than slot for nice inset effect
|
-- Scale icon proportionally based on button size
|
||||||
local iconDisplaySize = iconSize - 15
|
-- For icons < 44: use smaller inset (4px) for better fit
|
||||||
|
-- For icons >= 44: use larger inset (15px) for classic look
|
||||||
|
local iconInset
|
||||||
|
if iconSize < 44 then
|
||||||
|
iconInset = 10 -- Small inset for small icons
|
||||||
|
else
|
||||||
|
iconInset = 15 -- Larger inset for larger icons
|
||||||
|
end
|
||||||
|
|
||||||
|
local iconDisplaySize = iconSize - iconInset
|
||||||
iconTexture:ClearAllPoints()
|
iconTexture:ClearAllPoints()
|
||||||
iconTexture:SetPoint("CENTER", self, "CENTER", 0, 0)
|
iconTexture:SetPoint("CENTER", self, "CENTER", 0, 0)
|
||||||
iconTexture:SetWidth(iconDisplaySize)
|
iconTexture:SetWidth(iconDisplaySize)
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ end
|
|||||||
function Guda_SettingsPopup_OnShow(self)
|
function Guda_SettingsPopup_OnShow(self)
|
||||||
-- Load current settings
|
-- Load current settings
|
||||||
local bagColumns = Guda.Modules.DB:GetSetting("bagColumns") or 10
|
local bagColumns = Guda.Modules.DB:GetSetting("bagColumns") or 10
|
||||||
local bankColumns = Guda.Modules.DB:GetSetting("bankColumns") or 15
|
local bankColumns = Guda.Modules.DB:GetSetting("bankColumns") or 10
|
||||||
local iconSize = Guda.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
local iconSize = Guda.Modules.DB:GetSetting("iconSize") or 40
|
||||||
local iconFontSize = Guda.Modules.DB:GetSetting("iconFontSize") or 12
|
local iconFontSize = Guda.Modules.DB:GetSetting("iconFontSize") or 12
|
||||||
local iconSpacing = Guda.Modules.DB:GetSetting("iconSpacing") or 4
|
local iconSpacing = Guda.Modules.DB:GetSetting("iconSpacing") or 0
|
||||||
local lockBags = Guda.Modules.DB:GetSetting("lockBags")
|
local lockBags = Guda.Modules.DB:GetSetting("lockBags")
|
||||||
if lockBags == nil then
|
if lockBags == nil then
|
||||||
lockBags = false
|
lockBags = false
|
||||||
@@ -139,7 +139,7 @@ function Guda_SettingsPopup_BankColumnsSlider_OnLoad(self)
|
|||||||
self:SetMinMaxValues(5, 20)
|
self:SetMinMaxValues(5, 20)
|
||||||
self:SetValueStep(1)
|
self:SetValueStep(1)
|
||||||
|
|
||||||
local currentValue = Guda.Modules.DB:GetSetting("bankColumns") or 15
|
local currentValue = Guda.Modules.DB:GetSetting("bankColumns") or 10
|
||||||
self:SetValue(currentValue)
|
self:SetValue(currentValue)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ end
|
|||||||
|
|
||||||
-- Icon Size Slider OnLoad
|
-- Icon Size Slider OnLoad
|
||||||
function Guda_SettingsPopup_IconSizeSlider_OnLoad(self)
|
function Guda_SettingsPopup_IconSizeSlider_OnLoad(self)
|
||||||
getglobal(self:GetName().."Low"):SetText("24px")
|
getglobal(self:GetName().."Low"):SetText("30px")
|
||||||
getglobal(self:GetName().."High"):SetText("64px")
|
getglobal(self:GetName().."High"):SetText("64px")
|
||||||
|
|
||||||
local text = getglobal(self:GetName().."Text")
|
local text = getglobal(self:GetName().."Text")
|
||||||
@@ -174,7 +174,7 @@ function Guda_SettingsPopup_IconSizeSlider_OnLoad(self)
|
|||||||
text:SetFont(font, 12, flags)
|
text:SetFont(font, 12, flags)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:SetMinMaxValues(24, 64)
|
self:SetMinMaxValues(30, 64)
|
||||||
self:SetValueStep(1)
|
self:SetValueStep(1)
|
||||||
|
|
||||||
local currentValue = Guda.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
local currentValue = Guda.Modules.DB:GetSetting("iconSize") or addon.Constants.BUTTON_SIZE
|
||||||
@@ -257,7 +257,7 @@ function Guda_SettingsPopup_IconSpacingSlider_OnLoad(self)
|
|||||||
self:SetMinMaxValues(-5, 10)
|
self:SetMinMaxValues(-5, 10)
|
||||||
self:SetValueStep(1)
|
self:SetValueStep(1)
|
||||||
|
|
||||||
local currentValue = Guda.Modules.DB:GetSetting("iconSpacing") or 4
|
local currentValue = Guda.Modules.DB:GetSetting("iconSpacing") or 0
|
||||||
self:SetValue(currentValue)
|
self:SetValue(currentValue)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user