summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/lua/stash.lua
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/lua/stash.lua')
-rw-r--r--crawl-ref/source/lua/stash.lua52
1 files changed, 38 insertions, 14 deletions
diff --git a/crawl-ref/source/lua/stash.lua b/crawl-ref/source/lua/stash.lua
index ebdde34745..6af1178b79 100644
--- a/crawl-ref/source/lua/stash.lua
+++ b/crawl-ref/source/lua/stash.lua
@@ -1,30 +1,54 @@
---------------------------------------------------------------------------
-- stash.lua
--- Annotates items for the stash-tracker's search.
+-- Annotates items for the stash-tracker's search, and for autopickup
+-- exception matches.
--
-- To use this, add this line to your init.txt:
-- lua_file = lua/stash.lua
--
+-- Available annotations:
+-- {artefact} for identified artefacs.
+-- {ego} for identified branded items.
+-- { <skill> } - the relevant weapon skill for weapons.
+--
+-- You can optionally annotate items with the item class name (such as
+-- "weapon" for weapons) by setting
+-- annotate_item_class = true
+-- in your init.txt.
+--
+-- The full list of item class names is:
+-- gold, weapon, missile, armour, wand, food, scroll, jewelry, potion,
+-- book, staff, orb, misc, carrion
+--
+-- Item annotations are always prefixed to the item name. For instance:
+-- {artefact} the Staff of Wucad Mu
---------------------------------------------------------------------------
+local ch_annotate_item_class = nil
-- Annotate items for searches
function ch_stash_search_annotate_item(it)
- local annot = ""
+ local annot = ""
+
+ if item.artefact(it) then
+ annot = annot .. "{artefact} "
+ elseif item.branded(it) then
+ annot = annot .. "{ego} "
+ end
- if item.artifact(it) then
- annot = annot .. "{artefact} "
- elseif item.branded(it) then
- annot = annot .. "{ego} "
- elseif item.class(it, true) == "book" then
- annot = annot .. "{book} "
- end
+ local skill = item.weap_skill(it)
+ if skill then
+ annot = annot .. "{" .. skill .. "} "
+ end
- local skill = item.weap_skill(it)
- if skill then
- annot = annot .. "{" .. skill .. "} "
- end
+ if ch_annotate_item_class == nil then
+ ch_annotate_item_class = opt_boolean("annotate_item_class")
+ end
+
+ if ch_annotate_item_class then
+ annot = annot .. "{" .. item.class(it, true) .. "}"
+ end
- return annot
+ return annot
end
--- If you want dumps (.lst files) to be annotated, uncomment this line: