Jesse Luehrs > NetHack-Item-0.12 > NetHack::Item

Download:
NetHack-Item-0.12.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.11   Source   Latest Release: NetHack-Item-0.21

NAME ^

NetHack::Item - parse and interact with a NetHack item

VERSION ^

version 0.12

SYNOPSIS ^

    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

DESCRIPTION ^

NetHack's items are complex beasts. This library attempts to control that complexity.

ATTRIBUTES ^

These are the attributes common to every NetHack item. Subclasses (e.g. Wand) may have additional attributes.

raw

The raw string passed in to "new", to be parsed. This is the only required attribute.

identity

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".

appearance

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).

artifact

The name of the artifact, if applicable. The leading "The" is stripped (so you'll have "Eye of the Aethiopica").

slot

The inventory or container slot in which this item resides. Obviously not applicable to items on the ground.

quantity

The item stack's quantity. Usually 1.

cost

The amount of zorkmids that a shopkeeper is demanding for this item.

specific_name

A name for this specific item, as opposed to a name for all items of this class. Artifacts use specific name.

generic_name

A name for all items of this class, as opposed to a name for a specific item. Identification uses generic name.

is_wielded, is_quivered, is_greased, is_offhand

Interesting boolean states of an item.

is_blessed, is_cursed, is_uncursed

Boolean states about the BUC status of an item. If one returns true, the others will return false.

buc

Returns "blessed", "cursed", "uncursed", or undef.

is_holy, is_unholy

Synonyms for "is_blessed" and "is_cursed".

AUTHORS ^

Shawn M Moore, sartak@bestpractical.com

Jesse Luehrs, doy@tozt.net

Sean Kelly, cpan@katron.org

Stefan O'Rear, stefanor@cox.net

SEE ALSO ^

http://sartak.org/code/TAEB/

COPYRIGHT AND LICENSE ^

Copyright 2009 Shawn M Moore.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: