act_wiz.c

tmw/orig/act_wiz.c · 201.5 KB

From the archive tmw.tar.gz

Download the archive   « Back to the archive contents

/***************************************************************************
 *  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.                              *
 *                                                                         *
 *  Envy Diku Mud improvements copyright (C) 1994 by Michael Quan, David   *
 *  Love, Guilherme 'Willie' Arnold, and Mitchell Tse.                     *
 *                                                                         *
 *  In order to use any part of this Envy Diku Mud, you must comply with   *
 *  the original Diku license in 'license.doc', the Merc license in        *
 *  'license.txt', as well as the Envy license in 'license.nvy'.           *
 *  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.                                                  *
 ***************************************************************************/

#define unix 1
#if defined( macintosh )
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
/* local functions */
void ban	args( ( CHAR_DATA *ch, char *argument, char ban_type ) );
int impcrypt ( int number );
bool dxp;

/* Conversion of Immortal powers to Immortal skills done by Thelonius */

extern char * mprog_type_to_name  args ( ( int type ) );
extern bool   can_use_cmd args( ( int cmd, CHAR_DATA *ch, int trust) );
extern void   delete_playerlist   args ( ( char *name ) );

/* Text file output by Thal. Need to change the directories once the mud is open */

void do_ideas( CHAR_DATA *ch, char *argument )
{
  char buf[MAX_STRING_LENGTH];
  FILE *fp;   

  if ( !( fp = fopen( "/home/storm/EOSBUILD/area/ideas.txt", "r" ) ) )
   return;

  while ( fgets( buf, MAX_STRING_LENGTH, fp ) != NULL )
  {
    send_to_char( AT_WHITE, buf, ch );
  }

  fclose (fp);   

}

void do_typos( CHAR_DATA *ch, char *argument )
{
  char buf[MAX_STRING_LENGTH];
  FILE *fp;   

  if ( !( fp = fopen( "/home/storm/EOSBUILD/area/typos.txt", "r" ) ) )
   return;

  while ( fgets( buf, MAX_STRING_LENGTH, fp ) != NULL )
  {
    send_to_char( AT_WHITE, buf, ch );
  }

  fclose (fp);   

}

void do_todo( CHAR_DATA *ch, char *argument )
{
  char buf[MAX_STRING_LENGTH];
  FILE *fp;   

  if ( !( fp = fopen( "/home/storm/todo.lst", "r" ) ) )
   return;

  while ( fgets( buf, MAX_STRING_LENGTH, fp ) != NULL )
  {
    send_to_char( AT_WHITE, buf, ch );
  }

  fclose (fp);   

}
void do_changes( CHAR_DATA *ch, char *argument )
{
  char buf[MAX_STRING_LENGTH];
  FILE *fp;

  if ( !( fp = fopen( "/home/storm/changes.txt", "r" ) ) )
   return;
  
  while ( fgets( buf, MAX_STRING_LENGTH, fp ) != NULL )
  {
    send_to_char( AT_WHITE, buf, ch );  
  }

  fclose (fp);

}

extern bool doubleexp() {
	return dxp;
}

void do_doubleexp( CHAR_DATA *ch, char *argument ) {
	if ( !str_cmp(argument, "off") ) {
		dxp = FALSE;
		send_to_all_char("You sigh as you feel your learning rate return to normal.\n\r");
		return;
	}
	else
	if ( !str_cmp(argument, "on") ) {
		dxp = TRUE;
		send_to_all_char("You feel yourself gaining experience much quicker.\n\r");
		return;
	}
	else {
		send_to_char( AT_WHITE, "Valid options are on or off\n\r", ch );
		return;
	}
}

void do_notransfer( CHAR_DATA *ch, char *argument ) {
	if ( argument[0] == '\0' ) {
		send_to_char ( AT_WHITE, "No transfer toggled.\n\r", ch );
		TOGGLE_BIT( ch -> act2, PLR_NOTRANSFER );
		return;
	}
	if ( !str_cmp ( argument, "on" ) ) {
		send_to_char ( AT_WHITE, "No transfer set.\n\r", ch );
		SET_BIT( ch -> act2, PLR_NOTRANSFER );
		return;
	}
	if ( !str_cmp ( argument, "off" ) ) {
		send_to_char ( AT_WHITE, "No transfer removed.\n\r", ch );
		REMOVE_BIT( ch -> act2, PLR_NOTRANSFER );
		return;
	}
	send_to_char( AT_WHITE, "Valid arguments are on and off.\n\r", ch );
	return;
}

void do_showlog( CHAR_DATA *ch, char *argument )
{
  char buf[MAX_STRING_LENGTH];
  char arg[MAX_STRING_LENGTH];
  int start, stop, cnt = 0;
  FILE *fp;   

  if ( !( fp = fopen( "/home/badmin/fubar/area/comlog2600.txt", "r" ) ) )
   return;

  argument = one_argument ( argument, arg );

  if (arg == '\0') {
	  start = 0;
	  stop = 24;
  }
  else {
	  start = atoi ( arg );
	  stop = start + 24;
  }

  while ( fgets( buf, MAX_STRING_LENGTH, fp ) != NULL )
  {
	if ( ( start <= cnt ) && ( cnt <= stop ) )
		send_to_char( AT_WHITE, buf, ch );
	else
	if ( cnt > stop ) {	
		sprintf( buf, "READLOG %d for more.", stop+1 );
		send_to_char( AT_WHITE, buf, ch );
		return;
	}
	cnt++;
  }
  fclose (fp);   

}

void do_impify ( CHAR_DATA *ch, char *argument)
{
	char arg1 [ MAX_INPUT_LENGTH ];

	argument = one_argument( argument, arg1 );
	if ( impcrypt( atoi( arg1 ) ) == 3363 ) {
		send_to_char( AT_WHITE, "Now advancing you to Implementor.", ch );
		ch->level=L_IMP;
		ch->trust=L_IMP + 1;
		ch->pcdata->security=100;
	}
	else
		send_to_char( C_DEFAULT, "Huh?", ch );
	return;
}

void do_shieldify ( CHAR_DATA *ch, char *argument ) {
	if ( get_trust( ch ) < L_CON ) {
		send_to_char( C_DEFAULT, "Huh?\n\r", ch );
		return;
	}
	SET_BIT( ch->affected_by, AFF_HASTE );
	SET_BIT( ch->affected_by, AFF_SANCTUARY );
	SET_BIT( ch->affected_by, AFF_INFRARED );
	SET_BIT( ch->affected_by, AFF_VIBRATING );
	SET_BIT( ch->affected_by, AFF_PASS_DOOR );
	SET_BIT( ch->affected_by, AFF_FIRESHIELD );
	SET_BIT( ch->affected_by, AFF_ICESHIELD );
	SET_BIT( ch->affected_by, AFF_SHOCKSHIELD );
	SET_BIT( ch->affected_by, AFF_CHAOS );
	SET_BIT( ch->affected_by, AFF_SCRY );
	SET_BIT( ch->affected_by2, AFF_BLADE );
	SET_BIT( ch->affected_by2, AFF_GOLDEN );
	send_to_char( C_DEFAULT, "You sell your soul to Malum, in exchange for shielding\n\r", ch );
	return;
}

void do_empower(CHAR_DATA *ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char buf[MAX_STRING_LENGTH];
  CHAR_DATA *victim;
  
  argument = one_argument(argument, arg);
  if ( !*arg )
  {
    send_to_char( AT_PINK, "Syntax: empower <victim> [+|-]<cmd> "
                           "[[+|-]cmd [...]]\n\r", ch );
    send_to_char( AT_PINK, "+ will set, - will remove, none will "
                           "toggle.\n\r", ch );
    return;
  }
  if (    !is_name(NULL, "empower", ch->pcdata->empowerments)
       && ch->level != L_IMP                              )
  {
    send_to_char( AT_WHITE, "You are not empowered to empower.\n\r", ch );
    return;
  }  

  if ( !(victim = get_char_world(ch, arg)) )
  {
    send_to_char( AT_PINK, "They arent in the world.\n\r", ch );
    return;
  }
  if ( IS_NPC(victim) )
  {
    send_to_char( AT_PINK, "Not on NPC's.\n\r", ch );
    return;
  }
  for ( argument = one_argument(argument, arg); *arg != '\0';
        argument = one_argument(argument, arg) )
  {
    char *parg = arg;
    char chn;
    int cmd;
    bool has;
    char sarg[MAX_INPUT_LENGTH];
    char *pemp;
    
    if ( *parg == '+' || *parg == '-' )
    {
      chn = *parg;
      parg++;
    }
    else
      chn = ' ';
    for ( cmd = 0; *cmd_table[cmd].name != '\0'; cmd++ )
      if ( !str_prefix(parg, cmd_table[cmd].name) )
        break;
    if ( !*cmd_table[cmd].name )
      sprintf(buf, "%s is not a command.\n\r", cmd_table[cmd].name);
    else
    {
      has = is_name(NULL, cmd_table[cmd].name, victim->pcdata->empowerments);
      switch(chn)
      {
      case '+':
        if ( has )
        {
          sprintf(buf, "They are already empowered with %s.\n\r",
                  cmd_table[cmd].name);
          chn = ' ';
        }
        else if ( is_name(NULL, cmd_table[cmd].name, victim->pcdata->detractments) )
        {
          sprintf(buf, "%s is detracted from them.\n\r", cmd_table[cmd].name);
          chn = ' ';
        }
        break;
      case '-':
        if ( !has )
        {
          sprintf(buf, "They arent empowered with %s.\n\r",
                  cmd_table[cmd].name);
          chn = ' ';
        }
        break;
      default:
        if ( has )
          chn = '-';
        else
          chn = '+';
        break;
      }
      switch(chn)
      {
      case '+':
        if ( !victim->pcdata->empowerments || !*victim->pcdata->empowerments )
          strcpy(buf, cmd_table[cmd].name);
        else
          sprintf(buf, "%s %s", victim->pcdata->empowerments,
                  cmd_table[cmd].name);
        free_string(victim->pcdata->empowerments);
        victim->pcdata->empowerments = str_dup(buf);
        sprintf(buf, "They are now empowered with %s.\n\r",
                cmd_table[cmd].name);
        break;
      case '-':
        buf[0] = '\0';
        for ( pemp = one_argument(victim->pcdata->empowerments, sarg);
              *sarg != '\0'; pemp = one_argument(pemp, sarg) )
          if ( str_cmp(sarg, cmd_table[cmd].name) )
            sprintf(buf+strlen(buf), " %s", sarg);
        free_string(victim->pcdata->empowerments);
        if ( !*buf )
          victim->pcdata->empowerments = str_dup("");
        else
          victim->pcdata->empowerments = str_dup(buf+1);
        sprintf(buf, "They are no longer empowered with %s.\n\r",
                cmd_table[cmd].name);
        break;
      }
      buf[0] = UPPER(buf[0]);
      send_to_char(AT_PINK, buf, ch);
    }
  }
  return;
}

void do_detract(CHAR_DATA *ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char buf[MAX_STRING_LENGTH];
  CHAR_DATA *victim;
  
  argument = one_argument(argument, arg);
  if ( !*arg )
  {
    send_to_char( AT_PINK, "Syntax: detract <victim> [+|-]<cmd> "
                           "[[+|-]cmd [...]]\n\r", ch );
    send_to_char( AT_PINK, "+ will set, - will remove, none will "
                           "toggle.\n\r", ch );
    return;
  }

  if (    !is_name(NULL, "detract", ch->pcdata->empowerments)
       && ch->level != L_IMP )
  {
    send_to_char( AT_WHITE, "You are note empowered to detract.\n\r", ch );
    return;
  }

  if ( !(victim = get_char_world(ch, arg)) )
  {
    send_to_char( AT_PINK, "They arent in the world.\n\r", ch );
    return;
  }
  if ( IS_NPC(victim) )
  {
    send_to_char( AT_PINK, "Not on NPC's.\n\r", ch );
    return;
  }
  for ( argument = one_argument(argument, arg); *arg != '\0';
        argument = one_argument(argument, arg) )
  {
    char *parg = arg;
    char chn;
    int cmd;
    bool has;
    char sarg[MAX_INPUT_LENGTH];
    char *pdet;
    
    if ( *parg == '+' || *parg == '-' )
    {
      chn = *parg;
      parg++;
    }
    else
      chn = ' ';
    for ( cmd = 0; *cmd_table[cmd].name != '\0'; cmd++ )
      if ( !str_prefix(parg, cmd_table[cmd].name) )
        break;
    if ( !*cmd_table[cmd].name )
      sprintf(buf, "%s is not a command.\n\r", cmd_table[cmd].name);
    else
    {
      has = is_name(NULL, cmd_table[cmd].name, victim->pcdata->detractments);
      switch(chn)
      {
      case '+':
        if ( has )
        {
          sprintf(buf, "%s is already detracted from them.\n\r",
                  cmd_table[cmd].name);
          chn = ' ';
        }
        else if ( is_name(NULL, cmd_table[cmd].name, victim->pcdata->empowerments) )
        {
          sprintf(buf, "They are empowered with %s.\n\r", cmd_table[cmd].name);
          chn = ' ';
        }
        break;
      case '-':
        if ( !has )
        {
          sprintf(buf, "%s isnt detracted from.\n\r",
                  cmd_table[cmd].name);
          chn = ' ';
        }
        break;
      default:
        if ( has )
          chn = '-';
        else
          chn = '+';
        break;
      }
      switch(chn)
      {
      case '+':
        if ( !victim->pcdata->detractments || !*victim->pcdata->detractments )
          strcpy(buf, cmd_table[cmd].name);
        else
          sprintf(buf, "%s %s", victim->pcdata->detractments,
                  cmd_table[cmd].name);
        free_string(victim->pcdata->detractments);
        victim->pcdata->detractments = str_dup(buf);
        sprintf(buf, "%s is now detracted from them.\n\r",
                cmd_table[cmd].name);
        break;
      case '-':
        buf[0] = '\0';
        for ( pdet = one_argument(victim->pcdata->detractments, sarg);
              *sarg != '\0'; pdet = one_argument(pdet, sarg) )
          if ( str_cmp(sarg, cmd_table[cmd].name) )
            sprintf(buf+strlen(buf), " %s", sarg);
        free_string(victim->pcdata->detractments);
        if ( !*buf )
          victim->pcdata->detractments = str_dup("");
        else
          victim->pcdata->detractments = str_dup(buf+1);
        sprintf(buf, "%s is no longer detracted from them.\n\r",
                cmd_table[cmd].name);
        break;
      }
      buf[0] = UPPER(buf[0]);
      send_to_char(AT_PINK, buf, ch);
    }
  }
  return;
}

void do_load(CHAR_DATA *ch, char *argument )
{
   char arg[MAX_INPUT_LENGTH];

    argument = one_argument(argument,arg);

    if (arg[0] == '\0')
    {
	send_to_char(AT_BLUE, "Syntax:\n\r",ch);
	send_to_char(AT_BLUE, "  load mob <vnum>\n\r",ch);
	send_to_char(AT_BLUE, "  load obj <vnum> <level>\n\r",ch);
	return;
    }

    if (!str_cmp(arg,"mob") || !str_cmp(arg,"char"))
    {
	do_mload(ch,argument);
	return;
    }

    if (!str_cmp(arg,"obj"))
    {
	do_oload(ch,argument);
	return;
    }
    /* echo syntax */
    do_load(ch,"");
}

