dw_fluffos_v2/
dw_fluffos_v2/fluffos-2.9-ds2.05/
dw_fluffos_v2/fluffos-2.9-ds2.05/ChangeLog.old/
dw_fluffos_v2/fluffos-2.9-ds2.05/Win32/
dw_fluffos_v2/fluffos-2.9-ds2.05/compat/
dw_fluffos_v2/fluffos-2.9-ds2.05/compat/simuls/
dw_fluffos_v2/fluffos-2.9-ds2.05/include/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/clone/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/command/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/data/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/etc/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/include/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/inherit/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/inherit/master/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/log/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/single/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/single/tests/compiler/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/single/tests/efuns/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/single/tests/operators/
dw_fluffos_v2/fluffos-2.9-ds2.05/testsuite/u/
dw_fluffos_v2/fluffos-2.9-ds2.05/tmp/
dw_fluffos_v2/fluffos-2.9-ds2.05/windows/
dw_fluffos_v2/lib/
dw_fluffos_v2/lib/binaries/cmds/
dw_fluffos_v2/lib/binaries/cmds/creator/
dw_fluffos_v2/lib/binaries/cmds/living/
dw_fluffos_v2/lib/binaries/cmds/player/
dw_fluffos_v2/lib/binaries/d/admin/obj/
dw_fluffos_v2/lib/binaries/d/liaison/
dw_fluffos_v2/lib/binaries/global/virtual/
dw_fluffos_v2/lib/binaries/global/virtual/setup_compiler/
dw_fluffos_v2/lib/binaries/obj/handlers/autodoc/
dw_fluffos_v2/lib/binaries/obj/handlers/terrain_things/
dw_fluffos_v2/lib/binaries/obj/misc/
dw_fluffos_v2/lib/binaries/obj/misc/buckets/
dw_fluffos_v2/lib/binaries/obj/monster/
dw_fluffos_v2/lib/binaries/obj/reactions/
dw_fluffos_v2/lib/binaries/obj/reagents/
dw_fluffos_v2/lib/binaries/secure/cmds/creator/
dw_fluffos_v2/lib/binaries/secure/master/
dw_fluffos_v2/lib/binaries/std/
dw_fluffos_v2/lib/binaries/std/dom/
dw_fluffos_v2/lib/binaries/std/effects/object/
dw_fluffos_v2/lib/binaries/std/guilds/
dw_fluffos_v2/lib/binaries/std/languages/
dw_fluffos_v2/lib/binaries/std/races/
dw_fluffos_v2/lib/binaries/std/room/
dw_fluffos_v2/lib/binaries/std/room/basic/
dw_fluffos_v2/lib/binaries/std/shops/
dw_fluffos_v2/lib/binaries/std/shops/inherit/
dw_fluffos_v2/lib/binaries/www/
dw_fluffos_v2/lib/cmds/guild-race/
dw_fluffos_v2/lib/cmds/guild-race/crafts/
dw_fluffos_v2/lib/cmds/guild-race/other/
dw_fluffos_v2/lib/cmds/playtester/
dw_fluffos_v2/lib/cmds/playtester/senior/
dw_fluffos_v2/lib/d/admin/
dw_fluffos_v2/lib/d/admin/log/
dw_fluffos_v2/lib/d/admin/mapper/31-10-01/mapmaker/event/
dw_fluffos_v2/lib/d/admin/meetings/
dw_fluffos_v2/lib/d/admin/obj/
dw_fluffos_v2/lib/d/admin/room/we_care/
dw_fluffos_v2/lib/d/admin/save/
dw_fluffos_v2/lib/d/dist/
dw_fluffos_v2/lib/d/dist/mtf/
dw_fluffos_v2/lib/d/dist/pumpkin/
dw_fluffos_v2/lib/d/dist/pumpkin/chars/
dw_fluffos_v2/lib/d/dist/pumpkin/desert/
dw_fluffos_v2/lib/d/dist/pumpkin/gumboot/
dw_fluffos_v2/lib/d/dist/pumpkin/hospital/
dw_fluffos_v2/lib/d/dist/pumpkin/inherit/
dw_fluffos_v2/lib/d/dist/pumpkin/map/
dw_fluffos_v2/lib/d/dist/pumpkin/plain/
dw_fluffos_v2/lib/d/dist/pumpkin/pumpkin/
dw_fluffos_v2/lib/d/dist/pumpkin/save/
dw_fluffos_v2/lib/d/dist/pumpkin/squash/
dw_fluffos_v2/lib/d/dist/pumpkin/terrain/
dw_fluffos_v2/lib/d/dist/pumpkin/woods/
dw_fluffos_v2/lib/d/dist/start/
dw_fluffos_v2/lib/d/learning/TinyTown/buildings/
dw_fluffos_v2/lib/d/learning/TinyTown/map/
dw_fluffos_v2/lib/d/learning/TinyTown/roads/
dw_fluffos_v2/lib/d/learning/add_command/
dw_fluffos_v2/lib/d/learning/arms_and_weps/
dw_fluffos_v2/lib/d/learning/chars/
dw_fluffos_v2/lib/d/learning/cutnpaste/
dw_fluffos_v2/lib/d/learning/examples/npcs/
dw_fluffos_v2/lib/d/learning/examples/player_houses/npcs/
dw_fluffos_v2/lib/d/learning/examples/terrain_map/basic/
dw_fluffos_v2/lib/d/learning/functions/
dw_fluffos_v2/lib/d/learning/handlers/
dw_fluffos_v2/lib/d/learning/help_topics/npcs/
dw_fluffos_v2/lib/d/learning/help_topics/objects/
dw_fluffos_v2/lib/d/learning/help_topics/rcs_demo/
dw_fluffos_v2/lib/d/learning/help_topics/rooms/
dw_fluffos_v2/lib/d/learning/help_topics/rooms/crowd/
dw_fluffos_v2/lib/d/learning/help_topics/rooms/situations/
dw_fluffos_v2/lib/d/learning/items/
dw_fluffos_v2/lib/d/learning/save/
dw_fluffos_v2/lib/d/liaison/
dw_fluffos_v2/lib/d/liaison/NEWBIE/doc/
dw_fluffos_v2/lib/d/liaison/NEWBIE/save/oldlog/
dw_fluffos_v2/lib/db/
dw_fluffos_v2/lib/doc/
dw_fluffos_v2/lib/doc/creator/
dw_fluffos_v2/lib/doc/creator/autodoc/include/reaction/
dw_fluffos_v2/lib/doc/creator/autodoc/include/ritual_system/
dw_fluffos_v2/lib/doc/creator/autodoc/include/talker/
dw_fluffos_v2/lib/doc/creator/autodoc/include/terrain_map/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/baggage/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/clock/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/clothing/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/cont_save/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/corpse/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/money/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/monster/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/scabbard/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/service_provider/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/state_changer/
dw_fluffos_v2/lib/doc/creator/autodoc/obj/wand/
dw_fluffos_v2/lib/doc/creator/autodoc/std/book_dir/
dw_fluffos_v2/lib/doc/creator/autodoc/std/key/
dw_fluffos_v2/lib/doc/creator/autodoc/std/learning/
dw_fluffos_v2/lib/doc/creator/autodoc/std/map/
dw_fluffos_v2/lib/doc/creator/autodoc/std/race/
dw_fluffos_v2/lib/doc/creator/autodoc/std/weapon_logic/
dw_fluffos_v2/lib/doc/creator/files/
dw_fluffos_v2/lib/doc/creator/policy/
dw_fluffos_v2/lib/doc/creator/room/
dw_fluffos_v2/lib/doc/effects/
dw_fluffos_v2/lib/doc/ideas/
dw_fluffos_v2/lib/doc/known_command/
dw_fluffos_v2/lib/doc/lpc/basic_manual/
dw_fluffos_v2/lib/doc/lpc/intermediate/
dw_fluffos_v2/lib/doc/new/add_command/
dw_fluffos_v2/lib/doc/new/handlers/
dw_fluffos_v2/lib/doc/new/living/
dw_fluffos_v2/lib/doc/new/living/race/
dw_fluffos_v2/lib/doc/new/living/spells/
dw_fluffos_v2/lib/doc/new/player/
dw_fluffos_v2/lib/doc/new/room/guild/
dw_fluffos_v2/lib/doc/new/room/outside/
dw_fluffos_v2/lib/doc/new/room/storeroom/
dw_fluffos_v2/lib/doc/object/
dw_fluffos_v2/lib/doc/playtesters/
dw_fluffos_v2/lib/doc/policy/
dw_fluffos_v2/lib/doc/weapons/
dw_fluffos_v2/lib/global/handlers/
dw_fluffos_v2/lib/global/virtual/setup_compiler/
dw_fluffos_v2/lib/include/
dw_fluffos_v2/lib/include/cmds/
dw_fluffos_v2/lib/include/effects/
dw_fluffos_v2/lib/include/npc/
dw_fluffos_v2/lib/include/shops/
dw_fluffos_v2/lib/net/daemon/chars/
dw_fluffos_v2/lib/net/inherit/
dw_fluffos_v2/lib/net/intermud3/
dw_fluffos_v2/lib/net/intermud3/services/
dw_fluffos_v2/lib/net/obj/
dw_fluffos_v2/lib/net/save/
dw_fluffos_v2/lib/net/smnmp/
dw_fluffos_v2/lib/net/snmp/
dw_fluffos_v2/lib/obj/amulets/
dw_fluffos_v2/lib/obj/b_day/
dw_fluffos_v2/lib/obj/examples/
dw_fluffos_v2/lib/obj/food/alcohol/
dw_fluffos_v2/lib/obj/food/chocolates/
dw_fluffos_v2/lib/obj/food/fruits/
dw_fluffos_v2/lib/obj/food/meat/
dw_fluffos_v2/lib/obj/food/nuts/
dw_fluffos_v2/lib/obj/food/seafood/
dw_fluffos_v2/lib/obj/food/vegetables/
dw_fluffos_v2/lib/obj/fungi/
dw_fluffos_v2/lib/obj/furnitures/artwork/
dw_fluffos_v2/lib/obj/furnitures/bathroom/
dw_fluffos_v2/lib/obj/furnitures/beds/
dw_fluffos_v2/lib/obj/furnitures/cabinets/
dw_fluffos_v2/lib/obj/furnitures/chairs/
dw_fluffos_v2/lib/obj/furnitures/chests/
dw_fluffos_v2/lib/obj/furnitures/clocks/
dw_fluffos_v2/lib/obj/furnitures/crockery/
dw_fluffos_v2/lib/obj/furnitures/cupboards/
dw_fluffos_v2/lib/obj/furnitures/cushions/
dw_fluffos_v2/lib/obj/furnitures/fake_plants/
dw_fluffos_v2/lib/obj/furnitures/lamps/
dw_fluffos_v2/lib/obj/furnitures/mirrors/
dw_fluffos_v2/lib/obj/furnitures/outdoor/
dw_fluffos_v2/lib/obj/furnitures/safes/
dw_fluffos_v2/lib/obj/furnitures/shelves/
dw_fluffos_v2/lib/obj/furnitures/sideboards/
dw_fluffos_v2/lib/obj/furnitures/sofas/
dw_fluffos_v2/lib/obj/furnitures/stoves/
dw_fluffos_v2/lib/obj/furnitures/tables/
dw_fluffos_v2/lib/obj/furnitures/wardrobes/
dw_fluffos_v2/lib/obj/handlers/
dw_fluffos_v2/lib/obj/handlers/autodoc/
dw_fluffos_v2/lib/obj/jewellery/anklets/
dw_fluffos_v2/lib/obj/jewellery/bracelets/
dw_fluffos_v2/lib/obj/jewellery/earrings/
dw_fluffos_v2/lib/obj/jewellery/misc/
dw_fluffos_v2/lib/obj/jewellery/necklaces/
dw_fluffos_v2/lib/obj/jewellery/rings/
dw_fluffos_v2/lib/obj/media/
dw_fluffos_v2/lib/obj/misc/buckets/
dw_fluffos_v2/lib/obj/misc/jars/
dw_fluffos_v2/lib/obj/misc/papers/
dw_fluffos_v2/lib/obj/misc/player_shop/
dw_fluffos_v2/lib/obj/misc/shops/
dw_fluffos_v2/lib/obj/misc/traps/
dw_fluffos_v2/lib/obj/monster/
dw_fluffos_v2/lib/obj/monster/godmother/
dw_fluffos_v2/lib/obj/monster/transport/
dw_fluffos_v2/lib/obj/plants/inherit/
dw_fluffos_v2/lib/obj/potions/
dw_fluffos_v2/lib/open/boards/
dw_fluffos_v2/lib/save/autodoc/
dw_fluffos_v2/lib/save/bank_accounts/
dw_fluffos_v2/lib/save/boards/frog/
dw_fluffos_v2/lib/save/books/bed_catalog/
dw_fluffos_v2/lib/save/creators/
dw_fluffos_v2/lib/save/mail/
dw_fluffos_v2/lib/save/mail/p/
dw_fluffos_v2/lib/save/soul/data/
dw_fluffos_v2/lib/save/tasks/
dw_fluffos_v2/lib/save/vaults/
dw_fluffos_v2/lib/secure/cmds/lord/
dw_fluffos_v2/lib/secure/config/
dw_fluffos_v2/lib/secure/items/
dw_fluffos_v2/lib/secure/player/
dw_fluffos_v2/lib/soul/
dw_fluffos_v2/lib/soul/i/
dw_fluffos_v2/lib/soul/j/
dw_fluffos_v2/lib/soul/k/
dw_fluffos_v2/lib/soul/o/
dw_fluffos_v2/lib/soul/q/
dw_fluffos_v2/lib/soul/to_approve/
dw_fluffos_v2/lib/soul/u/
dw_fluffos_v2/lib/soul/v/
dw_fluffos_v2/lib/soul/wish_list/
dw_fluffos_v2/lib/soul/y/
dw_fluffos_v2/lib/soul/z/
dw_fluffos_v2/lib/std/creator/
dw_fluffos_v2/lib/std/effects/
dw_fluffos_v2/lib/std/effects/attached/
dw_fluffos_v2/lib/std/effects/external/
dw_fluffos_v2/lib/std/effects/fighting/
dw_fluffos_v2/lib/std/effects/other/
dw_fluffos_v2/lib/std/environ/
dw_fluffos_v2/lib/std/guilds/
dw_fluffos_v2/lib/std/hospital/
dw_fluffos_v2/lib/std/house/
dw_fluffos_v2/lib/std/house/onebedhouse/
dw_fluffos_v2/lib/std/house/onebedhut/
dw_fluffos_v2/lib/std/house/tworoomflat/
dw_fluffos_v2/lib/std/languages/
dw_fluffos_v2/lib/std/liquids/
dw_fluffos_v2/lib/std/nationality/
dw_fluffos_v2/lib/std/nationality/accents/
dw_fluffos_v2/lib/std/nationality/accents/national/
dw_fluffos_v2/lib/std/nationality/accents/regional/
dw_fluffos_v2/lib/std/npc/goals/
dw_fluffos_v2/lib/std/npc/goals/basic/
dw_fluffos_v2/lib/std/npc/goals/misc/
dw_fluffos_v2/lib/std/npc/inherit/
dw_fluffos_v2/lib/std/npc/plans/
dw_fluffos_v2/lib/std/npc/plans/basic/
dw_fluffos_v2/lib/std/outsides/
dw_fluffos_v2/lib/std/races/shadows/
dw_fluffos_v2/lib/std/room/basic/topography/
dw_fluffos_v2/lib/std/room/controller/
dw_fluffos_v2/lib/std/room/controller/topography/
dw_fluffos_v2/lib/std/room/furniture/games/
dw_fluffos_v2/lib/std/room/furniture/inherit/
dw_fluffos_v2/lib/std/room/inherit/carriage/
dw_fluffos_v2/lib/std/room/inherit/topography/
dw_fluffos_v2/lib/std/room/punishments/
dw_fluffos_v2/lib/std/room/topography/area/
dw_fluffos_v2/lib/std/room/topography/iroom/
dw_fluffos_v2/lib/std/room/topography/milestone/
dw_fluffos_v2/lib/std/shadows/
dw_fluffos_v2/lib/std/shadows/attached/
dw_fluffos_v2/lib/std/shadows/curses/
dw_fluffos_v2/lib/std/shadows/disease/
dw_fluffos_v2/lib/std/shadows/fighting/
dw_fluffos_v2/lib/std/shadows/room/
dw_fluffos_v2/lib/std/shops/controllers/
dw_fluffos_v2/lib/std/shops/objs/
dw_fluffos_v2/lib/std/shops/player_shop/
dw_fluffos_v2/lib/std/shops/player_shop/office_code/
dw_fluffos_v2/lib/std/socket/
dw_fluffos_v2/lib/www/
dw_fluffos_v2/lib/www/external/autodoc/
dw_fluffos_v2/lib/www/external/java/telnet/Documentation/
dw_fluffos_v2/lib/www/external/java/telnet/Documentation/images/
dw_fluffos_v2/lib/www/external/java/telnet/examples/
dw_fluffos_v2/lib/www/external/java/telnet/tools/
dw_fluffos_v2/lib/www/pics/
dw_fluffos_v2/lib/www/secure/creator/
dw_fluffos_v2/lib/www/secure/editors/
dw_fluffos_v2/lib/www/secure/survey_results/
dw_fluffos_v2/win32/
/*  -*- LPC -*-  */
/*
 * $Locker:  $
 * $Id: peddler.c,v 1.33 2003/04/23 09:36:04 runtime Exp $
 *
 */
