NetHack::Item - parse and interact with a NetHack item
version 0.21
use NetHack::Item; my $item = NetHack::Item->new("f - a wand of wishing named SWEET (0:3)" ); $item->slot # f $item->type # wand $item->specific_name # SWEET $item->charges # 3 $item->spend_charge; $item->wield; $item->buc("blessed"); $item->charges # 2 $item->is_wielded # 1 $item->is_blessed # 1 $item->is_cursed # 0
NetHack's items are complex beasts. This library attempts to control that complexity.
These are the attributes common to every NetHack item. Subclasses (e.g. Wand) may have additional attributes.
The raw string passed in to "new", to be parsed. This is the only required attribute.
The identity of the item (a string). For example, "clear potion" will be "potion of water". For artifacts, the base item is used for identity, so for "the Eye of the Aethiopica" you'll have "amulet of ESP".
The appearance of the item (a string). For example, "potion of water" will be "clear potion". For artifacts, the base item is used for appearance, so for "the Eye of the Aethiopica" you'll have "pyramidal amulet" (or any of the random appearances for amulets of ESP).
The name of the artifact, if applicable. The leading "The" is stripped (so you'll have "Eye of the Aethiopica").
The inventory or container slot in which this item resides. Obviously not applicable to items on the ground.
The item stack's quantity. Usually 1.
The amount of zorkmids that a shopkeeper is demanding for this item.
A name for this specific item, as opposed to a name for all items of this class. Artifacts use specific name.
A name for all items of this class, as opposed to a name for a specific item. Identification uses generic name.
Interesting boolean states of an item.
Boolean states about the BUC status of an item. If one returns true, the others will return false.
Returns "blessed", "cursed", "uncursed", or undef.
undef
Synonyms for "is_blessed" and "is_cursed".
Shawn M Moore, sartak@bestpractical.com
sartak@bestpractical.com
Jesse Luehrs, doy@tozt.net
doy@tozt.net
Sean Kelly, cpan@katron.org
cpan@katron.org
Stefan O'Rear, stefanor@cox.net
stefanor@cox.net
http://sartak.org/code/TAEB/
Copyright 2009-2011 Shawn M Moore.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install NetHack::Item, copy and paste the appropriate command in to your terminal.
cpanm
cpanm NetHack::Item
CPAN shell
perl -MCPAN -e shell install NetHack::Item
For more information on module installation, please visit the detailed CPAN module installation guide.