diff --git a/Aux-AddOn.toc b/Aux-AddOn.toc index ed994d4..d2d524c 100644 --- a/Aux-AddOn.toc +++ b/Aux-AddOn.toc @@ -1,7 +1,6 @@ ## Interface: 11200 ## Title: Aux ## Notes: A lightweight addon designed to help manage auctions -## Dependencies: EnhTooltip, Stubby ## SavedVariablesPerCharacter: aux_recently_searched, aux_view, AUX_SELL_SHORTCUT, AUX_BUY_SHORTCUT, AUX_OPEN_SELL, AUX_OPEN_BUY, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION ## SavedVariables: aux_database diff --git a/core.lua b/core.lua index 493969f..58e2885 100644 --- a/core.lua +++ b/core.lua @@ -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() diff --git a/slash.lua b/slash.lua index e5cd65f..8d97a97 100644 --- a/slash.lua +++ b/slash.lua @@ -8,5 +8,9 @@ function SlashCmdList.AUX(parameter) elseif parameter == 'clear database' then aux_database = {} Aux.log('Database cleared.') + elseif parameter == 'clear' then + aux_database = {} + Aux.persistence.load_dataset().snapshot = {} + Aux.log('Snapshot and database cleared.') end end \ No newline at end of file diff --git a/stat_histogram.lua b/stat_histogram.lua index 8a50c93..8e5837f 100644 --- a/stat_histogram.lua +++ b/stat_histogram.lua @@ -117,6 +117,7 @@ function public.process_auction(auction_info) end local index = ceil(buyout / private.current_record.step) + snipe.log(private.current_record.step..'X'..auction_info.item_id) if private.current_record.count <= 20 then @@ -203,7 +204,7 @@ function private.refactor(pmax, precision) private.current_record.min = new_min private.current_record.max = new_max - private.current_record.max = new_step + private.current_record.step = new_step private.current_record.count = new_count private.current_record.values = new_values end \ No newline at end of file