/**
 * This is the peddler object, it acts as a walking talking item
 * shop.
 * Added event_enter so to stop food from decaying when the peddler
 * sells it. Siel, October 2001
 *
 */
#include <armoury.h>
#include <money.h>
#include <move_failures.h>
#include <virtual.h>

#define MAX_PROP "max per reset"
#define TYPE "item shop type"
#define NUM_SOLD "number removed this reset"
#define DISPLAY "display in shop"

inherit "/obj/monster";
inherit "/std/shops/inherit/clone_on_demand";

private string _none_left_mess;
private string _out_of_item_mess;
private string _show_item_mess;
private string _missing_punter_mess;
private string _dont_sell_mess;
private string _all_out_mess;
private string _list_mess;
private string _list_item_mess;
private string _no_stock_mess;
private string _too_poor_mess;
private string _too_heavy_mess;
private string _in_combat_mess;
private string _busy_mess;
private int busy;

void create() {

    _none_left_mess      = "I'm afraid I don't have any of those.";
    _out_of_item_mess    = "We are right out of $item$.";
    _show_item_mess      = "$item$ is priced at $cost$.  Let me show it to "
        "you.";
    _missing_punter_mess = "Hey... Where'd the fellow go?  Anyway...";
    _dont_sell_mess      = "I'm afraid I don't have any $item$.";
    _all_out_mess        = "I'm afraid I have no $item$ left.";
    _list_mess           = "I have the following items for sale:";
    _list_item_mess      = "I have $num_left$ $display$ for $cost$.";
    _no_stock_mess       = "I am afraid I have nothing for sale.";
    _too_poor_mess       = "I'm afraid you can't afford to buy $item$.";
    _too_heavy_mess      = "Well, here's $item$, but you can't carry it at "
        "the moment.  I'll put it on the floor.";
    _in_combat_mess      = "Can't you see I'm a bit preoccupied right "
                           "now?";
    _busy_mess           = "Sorry, I can only handle one purchase at a "
                           "time!" ;
    monster::create();

} /* create() */


