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 and (item:isType("Weapon") 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 then item:use() -- sell it end end end end end