* BG's tooltip will now work in NinjaPanel! OnLeave-hook was required
ckaotik [12-03-10 - 21:09]
* BG's tooltip will now work in NinjaPanel! OnLeave-hook was required
* fixed 'compare with nil' error in CanDisenchant()
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