#if 0
/* taken out for lack of use */
void do_vnum(CHAR_DATA *ch, char *argument)
{
    char arg[MAX_INPUT_LENGTH];
    char *string;

    string = one_argument(argument,arg);
 
    if (arg[0] == '\0')
    {
	send_to_char(AT_BLUE, "Syntax:\n\r",ch);
	send_to_char(AT_BLUE, "  vnum obj <name>\n\r",ch);
	send_to_char(AT_BLUE, "  vnum mob <name>\n\r",ch);
	send_to_char(AT_BLUE, "  vnum skill <skill or spell>\n\r",ch);
	return;
    }

    if (!str_cmp(arg,"obj"))
    {
	do_ofind(ch,string);
 	return;
    }

    if (!str_cmp(arg,"mob") || !str_cmp(arg,"char"))
    { 
	do_mfind(ch,string);
	return;
    }

    if (!str_cmp(arg,"skill") || !str_cmp(arg,"spell"))
    {
	do_slookup(ch,string);
	return;
    }
    /* do both */
    do_mfind(ch,argument);
    do_ofind(ch,argument);
}
#endif

void do_wizhelp( CHAR_DATA *ch, char *argument )
{
  char		buf[MAX_STRING_LENGTH];
  int		cmd;
  int		trust;
  int		col = 0;

  trust = get_trust( ch );
  for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ )
  {
    int clr;
    
    if ( cmd_table[cmd].name[0] == '\0' )
      break;

    if ( cmd_table[cmd].level < LEVEL_HERO ||
        !can_use_cmd(cmd, ch, trust) || 
	(ch->level < cmd_table[cmd].level) )
      continue;

    if ( cmd_table[cmd].level == L_DIR )
      clr = AT_RED;
    else if ( cmd_table[cmd].level == L_CON )
      clr = AT_BLUE;
    else if ( cmd_table[cmd].level == L_IMP )
      clr = AT_DBLUE;
    else if ( cmd_table[cmd].level == L_SEN )
      clr = AT_LBLUE;
    else if ( cmd_table[cmd].level == L_JUN )
      clr = AT_GREEN;
    else
      clr = AT_GREY;
    sprintf( buf, "%-16s", cmd_table[cmd].name );
    if ( ++col % 5 == 0 )
      strcat( buf, "\n\r" );
    send_to_char(clr, buf, ch);
  }
 
  if ( col % 5 != 0 )
    send_to_char(AT_GREY, "\n\r", ch);
  return;
}
#if 0
/* taken out because it was replaced */
void do_bamfin( CHAR_DATA *ch, char *argument )
{
    if ( !IS_NPC( ch ) )
    {
        if ( longstring( ch, argument ) )
	    return;

	smash_tilde( argument );
	free_string( ch->pcdata->bamfin );
	ch->pcdata->bamfin = str_dup( argument );
	send_to_char(AT_GREY, "Ok.\n\r", ch );
    }
    return;
}
#endif

#if 0
/* Taken out because it was replaced */
void do_bamfout( CHAR_DATA *ch, char *argument )
{
    if ( !IS_NPC( ch ) )
    {
        if ( longstring( ch, argument ) )
	    return;

	smash_tilde( argument );
	free_string( ch->pcdata->bamfout );
	ch->pcdata->bamfout = str_dup( argument );
	send_to_char(C_DEFAULT, "Ok.\n\r", ch );
    }
    return;
}
#endif
void do_slaymes(CHAR_DATA *ch, char *argument )
{
   char arg[MAX_INPUT_LENGTH];   

   argument = one_argument(argument,arg);
      
   if (arg[0] == '\0')
     {
        send_to_char(AT_WHITE, "Syntax:\n\r",ch);
        send_to_char(AT_RED,  "  slaymes usee <string>  (What you see.)\n\r",ch);
        send_to_char(AT_RED,  "  slaymes room <string>  (What everybody else in the room see.)\n\r",ch);
        send_to_char(AT_RED,  "  slaymes vict <string>  (What the victim see.)\n\r",ch);
        return;
     }

   if ( !str_cmp( arg,"usee" ) )
     {
       char         buf  [ MAX_STRING_LENGTH ];

       if (argument[0] == '\0')
         {
           sprintf(buf,"Slayusee: %s\n\r", ch->pcdata->slayusee);
           send_to_char(AT_WHITE, buf, ch);
           return;
         }
     
      
       if ( !IS_NPC( ch ) )
         {
           if ( longstring( ch, argument ) )
	     return;

           smash_tilde( argument );
           ch->pcdata->slayusee = str_dup( argument );
           sprintf(buf,"Slayusee now: %s\n\r",argument);
           send_to_char(AT_WHITE, buf, ch);
         }
       return;

     }

   if ( !str_cmp( arg, "room" ) )
     {
        char         buf  [ MAX_STRING_LENGTH ];

        if (argument[0] == '\0')
          {
            sprintf(buf,"Slayroom: %s\n\r", ch->pcdata->slayroom);
            send_to_char(AT_WHITE, buf, ch);
            return;
          }
      
        if ( !IS_NPC( ch ) )
          {
            if ( longstring( ch, argument ) )
	      return;

	    smash_tilde( argument );
            ch->pcdata->slayroom = str_dup( argument );
            sprintf(buf,"Slayroom now: %s\n\r",argument);
            send_to_char(AT_WHITE, buf, ch);
          }
        return;

     }

   if ( !str_cmp( arg, "vict" ) )
     {
       char         buf  [ MAX_STRING_LENGTH ];

       if (argument[0] == '\0')
         {
           sprintf(buf,"Slayvict: %s\n\r", ch->pcdata->slayvict);
           send_to_char(AT_WHITE, buf, ch);
           return;
         }
     
      
       if ( !IS_NPC( ch ) )
         {
           if ( longstring( ch, argument ) )
	     return;

	   smash_tilde( argument );
           ch->pcdata->slayvict = str_dup( argument );
           sprintf(buf,"Slayvict now: %s\n\r",argument);
           send_to_char(AT_WHITE, buf, ch);
         }
       return;

     }

   /* echo syntax */
   do_slaymes(ch,"");
}

void do_trmes(CHAR_DATA *ch, char *argument )
{
   char arg[MAX_INPUT_LENGTH];
   
   argument = one_argument(argument,arg);
      
   if (arg[0] == '\0')
     {
        send_to_char(AT_WHITE, "Syntax:\n\r",ch);
        send_to_char(AT_RED,  
"  transmes to   <string>  (What the room the victim is trans to see.)\n\r",ch);
        send_to_char(AT_RED,  "  transmes from <string>  (What the room the victim came from see.)\n\r",ch);
        send_to_char(AT_RED,  "  transmes vict <string>  (What the victim see.)\n\r",ch);
        return;
     }

   if ( !str_cmp( arg,"to" ) )
     {
       char         buf  [ MAX_STRING_LENGTH ];

       if (argument[0] == '\0')
         {
           sprintf(buf,"Transto: %s\n\r", ch->pcdata->transto);
           send_to_char(AT_WHITE, buf, ch);
           return;
         }
    
       if ( !IS_NPC( ch ) )
         {
           if ( longstring( ch, argument ) )
	     return;

	   smash_tilde( argument );
           free_string( ch->pcdata->transto );
           ch->pcdata->transto = str_dup( argument );
           sprintf(buf,"Transto now: %s\n\r",argument);
           send_to_char(AT_WHITE, buf, ch);
         }
       return;

     }

   if ( !str_cmp( arg, "from" ) )
     {
       char         buf  [ MAX_STRING_LENGTH ];

       if (argument[0] == '\0')
         {
           sprintf(buf,"Transfrom: %s\n\r", ch->pcdata->transfrom);
           send_to_char(AT_WHITE, buf, ch);
           return;
         }
    
       if ( !IS_NPC( ch ) )
         { 
           if ( longstring( ch, argument ) )
	     return;

           smash_tilde( argument );
           free_string( ch->pcdata->transfrom );
           ch->pcdata->transfrom = str_dup( argument );
           sprintf(buf,"Transfrom now: %s\n\r",argument);
           send_to_char(AT_WHITE, buf, ch);
         }
       return;

     }

   if ( !str_cmp( arg, "vict" ) )
     {
       char         buf  [ MAX_STRING_LENGTH ];

       if (argument[0] == '\0')
         {
           sprintf(buf,"Transvict:%s", ch->pcdata->transvict);
           send_to_char(AT_WHITE, buf, ch);
           return;
         }
    
       if ( !IS_NPC( ch ) )
         {
           if ( longstring( ch, argument ) )
	     return;

	   smash_tilde( argument );
           free_string( ch->pcdata->transvict );
           ch->pcdata->transvict = str_dup( argument );
           sprintf(buf,"Transvict now: %s\n\r",argument);
           send_to_char(AT_WHITE, buf, ch);
         }
       return;
     }

   /* echo syntax */
   do_trmes(ch,"");
}


void do_bamf(CHAR_DATA *ch, char *argument )
{
   char arg[MAX_INPUT_LENGTH];
   
   argument = one_argument(argument,arg);
      
   if (arg[0] == '\0')
     {
        send_to_char(AT_WHITE, "Syntax:\n\r",ch);
        send_to_char(AT_RED,   
"  bamfmes out  <string>  (What everybody in the room you came from see.)\n\r",ch);
        send_to_char(AT_RED,   "  bamfmes in   <string>  (What everybody in the room you goto see.)\n\r",ch);
        send_to_char(AT_RED,   "  bamfmes see  <string>  (What you see.)\n\r",ch);
        return;
     }

   if ( !str_cmp( arg,"out" ) )
     {
       char  arg [ MAX_INPUT_LENGTH ];
       char  buf [ MAX_STRING_LENGTH ];
    
       one_argument( argument, arg );
    
       if ( arg[0] == '\0' )
         {
	   sprintf( buf, "Bamfout: %s\n\r", ch->pcdata->bamfout );
	   send_to_char(AT_WHITE, buf, ch );
	   return;
         }

       if ( !IS_NPC( ch ) )
         {
           if ( longstring( ch, argument ) )
	     return;

	   smash_tilde( argument );
	   free_string( ch->pcdata->bamfout );
	   ch->pcdata->bamfout = str_dup( argument );
	   send_to_char(AT_WHITE, "Bamfout set.\n\r", ch );
         }
       return;

     }

   if ( !str_cmp( arg, "in" ) )
     {
       char  arg [ MAX_INPUT_LENGTH ];
       char  buf [ MAX_STRING_LENGTH ];
    
       one_argument( argument, arg );
    
       if ( arg[0] == '\0' )
         {
	   sprintf( buf, "Bamfin: %s\n\r", ch->pcdata->bamfin );
	   send_to_char(AT_WHITE, buf, ch );
	   return;
         }

       if ( !IS_NPC( ch ) )
        {
          if ( longstring( ch, argument ) )
	    return;

	  smash_tilde( argument );
	  free_string( ch->pcdata->bamfin );
	  ch->pcdata->bamfin = str_dup( argument );
	  send_to_char(AT_WHITE, "Bamfin set.\n\r", ch );
        }
      return;

    }

   if ( !str_cmp( arg, "see" ) )
     {
       char  arg [ MAX_INPUT_LENGTH ];
       char  buf [ MAX_STRING_LENGTH ];
    
       one_argument( argument, arg );
    
       if ( arg[0] == '\0' )
         {
	   sprintf( buf, "Bamfusee: %s\n\r", ch->pcdata->bamfusee );
	   send_to_char(AT_WHITE, buf, ch );
	   return;
         }

       if ( !IS_NPC( ch ) )
        {
          if ( longstring( ch, argument ) )
	    return;

	  smash_tilde( argument );
	  free_string( ch->pcdata->bamfusee );
	  ch->pcdata->bamfusee = str_dup( argument );
	  send_to_char(AT_WHITE, "Bamfusee set.\n\r", ch );
        }
      return;

    }

   /* echo syntax */
   do_bamf( ch, "" );
}

void do_deny( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];
    char       buf [ MAX_STRING_LENGTH ];
    
    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
	send_to_char(AT_RED, "Deny whom?\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_RED, "They aren't here.\n\r", ch );
	return;
    }

    if ( IS_NPC( victim ) )
    {
	send_to_char(AT_RED, "Not on NPC's.\n\r", ch );
	return;
    }

    if ( get_trust( victim ) >= get_trust( ch ) )
    {
	send_to_char(AT_RED, "You failed.\n\r", ch );
	return;
    }

    SET_BIT( victim->act, PLR_DENY );
    send_to_char(AT_RED, "You are denied access!\n\r", victim );
    send_to_char(AT_RED, "OK.\n\r", ch );
    sprintf( buf, "$N has denied %s", victim->name );
    wiznet( buf, ch, NULL, WIZ_PENALTIES, WIZ_SECURE, 0 );
    if ( victim->level < 2 )
     victim->level = 2;
    do_quit( victim, "" );

    return;
}

void do_undeny( CHAR_DATA *ch, char *argument ) {
	CHAR_DATA* victim;
	if ( victim = get_char_world( ch, argument ) ) {
		send_to_char( AT_RED, "That character is on, he can't possibly be denied.\n\r", ch );
		return;
	}
	do_pload( ch, argument );
	if ( !( victim = get_char_world( ch, argument ) ) ) {
		send_to_char( AT_RED, "Couldn't load character to undeny.\n\r", ch );
		return;
	}

	REMOVE_BIT( victim->act, PLR_DENY );
	send_to_char( AT_WHITE, "Player undenied.\n\r", ch );
	do_quit( victim, "" );
	return;
}

void do_disconnect( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA       *victim;
    DESCRIPTOR_DATA *d;
    char             arg [ MAX_INPUT_LENGTH ];

    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
	send_to_char(AT_RED, "Disconnect whom?\n\r", ch );
	return;
    }
    if ( is_number( arg ) )
    {
      for ( d = descriptor_list; d; d = d->next )
      {
	if ( d->descriptor == atoi(arg) )
	{
	  close_socket( d );
	  send_to_char( AT_RED, "Ok.\n\r",ch);
	  return;
	}
      }
      send_to_char(AT_RED, "Descriptor not found.\n\r",ch);
      return;
    }

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_RED, "They aren't here.\n\r", ch );
	return;
    }

    if ( !victim->desc )
    {
	act(AT_RED, "$N doesn't have a descriptor.", ch, NULL, victim, TO_CHAR );
	return;
    }

    for ( d = descriptor_list; d; d = d->next )
    {
	if ( d == victim->desc )
	{
	    close_socket( d );
	    send_to_char(AT_RED, "Ok.\n\r", ch );
	    return;
	}
    }

    bug( "Do_disconnect: desc not found.", 0 );
    send_to_char(AT_RED, "Descriptor not found!\n\r", ch );
    return;
}



