changeset 2:216d8b3d039c

- small bug fixes.
author Tercioo
date Wed, 13 Jan 2016 21:34:32 -0200
parents b49854df36fc
children 899a07e4bef9
files GoldPrice.lua GoldPrice.toc
diffstat 2 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/GoldPrice.lua	Tue Jun 23 13:56:35 2015 -0300
+++ b/GoldPrice.lua	Wed Jan 13 21:34:32 2016 -0200
@@ -1,6 +1,3 @@
-
-
-
 do
 	local f = CreateFrame ("frame", "GoldPriceFrame", UIParent)
 	f:RegisterEvent ("TOKEN_MARKET_PRICE_UPDATED")
@@ -13,11 +10,12 @@
 	end
 	
 	f:SetScript ("OnEvent", function (self, event)
-	
-		local price = C_WowTokenPublic.GetCurrentMarketPrice()
-		price = floor (price / 10000)
-	
-		print ("|cFFFF9900Token Price|r: ", f:comma_value (price) .. "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t")
+		if (f.canShow) then
+			local price = C_WowTokenPublic.GetCurrentMarketPrice()
+			price = floor (price / 10000)
+			print ("|cFFFF9900Token Price|r: ", f:comma_value (price) .. "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t")
+			f.canShow = false
+		end
 	end)
 end
 
@@ -25,11 +23,13 @@
 function SlashCmdList.GoldPrice (msg, editbox)
 	if (GoldPriceFrame.LastQuerry and GoldPriceFrame.LastQuerry+15 > GetTime()) then
 		local price = C_WowTokenPublic.GetCurrentMarketPrice()
-		price = floor (price / 10000)
-		return print ("|cFFFF9900Token Price|r: ", GoldPriceFrame:comma_value (price) .. "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t")
+		if (price) then
+			price = floor (price / 10000)
+			return print ("|cFFFF9900Token Price|r: ", GoldPriceFrame:comma_value (price) .. "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t")
+		end
 	end
+	
+	GoldPriceFrame.canShow = true
 	GoldPriceFrame.LastQuerry = GetTime()
 	C_WowTokenPublic.UpdateMarketPrice()
-end
-
-
+end
\ No newline at end of file
--- a/GoldPrice.toc	Tue Jun 23 13:56:35 2015 -0300
+++ b/GoldPrice.toc	Wed Jan 13 21:34:32 2016 -0200
@@ -1,5 +1,5 @@
 ## Interface: 60200
-## Title: Gold Token Price
+## Title: Lib: TokenCommands-1.0
 ## Notes: Adds the slash command /gold /token showing the current token price.
 
 GoldPrice.lua
\ No newline at end of file