From 4b5aed956f04a5a5f0675fc640a404b04ed7997e Mon Sep 17 00:00:00 2001 From: pschifferer Date: Thu, 24 Dec 2009 15:05:43 +0000 Subject: [PATCH] Added option to modify tooltip. Added locale strings for modify tooltip option. Moved event registration for some crafting-related events to the open window function, so they are only processed when the window is open. --- CauldronMain.lua | 40 +++++++++++++++++++++++++++++++++------- Locale/Cauldron-enUS.lua | 2 ++ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/CauldronMain.lua b/CauldronMain.lua index f8313a4..73b6ce8 100644 --- a/CauldronMain.lua +++ b/CauldronMain.lua @@ -66,7 +66,10 @@ function Cauldron:OnInitialize() userdata = {}, -- Stores all known characters }, global = { - difficulty = {}, -- Stores at what level difficulty is changed for all recipes. + options = { + AutoOpenShoppingList = true, + ModifyTooltip = true, + }, } }; @@ -95,6 +98,14 @@ function Cauldron:OnInitialize() desc = L["Automatically open the shopping list when the bank, guild bank, or a merchant window is opened."], arg = "AutoOpenShoppingList", }, + modifyTooltip = { + type = 'toggle', + order = 1, + width = "double", + name = L["Modify tooltip?"], + desc = L["Adds information to the game tooltip when displaying information about certain crafting items."], + arg = "ModifyTooltip", + }, }, }, shoppinglist = { @@ -260,7 +271,6 @@ function Cauldron:OnEnable() self:RegisterEvent("SKILL_LINES_CHANGED", "OnSkillUpdate"); self:RegisterEvent("ADDON_LOADED", "OnAddonLoaded"); self:RegisterEvent("UNIT_PORTRAIT_UPDATE", "OnEvent"); - self:RegisterEvent("UPDATE_TRADESKILL_RECAST", "OnTradeSkillRecast"); self:RegisterEvent("BANKFRAME_OPENED", "OnBankOpened"); self:RegisterEvent("BANKFRAME_CLOSED", "OnBankClosed"); -- self:RegisterEvent("PLAYERBANKSLOTS_CHANGED"); @@ -280,10 +290,6 @@ function Cauldron:OnEnable() self:RegisterEvent("UI_ERROR_MESSAGE", "OnError"); self:RegisterEvent("UNIT_QUEST_LOG_CHANGED", "OnQuestLogChanged"); self:RegisterEvent("ACHIEVEMENT_EARNED", "OnAchievementEarned"); - self:RegisterEvent("UNIT_SPELLCAST_START", "OnSpellcastStart"); - self:RegisterEvent("UNIT_SPELLCAST_STOP", "OnSpellcastStop"); - self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "OnSpellcastSucceed"); - self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", "OnSpellcastInterrupt"); -- setup hooks for tooltips self:HookTooltips(); @@ -340,6 +346,13 @@ function Cauldron:OnTradeShow() self.updatingSkills = false; end + -- register for events that are needed when the window is open + self:RegisterEvent("UPDATE_TRADESKILL_RECAST", "OnTradeSkillRecast"); + self:RegisterEvent("UNIT_SPELLCAST_START", "OnSpellcastStart"); + self:RegisterEvent("UNIT_SPELLCAST_STOP", "OnSpellcastStop"); + self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "OnSpellcastSucceed"); + self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", "OnSpellcastInterrupt"); + -- show the UI frame self:debug("OnTradeShow: show the UI"); self:Frame_Show(); @@ -356,8 +369,16 @@ function Cauldron:OnTradeUpdate() end function Cauldron:OnTradeClose() - + + -- hide the window self:Frame_Hide(); + + -- unregister for events that are only needed when the window is open + self:UnregisterEvent("UPDATE_TRADESKILL_RECAST"); + self:UnregisterEvent("UNIT_SPELLCAST_START"); + self:UnregisterEvent("UNIT_SPELLCAST_STOP"); + self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED"); + self:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED"); end @@ -959,6 +980,11 @@ function Cauldron:HookTooltips() end function Cauldron:AddToTooltip(tooltip, id) + + if not Cauldron.db.global.options.ModifyTooltip then + return; + end + if not id then return; end diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua index e6082c0..5499b56 100644 --- a/Locale/Cauldron-enUS.lua +++ b/Locale/Cauldron-enUS.lua @@ -40,6 +40,8 @@ L["Clear Queue"] = true L["General"] = true L["Auto-open shopping list?"] = true L["Automatically open the shopping list when the bank, guild bank, or a merchant window is opened."] = true +L["Modify tooltip?"] = true +L["Adds information to the game tooltip when displaying information about certain crafting items."] = true L["Cauldron had issues with some recipes for this profession."] = true L["Please close and re-open the %1$s window again to re-scan."] = true -- 1.7.9.5