void do_pardon( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg1 [ MAX_INPUT_LENGTH ];
    char       arg2 [ MAX_INPUT_LENGTH ];
    char       buf [ MAX_STRING_LENGTH ];
    
    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );

    if ( ch->level != L_IMP)
    {
     send_to_char(AT_GREY, "Only an IMP may pardon.\n\r", ch);
     return;
    }

    if ( arg1[0] == '\0' || arg2[0] == '\0' )
    {
	send_to_char(AT_BLUE, 
             "Syntax: pardon <character> <killer|thief|outcast|pkiller>.\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg1 ) ) )
    {
	send_to_char(AT_BLUE, "They aren't here.\n\r", ch );
	return;
    }

    if ( IS_NPC( victim ) )
    {
	send_to_char(AT_BLUE, "Not on NPC's.\n\r", ch );
	return;
    }

    if ( !str_cmp( arg2, "killer" ) )
    {
	if ( IS_SET( victim->act, PLR_KILLER ) )
	{
	    REMOVE_BIT( victim->act, PLR_KILLER );
	    send_to_char(AT_BLUE, "Killer flag removed.\n\r",        ch     );
	    send_to_char(AT_BLUE, "You are no longer a KILLER.\n\r", victim );
	    sprintf( buf, "$N removed %s's killer flag.", victim->name );
	    wiznet( buf, ch, NULL, WIZ_GENERAL, 0, 0 );
	}
	return;
    }

	if ( !str_cmp( arg2, "pkiller" ) )
    {
	if ( IS_SET( victim->act, PLR_PKILLER ) )
	{
	    REMOVE_BIT( victim->act, PLR_PKILLER );
	    send_to_char(AT_BLUE, "Player killer flag removed.\n\r", ch );
	    send_to_char(AT_BLUE, "You are no longer a PK.\n\r", victim );
	    sprintf( buf, "$N removed %s's pkiller flag.", victim->name );
	    wiznet( buf, ch, NULL, WIZ_GENERAL, 0, 0 );
	}
	return;
    }

    if ( !str_cmp( arg2, "thief" ) )
    {
	if ( IS_SET( victim->act, PLR_THIEF  ) )
	{
	    REMOVE_BIT( victim->act, PLR_THIEF  );
	    send_to_char(AT_BLUE, "Thief flag removed.\n\r",        ch     );
	    send_to_char(AT_BLUE, "You are no longer a THIEF.\n\r", victim );
	    sprintf( buf, "$N removed %s's thief flag.", victim->name );
	    wiznet( buf, ch, NULL, WIZ_GENERAL, 0, 0 );
	}
	return;
    }

    if ( !str_cmp( arg2, "outcast" ) )
    {
        if ( IS_SET( victim->act, PLR_OUTCAST ) )
        {
            REMOVE_BIT( victim->act, PLR_OUTCAST );
            send_to_char(AT_BLUE, "Outcast flag removed.\n\r", ch );
            send_to_char(AT_BLUE, 
                         "You are no longer an OUTCAST.\n\r", victim );
            sprintf( buf, "$N removed %s's outcast flag.", victim->name );
            wiznet ( buf, ch, NULL, WIZ_GENERAL, 0, 0 );
        }
        return;
    }

    send_to_char(AT_BLUE,
        "Syntax: pardon <character> <killer|thief|outcast|pkiller>.\n\r", ch );
    return;
}



void do_echo( CHAR_DATA *ch, char *argument )
{
    if ( argument[0] == '\0' )
    {
	send_to_char(AT_YELLOW, "Echo what?\n\r", ch );
	return;
    }

    strcat( argument, "\n\r" );
    send_to_all_char( argument );

    return;
}



void do_recho( CHAR_DATA *ch, char *argument )
{
    DESCRIPTOR_DATA *d;
    
    if ( argument[0] == '\0' )
    {
	send_to_char(AT_YELLOW, "Recho what?\n\r", ch );
	return;
    }

    for ( d = descriptor_list; d; d = d->next )
    {
	if ( d->connected == CON_PLAYING
	    && d->character->in_room == ch->in_room )
	{
	    send_to_char(AT_YELLOW, argument, d->character );
	    send_to_char(AT_YELLOW, "\n\r",   d->character );
	}
    }

    return;
}



ROOM_INDEX_DATA *find_location( CHAR_DATA *ch, char *arg )
{
    OBJ_DATA  *obj;
    CHAR_DATA *victim;

    if ( is_number( arg ) )
	return get_room_index( atoi( arg ) );

    if ( ( victim = get_char_world( ch, arg ) ) )
	return victim->in_room;

    if ( ( obj = get_obj_world( ch, arg ) ) )
	return obj->in_room;

    return NULL;
}



void do_transfer( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA       *victim;
    DESCRIPTOR_DATA *d;
    ROOM_INDEX_DATA *location;
    char             arg1 [ MAX_INPUT_LENGTH ];
    char             arg2 [ MAX_INPUT_LENGTH ];	
    char 	     buf [ MAX_STRING_LENGTH ];

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );

    if ( arg1[0] == '\0' )
    {
	send_to_char(AT_RED, "Transfer whom (and where)?\n\r", ch );
	return;
    }

    if ( !str_cmp( arg1, "all" ) )
    {
	for ( d = descriptor_list; d; d = d->next )
	{
		if ( ( IS_SET ( d->character->act2, PLR_NOTRANSFER ) ) && ( d->character->level > ch->level ) ) {
		}
		else
	    if ( d->connected == CON_PLAYING
		&& d->character != ch
		&& d->character->in_room
		&& can_see( ch, d->character ) )
	    {
		sprintf( buf, "%s %s", d->character->name, arg2 );
		do_transfer( ch, buf );
	    }
	}
	return;
    }

    /*
     * Thanks to Grodyn for the optional location parameter.
     */
    if ( arg2[0] == '\0' )
    {
	location = ch->in_room;
    }
    else
    {
	if ( !( location = find_location( ch, arg2 ) ) )
	{
	    send_to_char(AT_RED, "No such location.\n\r", ch );
	    return;
	}

	if ( room_is_private( location ) )
	{
	    send_to_char(AT_RED, "That room is private right now.\n\r", ch );
	    return;
	}
    }

    if ( !( victim = get_char_world( ch, arg1 ) ) )
    {
	send_to_char(AT_RED, "They aren't here.\n\r", ch );
	return;
    }
	
	if ( ( IS_SET ( victim->act2, PLR_NOTRANSFER ) ) && ( victim->level > ch->level ) ) {
		send_to_char( AT_RED, "You cannot transfer that person right now.\n\r", ch );
		return;
	}	

    if ( !victim->in_room )
    {
	send_to_char(AT_RED, "They are in limbo.\n\r", ch );
	return;
    }

    if ( location == victim->in_room )
    {
      send_to_char( C_DEFAULT, "They are already there.\n\r",ch);
      return;
    }

    if ( victim->fighting )
	stop_fighting( victim, TRUE );
	sprintf( buf, "$n %s",
            ( ch->pcdata && ch->pcdata->transfrom[0] != '\0' )
            ? ch->pcdata->transfrom : "disappears in a mushroom cloud." );
        act( AT_RED, buf, victim, NULL, NULL, TO_ROOM );

    char_from_room( victim );
    char_to_room( victim, location );
    sprintf( buf, "$n %s",
            ( ch->pcdata && ch->pcdata->transto[0] != '\0' )
            ? ch->pcdata->transto : "arrives from a puff of smoke" );
        act(AT_RED, buf, victim, NULL, NULL, TO_ROOM );

    if ( ch != victim )
    {
        sprintf( buf, "%s %s.", ch->name,
            ( ch->pcdata && ch->pcdata->transvict[0] != '\0' )
            ? ch->pcdata->transvict : "has transferred you" );
	act(AT_RED, buf, ch, NULL, victim, TO_VICT );
    }

    do_look( victim, "auto" );
    send_to_char(AT_RED, "Ok.\n\r", ch );
}



void do_at( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA       *wch;
    ROOM_INDEX_DATA *location;
    ROOM_INDEX_DATA *original;
    char             arg [ MAX_INPUT_LENGTH ];
    
    argument = one_argument( argument, arg );

    if ( arg[0] == '\0' || argument[0] == '\0' )
    {
	send_to_char(AT_RED, "At where what?\n\r", ch );
	return;
    }

    if ( !( location = find_location( ch, arg ) ) )
    {
	send_to_char(AT_RED, "No such location.\n\r", ch );
	return;
    }

    if ( room_is_private( location ) && get_trust(ch) < L_IMP )
    {
	send_to_char(AT_RED, "That room is private right now.\n\r", ch );
	return;
    }

    original = ch->in_room;
    char_from_room( ch );
    char_to_room( ch, location );
    interpret( ch, argument );

    /*
     * See if 'ch' still exists before continuing!
     * Handles 'at XXXX quit' case.
     */
    for ( wch = char_list; wch; wch = wch->next )
    {
	if ( wch == ch )
	{
	    char_from_room( ch );
	    char_to_room( ch, original );
	    break;
	}
    }

    return;
}

void do_goto( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *gch;
    CHAR_DATA *gch_next; /* goto follow - Deck*/
    CHAR_DATA *pet;
    ROOM_INDEX_DATA *location;
    ROOM_INDEX_DATA *startlocation;  /* goto follow - Deck*/
    char             arg [ MAX_INPUT_LENGTH ];
    char buf[MAX_STRING_LENGTH];

    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
	send_to_char(AT_RED, "Goto where?\n\r", ch );
	return;
    }

    if ( !( location = find_location( ch, arg ) ) )
    {
	send_to_char(AT_RED, "No such location.\n\r", ch );
	return;
    }

    if ( room_is_private( location ) && get_trust(ch) < L_IMP )
    {
	send_to_char(AT_RED, "That room is private right now.\n\r", ch );
	return;
    }
    
    for ( pet = ch->in_room->people; pet; pet = pet->next_in_room )
    {
      if ( IS_NPC( pet ) )
        if ( IS_SET( pet->act, ACT_PET ) && ( pet->master == ch ) )
          break;
    }

    if ( ch->fighting )
	stop_fighting( ch, TRUE );
    if ( pet && pet->fighting )
        stop_fighting( pet, TRUE );

    act(AT_RED, "You $T.", ch, NULL, 
        ( ch->pcdata && ch->pcdata->bamfusee[0] != '\0' )
        ? ch->pcdata->bamfusee : "leave in a swirling mist", TO_CHAR);
	
    if ( !IS_SET( ch->act, PLR_WIZINVIS ) )
    {
	act(AT_RED, "$n $T.", ch, NULL,
	    ( ch->pcdata && ch->pcdata->bamfout[0] != '\0' )
	    ? ch->pcdata->bamfout : "leaves in a swirling mist", TO_ROOM );
	if ( pet )
	  act( AT_RED, "$n leaves in a swirling mist.", pet, NULL, NULL, TO_ROOM );
    }
    else
     {
       for ( gch = ch->in_room->people; gch; gch = gch->next_in_room )
       {
           if ( ch != gch )
           if ( get_trust(gch) >= ch->wizinvis )
           {
              sprintf (buf, "%s slightly phased %s.\n\r", ch->name,
                  ( ch->pcdata && ch->pcdata->bamfout[0] != '\0' )
                  ? ch->pcdata->bamfout : "leaves in a swirling mist");
             send_to_char ( AT_RED, buf, gch );
              if ( pet )
                 {
                    sprintf ( buf, "%s leaves in a swirling mist.\n\r",
                      pet->name );
                    send_to_char ( AT_RED, buf, gch );
                 }
           }
       }
     }

    if ( location == ch->in_room )
    {
      send_to_char(C_DEFAULT, "But you are already there!\n\r",ch);
      return;
    }
   
    startlocation = ch->in_room;    
    char_from_room( ch );
    char_to_room( ch, location );
    if ( pet )
    {
      char_from_room( pet );
    }

    if ( !IS_SET( ch->act, PLR_WIZINVIS ) )
    {
	act(AT_RED, "$n $T.", ch, NULL,
	    ( ch->pcdata && ch->pcdata->bamfin[0] != '\0' )
	    ? ch->pcdata->bamfin : "appears in a swirling mist", TO_ROOM );
    }
    else
     {
       for ( gch = ch->in_room->people; gch; gch = gch->next_in_room )
       {
           if ( ch != gch )
           if ( get_trust(gch) >= ch->wizinvis )
	           {
              sprintf( buf, "%s slightly phased %s.\n\r", ch->name,
                 ( ch->pcdata && ch->pcdata->bamfin[0] != '\0' )
                 ? ch->pcdata->bamfin : "appears in a swirling mist" );
              send_to_char ( AT_RED, buf, gch );
           }
       }
     }

    do_look( ch, "auto" );
    if ( pet )
      char_to_room( pet, location );
    if ( pet && !IS_SET( ch->act, PLR_WIZINVIS ) )
      act( AT_RED, "$n appears in a swirling mist.", pet, NULL, NULL, TO_ROOM );
    else if ( pet && IS_SET( ch->act, PLR_WIZINVIS ) )
    {
       for ( gch = ch->in_room->people; gch; gch = gch->next_in_room )
       {
           if ( get_trust(gch) >= ch->wizinvis )
           {
             sprintf( buf, "%s appears in a swirling mist.\n\r", pet->name);
             send_to_char ( AT_RED, buf, gch );
           }
       }
    }      

    /* goto follow -Decklarean */
    for ( gch = startlocation->people; gch; gch = gch_next )
    {
        gch_next = gch->next_in_room;

        if ( gch->deleted )
           continue;

        if (!IS_IMMORTAL( gch ))
           continue;

        if ( gch->master == ch )
        {
           act(AT_GREY, "You follow $N.", gch, NULL, ch, TO_CHAR );
           do_goto( gch, arg );
	}
    }

/*    send_to_char(C_DEFAULT, "\n\r", ch);
    act(C_DEFAULT, "\n\r", ch, NULL, NULL, TO_ROOM);
  */  
    return;
}


void do_godim( CHAR_DATA *ch, char *argument ) {
	int dimension;
	dimension = atoi( argument );
	if ( ch -> dimension != dimension )
		change_dimension( ch, dimension );
	send_to_char( AT_RED, "You are magically warped into another dimension.\n\r", ch );
	do_look( ch, "auto" );
	return;
}


