Mercurial > wow > prospect-me
comparison Modules/ProspectMe_Tooltip.lua @ 62:58d886030d65
Updated the tooltip to allow coloring and returning of negative amounts
| author | Vynn <mischivin@gmail.com> |
|---|---|
| date | Thu, 08 Dec 2016 23:02:01 -0500 |
| parents | 155fa49865f2 |
| children | dcb2ec933df7 |
comparison
equal
deleted
inserted
replaced
| 61:c3dc8c711bcf | 62:58d886030d65 |
|---|---|
| 8 local GSC_COPPER="ffc8602c" | 8 local GSC_COPPER="ffc8602c" |
| 9 | 9 |
| 10 local g, s, c | 10 local g, s, c |
| 11 local digits = 0 | 11 local digits = 0 |
| 12 local gsc | 12 local gsc |
| 13 local neg = false | |
| 14 | |
| 15 --if value is negative, record it and get the absolute value so log10 works | |
| 16 if value < 0 then | |
| 17 neg = true | |
| 18 value = math.abs(value) | |
| 19 end | |
| 20 | |
| 13 | 21 |
| 14 g = math.floor(value/10000) | 22 g = math.floor(value/10000) |
| 15 s = math.fmod(math.floor(value/100),100) | 23 s = math.fmod(math.floor(value/100),100) |
| 16 c = math.fmod(value,100) | 24 c = math.fmod(value,100) |
| 17 | 25 |
| 27 elseif ( digits < 9 ) then | 35 elseif ( digits < 9 ) then |
| 28 gsc = string.format("|c%s%5d|r", GSC_GOLD, g) | 36 gsc = string.format("|c%s%5d|r", GSC_GOLD, g) |
| 29 else | 37 else |
| 30 gsc = string.format("|c%s%2.1fk|r", GSC_GOLD, g/1000) | 38 gsc = string.format("|c%s%2.1fk|r", GSC_GOLD, g/1000) |
| 31 end | 39 end |
| 32 | 40 --if the original number was negative, add the symbol back in |
| 41 if neg then | |
| 42 gsc = "|cffff0000(|r" .. gsc .. "|cffff0000)|r" | |
| 43 end | |
| 33 return gsc | 44 return gsc |
| 34 end | 45 end |
| 35 | 46 |
| 36 ProspectMe.GetReturn = function (containerID) | 47 ProspectMe.GetReturn = function (containerID) |
| 37 local averageReturn = 0 | 48 local averageReturn = 0 |
