Quantcast

-Added a check so that the autoshine turns off after a second of non-use.

Xruptor [11-03-12 - 12:58]
-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
Filename
itemDB.lua
xanMortarPestle.lua
xanMortarPestle.toc
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