savedvariables refactoring
This commit is contained in:
+4
-27
@@ -12,7 +12,6 @@ local scan = require 'aux.core.scan'
|
|||||||
local search_tab = require 'aux.tabs.search'
|
local search_tab = require 'aux.tabs.search'
|
||||||
|
|
||||||
_G.aux_scale = 1
|
_G.aux_scale = 1
|
||||||
_G.aux_characters = {}
|
|
||||||
|
|
||||||
function M.set_p(v)
|
function M.set_p(v)
|
||||||
inspect(nil, v)
|
inspect(nil, v)
|
||||||
@@ -163,31 +162,10 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.is_player(name)
|
|
||||||
local key = GetCVar'realmName'
|
|
||||||
return name and index(aux_characters, key, name) and true or false
|
|
||||||
end
|
|
||||||
|
|
||||||
function LOAD2()
|
function LOAD2()
|
||||||
local key = GetCVar'realmName'
|
|
||||||
aux_characters[key] = aux_characters[key] or {}
|
|
||||||
for char, lastSeen in aux_characters[key] do
|
|
||||||
if GetTime() - lastSeen > 60 * 60 * 24 * 30 then
|
|
||||||
aux_characters[key][char] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
aux_characters[key][UnitName'player'] = GetTime()
|
|
||||||
AuxFrame:SetScale(aux_scale)
|
AuxFrame:SetScale(aux_scale)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.neutral_faction()
|
|
||||||
return not UnitFactionGroup'npc'
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.min_bid_increment(current_bid)
|
|
||||||
return max(1, floor(current_bid / 100) * 5)
|
|
||||||
end
|
|
||||||
|
|
||||||
function AUCTION_HOUSE_SHOW()
|
function AUCTION_HOUSE_SHOW()
|
||||||
AuctionFrame:Hide()
|
AuctionFrame:Hide()
|
||||||
AuxFrame:Show()
|
AuxFrame:Show()
|
||||||
@@ -210,11 +188,10 @@ end
|
|||||||
|
|
||||||
do
|
do
|
||||||
local last_owner_page_requested
|
local last_owner_page_requested
|
||||||
function GetOwnerAuctionItems(...)
|
function GetOwnerAuctionItems(index)
|
||||||
temp(arg)
|
local page = index
|
||||||
local page = arg[1]
|
last_owner_page_requested = index
|
||||||
last_owner_page_requested = page
|
return orig.GetOwnerAuctionItems(index)
|
||||||
return orig.GetOwnerAuctionItems(unpack(arg))
|
|
||||||
end
|
end
|
||||||
function AUCTION_OWNED_LIST_UPDATE()
|
function AUCTION_OWNED_LIST_UPDATE()
|
||||||
current_owner_page = last_owner_page_requested or 0
|
current_owner_page = last_owner_page_requested or 0
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
## Title: aux
|
## Title: aux
|
||||||
## Notes: Auction House replacement
|
## Notes: Auction House replacement
|
||||||
## SavedVariablesPerCharacter: aux_tooltip_value, aux_tooltip_daily, aux_tooltip_merchant_buy, aux_tooltip_merchant_sell, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution
|
## SavedVariablesPerCharacter: aux_tooltip_value, aux_tooltip_daily, aux_tooltip_merchant_buy, aux_tooltip_merchant_sell, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution
|
||||||
## SavedVariables: aux_scale, aux_datasets, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell, aux_characters, aux_recent_searches, aux_favorite_searches, aux_post_bid, aux_ignore_owner
|
## SavedVariables: aux, aux_scale, aux_post_bid, aux_ignore_owner, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell
|
||||||
|
|
||||||
libs\inspect.lua
|
libs\inspect.lua
|
||||||
libs\module.lua
|
libs\module.lua
|
||||||
|
|||||||
@@ -39,6 +39,22 @@ function LOAD()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do
|
||||||
|
local characters = empty
|
||||||
|
function M.is_player(name)
|
||||||
|
return characters[name] and true or false
|
||||||
|
end
|
||||||
|
function LOAD2()
|
||||||
|
characters = persistence.realm'characters'
|
||||||
|
for k, v in characters do
|
||||||
|
if GetTime() > v + 60 * 60 * 24 * 30 then
|
||||||
|
characters[k] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
characters[UnitName'player'] = GetTime()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local sell_scan_queued, incomplete_buy_data
|
local sell_scan_queued, incomplete_buy_data
|
||||||
function on_merchant_show()
|
function on_merchant_show()
|
||||||
|
|||||||
+2
-10
@@ -9,16 +9,8 @@ local history_schema = {'tuple', '#', {next_push='number'}, {daily_min_buyout='n
|
|||||||
|
|
||||||
local value_cache = {}
|
local value_cache = {}
|
||||||
|
|
||||||
do
|
function LOAD2()
|
||||||
local cache
|
data = persistence.faction'history'
|
||||||
function get_data()
|
|
||||||
if not cache then
|
|
||||||
local dataset = persistence.dataset
|
|
||||||
cache = dataset.history or T
|
|
||||||
dataset.history = cache
|
|
||||||
end
|
|
||||||
return cache
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ local history = require 'aux.core.history'
|
|||||||
local gui = require 'aux.gui'
|
local gui = require 'aux.gui'
|
||||||
local search_tab = require 'aux.tabs.search'
|
local search_tab = require 'aux.tabs.search'
|
||||||
local tooltip = require 'aux.core.tooltip'
|
local tooltip = require 'aux.core.tooltip'
|
||||||
|
local cache = require 'aux.core.cache'
|
||||||
|
|
||||||
local price_per_unit = false
|
local price_per_unit = false
|
||||||
|
|
||||||
@@ -139,7 +140,7 @@ M.search_columns = {
|
|||||||
width = .13,
|
width = .13,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell.text:SetText(is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '?'))
|
cell.text:SetText(cache.is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '?'))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
if not record_a.owner and not record_b.owner then
|
if not record_a.owner and not record_b.owner then
|
||||||
@@ -428,7 +429,7 @@ M.bids_columns = {
|
|||||||
width = .13,
|
width = .13,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell.text:SetText(is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '?'))
|
cell.text:SetText(cache.is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '?'))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
if not record_a.owner and not record_b.owner then
|
if not record_a.owner and not record_b.owner then
|
||||||
@@ -693,7 +694,7 @@ local methods = {
|
|||||||
local totalAuctions, totalPlayerAuctions = 0, 0
|
local totalAuctions, totalPlayerAuctions = 0, 0
|
||||||
for _, childInfo in info.children do
|
for _, childInfo in info.children do
|
||||||
totalAuctions = totalAuctions + childInfo.count
|
totalAuctions = totalAuctions + childInfo.count
|
||||||
if is_player(childInfo.record.owner) then
|
if cache.is_player(childInfo.record.owner) then
|
||||||
totalPlayerAuctions = totalPlayerAuctions + childInfo.count
|
totalPlayerAuctions = totalPlayerAuctions + childInfo.count
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+8
-15
@@ -11,6 +11,7 @@ local scan_util = require 'aux.util.scan'
|
|||||||
local post = require 'aux.core.post'
|
local post = require 'aux.core.post'
|
||||||
local scan = require 'aux.core.scan'
|
local scan = require 'aux.core.scan'
|
||||||
local history = require 'aux.core.history'
|
local history = require 'aux.core.history'
|
||||||
|
local cache = require 'aux.core.cache'
|
||||||
local item_listing = require 'aux.gui.item_listing'
|
local item_listing = require 'aux.gui.item_listing'
|
||||||
local al = require 'aux.gui.auction_listing'
|
local al = require 'aux.gui.auction_listing'
|
||||||
|
|
||||||
@@ -25,16 +26,8 @@ function get_default_settings()
|
|||||||
return O('duration', DURATION_8, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
return O('duration', DURATION_8, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
||||||
end
|
end
|
||||||
|
|
||||||
do
|
function LOAD2()
|
||||||
local data
|
data = persistence.faction'post'
|
||||||
function get_data()
|
|
||||||
if not data then
|
|
||||||
local dataset = persistence.dataset
|
|
||||||
data = dataset.post or T
|
|
||||||
dataset.post = data
|
|
||||||
end
|
|
||||||
return data
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function read_settings(item_key)
|
function read_settings(item_key)
|
||||||
@@ -333,7 +326,7 @@ function update_item_configuration()
|
|||||||
stack_count_slider.editbox:SetNumber(stack_count_slider:GetValue())
|
stack_count_slider.editbox:SetNumber(stack_count_slider:GetValue())
|
||||||
|
|
||||||
do
|
do
|
||||||
local deposit_factor = neutral_faction() and .25 or .05
|
local deposit_factor = UnitFactionGroup'npc' and .25 or .05
|
||||||
local stack_size, stack_count = stack_size_slider:GetValue(), stack_count_slider:GetValue()
|
local stack_size, stack_count = stack_size_slider:GetValue(), stack_count_slider:GetValue()
|
||||||
local amount = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120
|
local amount = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120
|
||||||
deposit:SetText('Deposit: ' .. money.to_string(amount, nil, nil, nil, color.text.enabled))
|
deposit:SetText('Deposit: ' .. money.to_string(amount, nil, nil, nil, color.text.enabled))
|
||||||
@@ -518,12 +511,12 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
|
|||||||
do
|
do
|
||||||
local entry
|
local entry
|
||||||
for _, record in bid_records[key] do
|
for _, record in bid_records[key] do
|
||||||
if unit_blizzard_bid == record.unit_price and aux_quantity == record.stack_size and duration == record.duration and is_player(owner) == record.own then
|
if unit_blizzard_bid == record.unit_price and aux_quantity == record.stack_size and duration == record.duration and cache.is_player(owner) == record.own then
|
||||||
entry = record
|
entry = record
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not entry then
|
if not entry then
|
||||||
entry = O('stack_size', aux_quantity, 'unit_price', unit_blizzard_bid, 'duration', duration, 'own', is_player(owner), 'count', 0)
|
entry = O('stack_size', aux_quantity, 'unit_price', unit_blizzard_bid, 'duration', duration, 'own', cache.is_player(owner), 'count', 0)
|
||||||
tinsert(bid_records[key], entry)
|
tinsert(bid_records[key], entry)
|
||||||
end
|
end
|
||||||
entry.count = entry.count + 1
|
entry.count = entry.count + 1
|
||||||
@@ -533,12 +526,12 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
|
|||||||
do
|
do
|
||||||
local entry
|
local entry
|
||||||
for _, record in buyout_records[key] do
|
for _, record in buyout_records[key] do
|
||||||
if unit_buyout_price == record.unit_price and aux_quantity == record.stack_size and duration == record.duration and is_player(owner) == record.own then
|
if unit_buyout_price == record.unit_price and aux_quantity == record.stack_size and duration == record.duration and cache.is_player(owner) == record.own then
|
||||||
entry = record
|
entry = record
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not entry then
|
if not entry then
|
||||||
entry = O('stack_size', aux_quantity, 'unit_price', unit_buyout_price, 'duration', duration, 'own', is_player(owner), 'count', 0)
|
entry = O('stack_size', aux_quantity, 'unit_price', unit_buyout_price, 'duration', duration, 'own', cache.is_player(owner), 'count', 0)
|
||||||
tinsert(buyout_records[key], entry)
|
tinsert(buyout_records[key], entry)
|
||||||
end
|
end
|
||||||
entry.count = entry.count + 1
|
entry.count = entry.count + 1
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ local info = require 'aux.util.info'
|
|||||||
local filter_util = require 'aux.util.filter'
|
local filter_util = require 'aux.util.filter'
|
||||||
local scan_util = require 'aux.util.scan'
|
local scan_util = require 'aux.util.scan'
|
||||||
local scan = require 'aux.core.scan'
|
local scan = require 'aux.core.scan'
|
||||||
|
local cache = require 'aux.core.cache'
|
||||||
|
|
||||||
function LOAD()
|
function LOAD()
|
||||||
new_search()
|
new_search()
|
||||||
@@ -368,7 +369,7 @@ do
|
|||||||
function find_auction(record)
|
function find_auction(record)
|
||||||
local search = current_search
|
local search = current_search
|
||||||
|
|
||||||
if not search.table:ContainsRecord(record) or is_player(record.owner) then
|
if not search.table:ContainsRecord(record) or cache.is_player(record.owner) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+17
-15
@@ -2,14 +2,16 @@ module 'aux.tabs.search'
|
|||||||
|
|
||||||
local filter_util = require 'aux.util.filter'
|
local filter_util = require 'aux.util.filter'
|
||||||
local gui = require 'aux.gui'
|
local gui = require 'aux.gui'
|
||||||
|
local persistence = require 'aux.util.persistence'
|
||||||
|
|
||||||
_G.aux_favorite_searches = {}
|
function LOAD2()
|
||||||
_G.aux_recent_searches = {}
|
recent_searches, favorite_searches = persistence.realm'recent_searches', persistence.realm'favorite_searches'
|
||||||
|
end
|
||||||
|
|
||||||
function update_search_listings()
|
function update_search_listings()
|
||||||
local favorite_search_rows = T
|
local favorite_search_rows = T
|
||||||
for i = 1, getn(aux_favorite_searches) do
|
for i = 1, getn(favorite_searches) do
|
||||||
local search = aux_favorite_searches[i]
|
local search = favorite_searches[i]
|
||||||
local name = strsub(search.prettified, 1, 250)
|
local name = strsub(search.prettified, 1, 250)
|
||||||
tinsert(favorite_search_rows, O(
|
tinsert(favorite_search_rows, O(
|
||||||
'cols', A(O('value', search.auto_buy and color.red'X' or ''), O('value', name)),
|
'cols', A(O('value', search.auto_buy and color.red'X' or ''), O('value', name)),
|
||||||
@@ -20,8 +22,8 @@ function update_search_listings()
|
|||||||
favorite_searches_listing:SetData(favorite_search_rows)
|
favorite_searches_listing:SetData(favorite_search_rows)
|
||||||
|
|
||||||
local recent_search_rows = T
|
local recent_search_rows = T
|
||||||
for i = 1, getn(aux_recent_searches) do
|
for i = 1, getn(recent_searches) do
|
||||||
local search = aux_recent_searches[i]
|
local search = recent_searches[i]
|
||||||
local name = strsub(search.prettified, 1, 250)
|
local name = strsub(search.prettified, 1, 250)
|
||||||
tinsert(recent_search_rows, O(
|
tinsert(recent_search_rows, O(
|
||||||
'cols', A(O('value', name)),
|
'cols', A(O('value', name)),
|
||||||
@@ -33,12 +35,12 @@ function update_search_listings()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function new_recent_search(filter_string, prettified)
|
function new_recent_search(filter_string, prettified)
|
||||||
tinsert(aux_recent_searches, 1, O(
|
tinsert(recent_searches, 1, O(
|
||||||
'filter_string', filter_string,
|
'filter_string', filter_string,
|
||||||
'prettified', prettified
|
'prettified', prettified
|
||||||
))
|
))
|
||||||
while getn(aux_recent_searches) > 50 do
|
while getn(recent_searches) > 50 do
|
||||||
tremove(aux_recent_searches)
|
tremove(recent_searches)
|
||||||
end
|
end
|
||||||
update_search_listings()
|
update_search_listings()
|
||||||
end
|
end
|
||||||
@@ -56,15 +58,15 @@ handlers = {
|
|||||||
elseif button == 'RightButton' then
|
elseif button == 'RightButton' then
|
||||||
local u = update_search_listings
|
local u = update_search_listings
|
||||||
if st == recent_searches_listing then
|
if st == recent_searches_listing then
|
||||||
tinsert(aux_favorite_searches, 1, data.search)
|
tinsert(favorite_searches, 1, data.search)
|
||||||
u(d)
|
u(d)
|
||||||
elseif st == favorite_searches_listing then
|
elseif st == favorite_searches_listing then
|
||||||
local auto_buy = data.search.auto_buy
|
local auto_buy = data.search.auto_buy
|
||||||
gui.menu(
|
gui.menu(
|
||||||
(auto_buy and 'Disable' or 'Enable') .. ' Auto Buy', function() if auto_buy then data.search.auto_buy = nil else enable_auto_buy(data.search) end u() end,
|
(auto_buy and 'Disable' or 'Enable') .. ' Auto Buy', function() if auto_buy then data.search.auto_buy = nil else enable_auto_buy(data.search) end u() end,
|
||||||
'Move Up', function() move_up(aux_favorite_searches, data.index); u() end,
|
'Move Up', function() move_up(favorite_searches, data.index); u() end,
|
||||||
'Move Down', function() move_down(aux_favorite_searches, data.index); u() end,
|
'Move Down', function() move_down(favorite_searches, data.index); u() end,
|
||||||
'Delete', function() tremove(aux_favorite_searches, data.index); u() end
|
'Delete', function() tremove(favorite_searches, data.index); u() end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -83,7 +85,7 @@ handlers = {
|
|||||||
|
|
||||||
function get_auto_buy_validator()
|
function get_auto_buy_validator()
|
||||||
local validators = T
|
local validators = T
|
||||||
for _, search in aux_favorite_searches do
|
for _, search in favorite_searches do
|
||||||
if search.auto_buy then
|
if search.auto_buy then
|
||||||
local queries, error = filter_util.queries(search.filter_string)
|
local queries, error = filter_util.queries(search.filter_string)
|
||||||
if queries then
|
if queries then
|
||||||
@@ -101,7 +103,7 @@ end
|
|||||||
function add_favorite(filter_string)
|
function add_favorite(filter_string)
|
||||||
local queries, error = filter_util.queries(filter_string)
|
local queries, error = filter_util.queries(filter_string)
|
||||||
if queries then
|
if queries then
|
||||||
tinsert(aux_favorite_searches, 1, O(
|
tinsert(favorite_searches, 1, O(
|
||||||
'filter_string', filter_string,
|
'filter_string', filter_string,
|
||||||
'prettified', join(map(queries, function(query) return query.prettified end), ';')
|
'prettified', join(map(queries, function(query) return query.prettified end), ';')
|
||||||
))
|
))
|
||||||
|
|||||||
+4
-4
@@ -126,8 +126,8 @@ function M.auction(index, query_type)
|
|||||||
'link', link,
|
'link', link,
|
||||||
'itemstring', item_info.itemstring,
|
'itemstring', item_info.itemstring,
|
||||||
'item_key', item_id .. ':' .. suffix_id,
|
'item_key', item_id .. ':' .. suffix_id,
|
||||||
'search_signature', join(temp-A(item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
'search_signature', join(temp-A(item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), aux_ignore_owner and (cache.is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
||||||
'sniping_signature', join(temp-A(item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
'sniping_signature', join(temp-A(item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (cache.is_player(owner) and 0 or 1) or (owner or '?')), ':'),
|
||||||
|
|
||||||
'name', name,
|
'name', name,
|
||||||
'texture', texture,
|
'texture', texture,
|
||||||
@@ -166,12 +166,12 @@ end
|
|||||||
function M.bid_update(auction_record)
|
function M.bid_update(auction_record)
|
||||||
auction_record.high_bid = auction_record.bid_price
|
auction_record.high_bid = auction_record.bid_price
|
||||||
auction_record.blizzard_bid = auction_record.bid_price
|
auction_record.blizzard_bid = auction_record.bid_price
|
||||||
auction_record.min_increment = min_bid_increment(auction_record.bid_price)
|
auction_record.min_increment = max(1, floor(auction_record.bid_price / 100) * 5)
|
||||||
auction_record.bid_price = auction_record.bid_price + auction_record.min_increment
|
auction_record.bid_price = auction_record.bid_price + auction_record.min_increment
|
||||||
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
|
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
|
||||||
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
|
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
|
||||||
auction_record.high_bidder = 1
|
auction_record.high_bidder = 1
|
||||||
auction_record.search_signature = join(temp-A(auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')), ':')
|
auction_record.search_signature = join(temp-A(auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (cache.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')), ':')
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.set_tooltip(itemstring, owner, anchor)
|
function M.set_tooltip(itemstring, owner, anchor)
|
||||||
|
|||||||
+31
-10
@@ -3,17 +3,38 @@ module 'aux.util.persistence'
|
|||||||
include 'T'
|
include 'T'
|
||||||
include 'aux'
|
include 'aux'
|
||||||
|
|
||||||
_G.aux_datasets = {}
|
_G.aux = {
|
||||||
|
player = {},
|
||||||
|
faction = {},
|
||||||
|
realm = {},
|
||||||
|
account = {},
|
||||||
|
}
|
||||||
|
|
||||||
do
|
local cache = {account=aux.account}
|
||||||
local dataset
|
|
||||||
function M.get_dataset()
|
function LOAD2()
|
||||||
if not dataset then
|
do
|
||||||
local dataset_key = format('%s|%s', GetCVar'realmName', UnitFactionGroup'player')
|
local key = format('%s|%s', GetCVar'realmName', UnitName'player')
|
||||||
dataset = aux_datasets[dataset_key] or T
|
aux.player[key] = aux.player[key] or {}
|
||||||
aux_datasets[dataset_key] = dataset
|
cache.player = aux.player[key]
|
||||||
end
|
end
|
||||||
return dataset
|
do
|
||||||
|
local key = format('%s|%s', GetCVar'realmName', UnitFactionGroup'player')
|
||||||
|
aux.faction[key] = aux.faction[key] or {}
|
||||||
|
cache.faction = aux.faction[key]
|
||||||
|
end
|
||||||
|
do
|
||||||
|
local key = GetCVar'realmName'
|
||||||
|
aux.realm[key] = aux.realm[key] or {}
|
||||||
|
cache.realm = aux.realm[key]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for scope in temp-S('player', 'faction', 'realm', 'account') do
|
||||||
|
local scope = scope
|
||||||
|
M[scope] = function(k)
|
||||||
|
cache[scope][k] = cache[scope][k]
|
||||||
|
return cache[scope][k]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user