will not exclude items with durability loss from post

This commit is contained in:
Manuel Simon Hirsig
2016-02-14 02:51:59 +01:00
parent 0673ebe322
commit b3faf24d38
3 changed files with 30 additions and 15 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
AuxVersion = '2.4.20'
AuxVersion = '2.4.21'
AuxAuthors = 'shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)'
Aux = {
@@ -260,7 +260,7 @@ function Aux.price_level_color(pct)
end
end
do
do -- TODO make it work for other ways to pick up things
local last_picked_up
function Aux.PickupContainerItem(bag, slot)
last_picked_up = { bag, slot }
+16 -2
View File
@@ -291,8 +291,9 @@ end
function private.item_charges(tooltip)
for _, line in ipairs(tooltip) do
local _, _, left_charges_string = strfind(line.left_text or '', '^(%d+) Charges')
local _, _, right_charges_string = strfind(line.right_text or '', '^(%d+) Charges$')
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 charges then
return charges
@@ -300,6 +301,19 @@ function private.item_charges(tooltip)
end
end
function public.durability(tooltip)
for _, line in ipairs(tooltip) do
local pattern = '^Durability (%d+) / (%d+)$'
local _, _, left_durability_string, left_max_durability_string = strfind(line.left_text or '', pattern)
local _, _, right_durability_string, right_max_durability_string = strfind(line.right_text or '', pattern)
local durability = tonumber(left_durability_string) or tonumber(right_durability_string)
local max_durability = tonumber(left_max_durability_string) or tonumber(right_max_durability_string)
if durability then
return durability, max_durability
end
end
end
function public.item_key(hyperlink)
local item_id, suffix_id = public.parse_hyperlink(hyperlink)
return item_id..':'..suffix_id
+12 -11
View File
@@ -121,7 +121,7 @@ function public.on_load()
private.auction_listing = Aux.listing.CreateScrollingTable(AuxSellAuctions)
private.auction_listing:SetColInfo({
{ name='Avail', width=.14, align='CENTER' },
{ name='Auctions', width=.14, align='CENTER' },
{ name='Yours', width=.14, align='CENTER' },
{ name='Left', width=.14, align='CENTER' },
{ name='Qty', width=.08, align='CENTER' },
@@ -627,6 +627,15 @@ function private.quantity_update()
refresh = true
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 item_info.lootable
and not (durability and durability < max_durability)
end
function private.unit_vendor_price(item_key)
local inventory_iterator = Aux.util.inventory_iterator()
@@ -639,11 +648,7 @@ function private.unit_vendor_price(item_key)
local item_info = Aux.info.container_item(slot.bag, slot.bag_slot)
if item_info and item_info.item_key == item_key then
if 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 item_info.lootable
then
if private.auctionable(item_info) then
ClearCursor()
PickupContainerItem(slot.bag, slot.bag_slot)
ClickAuctionSellItemButton()
@@ -716,11 +721,7 @@ function private.update_inventory_records()
if item_info then
local charge_class = item_info.charges or 0
if 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 item_info.lootable
then
if private.auctionable(item_info) then
if not auction_candidate_map[item_info.item_key] then
local availability = { [0]=0, [1]=0, [2]=0, [3]=0, [4]=0, [5]=0 }