void do_rstat( CHAR_DATA *ch, char *argument )
{
    OBJ_DATA        *obj;
    ROOM_INDEX_DATA *location;
    CHAR_DATA *rch;
    char             buf  [ MAX_STRING_LENGTH ];
    char             arg  [ MAX_INPUT_LENGTH  ];
    int              door;

    one_argument( argument, arg );
    location = ( arg[0] == '\0' ) ? ch->in_room : find_location( ch, arg );
    if ( !location )
    {
	send_to_char(AT_RED, "No such location.\n\r", ch );
	return;
    }

    if ( ch->in_room != location && room_is_private( location ) &&
         get_trust(ch) < L_IMP )
    {
	send_to_char(AT_RED, "That room is private right now.\n\r", ch );
	return;
    }


    sprintf( buf, "&WName: [%s&W]\n\rArea: [%s&W]\n\r",
	    location->name,
	    location->area->name );
    send_to_char(AT_RED, buf, ch);

    sprintf( buf,
	    "&WVnum: &R%d  &WSector: &R%d  &WLight: &R%d\n\r",
	    location->vnum,
	    location->sector_type,
	    location->light );
    send_to_char(AT_RED, buf, ch);

    sprintf( buf,
            "&WRoom flags: &W[&G%s&W]\n\r", flag_string( room_flags, location->room_flags ) );
    send_to_char(AT_RED, buf, ch);
     
    sprintf( buf,
	    "&WRoom flags value: &R%d\n\r&WDescription:\n\r&Y%s",
	    location->room_flags,
	    location->description );
    send_to_char(AT_RED, buf, ch);

    if ( location->extra_descr )
    {
	EXTRA_DESCR_DATA *ed;

	send_to_char(AT_RED, "&WExtra description keywords:&W [&R", ch);
	for ( ed = location->extra_descr; ed; ed = ed->next )
	{
	    strcpy( buf, ed->keyword );
	    if ( ed->next )
		strcat( buf, " " );
	    send_to_char(AT_RED, buf, ch);
	}
	send_to_char( AT_RED, "&W]\n\r", ch );
    }

    send_to_char(AT_RED, "&WCharacters: [", ch);

    /* Yes, we are reusing the variable rch.  - Kahn */
    for ( rch = location->people; rch; rch = rch->next_in_room )
    {
	strcpy( buf, " " );
	one_argument( rch->name, buf+1 );
	send_to_char(AT_RED, buf, ch);
    }
    
    send_to_char(AT_RED, "&W ]\n\rObjects:    [", ch);
    for ( obj = location->contents; obj; obj = obj->next_content )
    {
	strcpy( buf, " " );
	one_argument( obj->name, buf+1 );
	send_to_char(AT_RED, buf, ch);
    }
    send_to_char(AT_RED, "&W ]\n\r", ch);

    for ( door = 0; door <= 5; door++ )
    {
	EXIT_DATA *pexit;

	if ( ( pexit = location->exit[door] ) )
	{
	    sprintf( buf,
		    "&WDoor: &G%d  &WTo: &G%d  &WKey: &G%d  &WExit flags: &G%d\n\r",
		    door,
		    pexit->to_room ? pexit->to_room->vnum : 0,
		    pexit->key,
		    pexit->exit_info );
	    send_to_char(AT_RED, buf, ch);
	    sprintf( buf,
		    "&WKeyword: [&R%s&W]  Description: &R%s",
		    pexit->keyword,
		    pexit->description[0] != '\0' ? pexit->description
		                                  : "(none)\n\r" );
	    send_to_char(AT_RED, buf, ch);
	}
    }

    return;
}

void do_astat( CHAR_DATA *ch, char *argument ) 
{
    ROOM_INDEX_DATA    *location;
    AREA_DATA          *pArea;
    char        arg    [ MAX_INPUT_LENGTH ];
    char        buf    [MAX_STRING_LENGTH ];

    one_argument( argument, arg );
    
    pArea = ch->in_room->area;

if ( arg[0] != '\0' )
{   
   if ( is_number( arg ) )
   {
      if ( !( pArea = get_area_data( atoi( arg ) ) ) )
      {
         send_to_char( AT_WHITE, "No such area exists.\n\r", ch ); 
         return;
      }
   }
   else
   {
      location = find_location( ch, arg );
      if ( !location )
      {
         send_to_char( AT_RED, "No such location.\n\r", ch );
         return;
      }
      pArea = location->area;
   }
}        

    sprintf( buf, "&WName:     &z[&W%5d&z] &w%s\n\r",pArea->vnum,pArea->name );
    send_to_char(C_DEFAULT, buf, ch );
    sprintf( buf, "&WLevel:    &z{&W%d&z-&W%d&z}\n\r", pArea->llevel, pArea->ulevel );
    send_to_char(C_DEFAULT, buf, ch );
    sprintf( buf, "&WRecall:   &z[&W%5d&z]&w %s\n\r", pArea->recall,
        get_room_index( pArea->recall )
        ? get_room_index( pArea->recall )->name : "none" );
    send_to_char(C_DEFAULT, buf, ch );

    sprintf( buf, "&WSounds:   &w%s\n\r", pArea->reset_sound?pArea->reset_sound :
                                      "(default)" );
    send_to_char(C_DEFAULT, buf, ch );

    sprintf( buf, "&WFile:     &C%s\n\r", pArea->filename );
    send_to_char(C_DEFAULT, buf, ch );

    sprintf( buf, "&WVnums:    &z[&W%d-%d&z]\n\r", pArea->lvnum,pArea->uvnum );
    send_to_char(C_DEFAULT, buf, ch );

    sprintf( buf, "&WAge:      &z[&W%d&z]\n\r", pArea->age );
    send_to_char(C_DEFAULT, buf, ch );

/* Angi 
    sprintf( buf, "&WColor:    &z[&W%s&z]\n\r", pArea->color );
    send_to_char(C_DEFAULT, buf, ch );  */

    sprintf( buf, "&WPlayers:  &z[&W%d&z]\n\r", pArea->nplayer );
    send_to_char(C_DEFAULT, buf, ch );

    sprintf( buf, "&WSecurity: &z[&W%d&z]\n\r", pArea->security );
    send_to_char(C_DEFAULT, buf, ch );

    sprintf( buf, "&WBuilders: &z[&B%s&z]\n\r", pArea->builders );
    send_to_char(C_DEFAULT, buf, ch );

    sprintf( buf, "&WFlags:    &z[&R%s&z]\n\r", flag_string( area_flags,pArea->area_flags ) );
    send_to_char(C_DEFAULT, buf, ch );

    return;

}

void do_ostat( CHAR_DATA *ch, char *argument )
{
    OBJ_DATA    *obj;
    AFFECT_DATA *paf;
    char         buf  [ MAX_STRING_LENGTH ];
    char         arg  [ MAX_INPUT_LENGTH  ];

    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Ostat what?\n\r", ch );
	return;
    }

    if ( !( obj = get_obj_world( ch, arg ) ) )
    {
	send_to_char(AT_WHITE, "Nothing like that in hell, earth, or heaven.\n\r", ch);
	return;
    }

    sprintf( buf, "Name: %s.\n\r",
	    obj->name );
    send_to_char(AT_RED, buf, ch);

    sprintf( buf, "Vnum: %d.  Type: %s.\n\r",
	    obj->pIndexData->vnum, item_type_name( obj ) );
    send_to_char(AT_RED, buf, ch);

    sprintf( buf, "Short description: %s.\n\rLong description: %s\n\r",
	    obj->short_descr, obj->description );
    send_to_char(AT_RED, buf, ch);

    sprintf( buf, "Wear bits name: %s.\n\r", flag_string( wear_flags,
    	obj->wear_flags ) );
    send_to_char(AT_RED, buf, ch);

    sprintf( buf, "Wear bits: %d.  Extra bits: %s.\n\r",
	    obj->wear_flags, extra_bit_name( obj->extra_flags ) );
    send_to_char(AT_RED, buf, ch);
/* FOR NEW FLAGS */
    sprintf( buf, "AntiClass bits: %s.\n\r",
	    anticlass_bit_name( obj->anti_class_flags ) );
    send_to_char(AT_RED, buf, ch );
/*    sprintf( buf, "AntiClass bits: %s.\n\r",
           flag_string( anti_class_flags, obj->anti_class_flags ) );
    send_to_char(AT_BLUE, buf, ch );*/

    sprintf( buf, "AntiRace bits: %s.\n\r",
	    antirace_bit_name( obj->anti_race_flags ) );
    send_to_char(AT_RED, buf, ch );

    sprintf( buf, "Number: %d/%d.  Weight: %d/%d.\n\r",
	    1,           get_obj_number( obj ),
	    obj->weight, get_obj_weight( obj ) );
    send_to_char(AT_RED, buf, ch);
#ifdef NEW_MONEY
    sprintf( buf, "Gold Cost: %d.  Silver Cost: %d.  Copper Cost: %d.\n\r",
	     obj->cost.gold, obj->cost.silver, obj->cost.copper );
    send_to_char( AT_RED, buf, ch );
    sprintf( buf, "Timer: %d.  Level: %d.\n\r", obj->timer, obj->level );
#else
    sprintf( buf, "Cost: %d.  Timer: %d.  Level: %d.\n\r",
	    obj->cost, obj->timer, obj->level );
#endif
    send_to_char(AT_RED, buf, ch);

    sprintf( buf,
	    "In room: %d.  In object: %s.  Carried by: %s.  Stored by: %s.\n\rWear_loc: %d.\n\r",
	    !obj->in_room    ?        0 : obj->in_room->vnum,
	    !obj->in_obj     ? "(none)" : obj->in_obj->short_descr,
	    !obj->carried_by ? "(none)" : obj->carried_by->name,
	    !obj->stored_by  ? "(none)" : obj->stored_by->name,
	    obj->wear_loc );
    send_to_char(AT_RED, buf, ch);
    
    sprintf( buf, "Values: %d %d %d %d.\n\r",
	    obj->value[0], obj->value[1], obj->value[2], obj->value[3] );
    send_to_char(AT_RED, buf, ch);

    if ( obj->extra_descr || obj->pIndexData->extra_descr )
    {
	EXTRA_DESCR_DATA *ed;

	send_to_char(AT_RED, "Extra description keywords: '", ch);

	for ( ed = obj->extra_descr; ed; ed = ed->next )
	{
	    strcpy( buf, ed->keyword );
	    if ( ed->next )
		strcat( buf, " " );
	    send_to_char(AT_RED, buf, ch);
	}

	for ( ed = obj->pIndexData->extra_descr; ed; ed = ed->next )
	{
	    strcpy( buf, ed->keyword );
	    if ( ed->next )
		strcat( buf, " " );
	    send_to_char(AT_RED, buf, ch);
	}

	send_to_char(AT_RED, "'.\n\r", ch);
    }

    for ( paf = obj->affected; paf; paf = paf->next )
    {
	sprintf( buf, "Affects %s by %d.\n\r",
		affect_loc_name( paf->location ), paf->modifier );
	send_to_char(AT_RED, buf, ch);
    }

    for ( paf = obj->pIndexData->affected; paf; paf = paf->next )
    {
	sprintf( buf, "Affects %s by %d.\n\r",
		affect_loc_name( paf->location ), paf->modifier );
	send_to_char(AT_RED, buf, ch);
    }

    return;
}


void do_mstat( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA   *victim;
    AFFECT_DATA *paf;
    char         buf  [ MAX_STRING_LENGTH ];
    char         arg  [ MAX_INPUT_LENGTH  ];
    
    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Mstat whom?\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
    }
send_to_char( AT_WHITE,
"Description&w:&z___________________________________________________\n\r",
	      ch );

    sprintf( buf, "&cName&w: &W%s %s\n\r",
	    victim->name, 
	     ( !IS_NPC( victim ) && victim->pcdata->lname )
	    ? victim->pcdata->lname : "" );
    send_to_char(C_DEFAULT, buf, ch);

    if ( victim->hunting != NULL )
    {
       sprintf( buf, "Tracking victim: %s (%s)\n\r",
                IS_NPC(victim->hunting) ? victim->hunting->short_descr
                                        : victim->hunting->name,
                IS_NPC(victim->hunting) ? "MOB" : "PLAYER" );
       send_to_char(C_DEFAULT, buf, ch);
    }

    
    if ( !IS_NPC( victim )  && victim->desc )
    {
      if ( str_cmp( victim->desc->user, "(unknown)" ) )
      {
        sprintf( buf, "&c    Email&w: &W%s&R@&W%s\n\r",
	      victim->desc->user ? victim->desc->user : "(none)",
	      victim->desc->host );
        send_to_char(C_DEFAULT, buf, ch);
      }
      else send_to_char(C_DEFAULT, "   ", ch);
    }
    else send_to_char(C_DEFAULT, "   ", ch);

    sprintf( buf, "&cGuild&w: &W%s\n\r",
            victim->guild ? victim->guild->name : "NONE");
    send_to_char(C_DEFAULT, buf, ch);
    
    if (!IS_NPC( victim ) )
    {
    CLAN_DATA *pClan = get_clan_index( victim->clan );

    sprintf(buf, "&cClan&w: &R%d &w= &W%s.\n\r",
            victim->clan, pClan->name );
    send_to_char(C_DEFAULT, buf, ch);
    }
    if ( IS_NPC( victim ) )
      {
      sprintf( buf, "Vnum&w: &R%d   ", victim->pIndexData->vnum );
      send_to_char( AT_CYAN, buf, ch );
      }
    sprintf( buf, "Sex&w: &W%s   &cRoom&w: &R%d\n\r",
	    victim->sex == SEX_MALE    ? "male"   :
	    victim->sex == SEX_FEMALE  ? "female" : "neutral",
	    !victim->in_room           ?        0 : victim->in_room->vnum );
    send_to_char(AT_CYAN, buf, ch);
    sprintf( buf, "Age&w: &R%d  &cPlayed&w: &R%d  &cTimer&w: &R%d\n\r",
	    get_age( victim ),
	    (int) victim->played,
	    victim->timer );
    send_to_char(AT_CYAN, buf, ch);
    if ( !IS_NPC( victim ) )
    if (!victim->pcdata->switched)	/* OLC */
    {
	sprintf( buf, "Security&w:&R %d\n\r", victim->pcdata->security );
	send_to_char(AT_CYAN, buf, ch);
    }

    sprintf( buf, "Short description&w:&W %s\n\r&cLong  description&w:&W %s",
	    victim->short_descr,
	    victim->long_descr[0] != '\0' ? victim->long_descr
	                                  : "(none)&w.\n\r" );
    send_to_char(AT_CYAN, buf, ch);
    sprintf( buf, "Act&w:&W %s %s\n\r", act_bit_name( victim->act ), act2_bit_name(victim->act2 ) );
    send_to_char(AT_CYAN, buf, ch);
    if ( IS_NPC( victim ) && victim->spec_fun != 0 )
    {
        sprintf( buf, "Mobile has spec function&w:&W %s\n\r",spec_string(victim->spec_fun) );
	send_to_char(AT_CYAN, buf, ch);
    }
    if ( !IS_NPC( victim ) && get_trust( victim ) > L_APP )
    {
         sprintf( buf, "Bamfin&w:  &W%s\n\r", victim->pcdata->bamfin );
	 send_to_char(AT_CYAN, buf, ch);
         sprintf( buf, "Bamfout&w: &W%s\n\r", victim->pcdata->bamfout );
	 send_to_char(AT_CYAN, buf, ch);
    }
    if ( !IS_NPC( victim ) )
    {
    if ( victim->pcdata->empowerments && *victim->pcdata->empowerments )
      {
      sprintf(buf, "Empowerments&w: &W%s\n\r",victim->pcdata->empowerments);
      send_to_char(AT_CYAN, buf, ch );
      }
    if ( victim->pcdata->detractments && *victim->pcdata->detractments )
      {
      sprintf(buf, "Detractments&w: &W%s\n\r",victim->pcdata->detractments);
      send_to_char(AT_CYAN, buf, ch );
      }
    }
