bugfix for median

This commit is contained in:
Manuel Simon Hirsig
2016-01-17 11:36:46 +01:00
parent 4ea7aaeb6f
commit 96b4e52eb0
4 changed files with 37 additions and 30 deletions
+31 -28
View File
@@ -30,38 +30,41 @@ function Aux_OnLoad()
Aux.log('Aux v'..AuxVersion..' loaded.')
Aux.loaded = true
tinsert(UISpecialFrames, 'AuxFrame')
Stubby.RegisterFunctionHook('EnhTooltip.AddTooltip', 100, function(_ ,_ ,_ ,_ , link, _, count)
local item_id, suffix_id = EnhTooltip.BreakLink(link)
local item_key = item_id..':'..suffix_id
LoadAddOn('EnhTooltip')
if IsAddOnLoaded('EnhTooltip') then
Stubby.RegisterFunctionHook('EnhTooltip.AddTooltip', 100, function(_ ,_ ,_ ,_ , link, _, count)
local item_id, suffix_id = EnhTooltip.BreakLink(link)
local item_key = item_id..':'..suffix_id
local auction_count, seen_days, daily_average, EMA3, EMA7, EMA14 = Aux.stat_average.get_price_data(item_key)
local auction_count, seen_days, daily_average, EMA3, EMA7, EMA14 = Aux.stat_average.get_price_data(item_key)
if auction_count == 0 then
EnhTooltip.AddLine('Never seen at auction', nil, true)
EnhTooltip.LineColor(0.5, 0.8, 0.5)
else
EnhTooltip.AddLine('Seen '..auction_count..' '..Aux_PluralizeIf('time', auction_count)..' at auction', nil, true)
EnhTooltip.LineColor(0.5, 0.8, 0.1)
local median = Aux.stat_histogram.get_price_data(item_key)
if count == 1 then
EnhTooltip.AddLine('Median: '..Aux.util.money_string(median), nil, true)
if auction_count == 0 then
EnhTooltip.AddLine('Never seen at auction', nil, true)
EnhTooltip.LineColor(0.5, 0.8, 0.5)
else
EnhTooltip.AddLine('Median: '..Aux.util.money_string(median * count)..' ('..Aux.util.money_string(median)..' ea.)', nil, true)
end
EnhTooltip.LineColor(0.1,0.8,0.5)
EnhTooltip.AddLine('Seen '..auction_count..' '..Aux_PluralizeIf('time', auction_count)..' at auction', nil, true)
EnhTooltip.LineColor(0.5, 0.8, 0.1)
-- EnhTooltip.AddLine('AVG TDA: '..(daily_average > 0 and Aux.util.money_string(daily_average) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
-- EnhTooltip.LineColor(0.1,0.8,0.5)
-- EnhTooltip.AddLine('EMA3: '..(EMA3 > 0 and Aux.util.money_string(EMA3) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
-- EnhTooltip.LineColor(0.1,0.8,0.5)
-- EnhTooltip.AddLine('EMA7: '..(EMA7 > 0 and Aux.util.money_string(EMA7) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
-- EnhTooltip.LineColor(0.1,0.8,0.5)
-- EnhTooltip.AddLine('EMA14: '..(EMA14 > 0 and Aux.util.money_string(EMA14) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
-- EnhTooltip.LineColor(0.1,0.8,0.5)
end
end)
local median = Aux.stat_histogram.get_price_data(item_key)
if count == 1 then
EnhTooltip.AddLine('Median: '..Aux.util.money_string(median), nil, true)
else
EnhTooltip.AddLine('Median: '..Aux.util.money_string(median * count)..' ('..Aux.util.money_string(median)..' ea.)', nil, true)
end
EnhTooltip.LineColor(0.1,0.8,0.5)
-- EnhTooltip.AddLine('AVG TDA: '..(daily_average > 0 and Aux.util.money_string(daily_average) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
-- EnhTooltip.LineColor(0.1,0.8,0.5)
-- EnhTooltip.AddLine('EMA3: '..(EMA3 > 0 and Aux.util.money_string(EMA3) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
-- EnhTooltip.LineColor(0.1,0.8,0.5)
-- EnhTooltip.AddLine('EMA7: '..(EMA7 > 0 and Aux.util.money_string(EMA7) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
-- EnhTooltip.LineColor(0.1,0.8,0.5)
-- EnhTooltip.AddLine('EMA14: '..(EMA14 > 0 and Aux.util.money_string(EMA14) or RED_FONT_COLOR_CODE..'n/a'..FONT_COLOR_CODE_CLOSE), nil, true)
-- EnhTooltip.LineColor(0.1,0.8,0.5)
end
end)
end
end
function Aux_OnEvent()