diff --git a/Titan/Titan.lua b/Titan/Titan.lua index 8f8356e..65e7219 100644 --- a/Titan/Titan.lua +++ b/Titan/Titan.lua @@ -228,21 +228,18 @@ end) ---Titan Do all the setup needed when a user logs in / reload UI / enter or leave an instance. --- This is called after the 'player entering world' event is fired by Blizz. --- This is also called when a LDB plugin is created after Titan runs the 'player entering world' code. +--- The common code section will setup this toon's info +--- 1) Register any plugins +--- 2) Load the plugin vars (UseSettings) +--- 3) Update the Titan config +--- 4) Set the Titan vars +--- 5) Load / register any LDB plugins into Titan ---@param reload boolean true if reload; false if character 'first' enter function TitanPanel_PlayerEnteringWorld(reload) - --[[ -print("PEW" -.." "..tostring(Titan__InitializedPEW).."" -) ---]] if Titan__InitializedPEW then -- Currently no additional steps needed else - if Titan_Global.debug.titan_startup then - local dbg_msg = "PEW:" - .. " Init settings" - TitanDebug(dbg_msg, "normal") - end + Titan_Global.dbg:Out("Tooltip", "PEW: Init settings") -- Get Profile and Saved Vars TitanVariables_InitTitanSettings(); @@ -261,28 +258,16 @@ print("PEW" -- Set the two anchors in their default positions -- until the Titan bars are drawn - if Titan_Global.debug.titan_startup then - local dbg_msg = "PEW:" - .. " Create anchors for other addons" - TitanDebug(dbg_msg, "normal") - end + Titan_Global.dbg:Out("Tooltip", "PEW: Create anchors for other addons") TitanPanelTopAnchor:ClearAllPoints(); TitanPanelTopAnchor:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 0, 0); TitanPanelBottomAnchor:ClearAllPoints(); TitanPanelBottomAnchor:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 0, 0); -- Ensure the bars are created before the plugins are registered. - if Titan_Global.debug.titan_startup then - local dbg_msg = "PEW:" - .. " Create frames for Titan bars" - TitanDebug(dbg_msg, "normal") - end + Titan_Global.dbg:Out("Tooltip", "PEW: Create frames for Titan bars") for idx, v in pairs(TitanBarData) do - if Titan_Global.debug.titan_startup then - local dbg_msg = "..." - .. tostring(v.name) - TitanDebug(dbg_msg, "normal") - end + Titan_Global.dbg:Out("Tooltip", "... ".. tostring(v.name)) TitanPanelButton_CreateBar(idx) end @@ -304,59 +289,30 @@ print("PEW" end end - --[[ With user able to move the UI around and short bars, remove this feature - -- Check to see if we should kill off the OrderHallCommandBar - if not TitanAllGetVar("OrderHall") then - local TitanPanelAce = LibStub("AceAddon-3.0"):NewAddon("TitanPanelOHCB", "AceHook-3.0") - TitanPanelAce:SecureHook("OrderHall_CheckCommandBar", - function() - if OrderHallCommandBar then - OrderHallCommandBar:Hide() - OrderHallCommandBar:UnregisterAllEvents() - OrderHallCommandBar.Show = function () end - end - end - ) - else - local TitanPanelAce = LibStub("AceAddon-3.0"):NewAddon("TitanPanelOHCB", "AceHook-3.0") - TitanPanelAce:Unhook("OrderHall_CheckCommandBar") - end ---]] -- Should be safe to register for events that could show / hide Bars - if Titan_Global.debug.titan_startup then - local dbg_msg = "PEW:" - .. " Register for events Titan needs" - TitanDebug(dbg_msg, "normal") - end + Titan_Global.dbg:Out("Tooltip", "PEW: Register for events Titan needs") RegisterForEvents() end + + --====== Common code login versus reload / portal / ... + local _ = nil TitanSettings.Player, _, _ = TitanUtils_GetPlayer() -- Some addons wait to create their LDB component or a Titan addon could -- create additional buttons as needed. - -- So we need to sync their variables and set them up - if Titan_Global.debug.titan_startup then - local dbg_msg = "PEW:" - .. " Register any plugins found" - TitanDebug(dbg_msg, "normal") - end + Titan_Global.dbg:Out("Tooltip", "PEW: Register any plugins found") TitanUtils_RegisterPluginList() + Titan_Global.dbg:Out("Tooltip", "> PEW: Register any plugins done") - if Titan_Global.debug.titan_startup then - local dbg_msg = "PEW:" - .. " Synch plugin saved vars" - TitanDebug(dbg_msg, "normal") - end + -- Now sync saved variables to the profile chosen by the user. + -- This will set the bar(s) and enabled plugins (via OnShow). + Titan_Global.dbg:Out("Tooltip", "PEW: Synch plugin saved vars") TitanVariables_UseSettings(nil, TITAN_PROFILE_INIT) + Titan_Global.dbg:Out("Tooltip", "PEW: Init config data (right click menu)") -- all addons are loaded so update the config (options) -- some could have registered late... - if Titan_Global.debug.titan_startup then - local dbg_msg = "PEW:" - .. " Init config data (right click menu)" - TitanDebug(dbg_msg, "normal") - end TitanUpdateConfig("init") -- Init panel font @@ -384,13 +340,12 @@ print("PEW" -- No need end - -- Also sync LDB object text with their created Titan plugin - if Titan_Global.debug.titan_startup then - local dbg_msg = "PEW:" - .. " Register any LDB (Titan) plugins" - TitanDebug(dbg_msg, "normal") - end + -- Loop through the LDB objects to sync with their created Titan plugin + Titan_Global.dbg:Out("Tooltip", "PEW: Register any LDB (Titan) plugins") TitanLDBRefreshButton() + Titan_Global.dbg:Out("Tooltip", "> PEW: Register any LDB (Titan) plugins done") + + Titan_Global.dbg:Out("Tooltip", "PEW: Titan processing done") end -------------------------------------------------------------- @@ -418,10 +373,8 @@ function TitanPanelBarButton:ADDON_LOADED(addon) if addon == TITAN_ID then _G[TITAN_PANEL_CONTROL]:RegisterEvent("PLAYER_ENTERING_WORLD") - if Titan_Global.debug.titan_startup then - TitanDebug("Titan ADDON_LOADED") - end - -- TitanVariables_InitTitanSettings() -- Min table setup to start. + Titan_Global.dbg:Out("Tooltip", "ADDON_LOADED") + -- Unregister event - saves a few event calls. self:UnregisterEvent("ADDON_LOADED"); self.ADDON_LOADED = nil @@ -433,15 +386,8 @@ function TitanPanelBarButton:PLAYER_ENTERING_WORLD(arg1, arg2) local call_success = nil local ret_val = nil - --[[ -print("PLAYER_ENTERING_WORLD" -.." "..tostring(arg1).."" -.." "..tostring(arg2).."" -) ---]] - if Titan_Global.debug.titan_startup then - TitanDebug("Titan PLAYER_ENTERING_WORLD pcall setup routine") - end + Titan_Global.dbg:Out("Tooltip", "Titan PLAYER_ENTERING_WORLD pcall setup routine") + call_success, -- needed for pcall ret_val = -- actual return values pcall(TitanPanel_PlayerEnteringWorld, arg2) @@ -1689,8 +1635,8 @@ function TitanPanel_InitPanelButtons() TitanPanelBarButton_DisplayBarsWanted("TitanPanel_InitPanelButtons"); -- Position all the buttons - for i = 1, table.maxn(TitanPanelSettings.Buttons) do - local id = TitanPanelSettings.Buttons[i]; + for idx = 1, table.maxn(TitanPanelSettings.Buttons) do + local id = TitanPanelSettings.Buttons[idx]; if (TitanUtils_IsPluginRegistered(id)) then local i = TitanPanel_GetButtonNumber(id); button = TitanUtils_GetButton(id); @@ -1810,8 +1756,7 @@ end function TitanPanel_RefreshPanelButtons() if (TitanPanelSettings) then for i = 1, #TitanPanelSettings.Buttons do --- for i = 1, table.getn(TitanPanelSettings.Buttons) do -- getn deprecated from luau (used) - TitanPanelButton_UpdateButton(TitanPanelSettings.Buttons[i], 1); + TitanPanelButton_UpdateButton(TitanPanelSettings.Buttons[i], 1); end end end diff --git a/Titan/TitanDebug.lua b/Titan/TitanDebug.lua new file mode 100644 index 0000000..e51360b --- /dev/null +++ b/Titan/TitanDebug.lua @@ -0,0 +1,149 @@ +--[===[ File +This file contains the debug class to be used throughout Titan Panel and plugins. + +This file is loaded first so NO other Titan routines are to be used. + +The intent is a simple, flexible debug framework to enable: +- a consistent output +- enable / disable across an arbitrary scope - across addons; single addon; or partial addon +- enable / disable rather than comment out +--]===] + +Titan_Debug = {} + +local text_color = "1DA6C5" -- light blue +local head_color = "f2e699" -- yellow gold +local err_color = "ff2020" -- red + +local function Encode(color, text) + -- Color the string using WoW encoding + local res = "" + local c = tostring(color) + local t = tostring(text) + if (c and t) then + res = "|cff" .. c .. t .. "|r" + else + if (t) then + res = tostring(t) + else + -- return blank string + end + end + + return res +end + +local function Out_Error(plugin_id, topic_id, topic_text) + local msg = "" + .. Encode(err_color, + date("%H:%M:%S") + .. " <" .. tostring(plugin_id) + .. ":" .. topic_id .. "> ") -- yellow gold + .. " " .. Encode(text_color, tostring(topic_text) + ) -- + + _G["DEFAULT_CHAT_FRAME"]:AddMessage(msg) +end + +local function Out_debug(plugin_id, topic_id, topic_text) + local msg = "" + .. Encode(head_color, + date("%H:%M:%S") + .. " <" .. tostring(plugin_id) + .. ":" .. topic_id .. "> ") -- yellow gold + .. " " .. Encode(text_color, tostring(topic_text) + ) -- + + _G["DEFAULT_CHAT_FRAME"]:AddMessage(msg) +end + +---@class PluginDebugType +---@field plugin_id string Plugin / Addon name +---@field enabled boolean Whether this particular plugin debug is enabled +---@field topics table Index of topics (true / false) +---@field New function +---@field AddTopic function +---@field Out function +---@field EnableDebug function +---@field EnableTopic function + +---API Return a disabled debug class with default topics. Each plugin is welcome to add more topics. +---@param id string +---@return PluginDebugType +--- debug_obj = Titan_Debug.New("Titan") +function Titan_Debug:New(id) + local this = {} -- new object + setmetatable(this, self) -- create handle lookup; self == Titan_Debug + self.__index = self + + -- Init object + this.plugin_id = id + this.enabled = false + this.topics = { + ["Events"] = false, + ["Flow"] = false, + ["Tooltip"] = false, + ["Menu"] = false, + } + return this ---@type PluginDebugType +end + +---Add a topic to the created debug class +---@param topic_id string +--- debug_obj.Add("Startup") +function Titan_Debug:AddTopic(topic_id) + -- A bit harsh but do not override a topic + if self.topics[topic_id] == nil then + self.topics[topic_id] = false + else + Out_Error(self.plugin_id, self.topics[topic_id], " Attempt to override (" .. topic_id .. ")'") + end +end + +---Output a debug string under a topic id +---@param topic_id number +---@param str string +--- debug_info.Out(1, "OnEvent") +function Titan_Debug:Out(topic_id, str) + if self.enabled == true then -- debug enabled for this object + if self.topics[topic_id] == true -- exists and was enabled + then + Out_debug(self.plugin_id, topic_id, str) + else + -- silent return + end + else + -- silent return + end +end + +---@param action boolean +--- debug_info.EnableDebug(true) +function Titan_Debug:EnableDebug(action) + if self.enabled ~= action then + -- Inform dev of change + local msg = (action == true and "Enabled" or "Disabled") + Out_debug(self.plugin_id, "Events", msg) + else + -- silent + end + + self.enabled = action +end + +---Enable / disable debug the topic within this id +---@param id number +---@param action boolean +--- debug_info.EnableTopic(1, true) +--- debug_info.EnableTopic(1, false) +function Titan_Debug:EnableTopic(id, action) + self.topics[id] = action +end + +--[[ + local msg = "Debug Enable topic" + .." "..tostring(self.plugin_id) + .." "..tostring(id) + .." > "..tostring(self.topics[id].enabled) + _G["DEFAULT_CHAT_FRAME"]:AddMessage(msg) + --]] diff --git a/Titan/TitanGlobal.lua b/Titan/TitanGlobal.lua index 291c7a3..63de116 100644 --- a/Titan/TitanGlobal.lua +++ b/Titan/TitanGlobal.lua @@ -150,7 +150,6 @@ Titan_Global.debug.plugin_text = false Titan_Global.debug.plugin_register = false Titan_Global.debug.plugin_register_deep = false Titan_Global.debug.movable = false -Titan_Global.debug.titan_startup = false -- For WoW localized strings / literals we are using Titan_Global.literals = { @@ -186,15 +185,6 @@ Titan_Global.colors = { yellow = "ffff00", -- YELLOW_FONT_COLOR } ---type for debug ----@class PluginTopicType ----@field enabled boolean Whether this particular topic debug is enabled ----@field topic string The topic description - ----@class PluginDebugType ----@field enabled boolean Whether this particular plugin debug is enabled ----@field topics PluginTopicType[] The numeric list of possible debug - -- type for plugin registry ---@class PluginRegistryType ---@field id string The unique name of the plugin @@ -206,29 +196,12 @@ Titan_Global.colors = { ---@field tooltipTitle? string Localized string for the menu ---@field tooltipTextFunction? string | function Function to call for a simple tooltip (OnEnter) ---@field tooltipCustomFunction? function Function to call for a complex tooltip (OnEnter) ----@field debugClass? PluginDebugType Function to call to enable / disable debug (Titan Config) ---@field icon? string Path to the plugin icon ---@field iconWidth? integer Path to the plugin icon ---@field notes? string Brief description shown in Titan > Config > Plugins when this plugin is selected ---@field controlVariables? table Show or not on menu - set to true or false - ShowIcon ShowLabelText ShowColoredText DisplayOnRightSide ---@field savedVariables? table Initial value of any saved variables for this plugin; should include control variables ----API Return an empty debug class. ----@return PluginDebugType ----This routine was added for use with an IDE with Intellisense that supports Lua. It can be but might not be used. ----Each plugin is welcome to add more topics. ---- debug_info = Titan_Global.NewDebug() -function Titan_Global.NewDebug() - local reg = { - enabled = false, - topics = { - [1] = { enabled = false, topic = "Events"}, - [2] = { enabled = false, topic = "Flow"}, - } - } ---@type PluginDebugType - return reg -end - ---API Return an empty registry - only the id is set. ---@param id string The unique name of the plugin ---@return PluginRegistryType @@ -238,3 +211,12 @@ function Titan_Global.NewRegistry(id) local reg = { id = id } ---@type PluginRegistryType return reg end + +-- Set the debug topics for Titan itself - not any plugins +Titan_Global.dbg = Titan_Debug:New("Titan") +Titan_Global.dbg:AddTopic("Startup") +Titan_Global.dbg:AddTopic("Vars") + +Titan_Global.dbg:EnableDebug(false) +Titan_Global.dbg:EnableTopic("Tooltip", false) +Titan_Global.dbg:EnableTopic("Menu", false) diff --git a/Titan/TitanHistory.lua b/Titan/TitanHistory.lua index 65b112a..79ba334 100644 --- a/Titan/TitanHistory.lua +++ b/Titan/TitanHistory.lua @@ -15,6 +15,12 @@ Green - 'header' - Titan or plugin Highlight - notes. tips. and details --]] Titan_Global.recent_changes = "" +.. TitanUtils_GetGoldText("8.2.0 : 2025/01/03\n") +.. TitanUtils_GetGreenText("Titan : \n") +.. TitanUtils_GetHighlightText("" +.. "- Internal fixes to prevent timing issues for built-in plugins on init - any splash screen ." +) +.. "\n\n" .. TitanUtils_GetGoldText("8.1.7 : 2024/12/22\n") .. TitanUtils_GetGreenText("Gold : \n") .. TitanUtils_GetHighlightText("" @@ -46,67 +52,6 @@ Titan_Global.recent_changes = "" .. "- Classic Era TOC to 1.15.5" ) .. "\n\n" -.. TitanUtils_GetGoldText("8.1.4 : 2024/10/24\n") -.. TitanUtils_GetGreenText("Gold : \n") -.. TitanUtils_GetHighlightText("" -.. "- Add display of Realm (optional)." -.. "- Add display of Connected Realms to tooltip." -) -.. TitanUtils_GetGreenText("Gold : \n") -.. TitanUtils_GetHighlightText("" -.. "- Hopefully fix error some see on start Ticket #1415." -.. "- Make show of Warbank bank gold optional." -) -.. TitanUtils_GetGreenText("Loot : \n") -.. TitanUtils_GetHighlightText("" -.. "- Additional comments; use # over deprecated table.getn." -) -.. TitanUtils_GetGreenText("Titan : \n") -.. TitanUtils_GetHighlightText("" -.. "- Additional comments." -) -.. "\n\n" -.. TitanUtils_GetGoldText("8.1.3 : 2024/09/27\n") -.. TitanUtils_GetGreenText("XP : \n") -.. TitanUtils_GetHighlightText("" -.. "- Update XP timer to update every 10 versus 30 sec." -) -.. TitanUtils_GetGreenText("Titan : \n") -.. TitanUtils_GetHighlightText("" -.. "- Modified TitanMovable to remove API hooks that Blizzard screwed up." -.. "- Classic Era TOC to 1.15.4." -) -.. "\n\n" -Titan_Global.recent_changes = "" -.. TitanUtils_GetGoldText("8.1.0 : 2024/08/06\n") -.. TitanUtils_GetGreenText("Titan : \n") -.. TitanUtils_GetHighlightText("" -.. "- Updated TOC files to use *_Classic; single TOC file for Classic versions" -.. "- Updated retail TOC files to 11.0.2" -) -.. TitanUtils_GetGreenText("Gold : \n") -.. TitanUtils_GetHighlightText("" -.. "- Retail ONLY - Added Warband bank at bottom of list for totals.\n" -.. "- Better alignment when silver or copper are zero.\n" -.. "- Added space (' ') as a thousands separator option with comma and period.\n" -.. "- Show and Delete toon menus sort per user options.\n" -.. "- Shift + Left click will put the connected server list into Chat (also in Plugin Notes).\n" -) -.. TitanUtils_GetGreenText("Bags : \n") -.. TitanUtils_GetHighlightText("" -.. "- Retail ONLY : Added Reagent Bag slot.\n" -.. "- All : Removed profession count option.\n" -.. "- All : Profession counts are in Detailed Tooltip as grey - NOT added to free / used totals.\n" -) -.. TitanUtils_GetGreenText("Volume : \n") -.. TitanUtils_GetHighlightText("" -.. "- Fix double click Mute - it now toggles properly and icon changes.\n" -) -.. TitanUtils_GetGreenText("Regen : \n") -.. TitanUtils_GetHighlightText("" -.. "- Cleanup documentation (comments); made some routines local.\n" -) -.. "\n\n" --[[ Var Notes Use for important notes in the Titan Config About diff --git a/Titan/TitanVariables.lua b/Titan/TitanVariables.lua index c58e1b0..395871f 100644 --- a/Titan/TitanVariables.lua +++ b/Titan/TitanVariables.lua @@ -930,17 +930,13 @@ end --- Called when Titan is loaded (ADDON_LOADED event) function TitanVariables_InitTitanSettings() local player = TitanUtils_GetPlayer() - if Titan_Global.debug.titan_startup then - TitanDebug("_Init begin " .. tostring(player)) - end + Titan_Global.dbg:Out("Menu", "_Init begin " .. tostring(player)) if (TitanSettings) then -- all is good else TitanSettings = {} - if Titan_Global.debug.titan_startup then - TitanDebug("TitanSettings {}") - end + Titan_Global.dbg:Out("Menu", "TitanSettings {}") end -- check for player list per issue #745 @@ -948,9 +944,7 @@ function TitanVariables_InitTitanSettings() -- all is good else TitanSettings.Players = {} -- empty saved vars. New install or wipe - if Titan_Global.debug.titan_startup then - TitanDebug("TitanSettings.Players {}") - end + Titan_Global.dbg:Out("Menu", "TitanSettings.Players {}") end if (TitanAll) then @@ -959,17 +953,11 @@ function TitanVariables_InitTitanSettings() TitanAll = {} end - if Titan_Global.debug.titan_startup then - TitanDebug("Sync Titan Panel saved variables with TitanAll ") - end + Titan_Global.dbg:Out("Menu", "Sync Titan Panel saved variables with TitanAll") TitanVariables_SyncRegisterSavedVariables(TITAN_ALL_SAVED_VARIABLES, TitanAll) - if Titan_Global.debug.titan_startup then - TitanDebug("Sync Done ") - end + Titan_Global.dbg:Out("Menu", "> Sync Done") - if Titan_Global.debug.titan_startup then - TitanDebug("_Init end " .. tostring(player)) - end + Titan_Global.dbg:Out("Menu", "_Init end " .. tostring(player)) -- Current Titan list known - all toons player has profiles for -- Sort in alphabetical order. @@ -1065,15 +1053,9 @@ end local function Set_bar_vars(to_profile) if TitanSettings.Players[to_profile].BarVars then -- All good - if Titan_Global.debug.titan_startup then - print("Set_bar_vars found" - ) - end + Titan_Global.dbg:Out("Menu", "Set_bar_vars found") else - if Titan_Global.debug.titan_startup then - print("Set_bar_vars init" - ) - end + Titan_Global.dbg:Out("Menu", "Set_bar_vars init") -- Set to defaults TitanSettings.Players[to_profile].BarVars = TitanBarVarsDefaults local BV = TitanSettings.Players[to_profile].BarVars @@ -1082,9 +1064,7 @@ local function Set_bar_vars(to_profile) local panel = TitanSettings.Players[to_profile].Panel local tex = panel["TexturePath"]:gsub("TitanClassic", "Titan") - if Titan_Global.debug.titan_startup then - print("tex path '" .. tex .. "'") - end + Titan_Global.dbg:Out("Menu", "tex path '" .. tex .. "'") -- Bring original Titan bar optionss to the current user settings. -- If this is a new toon or new saved vars then it will just get defaults. @@ -1128,13 +1108,11 @@ local function Init_player_settings(from_profile, to_profile, action) local old_plugins = {} local reset = (action == TITAN_PROFILE_RESET) - if Titan_Global.debug.titan_startup then - print("Init_player_settings" - .. " from: " .. tostring(from_profile) .. "" - .. " to: " .. tostring(to_profile) .. "" - .. " action: " .. tostring(action) .. "" - ) - end + local msg = "Init_player_settings" + .. " from: " .. tostring(from_profile) .. "" + .. " to: " .. tostring(to_profile) .. "" + .. " action: " .. tostring(action) .. "" + Titan_Global.dbg:Out("Menu", msg) CleanupProfile() -- hide currently shown plugins @@ -1142,9 +1120,7 @@ local function Init_player_settings(from_profile, to_profile, action) -- all is good else -- Create the bare player tables so profile(s) can be added - if Titan_Global.debug.titan_startup then - TitanDebug("TitanSettings.Players[] {}") - end + Titan_Global.dbg:Out("Menu", "TitanSettings.Players[] {}") TitanSettings.Players[to_profile] = {} TitanSettings.Players[to_profile].Plugins = {} TitanSettings.Players[to_profile].Panel = TITAN_PANEL_SAVED_VARIABLES @@ -1203,18 +1179,18 @@ local function Init_player_settings(from_profile, to_profile, action) -- Ensure the old profile Bar data is whole... Set_bar_vars(from_profile) TitanSettings.Players[to_profile]["BarVars"] = deepcopy(old_player["BarVars"]) - - if Titan_Global.debug.titan_startup then +--[[ + if Titan_Global.dbg:EnableTopic("Menu") then -- Apply the new bar positions for idx, v in pairs(TitanBarData) do - print("BarVars " + local str = "BarVars " .. " " .. tostring(v.name) .. "" .. " " .. tostring(TitanSettings.Players[from_profile]["BarVars"][idx].show) .. "" .. " " .. tostring(TitanSettings.Players[to_profile]["BarVars"][idx].show) .. "" - ) + Titan_Global.dbg:Out("Menu", str) end end - +--]] -- Copy the panel settings for index, id in pairs(old_panel) do TitanPanelSetVar(index, old_panel[index]); diff --git a/Titan/Titan_Mainline.toc b/Titan/Titan_Mainline.toc index 0d3a60f..833307f 100644 --- a/Titan/Titan_Mainline.toc +++ b/Titan/Titan_Mainline.toc @@ -1,7 +1,7 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa008.1.7|r +## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa008.2.0|r ## Author: Titan Panel Dev Team -## Version: 8.1.7 +## Version: 8.2.0 ## IconTexture: Interface\Icons\Achievement_Dungeon_UlduarRaid_Titan_01 ## SavedVariables: TitanAll, TitanSettings, TitanSkins, ServerTimeOffsets, ServerHourFormat ## Notes: Adds display bars to show and control information/launcher plugins. @@ -41,6 +41,7 @@ locale\Localization.MX.lua locale\Localization.RU.lua locale\Localization.TW.lua +TitanDebug.lua TitanGlobal.lua TitanUtils.lua TitanHistory.lua diff --git a/Titan/_ATitanDoc.lua b/Titan/_ATitanDoc.lua index 6f3eef0..5425474 100644 --- a/Titan/_ATitanDoc.lua +++ b/Titan/_ATitanDoc.lua @@ -154,41 +154,50 @@ When ADDON_LOADED event is received, - Titan registers for event PLAYER_ENTERING_WORLD - Titan ensures its saved variables are whole and known player profiles are read. -NOTE: On ADDON_LOADED is the first time saved variables should be considered loaded and safe!! -EUsing saved variables before is likely to result in nil(s). Such as when WoW parses the addon code as it is loading. +NOTE: On ADDON_LOADED is the first time addon saved variables should be considered loaded and safe!! +Using addon saved variables before ADDON_LOADED is likely to result in nil(s). Such as when WoW parses the addon code as it is loading. +NOTE: The addon saved vars are NOT the Titan plugin saved vars via the registry (.savedVariables)! The registry is processed later! Next: ==== Waiting for WoW WoW fires a bunch of events as this and other addons are loaded. Eventually the game and all addons are loaded and PLAYER_ENTERING_WORLD event is sent -Next: ==== Entering world -When event PLAYER_ENTERING_WORLD is received via OnEvent, the real work begins. +Next: ==== Entering world - PLAYER_ENTERING_WORLD (PEW) event +When PLAYER_ENTERING_WORLD event is received via OnEvent, the real work begins. +The PEW events do NOT guarantee order! Titan plugins (addons) could receive a PEW before Titan - See NOTE below. The local routine - TitanPanel_PlayerEnteringWorld - is called using pcall. This ensures Titan reacts to errors rather than forcing an error to the user. TitanPanel_PlayerEnteringWorld does all the variable and profile setup for the character entering the world. -On first PLAYER_ENTERING_WORLD (not reload) Titan +On login PLAYER_ENTERING_WORLD - not reload - Titan - Sets character profiles - TitanVariables_InitTitanSettings - Sets TitanPanel*Anchor for other addons to adjust for Titan - Creates all Titan bars including right click menu and auto hide frames. See Frames below. - Registers for events Titan uses - RegisterForEvents On login and reload Titan -- Register plugins in case the user installed / enabled / disabled addons then reloaded - TitanUtils_RegisterPluginList - Set THIS character profile () - TitanVariables_UseSettings - - See TitanVariables (File) for more details on saved variables; this is a simple concept but touchy to implement - Here Titan uses - - TitanPanel_InitPanelBarButton to set the bars the user wants - - TitanPanel_InitPanelButtons to set the plugins the user wants on the user selected bars + See TitanVariables (File) for more details on saved variables; this is a simple concept but touchy to implement. + The user chosen profile sets the user chosen plugin saved vars for both Titan and any plugins - see NOTE below. + TitanVariables_UseSettings uses + - TitanPanel_InitPanelBarButton to set the bars the user wants. + - TitanPanel_InitPanelButtons to set the plugins the user wants on the user selected bars via OnShow. - Update the Titan config tables - TitanUpdateConfig - Set Titan font and strata -- Update any LDB plugins - TitanLDBRefreshButton +- Sync any LDB plugins with the cooresponding Titan plugin- TitanLDBRefreshButton If the above was successful then all is good If the above failed with an error then - tell user some bad happened with error they can pass to dev team - attempt to hide all bars as cleanup - nuke the Titan config tables as cleanup + +NOTE: The PEW event is an important but subtle distinction for Titan plugins! +Titan plugins should be very careful if they use the PEW event to run code. The PEW events do NOT guarantee order! +Meaning the plugin PEW could be processed BEFORE Titan has set saved vars for itself or plugins. +Titan plugins should not assume ANY saved vars are available until their OnShow. +Only at the OnShow are the 'right' plugin saved vars guaranteed to be set. +We have seen bugs occur on some user systems due to the order addons get and process the PEW event. --]===] --[[ Frames and Frame Scripts diff --git a/TitanAmmo/TitanAmmo_Classic.toc b/TitanAmmo/TitanAmmo_Classic.toc index 82cfc0b..e331c51 100644 --- a/TitanAmmo/TitanAmmo_Classic.toc +++ b/TitanAmmo/TitanAmmo_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fAmmo|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fAmmo|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Adds an ammo monitor to Titan Panel - Classic versions only ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: diff --git a/TitanBag/TitanBag_Classic.toc b/TitanBag/TitanBag_Classic.toc index cdc9492..32cf30f 100644 --- a/TitanBag/TitanBag_Classic.toc +++ b/TitanBag/TitanBag_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fBag|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fBag|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Adds bag and free slot information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: diff --git a/TitanBag/TitanBag_Mainline.toc b/TitanBag/TitanBag_Mainline.toc index 454af43..38aa5e6 100644 --- a/TitanBag/TitanBag_Mainline.toc +++ b/TitanBag/TitanBag_Mainline.toc @@ -1,6 +1,6 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55fBag|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fBag|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## IconTexture: Interface\AddOns\TitanBag\TitanBag ## Notes: Adds bag and free slot information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) diff --git a/TitanClassic/TitanClassic_Classic.toc b/TitanClassic/TitanClassic_Classic.toc index eb4f0e2..f9ae241 100644 --- a/TitanClassic/TitanClassic_Classic.toc +++ b/TitanClassic/TitanClassic_Classic.toc @@ -1,7 +1,7 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa008.1.7|r +## Title: Titan Panel [|cffeda55f_Core_|r] |cff00aa008.2.0|r ## Author: Titan Panel Dev Team -## Version: 8.1.7 +## Version: 8.2.0 ## SavedVariables: TitanAll, TitanSettings, TitanSkins, ServerTimeOffsets, ServerHourFormat ## OptionalDeps: Ace3, AceGUI-3.0-SharedMediaWidgets, LibSharedMedia-3.0, LibQTip-1.0, !LibUIDropDownMenu ## Notes: Adds display bars to show and control information/launcher plugins. @@ -44,6 +44,7 @@ TitanGame.lua ..\Titan\locale\Localization.RU.lua ..\Titan\locale\Localization.TW.lua +..\Titan\TitanDebug.lua ..\Titan\TitanGlobal.lua ..\Titan\TitanUtils.lua ..\Titan\TitanHistory.lua diff --git a/TitanClock/TitanClock.lua b/TitanClock/TitanClock.lua index 3cf663a..4b99daf 100644 --- a/TitanClock/TitanClock.lua +++ b/TitanClock/TitanClock.lua @@ -335,7 +335,6 @@ local function OnLoad(self) HideMapTime = false, } }; - self:RegisterEvent("PLAYER_ENTERING_WORLD"); end ---local Start the timer for advancing the clock time @@ -347,6 +346,18 @@ local function OnShow(self) ClockTimer = AceTimer:ScheduleRepeatingTimer(TitanPanelPluginHandle_OnUpdate, 30, updateTable) ClockTimerRunning = true end + + -- If the user wants the minimap clock or calendar hidden then hide them + if TitanGetVar(TITAN_CLOCK_ID, "HideGameTimeMinimap") then + if GameTimeFrame then GameTimeFrame:Hide() end + end + if TimeManagerClockButton and TimeManagerClockButton:GetName() then + if TitanGetVar(TITAN_CLOCK_ID, "HideMapTime") then + TimeManagerClockButton:Hide() + else + TimeManagerClockButton:Show() + end + end end ---local Stop the timer for advancing the clock time @@ -361,19 +372,7 @@ end ---@param event string Event ---@param ... any Event parameters local function OnEvent(self, event, ...) - if (event == "PLAYER_ENTERING_WORLD") then - -- If the user wants the minimap clock or calendar hidden then hide them - if TitanGetVar(TITAN_CLOCK_ID, "HideGameTimeMinimap") then - if GameTimeFrame then GameTimeFrame:Hide() end - end - if TimeManagerClockButton and TimeManagerClockButton:GetName() then - if TitanGetVar(TITAN_CLOCK_ID, "HideMapTime") then - TimeManagerClockButton:Hide() - else - TimeManagerClockButton:Show() - end - end - end + -- No events to process end ---local Handle mouse events the clock plugin is interested in. diff --git a/TitanClock/TitanClock_Classic.toc b/TitanClock/TitanClock_Classic.toc index 5d67db9..47ee703 100644 --- a/TitanClock/TitanClock_Classic.toc +++ b/TitanClock/TitanClock_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fClock|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fClock|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Adds a clock to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: diff --git a/TitanClock/TitanClock_Mainline.toc b/TitanClock/TitanClock_Mainline.toc index eb49ce7..b64c779 100644 --- a/TitanClock/TitanClock_Mainline.toc +++ b/TitanClock/TitanClock_Mainline.toc @@ -1,6 +1,6 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55fClock|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fClock|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## IconTexture: Interface\Icons\Spell_Nature_TimeStop ## Notes: Adds a clock to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) diff --git a/TitanGold/TitanGold.lua b/TitanGold/TitanGold.lua index c4e3af6..f49635f 100644 --- a/TitanGold/TitanGold.lua +++ b/TitanGold/TitanGold.lua @@ -45,11 +45,10 @@ local FACTION_HORDE = "Horde_debug" --]] -- Topic debug tool / scheme -local pdebug = Titan_Global.NewDebug() -pdebug.enabled = false -pdebug.topics[1].enabled = true -pdebug.topics[2].enabled = false -pdebug.topics[3] = { enabled = true, topic = "Tooltip"} +local dbg = Titan_Debug:New(TITAN_GOLD_ID) +dbg:EnableDebug(false) +dbg:EnableTopic("Events", false) +dbg:EnableTopic("Flow", false) -- ******************************** Functions ******************************* @@ -146,7 +145,6 @@ function Warband.SetSum() else -- Likely Classic version end - --TitanTopicDebug(TITAN_GOLD_ID, 2, Gold_debug("SetSum")) end ---local Set Warband Bank info @@ -158,20 +156,17 @@ function Warband.Init() else -- Likely Classic version end - --TitanTopicDebug(TITAN_GOLD_ID, 2, Gold_debug("Init")) end ---local Return Warband Bank info ---@return number function Warband.GetSum() - --TitanTopicDebug(TITAN_GOLD_ID, 2, Gold_debug("GetSum")) return Warband.bank_sum end ---local Return Warband Bank info ---@return string function Warband.GetName() - --TitanTopicDebug(TITAN_GOLD_ID, 2, Gold_debug("GetName")) return Warband.label end @@ -677,8 +672,8 @@ local function GetTooltipText() .. "------ \t +" .. "\n" .. war_name .. "\t" .. cash - local str = "" .. war_name .. " ".. cash - --TitanTopicDebug(TITAN_GOLD_ID, 3, str) + local msg = "" .. war_name .. " ".. cash + dbg:Out("Tooltip", msg) end @@ -802,11 +797,15 @@ end ---local See if this toon is in saved vars AFTER PEW event. --- Get current total and session start time. Toon gold is available via API AFTER PEW event. ----@param self Button -local function Initialize_Array(self) +local function Initialize_Array() + dbg:Out("Flow", "Init inititated") + + local info = "" if (GOLD_INITIALIZED) then -- already done else + Warband.Init() + -- Ensure the saved vars are usable for index, money in pairs(GoldSave) do local character, charserver, char_faction = GetIndexInfo(index) @@ -833,14 +832,17 @@ local function Initialize_Array(self) GOLD_STARTINGGOLD = Get_Money(); GOLD_SESSIONSTART = GetTime(); GOLD_INITIALIZED = true; - --[[ -print("Init" -.." "..tostring(GOLD_STARTINGGOLD).."" -.." "..tostring(GOLD_SESSIONSTART).."" -.." "..tostring(GOLD_INITIALIZED).."" -) ---]] - end + + info = "" + .." "..tostring(GOLD_SESSIONSTART).."" + .." "..tostring(GOLD_STARTINGGOLD).."" + .." "..tostring(Warband.GetSum()).."" + end + + local msg = "" + .." "..tostring(GOLD_INITIALIZED).."" + .." "..info.."" + dbg:Out("Flow", ">Init done : "..msg) end ---local Clear the gold array and rebuild @@ -849,7 +851,7 @@ local function ClearData(self) GOLD_INITIALIZED = false; GoldSave = {}; - Initialize_Array(self); + Initialize_Array(); DEFAULT_CHAT_FRAME:AddMessage(TitanUtils_GetGreenText(L["TITAN_GOLD_DB_CLEARED"])); end @@ -1203,7 +1205,6 @@ local function OnLoad(self) tooltipTitle = L["TITAN_GOLD_TOOLTIP"], tooltipTextFunction = GetTooltipText, buttonTextFunction = FindGold, - debugClass = pdebug, icon = "Interface\\AddOns\\TitanGold\\Artwork\\TitanGold", iconWidth = 16, notes = notes, @@ -1242,14 +1243,14 @@ local function OnLoad(self) }; self:RegisterEvent("ADDON_LOADED"); - self:RegisterEvent("PLAYER_ENTERING_WORLD"); +-- self:RegisterEvent("PLAYER_ENTERING_WORLD"); end ---local When shown, register needed events and start timer for gold per hour ---@param self Button local function OnShow(self) self:RegisterEvent("PLAYER_MONEY") - GoldSave[GOLD_INDEX].gold = Get_Money() + Initialize_Array() if GoldSave and TitanGetVar(TITAN_GOLD_ID, "DisplayGoldPerHour") then if GoldTimerRunning then @@ -1262,10 +1263,10 @@ local function OnShow(self) -- timer running or user does not want gold per hour end - local dbg = "" + local msg = "" .." "..Gold_debug("OnShow") - --TitanTopicDebug(TITAN_GOLD_ID, 1, dbg) -end + dbg:Out("Flow", msg) + end ---local When shown, unregister needed events and stop timer for gold per hour ---@param self Button @@ -1309,12 +1310,9 @@ local function OnEvent(self, event, a1, ...) -- Not this addon return -- no debug, if enabled end - elseif (event == "PLAYER_ENTERING_WORLD") then - Initialize_Array(self); - Warband.Init() - TitanPanelButton_UpdateButton(TITAN_GOLD_ID) end - --TitanTopicDebug(TITAN_GOLD_ID, 1, event) + + dbg:Out("Events", event) end ---Button clicks - only shift-left for now diff --git a/TitanGold/TitanGold_Classic.toc b/TitanGold/TitanGold_Classic.toc index 9fff6cd..d0e86fa 100644 --- a/TitanGold/TitanGold_Classic.toc +++ b/TitanGold/TitanGold_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fGold|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fGold|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Keeps track of all gold held by a player's toons on a per server/faction basis. ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: GoldSave diff --git a/TitanGold/TitanGold_Mainline.toc b/TitanGold/TitanGold_Mainline.toc index 3948b68..88a0776 100644 --- a/TitanGold/TitanGold_Mainline.toc +++ b/TitanGold/TitanGold_Mainline.toc @@ -1,6 +1,6 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55fGold|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fGold|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## IconTexture: Interface\AddOns\TitanGold\Artwork\TitanGold ## Notes: Keeps track of all gold held by a player's toons on a per server/faction basis. ## Author: Titan Panel Development Team (http://www.titanpanel.org) diff --git a/TitanLocation/TitanLocation.lua b/TitanLocation/TitanLocation.lua index 94f68b6..85c24b5 100755 --- a/TitanLocation/TitanLocation.lua +++ b/TitanLocation/TitanLocation.lua @@ -25,7 +25,13 @@ local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true) local LocationTimer = {}; local LocationTimerRunning = false -local debug_flow = false +-- Topic debug tool / scheme +local dbg = Titan_Debug:New(TITAN_LOCATION_ID) +dbg:EnableDebug(false) +dbg:AddTopic("Map") +dbg:EnableTopic("Events", false) +dbg:EnableTopic("Flow", false) + local place = { zoneText = "", @@ -51,17 +57,6 @@ local GetZonePVP = C_PvP.GetZonePVPInfo or GetZonePVPInfo -- For Classic version -- ******************************** Functions ******************************* -local function debug_msg(Message) - local msg = "" - local stamp = date("%H:%M:%S") -- date("%m/%d/%y %H:%M:%S") - local milli = GetTime() -- seconds with millisecond precision (float) - local milli_str = string.format("%0.2F", milli - math.modf(milli)) - msg = msg .. TitanUtils_GetGoldText(stamp .. milli_str .. " " .. TITAN_LOCATION_ID .. ": ") - msg = msg .. TitanUtils_GetGreenText(Message) - DEFAULT_CHAT_FRAME:AddMessage(msg) - -- DEFAULT_CHAT_FRAME:AddMessage(TITAN_LOCATION_ID..": " .. Message, 1.00, 0.49, 0.04) -end - ---local Register event if not already registered ---@param plugin Button ---@param event string @@ -91,15 +86,10 @@ local function Events(action, reason) -- action unknown ??? end - if debug_flow then - local msg = - "Events" - .. " " .. tostring(action) .. "" - .. " " .. tostring(reason) .. "" - debug_msg(msg) - else - -- not requested - end + local msg = "" + .. " " .. tostring(action) .. "" + .. " " .. tostring(reason) .. "" + dbg:Out("Events", msg) end ---local Get the player coordinates on x,y axis of the map of the zone / area they are in. @@ -263,13 +253,6 @@ local function TitanMapCoords_OnUpdate(self, elapsed) local cursorLocationText = "" local playerLocationText = "" - if debug_flow then - cursorLocationText = "-C-" - playerLocationText = "-P-" - else - -- use default - end - if place.show_on_map then place.px, place.py = GetPlayerMapPosition(); if place.px == nil then -- invalid map / timing / ... ? @@ -308,8 +291,7 @@ local function TitanMapCoords_OnUpdate(self, elapsed) -- format coords per the user requested format cursorLocationText = format(place.coords_style, 100 * cx, 100 * cy) --[[ -local msg = -"_OnUpdate" +local msg = "" .. " " .. tostring(inside) .. "" .. " [" .. (format("%.2f", left or 0)) .. "" .. " " .. (format("%.2f", (bottom) or 0)) .. "" @@ -317,7 +299,7 @@ local msg = .. " " .. (format("%.2f", (bottom + height) or 0)) .. "]" .. " " .. (format("%.2f", cx)) .. "" .. " " .. (format("%.2f", cy)) .. "" -debug_msg(msg) + dbg:Out("Map", msg) --]] end @@ -327,13 +309,11 @@ debug_msg(msg) -- use defaults, saving a few cpu cycles end ---[[ - local msg = - "_OnUpdate" - .. " " .. tostring(playerLocationText) .. "" - .. " " .. tostring(cursorLocationText) .. "" - debug_msg(msg) ---]] + local msg = "" + .. " " .. tostring(playerLocationText) .. "" + .. " " .. tostring(cursorLocationText) .. "" + dbg:Out("Map", msg) + SetCoordText(playerLocationText, cursorLocationText) end @@ -393,16 +373,12 @@ local function CoordFrames(action) end end - if debug_flow then - local msg = + local msg = "CoordFrames" .. " " .. tostring(action) .. "" .. " " .. tostring(place.show_on_map) .. "" .. " " .. tostring(addon_conflict) .. "" - debug_msg(msg) - else - -- not requested - end + dbg:Out("Flow", msg) end ---local Adds player and cursor coords to the WorldMapFrame, unless the player has CT_MapMod @@ -417,14 +393,9 @@ local function CreateMapFrames() return; end - if debug_flow then - local msg = + local msg = "CreateMapFrames" - -- .." "..tostring(reason).."" - debug_msg(msg) - else - -- not requested - end + dbg:Out("Flow", msg) -- create the frame to hold the font strings, and simulate an "OnUpdate" script handler using C_Timer for efficiency local frame = CreateFrame("FRAME", TITAN_MAP_FRAME, WorldMapFrame) @@ -442,14 +413,9 @@ end ---local Display button when plugin is visible ---@param self Button local function OnShow(self) - if debug_flow then - local msg = + local msg = "_OnShow" - -- .." "..tostring(reason).."" - debug_msg(msg) - else - -- not requested - end + dbg:Out("Flow", msg) if LocationTimerRunning then -- Do not schedule a new one @@ -458,6 +424,20 @@ local function OnShow(self) end CreateMapFrames() -- as needed + + if TITAN_ID == "TitanClassic" then + if not TitanGetVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap") + and MinimapBorderTop and MinimapBorderTop:IsShown() then + LocOnMiniMap("PEW") + end + + if TitanGetVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap") and MinimapBorderTop:IsShown() then + if not MinimapZoneTextButton:IsShown() then MinimapZoneTextButton:Show() end + end + else + -- no work needed + end + CoordFrames("start") -- start coords on map, if requested Events("register", "_OnShow") @@ -623,29 +603,10 @@ local function OnEvent(self, event, ...) -- DF TODO See if we can turn off zone on minimap --[=[ --]=] - if debug_flow then - local msg = + local msg = "_OnEvent" .. " " .. tostring(event) .. "" - debug_msg(msg) - else - -- not requested - end - - if TITAN_ID == "TitanClassic" then - if event == "PLAYER_ENTERING_WORLD" then - if not TitanGetVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap") - and MinimapBorderTop and MinimapBorderTop:IsShown() then - LocOnMiniMap("PEW") - end - end - - if TitanGetVar(TITAN_LOCATION_ID, "ShowLocOnMiniMap") and MinimapBorderTop:IsShown() then - if not MinimapZoneTextButton:IsShown() then MinimapZoneTextButton:Show() end - end - else - -- no work needed - end + dbg:Out("Events", msg) ZoneUpdate(self); --[[ @@ -919,16 +880,9 @@ local function OnLoad(self) } }; - RegEvent(self, "PLAYER_ENTERING_WORLD") - - if debug_flow then - local msg = + local msg = "_OnLoad" - -- .." "..tostring(reason).."" - debug_msg(msg) - else - -- not requested - end + dbg:Out("Flow", msg) end ---local Create needed frames diff --git a/TitanLocation/TitanLocation_Classic.toc b/TitanLocation/TitanLocation_Classic.toc index b6ea0ba..00a282f 100644 --- a/TitanLocation/TitanLocation_Classic.toc +++ b/TitanLocation/TitanLocation_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fLocation|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fLocation|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Adds coordinates and location information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: diff --git a/TitanLocation/TitanLocation_Mainline.toc b/TitanLocation/TitanLocation_Mainline.toc index 55f404a..e485d01 100644 --- a/TitanLocation/TitanLocation_Mainline.toc +++ b/TitanLocation/TitanLocation_Mainline.toc @@ -1,6 +1,6 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55fLocation|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fLocation|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## IconTexture: Interface\AddOns\TitanLocation\TitanLocation ## Notes: Adds coordinates and location information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) diff --git a/TitanLootType/TitanLootType_Classic.toc b/TitanLootType/TitanLootType_Classic.toc index 84e4c4b..125a838 100644 --- a/TitanLootType/TitanLootType_Classic.toc +++ b/TitanLootType/TitanLootType_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fLootType|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fLootType|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Adds group loot and instance difficulty information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: TitanClassicLootTypeSaved diff --git a/TitanLootType/TitanLootType_Mainline.toc b/TitanLootType/TitanLootType_Mainline.toc index c285860..3d74174 100644 --- a/TitanLootType/TitanLootType_Mainline.toc +++ b/TitanLootType/TitanLootType_Mainline.toc @@ -1,6 +1,6 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55fLootType|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fLootType|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## IconTexture: Interface\AddOns\TitanLootType\TitanLootType ## Notes: Adds group loot and instance difficulty information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) diff --git a/TitanPerformance/TitanPerformance.lua b/TitanPerformance/TitanPerformance.lua index 651ee5d..35a3c2f 100644 --- a/TitanPerformance/TitanPerformance.lua +++ b/TitanPerformance/TitanPerformance.lua @@ -643,6 +643,33 @@ print("TPref" TitanPanelRightClickMenu_AddControlVars(TITAN_PERFORMANCE_ID) end +local function Init() + topAddOns = {} + -- scan how many addons are active + local count = NumAddons(); + local ActiveAddons = 0; + local NumOfAddons = TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"); + if NumOfAddons == nil then + NumOfAddons = 5; + TitanSetVar(TITAN_PERFORMANCE_ID, "NumOfAddons", 5); + end + for i = 1, count do + if IsAddOnLoaded(i) then + ActiveAddons = ActiveAddons + 1; + end + end + + if ActiveAddons < NumOfAddons then + counter = ActiveAddons; + else + counter = NumOfAddons; + end + --set the counter to the proper number of active addons that are being monitored + for i = 1, counter do + topAddOns[i] = { name = '', value = 0 } + end +end + ---local Create plugin .registry and and init some variables and register for first events ---@param self Button local function OnLoad(self) @@ -684,7 +711,6 @@ local function OnLoad(self) }; perf_stats.fpsSampleCount = 0 - self:RegisterEvent("PLAYER_ENTERING_WORLD"); end ---local Hide the plugin and stop timers @@ -703,6 +729,8 @@ end ---local Show the plugin and start timers local function OnShow() + Init() + if PerfTimerRunning then -- Do not create a new one else @@ -716,32 +744,7 @@ end ---@param event string ---@param ... any local function OnEvent(self, event, ...) - if event == "PLAYER_ENTERING_WORLD" then - topAddOns = {} - -- scan how many addons are active - local count = NumAddons(); - local ActiveAddons = 0; - local NumOfAddons = TitanGetVar(TITAN_PERFORMANCE_ID, "NumOfAddons"); - if NumOfAddons == nil then - NumOfAddons = 5; - TitanSetVar(TITAN_PERFORMANCE_ID, "NumOfAddons", 5); - end - for i = 1, count do - if IsAddOnLoaded(i) then - ActiveAddons = ActiveAddons + 1; - end - end - - if ActiveAddons < NumOfAddons then - counter = ActiveAddons; - else - counter = NumOfAddons; - end - --set the counter to the proper number of active addons that are being monitored - for i = 1, counter do - topAddOns[i] = { name = '', value = 0 } - end - end + -- No events to process end ---local Handle mouse click events registered to plugin; Left click is garbage collection diff --git a/TitanPerformance/TitanPerformance_Classic.toc b/TitanPerformance/TitanPerformance_Classic.toc index 5c066dc..fb04478 100644 --- a/TitanPerformance/TitanPerformance_Classic.toc +++ b/TitanPerformance/TitanPerformance_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fPerformance|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fPerformance|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Adds FPS and Garbage collection information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: diff --git a/TitanPerformance/TitanPerformance_Mainline.toc b/TitanPerformance/TitanPerformance_Mainline.toc index 8acc03f..a8f1086 100644 --- a/TitanPerformance/TitanPerformance_Mainline.toc +++ b/TitanPerformance/TitanPerformance_Mainline.toc @@ -1,6 +1,6 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55fPerformance|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fPerformance|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## IconTexture: Interface\AddOns\TitanPerformance\TitanPerformance ## Notes: Adds FPS and Garbage collection information to Titan Panel ## Author: Titan Panel Development Team (http://www.titanpanel.org) diff --git a/TitanRegen/TitanRegen_Classic.toc b/TitanRegen/TitanRegen_Classic.toc index 9bd42dc..be7abd1 100644 --- a/TitanRegen/TitanRegen_Classic.toc +++ b/TitanRegen/TitanRegen_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fRegen|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fRegen|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Adds a regen monitor to Titan Panel to show HP/MANA regen - Classic versions only ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: diff --git a/TitanRepair/TitanRepair_Classic.toc b/TitanRepair/TitanRepair_Classic.toc index b475dd7..ecf3188 100644 --- a/TitanRepair/TitanRepair_Classic.toc +++ b/TitanRepair/TitanRepair_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fRepair|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fRepair|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Provides a configurable durability display. Also adds the ability to auto repair items and inventory at vendors. Adds selling of grey items. ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: diff --git a/TitanRepair/TitanRepair_Mainline.toc b/TitanRepair/TitanRepair_Mainline.toc index 70785b9..dfed52c 100644 --- a/TitanRepair/TitanRepair_Mainline.toc +++ b/TitanRepair/TitanRepair_Mainline.toc @@ -1,6 +1,6 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55fRepair|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fRepair|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## IconTexture: Interface\AddOns\TitanRepair\TitanRepair ## Notes: Provides a configurable durability display. Also adds the ability to auto repair items and inventory at vendors. Adds selling of grey items. ## Author: Titan Panel Development Team (http://www.titanpanel.org) diff --git a/TitanVolume/TitanVolume.lua b/TitanVolume/TitanVolume.lua index 60e3a6f..f6a6732 100644 --- a/TitanVolume/TitanVolume.lua +++ b/TitanVolume/TitanVolume.lua @@ -119,7 +119,12 @@ end ---@param self Button ---@param event string local function OnEvent(self, event, a1, ...) - if event == "PLAYER_ENTERING_WORLD" and TitanGetVar(TITAN_VOLUME_ID, "OverrideBlizzSettings") then + -- No events to process +end + +---local Set plugin icon and update plugin. +local function OnShow() + if TitanGetVar(TITAN_VOLUME_ID, "OverrideBlizzSettings") then -- Override Blizzard's volume CVar settings if TitanGetVar(TITAN_VOLUME_ID, "VolumeMaster") then SetCVar("Sound_MasterVolume", TitanGetVar(TITAN_VOLUME_ID, "VolumeMaster")) @@ -135,12 +140,7 @@ local function OnEvent(self, event, a1, ...) TitanGetVar(TITAN_VOLUME_ID, "VolumeMusic")) end -- if TitanGetVar(TITAN_VOLUME_ID, "VolumeOutboundChat") then SetCVar("OutboundChatVolume", TitanGetVar(TITAN_VOLUME_ID, "VolumeOutboundChat")) end -- if TitanGetVar(TITAN_VOLUME_ID, "VolumeInboundChat") then SetCVar("InboundChatVolume", TitanGetVar(TITAN_VOLUME_ID, "VolumeInboundChat")) end - TitanPanelButton_UpdateButton(TITAN_VOLUME_ID); end -end - ----local Set plugin icon and update plugin. -local function OnShow() SetVolumeIcon(); TitanPanelButton_UpdateButton(TITAN_VOLUME_ID); end @@ -360,7 +360,6 @@ local function OnLoad(self) DisplayOnRightSide = 1, } }; - self:RegisterEvent("PLAYER_ENTERING_WORLD"); end ---local Create needed frames diff --git a/TitanVolume/TitanVolume_Classic.toc b/TitanVolume/TitanVolume_Classic.toc index 88dce2f..f391604 100644 --- a/TitanVolume/TitanVolume_Classic.toc +++ b/TitanVolume/TitanVolume_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fVolume|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fVolume|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Adds a volume control icon on your Titan Bar ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: diff --git a/TitanVolume/TitanVolume_Mainline.toc b/TitanVolume/TitanVolume_Mainline.toc index 25939a7..4730afe 100644 --- a/TitanVolume/TitanVolume_Mainline.toc +++ b/TitanVolume/TitanVolume_Mainline.toc @@ -1,6 +1,6 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55fVolume|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fVolume|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## IconTexture: Interface\AddOns\TitanVolume\Artwork\TitanVolumeHigh ## Notes: Adds a volume control icon on your Titan Bar ## Author: Titan Panel Development Team (http://www.titanpanel.org) diff --git a/TitanXP/TitanXP_Classic.toc b/TitanXP/TitanXP_Classic.toc index ded03d1..e7d8002 100644 --- a/TitanXP/TitanXP_Classic.toc +++ b/TitanXP/TitanXP_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11505, 40401 -## Title: Titan Panel [|cffeda55fXP|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fXP|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## Notes: Adds information to Titan Panel about XP earned and time to level ## Author: Titan Panel Development Team (http://www.titanpanel.org) ## SavedVariables: diff --git a/TitanXP/TitanXP_Mainline.toc b/TitanXP/TitanXP_Mainline.toc index fe379a1..710f9e5 100644 --- a/TitanXP/TitanXP_Mainline.toc +++ b/TitanXP/TitanXP_Mainline.toc @@ -1,6 +1,6 @@ ## Interface: 110007 -## Title: Titan Panel [|cffeda55fXP|r] |cff00aa008.1.7|r -## Version: 8.1.7 +## Title: Titan Panel [|cffeda55fXP|r] |cff00aa008.2.0|r +## Version: 8.2.0 ## IconTexture: Interface\Icons\xp_icon ## Notes: Adds information to Titan Panel about XP earned and time to level ## Author: Titan Panel Development Team (http://www.titanpanel.org)