summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/l_item.cc
diff options
context:
space:
mode:
authorelliptic <hyperelliptical@gmail.com>2013-11-05 09:11:44 -0500
committerelliptic <hyperelliptical@gmail.com>2013-11-05 09:15:22 -0500
commit124d22f310f0a2458787eb5841ba007cb9b7b76e (patch)
treebeaf6a9e4a7188c0842afb29748614954b611d69 /crawl-ref/source/l_item.cc
parentb9975d15a484f5902e48748ad483543f2bc04152 (diff)
downloadcrawl-ref-124d22f310f0a2458787eb5841ba007cb9b7b76e.tar.gz
crawl-ref-124d22f310f0a2458787eb5841ba007cb9b7b76e.zip
Add some player-usable item lua: fully_identified, plus, plus2.
Diffstat (limited to 'crawl-ref/source/l_item.cc')
-rw-r--r--crawl-ref/source/l_item.cc55
1 files changed, 55 insertions, 0 deletions
diff --git a/crawl-ref/source/l_item.cc b/crawl-ref/source/l_item.cc
index 22df765c66..518b2ee239 100644
--- a/crawl-ref/source/l_item.cc
+++ b/crawl-ref/source/l_item.cc
@@ -633,6 +633,58 @@ IDEF(god_gift)
return 1;
}
+IDEF(fully_identified)
+{
+ if (!item || !item->defined())
+ return 0;
+
+ lua_pushboolean(ls, fully_identified(*item));
+
+ return 1;
+}
+
+IDEF(plus)
+{
+ if (!item || !item->defined())
+ return 0;
+
+ if (item_ident(*item, ISFLAG_KNOW_PLUSES)
+ && (item->base_type == OBJ_WEAPONS || item->base_type == OBJ_ARMOUR
+ || item->base_type == OBJ_WANDS
+ || item->base_type == OBJ_JEWELLERY
+ && (item->sub_type == RING_PROTECTION
+ || item->sub_type == RING_STRENGTH
+ || item->sub_type == RING_SLAYING
+ || item->sub_type == RING_EVASION
+ || item->sub_type == RING_DEXTERITY
+ || item->sub_type == RING_INTELLIGENCE)))
+ {
+ lua_pushnumber(ls, item->plus);
+ }
+ else
+ lua_pushnil(ls);
+
+ return 1;
+}
+
+IDEF(plus2)
+{
+ if (!item || !item->defined())
+ return 0;
+
+ if (item_ident(*item, ISFLAG_KNOW_PLUSES)
+ && (item->base_type == OBJ_WEAPONS
+ || item->base_type == OBJ_JEWELLERY
+ && item->sub_type == RING_SLAYING))
+ {
+ lua_pushnumber(ls, item->plus2);
+ }
+ else
+ lua_pushnil(ls);
+
+ return 1;
+}
+
// DLUA-only functions
static int l_item_do_pluses(lua_State *ls)
{
@@ -1051,6 +1103,9 @@ static ItemAccessor item_attrs[] =
{ "branded", l_item_branded },
{ "snakable", l_item_snakable },
{ "god_gift", l_item_god_gift },
+ { "fully_identified", l_item_fully_identified },
+ { "plus", l_item_plus },
+ { "plus2", l_item_plus2 },
{ "class", l_item_class },
{ "subtype", l_item_subtype },
{ "cursed", l_item_cursed },