/** @ignore yes */
void init() {
    object cont = query_cont();

    ::init();
    if( cont ) {
        this_player()->add_command( "browse", this_object(),
                                "<indirect:object:" + file_name(cont) +
                                "> {from|of} <direct:living:here>" );
        this_player()->add_command( "buy", this_object(),
                                "<indirect:object:" + file_name(cont) +
                                "> from <direct:living:here>" );
        this_player()->add_command( "list", this_object(),
                                "goods {from|of} <direct:living:here>" );
    }

} /* init() */


/** @ignore yes */
void check_cont() {
    object cont;
    ::check_cont();
    cont = query_cont();
    cont->set_name( "peddler_store" );
} /* check_cont() */


/**
 * This method returns the cost of the specified item to the buyer.
 * @param thing the thing to cost
 * @param buyer who is buying it
 * @return the cost of the item
 */
int query_cost( object thing, object buyer ) {

   if( thing->query_property("cost here") ) {
        return (int)thing->query_property("cost here");
    }
    else {
       return (int)thing->query_value_at( this_object() );
    }

} /* query_cost() */


/**
 * This method returns the costs of the item as a string.
 * @param thing the thing to buy
 * @param place the money area it is being bought in
 * @param buyer the person who is buying the object
 * @return the string money value
 */
