This commit is contained in:
Manuel Simon Hirsig
2016-03-05 12:55:33 +01:00
parent 6b7f292480
commit 8351d56f3b
3 changed files with 26 additions and 12 deletions
+23 -9
View File
@@ -293,16 +293,30 @@ function public.tooltip(setter)
end
function private.item_charges(tooltip)
for _, line in ipairs(tooltip) do
-- recipes also contain the charges tooltip for the item they teach so we have to ignore them
local ignore_pattern = '^Use: Teaches you how to create'
if strfind(line.left_text or '', ignore_pattern) or strfind(line.right_text or '', ignore_pattern) then
return
local use_entry_count = 0
for _, line in ipairs(tooltip) do
if strfind(line.left_text or '', ITEM_SPELL_TRIGGER_ONUSE) then
use_entry_count = use_entry_count + 1
end
local pattern = '^(%d+) Charges$'
local _, _, left_charges_string = strfind(line.left_text or '', pattern)
local _, _, right_charges_string = strfind(line.right_text or '', pattern)
local charges = tonumber(left_charges_string) or tonumber(right_charges_string)
if strfind(line.right_text or '', ITEM_SPELL_TRIGGER_ONUSE) then
use_entry_count = use_entry_count + 1
end
end
if use_entry_count > 1 then -- it's presumably a recipe
return
end
for _, line in ipairs(tooltip) do
local pattern1 = '^'..gsub(ITEM_SPELL_CHARGES, '%%d', '(%%d)')..'$'
local pattern2 = '^'..gsub(ITEM_SPELL_CHARGES_P1, '%%d', '(%%d)')..'$'
local _, _, left_charges_string1 = strfind(line.left_text or '', pattern1)
local _, _, left_charges_string2 = strfind(line.left_text or '', pattern2)
local _, _, right_charges_string1 = strfind(line.right_text or '', pattern1)
local _, _, right_charges_string2 = strfind(line.right_text or '', pattern2)
local charges = tonumber(left_charges_string1) or tonumber(left_charges_string2) or tonumber(right_charges_string1) or tonumber(right_charges_string2)
if charges then
return charges
end
+2 -2
View File
@@ -724,8 +724,8 @@ end
function private.auctionable(item_info)
local durability, max_durability = Aux.info.durability(item_info.tooltip)
return Aux.static.item_info(item_info.item_id)
and not Aux.info.tooltip_match('soulbound', item_info.tooltip)
and not Aux.info.tooltip_match('conjured item', item_info.tooltip)
and not Aux.info.tooltip_match(ITEM_SOULBOUND, item_info.tooltip)
and not Aux.info.tooltip_match(ITEM_CONJURED, item_info.tooltip)
and not item_info.lootable
and not (durability and durability < max_durability)
end
+1 -1
View File
@@ -455,7 +455,7 @@ function public.on_load()
local function add_modifier(...)
local current_filter_string = private.search_box:GetText()
for i=1,arg.n do
if string.sub(current_filter_string, strlen(current_filter_string), strlen(current_filter_string)) ~= '/' then
if current_filter_string ~= '' and string.sub(current_filter_string, strlen(current_filter_string), strlen(current_filter_string)) ~= '/' then
current_filter_string = current_filter_string..'/'
end
current_filter_string = current_filter_string..arg[i]