From 32186f9fbc1fb9c257b336c7eed195bd83ef9bf3 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Mon, 18 Jan 2016 04:36:26 +0100 Subject: [PATCH] hist price bugfix --- core.lua | 2 +- stat_histogram.lua | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/core.lua b/core.lua index fe306d5..de7fcb1 100644 --- a/core.lua +++ b/core.lua @@ -1,4 +1,4 @@ -AuxVersion = '2.2.4' +AuxVersion = '2.2.5' AuxAuthors = 'shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)' local lastRightClickAction = GetTime() diff --git a/stat_histogram.lua b/stat_histogram.lua index f5a58fb..ff551fa 100644 --- a/stat_histogram.lua +++ b/stat_histogram.lua @@ -87,18 +87,6 @@ function public.get_price_data(item_key) end end - if private.current_record.count > 20 then - if private.current_record.step > median / 85 and private.current_record.step > 1 then - private.refactor(median * 3, 300) - private.write_current_record() - return public.get_price_data(item_key) - elseif private.current_record.step < median / 115 then - private.refactor(median * 3, 300) - private.write_current_record() - return public.get_price_data(item_key) - end - end - return median, Q1, Q3, percent30, percent40, private.current_record.count, private.current_record.step end @@ -144,6 +132,14 @@ function public.process_auction(auction_info) private.current_record.values[index] = private.current_record.values[index] + 1 private.current_record.count = private.current_record.count + 1 + local median = public.get_price_data(auction_info.item_key) + + local step_too_small = private.current_record.step < median / 115 + local step_too_large = private.current_record.step > median / 85 and private.current_record.step > 1 + if private.current_record.count > 20 and (step_too_small or step_too_large) then + private.refactor(median, 100) + end + private.write_current_record() end end