string cost_string( object thing, string place, object buyer ) {
    return (string)MONEY_HAND->money_value_string(
        query_cost( thing, buyer ), place );
} /* cost_string() */


/**
 * The main entrace to the browse for things command.
 * @return 1 on success, 0 on failure
 */
int do_browse( mixed indirect_obs, string dir_match, string indir_match,
    string *words ) {

    int num_left;
    int i;
    string place;
    object *things;
    string custom_string;

    if( this_object()->query_fighting() ) {
        queue_command( "sayto " + file_name(this_player()) + " " +
            _in_combat_mess, 2 );
        this_player()->add_succeeded_mess( this_object(), "$N ask$s $D "
            "about browsing an item.\n", ({ }) );
        return 1;
    }

    place = query_property( "place" );
    if ( !place || ( place == "" ) ) {
        place = "default";
    }
    check_cont();
    things = indirect_obs;
    if( !sizeof( things ) ) {
        queue_command( "sayto " + file_name(this_player()) + " " +
            _none_left_mess, 2 );
    }
    else {
        for ( i = 0; i < sizeof( things ); i++ ) {
            num_left = things[i]->query_property( MAX_PROP ) -
                things[i]->query_property( NUM_SOLD );
            if (num_left <= 0) {
                custom_string = replace( _out_of_item_mess, ({
                    "$item$", things[i]->one_short()
                }) );
                queue_command( "sayto " + file_name(this_player()) +
                    custom_string);
                continue;
            }

            custom_string = replace( _show_item_mess, ({
                "$item$", "$C$" +
                    strip_colours((string)things[i]->the_short()),
                "$cost$", cost_string( things[i], place,
                    this_player() )
            }) );
            queue_command( "sayto " + file_name(this_player()) + " " +
                custom_string, 4 * i + 2 );

            // Added in by Oaf 11/99 - peddler doesn't have item in
            // inventory, so just tell the player the long() of the item.
            queue_command( "whisper " +
                things[i]->one_short()+":\n"+things[i]->long() + " to " +
                file_name(this_player()) );

            /*
            init_command("show " + things[i]->query_name() + " to " +
                this_player()->query_name(), 4*i+3);
            */
            /*
            call_out("show_it", 4*i+3, evaluate(things[i]->the_short()),
                evaluate(things[ i ]->long()));
            */
        }
    }

    this_player()->add_succeeded_mess( this_object(), "$N ask$s $D "
        "about "+ query_multiple_short(things) +".\n", ({ }) );
    return 1;

} /* do_browse() */


