area/
build/testing/
log/
player/
player/backup/
/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/
#include <glib.h>

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <merc.h>
#include <tables.h>
#include <interp.h>
#include <olc.h>


char    last_command[MAX_STRING_LENGTH];

bool	check_xsocial	args( ( CHAR_DATA *ch, char *command,
	char *argument ) );
void	make_preg	args( ( CHAR_DATA *mother, CHAR_DATA *father ) );
extern void    show_fm	  	args( ( CHAR_DATA *ch, char argument[MAX_STRING_LENGTH] ) );
extern void write_to_snooper args(( DESCRIPTOR_DATA *d, GString *output));

/*
 * Command logging types.
 */
#define LOG_NORMAL	0
#define LOG_ALWAYS	1
#define LOG_NEVER	2



/*
 * Log-all switch.
 */
bool				fLogAll		= FALSE;



/*
 * Command table.
 */
const	struct	cmd_type	cmd_table	[] =
{
    /*
     * Common movement commands.
     */
	
    { "p",	    do_powers,	POS_FIGHTING,	 3,  LOG_NORMAL	}, //This is to allow P = Powers to come first.. lazy people :P
    { "north",	do_north,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "east",	do_east,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "south",	do_south,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "west",	do_west,	POS_STANDING,	 0,  LOG_NORMAL },
	{ "up",		do_up,		POS_STANDING,	 0,  LOG_NORMAL },
	{ "down",	do_down,	POS_STANDING,	 0,  LOG_NORMAL },
	
    /*
     * Common other commands.
     * Placed here so one and two letter abbreviations work.
     */
	{ "buy",	do_buy,		POS_SITTING,	 0,  LOG_NORMAL	},
	{ "cast",	do_cast,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "immreport",	do_area_report,	POS_STANDING,	 12,  LOG_NORMAL	},
	{ "crack",	do_crack,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "diagnose",	do_diagnose,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "dismount",	do_dismount,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "enter",	do_enter,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "exits",	do_exits,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "get",	do_get,		POS_SITTING,	 0,  LOG_NORMAL	},
	
	{ "inventory",	do_inventory,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "ignore",	do_ignore,	POS_DEAD, 	 0,  LOG_NORMAL	},
	{ "kill",	do_kill,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "look",	do_look,	POS_MEDITATING,	 0,  LOG_NORMAL	},
    /* OLC Command, Due to it won't run if not after meditate */
	{ "medit",	do_medit,	POS_DEAD,    9,	 LOG_NORMAL },
	{ "mpedit",	do_mpedit,	POS_DEAD,   10,	 LOG_NORMAL },
	
	{ "meditate",	do_meditate,	POS_MEDITATING,	 0,  LOG_NORMAL	},
	{ "mount",	do_mount,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "order",	do_order,	POS_SITTING,	 2,  LOG_NORMAL	},
	{ "rest",	do_rest,	POS_MEDITATING,	 0,  LOG_NORMAL	},
	{ "sit",	do_sit,		POS_SITTING,	 0,  LOG_NORMAL	},
	{ "stand",	do_stand,	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "tell",	do_tell,	POS_MEDITATING,	 0,  LOG_NORMAL	},
	{ "whisper",	do_whisper,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "wield",	do_wear,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "wizhelp",	do_wizhelp,	POS_DEAD,	 7,  LOG_NORMAL	},
     /* { "version",	do_version,	POS_DEAD,	 0,  LOG_NORMAL	},
      * { "donate",     do_donate,	POS_SITTING,	 0,  LOG_NORMAL	},*/
	
    /*
     * Informational commands.
     */
	{ "affects",	do_affects,     POS_DEAD,	 0,  LOG_NORMAL	},
	{ "anondesc",	do_anon_desc,	POS_SITTING,	 2,  LOG_NORMAL },
	{ "areas",	do_areas,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "avatar",	do_avatar,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "bug",	do_bug,		POS_DEAD,	 0,  LOG_NORMAL	},
	{ "chop",	do_chop,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "claw",	do_spclaw,	POS_STANDING,	3,  LOG_ALWAYS },
	{ "commands",	do_commands,	POS_DEAD,	 0,  LOG_NORMAL },
	{ "compare",	do_compare,	POS_SITTING,	 0,  LOG_NORMAL },
	{ "consider",	do_consider,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "cook",	do_cook,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "credits",	do_credits,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "demeanor",	do_demeanor,	POS_DEAD,	 2,  LOG_NORMAL },
	{ "dissolve",	do_dissolve,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "equipment",	do_equipment,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "examine",	do_examine,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "filet",	do_filet,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "grenown",	do_give_renown,	POS_STANDING,	3,  LOG_NORMAL },
	{ "help",	do_help,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "introduce",	do_introduce,	POS_STANDING,	 1,  LOG_NORMAL	},
	{ "level",      do_skillall,    POS_DEAD,        0,  LOG_NORMAL },
	{ "makefire",	do_make_fire,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "nature",	do_nature,	POS_DEAD,	 2,  LOG_NORMAL },
	{ "penrenown",	do_penalty_renown,POS_STANDING,	3,  LOG_NORMAL },
	{ "permrenown",	do_perm_renown,	POS_STANDING,	3,  LOG_NORMAL },
	{ "pet",	    do_pet,	    POS_DEAD,	 0,  LOG_NORMAL	},
	{ "petdrink",	do_petdrink,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "petfeed",	do_petfeed,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "petscore",	do_petscore,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "pettrain",	do_pettrain,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "powers",	do_powers,	POS_FIGHTING,	 3,  LOG_NORMAL },
	{ "report",	do_report,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "roompose",	do_roompose,	POS_DEAD,	 2,  LOG_NORMAL },
	{ "rpflag",	do_flag_rp,	POS_DEAD,	 2,  LOG_NORMAL },
	{ "score",	do_score,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "skill",	do_skillall,	POS_DEAD,      	 0,  LOG_NORMAL },
	{ "skillz",     do_skillz,      POS_DEAD,        0,  LOG_NORMAL },
	{ "socials",	do_socials,	POS_DEAD,	 0,  LOG_NORMAL },
	{ "spells",	do_spell,	POS_DEAD,      	 0,  LOG_NORMAL },
	{ "stats",      do_skillall,    POS_DEAD,        0,  LOG_NORMAL },
	{ "time",	do_time,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "typo",	do_typo,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "vote",	do_vote,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "wash",	do_wash,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "weapon",	do_skillall,	POS_DEAD,      	 0,  LOG_NORMAL },
	{ "weather",	do_weather,	POS_SITTING,	 1,  LOG_NORMAL	},
	{ "who",	do_who,		POS_DEAD,	 0,  LOG_NORMAL	},
	{ "wizlist",	do_wizlist,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "xsocial",	do_huh,		POS_DEAD,	 2,  LOG_NORMAL },
	{ "xsocials",	do_xsocials,	POS_DEAD,	 2,  LOG_NORMAL },
	
    /*
     * Configuration commands.
     */
	{ "alignment",	do_alignment,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "alia",	do_alia,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "alias",	do_alias,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "antitribu",	do_antitribu,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "unalias",	do_unalias,	POS_DEAD,	 0,  LOG_NORMAL	},
        { "prefi",      do_prefi, 	POS_DEAD,	11,  LOG_NORMAL	},
        { "prefix",     do_prefix, 	POS_DEAD,	11,  LOG_NORMAL	},
	{ "channels",	do_channels,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "config",	do_config,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "mudconfig",	do_mud_config,	POS_DEAD,	 12,  LOG_NORMAL	},
	{ "auto",	do_config,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "description",do_description,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "password",	do_password,	POS_DEAD,	 0,  LOG_NEVER	},
	{ "title",	do_title,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "wimpy",	do_wimpy,	POS_DEAD,	 0,  LOG_NORMAL	},
	
	{ "ansi",	do_ansi,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "color",	do_ansi,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "autoexit",	do_autoexit,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "autoloot",	do_autoloot,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "autosac",	do_autosac,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "autoprotect", do_autoprotect,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "autostance",	do_autostance,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "blank",	do_blank,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "brief",	do_brief,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "cprompt",	do_cprompt,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "prompt",	do_prompt,	POS_DEAD,	 0,  LOG_NORMAL	},
	
    /*
     * Communication commands.
     */
	{ "answer",	do_answer,	POS_SLEEPING,	 0,  LOG_NORMAL },
	{ "cgossip",	do_cgossip,	POS_DEAD,    	 1,  LOG_NORMAL },  
	{ "chat",	do_chat,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ ".",		do_chat,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "emote",	do_xemote,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ ",",		do_xemote,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "email",	do_email,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "gtell",	do_gtell,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ ";",		do_gtell,	POS_DEAD,	 0,  LOG_NORMAL	},
     /* { "howl",	do_howl,	POS_DEAD,	 3,  LOG_NORMAL	}, */
	{ "music",	do_music,	POS_SLEEPING,	 0,  LOG_NORMAL },
	{ "note",	do_note,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "pose",	do_emote,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "mspoff",	do_mspoff,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "quest",	do_quest,	POS_SITTING,	 2,  LOG_ALWAYS	},
	{ "aquest",	do_askquest,	POS_SITTING,	 2,  LOG_NORMAL	},
	{ "question",	do_question,	POS_SLEEPING,	 0,  LOG_NORMAL },
	{ "reply",	do_reply,	POS_MEDITATING,	 0,  LOG_NORMAL },
	{ "say",	do_say,		POS_MEDITATING,	 0,  LOG_NORMAL	},
	{ "speak",	do_speak,	POS_MEDITATING,	 0,  LOG_NORMAL	},
	{ "'",		do_say,		POS_MEDITATING,	 0,  LOG_NORMAL	},
	{ "shout",	do_shout,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "yell",	do_yell,	POS_SITTING,	 0,  LOG_NORMAL	},
	
	//{ "change",	do_change,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "board",	do_board,	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "read",	do_read,	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "unread",     do_board,	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "greet",	do_greet,	POS_STANDING,	 2,  LOG_NORMAL	},
    /*
     * Object manipulation commands.
     */
	{ "activate",	do_activate,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "brandish",	do_brandish,	POS_SITTING,	 12, LOG_NORMAL	},
	{ "close",	do_close,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "draw",	do_draw,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "drink",	do_drink,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "drop",	do_drop,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "eat",	do_eat,		POS_SITTING,	 0,  LOG_NORMAL	},
	{ "empty",	do_empty,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "fill",	do_fill,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "give",	do_give,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "hold",	do_wear,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "list",	do_list,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "lock",	do_lock,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "morph",	do_morph,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "open",	do_open,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "pick",	do_pick,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "press",	do_press,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "pull",	do_pull,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "put",	do_put,		POS_SITTING,	 0,  LOG_NORMAL },
	{ "quaff",	do_quaff,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "recite",	do_recite,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "remove",	do_remove,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "sell",	do_sell,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "sheath",	do_sheath,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "take",	do_get,		POS_SITTING,	 0,  LOG_NORMAL	},
	{ "reload",	do_reload,	POS_STANDING,	 4,  LOG_NORMAL	},
	{ "unload",	do_unload,	POS_STANDING,	 4,  LOG_NORMAL	},
	{ "read",	do_read,	POS_DEAD,      	 0,  LOG_NORMAL	},
	{ "shoot",	do_shoot,	POS_STANDING,	 4,  LOG_NORMAL	},
	{ "throw",	do_throw,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "turn",	do_turn,	POS_MEDITATING,	 0,  LOG_NORMAL	},
	{ "twist",	do_twist,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "sacrifice",	do_sacrifice,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "unlock",	do_unlock,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "value",	do_value,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "wear",	do_wear,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "write",	do_write,	POS_MEDITATING,	 0,  LOG_NORMAL	},
	{ "voodoo",	do_voodoo,	POS_SITTING,	 3,  LOG_NORMAL	},
	{ "zap",	do_zap,		POS_SITTING,	 12, LOG_NORMAL	},
	
	{ "howl",	do_howl,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "secttalk",	do_secttalk,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "killme",	do_killme,	POS_DEAD,	 2,  LOG_NORMAL	},
	{ "wraith",	do_wraith,	POS_DEAD,	 2,  LOG_NORMAL	},
	
    /*
     * Combat commands.
     */
	{ "backstab",	do_backstab,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "bash",		do_bash,	POS_FIGHTING,	 2,  LOG_NORMAL	},
	{ "berserk",	do_berserk,	POS_FIGHTING,	 2,  LOG_NORMAL	},
	{ "bs",		do_backstab,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "disarm",	do_disarm,	POS_FIGHTING,	 2,  LOG_NORMAL	},
	{ "flee",	do_flee,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "fightstyle",	do_fightstyle,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "hurl",	do_hurl,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "kick",	do_kick,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "punch",	do_punch,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "stomp",	do_stomp,	POS_FIGHTING,	 3,  LOG_NORMAL	},
	{ "rescue",	do_rescue,	POS_FIGHTING,	 2,  LOG_NORMAL	},
	{ "stance",	do_stance,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "surrender",	do_surrender,	POS_FIGHTING,    4,  LOG_NORMAL	},	
	
	/*
	* Mob command interpreter (placed here for faster scan...)
	*/
	{ "mob",	do_mob,	POS_DEAD,	 0,  LOG_NEVER  },
	
/*
     * Miscellaneous commands.
     */
	{ "accep",	do_huh,		POS_STANDING,	 2,  LOG_NORMAL	},
	{ "logou",	do_huh,		POS_STANDING,	 2,  LOG_NORMAL	},
	{ "accept",	do_accept,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "artifact",	do_artifact,	POS_DEAD,    	 3,  LOG_NORMAL	},
	{ "birth",	do_birth,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "blindfold",	do_blindfold,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "breaku",	do_huh,		POS_STANDING,	 2,  LOG_NORMAL	},
	{ "breakup",	do_breakup,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "call",	do_call,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "claim",	do_claim,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "complete",	do_complete,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "consen",	do_huh,		POS_STANDING,	 1,  LOG_NORMAL	},
	{ "consent",	do_consent,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "delet",  	do_delet,  	POS_STANDING,	 0,  LOG_ALWAYS	},
	{ "delete", 	do_delete, 	POS_DEAD,    	 9,  LOG_ALWAYS	},
	{ "finger",	do_finger,	POS_DEAD,        0,  LOG_NORMAL	},
	{ "follow",	do_follow,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "gag",	do_gag,		POS_STANDING,	 3,  LOG_NORMAL	},
	{ "gift",	do_gift,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "group",	do_group,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "hide",	do_hide,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "home",	do_home,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "mobhunt",	do_mob_hunt,	POS_STANDING,	10,  LOG_NORMAL	},
	{ "locate",	do_locate,	POS_DEAD,    	 0,  LOG_NORMAL	},
	{ "practice",	do_practice,	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "propos",	do_huh,		POS_STANDING,	 2,  LOG_NORMAL	},
	{ "propose",	do_propose,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "garou",  do_garou,  	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "hunter", do_hunter,  	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "qui",	do_qui,		POS_DEAD,	 0,  LOG_NORMAL	},
	{ "quit",	do_quit,	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "ooc",	do_ooc, 	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "logout",	do_quit,	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "recall",	do_recall,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "escape",	do_escape,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "/",		do_recall,	POS_FIGHTING,	 0,  LOG_NORMAL	},
	{ "recharge",	do_recharge,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "rent",	do_rent,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "safe",	do_safe,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "save",	do_save,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "pbackup",	do_pbackup,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "saferoom",	do_safe_room,	POS_STANDING,	 7,  LOG_NORMAL	},
	{ "sleep",	do_sleep,	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "smother",	do_smother,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "sneak",	do_sneak,	POS_STANDING,	 0,  LOG_NORMAL	},
	{ "split",	do_split,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "scan",	do_scan,	POS_SITTING,	 0,  LOG_NORMAL	},
	{ "spy",	do_spy,		POS_SITTING,	 0,  LOG_NORMAL	},
	{ "steal",	do_steal,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "summon",	do_summon,	POS_DEAD,	 0,  LOG_NORMAL	},
	{ "tie",	do_tie,		POS_STANDING,	 3,  LOG_NORMAL	},
	{ "token",	do_token,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "track",	do_track,	POS_STANDING,	 2,  LOG_NORMAL	},
	{ "train",	do_train,	POS_SITTING,	 0,  LOG_NORMAL	},
  	{ "trait",	do_trait,	POS_SITTING,	 2,  LOG_NORMAL	},
	{ "untie",	do_untie,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "visible",	do_visible,	POS_SLEEPING,	 0,  LOG_NORMAL },
	{ "wake",	do_wake,	POS_SLEEPING,	 0,  LOG_NORMAL	},
	{ "where",	do_where,	POS_SITTING,	 7,  LOG_NORMAL	},
	{ "tag",       	do_tag,         POS_STANDING,    2,  LOG_NORMAL	},
	{ "notag",      do_notag,       POS_STANDING,    2,  LOG_NORMAL	},
    /*
     * Vampire and Werewolf commands.
     */
	{ "anarch",	do_anarch,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "bite",	do_bite,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "clanname",	do_clanname,	POS_STANDING,	 3,  LOG_ALWAYS	},
	{ "favour",	do_favour,	POS_SITTING,	 3,  LOG_NORMAL	},
	{ "feed",	do_feed,	POS_SITTING,	 3,  LOG_NORMAL	},
	{ "inconnu",	do_inconnu,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "induct",	do_induct,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "pray",	do_pray,	POS_MEDITATING,	 3,  LOG_NORMAL	},
	{ "readaura",	do_readaura,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "regenerate",	do_regenerate,	POS_SLEEPING,	 3,  LOG_NORMAL	},
	{ "stake",	do_stake,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "scry",	do_scry,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "sidestep",do_sidestep,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "teach",	do_teach,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "teachgift",	do_teachgift,	POS_STANDING,	 3,  LOG_NORMAL },
	{ "learngift",	do_learn_gift,	POS_STANDING,	 3,  LOG_NORMAL },
	{ "learndisc",	do_learndisc,	POS_STANDING,	 3,  LOG_NORMAL },
	{ "tribe",	do_tribe,	POS_SITTING,	 3,  LOG_NORMAL	},
	{ "upkeep",	do_upkeep,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "vclan",	do_vclan,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "for",	do_for,		POS_DEAD,	10,  LOG_ALWAYS	},
	{ "force",	do_force,	POS_DEAD,	 9,  LOG_ALWAYS	},
		      /*
        * Mage Commands
        */
	
	
	{ "sphereaffects",do_sphereaffects,POS_DEAD,     3,  LOG_NORMAL	},
	{ "mage", 	do_mage, 	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "create",	do_create,	POS_STANDING,	 8,  LOG_NORMAL	},
	{ "focistat", 	do_focistat, 	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "unmist",	do_unmist,	POS_STANDING,	 3,  LOG_NORMAL	},
	{ "tcaern",	do_tap_caern, POS_STANDING,  3,  LOG_NORMAL	},



    /*
     * Spiral WWF commands
     */
	{ "gstat",	do_garou_status, POS_RESTING,	 3,  LOG_NORMAL	},
	{ "shapeshift",	do_shapeshift,   POS_FIGHTING,	 3,  LOG_NORMAL	},
	{ "breed",	chbreed_form,   POS_DEAD,	 3,  LOG_NORMAL	},
	
	
    /*
     * Immortal commands.
     */
	{ "aaxe",	aslan_axe,	POS_DEAD,	12,  LOG_ALWAYS },
    { "chomp",	do_chomp,	POS_DEAD,	10,  LOG_ALWAYS },
    { "trust",	do_trust,	POS_DEAD,	11,  LOG_ALWAYS },
	{ "allow",	do_allow,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "ban",	do_ban,		POS_DEAD,	10,  LOG_ALWAYS	},
	{ "permban",	do_permban,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "bind",	do_bind,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "deny",	do_deny,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "disconnect",	do_disconnect,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "divorce",	do_divorce,	POS_DEAD,	 7,  LOG_ALWAYS	},
 /*	{ "fcommand",	do_fcommand,	POS_STANDING,	10,  LOG_NORMAL	},*/
 /*     { "fileupdate",	do_fileupdate,	POS_DEAD,	12,  LOG_ALWAYS	},*/
	{ "freeze",	do_freeze,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "marry",	do_marry,	POS_DEAD,	 7,  LOG_ALWAYS	},
	{ "omni",	do_omni,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "listskills",	do_list_skills,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "fvlist",	do_fvlist,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "vlist",	do_vlist,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "qset",	do_qset,	POS_DEAD,	 9,  LOG_ALWAYS	},
	{ "qstat",	do_qstat,	POS_DEAD,	 9,  LOG_ALWAYS	},
	{ "map",	do_map,		POS_DEAD,	10,  LOG_NORMAL	},
	{ "style",	do_style,	POS_DEAD,	 2,  LOG_NORMAL	},
	{ "qtrust",	do_qtrust,	POS_DEAD,	11,  LOG_ALWAYS	},
	{ "ntrust",	do_ntrust,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "reboo",	do_reboo,	POS_DEAD,	11,  LOG_NORMAL	},
	{ "reboot",	do_reboot,	POS_DEAD,	11,  LOG_ALWAYS	},
	{ "spiralbow",	do_spiralbow,	POS_DEAD,	11,  LOG_NORMAL	},
	{ "shutdow",	do_shutdow,	POS_DEAD,	11,  LOG_NORMAL	},
	{ "shutdown",	do_shutdown,	POS_DEAD,	11,  LOG_ALWAYS	},
	{ "copyove",	do_huh, 	POS_DEAD,	10,  LOG_NORMAL	},
	{ "copyover",	do_copyover,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "autocopy",	do_autocopy,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "sockets",	do_users,	POS_DEAD,	 8,  LOG_NORMAL	},
	{ "users",	do_newusers,	POS_DEAD,	 8,  LOG_NORMAL	},
	{ "wizlock",	do_wizlock,	POS_DEAD,	11,  LOG_ALWAYS	},
	{ "wiznet",	do_wiznet,	POS_DEAD,	7,  LOG_ALWAYS	},
	{ "watche",	do_huh,		POS_DEAD,	 2,  LOG_NEVER	},
	{ "watcher",	do_watcher,	POS_DEAD,	 2,  LOG_NEVER	},
	{ "listoo",	do_list_oowners,	POS_DEAD,	 8,  LOG_NEVER	},
	
	{ "mload",	do_mload,	POS_DEAD,	 8,  LOG_ALWAYS	},
	{ "mset",	do_mset,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "cset",	do_cset,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "noemote",	do_noemote,	POS_DEAD,	 9,  LOG_NORMAL	},
	{ "notell",	do_notell,	POS_DEAD,	 9,  LOG_NORMAL	},
	{ "showspecial",do_showspecial,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "oclone",	do_oclone,	POS_DEAD,	 9,  LOG_ALWAYS	},
	{ "oload",	do_oload,	POS_DEAD,	 9,  LOG_ALWAYS	},
	{ "oset",	do_oset,	POS_DEAD,	 9,  LOG_ALWAYS	},
	{ "otransfer",	do_otransfer,	POS_DEAD,	 9,  LOG_ALWAYS	},
	{ "planewalk",	do_planewalk,	POS_DEAD,	 7,  LOG_ALWAYS	},
	{ "pload",	do_pload,	POS_DEAD,	12,  LOG_ALWAYS	},
	{ "preturn",	do_preturn,	POS_DEAD,	 2,  LOG_NORMAL	},
	{ "pset",	do_pset,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "purge",	do_purge,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "qmake",	do_qmake,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "release",	do_release,	POS_DEAD,	 9,  LOG_ALWAYS	},
	{ "restore",	do_restore,	POS_DEAD,	 8,  LOG_ALWAYS	},
	{ "rset",	do_rset,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "silence",	do_silence,	POS_DEAD,	10,  LOG_NORMAL },
	//{ "silent",	do_silent,	POS_DEAD,	 3,  LOG_NORMAL },
	{ "sla",	do_sla,	        POS_DEAD,	10,  LOG_NORMAL	},
	{ "slay",	do_slay,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "spc",	do_spc,	        POS_DEAD,	10,  LOG_NORMAL	},
	{ "special",	do_special,	POS_DEAD,	10,  LOG_ALWAYS	},
	{ "decapitate",	do_decapitate,	POS_STANDING,	 3,  LOG_ALWAYS	},
	{ "diablerize",	do_diablerize,	POS_STANDING,	 3,  LOG_ALWAYS	},
	{ "sset",	do_sset,	POS_DEAD,	10,  LOG_ALWAYS },
	{ "tear",	do_tear,	POS_STANDING,	 3,  LOG_ALWAYS	},
	{ "transfer",	do_transfer,	POS_DEAD,	 7,  LOG_ALWAYS	},
	{ "makepet",	do_makepet,	POS_DEAD,	11,  LOG_NORMAL	},
	
	{ "transport",	do_transport,	POS_DEAD,	 0,  LOG_NORMAL	},
	
	{ "at",		do_at,		POS_DEAD,	 7,  LOG_NORMAL	},
	{ "baname",	do_bad_name, POS_DEAD,	 8,  LOG_NORMAL	},
	{ "bamfin",	do_bamfin,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "bamfout",	do_bamfout,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "check",	do_check,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "checkld", do_checkld,	POS_DEAD,	 9,  LOG_NEVER	},
	{ "echo",	do_echo,	POS_DEAD,	 9,  LOG_ALWAYS	},
	{ "goto",	do_goto,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "holylight",	do_holylight,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "incog",     	do_incog,       POS_DEAD,        7,  LOG_NORMAL },
	{ "invis",	do_invis,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "log",	do_log,		POS_DEAD,	11,  LOG_ALWAYS	},
	{ "memory",	do_memory,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "newmem",	do_newmem,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "mfind",	do_mfind,	POS_DEAD,	 8,  LOG_NORMAL },
	{ "mstat",	do_mstat,	POS_DEAD,	 8,  LOG_NORMAL	},
	{ "mwhere",	do_mwhere,	POS_DEAD,	 8,  LOG_NORMAL },
	{ "mxpecho",do_mxpecho,	POS_DEAD,	11,  LOG_ALWAYS	},
	{ "ofind",	do_ofind,	POS_DEAD,	 9,  LOG_NORMAL },
	{ "ostat",	do_ostat,	POS_DEAD,	 8,  LOG_NORMAL	},
	{ "oswitch",	do_oswitch,	POS_DEAD,	 9,  LOG_NORMAL	},
	{ "oreturn",	do_oreturn,	POS_DEAD,	 9,  LOG_NORMAL	},
	{ "peace",	do_peace,	POS_DEAD,	 8,  LOG_NORMAL	},
	{ "recho",	do_recho,	POS_DEAD,	 8,  LOG_NORMAL	},
	{ "return",	do_return,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "rstat",	do_rstat,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "slookup",	do_slookup,	POS_DEAD,	 9,  LOG_NORMAL },
	{ "snoop",	do_snoop,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "switch",	do_switch,	POS_DEAD,	 7,  LOG_ALWAYS	},
	{ "showfight",	do_showfight,	POS_DEAD,	 11,  LOG_ALWAYS	},
	
	{ "vamptalk",	do_vamptalk,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "magetalk",	do_magetalk,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "vtalk",	do_vamptalk,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ ">",		do_vamptalk,	POS_DEAD,	 3,  LOG_NORMAL	},
	{ "vampire",	do_vampire,	POS_STANDING,	 0,  LOG_NORMAL	},
	//{ "immune",     do_immune,	POS_DEAD,	 0,  LOG_NORMAL	},
	//{ "[",		do_fcommand,	POS_SITTING,	 3,  LOG_NORMAL	},
	
	{ "immtalk",	do_immtalk,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "immstake",	do_imm_stake,	POS_DEAD,	 12,  LOG_NORMAL	},
	{ "playwave",	do_playwave,	POS_DEAD,	10,  LOG_NORMAL	},
	{ "outfit",	do_outfit,	POS_DEAD,	 7,  LOG_ALWAYS	},
	{ "info",	do_info,	POS_DEAD,	 9,  LOG_NORMAL	},
	{ ":",		do_immtalk,	POS_DEAD,	 7,  LOG_NORMAL	},
	{ "mpdump",	do_mpdump,	POS_DEAD,	10,  LOG_NEVER		},
	{ "mpstat",	do_mpstat,	POS_DEAD,	10,  LOG_NEVER		},
	{ "clear",	do_clear,	POS_DEAD,	7,  LOG_NORMAL		},
	
    /*
     * OLC
     */
	{ "edit",	do_olc,		POS_DEAD,   9,  LOG_NORMAL },
	{ "asave",      do_asave,	POS_DEAD,   9,  LOG_NORMAL },
	{ "alist",	do_alist,	POS_DEAD,   9,  LOG_NORMAL },
	{ "resets",	do_resets,	POS_DEAD,   9,  LOG_NORMAL },
	{ "redit",	do_redit,	POS_DEAD,   9,	 LOG_NORMAL },
	{ "aedit",	do_aedit,	POS_DEAD,   9,  LOG_NORMAL },
	{ "oedit",	do_oedit,	POS_DEAD,   9,  LOG_NORMAL },
	{ "hedit",	do_hedit,	POS_DEAD,   9,  LOG_NORMAL },
	
    //Games
    { "slots",	do_slots,	POS_STANDING,   1,  LOG_NORMAL },
	{ "highdice",	do_high_dice,	POS_STANDING,  1,  LOG_NORMAL },
	
    /*
     * End of list.
     */
	{ "",		0,		POS_DEAD,	 0,  LOG_NORMAL	}
};




