mirror of
https://github.com/parnic/breakables.git
synced 2025-06-16 17:40:13 -05:00
- added spell tooltip to profession button
This commit is contained in:
@ -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])
|
||||
|
Reference in New Issue
Block a user