From aa82f7e5c540d048b839b24d6b7b87b35b81b8e3 Mon Sep 17 00:00:00 2001 From: urnati Date: Fri, 2 Aug 2024 15:04:10 -0400 Subject: [PATCH] - Gold : Add Warbank bank (as a toon); Add space as a separator option; sort Show / Delete menu per user options. --- Titan/TitanLDB.lua | 19 +- Titan/TitanUtils.lua | 17 +- Titan/TitanVariables.lua | 10 - Titan/_ATitanDoc.lua | 30 +- Titan/_TitanIDE.lua | 5 + TitanAmmo/TitanAmmo_Classic.toc | 6 - TitanBag/TitanBag_Classic.toc | 6 - TitanClassic/TitanClassic_Classic.toc | 7 +- TitanClock/TitanClock_Classic.toc | 6 - TitanGold/TitanGold.lua | 651 ++++++++++++------------- TitanGold/TitanGold_Classic.toc | 4 - TitanLocation/TitanLocation_Classic.toc | 5 - TitanLootType/TitanClassicLootType.lua | 1 + TitanLootType/TitanLootType_Classic.toc | 6 - TitanPerformance/TitanPerformance_Classic.toc | 6 - TitanRegen/TitanRegen_Classic.toc | 6 - TitanRepair/TitanRepair_Classic.toc | 6 - TitanVolume/TitanVolume_Classic.toc | 6 - TitanXP/TitanXP_Classic.toc | 6 - 19 files changed, 355 insertions(+), 448 deletions(-) diff --git a/Titan/TitanLDB.lua b/Titan/TitanLDB.lua index c65cc0f..f62e618 100644 --- a/Titan/TitanLDB.lua +++ b/Titan/TitanLDB.lua @@ -10,7 +10,7 @@ Created and initially commited on : July 29th, 2008 The spec: https://github.com/tekkub/libdatabroker-1-1 LDB (libdatabroker) is a small library that enables an addon to hook into a 'display' addon such as Titan. -=== Creation +--- Creation The addon dev creates an LDB object which the lib places in storage accessible by lib:DataObjectIterator(). It also fires a "LibDataBroker_DataObjectCreated" callback. @@ -19,21 +19,21 @@ When an LDB addon changes one of its values, the lib fires a callback for the di The LDB addon may declare scripts (tooltip, mouse clicks, etc.) per the spec for the display addon to use. -=== Starting from Titan view +--- Starting from Titan view On PLAYER_ENTERING_WORLD, Titan will use the iterator to wrap each LDB type addon into a Titan plugin. Once done processing the known LDB objects, Titan registers for the callback to handle LDB objects created later or on demand. Titan registers for callbacks on text and icon updates - depending on the LDB type. -=== Running from Titan view +--- Running from Titan view The LDB addon is responsible for setting and changing its text and icon. Titan is responsible for updating the Titan plugin in response. The Titan plugin will use the LDB addon scripts IF declared, again depending on the LDB type. -=== Supported +--- Supported Only LDB types listed in the LDB 1.1 spec are supported by Titan. - "launcher" become "icon" plugins - TitanPanelIconTemplate @@ -149,11 +149,12 @@ end ---Titan Properly anchor tooltips of the Titan (LDB) plugin ---@param parent table Parent frame ---@param anchorPoint string ----@param relativeToFrame table +---@param relativeToFrame table|string ---@param relativePoint string ---@param xOffset number ---@param yOffset number ----@param frame table Tolltip frame +---@param frame table|string Tooltip frame +--- relativeToFrame and frame are really ScriptRegion|string for GameTooltip function LDBToTitan:TitanLDBSetOwnerPosition(parent, anchorPoint, relativeToFrame, relativePoint, xOffset, yOffset, frame) if frame:GetName() == "GameTooltip" then -- Changes for 9.1.5 Removed the background template from the GameTooltip @@ -177,8 +178,8 @@ end ---Titan Fill in the tooltip for the Titan (LDB) plugin ---@param name string Plugin id name for LDB ---@param frame table Tooltip frame ----@param func function Tooltip function to be run -function LDBToTitan:TitanLDBSetTooltip(name, frame, func) +---@param tt_func function? Tooltip function to be run +function LDBToTitan:TitanLDBSetTooltip(name, frame, tt_func) -- Check to see if we allow tooltips to be shown if not TitanPanelGetVar("ToolTipsShown") or (TitanPanelGetVar("HideTipsInCombat") and InCombatLockdown()) then @@ -216,7 +217,7 @@ function LDBToTitan:TitanLDBSetTooltip(name, frame, func) else end - if func and If_Show_Tooltip() then func(frame) end; -- TODO: use pcall?? + if tt_func and If_Show_Tooltip() then tt_func(frame) end; -- TODO: use pcall?? frame:Show(); end diff --git a/Titan/TitanUtils.lua b/Titan/TitanUtils.lua index 409fe64..607fe7b 100644 --- a/Titan/TitanUtils.lua +++ b/Titan/TitanUtils.lua @@ -764,7 +764,6 @@ end ---@param text string Text to wrap ---@param color any See color:GetRGB() / color:GetRGBA() ---@return string text Custom color encoded string ---- TitanUtils_GetColoredText(GOLD_PERHOUR_STATUS, TITAN_GOLD_GREEN) function TitanUtils_GetColoredText(text, color) local res = "" if (color and text) then @@ -911,9 +910,7 @@ end ---@return integer gold part of value ---@return integer silver part of value ---@return integer copper part of value -function TitanUtils_CashToString(value, thousands_separator, decimal_separator, - only_gold, show_labels, show_icons, - add_color) +function TitanUtils_CashToString(value, thousands_separator, decimal_separator, only_gold, show_labels, show_icons, add_color) local show_zero = true local show_neg = true @@ -999,19 +996,25 @@ function TitanUtils_CashToString(value, thousands_separator, decimal_separator, -- now make the coin strings if gold > 0 then local gnum = TitanUtils_NumToString(gold, thousands_separator, decimal_separator) - gold_str = TitanUtils_GetHexText(gnum..g_lab .. " ", gc) --gc .. (gnum) .. g_lab .. " " .. FONT_COLOR_CODE_CLOSE + gold_str = TitanUtils_GetHexText(gnum..g_lab .. " ", gc) else gold_str = "" end if (silver > 0) then local snum = (string.format("%02d", silver) or "?") - silver_str = TitanUtils_GetHexText(snum..s_lab .. " ", sc) --sc .. (silver or "?") .. s_lab .. " " .. FONT_COLOR_CODE_CLOSE + silver_str = TitanUtils_GetHexText(snum..s_lab .. " ", sc) + elseif (string.len(gold_str) > 0) then -- space if gold present + local snum = (string.format("%02d", 0) or "?") + silver_str = TitanUtils_GetHexText(snum..s_lab .. " ", sc) else silver_str = "" end if (copper > 0) then local cnum = (string.format("%02d", copper) or "?") - copper_str = TitanUtils_GetHexText(cnum..c_lab, cc) --cc .. (copper or "?") .. c_lab .. "" .. FONT_COLOR_CODE_CLOSE + copper_str = TitanUtils_GetHexText(cnum..c_lab, cc) + elseif (string.len(silver_str) > 0) then -- space if silver present + local cnum = (string.format("%02d", 0) or "?") + copper_str = TitanUtils_GetHexText(cnum..c_lab, cc) else copper_str = "" end diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua index 04b8ae5..fc2aad4 100644 --- a/Titan/TitanVariables.lua +++ b/Titan/TitanVariables.lua @@ -40,16 +40,6 @@ if (GetLocale() == "ruRU") then end local TPC = TITAN_PANEL_CONSTANTS -- shortcut ---[===[ Titan -NAME: Titan bar overview -DESC: --- 3 button frames are used to create a Titan bar: --- the 'display' button frame - the bar itself, --- the 'hider' which is a blank 1/2 height bar to capture the cursor moving to the bar, --- and the 'auto hide' plugin displaying the 'push pin' button. -:DESC ---]===] - --[===[ Var TitanBarData table. The table holds: diff --git a/Titan/_ATitanDoc.lua b/Titan/_ATitanDoc.lua index 9c8221f..6f3eef0 100644 --- a/Titan/_ATitanDoc.lua +++ b/Titan/_ATitanDoc.lua @@ -32,13 +32,6 @@ There are diagnostic annotations used to ignore some warnings. Ignore warning annotations were limited as much as practical to 'this line' to point out usage of Classic routines. === Documentation blocks -Within the document are Titan routines available to a plugin developer. - -There are three files contributing to Titan documentation. -- Titan_API_