From cf128a6a874ed28c67d2e818f29febdcf3ff3e28 Mon Sep 17 00:00:00 2001 From: parnic Date: Sun, 12 Dec 2010 06:14:37 +0000 Subject: [PATCH] - added spell tooltip to profession button --- Breakables.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Breakables.lua b/Breakables.lua index 1748bbd..ee1b8c8 100644 --- a/Breakables.lua +++ b/Breakables.lua @@ -473,7 +473,7 @@ function Breakables:CreateButtonFrame() self.buttonFrame[i]:SetScript("OnMouseUp", function(frame) self:OnMouseUp(frame) end) self.buttonFrame[i]:SetClampedToScreen(true) - local spellName, _, texture = GetSpellInfo((self.buttonFrame[i].type == BREAKABLE_HERB and MillingId) or (self.buttonFrame[i].type == BREAKABLE_ORE and ProspectingId) or DisenchantId) + local spellName, _, texture = GetSpellInfo(self:GetSpellIdFromProfessionButton(self.buttonFrame[i])) self.buttonFrame[i]:SetAttribute("type1", "spell") self.buttonFrame[i]:SetAttribute("spell1", spellName) @@ -486,10 +486,17 @@ function Breakables:CreateButtonFrame() lbfGroup:AddButton(self.buttonFrame[i]) end + + self.buttonFrame[i]:SetScript("OnEnter", function(this) self:OnEnterProfessionButton(this) end) + self.buttonFrame[i]:SetScript("OnLeave", function() self:OnLeaveProfessionButton() end) end end end +function Breakables:GetSpellIdFromProfessionButton(btn) + return (btn.type == BREAKABLE_HERB and MillingId) or (btn.type == BREAKABLE_ORE and ProspectingId) or DisenchantId +end + function Breakables:ApplyScale() if not self.buttonFrame then return @@ -673,6 +680,15 @@ function Breakables:FindBreakables(bag) end end +function Breakables:OnEnterProfessionButton(btn) + GameTooltip:SetOwner(btn, "ANCHOR_BOTTOMLEFT") + GameTooltip:SetSpellByID(self:GetSpellIdFromProfessionButton(btn)) +end + +function Breakables:OnLeaveProfessionButton() + GameTooltip:Hide() +end + function Breakables:OnEnterBreakableButton(this, breakable) GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT") GameTooltip:SetBagItem(breakable[IDX_BAG], breakable[IDX_SLOT])