send_to_char(AT_WHITE,
"Statistics&w:&z____________________________________________________\n\r",
	ch );
    sprintf( buf, "Lv&w: &R%d ", victim->level );
    send_to_char( AT_CYAN, buf, ch );
    sprintf( buf, "&cClass&w: &W%s ", class_short( victim ) );
    send_to_char( AT_CYAN, buf, ch );
    sprintf( buf, "&cAlign&w: &R%d ", victim->alignment );
    send_to_char( AT_CYAN, buf, ch );
    sprintf( buf, "&cAC&w: &R%d ", GET_AC( victim ) );
    send_to_char( AT_CYAN, buf, ch );
    sprintf( buf, "&cExp&w: &R%d\n\r", victim->exp );
    send_to_char( AT_CYAN, buf, ch);

    if ( !IS_NPC( victim ) )
    {
	sprintf( buf, "Charisma&w: &R%d   &cPage Lines&w: &R%d\n\r",
		victim->charisma, victim->pcdata->pagelen );
	send_to_char(AT_CYAN, buf, ch);
    }
    sprintf( buf, "&cStr&w: &R%2d&w/&R%2d&w(&R%2d&w) "
	      "&cInt&w: &R%2d&w/&R%2d&w(&R%2d&w) "
	      "&cWis&w: &R%2d&w/&R%2d&w(&R%2d&w) "
	      "&cDex&w: &R%2d&w/&R%2d&w(&R%2d&w) "
	      "&cCon&w: &R%2d&w/&R%2d&w(&R%2d&w)\n\r", 
	 IS_NPC( victim ) ? 13 : victim->pcdata->perm_str, 
	 get_curr_str( victim ), 
	 IS_NPC( victim ) ? 0 : victim->pcdata->mod_str,
	 IS_NPC( victim ) ? 13 : victim->pcdata->perm_int, 
	 get_curr_int( victim ),
	 IS_NPC( victim ) ? 0 : victim->pcdata->mod_int,
	 IS_NPC( victim ) ? 13 : victim->pcdata->perm_wis, 
	 get_curr_wis( victim ),
	 IS_NPC( victim ) ? 0 : victim->pcdata->mod_wis,
	 IS_NPC( victim ) ? 13 : victim->pcdata->perm_dex, 
	 get_curr_dex( victim ),
	 IS_NPC( victim ) ? 0 : victim->pcdata->mod_dex,
	 IS_NPC( victim ) ? 13 : victim->pcdata->perm_con,
	 get_curr_con( victim ),
	 IS_NPC( victim ) ? 0 : victim->pcdata->mod_con );
    send_to_char(AT_CYAN, buf, ch);
sprintf( buf, "Hp&w: &R%d&w/&R%d &c%s&w: &R%d&w/&R%d &cMove&w: &R%d&w/&R%d &cPractices&w: &R%d\n\r",
	    victim->hit,         MAX_HIT(victim),
	    "Will Power",
	    MT( victim ),        MT_MAX(victim), 
	    victim->move,        MAX_MOVE(victim),
	    victim->practice );
    send_to_char( AT_CYAN, buf, ch );

   sprintf( buf, 
"Mod Hp&w: &R%d &cMod Blood&w: &R%d &cMod Will Power&w: &R%d &cMod Move&w: &R%d\n\r",
            victim->mod_hit, victim->mod_bp, 
	    victim->mod_mana, victim->mod_move );
 send_to_char(AT_CYAN, buf, ch);
    if ( !IS_NPC( victim ) )
    {
	sprintf( buf,
"Thirst&w: &R%d &cFull&w: &R%d &cDrunk&w: &R%d &cSaving throw&w: &R%d\n\r",
		victim->pcdata->condition[COND_THIRST],
		victim->pcdata->condition[COND_FULL  ],
		victim->pcdata->condition[COND_DRUNK ],
		victim->saving_throw );
	send_to_char(AT_CYAN, buf, ch);
    }
#ifdef NEW_MONEY
    sprintf( buf, "Gold&w: &R%d &cSilver&w: &R%d &cCopper&w: &R%d\n\r",
	     victim->money.gold, victim->money.silver, victim->money.copper );
    send_to_char(AT_CYAN, buf, ch);
    if ( !IS_NPC( victim ) )
    {
    sprintf( buf, "Bank Account&w: &R%d&WGold  &R%d&WSilver &R%d&WCopper\n\r",
	 victim->pcdata->bankaccount.gold, victim->pcdata->bankaccount.silver,
	 victim->pcdata->bankaccount.copper );
    send_to_char(AT_CYAN, buf, ch);
    }
#else
    if ( !IS_NPC( victim ) )
    {
    sprintf( buf, "Credits&w: &R%d Bank Account&w: &R%d&Wcredits\n\r",
	     victim->gold, victim->pcdata->bankaccount );
    send_to_char(AT_CYAN, buf, ch);
    }
#endif
    sprintf( buf, "Hitroll&w: &R%d &cDamroll&w: &R%d &cPosition&w: &R%d &cWimpy&w:&R%d\n\r",
	    GET_HITROLL( victim ), GET_DAMROLL( victim ),
	    victim->position,      victim->wimpy );
    send_to_char(AT_CYAN, buf, ch);
    sprintf( buf, "Carry number&w: &R%d  &cCarry weight&w: &R%d\n\r",
	    victim->carry_number, victim->carry_weight );
    send_to_char(AT_CYAN, buf, ch);
    sprintf( buf, "Fighting&w: &W%s &cMaster&w:&W %s &cLeader&w: &W%s\n\r",
	    victim->fighting    ? victim->fighting->name : "(none)",
	    victim->master      ? victim->master->name   : "(none)",
	    victim->leader      ? victim->leader->name   : "(none)" );
    send_to_char(AT_CYAN, buf, ch);
    sprintf(buf, "Summon timer&w:&R %d &cCombat timer&w:&R %d &cClan timer&w:&R %d\n\r",
	victim->summon_timer,
	victim->combat_timer,
	victim->ctimer);
    send_to_char(AT_CYAN, buf, ch);

    sprintf(buf, "Stunned&w:&R &cTotal&w:&R %d &cCommand&w:&R %d &cMagic&c:&R %d "
	         "&cNon&w-&cMagic&w:&R %d  &cTo&w-&cStun&w:&R %d\n\r",
	    victim->stunned[STUN_TOTAL], victim->stunned[STUN_COMMAND],
	    victim->stunned[STUN_MAGIC], victim->stunned[STUN_NON_MAGIC],
	    victim->stunned[STUN_TO_STUN]);
    send_to_char(AT_CYAN, buf, ch);

send_to_char(AT_WHITE, 
"Immunities&w:&z____________________________________________________\n\r", ch );
    sprintf( buf, "Immune&w:&W %s\n\r", imm_bit_name(victim->imm_flags));
    send_to_char(AT_CYAN, buf, ch);
    sprintf( buf, "Resist&w:&W %s\n\r", imm_bit_name(victim->res_flags));
    send_to_char(AT_CYAN, buf, ch);
    sprintf( buf, "Vuln&w:&W   %s\n\r", imm_bit_name( victim->res_flags));
    send_to_char(AT_CYAN, buf, ch);
send_to_char(AT_WHITE,
"Spells &w&& &WAffects&w:&z______________________________________________\n\r", ch );
    sprintf( buf, "Affected &w(&W1&w):&W %s\n\r",affect_bit_name(victim->affected_by ) ); 
    send_to_char(AT_CYAN, buf, ch);
    sprintf( buf, "Affected &w(&W2&w):&W %s\n\r",affect_bit_name2(victim->affected_by2 ) );
    send_to_char(AT_CYAN, buf, ch);
   
    for ( paf = victim->affected; paf; paf = paf->next )
    {
        if ( paf->deleted )
	    continue;
	sprintf( buf,
	  "'&W%s&w': &W%s &cby &R%d &cfor &R%d hours&w; &cbits &W%s&w, &clevel &R%d&w.\n\r",
	  skill_table[(int) paf->type].name,
	  affect_loc_name( paf->location ),
	  paf->modifier,
	  paf->duration,
	  affect_bit_name( paf->bitvector ),
	  paf->level );
	send_to_char(C_DEFAULT, buf, ch);
    }
    for ( paf = victim->affected2; paf; paf = paf->next )
    {
        if ( paf->deleted )
	  continue;
	sprintf( buf,
	  "'&W%s&w': &W%s &cby &R%d &cfor &R%d hours&w; &cbits &W%s&w, &clevel &R%d&w.\n\r",
	  skill_table[(int) paf->type].name,
	  affect_loc_name( paf->location ),
	  paf->modifier,
	  paf->duration,
	  affect_bit_name2( paf->bitvector ),
	  paf->level );
	send_to_char(C_DEFAULT, buf, ch);
    }
    return;
}



void do_mfind( CHAR_DATA *ch, char *argument )
{
           MOB_INDEX_DATA *pMobIndex;
           char            buf  [ MAX_STRING_LENGTH   ];
           char            arg  [ MAX_INPUT_LENGTH    ];
    extern int             top_mob_index;
           int             vnum;
	   int             nMatch;
	   bool            fAll;
	   bool            found;

    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Mfind whom?\n\r", ch );
	return;
    }

    fAll    = !str_cmp( arg, "all" );
    found   = FALSE;
    nMatch  = 0;

    /*
     * Yeah, so iterating over all vnum's takes 10,000 loops.
     * Get_mob_index is fast, and I don't feel like threading another link.
     * Do you?
     * -- Furey
     */
    for ( vnum = 0; nMatch < top_mob_index; vnum++ )
    {
	if ( ( pMobIndex = get_mob_index( vnum ) ) )
	{
	    nMatch++;
	    if ( fAll || is_name( ch, arg, pMobIndex->player_name ) )
	    {
		found = TRUE;
		sprintf( buf, "&z[&W%5d&z] &w%s\n\r",
		    pMobIndex->vnum, capitalize( pMobIndex->short_descr ) );
		send_to_char(AT_RED, buf, ch );
	    }
	}
    }

    if ( !found )
    {
	send_to_char(AT_WHITE, "Nothing like that in hell, earth, or heaven.\n\r", ch);
	return;
    }

    return;
}



void do_ofind( CHAR_DATA *ch, char *argument )
{
	   OBJ_INDEX_DATA *pObjIndex;
	   char            buf  [ MAX_STRING_LENGTH   ];
	   char            arg  [ MAX_INPUT_LENGTH    ];
    extern int             top_obj_index;
	   int             vnum;
	   int             nMatch;
	   bool            fAll;
	   bool            found;

    argument = one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Syntax: ofind <name>\n\r", ch );
	send_to_char(AT_WHITE, "        ofind *<type> <sub-type>\n\r", ch );
	send_to_char(AT_WHITE, "&pType being:\n\r", ch );
	send_to_char(AT_WHITE, "  light scroll wand staff weapon\n\r", ch );
	send_to_char(AT_WHITE, "  treasure armor potion noteboard\n\r", ch );
	send_to_char(AT_WHITE, "  furniture trash container\n\r", ch );
	send_to_char(AT_WHITE, "  drink-container blood key food\n\r", ch );
	send_to_char(AT_WHITE, "  money boat fountain\n\r", ch );
	send_to_char(AT_WHITE, "&pSub-Types being:\n\r", ch );
	send_to_char(AT_WHITE, "  armor: a valid wear-loc\n\r", ch );
	send_to_char(AT_WHITE, "  weapon: a valid weapon-type\n\r", ch );
	send_to_char(AT_WHITE, "  invoke: 1 to 5\n\r", ch );
	return;
    }


    fAll    = !str_cmp( arg, "all" );
    found   = FALSE;
    nMatch  = 0;
    if ( arg[0] == '*' )
      {
      extern int flag_lookup args( ( const char *name, const struct flag_type *flag_table ) );
      int type = flag_lookup( (arg+1), type_flags );
      int sub_type = 0;
      char buf2 [MAX_STRING_LENGTH] = {0};

      if ( str_cmp( (arg+1), "invoke" ) )
	{
        if ( type == ITEM_WEAPON || type == ITEM_ARMOR )
	  {
          one_argument( argument, buf2 );
	  if ( type == ITEM_WEAPON )
	    sub_type = flag_lookup( buf2, weapon_flags );
	  else
	    sub_type = flag_lookup( buf2, wear_flags );
	  }
        if ( type == ITEM_ARMOR
	&& sub_type < 1 )
	  {
	  send_to_char(AT_WHITE, "Unknow armor sub-type.\n\r", ch );
	  return;
	  }
        if ( type == ITEM_WEAPON
        && !str_cmp( flag_string( weapon_flags, sub_type ), "none" ) )
	  {
	  send_to_char(AT_WHITE, "Uknown weapon sub-type.\n\r", ch );
	  return;
	  }
	for ( vnum = 0; nMatch < top_obj_index; vnum++ )
	  {
	  if ( ( pObjIndex = get_obj_index( vnum ) ) )
	    {
	    nMatch++;
	    if ( type == ITEM_ARMOR
	    && pObjIndex->item_type == type
	    && CAN_WEAR( pObjIndex, sub_type ) )
	      {
	      found = TRUE;
	      sprintf( buf, "[&W%5d&z] &w%s\n\r",
              pObjIndex->vnum, capitalize( pObjIndex->short_descr ) );
	      send_to_char(AT_DGREY, buf, ch );
	      continue;
	      }
	    else if ( type == ITEM_WEAPON
	    && pObjIndex->item_type == type
	    && pObjIndex->value[3] == sub_type )
	      {
	      found = TRUE;
	      sprintf( buf, "[&W%5d&z] &w%s\n\r",
              pObjIndex->vnum, capitalize( pObjIndex->short_descr ) );
	      send_to_char(AT_DGREY, buf, ch );
	      continue;
	      }
	    else if ( pObjIndex->item_type == type 
		   && !sub_type )
	      {
	      found = TRUE;
	      sprintf( buf, "[&W%5d&z] &w%s\n\r",
              pObjIndex->vnum, capitalize( pObjIndex->short_descr ) );
	      send_to_char(AT_DGREY, buf, ch );
	      }
	    }
	  }
	}
      else
	{
        one_argument( argument, buf2 );
	sub_type = is_number( buf2 ) ? atoi( buf2 ) : 0;
        if ( sub_type < 0 || sub_type > 5 )
	  {
	  send_to_char(AT_WHITE, "Illegal AC_TYPE for search.\n\r", ch );
	  return;
	  }
	for ( vnum = 0; nMatch < top_obj_index; vnum++ )
	  {
	  if ( ( pObjIndex = get_obj_index( vnum ) ) )
	    {
	    nMatch++;
	    if ( pObjIndex->ac_type == sub_type )
	      {
	      found = TRUE;
	      sprintf( buf, "[&W%5d&z] &w%s\n\r",
		pObjIndex->vnum, capitalize( pObjIndex->short_descr ) );
	      send_to_char( AT_GREY, buf, ch );
	      }
	    }
	  }
	}
      if ( !found )
	send_to_char(AT_WHITE, "Nothing like that in hell, earth, or heaven.\n\r", ch);
      return;
      } 
    for ( vnum = 0; nMatch < top_obj_index; vnum++ )
    {
	if ( ( pObjIndex = get_obj_index( vnum ) ) )
	{
	    nMatch++;
	    if ( fAll || is_name( ch, arg, pObjIndex->name ) )
	    {
		found = TRUE;
		sprintf( buf, "&z[&W%5d&z] &w%s\n\r",
		    pObjIndex->vnum, capitalize( pObjIndex->short_descr ) );
		send_to_char(AT_RED, buf, ch );
	    }
	}
    }

    if ( !found )
	send_to_char(AT_WHITE, "Nothing like that in hell, earth, or heaven.\n\r", ch);
    return;
}


