From f788da0f0fd75e7350e2d368b28731ceb2a0e650 Mon Sep 17 00:00:00 2001 From: Xruptor Date: Sat, 3 Nov 2012 08:58:34 -0400 Subject: [PATCH] -Added a check so that the autoshine turns off after a second of non-use. -Added Desecrated Herb -Added vine-cracked junkbox -Added ghost iron box -Added Elementium Lockbox --- itemDB.lua | 5 ++++- xanMortarPestle.lua | 24 ++++++++++++++++++++++++ xanMortarPestle.toc | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/itemDB.lua b/itemDB.lua index dd6f316..444bd6a 100644 --- a/itemDB.lua +++ b/itemDB.lua @@ -66,6 +66,7 @@ xMPDB.herbs = { [72238] = true, -- Golden Lotus [79010] = true, -- Snow Lily [79011] = true, -- Fool's Cap + [89639] = true, -- Desecrated Herb } --[[------------------------ @@ -126,5 +127,7 @@ xMPDB.lock = { [43624] = true, [45986] = true, [63349] = true, - [68729] = true, + [68729] = true, --Elementium Lockbox + [88165] = true, --vine-cracked junkbox (MOP) + [88567] = true, --ghost iron box } diff --git a/xanMortarPestle.lua b/xanMortarPestle.lua index e0e7f73..879b171 100644 --- a/xanMortarPestle.lua +++ b/xanMortarPestle.lua @@ -112,6 +112,24 @@ end) local frm = CreateFrame("frame", "xanMortarPestle_Frame", UIParent) frm:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end) +--this update is JUST IN CASE the autoshine is still going even after the alt press is gone +local TimerOnUpdate = function(self, time) + + if self.active and not IsAltKeyDown() then + self.OnUpdateCounter = (self.OnUpdateCounter or 0) + time + if self.OnUpdateCounter < 0.5 then return end + self.OnUpdateCounter = 0 + + self.tick = (self.tick or 0) + 1 + if self.tick >= 1 then + AutoCastShine_AutoCastStop(self) + self.active = false + self.tick = 0 + self:SetScript("OnUpdate", nil) + end + end +end + function frm:PLAYER_LOGIN() --check for DB @@ -181,6 +199,9 @@ function frm:PLAYER_LOGIN() --set the item for disenchant check lastItem = link + button:SetScript("OnUpdate", TimerOnUpdate) + button.tick = 0 + button.active = true button:SetAttribute('macrotext', string.format('/cast %s\n/use %s %s', spells[spellID], bag, slot)) button:SetAllPoints(owner) button:SetAlpha(1) @@ -188,6 +209,9 @@ function frm:PLAYER_LOGIN() AutoCastShine_AutoCastStart(button, colors[spellID].r, colors[spellID].g, colors[spellID].b) else + button:SetScript("OnUpdate", nil) + button.tick = 0 + button.active = false button:ClearAllPoints() button:Hide() end diff --git a/xanMortarPestle.toc b/xanMortarPestle.toc index 250ad4e..f0a0eb0 100644 --- a/xanMortarPestle.toc +++ b/xanMortarPestle.toc @@ -2,7 +2,7 @@ ## Title: xanMortarPestle ## Notes: Mill/Prospect/Disenchant using (Alt + Right-Click) on an item. ## Author: Xruptor -## Version: 2.5 +## Version: 2.7 ## SavedVariables: XMP_DB xanMortarPestle.lua -- 1.7.9.5