# HG changeset patch # User Vynn # Date 1481256121 18000 # Node ID 58d886030d654cba1b9a727a4def7f71cd30623d # Parent c3dc8c711bcfbea2249e002fa0bc1526729c7def Updated the tooltip to allow coloring and returning of negative amounts diff -r c3dc8c711bcf -r 58d886030d65 Modules/ProspectMe_Tooltip.lua --- a/Modules/ProspectMe_Tooltip.lua Mon Nov 28 12:30:51 2016 -0500 +++ b/Modules/ProspectMe_Tooltip.lua Thu Dec 08 23:02:01 2016 -0500 @@ -10,6 +10,14 @@ local g, s, c local digits = 0 local gsc + local neg = false + + --if value is negative, record it and get the absolute value so log10 works + if value < 0 then + neg = true + value = math.abs(value) + end + g = math.floor(value/10000) s = math.fmod(math.floor(value/100),100) @@ -29,7 +37,10 @@ else gsc = string.format("|c%s%2.1fk|r", GSC_GOLD, g/1000) end - + --if the original number was negative, add the symbol back in + if neg then + gsc = "|cffff0000(|r" .. gsc .. "|cffff0000)|r" + end return gsc end