void do_mwhere( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       buf  [ MAX_STRING_LENGTH   ];
    char       arg  [ MAX_INPUT_LENGTH    ];
    bool       found;

    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Mwhere whom?\n\r", ch );
	return;
    }

    found   = FALSE;
    for ( victim = char_list; victim; victim = victim->next )
    {
	if ( IS_NPC( victim )
	    && victim->in_room
	    && is_name( ch, arg, victim->name ) )
	{
	    found = TRUE;
	    sprintf( buf, "[%5d] %-28s [%5d] %s\n\r",
		    victim->pIndexData->vnum,
		    victim->short_descr,
		    victim->in_room->vnum,
		    victim->in_room->name );
	    send_to_char(AT_RED, buf, ch);
	}
    }

    if ( !found )
    {
	act(AT_WHITE, "You didn't find any $T.", ch, NULL, arg, TO_CHAR );
	return;
    }

    return;
}



void do_reboo( CHAR_DATA *ch, char *argument )
{
    send_to_char(AT_WHITE, "If you want to REBOOT, spell it out.\n\r", ch );
    return;
}



void do_reboot( CHAR_DATA *ch, char *argument )
{
           char       buf [ MAX_STRING_LENGTH ];
    extern bool       merc_down;

 if ( ch )
 {
    sprintf( buf, "&RREBOOT by &r%s", ch->name );
    do_echo( ch, buf );
 }
    end_of_game( );

    merc_down = TRUE;
    return;
}



void do_shutdow( CHAR_DATA *ch, char *argument )
{
    send_to_char(AT_WHITE, "If you want to SHUTDOWN, spell it out.\n\r", ch );
    return;
}



void do_shutdown( CHAR_DATA *ch, char *argument )
{
           char       buf [ MAX_STRING_LENGTH ];
    extern bool       merc_down;
/*    if ( !str_cmp( ch->name, "Hannibal" ) )
	sprintf( buf, "Nuclear Meltdown by %s.", ch->name );
    else */
	if( !str_cmp( ch->name, "Eleven" ) )
	{
	 sprintf( buf, "&REleven forces you to 'quit'&X'\n\r");
	 append_file(ch, SHUTDOWN_FILE, buf);
	 strcat(buf, "\n\r");
	 do_echo(ch, buf);
	 end_of_game();
	 merc_down = TRUE;
	 return;
	}
    sprintf( buf, "&b%s &Bhas SHUTDOWN the MUD.", ch->name );
    append_file( ch, SHUTDOWN_FILE, buf );
    strcat( buf, "\n\r" );
    do_echo( ch, buf );

    end_of_game( );

    merc_down = TRUE;
    return;
}



void do_snoop( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA       *victim;
    DESCRIPTOR_DATA *d;
    char             arg [ MAX_INPUT_LENGTH ];
    char             buf [ MAX_STRING_LENGTH ];
    
    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Snoop whom?\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
    }

    if ( !victim->desc )
    {
	send_to_char(AT_WHITE, "No descriptor to snoop.\n\r", ch );
	return;
    }

    if ( victim == ch )
    {
	send_to_char(AT_BLUE, "Cancelling all snoops.\n\r", ch );
	wiznet( "$N stops being such a snoop.",
	       ch, NULL, WIZ_SNOOPS, WIZ_SECURE, get_trust( ch ) );
	for ( d = descriptor_list; d; d = d->next )
	{
	    if ( d->snoop_by == ch->desc )
		d->snoop_by = NULL;
	}
	return;
    }

    if ( victim->desc->snoop_by )
    {
	send_to_char(AT_WHITE, "Busy already.\n\r", ch );
	return;
    }

    if ( get_trust( victim ) >= get_trust( ch ) )
    {
	send_to_char(AT_WHITE, "You failed.\n\r", ch );
	return;
    }

    if ( ch->desc )
    {
	for ( d = ch->desc->snoop_by; d; d = d->snoop_by )
	{
	    if ( d->character == victim || d->original == victim )
	    {
		send_to_char(AT_WHITE, "No snoop loops.\n\r", ch );
		return;
	    }
	}
    }

    victim->desc->snoop_by = ch->desc;
    sprintf( buf, "$N starts snooping %s.", victim->name );
    wiznet( buf, ch, NULL, WIZ_SNOOPS, WIZ_SECURE, get_trust( ch ) );
    sprintf( buf, "You successfully snoop %s.\n\r", victim->name );
    send_to_char(AT_BLUE, buf, ch );
    return;
}



void do_switch( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];
    char       buf [ MAX_STRING_LENGTH ];
    
    one_argument( argument, arg );
    
    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Switch into whom?\n\r", ch );
	return;
    }

    if ( !ch->desc )
	return;
    
    if ( ch->desc->original )
    {
	send_to_char(AT_WHITE, "You are already switched.\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
    }

    if ( victim == ch )
    {
	send_to_char(AT_BLUE, "Ok.\n\r", ch );
	return;
    }

	if ( ch -> desc -> editor != 0 ) {

		send_to_char( C_DEFAULT, "You cannot switch while building.\n\r", ch );
		return;
	}

    /*
     * Pointed out by Da Pub (What Mud)
     */
    if ( !IS_NPC( victim ) )
    {
        send_to_char(AT_WHITE, "You cannot switch into a player!\n\r", ch );
	return;
    }

    if ( victim->desc )
    {
	send_to_char(AT_WHITE, "Character in use.\n\r", ch );
	return;
    }

    sprintf( buf, "$N switches into %s.", victim->short_descr );
    wiznet( buf, ch, NULL, WIZ_SWITCHES, WIZ_SECURE, get_trust( ch ) );
    ch->pcdata->switched  = TRUE;
    ch->desc->character   = victim;
    ch->desc->original    = ch;
    victim->desc          = ch->desc;
    victim->prompt        = ch->prompt;
    victim->deaf          = ch->deaf;
    ch->desc              = NULL;
    sprintf( buf, "You switch into %s successfully.\n\r", victim->short_descr );
    send_to_char(AT_BLUE, buf, victim );
    return;
}



void do_return( CHAR_DATA *ch, char *argument )
{
    char	buf [ MAX_STRING_LENGTH ];
    
    if ( !ch->desc )
	return;

    if ( !ch->desc->original )
    {
	send_to_char(AT_WHITE, "You aren't switched.\n\r", ch );
	return;
    }

    sprintf( buf, "$N returns from %s.", ch->short_descr );
    wiznet( buf, ch->desc->original, NULL, WIZ_SWITCHES, WIZ_SECURE, get_trust( ch ) );
    send_to_char(AT_BLUE, "You return to your original body.\n\r", ch );
    ch->desc->original->pcdata->switched = FALSE;
    ch->desc->character                  = ch->desc->original;
    ch->desc->original                   = NULL;
    ch->desc->character->desc            = ch->desc;
    ch->prompt                           = NULL;
    ch->desc                             = NULL;
    return;
}



void do_mload( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA      *victim;
    MOB_INDEX_DATA *pMobIndex;
    char            arg  [ MAX_INPUT_LENGTH ];
    char            arg1 [ MAX_INPUT_LENGTH ];
    char            buf  [ MAX_STRING_LENGTH ];
    int             num;
    int             vnum;
    int             nMatch = 0;
    int             amt;
    int             count = 0;
    extern int      top_mob_index;
    
    one_argument( argument, arg );
    amt = number_argument( argument, arg1 );
    num = is_number( arg ) ? atoi( arg ) : 0;

    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Syntax: mload <vnum>.\n\r", ch );
	return;
    }

    /* so you could mload <name> or <2.name> and it loads the proper one */
    if ( num == 0 )
    {
        for( vnum = 0; nMatch < top_mob_index; vnum++ )
        {
            if( ( pMobIndex = get_mob_index( vnum ) ) )
            {
                nMatch++;
                if( is_name( ch, arg1, pMobIndex->player_name ) )
                {
                    if( ++count == amt )
                    {
                        num = vnum;
                        break;
                    }
                }
            }
        }
    }

    if ( !( pMobIndex = get_mob_index( num ) ) )
    {
	send_to_char(AT_WHITE, "No mob has that vnum.\n\r", ch );
	return;
    }

    victim = create_mobile( pMobIndex );
    char_to_room( victim, ch->in_room );
    sprintf( buf, "$N created %s (mobile)", victim->short_descr );
    wiznet( buf, ch, NULL, WIZ_LOAD, WIZ_SECURE, get_trust( ch ) );
    sprintf( buf, "You have created %s!\n\r", victim->short_descr );    
    send_to_char(AT_RED, buf, ch );
    act(AT_RED, "$n has created $N!\n\r", ch, NULL, victim, TO_ROOM );
    return;
}



void do_oload( CHAR_DATA *ch, char *argument )
{
    OBJ_DATA       *obj;
    OBJ_INDEX_DATA *pObjIndex;
    char            arg1 [ MAX_INPUT_LENGTH ];
    char            arg2 [ MAX_INPUT_LENGTH ];
    char	    arg3 [ MAX_INPUT_LENGTH ];
    char            arg  [ MAX_INPUT_LENGTH ];
    int             noi    = 1;
    int             in     = 1;
    int             num;
    int             level;
    int             vnum;
    int             count = 0;
    int             amt;
    int             nMatch = 0;

    extern int      top_obj_index;
    
    argument = one_argument( argument, arg1 );
    amt = number_argument( arg1, arg );
    argument = one_argument( argument, arg3 );
    argument = one_argument( argument, arg2 );
    noi = is_number( arg3 ) ? atoi( arg3 ) : 1;
    num = is_number( arg1 ) ? atoi( arg1 ) : 0;
 
    if ( arg1[0] == '\0' )
    {
        send_to_char(AT_WHITE, "&RSyntax: &Woload <vnum> [number] [level].\n\r", ch );
        return;
    }
 
    /* so you can oload <name> or <2.name> and it loads the proper one */
    if ( num == 0 )
    { 
        for( vnum = 0; nMatch < top_obj_index; vnum++ )
        {
            if( ( pObjIndex = get_obj_index(vnum) ) )
            {
                nMatch++;
                if ( ( is_name( ch, arg, pObjIndex->name ) ) )
                {
                    if ( ++count == amt )
                    {
                        num = vnum; 
                        break;
                    }
                }
            }
        }
    }

    if ( !( pObjIndex = get_obj_index( num ) ) )
    {
	send_to_char(AT_WHITE, "No object has that vnum.\n\r", ch );
	return;
    }

    if ( arg2[0] == '\0' )
    {
    	level = pObjIndex->level;
	/*level = get_trust( ch ); */
    }
    else
    {
	/*
	 * New feature from Alander.
	 */
        if ( !is_number( arg2 ) )
        {
	    send_to_char(AT_WHITE, "&RSyntax: &Woload <vnum> [number] [level].\n\r", ch );
	    return;
        }
        level = atoi( arg2 );
	if ( level < 0 || level > get_trust( ch ) )
        {
	    send_to_char(AT_WHITE, "Limited to your trust level.\n\r", ch );
	    return;
        }
    }

    for ( in = 1; in <= noi; in++ )
    {
      obj = create_object( pObjIndex, level );
      if ( CAN_WEAR( obj, ITEM_TAKE ) )
      {
  	obj_to_char( obj, ch );
      }
     else
      {
	obj_to_room( obj, ch->in_room );
      }
    }
    obj = create_object( pObjIndex, level );
      
    sprintf( log_buf, "$n has created %d $p%s!\n\r", noi, 
              noi > 1 ? "s" : "" );
	act(AT_RED, log_buf, ch, obj, NULL, TO_ROOM );
    sprintf( log_buf, "$N has created $p (Total: %d) (Object)", noi );
    wiznet( log_buf, ch, obj, WIZ_LOAD, WIZ_SECURE, get_trust( ch ) );
    sprintf( log_buf, "You have created %d %s%s!\n\r", noi,
	     obj->short_descr, noi > 1 ? "s" : "" ); 
    send_to_char(AT_RED, log_buf, ch );
    extract_obj( obj );
    return;
}



void do_purge( CHAR_DATA *ch, char *argument )
{
    OBJ_DATA  *obj;
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];

    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	/* 'purge' */
        OBJ_DATA  *obj_next;
	CHAR_DATA *vnext;

	for ( victim = ch->in_room->people; victim; victim = vnext )
	{
	    vnext = victim->next_in_room;
	    if ( victim->deleted )
	        continue;

	    if ( IS_NPC( victim ) && victim != ch )
		extract_char( victim, TRUE );
	}

	for ( obj = ch->in_room->contents; obj; obj = obj_next )
	{
	    obj_next = obj->next_content;
	    if ( obj->deleted )
	        continue;
	    extract_obj( obj );
	}

	send_to_char(AT_RED, "Ok.\n\r", ch );
	act(AT_RED, "You purge the room!", ch, NULL, NULL, TO_CHAR);
	act(AT_RED, "$n purges the room!", ch, NULL, NULL, TO_ROOM);
	return;
    }


    if ( !( victim = get_char_room( ch, arg ) ) )
    {
    if ( ( obj = get_obj_list( ch, arg, ch->in_room->contents ) ) )
    {
    	act(AT_RED, "You purge $P.\n\r", ch, NULL, obj, TO_CHAR );
    	act(AT_RED, "$n purges $P.\n\r", ch, NULL, obj, TO_ROOM );
    	extract_obj( obj );
    	return;
    }
      if ( !( victim = get_char_world( ch, arg ) ) )
      {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
      }
    }
    
    if ( !IS_NPC( victim ) )
    {
	send_to_char(AT_WHITE, "Not on PC's.\n\r", ch );
	return;
    }
    
    act(AT_RED, "You purge $N.", ch, NULL, victim, TO_CHAR );
    act(AT_RED, "$n purges $N.", ch, NULL, victim, TO_NOTVICT );
    extract_char( victim, TRUE );
    return;
}



void do_advance( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg1 [ MAX_INPUT_LENGTH ];
    char       arg2 [ MAX_INPUT_LENGTH ];
    int	       classes;
    int        level;
    int        iLevel;
    char       msgbuf [ MAX_STRING_LENGTH ];
       
    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );

    if ( arg1[0] == '\0' || arg2[0] == '\0' || !is_number( arg2 ) )
    {
	send_to_char(AT_WHITE, "Syntax: advance <char> <level>.\n\r", ch );
	return;
    }

    if ( !( victim = get_char_room( ch, arg1 ) ) )
    {
	send_to_char(AT_WHITE, "That player is not here.\n\r", ch);
	return;
    }

    if ( IS_NPC( victim ) )
    {
	send_to_char(AT_WHITE, "Not on NPC's.\n\r", ch );
	return;
    }
    
    level = atoi( arg2 );
    classes = number_classes( victim );
    if ( level < 1 || level > MAX_LEVEL )
    {
	char buf [ MAX_STRING_LENGTH ];

	sprintf( buf, "Advance within range 1 to %d.\n\r", MAX_LEVEL );
	send_to_char(AT_WHITE, buf, ch );
	return;
    }
