From 1cd75a1755a4902189b682ae650b4610811717f9 Mon Sep 17 00:00:00 2001 From: ckaotik Date: Fri, 3 Dec 2010 22:09:40 +0100 Subject: [PATCH] * BG's tooltip will now work in NinjaPanel! OnLeave-hook was required * fixed 'compare with nil' error in CanDisenchant() --- core.lua | 7 +++++-- helper.lua | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core.lua b/core.lua index 72900e9..56ec61f 100644 --- a/core.lua +++ b/core.lua @@ -20,8 +20,9 @@ local LDB = LibStub("LibDataBroker-1.1"):NewDataObject("Broker_Garbage", { label = "Garbage", text = "", - OnClick = function(...) BrokerGarbage:OnClick(...) end, + OnClick = function(...) BrokerGarbage:OnClick(...) end, OnEnter = function(...) BrokerGarbage:Tooltip(...) end, + OnLeave = function() end, -- needed for e.g. NinjaPanel }) local function UpdateLDB() @@ -289,7 +290,9 @@ function BrokerGarbage:Tooltip(self) end -- onClick function - works for both, the LDB plugin -and- tooltip lines -function BrokerGarbage:OnClick(itemTable, button) +function BrokerGarbage:OnClick(itemTable, button) + BrokerGarbage.debug1 = itemTable + BrokerGarbage.debug2 = button -- handle LDB clicks seperately local LDBclick = false if not itemTable or not itemTable.itemID or type(itemTable.itemID) ~= "number" then diff --git a/helper.lua b/helper.lua index d6fc229..01ff64c 100644 --- a/helper.lua +++ b/helper.lua @@ -479,7 +479,10 @@ function BrokerGarbage:CanDisenchant(itemLink, location) end end - if skillRank >= required then + if not skillRank or not required then + -- this item is not disenchantable + return false + elseif skillRank >= required then -- this character can disenchant the item. Perfect! return true elseif BG_GlobalDB.hasEnchanter then -- 1.7.9.5