Allright, if you want to code a shop, all you need are three things:
1) A room that is the actual shop itself.
2) A room that stores the shop's inventory (and should be very hard or
	impossible for players to get into)
3) A shopkeeper in the shop room.  He holds all the code for the shop, so
	if he's not there, there is no shop.

The first two are coded just like normal rooms...be sure to tell the
players to talk to the shopkeeper for help.  He's very intelligent and
he'll take it from there.  If you want the shop to have a certain
"default" inventory (i.e., not just what players sell to it), put that
in the storage room code either in create() or reset() (reset is called
every 30 min.)  

VERY IMPORTANT:
the storage room MUST have the following line in its create() function:
set_property("storage room", 1);
Or its inventory will be automatically destructed after a certain time
by clean_up.

Okay.  Coding the shopkeeper himself is the hard part.  He is coded 
similarly to a monster (see /doc/build/monsters/tutorial) with a few
extra things.  

NOTE: The shopkeeper needs the line:
inherit "/std/npc_shop";
INSTEAD of:
inherit MONSTER;  or  inherit "/std/monster";

You can set anything that you could set in a normal monster
plus the following.  Note all of these appear in the create() function
along with all other monster stuff (see monster dox).

set("storage room", string where);
example: set("storage room", "/wizards/diewarzau/rooms/storage");

This tells the shopkeeper what room is the storage room, and therefore
where to put his stuff.


set("no sell", 1);

Setting the above will cause the shopkeeper not to accept items sold to
him by players.  This is useful when coding a specialty shop like a 
restaurant or mage supply shop, etc.

set("pre sell function", function pre_sell);
example: set("pre sell function", (: this_object(), "pre_sell" :) );

If you set the above, the function 'pre_sell' will be called every
time a player sells something to the shopkeeper.  If the funtion
returns a 0, the shopkeeper will buy the object.  If it returns a
string, the shopkeeper will say the string and then refuse to buy the
object.  For instance in the above example, you would define the
following function in the shopkeeper file if you want him to buy only
weapons:

string pre_sell(object item) {
  if(!item->is_weapon()) return "I only buy weapons.";
  return 0;
}


set("markup", int percent);
example: set("markup", 150);

Sets the percent markup of the store.  The shopkeeper will mark the 
value of anything in his inventory up by the specified percent.  If
you want a super cheap store, negative markups are supported.


A note about languages:
Note that a shopkeeper actually SPEAKS with players, meaning that
if he doesn't know the language the character wishes to use, they cannot
transact business.  All shopkeepers are automatically fluent in common,
but you may want to give them other languages.  They will always try to
talk to the player in the language he or she is currently speaking.
If you want to give your shopkeeper an extra language use:

set_lang_prof(string lang, int prof);
example: set_lang_prof("elvish", 10);
10 is the highest level a language can go.  The shopkeeper probably
needs at least 8 if he wants to be able to transact business effectively.

NOTE:  The shopkeeper carries support for saving both his inventory and
his money over reboots, though this ability is usually reserved for 
shops owned by players, which will be coded later.  If you have a good case
for wanting your shop to do this, mail me (Diewarzau), and I'll get back to
you with how to do that.