/**
 * This method shows the object in question to the player.
 * @param short the short description
 * @param long the long description
void show_it(string short, string long){
    if(environment(this_player()) != environment(this_object())){
        queue_command("'" + _missing_punter_mess);
        return;
    }
    tell_room(environment(this_object()), capitalize(evaluate(the_short()))+
        " shows "+this_player()->the_short()+" "+short+ ".\n");
    tell_object(this_player(), long);

} * show_it() */

/**
 * The main entrace to the buy things command.
 * @return 1 on success, 0 on failure
 */
int do_buy( mixed indirect_obs, string dir_match, string indir_match,
      string *words ) {

    int i, num_left;
    object *things;
    string custom_string;

    if(busy) {
      do_command("'" + _busy_mess);
      this_player()->add_succeeded_mess( this_object(), "$N confuse$s "
                     "$D, who is busy making business.\n", ({ }));
      return 1;
    }
    busy = 1;

    check_cont();
    things = indirect_obs;

    if ( !sizeof( things ) ) {
        custom_string = replace( _dont_sell_mess, ({
            "$item$", indir_match
        }) );
        queue_command( "sayto " + file_name(this_player()) + " " +
            custom_string);
    }
    else {
        if( this_object()->query_fighting() ) {
           queue_command( "sayto " + file_name(this_player()) + " " +
                          _in_combat_mess, 2 );
           this_player()->add_succeeded_mess( this_object(), "$N ask$s $D "
               "about buying "+ query_multiple_short(things) +".\n", ({ }) );
           busy = 0;
           return 1;
        }

        for ( i = 0; i < sizeof( things ); ++i ) {
            num_left = (int)things[ i ]->query_property( MAX_PROP ) -
                (int)things[ i ]->query_property( NUM_SOLD );
            if ( num_left < 1 ) {
                custom_string = replace( _all_out_mess, ({
                    "$item$", strip_colours((string)things[i]->query_plural())
                }) );
                init_command( "sayto " + file_name(this_player()) + " " +
                    custom_string, 2 * i + 2 );
                busy = 0;
                continue;
            }

            call_out( "sell_thing", 2 * i, this_player(), things[ i ] );
        }
    }

    this_player()->add_succeeded_mess( this_object(), "$N ask$s $D "
        "about buying "+ query_multiple_short(things) +".\n", ({ }) );
    return 1;

} /* do_buy() */