/*
 * The main entry point for executing commands.
 * Can be recursively called from 'at', 'order', 'force'.
 */
void interpret( CHAR_DATA *ch, char *argument )
{
	/*  ROOMTEXT_DATA *rt;
	    char kavirarg[MAX_INPUT_LENGTH]; */
	char arg[MAX_STRING_LENGTH];
	char buf[MAX_STRING_LENGTH];
	char fight_buf[MSL];
	GString *buffer;
	char argu[MAX_STRING_LENGTH];
	char command[MAX_STRING_LENGTH];
	char logline[MAX_STRING_LENGTH];
	int cmd;
	int trust;
	bool found;
	char cmd_copy[MAX_INPUT_LENGTH] ;

	if (!IS_NPC(ch) && ch->fighting != NULL){
		sprintf(fight_buf,"@%s@COMMAND: %s",ch->name->str,argument);
		show_fm(ch,fight_buf);
	}

	sprintf(argu,"%s %s",arg,one_argument( argument, arg));

	/*
	 * Strip leading spaces.
	 */
	while ( isspace(*argument) )
		argument++;
	if ( argument[0] == '\0' )
		return;

	/*
	 * No hiding.
	 REMOVE_BIT( ch->affected_by, AFF_HIDE );
	 */

	/*
	 * Implement freeze command.
	 */
	if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_FREEZE) )
	{
		send_to_char( "You're totally frozen!\n\r", ch );
		return;
	}
	else if (number_percent() <= 10 && IS_SET(ch->added, ADDED_CALM))
	{
		send_to_char( "You really can't be bothered.\n\r", ch );
		return;
	}



	/*
	 * Grab the command word.
	 * Special parsing so ' can be a command,
	 *   also no spaces needed after punctuation.
	 */
	str_cpy(cmd_copy, argument);
	str_cpy( logline, argument );
	/*Lets see who is doing what? -Ferric*/
	str_cpy( buf, argument);
	if (!IS_NPC(ch))
		sprintf(last_command,"%s in room[%d]: %s.",ch->name->str,
				ch->in_room->vnum,
				buf);

	if ( !isalpha(argument[0]) && !isdigit(argument[0]) )
	{
		command[0] = argument[0];
		command[1] = '\0';
		argument++;
		while ( isspace(*argument) )
			argument++;
	}
	else
	{
		argument = one_argument( argument, command );
	}

	/*
	 * Look for command in command table.
	 */
	found = FALSE;
	trust = get_trust( ch );
	for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ )
	{
		if ( command[0] == cmd_table[cmd].name[0]
				&&   !str_prefix( command, cmd_table[cmd].name )
				&&   cmd_table[cmd].level <= trust )
		{
			if (ch->plane == PLANE_DEAD && !IS_IMMORTAL(ch))
			{
				if      (!str_cmp( cmd_table[cmd].name, "killme"  )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "wraith"  )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "note"  )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "board"  )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "help"    )) found = TRUE;
				else {
					send_to_char( "You are dead! You must type KILLME or Wraith to continue\n\r", ch ); return; }
			}

			if (ch->plane == PLANE_PUNISHMENT && !IS_IMMORTAL(ch))
			{
				if      (!str_cmp( cmd_table[cmd].name, "say"  )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "help"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "quit"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "up"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "down"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "north"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "west"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "east"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "south"    )) found = TRUE;
				else {
					send_to_char( "Umm Your being Punished... You can't do that\n\r", ch ); return; }
			}
	
			if (IS_HEAD(ch,LOST_HEAD) || IS_EXTRA(ch,EXTRA_OSWITCH) )
			{
				if      (!str_cmp( cmd_table[cmd].name, "say"     )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "'"       )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "immtalk" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, ":"       )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "chat"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "."       )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "look"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "save"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "exits"   )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "emote"   )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "tell"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "order"   )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "who"     )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "weather" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "where"   )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "safe"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "scan"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "spy"     )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "score"   )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "save"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "inventory" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "oreturn" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "roll" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "leap" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "lifespan" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "nightsight" )) found = TRUE;
				//else if (!str_cmp( cmd_table[cmd].name, "recite" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "truesight" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "horns" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "fangs" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "essence" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "p")) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "power")) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "powers")) found = TRUE;
				//else if (!str_cmp( cmd_table[cmd].name, "cast" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "quit" ) &&
						!IS_NPC(ch) && ch->pcdata->obj_vnum != 0) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "humanform" ) &&
						!IS_NPC(ch) && ch->pcdata->obj_vnum != 0) found = TRUE;
				else {
					send_to_char( "Not without a body!\n\r", ch ); return; }
			}
			else if (IS_EXTRA(ch,TIED_UP) )
			{
				if      (!str_cmp( cmd_table[cmd].name, "say"  )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "'"    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "chat" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "."    )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "yell" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "shout")) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "look" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "save" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "exits")) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "inventory" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "tell" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "order" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "who" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "weather" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "where" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "introduce" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "safe" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "scan" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "spy"  )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "sleep" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "wake" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "fangs" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "claws" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "nightsight" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "shadowsight" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "shadowplane" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "regenerate" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "shield" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "vclan" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "upkeep" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "score" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "immune" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "report" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "goto" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "flex" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "change" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "drink" )) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "p")) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "power")) found = TRUE;
				else if (!str_cmp( cmd_table[cmd].name, "powers")) found = TRUE;
				else {
					send_to_char( "Not while tied up.\n\r", ch );
					if (ch->position > POS_STUNNED)
						act("$n strains against $s bonds.",ch,NULL,NULL,TO_ROOM);
					return; }
			}
			found = TRUE;
			break;
		}
	}

	/*
	 * Log and snoop.
	 */
	if ( cmd_table[cmd].log == LOG_NEVER )
		str_cpy( logline, "XXXXXXXX XXXXXXXX XXXXXXXX" );

	if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) )
			||   fLogAll
			||   cmd_table[cmd].log == LOG_ALWAYS )
	{
		sprintf( log_buf, "Log %s: %s", ch->name->str, logline );
		log_string2( log_buf );
		logchan(log_buf, NULL, NULL,WIZ_GENERAL,0, ch->level );
	}

	if ( ch->desc != NULL && ch->desc->snoop_by != NULL && g_slist_length(ch->desc->snoop_by) > 0 )
	{
		GSList *desc_list = NULL;
		GString *SnoopString;
		DESCRIPTOR_DATA *snooper;

		for ( desc_list = ch->desc->snoop_by; desc_list != NULL; desc_list = g_slist_next(desc_list) )
		{
			snooper = (DESCRIPTOR_DATA*)desc_list->data;
			SnoopString = g_string_new(logline);
			SnoopString = g_string_append(SnoopString,"\n\r");
			write_to_snooper( snooper, SnoopString);
			g_string_free(SnoopString,TRUE);
		}
	}

	if ( !found )
	{
		/*
		 * Look for command in socials table.
		 */
		if ( !check_social( ch, command, argument ) )
		{
			if ( !check_xsocial( ch, command, argument ) )
			{
				send_to_char( "Huh?\n\r", ch );
				playwave_toch(ch,11);
			}
		}
		/*
		   else
		   {
		   sprintf(kavirarg,">>>%s",argu);
		   room_text( ch, kavirarg );
		   }
		 */
		return;
	}

	/*
	 * Character not in position for command?
	 */
	if ( ch->position < cmd_table[cmd].position )
	{
		switch( ch->position )
		{
			case POS_DEAD:
				send_to_char( "Lie still; you are DEAD.\n\r", ch );
				break;

			case POS_MORTAL:
			case POS_INCAP:
				send_to_char( "You are hurt far too bad for that.\n\r", ch );
				break;

			case POS_STUNNED:
				send_to_char( "You are too stunned to do that.\n\r", ch );
				break;

			case POS_SLEEPING:
				send_to_char( "In your dreams, or what?\n\r", ch );
				break;

			case POS_MEDITATING:
			case POS_SITTING:
			case POS_RESTING:
				send_to_char( "Nah... You feel too relaxed...\n\r", ch);
				break;

			case POS_FIGHTING:
				send_to_char( "No way!  You are still fighting!\n\r", ch);
				break;

		}
		return;
	}

	if (!IS_NPC(ch) && ch->plane == PLANE_ETHEREAL )
	{
		if (!str_cmp( cmd_table[cmd].name, "unmist" )
				|| !str_cmp( cmd_table[cmd].name, "score"     )
				|| !str_cmp( cmd_table[cmd].name, "planewalk"     )
				|| !str_cmp( cmd_table[cmd].name, "look"      )
				|| !str_cmp( cmd_table[cmd].name, "save"      )
				|| !str_cmp( cmd_table[cmd].name, "north"      )
				|| !str_cmp( cmd_table[cmd].name, "west"      )
				|| !str_cmp( cmd_table[cmd].name, "south"      )
				|| !str_cmp( cmd_table[cmd].name, "east"      )
				|| !str_cmp( cmd_table[cmd].name, "up"      )
				|| !str_cmp( cmd_table[cmd].name, "tenebrous" )
				|| !str_cmp( cmd_table[cmd].name, "down"      )
				|| !str_cmp( cmd_table[cmd].name, "upkeep"    )
				|| !str_cmp( cmd_table[cmd].name, "powers"    )
				|| !str_cmp( cmd_table[cmd].name, "stand"    )
				|| !str_cmp( cmd_table[cmd].name, "change"    )
				|| !str_cmp( cmd_table[cmd].name, "who"       ))
		{
		}
		else
		{
			send_to_char( "You can't do that while ethereal!\n\r", ch );
			return;
		}
	}


	if ( !IS_NPC(ch) && ch->plane == PLANE_EARTH) 
	{
		if (!str_cmp( cmd_table[cmd].name, "earthmeld" )
				|| !str_cmp( cmd_table[cmd].name, "score"     )
				|| !str_cmp( cmd_table[cmd].name, "look"      )
				|| !str_cmp( cmd_table[cmd].name, "powers"    )
				|| !str_cmp( cmd_table[cmd].name, "planewalk"     )
				|| !str_cmp( cmd_table[cmd].name, "spburrow"  )
				|| !str_cmp( cmd_table[cmd].name, "save"      )
				|| !str_cmp( cmd_table[cmd].name, "upkeep"    )
				|| !str_cmp( cmd_table[cmd].name, "who"       ))
		{
		}
		else
		{
			send_to_char( "You can't move underground!\n\r", ch );
			return;
		}
	}

	if ( !IS_NPC(ch) && IS_SET(ch->added, ADDED_CHAMELEON)) 
	{
		if (!str_cmp( cmd_table[cmd].name, "earthmeld" )
				|| !str_cmp( cmd_table[cmd].name, "score"     )
				|| !str_cmp( cmd_table[cmd].name, "look"      )
				|| !str_cmp( cmd_table[cmd].name, "powers"    )
				|| !str_cmp( cmd_table[cmd].name, "planewalk"     )
				|| !str_cmp( cmd_table[cmd].name, "spburrow"  )
				|| !str_cmp( cmd_table[cmd].name, "save"      )
				|| !str_cmp( cmd_table[cmd].name, "upkeep"    )
				|| !str_cmp( cmd_table[cmd].name, "who"       ))
		{
		}
		else
		{
			send_to_char( "You can't do anything as a chameleon!\n\r", ch );
			return;
		}
	}

	/*
	 * Dispatch the command.
	 */
	if (IS_SET(mudsetting->mud_setting,MS_DEBUG)){
		buffer = g_string_new("");
		g_string_sprintf(buffer,"command/owner: %s/%s\n\r",cmd_table[cmd].name,ch->name->str);
		bug(buffer->str,0);
		g_string_free(buffer,TRUE);
	}
	(*cmd_table[cmd].do_fun) ( ch, argument );

	//Lag the people that pissed us off :P

	if(!IS_NPC(ch) && ch->pcdata->lag_time > 0)
		WAIT_STATE(ch,number_range(1,ch->pcdata->lag_time));    

	tail_chain( );

	return;
}

