very basic history implemented
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
## 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
|
||||
|
||||
slash.lua
|
||||
core.xml
|
||||
control.xml
|
||||
persistence.lua
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AuxVersion = '2.1.8'
|
||||
AuxVersion = '2.2.0'
|
||||
AuxAuthors = 'shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)'
|
||||
|
||||
local lastRightClickAction = GetTime()
|
||||
@@ -40,7 +40,7 @@ function Aux_OnLoad()
|
||||
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 total', nil, true)
|
||||
EnhTooltip.AddLine('Seen '..auction_count..' '..Aux_PluralizeIf('time', auction_count)..' at auction', nil, true)
|
||||
EnhTooltip.LineColor(0.5, 0.8, 0.1)
|
||||
|
||||
local unit_value = Aux.stat_average.get_mean(item_key)
|
||||
|
||||
@@ -145,7 +145,13 @@ function scan_auctions_helper(i, n, k)
|
||||
|
||||
local auction_info = Aux.info.auction(i, state.job.type)
|
||||
if auction_info then
|
||||
wait_for_callback{state.job.on_read_auction, auction_info, recurse}
|
||||
wait_for_callback{state.job.on_read_auction, auction_info, recurse }
|
||||
|
||||
local snapshot = Aux.persistence.load_snapshot()
|
||||
if not snapshot.contains(auction_info.signature) then
|
||||
snapshot.add(auction_info.signature)
|
||||
Aux.stat_average.process_auction(auction_info)
|
||||
end
|
||||
else
|
||||
recurse()
|
||||
end
|
||||
|
||||
+8
-15
@@ -15,8 +15,8 @@ function public.start_scan()
|
||||
-- return
|
||||
-- end
|
||||
|
||||
AuxHistoryScanButton:Hide()
|
||||
AuxHistoryStopButton:Show()
|
||||
-- AuxHistoryScanButton:Hide()
|
||||
-- AuxHistoryStopButton:Show()
|
||||
|
||||
private.scanned_signatures = Aux.util.set()
|
||||
|
||||
@@ -32,15 +32,15 @@ function public.start_scan()
|
||||
end,
|
||||
on_complete = function()
|
||||
private.update_snapshot()
|
||||
|
||||
AuxHistoryStopButton:Hide()
|
||||
AuxHistoryScanButton:Show()
|
||||
Aux.log('Scan complete: Old auctions were removed from the snapshot.')
|
||||
-- AuxHistoryStopButton:Hide()
|
||||
-- AuxHistoryScanButton:Show()
|
||||
end,
|
||||
on_abort = function()
|
||||
private.update_snapshot()
|
||||
|
||||
AuxHistoryStopButton:Hide()
|
||||
AuxHistoryScanButton:Show()
|
||||
Aux.log('Scanning aborted.')
|
||||
-- AuxHistoryStopButton:Hide()
|
||||
-- AuxHistoryScanButton:Show()
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
local last_page = max(total_pages - 1, 0)
|
||||
@@ -66,11 +66,4 @@ end
|
||||
|
||||
function private.process_auction(auction_info)
|
||||
private.scanned_signatures.add(auction_info.signature)
|
||||
|
||||
local snapshot = Aux.persistence.load_snapshot()
|
||||
|
||||
if not snapshot.contains(auction_info.signature) then
|
||||
snapshot.add(auction_info.signature)
|
||||
Aux.stat_average.process_auction(auction_info)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
SLASH_AUX1 = '/aux'
|
||||
function SlashCmdList.AUX(parameter)
|
||||
if parameter == 'scan' then
|
||||
Aux.history_frame.start_scan()
|
||||
elseif parameter == 'clear snapshot' then
|
||||
Aux.persistence.load_dataset().snapshot = {}
|
||||
Aux.log('Snapshot cleared.')
|
||||
elseif parameter == 'clear database' then
|
||||
aux_database = {}
|
||||
Aux.log('Database cleared.')
|
||||
end
|
||||
end
|
||||
+3
-2
@@ -2,7 +2,7 @@ local private, public = {}, {}
|
||||
Aux.stat_average = public
|
||||
|
||||
private.PUSH_INTERVAL = 57600
|
||||
private.NEW_RECORD = '0:0:0:0:0:0:0:0:0:0:0'
|
||||
private.NEW_RECORD = '0:0:0:0:0:0:0:0:0:0'
|
||||
|
||||
function private.load_data()
|
||||
local dataset = Aux.persistence.load_dataset()
|
||||
@@ -125,8 +125,9 @@ end
|
||||
|
||||
function private.push_data()
|
||||
local data = private.load_data()
|
||||
local item_data = data.item_data
|
||||
|
||||
for item_key, _ in pairs(data) do
|
||||
for item_key, _ in pairs(item_data) do
|
||||
|
||||
local item_record = public.read_record(item_key)
|
||||
local _, daily_auction_count, daily_unit_count, daily_accumulated_buyout, daily_min_buyout, seen_days, EMA3, EMA7, EMA14, average_min_buyout = unpack(item_record)
|
||||
|
||||
Reference in New Issue
Block a user