/**
 * The main entrace to the list stuff command.
 * @return 1 on success, 0 on failure
 */
int do_list() {
    int num_left;
    string place;
    object thing;
    int first;
    object cont;
    string display;
    string custom_string;

    if( this_object()->query_fighting() ) {
        queue_command( "sayto " + file_name(this_player()) + " " +
            _in_combat_mess, 2 );
        this_player()->add_succeeded_mess( this_object(), "" );
        return 1;
    }

    place = query_property( "place" );

    if ( !place || ( place == "" ) ) {
        place = "default";
    }

    check_cont();
    cont = query_cont();

    thing = first_inventory( cont );
    first = 1;

    while ( thing ) {
        num_left = (int)thing->query_property( MAX_PROP ) -
            (int)thing->query_property( NUM_SOLD );
        if ( num_left < 1 ) {
            thing = next_inventory( thing );
            continue;
        }
        if (first) {
            queue_command( "sayto " + file_name(this_player()) + " " +
                _list_mess);
            first = 0;
        }

        /* Make it use the display property added with add_object, if it
            exists.  Else use the short.  Pluralize if neccessary */
        display = (string)thing->query_property( DISPLAY );


        if ( !stringp( display )  && thing->short()) {
            if( num_left > 1 ) {
                display = (string)thing->query_plural();
            }
            else {
                display = (string)thing->a_short();
            }
        }
        else {
            if( num_left > 1 ) {
                display = pluralize( display );
            }
        }

        custom_string = replace( _list_item_mess, ({
            "$num_left$", (num_left > 1 ? query_num (num_left) : ""),
//            "$num_left$", query_num (num_left),
            "$display$", display,
            "$cost$", cost_string( thing, place, this_player() ) +
                 (num_left > 1 ? " each" : "" )
        }) );

        queue_command( "sayto " + file_name( this_player() ) +
                    " " + custom_string );
        thing = next_inventory( thing );
    }

    if ( first ) {
        queue_command( "say " + _no_stock_mess);
    }

    this_player()->add_succeeded_mess( this_object(), "" );
    return 1;

} /* do_list() */