void check_affection(CHAR_DATA *ch, CHAR_DATA *victim, char *argument)
{
    int AffAmount = 0;

    if (!IS_PET(victim))
        return;
    
    if (!str_cmp(argument,"pat"))
    {
        do_say(victim,"Thanks I needed that!");
        AffAmount = 1;
    }
    
    if (!str_cmp(argument,"slap"))
    {
        do_say(victim,"Ouch! I'm sorry!");
        AffAmount = -3;
    }

    victim->pet_stats[PET_AFFECTION] += AffAmount;

    return;
}

bool check_social( CHAR_DATA *ch, char *command, char *argument )
{
	char arg[MAX_STRING_LENGTH];
	CHAR_DATA *victim = NULL;
	int cmd;
	bool found;
	
	found  = FALSE;
	for ( cmd = 0; social_table[cmd].name[0] != '\0'; cmd++ )
	{
		if ( command[0] == social_table[cmd].name[0]
			&&   !str_prefix( command, social_table[cmd].name ) )
		{
			found = TRUE;
			break;
		}
	}
	
	if ( !found )
		return FALSE;
	
	if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_NO_EMOTE) )
	{
		send_to_char( "You are anti-social!\n\r", ch );
		return TRUE;
	}
/*
    if ( IS_HEAD(ch,LOST_HEAD) || IS_EXTRA(ch,EXTRA_OSWITCH))
    {
	send_to_char( "You cannot socialize in this form!\n\r", ch );
	return TRUE;
    }
*/
	switch ( ch->position )
	{
		case POS_DEAD:
			send_to_char( "Lie still; you are DEAD.\n\r", ch );
			return TRUE;
			
		case POS_INCAP:
		case POS_MORTAL:
			send_to_char( "You are hurt far too bad for that.\n\r", ch );
			return TRUE;
			
		case POS_STUNNED:
			send_to_char( "You are too stunned to do that.\n\r", ch );
			return TRUE;
			
		case POS_SLEEPING:
	/*
	 * I just know this is the path to a 12" 'if' statement.  :(
	* But two players asked for it already!  -- Furey
	*/
			if ( !str_cmp( social_table[cmd].name, "snore" ) )
				break;
			send_to_char( "In your dreams, or what?\n\r", ch );
			return TRUE;
			
	}
	
	one_argument( argument, arg );
	
	if ( arg[0] == '\0' )
	{
		act( social_table[cmd].others_no_arg, ch, NULL, victim, TO_ROOM    );
		act( social_table[cmd].char_no_arg,   ch, NULL, victim, TO_CHAR    );
	}
	else if ( ( victim = get_char_room( ch, arg ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
	}
	else if ( victim == ch )
	{
		act( social_table[cmd].others_auto,   ch, NULL, victim, TO_ROOM    );
		act( social_table[cmd].char_auto,     ch, NULL, victim, TO_CHAR    );
	}
	else
	{
		act( social_table[cmd].others_found,  ch, NULL, victim, TO_NOTVICT );
		act( social_table[cmd].char_found,    ch, NULL, victim, TO_CHAR    );
		act( social_table[cmd].vict_found,    ch, NULL, victim, TO_VICT    );
		
		if ( !IS_NPC(ch) && IS_NPC(victim)
			&&   !IS_AFFECTED(victim, AFF_CHARM)
			&&   IS_AWAKE(victim) )
		{
			if (IS_PET(victim))
                check_affection(ch,victim,social_table[cmd].name);
            /*
            switch ( number_bits( 4 ) )
			{
		        case 0:
					multi_hit( victim, ch, TYPE_UNDEFINED );
					break;
					
					case 1: case 2: case 3: case 4:
					case 5: case 6: case 7: case 8:
						act( social_table[cmd].others_found,
							victim, NULL, ch, TO_NOTVICT );
					act( social_table[cmd].char_found,
						victim, NULL, ch, TO_CHAR    );
					act( social_table[cmd].vict_found,
						victim, NULL, ch, TO_VICT    );
					break;
					
					case 9: case 10: case 11: case 12:
			    	act( "$n slaps $N.",  victim, NULL, ch, TO_NOTVICT );
					act( "You slap $N.",  victim, NULL, ch, TO_CHAR    );
					act( "$n slaps you.", victim, NULL, ch, TO_VICT    );
					break;
			}
            */
		}
	}
	return TRUE;
}



bool check_xsocial( CHAR_DATA *ch, char *command, char *argument )
{
	char arg[MAX_STRING_LENGTH];
	CHAR_DATA *victim = NULL;
	CHAR_DATA *partner = NULL;
	int cmd;
	int stage;
	int amount;
	bool is_ok = FALSE;
	bool found = FALSE;
	bool one = FALSE;
	bool two = FALSE;
	
	if (IS_NPC(ch)) return FALSE;
	
	for ( cmd = 0; xsocial_table[cmd].name != NULL; cmd++ )
	{
		if ( command[0] == xsocial_table[cmd].name[0]
			&&   !str_prefix( command, xsocial_table[cmd].name ) )
		{
			found = TRUE;
			break;
		}
	}
	
	if ( !found )
		return FALSE;
	
	if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_NO_EMOTE) )
	{
		send_to_char( "You are anti-social!\n\r", ch );
		return TRUE;
	}
	switch ( ch->position )
	{
		case POS_DEAD:
			send_to_char( "Lie still; you are DEAD.\n\r", ch );
			return TRUE;
			
		case POS_INCAP:
		case POS_MORTAL:
			send_to_char( "You are hurt far too bad for that.\n\r", ch );
			return TRUE;
			
		case POS_STUNNED:
			send_to_char( "You are too stunned to do that.\n\r", ch );
			return TRUE;
			
		case POS_SLEEPING:
			send_to_char( "In your dreams, or what?\n\r", ch );
			return TRUE;
			
	}
	
	one_argument( argument, arg );
	
	if ( arg[0] == '\0' )
	{
		act( xsocial_table[cmd].others_no_arg, ch, NULL, victim, TO_ROOM    );
		act( xsocial_table[cmd].char_no_arg,   ch, NULL, victim, TO_CHAR    );
	}
	else if ( ( victim = get_char_room( ch, arg ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
	}
	else if ( victim == ch )
	{
		act( xsocial_table[cmd].others_auto,   ch, NULL, victim, TO_ROOM );
		act( xsocial_table[cmd].char_auto,     ch, NULL, victim, TO_CHAR );
	}
	else if (IS_NPC(victim))
	{
		send_to_char("You can only perform xsocials on players.\n\r",ch);
	}
	else if (ch->sex != SEX_MALE && ch->sex != SEX_FEMALE)
	{
		send_to_char("You must be either male or female to use these socials.\n\r",ch);
	}
	else if (victim->sex != SEX_MALE && victim->sex != SEX_FEMALE)
	{
		send_to_char("They must be either male or female for these socials.\n\r",ch);
	}
	else if (ch->sex == victim->sex)
	{
		send_to_char("Please stick to people of the opposite gender.\n\r",ch);
	}
	else
	{
		if (xsocial_table[cmd].gender == SEX_MALE && ch->sex != SEX_MALE)
		{
			send_to_char("Only men can perform this type of social.\n\r",ch);
		}
		else if (xsocial_table[cmd].gender == SEX_FEMALE && ch->sex != SEX_FEMALE)
		{
			send_to_char("Only women can perform this type of social.\n\r",ch);
		}
		else if (xsocial_table[cmd].gender == SEX_MALE && victim->sex != SEX_FEMALE)
		{
			send_to_char("You can only perform this social on a woman.\n\r",ch);
		}
		else if (xsocial_table[cmd].gender == SEX_FEMALE && victim->sex != SEX_MALE)
		{
			send_to_char("You can only perform this social on a man.\n\r",ch);
		}
		else if ((partner = victim->pcdata->partner) == NULL || partner != ch)
		{
			send_to_char("You cannot perform an xsocial on someone without their CONSENT.\n\r",ch);
		}
		else if (xsocial_table[cmd].stage == 0 && ch->pcdata->stage[0] < 1
			&& ch->pcdata->stage[2] > 0 && ch->sex == SEX_MALE)
			send_to_char("You have not yet recovered from last time!\n\r",ch);
		else if (xsocial_table[cmd].stage == 0 && victim->pcdata->stage[0] < 1
			&& victim->pcdata->stage[2] > 0 && victim->sex == SEX_MALE)
			send_to_char("They have not yet recovered from last time!\n\r",ch);
		else if (xsocial_table[cmd].stage > 0 && ch->pcdata->stage[0] < 100)
			send_to_char("You are not sufficiently aroused.\n\r",ch);
		else if (xsocial_table[cmd].stage > 0 && victim->pcdata->stage[0] < 100)
			send_to_char("They are not sufficiently aroused.\n\r",ch);
		else if (xsocial_table[cmd].stage > 1 && ch->pcdata->stage[1] < 1)
			send_to_char("You are not in the right position.\n\r",ch);
		else if (xsocial_table[cmd].stage > 1 && victim->pcdata->stage[1] < 1)
			send_to_char("They are not in the right position.\n\r",ch);
		else
		{
			act(xsocial_table[cmd].others_found,  ch, NULL, victim, TO_NOTVICT);
			act(xsocial_table[cmd].char_found,    ch, NULL, victim, TO_CHAR   );
			act(xsocial_table[cmd].vict_found,    ch, NULL, victim, TO_VICT   );
			if (xsocial_table[cmd].chance)
			{
				if (ch->sex == SEX_FEMALE && 
					!IS_EXTRA(ch, EXTRA_PREGNANT) && number_range(1,1000) == 1) 
					make_preg(ch,victim);
				else if (victim->sex == SEX_FEMALE && 
					!IS_EXTRA(victim, EXTRA_PREGNANT) && 
					number_range(1,1000) == 1) 
					make_preg(victim,ch);
			}
			if (xsocial_table[cmd].stage == 1)
			{
				ch->pcdata->stage[1] = xsocial_table[cmd].position;
				victim->pcdata->stage[1] = xsocial_table[cmd].position;
				if (!IS_SET(ch->extra, EXTRA_DONE))
				{
					SET_BIT(ch->extra, EXTRA_DONE);
					if (ch->sex == SEX_FEMALE)
					{
						act("You feel $n bleed as you enter $m.",ch,NULL,victim,TO_VICT);
						act("You feel yourself bleed as $N enters you.",ch,NULL,victim,TO_CHAR);
						ch->in_room->blood += 1;
					}
				}
				if (!IS_SET(victim->extra, EXTRA_DONE))
				{
					SET_BIT(victim->extra, EXTRA_DONE);
					if (victim->sex == SEX_FEMALE)
					{
						act("You feel $N bleed as you enter $M.",ch,NULL,victim,TO_CHAR);
						act("You feel yourself bleed as $n enters you.",ch,NULL,victim,TO_VICT);
						ch->in_room->blood += 1;
					}
				}
				stage = 2;
			}
			else stage = xsocial_table[cmd].stage;
			if (stage == 2) amount = ch->pcdata->stage[1];
			else amount = 100;
			if (xsocial_table[cmd].self > 0)
			{
				is_ok = FALSE;
				if (ch->pcdata->stage[stage] >= amount) is_ok = TRUE;
				ch->pcdata->stage[stage] += xsocial_table[cmd].self;
				if (!is_ok && ch->pcdata->stage[stage] >= amount) 
				{
					stage_update(ch,victim,stage);
					one = TRUE;
				}
			}
			if (xsocial_table[cmd].other > 0)
			{
				is_ok = FALSE;
				if (victim->pcdata->stage[stage] >= amount) is_ok = TRUE;
				victim->pcdata->stage[stage] += xsocial_table[cmd].other;
				if (!is_ok && victim->pcdata->stage[stage] >= amount) 
				{
					stage_update(victim,ch,stage);
					two = TRUE;
				}
			}
			if ( one && two )
			{
				ch->pcdata->stage[0] = 0;
				victim->pcdata->stage[0] = 0;
				if (!IS_EXTRA(ch, EXTRA_EXP))
				{
					send_to_char("Congratulations on achieving a simultanious orgasm!  Recieve 100000 exp!\n\r",ch);
					SET_BIT(ch->extra, EXTRA_EXP);
					ch->exp += 100000;
				}
				if (!IS_EXTRA(victim, EXTRA_EXP))
				{
					send_to_char("Congratulations on achieving a simultanious orgasm!  Recieve 100000 exp!\n\r",victim);
					SET_BIT(victim->extra, EXTRA_EXP);
					victim->exp += 100000;
				}
			}
		}
	}
	return TRUE;
}

void stage_update( CHAR_DATA *ch, CHAR_DATA *victim, int stage )
{
	if (IS_NPC(ch) || IS_NPC(victim)) return;
	if (stage == 0)
	{
		if (ch->sex == SEX_MALE)
		{
			send_to_char("You feel yourself harden.\n\r",ch);
			act("You feel $n harden.",ch,NULL,victim,TO_VICT);
			return;
		}
		else if (ch->sex == SEX_FEMALE)
		{
			send_to_char("You feel moist.\n\r",ch);
			act("You feel $n dampen.",ch,NULL,victim,TO_VICT);
			return;
		}
	}
	else if (stage == 2)
	{
		if (ch->sex == SEX_MALE)
		{
			act("You clench your teeth as you cum in $M.",ch,NULL,victim,TO_CHAR);
			act("$n clenches $s teeth as $e cums in you.",ch,NULL,victim,TO_VICT);
			act("$n clenches $s teeth as $e cums in $N.",ch,NULL,victim,TO_NOTVICT);
			ch->pcdata->stage[0] = 0;
			ch->pcdata->stage[1] = 0;
			ch->pcdata->genes[8] += 1;
			victim->pcdata->genes[8] += 1;
			save_char_obj(ch);
			save_char_obj(victim);
			if (ch->pcdata->stage[0] <= 250) ch->pcdata->stage[0] = 0;
			else victim->pcdata->stage[0] -= 250;
			victim->pcdata->stage[1] = 0;
			if (victim->sex == SEX_FEMALE && 
				!IS_EXTRA(victim, EXTRA_PREGNANT) && number_percent() <= 8) 
				make_preg(victim,ch);
			return;
		}
		else if (ch->sex == SEX_FEMALE)
		{
			act("You wimper as you cum.",ch,NULL,victim,TO_CHAR);
			act("$n wimpers as $e cums.",ch,NULL,victim,TO_ROOM);
			if (victim->pcdata->stage[2] < 1 || victim->pcdata->stage[2] >= 250)
			{
				ch->pcdata->stage[2] = 0;
				if (ch->pcdata->stage[0] >= 200) ch->pcdata->stage[0] -= 100;
			}
			else ch->pcdata->stage[2] = 200;
			return;
		}
	}
	return;
}

void make_preg( CHAR_DATA *mother, CHAR_DATA *father )
{
	char *strtime;
	char buf [MAX_STRING_LENGTH];
	
	if (( ((get_age(mother) - 17) * 2 ) < 25 ) || ( ((get_age(father) - 17) * 2 ) < 25 ))
		return;   /* parents must have 25 hours for conception */
	
	if (IS_NPC(mother) || IS_NPC(father)) return;
	if (IS_AFFECTED(mother, AFF_CONTRACEPTION)) return;
	strtime = ctime( &current_time );
	strtime[strlen(strtime)-1] = '\0';
	mother->pcdata->conception = g_string_assign(mother->pcdata->conception,strtime);
	sprintf(buf,"%s %s",mother->name->str,father->name->str);
	mother->pcdata->cparents = g_string_assign(mother->pcdata->cparents,buf);
	SET_BIT(mother->extra, EXTRA_PREGNANT);
	mother->pcdata->genes[0] = UMIN(3000,(int)((double)(mother->max_hit + father->max_hit) * 0.5));
	mother->pcdata->genes[1] = UMIN(3000,(int)((double)(mother->max_mana + father->max_mana) * 0.5));
	mother->pcdata->genes[2] = UMIN(3000,(int)((double)(mother->max_move + father->max_move) * 0.5));
	mother->pcdata->genes[4] = number_range(1,2);
	return;
}


bool check_dumbshit(char * command)
{
	int cmd;
	
	for ( cmd = 0; dumb_shit[cmd].command[0] != '\0'; cmd++ )
	{
		if ( command[0] == dumb_shit[cmd].command[0]
			&&   !str_prefix( command, dumb_shit[cmd].command))
			return FALSE;	
		
	}
	return TRUE;
}