Quantcast

- Volume : Revert to 9.0.2

urnati [02-15-26 - 22:43]
- Volume : Revert to 9.0.2
- Gold Add Sort By and Show sub menus
Filename
Titan/TitanHistory.lua
TitanGold/TitanGold.lua
TitanVolume/TitanVolume.lua
diff --git a/Titan/TitanHistory.lua b/Titan/TitanHistory.lua
index 20a168d..6bf87a3 100644
--- a/Titan/TitanHistory.lua
+++ b/Titan/TitanHistory.lua
@@ -10,9 +10,30 @@ These are in a seperate file to
 --- Release notes. Keep structure; most recent on 'top'
 local recent_changes = {
    {
+      version = "9.1.1",
+      when = "2026/02/16",
+      topics = {
+         {
+            {
+               topic = "Titan Gold",
+               lines = {
+                  "Fix : Added back Sort By submenu.",
+                  "Fix : Added back Show submenu.",
+               },
+            },
+            {
+               topic = "TitanVolume",
+               lines = {
+                  "Restored prior version until a better menu and widget scheme is determined. ",
+               },
+            },
+         },
+      },
+   },
+   {
       version = "9.1.0",
       when = "2026/02/02",
-      topics =  {
+      topics = {
          {
             topic = "Titan Menus",
             lines = {
@@ -75,7 +96,7 @@ local recent_changes = {
    {
       version = "9.0.2",
       when = "2026/01/12",
-      topics =  {
+      topics = {
          {
             topic = "Titan TOC",
             lines = {
@@ -107,13 +128,13 @@ local recent_changes = {
    {
       version = "9.0.1",
       when = "2025/12/01",
-      topics =  {
+      topics = {
          {
-         topic = "Profiles",
-         lines = {
-            "Profiles - Sync All added.",
-            "- Acts as the old Global; overrides Sync.",
-            "- See Titan > Config > Help > Profiles for more details on how this works.",
+            topic = "Profiles",
+            lines = {
+               "Profiles - Sync All added.",
+               "- Acts as the old Global; overrides Sync.",
+               "- See Titan > Config > Help > Profiles for more details on how this works.",
             },
          },
          {
@@ -128,50 +149,50 @@ local recent_changes = {
       version = "9.0.0",
       when = "2025/11/06",
       topics = {
-            {
+         {
             topic = "Profiles",
             lines = {
                "Profiles are greatly changed.",
                "- Global is gone; replaced by a Sync scheme.",
                "- See Titan > Config > Help > Profiles for more details on how this works.",
-               },
             },
-            {
-               topic = "Export / Import of Profiles",
-               lines = {
-                  "Profiles can be exported to be safely saved and imported to same or another system.",
-                  "- See Titan > Config > Help > Export / Import for more details on how this works.",
-               },
+         },
+         {
+            topic = "Export / Import of Profiles",
+            lines = {
+               "Profiles can be exported to be safely saved and imported to same or another system.",
+               "- See Titan > Config > Help > Export / Import for more details on how this works.",
             },
-            {
-               topic = "Reset",
-               lines = {
-                  "Due to the Profile changing to Sync :",
-                  "- /titan reset will reset the Profile used (could be a Sync).",
-                  "- /titan reset all ",
-                  "--- NEW slash command will act as a delete of Titan saved vars",
-                  "--- Also accessable in Titan > Config > Advanced",
-               },
+         },
+         {
+            topic = "Reset",
+            lines = {
+               "Due to the Profile changing to Sync :",
+               "- /titan reset will reset the Profile used (could be a Sync).",
+               "- /titan reset all ",
+               "--- NEW slash command will act as a delete of Titan saved vars",
+               "--- Also accessable in Titan > Config > Advanced",
             },
-            {
-               topic = "TitanUI",
-               lines = {
-                  "NEW built-in!",
-                  "Left click will reload UI.",
-                  "Menu gives access to :",
-                  "- Select Titan config pages.",
-                  "- Titan reset of profile (could be a Sync).",
-                  "- Select dev tools, if available.",
-               },
+         },
+         {
+            topic = "TitanUI",
+            lines = {
+               "NEW built-in!",
+               "Left click will reload UI.",
+               "Menu gives access to :",
+               "- Select Titan config pages.",
+               "- Titan reset of profile (could be a Sync).",
+               "- Select dev tools, if available.",
             },
-            {
-               topic = "Titan",
-               lines = {
-                  "Ace : Updated libs to Oct 2025 release - Should be Midnight ready!!",
-                  "Plugins : Should be less space after, esp. for those with multiple info displayed such as Perf and Repair.",
-                  "Help : Titan > Config > Help - More detailed info; Redesigned for readability.",
-               },
+         },
+         {
+            topic = "Titan",
+            lines = {
+               "Ace : Updated libs to Oct 2025 release - Should be Midnight ready!!",
+               "Plugins : Should be less space after, esp. for those with multiple info displayed such as Perf and Repair.",
+               "Help : Titan > Config > Help - More detailed info; Redesigned for readability.",
             },
+         },
       },
    },
 }
diff --git a/TitanGold/TitanGold.lua b/TitanGold/TitanGold.lua
index 86a926f..60858fa 100644
--- a/TitanGold/TitanGold.lua
+++ b/TitanGold/TitanGold.lua
@@ -216,33 +216,6 @@ local function GetConnectedRealms()
 	return realms
 end

----Take a table of indexes to sort gold
----@param gold_table table
----@return table sorted May not be need but it is explicit
-local function SortByIndex(gold_table)
-	local by_realm = TitanGetVar(TITAN_GOLD_ID, "GroupByRealm")
-	local by_name = TitanGetVar(TITAN_GOLD_ID, "SortByName")
-	-- This section will sort the array based on user preference
-	-- * by name or by gold amount descending
-	-- * grouping by realm if selected
-	if by_name then
-		table.sort(gold_table, function(key1, key2)
-			return key1 < key2
-		end)
-	elseif by_realm then
-		table.sort(gold_table, function(key1, key2)
-			if gold_table[key1].realm ~= gold_table[key2].realm then
-				return gold_table[key1].realm < gold_table[key2].realm
-			end
-			return false
-		end)
-	else
-		-- just return the table untouched
-	end
-
-	return gold_table
-end
-
 ---local Use index to get toon info from Titan
 ---@param info string
 ---@return string Character name - no server
@@ -312,13 +285,16 @@ local function EvalIndexInfo(index)
 			end

 			-- Assume server option is satisfied; check other options
-			if (res.ignore_faction or res.same_faction) then
+			if (res.ignore_faction or res.same_faction)
+			and toon_gold.show
+			then
 				res.show_toon = true
 			else
 				res.show_toon = false
 			end

 			res.gold = toon_gold.gold
+			res.show = toon_gold.show -- user option

 			str = str
 				.. " n:" .. tostring(res.char_name) .. ""
@@ -337,6 +313,7 @@ local function EvalIndexInfo(index)

 	return res
 end
+
 ---local Helper for TotalGold
 --- If toon is to be shown add amount to total; otherwise pass back running total
 local function ToonAdd(show, amount, total)
@@ -424,6 +401,39 @@ end

 -- ====== Tool tip routines

+---Take a table of toons to sort per user settings
+---@param gold_table table
+---@return table sorted May not be need but it is explicit
+local function SortByIndex(gold_table)
+--	local by_realm = TitanGetVar(TITAN_GOLD_ID, "GroupByRealm")
+	local by_name = TitanGetVar(TITAN_GOLD_ID, "SortByName")
+	-- This section will sort the array based on user preference
+	-- * by name or by gold amount descending
+	-- * grouping by realm if selected
+	if by_name == true then
+		table.sort(gold_table, function(key1, key2)
+			return key1.char_name < key2.char_name
+		end)
+--[[
+	-- 2026 Feb : Removed as a sort
+	--  it does not make sense with by_name and by_gold being on a T/F option
+	elseif by_realm then
+		table.sort(gold_table, function(key1, key2)
+			if gold_table[key1].realm ~= gold_table[key2].realm then
+				return gold_table[key1].realm < gold_table[key2].realm
+			end
+			return false
+		end)
+--]]
+	else -- by gold
+		table.sort(gold_table, function(key1, key2)
+			return key1.gold < key2.gold
+		end)
+	end
+
+	return gold_table
+end
+
 ---local Generate formatted tooltip text
 ---@return string
 local function GetTooltipText()
@@ -447,7 +457,7 @@ local function GetTooltipText()
 			if char.valid then
 				if char.same_realm and char.show_toon then
 					Titan_Debug.Out('gold', 'tool_tip', index.." "..NiceCash(char.gold, false, false))
-					table.insert(GoldSorted, index);
+					table.insert(GoldSorted, char);
 				end
 			end
 		end
@@ -459,7 +469,7 @@ local function GetTooltipText()
 			if char.valid then
 				if char.merge_realm and char.show_toon then
 					Titan_Debug.Out('gold', 'tool_tip', index.." "..NiceCash(char.gold, false, false))
-					table.insert(GoldSorted, index);
+					table.insert(GoldSorted, char);
 				end
 			end
 		end
@@ -471,7 +481,7 @@ local function GetTooltipText()
 			if char.valid then
 				if char.show_toon then
 					Titan_Debug.Out('gold', 'tool_tip', index.." "..NiceCash(char.gold, false, false))
-					table.insert(GoldSorted, index);
+					table.insert(GoldSorted, char);
 				end
 			end
 		end
@@ -490,8 +500,11 @@ local function GetTooltipText()
 	local character, charserver, char_faction
 	for i = 1, #GoldSorted do
 		local toon = GoldSorted[i]
-		character, charserver, char_faction = GetIndexInfo(toon)
-		local t_gold = TitanSettings.Players[toon].Info[TITAN_GOLD_ID].gold
+		character = toon.char_name
+		charserver = toon.server
+		char_faction = toon.faction
+
+		local t_gold = toon.gold --TitanSettings.Players[toon].Info[TITAN_GOLD_ID].gold
 		coin_str = NiceCash(t_gold, false, false)
 		show_dash = false
 		show_realm = true
@@ -667,6 +680,8 @@ local function Initialize_Array()
 	if (GOLD_INITIALIZED) then
 		-- already done
 	else
+		-- 2026 Jan : Saved vars are now in Titan
+
 		-- See if this is a new toon to Gold saved vars or reset
 		local gindex, _, _ = TitanUtils_GetPlayer()
 		-- TitanSettings.Players[toon].Info.[TITAN_GOLD_ID]
@@ -694,6 +709,22 @@ local function Initialize_Array()
 			.. " " .. tostring(GOLD_SESSIONSTART) .. ""
 			.. " " .. tostring(GOLD_STARTINGGOLD) .. ""
 			.. " " .. tostring(Warband.GetSum()) .. ""
+
+		-- Ensure the saved vars are what we need for valid toons
+		for index, money in pairs(TitanSettings.Players) do
+			local char = EvalIndexInfo(index)
+			if char.valid then
+				-- Added 2026 Feb
+			if TitanSettings.Players[index].Info[TITAN_GOLD_ID].show == nil then
+					TitanSettings.Players[index].Info[TITAN_GOLD_ID].show = true -- default
+				else
+					-- exists, use as is
+				end
+			else
+				-- ignore custom profiles or toons not logged into yet
+			end
+		end
+
 	end

 	local msg = ">Init done : "
@@ -733,10 +764,49 @@ local function TitanGold_ClearDB()
 	StaticPopup_Show("TITANGOLD_CLEAR_DATABASE");
 end

+---local Create Show menu - list of characters in same faction
+---@param faction string
+---@param level table Menu description to attach to
+local function ShowMenuButtons(faction, level)
+	for index, money in pairs(TitanSettings.Players) do
+		local char = EvalIndexInfo(index)
+		if char.valid and char.faction == faction then
+			Titan_Menu.AddSelectorGeneric(level, char.char_name,
+				function(data)
+					local toon_info = TitanSettings.Players[data.c_name].Info ---@class CharInfo
+					local toon_gold = toon_info[TITAN_GOLD_ID] ---@class GoldData
+					return toon_gold.show
+				end,
+				function(data)
+					local toon_info = TitanSettings.Players[index].Info ---@class CharInfo
+					local toon_gold = toon_info[TITAN_GOLD_ID] ---@class GoldData
+					toon_gold.show = not toon_gold.show
+				end,
+				{ c_name = index }
+			)
+		else
+			-- ignore custom profiles or toons not logged into yet
+		end
+	end
+end
+
 local function GeneratorFunction(owner, rootDescription)
 	local id = TITAN_GOLD_ID
 	local root = rootDescription -- menu widget to start with

+	local opts_sort = Titan_Menu.AddButton(root, L["TITAN_GOLD_SORT_BY"])
+	do           -- next level options
+		local disp = { -- selectors using the same option - label, value
+			{ L["TITAN_GOLD_TOGGLE_SORT_GOLD"], false },
+			{ L["TITAN_GOLD_TOGGLE_SORT_NAME"], true },
+		}
+		Titan_Menu.AddSelectorList(opts_sort, id, nil, "SortByName", disp)
+
+		Titan_Menu.AddDivider(opts_sort)
+
+		Titan_Menu.AddSelector(opts_sort, id, L["TITAN_GOLD_GROUP_BY_REALM"], "GroupByRealm")
+	end
+
 	local opts_gold = Titan_Menu.AddButton(root, L["TITAN_GOLD_TOOLTIP_DISPLAY_OPTIONS"])
 	do           -- next level options
 		local list = { -- a mututally exclusive triple
@@ -783,8 +853,19 @@ local function GeneratorFunction(owner, rootDescription)
 	end
 	Titan_Menu.AddDivider(root)

+	local opts_show = Titan_Menu.AddButton(root, L["TITAN_GOLD_SHOW_PLAYER"]
+		.." : "..L["TITAN_GOLD_FACTION_PLAYER_ALLY"])
+	do
+	local opts_alliance = Titan_Menu.AddButton(opts_show, L["TITAN_GOLD_FACTION_PLAYER_ALLY"])
+		ShowMenuButtons(TITAN_ALLIANCE, opts_alliance)
+	end
+	do
+	local opts_horde = Titan_Menu.AddButton(opts_show, L["TITAN_GOLD_FACTION_PLAYER_HORDE"])
+		ShowMenuButtons(TITAN_HORDE, opts_horde)
+	end
+
 --	Titan_Menu.AddCommand(root, id, L["TITAN_GOLD_CLEAR_DATA_TEXT"], TitanGold_ClearDB)
---	Titan_Menu.AddCommand(root, id, L["TITAN_GOLD_RESET_SESS_TEXT"], ResetSession)
+	Titan_Menu.AddCommand(root, id, L["TITAN_GOLD_RESET_SESS_TEXT"], ResetSession)
 end

 ---local Get the gold total the user wants (server or player).
diff --git a/TitanVolume/TitanVolume.lua b/TitanVolume/TitanVolume.lua
index 6eb2e8f..fae9f6e 100644
--- a/TitanVolume/TitanVolume.lua
+++ b/TitanVolume/TitanVolume.lua
@@ -281,16 +281,27 @@ local function GetTooltipText()
 	return text
 end

----Generate and display right click menu options for user.
----@param owner table Plugin frame
----@param rootDescription table Menu context root
-local function GeneratorFunction(owner, rootDescription)
-	local id = TITAN_VOLUME_ID
-	local root = rootDescription -- menu widget to start with
+---local Generate the right click menu
+local function CreateMenu()
+	TitanPanelRightClickMenu_AddTitle(TitanPlugins[TITAN_VOLUME_ID].menuText);
+
+	local info = {};
+	info.notCheckable = true
+	info.text = L["TITAN_VOLUME_MENU_AUDIO_OPTIONS_LABEL"];
+	info.func = function()
+		ShowUIPanel(VideoOptionsFrame);
+	end
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());

-	Titan_Menu.AddCommand(root, id, L["TITAN_VOLUME_MENU_AUDIO_OPTIONS_LABEL"], ShowUIPanel, VideoOptionsFrame)
+	info.text = L["TITAN_VOLUME_MENU_OVERRIDE_BLIZZ_SETTINGS"];
+	info.notCheckable = false
+	info.func = function()
+		TitanToggleVar(TITAN_VOLUME_ID, "OverrideBlizzSettings");
+	end
+	info.checked = TitanGetVar(TITAN_VOLUME_ID, "OverrideBlizzSettings");
+	TitanPanelRightClickMenu_AddButton(info, TitanPanelRightClickMenu_GetDropdownLevel());

-	Titan_Menu.AddSelector(root, id, L["TITAN_VOLUME_MENU_OVERRIDE_BLIZZ_SETTINGS"], "OverrideBlizzSettings")
+	TitanPanelRightClickMenu_AddControlVars(TITAN_VOLUME_ID)
 end

 ---local On double click toggle the all sound mute; will flash the slider frame...
@@ -317,6 +328,7 @@ end
 local function OnLoad(self)
 	local notes = ""
 	.. "Adds a volume control icon on your Titan Bar.\n"
+	.. "Needs updates for new menu scheme!\n"
 	.. L["TITAN_VOLUME_TOOLTIP_HINT1"] .. "\n"
 	.. L["TITAN_VOLUME_TOOLTIP_HINT2"] .. "\n"
 	--		.."- xxx.\n"
@@ -325,8 +337,7 @@ local function OnLoad(self)
 		category = "Built-ins",
 		version = TITAN_VERSION,
 		menuText = L["TITAN_VOLUME_MENU_TEXT"],
---		menuTextFunction = CreateMenu,
-		menuContextFunction = GeneratorFunction, -- NEW scheme
+		menuTextFunction = CreateMenu,
 		tooltipTitle = VOLUME, --L["TITAN_VOLUME_TOOLTIP"],
 		tooltipTextFunction = GetTooltipText,
 		iconWidth = 32,
@@ -399,10 +410,6 @@ local function Create_Frames()
 	config:SetScript("OnUpdate", function(self, elapsed)
 		TitanUtils_CheckFrameCounting(self, elapsed)
 	end)
-	window:SetScript("OnClick", function(self, button)
-		-- prevent frame flash
---		TitanPanelButton_OnClick(self, button)
-	end)
 	window:SetScript("OnDoubleClick", function(self, button)
 		OnDoubleClick(self, button)
 --		TitanPanelButton_OnClick(self, button)