slash refactoring, characters now per realm
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Aux = {
|
Aux = {
|
||||||
version = '2.13.4',
|
version = '2.13.5',
|
||||||
blizzard_ui_shown = false,
|
blizzard_ui_shown = false,
|
||||||
orig = {},
|
orig = {},
|
||||||
}
|
}
|
||||||
@@ -423,11 +423,10 @@ function Aux.show_elements(elements)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Aux.is_player(name)
|
function Aux.is_player(name)
|
||||||
for i,v in ipairs(aux_characters) do
|
local realm = GetCVar('realmName')
|
||||||
if aux_characters[i] == name then
|
if aux_characters[realm][name] then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return UnitName('player') == name
|
return UnitName('player') == name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,102 +2,81 @@ SLASH_AUX1 = '/aux'
|
|||||||
function SlashCmdList.AUX(command)
|
function SlashCmdList.AUX(command)
|
||||||
if not command then return end
|
if not command then return end
|
||||||
local arguments = Aux.util.tokenize(command)
|
local arguments = Aux.util.tokenize(command)
|
||||||
if command == 'clear history' then
|
if arguments[1] == 'clear' and arguments[2] == 'history' then
|
||||||
Aux.persistence.load_dataset().history = nil
|
Aux.persistence.load_dataset().history = nil
|
||||||
Aux.log('History cleared.')
|
Aux.log('History cleared.')
|
||||||
elseif command == 'clear post' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'post' then
|
||||||
Aux.persistence.load_dataset().post = nil
|
Aux.persistence.load_dataset().post = nil
|
||||||
Aux.log('Post settings cleared.')
|
Aux.log('Post settings cleared.')
|
||||||
elseif command == 'clear datasets' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'datasets' then
|
||||||
aux_datasets = {}
|
aux_datasets = {}
|
||||||
Aux.log('Datasets cleared.')
|
Aux.log('Datasets cleared.')
|
||||||
elseif command == 'clear merchant buy' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'buy' then
|
||||||
aux_merchant_buy = {}
|
aux_merchant_buy = {}
|
||||||
Aux.log('Merchant buy prices cleared.')
|
Aux.log('Merchant buy prices cleared.')
|
||||||
elseif command == 'clear merchant sell' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'merchant' and arguments[3] == 'sell' then
|
||||||
aux_merchant_sell = {}
|
aux_merchant_sell = {}
|
||||||
Aux.log('Merchant sell prices cleared.')
|
Aux.log('Merchant sell prices cleared.')
|
||||||
elseif command == 'clear item cache' then
|
elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
|
||||||
aux_items = {}
|
aux_items = {}
|
||||||
aux_item_ids = {}
|
aux_item_ids = {}
|
||||||
aux_auctionable_items = {}
|
aux_auctionable_items = {}
|
||||||
Aux.log('Item cache cleared.')
|
Aux.log('Item cache cleared.')
|
||||||
elseif command == 'populate wdb' then
|
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
|
||||||
Aux.cache.populate_wdb()
|
Aux.cache.populate_wdb()
|
||||||
elseif command == 'tooltip daily' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'daily' then
|
||||||
aux_tooltip_daily = not aux_tooltip_daily
|
aux_tooltip_daily = not aux_tooltip_daily
|
||||||
Aux.log('Market value in tooltip '..(aux_tooltip_daily and 'enabled' or 'disabled')..'.')
|
Aux.log('Market value in tooltip '..(aux_tooltip_daily and 'enabled' or 'disabled')..'.')
|
||||||
elseif command == 'tooltip vendor buy' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'buy' then
|
||||||
aux_tooltip_vendor_buy = not aux_tooltip_vendor_buy
|
aux_tooltip_vendor_buy = not aux_tooltip_vendor_buy
|
||||||
Aux.log('Vendor buy price in tooltip '..(aux_tooltip_vendor_buy and 'enabled' or 'disabled')..'.')
|
Aux.log('Vendor buy price in tooltip '..(aux_tooltip_vendor_buy and 'enabled' or 'disabled')..'.')
|
||||||
elseif command == 'tooltip vendor sell' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'vendor' and arguments[3] == 'sell' then
|
||||||
aux_tooltip_vendor_sell = not aux_tooltip_vendor_sell
|
aux_tooltip_vendor_sell = not aux_tooltip_vendor_sell
|
||||||
Aux.log('Vendor sell price in tooltip '..(aux_tooltip_vendor_sell and 'enabled' or 'disabled')..'.')
|
Aux.log('Vendor sell price in tooltip '..(aux_tooltip_vendor_sell and 'enabled' or 'disabled')..'.')
|
||||||
elseif command == 'tooltip disenchant value' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'value' then
|
||||||
aux_tooltip_disenchant_value = not aux_tooltip_disenchant_value
|
aux_tooltip_disenchant_value = not aux_tooltip_disenchant_value
|
||||||
Aux.log('Disenchant value in tooltip '..(aux_tooltip_disenchant_value and 'enabled' or 'disabled')..'.')
|
Aux.log('Disenchant value in tooltip '..(aux_tooltip_disenchant_value and 'enabled' or 'disabled')..'.')
|
||||||
elseif command == 'tooltip disenchant distribution' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'distribution' then
|
||||||
aux_tooltip_disenchant_distribution = not aux_tooltip_disenchant_distribution
|
aux_tooltip_disenchant_distribution = not aux_tooltip_disenchant_distribution
|
||||||
Aux.log('Disenchant distribution in tooltip '..(aux_tooltip_disenchant_distribution and 'enabled' or 'disabled')..'.')
|
Aux.log('Disenchant distribution in tooltip '..(aux_tooltip_disenchant_distribution and 'enabled' or 'disabled')..'.')
|
||||||
elseif command == 'tooltip disenchant source' then
|
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'source' then
|
||||||
aux_tooltip_disenchant_source = not aux_tooltip_disenchant_source
|
aux_tooltip_disenchant_source = not aux_tooltip_disenchant_source
|
||||||
Aux.log('Disenchant source in tooltip '..(aux_tooltip_disenchant_source and 'enabled' or 'disabled')..'.')
|
Aux.log('Disenchant source in tooltip '..(aux_tooltip_disenchant_source and 'enabled' or 'disabled')..'.')
|
||||||
elseif command == 'ignore owner' then
|
elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
|
||||||
aux_ignore_owner = not aux_ignore_owner
|
aux_ignore_owner = not aux_ignore_owner
|
||||||
Aux.log('Ignoring of owner '..(aux_ignore_owner and 'enabled' or 'disabled')..'.')
|
Aux.log('Ignoring of owner '..(aux_ignore_owner and 'enabled' or 'disabled')..'.')
|
||||||
elseif arguments[1] == 'addchar' and arguments[2] then
|
elseif arguments[1] == 'addchar' then
|
||||||
local exists = false
|
local realm = GetCVar('realmName')
|
||||||
for i=2, getn(arguments) do
|
aux_characters[realm] = aux_characters[realm] or {}
|
||||||
exists = false
|
for i=2,getn(arguments) do
|
||||||
if arguments[i] ~= '' then
|
local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
|
||||||
arguments[i] = string.gsub(arguments[i], '^%l', strupper) -- force uppercase
|
if not aux_characters[realm][name] then
|
||||||
for i_aux,_ in ipairs(aux_characters) do
|
aux_characters[realm][name] = true
|
||||||
if (aux_characters[i_aux] == arguments[i]) then
|
Aux.log('Character "'..name..'" added.')
|
||||||
exists = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not exists then
|
|
||||||
table.insert(aux_characters, arguments[i])
|
|
||||||
Aux.log('Character "'..arguments[i]..'" added.')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif arguments[1] == 'delchar' and arguments[2] then
|
elseif arguments[1] == 'delchar' then
|
||||||
for i=2, table.getn(arguments) do
|
local realm = GetCVar('realmName')
|
||||||
if arguments[i] ~= "" then
|
aux_characters[realm] = aux_characters[realm] or {}
|
||||||
arguments[i] = strupper(strsub(arguments[i], 1, 1))..strsub(arguments[i], 2)
|
for i=2,getn(arguments) do
|
||||||
for i_aux,v in ipairs(aux_characters) do
|
local name = string.gsub(strlower(arguments[i]), '^%l', strupper)
|
||||||
if aux_characters[i_aux] == arguments[i] then
|
if aux_characters[realm][name] then
|
||||||
table.remove(aux_characters, i_aux)
|
aux_characters[realm][name] = nil
|
||||||
Aux.log('Character "'..arguments[i]..'" removed.')
|
Aux.log('Character "'..name..'" removed.')
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif command == 'chars' then
|
elseif arguments[1] == 'chars' then
|
||||||
local chars
|
local realm = GetCVar('realmName')
|
||||||
local num = table.getn(aux_characters)
|
local chars = {}
|
||||||
for i,v in ipairs(aux_characters) do
|
for name, _ in pairs(aux_characters[realm] or {}) do
|
||||||
if i ~= num then
|
tinsert(chars, name)
|
||||||
if chars then
|
|
||||||
chars = chars .. v .. ", "
|
|
||||||
else
|
|
||||||
chars = v .. ", "
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if chars then
|
|
||||||
chars = chars .. v
|
|
||||||
else
|
|
||||||
chars = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if num > 0 then
|
if getn(chars) > 0 then
|
||||||
Aux.log('Your characters: "'..chars..'".')
|
Aux.log('Your characters: "'..Aux.util.join(chars, ', ')..'".')
|
||||||
else
|
else
|
||||||
Aux.log('You don\'t have any additional characters. Type "/aux addchar NAME" to add one.')
|
Aux.log('You don\'t have any additional characters. Type "/aux addchar NAME" to add one.')
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
Aux.log('Unknown command: "'..command..'"')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user