some persistence updates
This commit is contained in:
+8
-1
@@ -29,6 +29,13 @@ function private.load_dataset()
|
||||
return aux_database[dataset_key]
|
||||
end
|
||||
|
||||
function load_snapshot()
|
||||
local dataset = load_dataset()
|
||||
local snapshot = Aux.util.set()
|
||||
snapshot.set_data(dataset.snapshot)
|
||||
return snapshot
|
||||
end
|
||||
|
||||
function public.load_scan_records(item_key)
|
||||
local dataset = private.load_dataset()
|
||||
|
||||
@@ -76,4 +83,4 @@ function private.deserialize(data_string, separator)
|
||||
return data
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
local version_outdated, on_load, load_snapshot, save_snapshot, load_history, save_history
|
||||
|
||||
aux_store = {}
|
||||
|
||||
function on_load()
|
||||
perform_migration(aux_store)
|
||||
aux_store.version = Aux.core.version
|
||||
end
|
||||
|
||||
function get_auction_house_id()
|
||||
local realm = GetCVar('realmName')
|
||||
local zone = GetMinimapZoneText()
|
||||
local faction
|
||||
if zone == 'Gadgetzan' or zone == 'Everlook' or zone == 'Booty Bay' then
|
||||
faction = 'Neutral'
|
||||
else
|
||||
faction = UnitFactionGroup('player')
|
||||
end
|
||||
return realm..'|'..faction
|
||||
end
|
||||
|
||||
function load_history()
|
||||
local auction_house_id = get_auction_house_id()
|
||||
aux_store.datasets[auction_house_id] = aux_store.datasets[auction_house_id] or {}
|
||||
return aux_store.datasets[auction_house_id]
|
||||
end
|
||||
|
||||
function save_history(history)
|
||||
local auction_house_id = get_auction_house_id()
|
||||
aux_store.datasets[auction_house_id] = aux_store.datasets[auction_house_id] or {}
|
||||
return aux_store.datasets[auction_house_id]
|
||||
end
|
||||
|
||||
function load_shapshot()
|
||||
local auction_house_id = get_auction_house_id()
|
||||
aux_store.datasets[auction_house_id] = aux_store.datasets[auction_house_id] or {}
|
||||
return aux_store.datasets[auction_house_id]
|
||||
end
|
||||
|
||||
function save_snapshot(snapshot)
|
||||
local auction_house_id = get_auction_house_id()
|
||||
aux_store.datasets[auction_house_id] = aux_store.datasets[auction_house_id] or {}
|
||||
return aux_store.datasets[auction_house_id]
|
||||
end
|
||||
|
||||
Aux.store = {
|
||||
load_history = load_history,
|
||||
update_history = save_history,
|
||||
load_snapshot = load_snapshot,
|
||||
update_snapshot = save_snapshot,
|
||||
}
|
||||
Reference in New Issue
Block a user