From 2a956cd9ebf900ce5a0e8008e31aa9ec61b2ab22 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Sat, 30 Aug 2014 14:12:50 +0200 Subject: [PATCH] Do some more validation before we show --- Molinari.lua | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Molinari.lua b/Molinari.lua index 1150a9c..e9591b0 100644 --- a/Molinari.lua +++ b/Molinari.lua @@ -26,11 +26,15 @@ function Molinari:Apply(itemLink, spell, r, g, b) local parent = GetMouseFocus() local slot = parent:GetID() local bag = parent:GetParent():GetID() + if(not bag or bag < 0) then return end - local show = true - if(GetTradeTargetItemLink(7) == itemLink and type(spell) ~= 'number') then - self:SetAttribute('alt-type1', 'macro') - self:SetAttribute('macrotext', string.format('/cast %s\n/run ClickTargetTradeButton(7)', spell)) + if(GetTradeTargetItemLink(7) == itemLink) then + if(type(spell) == 'number') then + return + else + self:SetAttribute('alt-type1', 'macro') + self:SetAttribute('macrotext', string.format('/cast %s\n/run ClickTargetTradeButton(7)', spell)) + end elseif(GetContainerItemLink(bag, slot) == itemLink) then if(type(spell) == 'number') then self:SetAttribute('alt-type1', 'item') @@ -43,16 +47,14 @@ function Molinari:Apply(itemLink, spell, r, g, b) self:SetAttribute('target-bag', bag) self:SetAttribute('target-slot', slot) else - show = false + return end - if(show) then - self:SetAttribute('_entered', true) - self:SetAllPoints(parent) - self:Show() + self:SetAttribute('_entered', true) + self:SetAllPoints(parent) + self:Show() - AutoCastShine_AutoCastStart(self, r, g, b) - end + AutoCastShine_AutoCastStart(self, r, g, b) end local MILLING, PROSPECTING, DISENCHANTING, LOCKPICKING @@ -63,8 +65,9 @@ function Molinari:OnTooltipSetItem() if(not IsAltKeyDown()) then return end if(InCombatLockdown()) then return end if(UnitHasVehicleUI('player')) then return end - if(MailFrame:IsShown()) then return end - if((AuctionFrame and AuctionFrame:IsShown())) then return end + if(MailFrame:IsVisible()) then return end + if(EquipmentFlyoutFrame:IsVisible()) then return end + if(AuctionFrame and AuctionFrame:IsVisible()) then return end local itemID = tonumber(string.match(itemLink, 'item:(%d+):')) if(LibProcessable:IsMillable(itemID) and GetItemCount(itemID) >= 5) then -- 1.7.9.5