feat: cross acount / cross realm character data
This commit is contained in:
+81
-8
@@ -314,6 +314,8 @@ end
|
|||||||
-- Get all characters (optionally filter by faction and/or realm)
|
-- Get all characters (optionally filter by faction and/or realm)
|
||||||
function DB:GetAllCharacters(sameFactionOnly, currentRealmOnly)
|
function DB:GetAllCharacters(sameFactionOnly, currentRealmOnly)
|
||||||
local chars = {}
|
local chars = {}
|
||||||
|
|
||||||
|
-- Own characters from SavedVariables
|
||||||
for fullName, data in pairs(Guda_DB.characters) do
|
for fullName, data in pairs(Guda_DB.characters) do
|
||||||
local factionMatch = not sameFactionOnly or data.faction == playerFaction
|
local factionMatch = not sameFactionOnly or data.faction == playerFaction
|
||||||
local realmMatch = not currentRealmOnly or data.realm == playerRealm
|
local realmMatch = not currentRealmOnly or data.realm == playerRealm
|
||||||
@@ -323,17 +325,38 @@ function DB:GetAllCharacters(sameFactionOnly, currentRealmOnly)
|
|||||||
name = data.name,
|
name = data.name,
|
||||||
realm = data.realm,
|
realm = data.realm,
|
||||||
class = data.class,
|
class = data.class,
|
||||||
classToken = data.classToken, -- English uppercase token for colors
|
classToken = data.classToken,
|
||||||
level = data.level,
|
level = data.level,
|
||||||
faction = data.faction,
|
faction = data.faction,
|
||||||
money = data.money,
|
money = data.money,
|
||||||
lastUpdate = data.lastUpdate,
|
lastUpdate = data.lastUpdate,
|
||||||
account = data.account,
|
|
||||||
isShared = data.isShared,
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Shared characters from other accounts (in-memory only)
|
||||||
|
if addon.sharedCharacters then
|
||||||
|
for fullName, data in pairs(addon.sharedCharacters) do
|
||||||
|
local factionMatch = not sameFactionOnly or data.faction == playerFaction
|
||||||
|
local realmMatch = not currentRealmOnly or data.realm == playerRealm
|
||||||
|
if factionMatch and realmMatch then
|
||||||
|
table.insert(chars, {
|
||||||
|
fullName = fullName,
|
||||||
|
name = data.name,
|
||||||
|
realm = data.realm,
|
||||||
|
class = data.class,
|
||||||
|
classToken = data.classToken,
|
||||||
|
level = data.level,
|
||||||
|
faction = data.faction,
|
||||||
|
money = data.money,
|
||||||
|
lastUpdate = data.lastUpdate,
|
||||||
|
account = data.account,
|
||||||
|
isShared = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Sort by name
|
-- Sort by name
|
||||||
table.sort(chars, function(a, b)
|
table.sort(chars, function(a, b)
|
||||||
return a.name < b.name
|
return a.name < b.name
|
||||||
@@ -342,21 +365,30 @@ function DB:GetAllCharacters(sameFactionOnly, currentRealmOnly)
|
|||||||
return chars
|
return chars
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Look up a character in own DB or shared characters
|
||||||
|
function DB:GetCharacterData(fullName)
|
||||||
|
local char = Guda_DB.characters[fullName]
|
||||||
|
if not char and addon.sharedCharacters then
|
||||||
|
char = addon.sharedCharacters[fullName]
|
||||||
|
end
|
||||||
|
return char
|
||||||
|
end
|
||||||
|
|
||||||
-- Get character's bags
|
-- Get character's bags
|
||||||
function DB:GetCharacterBags(fullName)
|
function DB:GetCharacterBags(fullName)
|
||||||
local char = Guda_DB.characters[fullName]
|
local char = self:GetCharacterData(fullName)
|
||||||
return char and char.bags or {}
|
return char and char.bags or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get character's bank
|
-- Get character's bank
|
||||||
function DB:GetCharacterBank(fullName)
|
function DB:GetCharacterBank(fullName)
|
||||||
local char = Guda_DB.characters[fullName]
|
local char = self:GetCharacterData(fullName)
|
||||||
return char and char.bank or {}
|
return char and char.bank or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get character's mailbox
|
-- Get character's mailbox
|
||||||
function DB:GetCharacterMailbox(fullName)
|
function DB:GetCharacterMailbox(fullName)
|
||||||
local char = Guda_DB.characters[fullName]
|
local char = self:GetCharacterData(fullName)
|
||||||
return char and char.mailbox or {}
|
return char and char.mailbox or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -415,13 +447,13 @@ end
|
|||||||
|
|
||||||
-- Get character's equipped items
|
-- Get character's equipped items
|
||||||
function DB:GetCharacterEquipped(fullName)
|
function DB:GetCharacterEquipped(fullName)
|
||||||
local char = Guda_DB.characters[fullName]
|
local char = self:GetCharacterData(fullName)
|
||||||
return char and char.equipped or {}
|
return char and char.equipped or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get character info
|
-- Get character info
|
||||||
function DB:GetCharacterInfo(fullName)
|
function DB:GetCharacterInfo(fullName)
|
||||||
local char = Guda_DB.characters[fullName]
|
local char = self:GetCharacterData(fullName)
|
||||||
return char and char.character or {}
|
return char and char.character or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -435,6 +467,16 @@ function DB:GetTotalMoney(sameFactionOnly, currentRealmOnly)
|
|||||||
total = total + (data.money or 0)
|
total = total + (data.money or 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- Include shared characters
|
||||||
|
if addon.sharedCharacters then
|
||||||
|
for fullName, data in pairs(addon.sharedCharacters) do
|
||||||
|
local factionMatch = not sameFactionOnly or data.faction == playerFaction
|
||||||
|
local realmMatch = not currentRealmOnly or data.realm == playerRealm
|
||||||
|
if factionMatch and realmMatch then
|
||||||
|
total = total + (data.money or 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
return total
|
return total
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -455,6 +497,37 @@ function DB:ToggleGoldBlacklist(fullName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Clean up blacklist entries for characters that no longer exist
|
||||||
|
-- Call after SharedData import so shared characters are present
|
||||||
|
function DB:CleanupBlacklist()
|
||||||
|
if not Guda_DB.goldBlacklist then return end
|
||||||
|
for fullName in pairs(Guda_DB.goldBlacklist) do
|
||||||
|
local exists = Guda_DB.characters[fullName] or (addon.sharedCharacters and addon.sharedCharacters[fullName])
|
||||||
|
if not exists then
|
||||||
|
Guda_DB.goldBlacklist[fullName] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove a character from the database entirely
|
||||||
|
function DB:RemoveCharacter(fullName)
|
||||||
|
if not fullName then return end
|
||||||
|
-- Don't allow removing the current character
|
||||||
|
local currentFullName = playerName and playerRealm and (playerName .. "-" .. playerRealm)
|
||||||
|
if fullName == currentFullName then return false end
|
||||||
|
|
||||||
|
if Guda_DB.characters[fullName] then
|
||||||
|
Guda_DB.characters[fullName] = nil
|
||||||
|
end
|
||||||
|
if addon.sharedCharacters and addon.sharedCharacters[fullName] then
|
||||||
|
addon.sharedCharacters[fullName] = nil
|
||||||
|
end
|
||||||
|
if Guda_DB.goldBlacklist and Guda_DB.goldBlacklist[fullName] then
|
||||||
|
Guda_DB.goldBlacklist[fullName] = nil
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
-- Get character setting
|
-- Get character setting
|
||||||
function DB:GetSetting(key)
|
function DB:GetSetting(key)
|
||||||
-- SavedVariables may not be initialized yet when some UI OnLoad scripts run
|
-- SavedVariables may not be initialized yet when some UI OnLoad scripts run
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ function Main:Initialize()
|
|||||||
addon.Modules.SharedData:Initialize()
|
addon.Modules.SharedData:Initialize()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Clean up blacklist for deleted characters (after shared import)
|
||||||
|
addon.Modules.DB:CleanupBlacklist()
|
||||||
|
|
||||||
-- Initialize item detection (before scanners, as they may use it)
|
-- Initialize item detection (before scanners, as they may use it)
|
||||||
if addon.Modules.ItemDetection then
|
if addon.Modules.ItemDetection then
|
||||||
addon.Modules.ItemDetection:Initialize()
|
addon.Modules.ItemDetection:Initialize()
|
||||||
|
|||||||
+25
-12
@@ -2,33 +2,47 @@
|
|||||||
-- Cross-account character data sharing via GudaIO DLL (optional)
|
-- Cross-account character data sharing via GudaIO DLL (optional)
|
||||||
-- The DLL merges all accounts' SavedVariables at startup into GudaShared.lua
|
-- The DLL merges all accounts' SavedVariables at startup into GudaShared.lua
|
||||||
-- which is loaded via .toc and sets Guda_SharedCharacters global.
|
-- which is loaded via .toc and sets Guda_SharedCharacters global.
|
||||||
-- No Lua hooking needed - pure file I/O at DLL load time.
|
--
|
||||||
|
-- IMPORTANT: Shared characters are stored in addon.sharedCharacters (in-memory only),
|
||||||
|
-- NOT in Guda_DB.characters, to prevent them from leaking into SavedVariables.
|
||||||
|
|
||||||
local addon = Guda
|
local addon = Guda
|
||||||
|
|
||||||
local SharedData = {}
|
local SharedData = {}
|
||||||
addon.Modules.SharedData = SharedData
|
addon.Modules.SharedData = SharedData
|
||||||
|
|
||||||
-- Import shared characters from other accounts
|
|
||||||
function SharedData:Initialize()
|
function SharedData:Initialize()
|
||||||
|
-- Clean up any leaked shared characters from the old approach
|
||||||
|
if Guda_DB and Guda_DB.characters then
|
||||||
|
for fullName, data in pairs(Guda_DB.characters) do
|
||||||
|
if data.isShared then
|
||||||
|
Guda_DB.characters[fullName] = nil
|
||||||
|
else
|
||||||
|
-- Strip leaked fields from own characters
|
||||||
|
data.isShared = nil
|
||||||
|
data.account = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Initialize in-memory shared characters table
|
||||||
|
addon.sharedCharacters = {}
|
||||||
|
|
||||||
if not Guda_SharedCharacters or type(Guda_SharedCharacters) ~= "table" then
|
if not Guda_SharedCharacters or type(Guda_SharedCharacters) ~= "table" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Determine current account by checking which characters are ours
|
-- Determine which characters belong to the current account
|
||||||
-- (characters in Guda_DB.characters that don't have isShared flag)
|
|
||||||
local myChars = {}
|
local myChars = {}
|
||||||
if Guda_DB and Guda_DB.characters then
|
if Guda_DB and Guda_DB.characters then
|
||||||
for fullName, data in pairs(Guda_DB.characters) do
|
for fullName in pairs(Guda_DB.characters) do
|
||||||
if not data.isShared then
|
myChars[fullName] = true
|
||||||
myChars[fullName] = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Find which account name belongs to us by checking overlap
|
-- Find which account name belongs to us by checking overlap
|
||||||
local myAccount = nil
|
local myAccount = nil
|
||||||
local accountChars = {} -- account -> { fullName -> true }
|
local accountChars = {}
|
||||||
for fullName, charData in pairs(Guda_SharedCharacters) do
|
for fullName, charData in pairs(Guda_SharedCharacters) do
|
||||||
local acct = charData.account
|
local acct = charData.account
|
||||||
if acct then
|
if acct then
|
||||||
@@ -47,13 +61,12 @@ function SharedData:Initialize()
|
|||||||
if myAccount then break end
|
if myAccount then break end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Import characters from other accounts
|
-- Import characters from other accounts into in-memory table
|
||||||
local importCount = 0
|
local importCount = 0
|
||||||
for fullName, charData in pairs(Guda_SharedCharacters) do
|
for fullName, charData in pairs(Guda_SharedCharacters) do
|
||||||
if charData.account and charData.account ~= myAccount then
|
if charData.account and charData.account ~= myAccount then
|
||||||
-- Don't overwrite our own characters
|
|
||||||
if not myChars[fullName] then
|
if not myChars[fullName] then
|
||||||
Guda_DB.characters[fullName] = {
|
addon.sharedCharacters[fullName] = {
|
||||||
name = charData.name,
|
name = charData.name,
|
||||||
realm = charData.realm,
|
realm = charData.realm,
|
||||||
faction = charData.faction,
|
faction = charData.faction,
|
||||||
|
|||||||
+29
-26
@@ -277,36 +277,39 @@ function Tooltip:AddInventoryInfo(tooltip, link)
|
|||||||
local currentPlayerName = addon.Modules.DB:GetPlayerFullName()
|
local currentPlayerName = addon.Modules.DB:GetPlayerFullName()
|
||||||
local currentRealm = GetRealmName()
|
local currentRealm = GetRealmName()
|
||||||
|
|
||||||
-- Count items across characters on current realm only
|
-- Count items across characters on current realm only (own + shared)
|
||||||
for charName, charData in pairs(Guda_DB.characters) do
|
local function countFromSource(source, isSharedSource)
|
||||||
-- Ensure charData is actually a table, on current realm, and not blacklisted
|
for charName, charData in pairs(source) do
|
||||||
if type(charData) == "table" and charData.realm == currentRealm and not addon.Modules.DB:IsGoldBlacklisted(charName) then
|
if type(charData) == "table" and charData.realm == currentRealm and not addon.Modules.DB:IsGoldBlacklisted(charName) then
|
||||||
local isCurrentChar = (charName == currentPlayerName)
|
local isCurrentChar = (charName == currentPlayerName)
|
||||||
local bagCount, bankCount, equippedCount, mailCount = CountItemsForCharacter(itemID, charData, isCurrentChar)
|
local bagCount, bankCount, equippedCount, mailCount = CountItemsForCharacter(itemID, charData, isCurrentChar)
|
||||||
|
|
||||||
if bagCount > 0 or bankCount > 0 or equippedCount > 0 or mailCount > 0 then
|
if bagCount > 0 or bankCount > 0 or equippedCount > 0 or mailCount > 0 then
|
||||||
hasAnyItems = true
|
hasAnyItems = true
|
||||||
totalBags = totalBags + bagCount
|
totalBags = totalBags + bagCount
|
||||||
totalBank = totalBank + bankCount
|
totalBank = totalBank + bankCount
|
||||||
totalMail = totalMail + mailCount
|
totalMail = totalMail + mailCount
|
||||||
totalEquipped = totalEquipped + equippedCount
|
totalEquipped = totalEquipped + equippedCount
|
||||||
ccIndex = ccIndex + 1
|
ccIndex = ccIndex + 1
|
||||||
-- Reuse existing sub-table or create one that persists
|
if not characterCounts[ccIndex] then
|
||||||
if not characterCounts[ccIndex] then
|
characterCounts[ccIndex] = {}
|
||||||
characterCounts[ccIndex] = {}
|
end
|
||||||
|
local entry = characterCounts[ccIndex]
|
||||||
|
entry.name = charData.name or charName
|
||||||
|
entry.classToken = charData.classToken
|
||||||
|
entry.bagCount = bagCount
|
||||||
|
entry.bankCount = bankCount
|
||||||
|
entry.mailCount = mailCount
|
||||||
|
entry.equippedCount = equippedCount
|
||||||
|
entry.isCurrent = isCurrentChar
|
||||||
|
entry.isShared = isSharedSource
|
||||||
end
|
end
|
||||||
local entry = characterCounts[ccIndex]
|
|
||||||
entry.name = charData.name or charName
|
|
||||||
entry.classToken = charData.classToken
|
|
||||||
entry.bagCount = bagCount
|
|
||||||
entry.bankCount = bankCount
|
|
||||||
entry.mailCount = mailCount
|
|
||||||
entry.equippedCount = equippedCount
|
|
||||||
entry.isCurrent = isCurrentChar
|
|
||||||
entry.isShared = charData.isShared
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- If charData is not a table (string, number, etc.), just skip it
|
end
|
||||||
|
countFromSource(Guda_DB.characters, false)
|
||||||
|
if addon.sharedCharacters then
|
||||||
|
countFromSource(addon.sharedCharacters, true)
|
||||||
end
|
end
|
||||||
-- Clean up any stale entries beyond current count
|
-- Clean up any stale entries beyond current count
|
||||||
for i = ccIndex + 1, table.getn(characterCounts) do
|
for i = ccIndex + 1, table.getn(characterCounts) do
|
||||||
|
|||||||
+2571
-2417
File diff suppressed because it is too large
Load Diff
+72
-72
@@ -2419,6 +2419,67 @@ function Guda_MoneyTooltip_Hide()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Confirmation dialog for character removal
|
||||||
|
StaticPopupDialogs["GUDA_REMOVE_CHARACTER"] = {
|
||||||
|
text = "Remove %s from Guda tracking?\n\nThis will delete all saved data for this character.",
|
||||||
|
button1 = "Remove",
|
||||||
|
button2 = "Cancel",
|
||||||
|
OnAccept = function()
|
||||||
|
local fullName = Guda._pendingRemoveChar
|
||||||
|
if fullName then
|
||||||
|
addon.Modules.DB:RemoveCharacter(fullName)
|
||||||
|
Guda._pendingRemoveChar = nil
|
||||||
|
if moneyTooltip and moneyTooltip:IsShown() and moneyTooltip.anchor then
|
||||||
|
Guda_MoneyTooltip_Show(moneyTooltip.anchor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
OnCancel = function()
|
||||||
|
Guda._pendingRemoveChar = nil
|
||||||
|
end,
|
||||||
|
timeout = 0,
|
||||||
|
whileDead = 1,
|
||||||
|
hideOnEscape = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Helper: add character entries to gold tracking dropdown at given level
|
||||||
|
local function AddGoldTrackingCharEntries(chars, level)
|
||||||
|
local currentPlayerFullName = addon.Modules.DB:GetPlayerFullName()
|
||||||
|
for _, char in ipairs(chars) do
|
||||||
|
local charFullName = char.fullName
|
||||||
|
local charName = char.name
|
||||||
|
local classColor = char.classToken and RAID_CLASS_COLORS[char.classToken]
|
||||||
|
local r, g, b = 1, 1, 1
|
||||||
|
if classColor then r, g, b = classColor.r, classColor.g, classColor.b end
|
||||||
|
|
||||||
|
-- Row 1: checkbox with character name
|
||||||
|
local info = {}
|
||||||
|
info.text = addon.Modules.Utils:ColorText(charName, r, g, b)
|
||||||
|
info.checked = not addon.Modules.DB:IsGoldBlacklisted(charFullName)
|
||||||
|
info.keepShownOnClick = 1
|
||||||
|
info.func = function()
|
||||||
|
addon.Modules.DB:ToggleGoldBlacklist(charFullName)
|
||||||
|
if moneyTooltip and moneyTooltip:IsShown() and moneyTooltip.anchor then
|
||||||
|
Guda_MoneyTooltip_Show(moneyTooltip.anchor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
UIDropDownMenu_AddButton(info, level)
|
||||||
|
|
||||||
|
-- Row 2: [X] Remove (indented, smaller feel, skip for current character)
|
||||||
|
if charFullName ~= currentPlayerFullName then
|
||||||
|
local del = {}
|
||||||
|
del.text = " |cFF888888[|r|cFFFF4444X|r|cFF888888]|r |cFF666666Remove|r"
|
||||||
|
del.notCheckable = 1
|
||||||
|
del.func = function()
|
||||||
|
Guda._pendingRemoveChar = charFullName
|
||||||
|
CloseDropDownMenus()
|
||||||
|
StaticPopup_Show("GUDA_REMOVE_CHARACTER", charName)
|
||||||
|
end
|
||||||
|
UIDropDownMenu_AddButton(del, level)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Gold tracking dropdown menu (grouped by account > realm > characters)
|
-- Gold tracking dropdown menu (grouped by account > realm > characters)
|
||||||
local function Guda_GoldTrackingMenu_Initialize()
|
local function Guda_GoldTrackingMenu_Initialize()
|
||||||
local characters = addon.Modules.DB:GetAllCharacters(false, false) -- all realms
|
local characters = addon.Modules.DB:GetAllCharacters(false, false) -- all realms
|
||||||
@@ -2454,91 +2515,30 @@ local function Guda_GoldTrackingMenu_Initialize()
|
|||||||
local level = UIDROPDOWNMENU_MENU_LEVEL or 1
|
local level = UIDROPDOWNMENU_MENU_LEVEL or 1
|
||||||
|
|
||||||
if level == 1 then
|
if level == 1 then
|
||||||
-- Level 1: account names (or realm names if single account)
|
-- Level 1: "Account - Realm" combined entries (max 2 levels deep)
|
||||||
if table.getn(accountOrder) == 1 then
|
for _, acctKey in ipairs(accountOrder) do
|
||||||
local acct = accounts[accountOrder[1]]
|
local acct = accounts[acctKey]
|
||||||
for _, realm in ipairs(acct.realmOrder) do
|
for _, realm in ipairs(acct.realmOrder) do
|
||||||
local info = {}
|
local info = {}
|
||||||
info.text = realm
|
if table.getn(accountOrder) > 1 then
|
||||||
|
info.text = acctKey .. " - " .. realm
|
||||||
|
else
|
||||||
|
info.text = realm
|
||||||
|
end
|
||||||
info.notCheckable = 1
|
info.notCheckable = 1
|
||||||
info.hasArrow = 1
|
info.hasArrow = 1
|
||||||
info.value = accountOrder[1] .. "|" .. realm
|
info.value = acctKey .. "|" .. realm
|
||||||
UIDropDownMenu_AddButton(info, 1)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
for _, acctKey in ipairs(accountOrder) do
|
|
||||||
local info = {}
|
|
||||||
info.text = acctKey
|
|
||||||
info.notCheckable = 1
|
|
||||||
info.hasArrow = 1
|
|
||||||
info.value = acctKey
|
|
||||||
UIDropDownMenu_AddButton(info, 1)
|
UIDropDownMenu_AddButton(info, 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif level == 2 then
|
elseif level == 2 then
|
||||||
local parentValue = UIDROPDOWNMENU_MENU_VALUE
|
-- Level 2: characters
|
||||||
if table.getn(accountOrder) == 1 then
|
|
||||||
local _, _, acctKey, realm = string.find(parentValue, "^(.+)|(.+)$")
|
|
||||||
local acct = accounts[acctKey]
|
|
||||||
local chars = acct and acct.realms[realm]
|
|
||||||
if chars then
|
|
||||||
for _, char in ipairs(chars) do
|
|
||||||
local charFullName = char.fullName
|
|
||||||
local classColor = char.classToken and RAID_CLASS_COLORS[char.classToken]
|
|
||||||
local r, g, b = 1, 1, 1
|
|
||||||
if classColor then r, g, b = classColor.r, classColor.g, classColor.b end
|
|
||||||
|
|
||||||
local info = {}
|
|
||||||
info.text = addon.Modules.Utils:ColorText(char.name, r, g, b)
|
|
||||||
info.checked = not addon.Modules.DB:IsGoldBlacklisted(charFullName)
|
|
||||||
info.keepShownOnClick = 1
|
|
||||||
info.func = function()
|
|
||||||
addon.Modules.DB:ToggleGoldBlacklist(charFullName)
|
|
||||||
if moneyTooltip and moneyTooltip:IsShown() and moneyTooltip.anchor then
|
|
||||||
Guda_MoneyTooltip_Show(moneyTooltip.anchor)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
UIDropDownMenu_AddButton(info, 2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
local acct = accounts[parentValue]
|
|
||||||
if acct then
|
|
||||||
for _, realm in ipairs(acct.realmOrder) do
|
|
||||||
local info = {}
|
|
||||||
info.text = realm
|
|
||||||
info.notCheckable = 1
|
|
||||||
info.hasArrow = 1
|
|
||||||
info.value = parentValue .. "|" .. realm
|
|
||||||
UIDropDownMenu_AddButton(info, 2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Guda_ScaleDropdownFonts(12)
|
|
||||||
elseif level == 3 then
|
|
||||||
local parentValue = UIDROPDOWNMENU_MENU_VALUE
|
local parentValue = UIDROPDOWNMENU_MENU_VALUE
|
||||||
local _, _, acctKey, realm = string.find(parentValue, "^(.+)|(.+)$")
|
local _, _, acctKey, realm = string.find(parentValue, "^(.+)|(.+)$")
|
||||||
local acct = accounts[acctKey]
|
local acct = accounts[acctKey]
|
||||||
local chars = acct and acct.realms[realm]
|
local chars = acct and acct.realms[realm]
|
||||||
if chars then
|
if chars then
|
||||||
for _, char in ipairs(chars) do
|
AddGoldTrackingCharEntries(chars, 2)
|
||||||
local charFullName = char.fullName
|
|
||||||
local classColor = char.classToken and RAID_CLASS_COLORS[char.classToken]
|
|
||||||
local r, g, b = 1, 1, 1
|
|
||||||
if classColor then r, g, b = classColor.r, classColor.g, classColor.b end
|
|
||||||
|
|
||||||
local info = {}
|
|
||||||
info.text = addon.Modules.Utils:ColorText(char.name, r, g, b)
|
|
||||||
info.checked = not addon.Modules.DB:IsGoldBlacklisted(charFullName)
|
|
||||||
info.keepShownOnClick = 1
|
|
||||||
info.func = function()
|
|
||||||
addon.Modules.DB:ToggleGoldBlacklist(charFullName)
|
|
||||||
if moneyTooltip and moneyTooltip:IsShown() and moneyTooltip.anchor then
|
|
||||||
Guda_MoneyTooltip_Show(moneyTooltip.anchor)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
UIDropDownMenu_AddButton(info, 3)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
Guda_ScaleDropdownFonts(12)
|
Guda_ScaleDropdownFonts(12)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user