consumable
index
/home/thindil/Projekty/anaria/server/lib/pymodules/consumable.py

consumable.py
 
Consumable item type. By default, implements edible and drinkable. Allows
players to add new consumable types, and subtypes (liquor, water, juice, ...?).
Comes with OLC object interface.
 
This module has been designed to allow for easy addition of a potion/pill
system. When an item is consumed, consume hooks are run (in addition to eat
and drink hooks). Magical affects can piggyback on to this, in addition to
other special things like extracting depleted flasks.

 
Modules
       
auxiliary
hooks
mud
mudsock
mudsys
olc
storage
utils

 
Classes
       
ConsumableData

 
class ConsumableData
    Data for Consumables. Contains a type (food, drink), a subtype (liquor,
water, juice), a maximum number of consumptions, and a current number
of consumptions.
 
  Methods defined here:
__init__(self, set=None)
copy(self)
copyTo(self, to)
store(self)

Data and other attributes defined here:
__item_type__ = 'consumable'

 
Functions
       
__obj_isConsumeType__(obj, type)
Return whether the object is consumable, and of the specified type
of consumable.
__unload__()
remove all hooks.
cmd_drink(ch, cmd, arg)
Allows a player to sip a drinkable object they are carrying, or
are around.
cmd_eat(ch, cmd, arg)
Allows players to eat food they are carrying.
cmd_empty(ch, cmd, arg)
Empty out the liquids in a drink consumable.
cmd_fill(ch, cmd, arg)
Attempt to fill one drinkable source with liquid from another.
consolc_chooser(sock, data, option)
figure out what field we want to edit, and display a prompt
consolc_menu(sock, data)
display our menu interface
consolc_parser(sock, data, choice, arg)
parse out what we want to change a specified field to
consolc_to_proto(data)
return a script that will generate relevant info to create this item
consumable_desc_info(info)
appends consumable information about an object to the description
buffer when a person looks at it.
get_consume_dflt(type)
get the default subtype for a consumable
get_consume_subtypes(type)
list all subtypes for a consumable
get_consume_types()
list all consumable types
is_consume_subtype(type, subtype)
return whether subtype is a registered subtype for type
is_consume_type(type)
return whether type is a registered consumable type
register_consume_subtype(type, subtype)
create a new subtype for the specified consumable type
register_consume_type(type, dflt_subtype='unknown')
create a new consumable type, and add a default subtype

 
Data
        __CONSOLC_MAX_USES__ = 3
__CONSOLC_SUBTYPE__ = 2
__CONSOLC_TYPE__ = 1
__CONSOLC_USES__ = 4
consolc_opt_map = {'1': (1, 'Wybierz typ: '), '2': (2, 'Wybierz podtyp: '), '3': (3, 'Wprowad\xc5\xba maksymaln\xc4\x85 liczb\xc4\x99 u\xc5\xbcy\xc4\x87: '), '4': (4, 'Wprowad\xc5\xba ile razy by\xc5\x82 ju\xc5\xbc u\xc5\xbcyty: ')}
ctype_dflt = {'drinkable': 'wod\xc4\x99', 'edible': 'pieczywo', 'fuel': 'olej'}
ctype_map = {'drinkable': ['wod\xc4\x99', 'wino', 'piwo'], 'edible': ['pieczywo', 'jarzyna', 'mi\xc4\x99so'], 'fuel': ['olej']}