diff --git a/Titan/TitanConfig.lua b/Titan/TitanConfig.lua
index 5411a87..5fa4bad 100644
--- a/Titan/TitanConfig.lua
+++ b/Titan/TitanConfig.lua
@@ -1533,7 +1533,7 @@ local function TitanUpdateConfigAddons()
end
args[plug_in.id] = {
type = "group",
- name = ColorVisible(plug_in.id or "", plug_in.menuText),
+ name = ColorVisible(plug_in.id, plug_in.menuText or ""),
order = idx,
args = {
name = {
@@ -1699,6 +1699,40 @@ local function TitanUpdateConfigAddons()
cmdHidden = true,
}
end
+ args[plug_in.id].args.space_50_2 = {
+ order = 59,
+ type = "description",
+ name = " ",
+ cmdHidden = true,
+ }
+ --
+ -- Custom Label
+ args[plug_in.id].args.custom_labels = {
+ order = 60,
+ type = "header",
+ name = SHOW.." "..CUSTOM.." ".."Labels",
+ }
+ args[plug_in.id].args.custom_label_show = {
+ type = "toggle",
+ name = SHOW,
+ order = 62,
+ get = function(info) return (TitanGetVar(info[1], "CustomLabelTextShow") or false) end,
+ set = function(info, v)
+ TitanToggleVar(info[1], "CustomLabelTextShow");
+ TitanPanelButton_UpdateButton(info[1])
+ end,
+ }
+ args[plug_in.id].args.custom_label_text = {
+ order = 64,
+ name = CUSTOM,
+ desc = "Custom label text to show",
+ type = "input", width = "full",
+ get = function(info) return (TitanGetVar(info[1], "CustomLabelText") or "") end,
+ set = function(info,v)
+ TitanSetVar(info[1], "CustomLabelText", v);
+ TitanPanelButton_UpdateButton(info[1])
+ end,
+ }
end
end
diff --git a/Titan/TitanPanelTemplate.lua b/Titan/TitanPanelTemplate.lua
index d17dc08..cc80599 100644
--- a/Titan/TitanPanelTemplate.lua
+++ b/Titan/TitanPanelTemplate.lua
@@ -782,7 +782,15 @@ local function TitanPanelButton_SetButtonText(id)
local values = 0
if label1 or value1 then
values = 1
- if not show_label then label1 = "" end
+ if show_label then
+ if TitanGetVar(id, "CustomLabelTextShow") then
+ -- override the label per the user
+ label1 = TitanGetVar(id, "CustomLabelText")
+ else
+ end
+ else
+ label1 = ""
+ end
if label2 or value2 then
values = 2
if not show_label then label2 = "" end
diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua
index 5a66668..e97bfc6 100644
--- a/Titan/TitanUtils.lua
+++ b/Titan/TitanUtils.lua
@@ -1353,6 +1353,16 @@ function TitanUtils_PluginFail(plugin)
}
end
+local function NoColor(name)
+ local no_color = name
+
+ -- Remove any color formatting from the name in the list
+ no_color = string.gsub(no_color, "|c........", "")
+ no_color = string.gsub(no_color, "|r", "")
+
+ return no_color
+end
+
--[[ local
NAME: TitanUtils_RegisterPluginProtected
DESC: This routine is intended to be called in a protected manner (pcall) by Titan when it attempts to register a plugin.
@@ -1404,11 +1414,28 @@ local function TitanUtils_RegisterPluginProtected(plugin)
else
-- A sanity check just in case it was already in the list
if (not TitanUtils_TableContainsValue(TitanPluginsIndex, id)) then
+ -- Herein lies any special per plugin variables Titan wishes to control
+ -- These will be overwritten from saved vars, if any
+ --
+ -- Sanity check
+ if self.registry.savedVariables then
+ -- Custom labels
+ self.registry.savedVariables.CustomLabelTextShow = false
+ self.registry.savedVariables.CustomLabelText = ""
+ end
+
-- Assign and Sort the list of plugins
TitanPlugins[id] = self.registry;
+ -- Set the name used for menus
+ if TitanPlugins[id].menuText == nil then
+ TitanPlugins[id].menuText = TitanPlugins[id].id;
+ end
+ TitanPlugins[id].menuText = NoColor(TitanPlugins[id].menuText)
+
table.insert(TitanPluginsIndex, self.registry.id);
table.sort(TitanPluginsIndex,
function(a, b)
+--[[
-- if the .menuText is missing then use .id
if TitanPlugins[a].menuText == nil then
TitanPlugins[a].menuText = TitanPlugins[a].id;
@@ -1416,6 +1443,7 @@ local function TitanUtils_RegisterPluginProtected(plugin)
if TitanPlugins[b].menuText == nil then
TitanPlugins[b].menuText = TitanPlugins[b].id;
end
+--]]
return string.lower(TitanPlugins[a].menuText)
< string.lower(TitanPlugins[b].menuText);
end
diff --git a/TitanGold/TitanGold.lua b/TitanGold/TitanGold.lua
index 9cef382..72bf47b 100644
--- a/TitanGold/TitanGold.lua
+++ b/TitanGold/TitanGold.lua
@@ -10,7 +10,7 @@
local TITAN_GOLD_ID = "Gold";
local TITAN_GOLD_COUNT_FORMAT = "%d";
local TITAN_GOLD_VERSION = TITAN_VERSION;
-local TITAN_GOLD_SPACERBAR = "--------------------";
+local TITAN_GOLD_SPACERBAR = "-----------------------";
local TITAN_GOLD_BLUE = {r=0.4,b=1,g=0.4};
local TITAN_GOLD_RED = {r=1,b=0,g=0};
local TITAN_GOLD_GREEN = {r=0,b=0,g=1};
@@ -200,6 +200,7 @@ function TitanPanelGoldButton_OnLoad(self)
SeparateServers = true,
AllServers = false,
IgnoreFaction = false,
+ GroupByRealm = false,
gold = { total = "112233", neg = false },
}
};
@@ -270,7 +271,7 @@ end
--[[
-- *******************************************************************************************
-- NAME: TitanPanelGoldButton_GetTooltipText()
--- DESC: Gets our tool-tip text, what appears when we hover over our item on the Titan bar.
+-- DESC: Gets the tool-tip text, what appears when we hover over Gold on the Titan bar.
-- *******************************************************************************************
--]]
function TitanPanelGoldButton_GetTooltipText()
@@ -291,7 +292,7 @@ function TitanPanelGoldButton_GetTooltipText()
-- insert all keys from hash into the GoldSaveSorted array
if TitanGetVar(TITAN_GOLD_ID, "SeparateServers") then
- -- Parse the database and display all characters from the same faction and server
+ -- Parse the database and display characters from this server
GoldSave[GOLD_INDEX].gold = GetMoney("player")
local coin_str = ""
local character, charserver = "", ""
@@ -312,7 +313,7 @@ function TitanPanelGoldButton_GetTooltipText()
end
end
elseif TitanGetVar(TITAN_GOLD_ID, "MergeServers") then
- -- Parse the database and display characters from the same faction on merged / connected servers
+ -- Parse the database and display characters from merged / connected servers
for ms = 1, countelements do
local server = realmNames[ms]
GoldSave[GOLD_INDEX].gold = GetMoney("player")
@@ -342,7 +343,7 @@ function TitanPanelGoldButton_GetTooltipText()
end
end
elseif TitanGetVar(TITAN_GOLD_ID, "AllServers") then
- -- Parse the database and display characters from the same faction on all servers
+ -- Parse the database and display characters from all servers
GoldSave[GOLD_INDEX].gold = GetMoney("player")
local coin_str = ""
local character, charserver = "", ""
@@ -364,41 +365,80 @@ function TitanPanelGoldButton_GetTooltipText()
end
end
- -- This next section will sort the array based on user preference
- -- either by name, or by gold amount descending.
+ local by_realm = TitanGetVar(TITAN_GOLD_ID, "GroupByRealm")
+ -- This section will sort the array based on user preference
+ -- * by name or by gold amount descending
+ -- * grouping by realm if selected
if TitanGetVar(TITAN_GOLD_ID, "SortByName") then
- table.sort(GoldSaveSorted, function (key1, key2) return GoldSave[key1].name < GoldSave[key2].name end)
+ table.sort(GoldSaveSorted, function (key1, key2)
+ if by_realm then
+ if GoldSave[key1].realm ~= GoldSave[key2].realm then
+ return GoldSave[key1].realm < GoldSave[key2].realm
+ end
+ end
+
+ return GoldSave[key1].name < GoldSave[key2].name
+ end)
else
- table.sort(GoldSaveSorted, function (key1, key2) return GoldSave[key1].gold > GoldSave[key2].gold end)
+ table.sort(GoldSaveSorted, function (key1, key2)
+ if by_realm then
+ if GoldSave[key1].realm ~= GoldSave[key2].realm then
+ return GoldSave[key1].realm < GoldSave[key2].realm
+ end
+ end
+
+ return GoldSave[key1].gold > GoldSave[key2].gold
+ end)
end
-- Array holds all characters to display, nicely sorted.
currentMoneyRichText = ""
- coin_str = ""
- faction_text = ""
+ local coin_str = ""
+ local faction_text = ""
+ local curr_realm = ""
+ local show_dash = false
+ local show_realm = true
+ local character, charserver, char_faction
for i = 1, getn(GoldSaveSorted) do
character, charserver, char_faction = ToonInfo(GoldSaveSorted[i])
coin_str = NiceCash(GoldSave[GoldSaveSorted[i]].gold, false, false)
+ show_dash = false
+ show_realm = true
+
+ if (TitanGetVar(TITAN_GOLD_ID, "SeparateServers")) then
+-- charserver = "" -- do not repeat the server on each line
+ show_realm = false
+ elseif (TitanGetVar(TITAN_GOLD_ID, "MergeServers")) then
+ show_dash = true
+-- charserver = "-"..charserver
+ elseif (TitanGetVar(TITAN_GOLD_ID, "AllServers")) then
+ show_dash = true
+ end
+
+ if by_realm then
+ -- Set a realm header
+ if charserver ~= curr_realm then
+ currentMoneyRichText = currentMoneyRichText.."\n"
+ .."-- "..charserver
+ curr_realm = charserver
+ end
+ show_dash = false
+-- charserver = "" -- do not repeat the server on each line
+ show_realm = false
+ end
if ignore_faction then
if char_faction == FACTION_ALLIANCE then
faction_text = "-".."|cff5b92e5"..FACTION_ALLIANCE.._G["FONT_COLOR_CODE_CLOSE"]
- -- "|cff5b92e5"..FACTION_ALLIANCE.._G["FONT_COLOR_CODE_CLOSE"]
elseif char_faction == FACTION_HORDE then
--- faction_text = "-".."|cffd42447"..FACTION_HORDE.._G["FONT_COLOR_CODE_CLOSE"]
faction_text = "-"..TitanUtils_GetHexText(FACTION_HORDE, "d42447")
end
end
- if (TitanGetVar(TITAN_GOLD_ID, "SeparateServers")) then
- charserver = "" -- do not repeat the server on each line
- else
- charserver = "-"..charserver
- end
-
currentMoneyRichText = currentMoneyRichText.."\n"
..character
- ..charserver
+ ..(show_dash and "-" or "")
+ ..(show_realm and charserver or "")
..faction_text
.."\t"..coin_str
end
@@ -452,13 +492,13 @@ print("TG"
coin_str = NiceCash(sesstotal, true, true)
-- ..TitanUtils_GetColoredText(GOLD_SESS_STATUS,GOLD_COLOR)
sessionMoneyRichText = sessionMoneyRichText
- ..GOLD_SESS_STATUS
+ ..TitanUtils_GetColoredText(GOLD_SESS_STATUS,GOLD_COLOR)
.."\t"..coin_str.."\n";
if TitanGetVar(TITAN_GOLD_ID, "DisplayGoldPerHour") then
coin_str = NiceCash(perhour, true, true)
sessionMoneyRichText = sessionMoneyRichText
- ..GOLD_PERHOUR_STATUS
+ ..TitanUtils_GetColoredText(GOLD_PERHOUR_STATUS,GOLD_COLOR)
.."\t"..coin_str.."\n";
end
@@ -486,9 +526,9 @@ print("TG"
end
return ""
+ ..currentMoneyRichText.."\n"
+ ..TITAN_GOLD_SPACERBAR.."\n"
..final_tooltip..final_server..final_faction.."\n"
- ..TITAN_GOLD_SPACERBAR
- ..currentMoneyRichText
..sessionMoneyRichText
end
@@ -734,13 +774,13 @@ function TitanPanelRightClickMenu_PrepareGoldMenu()
else
TitanPanelRightClickMenu_AddCommand(L["TITAN_GOLD_TOGGLE_ALL_TEXT"], TITAN_GOLD_ID,"TitanPanelGoldButton_Toggle");
end
-
- -- Function to toggle display sort
- if TitanGetVar(TITAN_GOLD_ID, "SortByName") then
- TitanPanelRightClickMenu_AddCommand(L["TITAN_GOLD_TOGGLE_SORT_GOLD"], TITAN_GOLD_ID,"TitanPanelGoldSort_Toggle");
- else
- TitanPanelRightClickMenu_AddCommand(L["TITAN_GOLD_TOGGLE_SORT_NAME"], TITAN_GOLD_ID,"TitanPanelGoldSort_Toggle");
- end
+
+ info = {};
+ info.notCheckable = true
+ info.text = RAID_FRAME_SORT_LABEL --L["TITAN_GOLD_DELETE_PLAYER"];
+ info.value = "Sorting";
+ info.hasArrow = 1;
+ TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
-- Function to toggle gold per hour sort
if TitanGetVar(TITAN_GOLD_ID, "DisplayGoldPerHour") then
@@ -810,7 +850,7 @@ function TitanPanelRightClickMenu_PrepareGoldMenu()
TitanPanelRightClickMenu_AddSeparator();
-- Which characters to show
- -- - Seprate : this server
+ -- - Separate : this server
-- - Merge : connected / merged servers
-- - All : any server
local info = {};
@@ -887,7 +927,7 @@ function TitanPanelRightClickMenu_PrepareGoldMenu()
TitanPanelRightClickMenu_AddCommand(L["TITAN_PANEL_MENU_HIDE"], TITAN_GOLD_ID, TITAN_PANEL_MENU_FUNC_HIDE);
end
- -- Second (2nd) level for show / delete
+ -- Second (2nd) level for show / delete | sort by
if TitanPanelRightClickMenu_GetDropdownLevel() == 2
and TitanPanelRightClickMenu_GetDropdMenuValue() == "ToonDelete" then
local info = {};
@@ -914,6 +954,34 @@ function TitanPanelRightClickMenu_PrepareGoldMenu()
info.value = "ShowHorde";
info.hasArrow = 1;
TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+ elseif TitanPanelRightClickMenu_GetDropdownLevel() == 2
+ and TitanPanelRightClickMenu_GetDropdMenuValue() == "Sorting" then
+ -- Show gold only option - no silver, no copper
+ local info = {};
+ info.text = L["TITAN_GOLD_TOGGLE_SORT_GOLD"]
+ info.checked = not TitanGetVar(TITAN_GOLD_ID, "SortByName");
+ info.func = function()
+ TitanPanelGoldSort_Toggle()
+ end
+ TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+ local info = {};
+ info.text = L["TITAN_GOLD_TOGGLE_SORT_NAME"]
+ info.checked = TitanGetVar(TITAN_GOLD_ID, "SortByName");
+ info.func = function()
+ TitanPanelGoldSort_Toggle()
+ end
+ TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
+
+ TitanPanelRightClickMenu_AddSeparator(TitanPanelRightClickMenu_GetDropdownLevel());
+
+ local info = {};
+ info.text = GROUP.." By Realm"
+ info.checked = TitanGetVar(TITAN_GOLD_ID, "GroupByRealm")
+ info.func = function()
+ TitanToggleVar(TITAN_GOLD_ID, "GroupByRealm")
+ end
+ TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());
end
-- Third (3rd) level for the list of characters / toons
@@ -954,17 +1022,31 @@ function TitanPanelGoldButton_Initialize_Array(self)
self:UnregisterEvent("VARIABLES_LOADED");
+ -- See if this is a new to toon to Gold
if (GoldSave[GOLD_INDEX] == nil) then
GoldSave[GOLD_INDEX] = {}
+ GoldSave[GOLD_INDEX] = {gold = GetMoney("player"), name = UnitName("player")}
end
+
+ -- Ensure the saved vars are usable
for index, money in pairs(GoldSave) do
- local character, charserver = string.match(index, "(.*)_(.*)::"..UnitFactionGroup("Player"));
+ local character, charserver = string.match(index, "(.*)_(.*)::")
+
+ -- Could be a new toon to Gold or an updated Gold
+ local show_toon = GoldSave[index].show
+ if show_toon == nil then
+ show_toon = true
+ end
+ GoldSave[index].show = show_toon
+ GoldSave[index].realm = charserver -- added July 2022
+--[[
if character == UnitName("player") and charserver == realmName then
local rementry = character.."_"..charserver.."::"..UnitFactionGroup("Player");
local showCharacter = GoldSave[rementry].show
if showCharacter == nil then showCharacter = true end
GoldSave[GOLD_INDEX] = {gold = GetMoney("player"), show = showCharacter, name = UnitName("player")}
end
+--]]
end
GOLD_STARTINGGOLD = GetMoney("player");
GOLD_SESSIONSTART = GetTime();