function sellItem(item)
-----------------------------------
-- NORMAL ITEMS --
-----------------------------------
if item.quality == ItemQuality.Normal then
-----------------------------------
-- SUPERIOR ITEMS --
-----------------------------------
elseif item.quality == ItemQuality.Superior then
-----------------------------------
-- MAGIC ITEMS --
-----------------------------------
elseif item.quality == ItemQuality.Magic then
-----------------------------------
-- SET ITEMS --
-----------------------------------
elseif item.quality == ItemQuality.Set then
-----------------------------------
-- RARE ITEMS --
-----------------------------------
elseif item.quality == ItemQuality.Rare then
if item.flags.Identified == true then
-- Circlets
if item.baseItem.type == ItemType.Circlet then
-- +2 Class skills or +2 specific skill tab
if checkModStatType(item, ClassSkillsBonus) >= 2 or checkModStatType(item, SkillTabBonus) >= 2 then
return false
end
end
end
return true
-----------------------------------
-- UNIQUE ITEMS --
-----------------------------------
elseif item.quality == ItemQuality.Unique then
-----------------------------------
-- CRAFTED ITEMS --
-----------------------------------
elseif item.quality == ItemQuality.Crafted then
-----------------------------------
-- MISC ITEMS --
-----------------------------------
-- Items like gems, runes and potions fall under Misc
else
end
return false
end
-- checkModStatType
-- Checks modName against item.mods[].Stat.Type
-- Ex: checkModStatType(item, ClassSkillsBonus)
function checkModStatType(item, modName)
for i = 0, item.mods:size() - 1 do
if item.mods[i].Stat.Type == StatType.modName
return item.mods[i].Value
end
end
return -1
end