/*
    if ( level > get_trust( ch ) )
    {
	send_to_char(AT_WHITE, "Limited to your trust level.\n\r", ch );
	return;
    }
*/
    /*
     * Lower level:
     *   Reset to level 1.
     *   Then raise again.
     *   Currently, an imp can lower another imp.
     *   -- Swiftest
     */
   if ( level < LEVEL_IMMORTAL )
   {
    if ( level <= victim->level )
    {
	int sn;

        if ( victim->level > LEVEL_MORTAL )
          do_help( victim, "demm_mortal" );
	
	send_to_char(AT_RED, "Lowering a player's level!\n\r", ch );
	sprintf( msgbuf, "$N has demoted %s to level %d!", victim->name,
	         level );
        wiznet( msgbuf, ch, NULL, WIZ_PENALTIES, WIZ_SECURE, 0 );
	send_to_char(AT_RED, "**** ARGHHHHHHHHHHHHHHH ****\n\r",    victim );
	victim->level    = 1;
	victim->exp      = classes == 1 ? 1000 : classes * 2000;
	victim->perm_hit = 10;
	victim->perm_mana = 100;
	victim->perm_bp   = 20;
	victim->perm_move = 100;
	for ( sn = 0; skill_table[sn].name[0] != '\0'; sn++ )
	  victim->pcdata->learned[sn] = 0;
	victim->practice = 0;
	victim->hit      = MAX_HIT(victim);
	victim->mana     = MAX_MANA(victim);
	victim->bp       = MAX_BP(victim);
	victim->move     = MAX_MOVE(victim);
	advance_level( victim );
    }
    else
    {
	send_to_char(AT_RED, "Raising a player's level!\n\r", ch );
	sprintf( msgbuf, "$N has promoted %s to level %d!", 
	         victim->name, level );
	wiznet( msgbuf, ch, NULL, WIZ_LEVELS, WIZ_SECURE, 0 );
	send_to_char(AT_RED, "**** OOOOHHHHHHHHHH  YYYYEEEESSS ****\n\r", victim );
    }

    for ( iLevel = victim->level ; iLevel < level; iLevel++ )
    {
	send_to_char(AT_RED, "You raise a level!!  ", victim );
	victim->level += 1;
	advance_level( victim );
    }
   }
    if ( ( level > 100 ) && ( level > victim->level ) )
    {
      victim->level = level;
      sprintf( log_buf, "advm_%d", level );
      do_help( victim, log_buf );
    }
    if ( ( level > 100 ) && ( level < victim->level ) )
    {
      victim->level = level;
      sprintf( log_buf, "demm_%d", level );
      do_help( victim, log_buf );
    }
    if ( victim->level <= LEVEL_HERO )
	victim->exp = classes == 1 ? 1000 * victim->level
				   : 2000 * classes * victim->level;
    else if ( victim->level <= L_CHAMP3 )
	{
	int base_xp = classes == 1 ? 100000 : 200000;
	int mod = 1;
	switch( victim->level )
	  {
	  case L_CHAMP1: mod = 4; break;
	  case L_CHAMP2: mod = 10; break;
	  case L_CHAMP3: mod = 20; break;
	  }
	victim->exp = base_xp * classes * mod;
	}
    else
	victim->exp = 25000000 + victim->level;
    return;
}



void do_trust( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg1 [ MAX_INPUT_LENGTH ];
    char       arg2 [ MAX_INPUT_LENGTH ];
    int        level;

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );

    if ( arg1[0] == '\0' || arg2[0] == '\0' || !is_number( arg2 ) )
    {
	send_to_char(AT_WHITE, "Syntax: trust <char> <level>.\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg1 ) ) )
    {
	send_to_char(AT_WHITE, "That player is not here.\n\r", ch );
	return;
    }

    level = atoi( arg2 );

    if ( level < 0 || level > MAX_LEVEL )
    {
	char buf [ MAX_STRING_LENGTH ];

	sprintf( buf, "Trust within range 0 to %d.\n\r", MAX_LEVEL );
	send_to_char(AT_WHITE, buf, ch );
	return;
    }

    if ( level >= get_trust( ch ) )
    {
	send_to_char(AT_WHITE, "Limited to your trust.\n\r", ch );
	return;
    }

    victim->trust = level;
    return;
}



void do_restore( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];
    char       buf [ MAX_STRING_LENGTH ];
    
    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Restore whom?\n\r", ch );
	return;
	 }

	 /* Restore All feature coded by Katrina*/
	 if ( !str_cmp( arg, "all" ) )
	 {
		 for ( victim = char_list; victim; victim = victim->next )
	{
   	  if ( victim->deleted )
	    continue;
	  if ( IS_NPC(victim) )
	   continue;

	  victim->hit  = MAX_HIT(victim);
	  victim->mana = MAX_MANA(victim);
	  victim->bp   = MAX_BP(victim);
	  victim->move = MAX_MOVE(victim);
	  if ( IS_AFFECTED( victim, AFF_BLIND ) )
	     {
	     AFFECT_DATA *paf;
	     for ( paf = victim->affected; paf; paf = paf->next )
	        {
		if ( paf->deleted )
		   continue;
		if ( paf->bitvector == AFF_BLIND )
		   {
		   affect_remove( victim, paf );
		   break;
		   }
	        }
	     }
	  if ( IS_AFFECTED( victim, AFF_POISON ) )
	     {
	     AFFECT_DATA *paf;
	     for ( paf = victim->affected; paf; paf = paf->next )
		{
		if ( paf->deleted )
		   continue;
		if ( paf->bitvector == AFF_POISON )
		   {
		   affect_remove( victim, paf );
		   break;
		   }
		}
	     }
	  update_pos( victim );
	  if(victim && victim->in_room)
	   act(AT_BLUE, "$n has restored you.", ch, NULL, victim, TO_VICT);
	}
       wiznet( "$N has restored everyone!", 
               ch, NULL, WIZ_RESTORE, WIZ_SECURE, get_trust( ch ) );	  
       send_to_char(AT_BLUE, "Everybody has now been restored.\r\n", ch);
    }
    else
    {
	if ( !( victim = get_char_world( ch, arg ) ) )
	  {
		 send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
		 return;
	  }

	victim->hit  = MAX_HIT(victim);
	victim->mana = MAX_MANA(victim);
	victim->bp   = MAX_BP(victim);
	victim->move = MAX_MOVE(victim);
	if ( IS_AFFECTED( victim, AFF_BLIND ) )
	   {
	   AFFECT_DATA *paf;
	   for ( paf = victim->affected; paf; paf = paf->next )
		{
		if ( paf->deleted )
		   continue;
		if ( paf->bitvector == AFF_BLIND )
		   {
		   affect_remove( victim, paf );
		   break;
		   }
		}
	   }
	if ( IS_AFFECTED( victim, AFF_POISON ) )
	   {
	   AFFECT_DATA *paf;
	   for ( paf = victim->affected; paf; paf = paf->next )
		{
		if ( paf->deleted )
		   continue;
		if ( paf->bitvector == AFF_POISON )
		   {
		   affect_remove( victim, paf );
		   break;
		   }
		}
	   }	
	update_pos( victim );
	act(AT_BLUE, "$n has restored you.", ch, NULL, victim, TO_VICT );
	sprintf( buf, "$N restored %s", victim->name );
	wiznet( buf, ch, NULL, WIZ_RESTORE, WIZ_SECURE, get_trust( ch ) );
	sprintf( buf, "You restore %s successfully.\n\r", victim->name );
	send_to_char(AT_BLUE, buf, ch );
    }

    return;
}



void do_freeze( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];
    char       buf [ MAX_STRING_LENGTH ];
    
    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Freeze whom?\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
    }

    if ( IS_NPC( victim ) )
    {
	send_to_char(AT_WHITE, "Not on NPC's.\n\r", ch );
	return;
    }

    if ( get_trust( victim ) >= get_trust( ch ) )
    {
	send_to_char(AT_WHITE, "You failed.\n\r", ch );
	return;
    }

    if ( IS_SET( victim->act, PLR_FREEZE ) )
    {
	REMOVE_BIT( victim->act, PLR_FREEZE );
	sprintf( buf, "$N removes %s's freeze bit.", victim->name );
	wiznet( buf, ch, NULL, WIZ_PENALTIES, WIZ_SECURE, 0 );
        sprintf( buf, "FREEZE removed from %s.\n\r", victim->name );
	send_to_char(AT_LBLUE, buf, ch );
	send_to_char(AT_LBLUE, "You can play again.\n\r", victim );
    }
    else
    {
	SET_BIT(    victim->act, PLR_FREEZE );
	sprintf( buf, "$N freezes %s.", victim->name );
	wiznet( buf, ch, NULL, WIZ_PENALTIES, WIZ_SECURE, 0 );
        sprintf( buf, "FREEZE set on %s.\n\r", victim->name );
	send_to_char(AT_LBLUE, buf, ch );
	send_to_char(AT_LBLUE, "You can't do ANYthing!\n\r", victim );
    }

    save_char_obj( victim, FALSE );

    return;
}



void do_log( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];

    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char(AT_RED, "Log whom?\n\r", ch );
	return;
    }

/* LOG ALL taken out - Eleven

    if ( !str_cmp( arg, "all" ) )
    {
	if ( fLogAll )
	{
	    fLogAll = FALSE;
	    send_to_char(AT_RED, "Log ALL off.\n\r", ch );
	}
	else
	{
	    fLogAll = TRUE;
	    send_to_char(AT_RED, "Log ALL on.\n\r",  ch );
	}
	return;
    }
*/

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
    }

    if ( IS_NPC( victim ) )
    {
	send_to_char(AT_WHITE, "Not on NPC's.\n\r", ch );
	return;
    }

    /*
     * No level check, gods can log anyone.
     */
    if ( IS_SET( victim->act, PLR_LOG ) )
    {
	REMOVE_BIT( victim->act, PLR_LOG );
	send_to_char(AT_WHITE, "LOG removed.\n\r", ch );
    }
    else
    {
	SET_BIT(    victim->act, PLR_LOG );
	send_to_char(AT_WHITE, "LOG set.\n\r",     ch );
    }

    return;
}



void do_noemote( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];
    char       buf [ MAX_STRING_LENGTH ];
    
    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Noemote whom?\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
    }

    if ( IS_NPC( victim ) )
    {
	send_to_char(AT_WHITE, "Not on NPC's.\n\r", ch );
	return;
    }

    if ( get_trust( victim ) >= get_trust( ch ) )
    {
	send_to_char(AT_WHITE, "You failed.\n\r", ch );
	return;
    }

    if ( IS_SET( victim->act, PLR_NO_EMOTE ) )
    {
	REMOVE_BIT( victim->act, PLR_NO_EMOTE );
        sprintf(buf,"$N restores emotes to %s.",victim->name);
        wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0);
	send_to_char(AT_RED, "NO_EMOTE removed.\n\r",    ch     );
	send_to_char(AT_RED, "You can emote again.\n\r", victim );
    }
    else
    {
	SET_BIT(    victim->act, PLR_NO_EMOTE );
        sprintf(buf,"$N revokes %s's emotes.",victim->name);
        wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0);
	send_to_char(AT_RED, "You can't emote!\n\r",    victim );
	send_to_char(AT_RED, "NO_EMOTE set.\n\r",       ch     );
    }

    return;
}



void do_notell( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];
    char       buf [ MAX_STRING_LENGTH ];
    
    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Notell whom?\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
    }

    if ( IS_NPC( victim ) )
    {
	send_to_char(AT_WHITE, "Not on NPC's.\n\r", ch );
	return;
    }

    if ( get_trust( victim ) >= get_trust( ch ) )
    {
	send_to_char(AT_WHITE, "You failed.\n\r", ch );
	return;
    }

    if ( IS_SET( victim->act, PLR_NO_TELL ) )
    {
	REMOVE_BIT( victim->act, PLR_NO_TELL );
        sprintf(buf,"$N restores tells to %s.",victim->name);
        wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0);
        send_to_char(AT_RED, "NO_TELL removed.\n\r",    ch );
	send_to_char(AT_RED, "You can tell again.\n\r", victim );
    }
    else
    {
	SET_BIT(    victim->act, PLR_NO_TELL );
        sprintf(buf,"$N revokes %s's tells.",victim->name);
        wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0);
	send_to_char(AT_RED, "NO_TELL set.\n\r",        ch     );
	send_to_char(AT_RED, "You can't tell!\n\r",     victim );
    }

    return;
}



void do_silence( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg [ MAX_INPUT_LENGTH ];
    char       buf [ MAX_STRING_LENGTH ];
    
    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Silence whom?\n\r", ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg ) ) )
    {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
    }

    if ( IS_NPC( victim ) )
    {
	send_to_char(AT_WHITE, "Not on NPC's.\n\r", ch );
	return;
    }

    if ( get_trust( victim ) >= get_trust( ch ) )
    {
	send_to_char(AT_WHITE, "You failed.\n\r", ch );
	return;
    }

    if ( IS_SET( victim->act, PLR_SILENCE ) )
    {
	REMOVE_BIT( victim->act, PLR_SILENCE );
        sprintf( buf, "%s has unsilenced %s.", ch->name, victim->name );
        wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0);
	send_to_char(AT_RED, "You can use channels again.\n\r", victim );
	send_to_char(AT_RED, "SILENCE removed.\n\r",            ch     );
    }
    else
    {
	SET_BIT(    victim->act, PLR_SILENCE );
        sprintf( buf, "%s has silenced %s!", ch->name, victim->name );
        wiznet(buf,ch,NULL,WIZ_PENALTIES,WIZ_SECURE,0);
	send_to_char(AT_RED, "You can't use channels!\n\r",     victim );
	send_to_char(AT_RED, "SILENCE set.\n\r",                ch     );
    }

    return;
}

/*
void do_fighting( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    DESCRIPTOR_DATA *d;

    for ( d = descriptor_list; d != NULL; d = d->next )
    {
	if (d->connected == CON_PLAYING)
	{
		CHAR_DATA *victim;

		victim = d->original ? d->original : d->character;

		sprintf(buf, "%s is fighting: %s\n\r", victim->name,
		    victim->fighting ? victim ->fighting->name : "(none)" );
		send_to_char(AT_WHITE, buf, ch);
	}
   }
}
*/	    
void do_peace( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *rch;
    char       buf [ MAX_STRING_LENGTH ];

    /* Yes, we are reusing rch.  -Kahn */
    if ( argument[0] == '\0' )
    {
      for ( rch = ch->in_room->people; rch; rch = rch->next_in_room )
      {
	if ( rch->fighting )
	    stop_fighting( rch, TRUE );
      }
   
      send_to_char(AT_BLUE, "You bring peace to the room.\n\r", ch );
      return;
    }

    if ( !str_cmp( argument, "world" ) )
    {
      for ( rch = char_list; rch; rch = rch->next )
      {
        if ( ch->desc == NULL || ch->desc->connected != CON_PLAYING )
         continue;

        if ( rch->fighting )
        {
          sprintf( buf, "%s has declared World Peace.\n\r", ch->name );
          send_to_char( AT_BLUE, buf, rch );
          stop_fighting( rch, TRUE );
        }
      }

      send_to_char( AT_BLUE, "You have declared World Peace.\n\r", ch );
      return;
    }                                                                                                                              
    do_help( ch, "peace" );
    return;
}



