diff --git a/persistence.lua b/persistence.lua index 84fbb5e..e7bfec5 100644 --- a/persistence.lua +++ b/persistence.lua @@ -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 \ No newline at end of file +end diff --git a/store.lua b/store.lua deleted file mode 100644 index 0c39447..0000000 --- a/store.lua +++ /dev/null @@ -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, -}