Tercio@0: do Tercio@0: local f = CreateFrame ("frame", "GoldPriceFrame", UIParent) Tercio@0: f:RegisterEvent ("TOKEN_MARKET_PRICE_UPDATED") Tercio@0: f:Hide() Tercio@0: Tercio@0: function f:comma_value (n) Tercio@0: n = floor (n) Tercio@0: local left,num,right = string.match (n,'^([^%d]*%d)(%d*)(.-)$') Tercio@0: return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right Tercio@0: end Tercio@0: Tercio@0: f:SetScript ("OnEvent", function (self, event) Tercioo@2: if (f.canShow) then Tercioo@2: local price = C_WowTokenPublic.GetCurrentMarketPrice() Tercioo@2: price = floor (price / 10000) Tercioo@2: print ("|cFFFF9900Token Price|r: ", f:comma_value (price) .. "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t") Tercioo@2: f.canShow = false Tercioo@2: end Tercio@0: end) Tercio@0: end Tercio@0: Tercio@0: SLASH_GoldPrice1, SLASH_GoldPrice2 = "/gold", "/token" Tercio@0: function SlashCmdList.GoldPrice (msg, editbox) Tercio@0: if (GoldPriceFrame.LastQuerry and GoldPriceFrame.LastQuerry+15 > GetTime()) then Tercio@0: local price = C_WowTokenPublic.GetCurrentMarketPrice() Tercioo@2: if (price) then Tercioo@2: price = floor (price / 10000) Tercioo@2: return print ("|cFFFF9900Token Price|r: ", GoldPriceFrame:comma_value (price) .. "|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t") Tercioo@2: end Tercio@0: end Tercioo@2: Tercioo@2: GoldPriceFrame.canShow = true Tercio@0: GoldPriceFrame.LastQuerry = GetTime() Tercio@0: C_WowTokenPublic.UpdateMarketPrice() Tercioo@2: end