From 3205762d0e0cde83dca577267058b14d6e9a502a Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Mon, 28 Sep 2015 00:15:42 +0200 Subject: [PATCH] better reporting --- buy.lua | 18 ++++++++---------- sell.lua | 13 +++++++++---- util.lua | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/buy.lua b/buy.lua index f5f4ab1..141e71b 100644 --- a/buy.lua +++ b/buy.lua @@ -274,26 +274,24 @@ function Aux_Buy_ScrollbarUpdate() [[ -

Aux Buy Report


-

Exit status: %s


-

- %i out of %i ordered auctions for %s purchased -

+

Aux Buy Report%s

+

+ %i out of %i ordered auctions of %s purchased +

Total units purchased: %i -

-

- Total expense: %i +
+ Total expense: %s

]], - completed and 'Completed' or 'Aborted', + completed and '' or ' (Aborted)', progress.auctions, ordered_count, item_name, progress.units, - progress.expense + Aux.util.format_money(progress.expense) )) AuxBuyReportHTML:SetSpacing(3) diff --git a/sell.lua b/sell.lua index e75709b..8150b7d 100644 --- a/sell.lua +++ b/sell.lua @@ -516,17 +516,22 @@ function report(item_name, stack_size, buyout_price, posted) [[ -

Aux Sell Report


+

Aux Sell Report

+

- %i %i-stacks of %s posted for %i each + %i auctions of %s posted +

+ Stack size: %i +
+ Stack price: %s

]], posted, - stack_size, item_name, - buyout_price + stack_size, + Aux.util.format_money(buyout_price) )) AuxBuyReportHTML:SetSpacing(3) diff --git a/util.lua b/util.lua index d97ba45..1389e5d 100644 --- a/util.lua +++ b/util.lua @@ -20,4 +20,23 @@ function Aux.util.item_name_autocomplete() return end end +end + +function Aux.util.format_money(val) + + local g = math.floor(val / 10000) + + val = val - g * 10000 + + local s = math.floor(val / 100) + + val = val - s * 100 + + local c = math.floor(val) + + local g_string = g ~= 0 and g .. 'g' or '' + local s_string = s ~= 0 and s .. 's' or '' + local c_string = (c ~= 0 or g == 0 and s == 0) and c .. 'c' or '' + + return g_string .. s_string .. c_string end \ No newline at end of file