automatic alt detection

This commit is contained in:
Manuel Simon Hirsig
2016-11-26 19:28:09 +01:00
parent 964389cd69
commit 0573f92ea3
4 changed files with 16 additions and 38 deletions
+15 -3
View File
@@ -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()
-1
View File
@@ -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()
-33
View File
@@ -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
+1 -1
View File
@@ -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,