Make menu_colour_item_prefix also apply for autopickup_exceptions, so you can exclude, for example, all evil_eating at once. Fix Vampires "continuing draining" after having "stopped".
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5666 c06c8d41-db1a-0410-9941-cceddc491573
QGUV5IINCOK6AXWQ2QTZMPDJTEZPON5O565ANT2EE236I5OAPAVAC
3GBXSMNQIP63NWDR4AVYCVHFEIBWDTTLIGP5L5ZBIH3LZ6P3ANJAC
YXY47WGHSW2UMFCUOHFPGRX4LKRSFVUTWUCIOL6OTZPS3C7ZHLNAC
SXTWWMONWAVOGIYRQP6ALJLLNCDNT4NNDTE2HXCUOVP6HZ7XNXFQC
OK5VPFM4IAUPE3W75VZMR3RNXHWTOIB6QVCT6FO2GXQHXQFRACVQC
4GYZYBY7FFORRNPIEFTV4ZM2C7Z6D2KTQOM537ZCC2YBXT2TNSHAC
SSCG2FLJMUTTIRXBFSPLAUUBUIN375ZGL5UOAF3SC62ZIILSMMKAC
7YUGK5Q64KG5O7GJGTUBRRLHAHBCJ5YOE23YUPT6UBKUSB67CYAQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RREJL4WZKWFEMA62AC5G5UDTOXMW4UULIQXVA5RPFASPODMHQZ7AC
547JREUJXTZNYVGHNNAET5F5O5JYYGNTDQB6ABZNT7YX5EY64OHAC
F4F7W4Z2DEJBKPEEOKBV5364WE6N6N6OMA4N7D5ESVEGCCUCWZLAC
KX23OEQBBLMQHTFCA4TYYEGLHCETXVZCXALYR5U5RELKJMMB66SAC
3D6NWJ44UYHLZMD3BOQIWXJUEGITAVCHK6Z2WWDQONVQC4HSBRXQC
OFH2B2UZBK43QLFQBZ54FOCFLFNE54BZVDNCEUGDTBCUGNVZULIQC
NGW2XPEX2XRK3CYC37DNUZSSB5IQLECMKRB6NX257I2X3G35LMPAC
UET576SVCGS2TXEDRTO7BUTOTLJ77MYHIVZJCDWGH2BAXYMKG6DAC
57E4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z2QPVCAC
4UQBOVCMAMNCCF6PPX222H6JJO7MPYOKKC2NBKMVYIT5R5FOACNAC
ZEXKK2T26K2IMZRZCFGMD55TVH3XCV5BHZZV6WFOU5HCDR4W6U7QC
V6REAY6RCAG2QQ4BO54GHYOVTNCYHTLERJCIZJPSANXFBINZOTXAC
GPEQXXKYWFSEHRNHZENL23KWT2WWVJJG5DVFUP3LLIRGCWR7X4UAC
UWA77ZXA34J6UHPHAMFCCMP2OIPRIMGXYTEPXUU53FIRK3GZBL4QC
23476JBTNJRBK3NJD552PEZVDWO4LE5X4U7K4FWJFPZDOGN3JMLQC
E5GFDGV5XJVVDZGWFQIIZ47FGGF7AEJLGGBWRUZ34HPLNFJTNLLQC
&& !is_useless_item(item) && !is_inedible(item)
&& !is_dangerous_item(item)
#ifdef CLUA_BINDINGS
&& clua.callbooleanfn(true, "ch_autopickup", "u", &item)
#endif
|| _is_forced_autopickup(item, itemname))
&& !is_useless_item(item) && !is_inedible(item)
|| _is_forced_autopickup(item, itemname))
// Certainly not useless if it can be used for attacking.
if (is_bad_item(item))
switch (item.sub_type)
{
case POT_CONFUSION:
case POT_SLOWING:
case POT_DEGENERATION:
case POT_DECAY:
case POT_PARALYSIS:
case POT_POISON:
case POT_STRONG_POISON:
case POT_MUTATION:
// Certainly not useless if it can be used for attacking.
if (you.species == SP_GHOUL
|| you.species == SP_VAMPIRE && you.hunger_state >= HS_SATIATED)
{
switch (item.sub_type)
{
case POT_BERSERK_RAGE:
case POT_CURE_MUTATION:
case POT_GAIN_STRENGTH:
case POT_GAIN_INTELLIGENCE:
case POT_GAIN_DEXTERITY:
return (true);
}
}
// Do a second switch for the other potions.
------------------------------------------------------------
-- pickup.lua:
-- Smarter autopickup handling that takes into account the
-- item type in combination with your character's race,
-- religion, knowledge, and eating habits.
--
-- To use this, add this line to your init.txt:
-- lua_file = lua/pickup.lua
--
-- Notes:
-- * This script only handles items of classes with
-- autopickup on.
-- * Any result can still be overridden using
-- autopickup_exceptions.
------------------------------------------------------------
function make_hash(ls)
local h = { }
for _, i in ipairs(ls) do
h[i] = true
end
return h
end
return you.race() == "Mummy" or you.race() == "Ghoul"
end
-- not identified
function unknown_potion(type)
return type == 0
end
function good_potion(type)
return type == 1
end
function bad_potion(type)
return type == 2
end
-- special cases
function spec_potion(type)
return type == 3
end
function ch_autopickup(it)
local spells = make_hash( you.spells() )
if item.class(it) == "Potions" then
local type = item.potion_type(it)
-- "bad" potions only for Evaporate
if spells["Evaporate"] and bad_potion(type) then
return true
end
-- no potions for Mummies
if you.race() == "Mummy" or bad_potion(type) then
return false
end
-- pickup "good" and unID'd potions
if good_potion(type) or unknown_potion(type) then
return true
end
-- special handling
if spec_potion(type) then
if item.subtype(it) == "berserk"
return false
else
return true
end
end
-- special cases for blood, water, and porridge
if item.subtype(it) == "blood"
or item.subtype(it) == "porridge" then
return food.can_eat(it, false)
end
end
-- anything not handled until here can be picked up
return true
end
if item.class(it) == "Carrion"
or item.class(it) == "Comestibles" then
return food.can_eat(it, false)
end
end
if item.class(it) == "Jewellery" then
if item.subtype(it) == "hunger"
or item.subtype(it) == "inaccuracy" then
return false
end
(item.subtype(it) == "regeneration"
return false
end
end
-- we only get here if class autopickup ON
return true
end
or item.subtype(it) == "rage"
or item.subtype(it) == "sustenance"
and you.race() == "Mummy") then
if you_real_undead() and
if item.class(it) == "Books" and item.subtype(it) == "spellbook"
and you.god() == "Trog" then
return false
or item.subtype(it) == "water"
or item.subtype(it) == "gain ability"
if you_real_undead() then
or item.subtype(it) == "cure mutation"
or item.subtype(it) == "mutation" then
-- real undead cannot use berserk
-- or anything involving mutations
-- also: no bad potions for anyone else
-- don't count Vampires here because of all those exceptions
function you_real_undead()
# status_caption_colour = yellow
# delay_message_clear = true
# show_inventory_weights = true
# show_gold_turns = true
# show_beam = false
# status_caption_colour = yellow
# classic_hud = true
# mlist_min_height = 5
# msg_max_height = 10
# mlist_allow_alternate_layout = true
# show_gold_turns = true
# delay_message_clear = true
# show_inventory_weights = true
# list_rotten = false
# mlist_min_height = 5
# msg_max_height = 10
# mlist_allow_alternate_layout = true
# classic_hud = true
# list_rotten = false
# show_beam = false
# Excluding amulets as you only need one of each. Also for some rings.
# There is some (intended) overlap with pickup.lua, which also excludes
# the ring of hunger, for example.
# Exclude potentially useful items of high risk, like ?torment.
ae = dangerous_item
# Excluding amulets as you only need one of each. (If you know the
# subtype that means you already have one of it.) Also for some rings.
# Some items may already be excluded as bad_item, e.g. inaccuracy.
menu_colour_prefix_id = false
Setting this option to true will prefix the string against which
menu_colour regexes are matched (not the string
displayed) with the item's identification state: "unidentified"
for unidentified, "known" for wands for which you know the type
but don't know the number of charges, and for rings with plusses
for which you know the type but don't know the plus value, and
"identified" for other identified items.
Note that the prefix is put before the the *entire* string which
is displayed, so if you're wielding an uncursed dagger which has
the 'a' slot, the string the regexes will match against is
"identified a - an uncursed dagger (weapon)".
the item's object type: armour, weapon, wand, etc. If both this
option and menu_colour_prefix_id are set to true, then the
identification string comes before the object type string (i.e.,
"identified weapon", "known wand", etc).
the item's object type: armour, weapon, wand, etc.