function expertSell(npcname, dura) if dura == nil then dura = 100 end inventory:update() if player:openStore(npcname) then -- open store for i, item in pairs(inventory.BagSlot) do -- for each item -- Only if equipment in bags if (i > 60 + settings.profile.options.INV_AUTOSELL_FROMSLOT - 1 and 60 + settings.profile.options.INV_AUTOSELL_TOSLOT + 1 > i) and (item:isType("Weapons") or item:isType("Armor")) then -- only get tooltip if high dura local sellit = false if item.Durability > dura then local tooltip_right = item:getGameTooltip("right") -- get tooltip for i,tooltipline in pairs(tooltip_right) do if string.match(tooltipline," [IVX]+$") then -- if ends in roman numeral sellit = true break end end else sellit = true -- sell if dura is low end if sellit == true then item:use() -- sell it end end end end end