From 123614e64bfdefa691482a6b763b09ae7a6a0b48 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Wed, 23 Dec 2009 02:18:23 +0100 Subject: [PATCH] Rework the click conditions, barely need any. --- Molinari.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Molinari.lua b/Molinari.lua index 36e102e..bfda3e1 100644 --- a/Molinari.lua +++ b/Molinari.lua @@ -22,6 +22,7 @@ button:SetScript('OnLeave', function(self) end end) +local disenchanting = GetSpellInfo(13262) local macro = '/cast %s\n/use %s %s' local spells = {} @@ -39,7 +40,7 @@ end local function Disenchantable(item) local _, _, quality, _, _, type = GetItemInfo(item) if ((type == ARMOR or type == ENCHSLOT_WEAPON) and quality > 1 and quality < 5) then - return GetSpellInfo(13262), 0.5, 0.5, 1 + return disenchanting, 0.5, 0.5, 1 end end @@ -52,19 +53,19 @@ local function ScanTooltip() end end -local function Clickable() - return (not IsAddOnLoaded('Blizzard_AuctionUI') or (AuctionFrame and not AuctionFrame:IsShown())) and not TradeFrame:IsShown() and not BankFrame:IsShown() and not MailFrame:IsShown() and not InCombatLockdown() and IsAltKeyDown() +local function Clickable(spell) + return (not IsAddOnLoaded('Blizzard_AuctionUI') or (AuctionFrame and not AuctionFrame:IsShown())) and (spell == disenchanting and not CharacterFrame:IsShown()) and not InCombatLockdown() and IsAltKeyDown() end GameTooltip:HookScript('OnTooltipSetItem', function(self) local item = self:GetItem() - if(item and Clickable()) then + if(item) then local spell, r, g, b = ScanTooltip() if(not spell) then spell, r, g, b = Disenchantable(item) end - if(spell) then + if(spell and Clickable(spell)) then local slot = GetMouseFocus() button:SetAttribute('macrotext', macro:format(spell, slot:GetParent():GetID(), slot:GetID())) button:SetAllPoints(slot) -- 1.7.9.5