From 2561295a6caa6f0a68996ff5322ede0c44652342 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Nov 2009 21:54:05 +0100 Subject: [PATCH] Only enable on the profession(s) the player knows --- Molinari.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Molinari.lua b/Molinari.lua index fb0d725..220f185 100644 --- a/Molinari.lua +++ b/Molinari.lua @@ -5,6 +5,7 @@ button:SetAttribute('*type*', 'macro') button:SetBackdrop({bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=]}) button:SetBackdropColor(0, 0, 0, 0.4) +button:RegisterEvent('PLAYER_LOGIN') button:RegisterEvent('MODIFIER_STATE_CHANGED') button:SetScript('OnEvent', function(self, event, ...) self[event](self, event, ...) end) button:SetScript('OnLeave', function(self) @@ -16,11 +17,7 @@ button:SetScript('OnLeave', function(self) end) local macro = '/cast %s\n/use %s %s' - -local spells = { - [ITEM_MILLABLE] = {GetSpellInfo(51005), 0.5, 1, 0.5}, - [ITEM_PROSPECTABLE] = {GetSpellInfo(31252), 1, 0.5, 0.5}, -} +local spells = {} function button:MODIFIER_STATE_CHANGED(event, key) if(self:IsShown() and (key == 'LALT' or key == 'RALT')) then @@ -71,3 +68,15 @@ GameTooltip:HookScript('OnTooltipSetItem', function(self) end end end) + +function button:PLAYER_LOGIN() + if(IsSpellKnown(51005)) then + spells[ITEM_MILLABLE] = {GetSpellInfo(51005), 0.5, 1, 0.5} + end + if(IsSpellKnown(31252)) then + spells[ITEM_PROSPECTABLE] = {GetSpellInfo(31252), 1, 0.5, 0.5} + end + if(not IsSpellKnown(13262)) then + Disenchantable = function() end + end +end -- 1.7.9.5