refactorings
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
||||
local m, public, private = Aux.module'completion'
|
||||
local m, public, private = aux.module'completion'
|
||||
|
||||
function public:complete_filter()
|
||||
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
|
||||
@@ -8,12 +8,12 @@ function public:complete_filter()
|
||||
local filter_string = this:GetText()
|
||||
|
||||
local completed_filter_string = ({strfind(filter_string, '([^;]*)/[^/;]*$')})[3]
|
||||
local _, suggestions = Aux.filter.query(completed_filter_string or '')
|
||||
local _, suggestions = aux.filter.query(completed_filter_string or '')
|
||||
|
||||
local start_index, _, current_modifier = strfind(filter_string, '([^/;]*)$')
|
||||
current_modifier = current_modifier or ''
|
||||
|
||||
for _, suggestion in ipairs(suggestions) do
|
||||
for _, suggestion in suggestions do
|
||||
if strsub(strupper(suggestion), 1, strlen(current_modifier)) == strupper(current_modifier) then
|
||||
this:SetText(strlower(strsub(filter_string, 1, start_index - 1).. suggestion))
|
||||
this:HighlightText(strlen(filter_string), -1)
|
||||
@@ -30,7 +30,7 @@ function public.complete(options)
|
||||
|
||||
local text = self:GetText()
|
||||
|
||||
for _, item_name in ipairs(options()) do
|
||||
for _, item_name in options() do
|
||||
if strsub(strupper(item_name), 1, strlen(text)) == strupper(text) then
|
||||
self:SetText(strlower(item_name))
|
||||
self:HighlightText(strlen(text), -1)
|
||||
|
||||
+11
-14
@@ -1,4 +1,4 @@
|
||||
local m, public, private = Aux.module'util'
|
||||
local m, public, private = aux.module'util'
|
||||
|
||||
function public.pass()
|
||||
end
|
||||
@@ -141,13 +141,11 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function public.join(array, separator)
|
||||
local str = ''
|
||||
for i, element in ipairs(array) do
|
||||
if i > 1 then
|
||||
str = str..separator
|
||||
end
|
||||
str = str..element
|
||||
function public.join(parts, separator)
|
||||
local str = parts[1]
|
||||
for i=2,getn(parts) do
|
||||
if not parts[i] then break end
|
||||
str = str..separator..parts[i]
|
||||
end
|
||||
return str
|
||||
end
|
||||
@@ -226,11 +224,10 @@ function public.bag_type(bag)
|
||||
return 1
|
||||
end
|
||||
|
||||
local link = GetInventoryItemLink('player', ContainerIDToInventoryID(bag))
|
||||
if link then
|
||||
local item_id = Aux.info.parse_hyperlink(GetInventoryItemLink('player', ContainerIDToInventoryID(bag)))
|
||||
local item_info = Aux.info.item(item_id)
|
||||
return Aux.info.item_subclass_index(3, item_info.subclass)
|
||||
if GetInventoryItemLink('player', ContainerIDToInventoryID(bag)) then
|
||||
local item_id = aux.info.parse_hyperlink(GetInventoryItemLink('player', ContainerIDToInventoryID(bag)))
|
||||
local item_info = aux.info.item(item_id)
|
||||
return aux.info.item_subclass_index(3, item_info.subclass)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -264,7 +261,7 @@ function public.format_money(money, exact, color)
|
||||
-- Round to nearest silver
|
||||
money = floor(money / 100 + 0.5) * 100
|
||||
end
|
||||
local g, s, c = Aux.money.to_GSC(money)
|
||||
local g, s, c = aux.money.to_GSC(money)
|
||||
|
||||
local gsc = ''
|
||||
|
||||
|
||||
+47
-47
@@ -1,11 +1,11 @@
|
||||
local m, public, private = Aux.module'filter'
|
||||
local m, public, private = aux.module'filter'
|
||||
|
||||
function private.default_filter(str)
|
||||
return {
|
||||
input_type = '',
|
||||
validator = function()
|
||||
return function(auction_record)
|
||||
return Aux.util.any(auction_record.tooltip, function(entry)
|
||||
return aux.util.any(auction_record.tooltip, function(entry)
|
||||
return strfind(strupper(entry.left_text or ''), strupper(str or ''), 1, true) or strfind(strupper(entry.right_text or ''), strupper(str or ''), 1, true)
|
||||
end)
|
||||
end
|
||||
@@ -19,7 +19,7 @@ public.filters = {
|
||||
input_type = '',
|
||||
validator = function()
|
||||
return function(auction_record)
|
||||
return auction_record.usable and not Aux.info.tooltip_match(ITEM_SPELL_KNOWN, auction_record.tooltip)
|
||||
return auction_record.usable and not aux.info.tooltip_match(ITEM_SPELL_KNOWN, auction_record.tooltip)
|
||||
end
|
||||
end,
|
||||
},
|
||||
@@ -35,7 +35,7 @@ public.filters = {
|
||||
input_type = 'string',
|
||||
validator = function(name)
|
||||
return function(auction_record)
|
||||
return strlower(Aux.info.item(auction_record.item_id).name) == name
|
||||
return strlower(aux.info.item(auction_record.item_id).name) == name
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -43,7 +43,7 @@ public.filters = {
|
||||
['left'] = {
|
||||
input_type = {'30m', '2h', '8h', '24h'},
|
||||
validator = function(duration)
|
||||
local code = Aux.util.key(duration, {'30m', '2h', '8h', '24h'})
|
||||
local code = aux.util.key(duration, {'30m', '2h', '8h', '24h'})
|
||||
return function(auction_record)
|
||||
return auction_record.duration == code
|
||||
end
|
||||
@@ -53,7 +53,7 @@ public.filters = {
|
||||
['rarity'] = {
|
||||
input_type = {'poor', 'common', 'uncommon', 'rare', 'epic'},
|
||||
validator = function(rarity)
|
||||
local code = Aux.util.key(rarity, {'poor', 'common', 'uncommon', 'rare', 'epic'}) - 1
|
||||
local code = aux.util.key(rarity, {'poor', 'common', 'uncommon', 'rare', 'epic'}) - 1
|
||||
return function(auction_record)
|
||||
return auction_record.quality == code
|
||||
end
|
||||
@@ -119,8 +119,8 @@ public.filters = {
|
||||
validator = function(pct)
|
||||
return function(auction_record)
|
||||
return auction_record.unit_buyout_price > 0
|
||||
and Aux.history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / Aux.history.value(auction_record.item_key) * 100 <= pct
|
||||
and aux.history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -130,8 +130,8 @@ public.filters = {
|
||||
validator = function(pct)
|
||||
return function(auction_record)
|
||||
return auction_record.unit_buyout_price > 0
|
||||
and Aux.history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / Aux.history.value(auction_record.item_key) * 100 <= pct
|
||||
and aux.history.value(auction_record.item_key)
|
||||
and auction_record.unit_buyout_price / aux.history.value(auction_record.item_key) * 100 <= pct
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -140,7 +140,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
return Aux.history.value(auction_record.item_key) and Aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||
return aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -149,7 +149,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
return auction_record.buyout_price > 0 and Aux.history.value(auction_record.item_key) and Aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||
return auction_record.buyout_price > 0 and aux.history.value(auction_record.item_key) and aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -158,7 +158,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
local disenchant_value = Aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||
local disenchant_value = aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||
return disenchant_value and disenchant_value - auction_record.bid_price >= amount
|
||||
end
|
||||
end
|
||||
@@ -168,7 +168,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
local disenchant_value = Aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||
local disenchant_value = aux.disenchant.value(auction_record.slot, auction_record.quality, auction_record.level)
|
||||
return auction_record.buyout_price > 0 and disenchant_value and disenchant_value - auction_record.buyout_price >= amount
|
||||
end
|
||||
end
|
||||
@@ -178,7 +178,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
local vendor_price = Aux.cache.merchant_info(auction_record.item_id)
|
||||
local vendor_price = aux.cache.merchant_info(auction_record.item_id)
|
||||
return vendor_price and vendor_price * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||
end
|
||||
end
|
||||
@@ -188,7 +188,7 @@ public.filters = {
|
||||
input_type = 'money',
|
||||
validator = function(amount)
|
||||
return function(auction_record)
|
||||
local vendor_price = Aux.cache.merchant_info(auction_record.item_id)
|
||||
local vendor_price = aux.cache.merchant_info(auction_record.item_id)
|
||||
return auction_record.buyout_price > 0 and vendor_price and vendor_price * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||
end
|
||||
end
|
||||
@@ -240,27 +240,27 @@ function private.blizzard_filter_parser()
|
||||
else
|
||||
return nil, 'Erroneous level range modifier'
|
||||
end
|
||||
elseif Aux.info.item_class_index(str) and not (filters.class and not filters.subclass and str == strlower(({ GetAuctionItemClasses() })[10])) then
|
||||
class_index = Aux.info.item_class_index(str)
|
||||
elseif aux.info.item_class_index(str) and not (filters.class and not filters.subclass and str == strlower(({ GetAuctionItemClasses() })[10])) then
|
||||
class_index = aux.info.item_class_index(str)
|
||||
if not filters.class then
|
||||
filter = {'class', str}
|
||||
else
|
||||
return nil, 'Erroneous item class modifier'
|
||||
end
|
||||
elseif class_index and Aux.info.item_subclass_index(class_index, str) then
|
||||
subclass_index = Aux.info.item_subclass_index(class_index, str)
|
||||
elseif class_index and aux.info.item_subclass_index(class_index, str) then
|
||||
subclass_index = aux.info.item_subclass_index(class_index, str)
|
||||
if not filters.subclass then
|
||||
filter = {'subclass', str}
|
||||
else
|
||||
return nil, 'Erroneous item subclass modifier'
|
||||
end
|
||||
elseif subclass_index and Aux.info.item_slot_index(class_index, subclass_index, str) then
|
||||
elseif subclass_index and aux.info.item_slot_index(class_index, subclass_index, str) then
|
||||
if not filters.slot then
|
||||
filter = {'slot', str}
|
||||
else
|
||||
return nil, 'Erroneous item slot modifier'
|
||||
end
|
||||
elseif Aux.info.item_quality_index(str) then
|
||||
elseif aux.info.item_quality_index(str) then
|
||||
if not filters.quality then
|
||||
filter = {'quality', str}
|
||||
else
|
||||
@@ -310,7 +310,7 @@ end
|
||||
|
||||
function private.parse_parameter(input_type, str)
|
||||
if input_type == 'money' then
|
||||
local money = Aux.money.from_string(str)
|
||||
local money = aux.money.from_string(str)
|
||||
if money and money > 0 then
|
||||
return money
|
||||
end
|
||||
@@ -324,7 +324,7 @@ function private.parse_parameter(input_type, str)
|
||||
return str
|
||||
end
|
||||
elseif type(input_type) == 'table' then
|
||||
local choice = Aux.util.key(str, input_type)
|
||||
local choice = aux.util.key(str, input_type)
|
||||
if choice then
|
||||
return choice
|
||||
end
|
||||
@@ -334,7 +334,7 @@ end
|
||||
function public.parse_query_string(str)
|
||||
local components = { blizzard = {}, post = {} }
|
||||
local blizzard_filter_parser = m.blizzard_filter_parser()
|
||||
local parts = Aux.util.map(Aux.util.split(str, '/'), function(part) return strlower(Aux.util.trim(part)) end)
|
||||
local parts = aux.util.map(aux.util.split(str, '/'), function(part) return strlower(aux.util.trim(part)) end)
|
||||
|
||||
local i = 1
|
||||
while parts[i] do
|
||||
@@ -412,16 +412,16 @@ function public.query(query_string)
|
||||
end
|
||||
|
||||
function public.queries(query_string)
|
||||
local parts = Aux.util.split(query_string, ';')
|
||||
local parts = aux.util.split(query_string, ';')
|
||||
|
||||
local queries = {}
|
||||
for _, str in ipairs(parts) do
|
||||
str = Aux.util.trim(str)
|
||||
str = aux.util.trim(str)
|
||||
|
||||
local query, _, error = m.query(str)
|
||||
|
||||
if not query then
|
||||
Aux.log('Invalid filter:', error)
|
||||
aux.log('Invalid filter:', error)
|
||||
return
|
||||
else
|
||||
tinsert(queries, query)
|
||||
@@ -469,7 +469,7 @@ function private.suggestions(components)
|
||||
end
|
||||
|
||||
-- subclasses
|
||||
local class_index = blizzard_filters.class and Aux.info.item_class_index(blizzard_filters.class)
|
||||
local class_index = blizzard_filters.class and aux.info.item_class_index(blizzard_filters.class)
|
||||
if class_index and not blizzard_filters.subclass then
|
||||
for _, subclass in ipairs({ GetAuctionItemSubClasses(class_index) }) do
|
||||
tinsert(suggestions, subclass)
|
||||
@@ -477,9 +477,9 @@ function private.suggestions(components)
|
||||
end
|
||||
|
||||
-- slots
|
||||
local subclass_index = class_index and blizzard_filters.subclass and Aux.info.item_subclass_index(class_index, blizzard_filters.subclass)
|
||||
local subclass_index = class_index and blizzard_filters.subclass and aux.info.item_subclass_index(class_index, blizzard_filters.subclass)
|
||||
if subclass_index and not blizzard_filters.slot then
|
||||
for _, invtype in ipairs({ GetAuctionInvTypes(class_index, Aux.info.item_subclass_index(class_index, blizzard_filters.subclass)) }) do
|
||||
for _, invtype in ipairs({ GetAuctionInvTypes(class_index, aux.info.item_subclass_index(class_index, blizzard_filters.subclass)) }) do
|
||||
tinsert(suggestions, getglobal(invtype))
|
||||
end
|
||||
end
|
||||
@@ -572,9 +572,9 @@ function private.prettified_query_string(components)
|
||||
for _, filter in components.blizzard do
|
||||
blizzard_filters[filter[1]] = filter[2] or true
|
||||
if filter[1] == 'exact' then
|
||||
prettified.prepend(Aux.info.display_name(Aux.cache.item_id(m.unquote(blizzard_filters.name))) or Aux.gui.inline_color({216, 225, 211, 1})..'['..m.unquote(blizzard_filters.name)..']|r')
|
||||
prettified.prepend(aux.info.display_name(aux.cache.item_id(m.unquote(blizzard_filters.name))) or aux.gui.inline_color({216, 225, 211, 1})..'['..m.unquote(blizzard_filters.name)..']|r')
|
||||
elseif filter[1] ~= 'name' then
|
||||
prettified.append(Aux.gui.inline_color({216, 225, 211, 1})..(filter[2] or filter[1])..'|r')
|
||||
prettified.append(aux.gui.inline_color({216, 225, 211, 1})..(filter[2] or filter[1])..'|r')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -582,7 +582,7 @@ function private.prettified_query_string(components)
|
||||
if m.unquote(blizzard_filters.name) == '' then
|
||||
prettified.prepend('|cffff0000'..'No Filter'..'|r')
|
||||
else
|
||||
prettified.prepend(Aux.gui.inline_color({216, 225, 211, 1})..m.unquote(blizzard_filters.name)..'|r')
|
||||
prettified.prepend(aux.gui.inline_color({216, 225, 211, 1})..m.unquote(blizzard_filters.name)..'|r')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -623,11 +623,11 @@ function private.blizzard_query(components)
|
||||
|
||||
local item_info, class_index, subclass_index, slot_index
|
||||
if filters.exact then
|
||||
local item_id = Aux.cache.item_id(filters.name)
|
||||
item_info = Aux.info.item(item_id)
|
||||
class_index = item_info and Aux.info.item_class_index(item_info.class)
|
||||
subclass_index = class_index and item_info.subclass and Aux.info.item_subclass_index(class_index, item_info.subclass)
|
||||
slot_index = subclass_index and item_info.slot and Aux.info.item_slot_index(class_index, subclass_index, item_info.slot)
|
||||
local item_id = aux.cache.item_id(filters.name)
|
||||
item_info = aux.info.item(item_id)
|
||||
class_index = item_info and aux.info.item_class_index(item_info.class)
|
||||
subclass_index = class_index and item_info.subclass and aux.info.item_subclass_index(class_index, item_info.subclass)
|
||||
slot_index = subclass_index and item_info.slot and aux.info.item_slot_index(class_index, subclass_index, item_info.slot)
|
||||
end
|
||||
|
||||
if item_info then
|
||||
@@ -641,11 +641,11 @@ function private.blizzard_query(components)
|
||||
else
|
||||
query.min_level = tonumber(filters.min_level)
|
||||
query.max_level = tonumber(filters.max_level)
|
||||
query.class = filters.class and filters.class and Aux.info.item_class_index(filters.class)
|
||||
query.subclass = query.class and filters.subclass and Aux.info.item_subclass_index(query.class, filters.subclass)
|
||||
query.slot = query.subclass and filters.slot and Aux.info.item_slot_index(query.class, query.subclass, filters.slot)
|
||||
query.class = filters.class and filters.class and aux.info.item_class_index(filters.class)
|
||||
query.subclass = query.class and filters.subclass and aux.info.item_subclass_index(query.class, filters.subclass)
|
||||
query.slot = query.subclass and filters.slot and aux.info.item_slot_index(query.class, query.subclass, filters.slot)
|
||||
query.usable = filters.usable and 1
|
||||
query.quality = filters.quality and Aux.info.item_quality_index(filters.quality)
|
||||
query.quality = filters.quality and aux.info.item_quality_index(filters.quality)
|
||||
end
|
||||
|
||||
return query
|
||||
@@ -662,7 +662,7 @@ function private.validator(components)
|
||||
|
||||
return function(record)
|
||||
for _, filter in components.blizzard do
|
||||
if filter[1] == 'exact' and strlower(Aux.info.item(record.item_id).name) ~= components.blizzard[1][2] then
|
||||
if filter[1] == 'exact' and strlower(aux.info.item(record.item_id).name) ~= components.blizzard[1][2] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -678,15 +678,15 @@ function private.validator(components)
|
||||
if name == 'not' then
|
||||
tinsert(stack, not args[1])
|
||||
elseif name == 'and' then
|
||||
tinsert(stack, Aux.util.all(args, Aux.util.id))
|
||||
tinsert(stack, aux.util.all(args, aux.util.id))
|
||||
elseif name == 'or' then
|
||||
tinsert(stack, Aux.util.any(args, Aux.util.id))
|
||||
tinsert(stack, aux.util.any(args, aux.util.id))
|
||||
end
|
||||
elseif type == 'filter' then
|
||||
tinsert(stack, validators[i](record) and true or false)
|
||||
end
|
||||
end
|
||||
return Aux.util.all(stack, Aux.util.id)
|
||||
return aux.util.all(stack, aux.util.id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
local m, public, private = Aux.module'info'
|
||||
local m, public, private = aux.module'info'
|
||||
|
||||
local TOOLTIP_LENGTH = 30
|
||||
|
||||
@@ -133,8 +133,8 @@ function public.auction(index, query_type)
|
||||
hyperlink = hyperlink,
|
||||
itemstring = item_info.itemstring,
|
||||
item_key = item_id..':'..suffix_id,
|
||||
search_signature = Aux.util.join({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 (Aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
|
||||
sniping_signature = Aux.util.join({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (Aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
|
||||
search_signature = aux.util.join({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 (aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
|
||||
sniping_signature = aux.util.join({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
|
||||
|
||||
name = name,
|
||||
texture = texture,
|
||||
@@ -172,12 +172,12 @@ end
|
||||
function public.bid_update(auction_record)
|
||||
auction_record.high_bid = auction_record.bid_price
|
||||
auction_record.blizzard_bid = auction_record.bid_price
|
||||
auction_record.min_increment = Aux.min_bid_increment(auction_record.bid_price)
|
||||
auction_record.min_increment = aux.min_bid_increment(auction_record.bid_price)
|
||||
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_bid_price = auction_record.bid_price / auction_record.aux_quantity
|
||||
auction_record.high_bidder = 1
|
||||
auction_record.search_signature = Aux.util.join({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 (Aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
|
||||
auction_record.search_signature = aux.util.join({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 (aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
|
||||
end
|
||||
|
||||
function public.set_tooltip(itemstring, owner, anchor)
|
||||
@@ -222,7 +222,7 @@ function public.set_shopping_tooltip(slot)
|
||||
end
|
||||
|
||||
function public.tooltip_match(entry, tooltip)
|
||||
return Aux.util.any(tooltip, function(line)
|
||||
return aux.util.any(tooltip, function(line)
|
||||
local left_match = line.left_text and strupper(line.left_text) == strupper(entry)
|
||||
local right_match = line.right_text and strupper(line.right_text) == strupper(entry)
|
||||
return left_match or right_match
|
||||
@@ -258,7 +258,7 @@ function public.load_tooltip(frame, tooltip)
|
||||
end
|
||||
|
||||
function public.display_name(item_id, no_brackets, no_color)
|
||||
local item_info = Aux.info.item(item_id)
|
||||
local item_info = aux.info.item(item_id)
|
||||
if item_info then
|
||||
local name = item_info.name
|
||||
if not no_brackets then
|
||||
@@ -389,7 +389,7 @@ function public.item(item_id, suffix_id)
|
||||
slot = slot,
|
||||
max_stack = max_stack,
|
||||
texture = texture,
|
||||
} or Aux.cache.item_info(item_id)
|
||||
} or aux.cache.item_info(item_id)
|
||||
end
|
||||
|
||||
function public.item_class_index(item_class)
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
local m, public, private = Aux.module'money'
|
||||
local m, public, private = aux.module'money'
|
||||
|
||||
local GOLD_TEXT = '|cffffd70ag|r'
|
||||
local SILVER_TEXT = '|cffc7c7cfs|r'
|
||||
@@ -50,7 +50,7 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color)
|
||||
if copper > 0 or gold == 0 and silver == 0 then
|
||||
tinsert(parts, m.format_number(copper, pad, decimal_points, color)..copper_text)
|
||||
end
|
||||
text = Aux.util.join(parts, ' ')
|
||||
text = aux.util.join(parts, ' ')
|
||||
else
|
||||
if gold > 0 then
|
||||
text = m.format_number(gold, false, nil, color)..gold_text..' '..m.format_number(silver, pad, nil, color)..silver_text..' '..m.format_number(copper, pad, decimal_points, color)..copper_text
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local m, public, private = Aux.module'persistence'
|
||||
local m, public, private = aux.module'persistence'
|
||||
|
||||
aux_datasets = {}
|
||||
|
||||
@@ -6,7 +6,7 @@ do
|
||||
local realm, faction
|
||||
|
||||
function public.LOAD()
|
||||
Aux.control.as_soon_as(function() faction = UnitFactionGroup('player') return faction end, Aux.util.pass)
|
||||
aux.control.as_soon_as(function() faction = UnitFactionGroup('player') return faction end, aux.util.pass)
|
||||
realm = GetCVar('realmName')
|
||||
end
|
||||
|
||||
@@ -60,8 +60,8 @@ function public.read_list(schema, str)
|
||||
|
||||
local separator = schema[2]
|
||||
local element_type = schema[3]
|
||||
local parts = Aux.util.split(str, separator)
|
||||
return Aux.util.map(parts, function(part)
|
||||
local parts = aux.util.split(str, separator)
|
||||
return aux.util.map(parts, function(part)
|
||||
return m.read(element_type, part)
|
||||
end)
|
||||
end
|
||||
@@ -69,16 +69,16 @@ end
|
||||
function public.write_list(schema, list)
|
||||
local separator = schema[2]
|
||||
local element_type = schema[3]
|
||||
local parts = Aux.util.map(list, function(element)
|
||||
local parts = aux.util.map(list, function(element)
|
||||
return m.write(element_type, element)
|
||||
end)
|
||||
return Aux.util.join(parts, separator)
|
||||
return aux.util.join(parts, separator)
|
||||
end
|
||||
|
||||
function public.read_record(schema, str)
|
||||
local separator = schema[2]
|
||||
local record = {}
|
||||
local parts = Aux.util.split(str, separator)
|
||||
local parts = aux.util.split(str, separator)
|
||||
for i=3,getn(schema) do
|
||||
local key, type = next(schema[i])
|
||||
record[key] = m.read(type, parts[i - 2])
|
||||
@@ -91,9 +91,10 @@ function public.write_record(schema, record)
|
||||
local parts = {}
|
||||
for i=3,getn(schema) do
|
||||
local key, type = next(schema[i])
|
||||
aux.log(type, record[key], m.write(type, record[key]))
|
||||
tinsert(parts, m.write(type, record[key]))
|
||||
end
|
||||
return Aux.util.join(parts, separator)
|
||||
return aux.util.join(parts, separator)
|
||||
end
|
||||
|
||||
function public.serialize(data, separator, compactor)
|
||||
|
||||
+8
-8
@@ -1,9 +1,9 @@
|
||||
local m, public, private = Aux.module'scan_util'
|
||||
local m, public, private = aux.module'scan_util'
|
||||
|
||||
function public.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
||||
|
||||
local function test(index)
|
||||
local auction_info = Aux.info.auction(index, auction_record.query_type)
|
||||
local auction_info = aux.info.auction(index, auction_record.query_type)
|
||||
return auction_info and auction_info.search_signature == auction_record.search_signature
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
||||
|
||||
if auction_record.blizzard_query then
|
||||
|
||||
local blizzard_query1 = Aux.util.copy(auction_record.blizzard_query)
|
||||
local blizzard_query1 = aux.util.copy(auction_record.blizzard_query)
|
||||
blizzard_query1.first_page = auction_record.page
|
||||
blizzard_query1.last_page = auction_record.page
|
||||
tinsert(queries, {
|
||||
@@ -20,7 +20,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
||||
})
|
||||
|
||||
if auction_record.page > 0 then
|
||||
local blizzard_query2 = Aux.util.copy(auction_record.blizzard_query)
|
||||
local blizzard_query2 = aux.util.copy(auction_record.blizzard_query)
|
||||
blizzard_query2.first_page = auction_record.page - 1
|
||||
blizzard_query2.last_page = auction_record.page - 1
|
||||
tinsert(queries, {
|
||||
@@ -29,14 +29,14 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
||||
end
|
||||
|
||||
local item_query = m.item_query(auction_record.item_id, 1, 1)
|
||||
if not Aux.util.eq(auction_record.blizzard_query, item_query.blizzard_query) then
|
||||
if not aux.util.eq(auction_record.blizzard_query, item_query.blizzard_query) then
|
||||
tinsert(queries, item_query)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local found
|
||||
return Aux.scan.start{
|
||||
return aux.scan.start{
|
||||
type = auction_record.query_type,
|
||||
queries = queries,
|
||||
on_scan_start = function()
|
||||
@@ -72,10 +72,10 @@ end
|
||||
|
||||
function public.item_query(item_id, first_page, last_page)
|
||||
|
||||
local item_info = Aux.info.item(item_id)
|
||||
local item_info = aux.info.item(item_id)
|
||||
|
||||
if item_info then
|
||||
local query = Aux.filter.query(item_info.name..'/exact')
|
||||
local query = aux.filter.query(item_info.name..'/exact')
|
||||
query.blizzard_query.first_page = first_page
|
||||
query.blizzard_query.last_page = last_page
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
local m, public, private = Aux.module'sort'
|
||||
local m, public, private = aux.module'sort'
|
||||
|
||||
public.LT = {}
|
||||
public.EQ = {}
|
||||
|
||||
Reference in New Issue
Block a user