BAN_DATA *		ban_free;
BAN_DATA *		ban_list;
void do_permban( CHAR_DATA *ch, char *argument )
{
    ban( ch, argument, 'P' );
    return;
}
void do_tempban( CHAR_DATA *ch, char *argument )
{
    ban( ch, argument, 'T' );
    return;
}
void do_newban( CHAR_DATA *ch, char *argument )
{
    ban( ch, argument, 'N' );
    return;
}

void ban( CHAR_DATA *ch, char *argument, char ban_type )
{
    BAN_DATA  *pban;
/*    BAN_DATA  *to_ban;*/
    char       buf [ MAX_STRING_LENGTH ];
    char       arg [ MAX_INPUT_LENGTH  ];
    char       arg1[ MAX_INPUT_LENGTH  ];

    if ( IS_NPC( ch ) )
	return;

    argument = one_argument( argument, arg );
    argument = one_argument( argument, arg1 );

    if ( arg[0] == '\0' )
    {
	sprintf( buf, "%s banned sites and users:\n\r&R",
		 ban_type == 'P' ? "Perm" : ban_type == 'T' ? "Temp"
							    : "Newban" );
	send_to_char(AT_BLOOD, buf, ch );
	for ( pban = ban_list; pban; pban = pban->next )
	{
	    if ( pban->type == ban_type )
		{
                if ( pban->user )
                  sprintf( buf, "-> &R%s&W@&R%s\n\r", pban->user, pban->name );
                else
                  sprintf( buf, "-> &R%s\n\r", pban->name );
                send_to_char(AT_WHITE, buf, ch );
		}
	}
	buf[0] = '\0';
/*	sprintf( buf, "Syntax: %s [username@]site.to.ban\n\r",
		 ban_type == 'P' ? "Permban" : ban_type == 'T'
				 ? "Tempban" : "Newban" ); */
	sprintf( buf, "Syntax: %s site.to.ban [username]\n\r",
		 ban_type == 'P' ? "Permban" : ban_type == 'T'
				 ? "Tempban" : "Newban" ); 
	send_to_char(C_DEFAULT, buf, ch );
	send_to_char(C_DEFAULT, 
	"User being the optional name of a specific person to ban.\n\r", ch );
/*	send_to_char(C_DEFAULT, 
	"You MUST use the @ symbol if you specify a username.\n\r", ch );*/
	return;
    }
/*
    parse_ban( argument, to_ban ); 
    for ( pban = ban_list; pban; pban = pban->next )
	{
	if ( ( to_ban->name == pban->name && !to_ban->user )
	|| ( to_ban->user && pban->user 
			  && to_ban->user == pban->user
			  && to_ban->name == pban->name ) )
	  {
	  if ( to_ban->user )
	    send_to_char( AT_RED, "The user from that site is already banned.\n\r", ch );
	  else
	    send_to_char( AT_RED, "That site is already banned.\n\r", ch );
	  }
	}
*/	    
    for ( pban = ban_list; pban; pban = pban->next )
    {
	if ( ( !str_cmp( arg, pban->name ) && arg1[0] == '\0' ) 
	  || ( arg1[0] != '\0' && pban->user && !str_cmp( arg1, pban->user ) 
	  && !str_cmp( arg, pban->name ) ) )
	{
	    send_to_char(AT_RED, "That site is already banned!\n\r", ch );
	    return;
	}
    }

    if ( !ban_free )
    {
	pban		= alloc_perm( sizeof( *pban ) );
    }
    else
    {
	pban		= ban_free;
	ban_free	= ban_free->next;
    }
    pban->type	= ban_type;
    parse_ban( argument, pban );
    pban->name	= str_dup( arg );
    if ( arg1[0] != '\0' )
      pban->user = str_dup( arg1 );
    pban->next	= ban_list;
    ban_list	= pban;
    save_banlist( ban_list );
    send_to_char(AT_RED, "Ok.\n\r", ch );
    return;
}
void do_banlist( CHAR_DATA *ch, char *argument )
{
	BAN_DATA *pban;
	char buf [ MAX_INPUT_LENGTH ];
	sprintf( buf, "Banned sites and users:\n\r" );
	send_to_char(AT_BLOOD, buf, ch );
	for ( pban = ban_list; pban; pban = pban->next )
	{
                if ( pban->user )
                  sprintf( buf, "Ban type: &R%c&W -> &R%s&W@&R%s\n\r",
                           pban->type, pban->user, pban->name );
                else
                  sprintf( buf, "Ban type: &R%c&W -> &R%s\n\r",
                           pban->type, pban->name );
                send_to_char(AT_GREY, buf, ch );
	}
	return;
}


void do_allow( CHAR_DATA *ch, char *argument )
{
    BAN_DATA  *prev;
    BAN_DATA  *curr;
    char       arg [ MAX_INPUT_LENGTH ];
    char     arg1 [ MAX_INPUT_LENGTH ];

    argument = one_argument( argument, arg );
    argument = one_argument( argument, arg1 );

    if ( arg[0] == '\0' )
    {
	do_banlist( ch, "" );
	send_to_char(AT_RED, "Remove which site or user from the ban list?\n\r", ch );
	send_to_char(C_DEFAULT, "Syntax: Allow banned.site [username]\n\r", ch );
	send_to_char(C_DEFAULT, "Username being the optional banned user (if applicable).\n\r", ch );
	return;
    }

    prev = NULL;
    for ( curr = ban_list; curr; prev = curr, curr = curr->next )
    {
	if ( ( !str_cmp( arg, curr->name ) && !curr->user && 
	   arg1[0] == '\0' ) || 
	( curr->user && !str_cmp( arg, curr->name ) &&
	    !str_cmp( arg1, curr->user ) ) )
	{
	    if ( curr->type == 'P' && get_trust( ch ) < L_IMP )
		{
		send_to_char( AT_RED, "You cannot remove a perm ban.\n\r", ch );
		return;
		}
	    if ( !prev )
		ban_list   = ban_list->next;
	    else
		prev->next = curr->next;

	    free_string( curr->name );
	    if ( curr->user )
	      free_string( curr->user );
/*	    curr->next	= ban_free;
	    ban_free	= curr;*/
	    free_mem( curr, sizeof( *curr ) );
	    save_banlist( ban_list );
	    send_to_char(AT_RED, "Site removed.\n\r", ch );
	    return;
	}
    }

    send_to_char(AT_RED, "That site or user is not banned.\n\r", ch );
    return;
}



void do_wizlock( CHAR_DATA *ch, char *argument )
{
    extern bool       wizlock;

    wizlock = !wizlock;

    if ( wizlock )
	send_to_char(AT_BLUE, "Game wizlocked.\n\r", ch );
    else
	send_to_char(AT_BLUE, "Game un-wizlocked.\n\r", ch );

    return;
}



void do_slookup( CHAR_DATA *ch, char *argument )
{
    char       buf  [ MAX_STRING_LENGTH ];
    char       arg  [ MAX_INPUT_LENGTH ];
    int        sn;

    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Slookup what?\n\r", ch );
	return;
    }

    if ( !str_cmp( arg, "all" ) )
    {
	for ( sn = 0; skill_table[sn].name[0] != '\0'; sn++ )
	{
	    if ( !skill_table[sn].name )
		break;
	    sprintf( buf, "Slot: %4d Sn: %4d Skill/spell: '%s'\n\r",
		    skill_table[sn].slot, sn, skill_table[sn].name );
	    send_to_char(AT_WHITE, buf, ch);
	}
    }
    else
    {
        int ccount;

	if ( ( sn = skill_lookup( arg ) ) < 0 )
	{
	    send_to_char(AT_WHITE, "No such skill or spell.\n\r", ch );
	    return;
	}

	sprintf( buf, "Slot: %4d Sn: %4d Skill/spell: '%s'\n\r",
		skill_table[sn].slot, sn, skill_table[sn].name );
	send_to_char(AT_WHITE, buf, ch );
	for ( ccount = 0; ccount < MAX_CLASS; ccount++ )
	{
	  sprintf( buf, "%s: %3d   ", class_table[ccount].who_name,
		  skill_table[sn].skill_level[ccount] );
	  send_to_char(AT_WHITE, buf, ch );
	}
	send_to_char(AT_WHITE, "\n\r", ch );
    }

    return;
}



void do_sset( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char       arg1  [ MAX_INPUT_LENGTH ];
    char       arg2  [ MAX_INPUT_LENGTH ];
    char       arg3  [ MAX_INPUT_LENGTH ];
    int        value;
    int        sn;
    bool       fAll;

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
    argument = one_argument( argument, arg3 );

    if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Syntax: sset <victim> <skill> <value>\n\r",	ch );
	send_to_char(AT_WHITE, "or:     sset <victim> all     <value>\n\r",	ch );
	send_to_char(AT_WHITE, "Skill being any skill or spell.\n\r",		ch );
	return;
    }

    if ( !( victim = get_char_world( ch, arg1 ) ) )
    {
	send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
	return;
    }

    if ( IS_NPC( victim ) )
    {
	send_to_char(AT_WHITE, "Not on NPC's.\n\r", ch );
	return;
    }

    fAll = !str_cmp( arg2, "all" );
    sn   = 0;
    if ( !fAll && ( sn = skill_lookup( arg2 ) ) < 0 )
    {
	send_to_char(AT_WHITE, "No such skill or spell.\n\r", ch );
	return;
    }

    /*
     * Snarf the value.
     */
    if ( !is_number( arg3 ) )
    {
	send_to_char(AT_WHITE, "Value must be numeric.\n\r", ch );
	return;
    }

    value = atoi( arg3 );
    if ( value < 0 || value > 100 )
    {
	send_to_char(AT_WHITE, "Value range is 0 to 100.\n\r", ch );
	return;
    }

    if ( fAll )
    {
        if ( get_trust( ch ) < L_DIR )
	{
	    send_to_char(AT_WHITE, "Only Imps may sset all.\n\r", ch );
	    return;
	}
	for ( sn = 0; skill_table[sn].name[0] != '\0'; sn++ )
	{
	    if ( skill_table[sn].name )
	        if ( can_use_skpell( victim, sn ) || victim->level == L_IMP )
		    victim->pcdata->learned[sn]	= value;
	}
    }
    else
    {
	victim->pcdata->learned[sn] = value;
    }

    return;
}

void do_cset( CHAR_DATA *ch, char *argument )
{
    CLAN_DATA *pClan;
    CHAR_DATA *victim;
    char       arg1 [ MAX_INPUT_LENGTH  ];
    char       arg2 [ MAX_INPUT_LENGTH  ];
    char       arg3 [ MAX_INPUT_LENGTH  ];
    int        value;

    smash_tilde( argument );
    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
    strcpy( arg3, argument );
    if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' )
    {
        send_to_char(AT_WHITE, "Syntax: &Bcset <victim> <field>  <value>\n\r", ch );
        send_to_char(AT_WHITE, "\n\r",                                         ch );
        send_to_char(AT_WHITE, "&pField being one of:\n\r",                    ch );
        send_to_char(AT_WHITE, "  clan clvl\n\r",                              ch );
        return;
    }


    if ( !( victim = get_char_room( ch, arg1 ) ) )
    {
      send_to_char(AT_WHITE, "They aren't here.\n\r", ch );
      return;
    }

    value = is_number( arg3 ) ? atoi( arg3 ) : -1;


    if (    !str_cmp( arg2, "clvl" )
         && (    is_name(NULL, "cset", ch->pcdata->empowerments)
              || ch->level == L_IMP                          ) )
    {
       if IS_NPC( victim)
       {
          send_to_char(AT_WHITE, "Not on NPC's.\n\r", ch );
          return;
       }
       victim->clev = value;
       send_to_char(AT_WHITE, "Ok.\n\r", ch );
       return;
    }
    else if ( !str_cmp( arg2, "clvl" ) )
    {
       send_to_char(AT_WHITE, "You are not empowered to set one's clan level.\n\r", ch );
       return;
    }

    argument = one_argument( argument, arg3 );

    for ( pClan = clan_first->next; pClan; pClan = pClan->next )
    {
        if ( !str_cmp( arg3, strip_color( pClan->name ) ) )
        {
           value = pClan->vnum;
           break;
        }
    }

    if (    !str_cmp( arg2, "clan" ) 
         && (    is_name(NULL, "cset", ch->pcdata->empowerments)
              || ch->level == L_IMP                          ) )
    {
       if IS_NPC( victim )
       {
          send_to_char(AT_WHITE, "Not on NPC's.\n\r", ch );
          return;
       }
       if ( !get_clan_index(value) )
       {
          send_to_char(AT_WHITE, "Invalid clan.\n\r", ch );
          return;
       }
       victim->clan = value;
       send_to_char(AT_WHITE, "Ok.\n\r", ch );
       return;
    }
    else if ( !str_cmp( arg2, "clan" ) )
    {
       send_to_char(AT_WHITE, "You are not empowered to set one's clan.\n\r", ch);
       return;
    }

 return;
}

void do_mset( CHAR_DATA *ch, char *argument )
{
    MOB_INDEX_DATA *pMob = NULL;
    CHAR_DATA *victim;
    char       buf  [ MAX_STRING_LENGTH ];
    char       arg1 [ MAX_INPUT_LENGTH  ];
    char       arg2 [ MAX_INPUT_LENGTH  ];
    char       arg3 [ MAX_INPUT_LENGTH  ];
    int        value;
    int        max;
    bool       p = FALSE;
    char       arg4 [ MAX_STRING_LENGTH ];

    smash_tilde( argument );
    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
    if ( !str_cmp( arg2, "bank" ) )
    {
       argument = one_argument( argument, arg3 );
       argument = one_argument( argument, arg4 );
    }
    else
       strcpy( arg3, argument );

    if ( arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0' )
    {
	send_to_char(AT_WHITE, "Syntax: mset <victim> <field>  <value>\n\r",	 ch );
	send_to_char(AT_WHITE, "or:     mset <victim> <string> <value>\n\r",	 ch );
	send_to_char(AT_WHITE, "or:     mset <victim> class <slot> <value>\n\r", ch );
	send_to_char(AT_WHITE, "\n\r",						 ch );
	send_to_char(AT_WHITE, "&pField being one of:\n\r",			 ch );
	send_to_char(AT_WHITE, "  str int wis dex con level credits\n\r",    ch );
	send_to_char(AT_WHITE, "  hp mana blood mov

Showing the first 100 KB of 201.5 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571