/**
 * The main entrace to the sell stuff command.
 * @return 1 on success, 0 on failure
 */
void sell_thing( object player, object thing ) {
    int value;
    string item_name, place;
    object copy;
    string custom_string;

    if ( !player ) {
        busy = 0;
        return;
    }
    if ( environment( player ) != environment( this_object() ) ) {
        busy = 0;
        return;
    }
    if ( !thing ) {
        busy = 0;
        return;
    }

    place = query_property( "place" );
    if ( !place || ( place == "" ) ) {
        place = "default";
    }

    value = (int)player->query_value_in( place );
    if ( place != "default" ) {
        value += (int)player->query_value_in( "default" );
    }

    // Make sure we are making a cost based on the non-cloned object.
    if ( (int)this_object()->query_cost( thing, player ) > value ) {
        custom_string = replace( _too_poor_mess, ({
            "$item$", (string)thing->a_short()
        }) );
        queue_command( "sayto " + file_name(player) + " " +
                       custom_string );
        busy = 0;
        return;
    }

    // So the copy is only made if the item is actually sold.
    copy = (object)this_object()->create_real_object( thing );
    if ( !copy ) {
        switch ( (string)thing->query_property( TYPE ) ) {
            case "armour" :
            case "weapon" :
            case "armoury item":
                copy = ARMOURY->request_item( item_name,
                    80 + random( 20 ) );
                break;
            case "object" :
                copy = clone_object( item_name );
                break;
        }
    }
    if ( !copy ) {
        copy = clone_object( explode( file_name( thing ), "#" )[ 0 ] );
    }
    if ( !copy ) {
        busy = 0;
        return;
    }

    thing->add_property( NUM_SOLD, (int)thing->query_property( NUM_SOLD ) +
        1 );
    player->pay_money( (mixed *)MONEY_HAND->create_money_array(
        (int)this_object()->query_cost( copy, player ), place ), place );
    tell_object( player, "You pay "+ the_short() +" "+
        cost_string( copy, place, player ) +".\n" );
    tell_room( environment(), (string)player->one_short() +
        " gives "+ the_short() +" some money.\n", player );

    if ( (int)copy->move( player ) != MOVE_OK ) {
        custom_string = replace( _too_heavy_mess, ({
            "$item$", (string)copy->the_short()
        }) );
        queue_command( "sayto " + file_name(player) + " " + custom_string );
        copy->move( environment() );
        queue_command( ":puts "+ (string)copy->a_short() +" on the ground." );
    }
    else {
        tell_room( environment(), the_short() +" gives "+
            (string)player->one_short() +" "+ (string)copy->a_short() +
            ".\n" );
    }
    busy = 0;

} /* sell_thing() */

