refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-09 10:46:43 +02:00
parent ebd09e051e
commit 44d0b46aa8
6 changed files with 147 additions and 145 deletions
+10 -15
View File
@@ -10,6 +10,7 @@ public.COLORS = {
YELLOW = '|cffffff00',
ORANGE = '|cffff9218',
RED = '|cffff0000',
GRAY = '|cffbbbbbb',
}
local AUCTION_PCT_COLORS = {
@@ -535,25 +536,19 @@ function private.record_percentage(record)
end
end
function public.percentage_historical(pct, based_on_bid)
local pctColor = '|cffffffff'
if based_on_bid then
pctColor = '|cffbbbbbb'
else
for i=1, getn(AUCTION_PCT_COLORS) do
if pct < AUCTION_PCT_COLORS[i].value then
pctColor = AUCTION_PCT_COLORS[i].color
break
end
end
end
function private.percentage_color(pct)
for i=1,getn(AUCTION_PCT_COLORS) do
if pct < AUCTION_PCT_COLORS[i].value then
return AUCTION_PCT_COLORS[i].color
end
end
end
function public.percentage_historical(pct, bid)
if pct > 10000 then
pct = '>10000'
end
return format('%s%s%%|r', pctColor, pct)
return (bid and m.COLORS.GRAY or m.percentage_color(pct))..pct..'%'..FONT_COLOR_CODE_CLOSE
end
function public.time_left(code)