improvement for auctionable check
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Aux = {
|
Aux = {
|
||||||
version = '2.8.2',
|
version = '2.8.3',
|
||||||
blizzard_ui_shown = false,
|
blizzard_ui_shown = false,
|
||||||
orig = {},
|
orig = {},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,14 +216,28 @@ function public.set_shopping_tooltip(slot)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.tooltip_match(pattern, tooltip)
|
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(pattern)
|
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(pattern)
|
local right_match = line.right_text and strupper(line.right_text) == strupper(entry)
|
||||||
return left_match or right_match
|
return left_match or right_match
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function public.tooltip_find(pattern, tooltip)
|
||||||
|
local count = 0
|
||||||
|
for _, line in ipairs(tooltip) do
|
||||||
|
if line.left_text and strfind(line.left_text, pattern) then
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
if line.right_text and strfind(line.right_text, pattern) then
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
function public.load_tooltip(frame, tooltip)
|
function public.load_tooltip(frame, tooltip)
|
||||||
for _, line in ipairs(tooltip) do
|
for _, line in ipairs(tooltip) do
|
||||||
if line.right_text then
|
if line.right_text then
|
||||||
@@ -253,13 +267,13 @@ function public.display_name(item_id, plain, uncolored)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function public.auctionable(tooltip, quality, lootable)
|
function public.auctionable(tooltip, quality, lootable)
|
||||||
local durability, max_durability = Aux.info.durability(tooltip)
|
local durability, max_durability = public.durability(tooltip)
|
||||||
return not lootable
|
return not lootable
|
||||||
and (not quality or quality < 6)
|
and (not quality or quality < 6)
|
||||||
and not Aux.info.tooltip_match(ITEM_BIND_ON_PICKUP, tooltip)
|
and not public.tooltip_match(ITEM_BIND_ON_PICKUP, tooltip)
|
||||||
and not Aux.info.tooltip_match(ITEM_BIND_QUEST, tooltip)
|
and not public.tooltip_match(ITEM_BIND_QUEST, tooltip)
|
||||||
and not Aux.info.tooltip_match(ITEM_SOULBOUND, tooltip)
|
and not public.tooltip_match(ITEM_SOULBOUND, tooltip)
|
||||||
and not Aux.info.tooltip_match(ITEM_CONJURED, tooltip)
|
and (not public.tooltip_match(ITEM_CONJURED, tooltip) or public.tooltip_find(ITEM_MIN_LEVEL, tooltip) > 1)
|
||||||
and not (durability and durability < max_durability)
|
and not (durability and durability < max_durability)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -302,16 +316,7 @@ function public.tooltip(setter)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function private.item_charges(tooltip)
|
function private.item_charges(tooltip)
|
||||||
local use_entry_count = 0
|
if public.tooltip_find(ITEM_SPELL_TRIGGER_ONUSE, tooltip) > 1 then -- it's presumably a recipe
|
||||||
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
|
|
||||||
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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -105,7 +105,7 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
|
|
||||||
local color = {r=1, g=1, b=0.6 }
|
local color = {r=1, g=1, b=0.6 }
|
||||||
|
|
||||||
local auctionable = item_info and Aux.info.auctionable(Aux.info.tooltip(function(tt) tt:SetHyperlink(item_info.itemstring) end), item_info.quality)
|
local auctionable = not item_info or Aux.info.auctionable(Aux.info.tooltip(function(tt) tt:SetHyperlink(item_info.itemstring) end), item_info.quality)
|
||||||
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
||||||
local value
|
local value
|
||||||
if auctionable then
|
if auctionable then
|
||||||
|
|||||||
Reference in New Issue
Block a user