--- LUA BLOCK
{
add_autopickup_func(function(it, name)
if it.is_useless then
return
end
if it.class(true) == "armour" then
local good_slots = {cloak="Cloak", helmet="Helmet", gloves="Gloves",
boots="Boots"}
st, _ = it.subtype()
if good_slots[st] ~= nil and items.equipped_at(good_slots[st]) == nil then
return true
end
end
end)
AUTOIDENT_SCROLL_MIN = 3
AUTOIDENT_POTION_MIN = 3
local function auto_identify()
local inv = items.inventory()
for _, it in ipairs(inv) do
if not it.fully_identified then
local letter = items.index_to_letter(it.slot)
if it.class() == "Scrolls" and it.quantity >= AUTOIDENT_SCROLL_MIN then
crawl.mpr("You have " .. AUTOIDENT_SCROLL_MIN .. " of an unidentified scroll. You should read one.")
elseif it.class() == "Potions" and it.quantity >= AUTOIDENT_POTION_MIN then
crawl.mpr("You have " .. AUTOIDENT_POTION_MIN .. " of an unidentified potion. You should quaff one.")
end
end
end
end
local function ihaveunidentified()
local inv = items.inventory()
for _, it in ipairs(inv) do
if not it.fully_identified then
return true
end
end
return false
end
local function ihaveidentify()
local inv = items.inventory()
for _, it in ipairs(inv) do
if string.find(it.name(), "dentify") then
return true
end
end
return false
end
local function ihaveidentify_at()
local inv = items.inventory()
for _, it in ipairs(inv) do
if string.find(it.name(), "dentify") then
local letter = items.index_to_letter(it.slot)
return letter
end
end
end
function ready()
if you.feel_safe() then
if not string.find(you.status(), "nable to read") then
auto_identify()
if ihaveunidentified() then
if ihaveidentify() then
crawl.mpr("You a scroll of identify and an unidentified item. Consider reading a scroll of identify at " .. ihaveidentify_at() .. ".")
end
end
end
end
end
}