# HG changeset patch # User Tercio # Date 1428696317 10800 # Node ID 3b695b187743107072ebccf7c753d86b25288498 First Commit diff -r 000000000000 -r 3b695b187743 GoldPrice.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GoldPrice.lua Fri Apr 10 17:05:17 2015 -0300 @@ -0,0 +1,35 @@ + + + +do + local f = CreateFrame ("frame", "GoldPriceFrame", UIParent) + f:RegisterEvent ("TOKEN_MARKET_PRICE_UPDATED") + f:Hide() + + function f:comma_value (n) + n = floor (n) + local left,num,right = string.match (n,'^([^%d]*%d)(%d*)(.-)$') + return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right + 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") + end) +end + +SLASH_GoldPrice1, SLASH_GoldPrice2 = "/gold", "/token" +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") + end + GoldPriceFrame.LastQuerry = GetTime() + C_WowTokenPublic.UpdateMarketPrice() +end + + diff -r 000000000000 -r 3b695b187743 GoldPrice.toc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GoldPrice.toc Fri Apr 10 17:05:17 2015 -0300 @@ -0,0 +1,5 @@ +## Interface: 60100 +## Title: Gold Token Price +## Notes: Adds the slash command /gold /token showing the current token price. + +GoldPrice.lua \ No newline at end of file