diff --git a/aux-addon.lua b/aux-addon.lua index 8ca076a..d23d0e9 100644 --- a/aux-addon.lua +++ b/aux-addon.lua @@ -10,6 +10,7 @@ local stack = require 'aux.core.stack' local post = require 'aux.core.post' local scan = require 'aux.core.scan' +_G.aux_characters = T --aux_account_settings = {} -- TODO clean up the mess of savedvariables --aux_character_settings = {} @@ -163,9 +164,20 @@ do end end -function M.is_player(name, current) - local realm = GetCVar'realmName' - return not current and index(aux_characters, realm, name) or UnitName'player' == name +function M.is_player(name) + local key = GetCVar'realmName' .. '|' .. UnitFactionGroup'player' + return index(aux_characters, key, name) +end + +function LOAD2() + local key = GetCVar'realmName' .. '|' .. UnitFactionGroup'player' + 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() end function M.neutral_faction() diff --git a/core/cache.lua b/core/cache.lua index 8bc50d2..db2ac7d 100644 --- a/core/cache.lua +++ b/core/cache.lua @@ -17,7 +17,6 @@ _G.aux_item_ids = T _G.aux_auctionable_items = T _G.aux_merchant_buy = T _G.aux_merchant_sell = T -_G.aux_characters = T function LOAD() scan_wdb() diff --git a/core/slash.lua b/core/slash.lua index 93881a1..1d01ef5 100644 --- a/core/slash.lua +++ b/core/slash.lua @@ -58,39 +58,6 @@ function SlashCmdList.AUX(command) elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then _G.aux_ignore_owner = not aux_ignore_owner print('Ignoring of owner ' .. (aux_ignore_owner and 'enabled' or 'disabled') .. '.') - elseif arguments[1] == 'chars' and arguments[2] == 'add' then - local realm = GetCVar'realmName' - aux_characters[realm] = aux_characters[realm] or T - for i = 3, getn(arguments) do - local name = gsub(strlower(arguments[i]), '^%l', strupper) - if not aux_characters[realm][name] then - aux_characters[realm][name] = true - print('Character "' .. name .. '" added.') - end - end - elseif arguments[1] == 'chars' and arguments[2] == 'remove' then - local realm = GetCVar'realmName' - if not aux_characters[realm] then - return - end - for i = 3, getn(arguments) do - local name = gsub(strlower(arguments[i]), '^%l', strupper) - if aux_characters[realm][name] then - aux_characters[realm][name] = nil - print('Character "' .. name .. '" removed.') - end - end - elseif arguments[1] == 'chars' then - local realm = GetCVar'realmName' - local chars = T - for name in aux_characters[realm] or empty do - tinsert(chars, name) - end - if getn(chars) > 0 then - print('Your characters: "' .. join(chars, ', ') .. '".') - else - print('You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".') - end else print('Unknown command: "' .. command .. '"') end diff --git a/util/info.lua b/util/info.lua index b4bdc0f..0bf4956 100644 --- a/util/info.lua +++ b/util/info.lua @@ -127,7 +127,7 @@ function M.auction(index, query_type) 'itemstring', item_info.itemstring, '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 '?')), ':'), - 'sniping_signature', join(temp-A(item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (is_player(owner, true) 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 '?')), ':'), 'name', name, 'texture', texture,