void event_enter(object ob, string mess, object from) {
    if (ob->query_food_object()) { ob->set_decay_speed(0); }
} /* event_enter() */


void event_exit(object ob, string message, object to) {
    if (ob->query_food_object()) { ob->set_decay_speed(8000); }
} /* event_exit() */


void dest_me() {
  if(query_cont())
    log_file("PEDDLER", "Cont: %s\n", file_name(query_cont()));
    clone_on_demand::dest_me();
    monster::dest_me();
} /* dest_me() */


/* CHAT OVERRIDE FUNCTIONS, Dasquian 8/7/02 */


/**
 * Overrides the default reply to having none left
 * @param s the chat to replace the default with
 */
void set_none_left_mess(string s) {
    _none_left_mess = s;
} /* set_none_left_mess() */

/**
 * Overrides the default chat of being out of an item that is browsed
 * @param s the chat to replace the default with.  Must include $item$, which
 * will be replaced by the item short.
 */
void set_out_of_item_mess(string s) {
    _out_of_item_mess = s;
} /* set_out_of_item_mess() */

/**
 * Overrides the default chat of showing an item to a player
 * @param s the chat to replace the default with.  Must include $item$ and
 * $cost$, which will be replaced by the item short and the cost of the item
 * respectively.
 */
void set_show_item_mess(string s) {
    _show_item_mess = s;
} /* set_show_item_mess() */

/**
 * Overrides the default chat to the player having wandered off
 * @param s the chat to replace the default with
 */
void set_missing_punter_mess(string s) {
    _missing_punter_mess = s;
} /* set_missing_punter_mess() */

/**
 * Overrides the default chat of the peddler not selling an item
 * @param s the chat to replace the default with.  Must include $item$, which
 * will be replaced by the item short.
 */
void set_dont_sell_mess(string s) {
    _dont_sell_mess = s;
} /* set_dont_sell_mess() */

/**
 * Overrides the default chat of the item being out of stock when a player
 * tries to buy it
 * @param s the chat to replace the default with.  Must include $item$, which
 * will be replaced by the item short.
 */
void set_all_out_mess(string s) {
    _all_out_mess = s;
} /* set_all_out_mess() */

/**
 * Overrides the default chat to announcing the stock list
 * @param s the chat to replace the default with
 */
void set_list_mess(string s) {
    _list_mess = s;
} /* set_list_mess() */

/**
 * Overrides the default chat of listing a stock item's price and stock
 * @param s the chat to replace the default with.  Must include $num_left$,
 * $display$ and $cost$, which will be replaced by the appropriate
 * strings.
 */
void set_list_item_mess(string s) {
    _list_item_mess = s;
} /* set_list_item_mess() */

/**
 * Overrides the default reply to having no listable stock
 * @param s the chat to replace the default with
 */
void set_no_stock_mess(string s) {
    _no_stock_mess = s;
} /* set_no_stock_mess() */

/**
 * Overrides the default chat of the player being too poor to buy an item
 * @param s the chat to replace the default with.  Must include $item$, which
 * will be replaced by the item short.
 */
void set_too_poor_mess(string s) {
    _too_poor_mess = s;
} /* set_too_poor_mess() */

/**
 * Overrides the default chat of the player being too burdened to carry an
 * item
 * @param s the chat to replace the default with.  Must include $item$, which
 * will be replaced by the item short.
 */
void set_too_heavy_mess(string s) {
    _too_heavy_mess = s;
} /* set_too_heavy_mess() */

/**
 * Overrides the default chat of the peddler being in combat and hence unable
 * to sell his wares!
 * @param s the chat to replace the default with
 */
void set_in_combat_mess(string s) {
    _in_combat_mess = s;
} /* set_in_combat_mess() */

/**
 * Overrides the default chat of the peddler being busy selling
 * something already.
 * @param s the chat to replace the default with
 */
void set_busy_mess(string s) {
    _busy_mess = s;
} /* set_busy_mess() */