act_wiz.c

dbsc/src/act_wiz.c · 377.8 KB

From the archive dbsc.tgz

Download the archive   « Back to the archive contents

/****************************************************************************
* [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame      |   \\._.//   *
* -----------------------------------------------------------|   (0...0)   *
* SMAUG 1.0 (C) 1994, 1995, 1996, 1998  by Derek Snider      |    ).:.(    *
* -----------------------------------------------------------|    {o o}    *
* SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus,      |   / ' ' \   *
* Scryn, Rennard, Swordbearer, Gorog, Grishnakh, Nivek,      |~'~.VxvxV.~'~*
* Tricops and Fireblade                                      |             *
* ------------------------------------------------------------------------ *
* Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael        *
* Chastain, Michael Quan, and Mitchell Tse.                                *
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,          *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.     *
* ------------------------------------------------------------------------ *
*			   Wizard/god command module			    *
****************************************************************************/

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <math.h>
#include "mud.h"
#ifdef WIN32
 #include <io.h>
 #define F_OK 0
#endif


#define RESTORE_INTERVAL 21600

char * const save_flag[] =
    { "death", "kill", "passwd", "drop", "put", "give", "auto", "zap",
      "auction", "get", "receive", "idle", "backup", "quitbackup", "fill",
      "empty", "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24",
      "r25", "r26", "r27", "r28", "r29", "r30", "r31"
    };

bool add_hiscore( char *keyword, char *name, int score );
bool add_hiscore_ld( char *keyword, char *name, long double score );
/* from reset.c */
int generate_itemlevel args ( ( AREA_DATA *pArea, OBJ_INDEX_DATA *pObjIndex ));

/* from comm.c */
bool	write_to_descriptor	args( ( int desc, char *txt, int length ) );
bool check_parse_name args( ( char *name, bool newchar ) );

/* from boards.c */
void	note_attach( CHAR_DATA *ch);

/* from build.c */
int get_risflag( char *flag );
int get_defenseflag( char *flag );
int get_attackflag( char *flag );

/* from tables.c */
void	write_race_file( int ra );

/*
 * Local functions.
 */
// long double atod	args( (const char* szNumber) );
long double	atod	args( ( const char *string ) );

char *tiny_affect_loc_name(int location);

ROOM_INDEX_DATA * find_location	args( ( CHAR_DATA *ch, char *arg ) );
void save_watchlist args( ( void ) );
void save_banlist args( ( void ) );
void close_area args( ( AREA_DATA *pArea ) );

int get_color (char *argument); /* function proto */

void	sort_reserved	args( ( RESERVE_DATA *pRes ) );

PROJECT_DATA * get_project_by_number args( ( int pnum ) );
NOTE_DATA * get_log_by_number args( ( PROJECT_DATA *pproject, int pnum ) );


/*
 * Global variables.
 */

char reboot_time[50];
time_t new_boot_time_t;
extern struct tm new_boot_struct;
extern OBJ_INDEX_DATA *obj_index_hash[MAX_KEY_HASH];
extern MOB_INDEX_DATA *mob_index_hash[MAX_KEY_HASH];

int get_saveflag( char *name )
{
	int x;

	for ( x = 0; x < sizeof(save_flag) / sizeof(save_flag[0]); x++ )
		if ( !str_cmp( name, save_flag[x] ) )
			return x;
	return -1;
}

/*
 * Toggle "Do Not Disturb" flag. Used to prevent lower level imms from
 * using commands like "trans" and "goto" on higher level imms.
 */
void do_dnd( CHAR_DATA *ch, char *argument )
{
	if ( !IS_NPC(ch) && ch->pcdata )
		if ( IS_SET(ch->pcdata->flags, PCFLAG_DND) )
		{
			REMOVE_BIT(ch->pcdata->flags, PCFLAG_DND);
			send_to_char( "Your 'do not disturb' flag is now off.\n\r", ch );
		}
		else
		{
			SET_BIT(ch->pcdata->flags, PCFLAG_DND);
			send_to_char( "Your 'do not disturb' flag is now on.\n\r", ch );
		}
	else
		send_to_char( "huh?\n\r", ch );
}

void do_showimmlog( CHAR_DATA *ch, char *argument )
{
  char arg[MAX_INPUT_LENGTH];
  char lstart[MAX_INPUT_LENGTH];
  char lcount[MAX_INPUT_LENGTH];
  char filename[MAX_INPUT_LENGTH];
  char s[MAX_STRING_LENGTH];
  FILE *fp;
  int start = 0;
  int numlines = 0;
  int x = 0;
  int y = 0;

  if( IS_NPC(ch) )
    return;

  argument = one_argument( argument, arg );
  argument = one_argument( argument, lstart );
  argument = one_argument( argument, lcount );

  set_pager_color( AT_IMMORT, ch );

  if( arg[0] == '\0'
    || lstart[0] == '\0'
    || lcount[0] == '\0'
    || !is_number( lstart )
    || !is_number( lcount ) )
  {
    send_to_pager( "   showimmlog <target> <starting line> <number of lines>\n\r", ch );
    return;
  }
  else
  {
    start = atoi( lstart );
    numlines = atoi(lcount );

    set_pager_color( AT_PLAIN, ch );
    strcat( arg, "log" );
    sprintf( filename, "%s%s", WATCH_DIR, strlower( arg ) );
    if( !(fp = fopen( filename, "r" ) ) )
    {
      send_to_char( "Invalid filename.\n\r", ch );
      return;
    }
    else
    {
      fgets( s, MAX_STRING_LENGTH, fp );
      x++;
      while( !feof( fp ) )
      {
//	set_pager_color( AT_PLAIN, ch );
//	send_to_pager( s, ch );
	fgets( s, MAX_STRING_LENGTH, fp );
	x++;
      }
      fclose( fp );
      if( x < start + numlines )
      {
	ch_printf( ch, "The line range must be within %d lines.\n\r", x );
	return;
      }
      else
      {
	fp = fopen( filename, "r" );
	for( x = 0; x < start; x++ )
	  fgets( s, MAX_STRING_LENGTH, fp );
	for( y = 0; y < numlines; y++ )
	{
	  ch_printf( ch, "&R&w%d %s", x + y, s );
	  fgets( s, MAX_STRING_LENGTH, fp );
	}
	send_to_pager( "\n\r", ch );
      }
      fclose( fp );
    }
  }
}

/*
 * The "watch" facility allows imms to specify the name of a player or
 * the name of a site to be watched. It is like "logging" a player except
 * the results are written to a file in the "watch" directory named with
 * the same name as the imm. The idea is to allow lower level imms to
 * watch players or sites without having to have access to the log files.
 */
void do_watch( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char arg3[MAX_INPUT_LENGTH];
	WATCH_DATA *pw;

	if ( IS_NPC(ch) )
		return ;

	argument = one_argument( argument, arg );
	set_pager_color( AT_IMMORT, ch );

	if ( arg[0] == '\0' || !str_cmp(arg, "help") )
	{
		send_to_pager("Syntax Examples:\n\r", ch);
		/*
		 * Only IMP+ can see all the watches. The rest can just see their own.
		 */
		if ( get_trust(ch) >= LEVEL_IMPLEMENTOR )
			send_to_pager(
			    "   watch show all          show all watches\n\r", ch);
		send_to_pager(
		    "   watch show              show all my watches\n\r"
		    "   watch size              show the size of my watch file\n\r"
		    "   watch player joe        add a new player watch\n\r"
		    "   watch site 2.3.123      add a new site watch\n\r"
		    "   watch command make      add a new command watch\n\r"
		    "   watch site 2.3.12       matches 2.3.12x\n\r"
		    "   watch site 2.3.12.      matches 2.3.12.x\n\r"
		    "   watch delete n          delete my nth watch\n\r"
		    "   watch print 500         print watch file starting at line 500\n\r"
		    "   watch print 500 1000    print 1000 lines starting at line 500\n\r"
		    "   watch clear             clear my watch file\n\r",
		    ch);
		return ;
	}

	set_pager_color( AT_PLAIN, ch );
	argument = one_argument(argument, arg2);
	argument = one_argument(argument, arg3);

	/*
	 * Clear watch file
	 */
	if ( !str_cmp(arg, "clear") )
	{
		char fname[MAX_INPUT_LENGTH];

		sprintf( fname, "%s%s", WATCH_DIR, strlower( ch->name ) );
		if ( 0 == remove
			     ( fname ) )
			{
				send_to_pager( "Ok. Your watch file has been cleared.\n\r", ch);
				return ;
			}
		send_to_pager( "You have no valid watch file to clear.\n\r", ch);
		return ;
	}

	/*
	 * Display size of watch file
	 */
	if ( !str_cmp(arg, "size") )
	{
		FILE *fp;
		char fname[MAX_INPUT_LENGTH], s[MAX_STRING_LENGTH];
		int rec_count = 0;

		sprintf( fname, "%s%s", WATCH_DIR, strlower( ch->name ) );

		if ( !(fp = fopen( fname, "r" )) )
		{
			send_to_pager(
			    "You have no watch file. Perhaps you cleared it?\n\r", ch );
			return ;
		}

		fgets( s, MAX_STRING_LENGTH, fp );
		while ( !feof(fp) )
		{
			rec_count++;
			fgets( s, MAX_STRING_LENGTH, fp );
		}
		pager_printf( ch, "You have %d lines in your watch file.\n\r", rec_count);
		fclose(fp);
		return ;
	}

	/*
	 * Print watch file
	 */
	if ( !str_cmp(arg, "print") )
	{
		FILE *fp;
		char fname[MAX_INPUT_LENGTH], s[MAX_STRING_LENGTH];
		const int MAX_DISPLAY_LINES = 1000;
		int start, limit, disp_count = 0, rec_count = 0;

		if ( arg2[0] == '\0' )
		{
			send_to_pager(
			    "Sorry. You must specify a starting line number.\n\r", ch);
			return ;
		}

		start = atoi(arg2);
		limit = (arg3[0] == '\0') ? MAX_DISPLAY_LINES : atoi(arg3);
		limit = UMIN( limit, MAX_DISPLAY_LINES);

		sprintf( fname, "%s%s", WATCH_DIR, strlower( ch->name ) );
		if ( !(fp = fopen( fname, "r" )) )
			return ;
		fgets( s, MAX_STRING_LENGTH, fp );

		while ( (disp_count < limit) && (!feof(fp)) )
		{
			if ( ++rec_count >= start )
			{
				send_to_pager( s, ch );
				disp_count++;
			}
			fgets( s, MAX_STRING_LENGTH, fp );
		}
		send_to_pager( "\n\r", ch );
		if ( disp_count >= MAX_DISPLAY_LINES )
			send_to_pager(
			    "Maximum display lines exceeded. List is terminated.\n\r"
			    "Type 'help watch' to see how to print the rest of the list.\n\r"
			    "\n\r"
			    "Your watch file is large. Perhaps you should clear it?\n\r", ch);

		fclose(fp);
		return ;
	}

	/*
	 * Display all watches
	 * Only IMP+ can see all the watches. The rest can just see their own.
	 */
	if ( get_trust(ch) >= LEVEL_IMPLEMENTOR
	     && !str_cmp(arg, "show") && !str_cmp(arg2, "all") )
	{
		pager_printf( ch, "%-12s %-14s %-15s\n\r",
		              "Imm Name", "Player/Command", "Player Site");
		if (first_watch)
			for ( pw = first_watch; pw; pw = pw->next )
				if ( get_trust(ch) >= pw->imm_level )
					pager_printf( ch, "%-14s %-12s %-15s\n\r",
					              pw->imm_name, pw->target_name ? pw->target_name : " ",
					              pw->player_site ? pw->player_site : " " );
		return ;
	}

	/*
	 * Display only those watches belonging to the requesting imm
	 */
	if ( !str_cmp(arg, "show") && arg2[0] == '\0' )
	{
		int cou = 0;
		pager_printf( ch, "%-3s %-12s %-14s %-15s\n\r",
		              " ", "Imm Name", "Player/Command", "Player Site");
		if (first_watch)
			for ( pw = first_watch; pw; pw = pw->next )
				if ( !str_cmp(ch->name, pw->imm_name) )
					pager_printf( ch, "%3d %-12s %-14s %-15s\n\r",
					              ++cou, pw->imm_name, pw->target_name ? pw->target_name : " ",
					              pw->player_site ? pw->player_site : " " );
		return ;
	}

	/*
	 * Delete a watch belonging to the requesting imm
	 */
	if ( !str_cmp(arg, "delete") && isdigit(*arg2) )
	{
		int cou = 0;
		int num;

		num = atoi(arg2);
		if (first_watch)
			for ( pw = first_watch; pw; pw = pw->next )
				if ( !str_cmp(ch->name, pw->imm_name) )
					if ( num == ++cou )
					{
						/* Oops someone forgot to clear up the memory --Shaddai */
						if ( pw->imm_name )
							DISPOSE ( pw->imm_name );
						if ( pw->player_site )
							DISPOSE( pw->player_site );
						if ( pw->target_name )
							DISPOSE( pw->target_name );
						/* Now we can unlink and then clear up that final
						 * pointer -- Shaddai
						 */
						UNLINK( pw, first_watch, last_watch, next, prev );
						DISPOSE( pw );
						save_watchlist( );
						send_to_pager ("Deleted.\n\r", ch);
						return ;
					}
		send_to_pager ("Sorry. I found nothing to delete.\n\r", ch);
		return ;
	}

	/*
	 * Watch a specific player
	 */
	if ( !str_cmp(arg, "player") && *arg2 )
	{
		WATCH_DATA *pinsert;
		CHAR_DATA *vic;
		char buf [MAX_INPUT_LENGTH];

		if (first_watch)                            /* check for dups */
			for ( pw = first_watch; pw; pw = pw->next )
				if ( !str_cmp(ch->name, pw->imm_name)
				     && pw->target_name
				     && !str_cmp(arg2 , pw->target_name) )
				{
					send_to_pager("You are already watching that player.\n\r", ch);
					return ;
				}

		CREATE( pinsert, WATCH_DATA, 1 );           /* create new watch */
		pinsert->imm_level = get_trust(ch);
		pinsert->imm_name = str_dup( strlower( ch->name ) );
		pinsert->target_name = str_dup( strlower( arg2 ) );
		pinsert->player_site = NULL;

		/* stupid get_char_world returns ptr to "samantha" when given "sam" */
		/* so I do a str_cmp to make sure it finds the right player --Gorog */

		sprintf( buf, "0.%s", arg2 );
		if ( (vic = get_char_world( ch, buf)) )    /* if vic is in game now */
			if ( (!IS_NPC(vic)) && !str_cmp(arg2, vic->name) )
				SET_BIT( vic->pcdata->flags, PCFLAG_WATCH );

		if (first_watch)                            /* ins new watch if app */
			for ( pw = first_watch; pw; pw = pw->next )
				if ( strcmp(pinsert->imm_name, pw->imm_name) < 0 )
				{
					INSERT( pinsert, pw, first_watch, next, prev );
					save_watchlist( );
					send_to_pager(
					    "Ok. That player will be watched.\n\r", ch);
					return ;
				}

		LINK( pinsert, first_watch, last_watch, next, prev );  /* link new watch */
		save_watchlist( );
		send_to_pager("Ok. That player will be watched.\n\r", ch);
		return ;
	}

	/*
	 * Watch a specific site
	 */
	if ( !str_cmp(arg, "site") && *arg2 )
	{
		WATCH_DATA *pinsert;
		CHAR_DATA *vic;

		if (first_watch)                            /* check for dups */
			for ( pw = first_watch; pw; pw = pw->next )
				if ( !str_cmp(ch->name, pw->imm_name)
				     && pw->player_site
				     && !str_cmp(arg2 , pw->player_site) )
				{
					send_to_pager("You are already watching that site.\n\r", ch);
					return ;
				}

		CREATE( pinsert, WATCH_DATA, 1 );           /* create new watch */
		pinsert->imm_level = get_trust(ch);
		pinsert->imm_name = str_dup( strlower( ch->name ) );
		pinsert->player_site = str_dup( strlower( arg2 ) );
		pinsert->target_name = NULL;

		for ( vic = first_char; vic; vic = vic->next )
			if ( !IS_NPC(vic) && vic->desc && *pinsert->player_site
			     && !str_prefix( pinsert->player_site, vic->desc->host )
			     && get_trust(vic) < pinsert->imm_level )
				SET_BIT( vic->pcdata->flags, PCFLAG_WATCH );

		if (first_watch)                            /* ins new watch if app */
			for ( pw = first_watch; pw; pw = pw->next )
				if ( strcmp(pinsert->imm_name, pw->imm_name) < 0 )
				{
					INSERT( pinsert, pw, first_watch, next, prev );
					save_watchlist( );
					send_to_pager(
					    "Ok. That site will be watched.\n\r", ch);
					return ;
				}

		LINK( pinsert, first_watch, last_watch, next, prev );
		save_watchlist( );
		send_to_pager("Ok. That site will be watched.\n\r", ch);
		return ;
	}

	/*
	 * Watch a specific command - FB
	 */
	if (!str_cmp(arg, "command") && *arg2)
	{
		WATCH_DATA *pinsert;
		CMDTYPE *cmd;
		bool found = FALSE;

		for (pw = first_watch; pw; pw = pw->next)
		{
			if (!str_cmp(ch->name, pw->imm_name)
			    && pw->target_name
			    && !str_cmp(arg2, pw->target_name))
			{
				send_to_pager("You are already watching that command.\n\r", ch);
				return ;
			}
		}

		for (cmd = command_hash[LOWER(arg2[0]) % 126]; cmd; cmd = cmd->next )
		{
			if (!strcmp(arg2, cmd->name))
			{
				found = TRUE;
				break;
			}
		}

		if (!found)
		{
			send_to_pager("No such command exists.\n\r", ch);
			return ;
		}
		else
		{
			SET_BIT(cmd->flags, CMD_WATCH);
		}

		CREATE(pinsert, WATCH_DATA, 1);
		pinsert->imm_level = get_trust(ch);
		pinsert->imm_name = str_dup(strlower(ch->name));
		pinsert->player_site = NULL;
		pinsert->target_name = str_dup(arg2);

		for (pw = first_watch; pw; pw = pw->next)
		{
			if (strcmp(pinsert->imm_name, pw->imm_name) < 0)
			{
				INSERT(pinsert, pw, first_watch, next, prev);
				save_watchlist();
				send_to_pager("Ok, That command will be watched.\n\r", ch);
				return ;
			}
		}

		LINK(pinsert, first_watch, last_watch, next, prev);
		save_watchlist();
		send_to_pager("Ok. That site will be watched.\n\r", ch);
		return ;
	}

	send_to_pager("Sorry. I can't do anything with that. "
	              "Please read the help file.\n\r", ch);
	return ;
}

void do_wizhelp( CHAR_DATA *ch, char *argument )
{
	CMDTYPE * cmd;
	int col, hash;
	int curr_lvl;
	col = 0;

	for ( curr_lvl = LEVEL_AVATAR; curr_lvl <= get_trust( ch );
	      curr_lvl++)
	{
		col = 0;
		pager_printf( ch, "\n\r\n\r&W[LEVEL %-2d]:&w\n\r", curr_lvl);
		for (hash = 0; hash < 126; hash++ )
			for ( cmd = command_hash[hash]; cmd; cmd = cmd->next )
				if (( cmd->level == curr_lvl)
				    && cmd->level <= get_trust( ch ) )
				{
					pager_printf( ch, "%-15s", cmd->name );
					if ( ++col == 5 )
					{
						col = 0;
						send_to_pager( "\n\r", ch );
					}
				}
	}
	pager_printf( ch, "\n\r");
	return ;
}

void do_restrict( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char buf[MAX_STRING_LENGTH];
	sh_int level, hash;
	CMDTYPE *cmd;
	bool found;

	found = FALSE;
	set_char_color( AT_IMMORT, ch );

	argument = one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_char( "Restrict which command?\n\r", ch );
		return ;
	}

	argument = one_argument ( argument, arg2 );
	if ( arg2[0] == '\0' )
		level = get_trust( ch );
	else
		level = atoi( arg2 );

	level = UMAX( UMIN( get_trust( ch ), level ), 0 );

	hash = arg[0] % 126;
	for ( cmd = command_hash[hash]; cmd; cmd = cmd->next )
	{
		if ( !str_prefix( arg, cmd->name )
		     && cmd->level <= get_trust( ch ) )
		{
			found = TRUE;
			break;
		}
	}

	if ( found )
	{
		if ( !str_prefix( arg2, "show" ) )
		{
			sprintf(buf, "%s show", cmd->name);
			do_cedit(ch, buf);
			/*    		ch_printf( ch, "%s is at level %d.\n\r", cmd->name, cmd->level );*/
			return ;
		}
		cmd->level = level;
		ch_printf( ch, "You restrict %s to level %d\n\r",
		           cmd->name, level );
		sprintf( buf, "%s restricting %s to level %d",
		         ch->name, cmd->name, level );
		log_string( buf );
	}
	else
		send_to_char( "You may not restrict that command.\n\r", ch );

	return ;
}

/*
 * Check if the name prefix uniquely identifies a char descriptor
 */
CHAR_DATA *get_waiting_desc( CHAR_DATA *ch, char *name )
{
	DESCRIPTOR_DATA *d;
	CHAR_DATA *ret_char = NULL;
	static unsigned int number_of_hits;

	number_of_hits = 0;
	for ( d = first_descriptor; d; d = d->next )
	{
		if ( d->character && (!str_prefix( name, d->character->name )) &&
		     IS_WAITING_FOR_AUTH(d->character) )
		{
			if ( ++number_of_hits > 1 )
			{
				ch_printf( ch, "%s does not uniquely identify a char.\n\r", name );
				return NULL;
			}
			ret_char = d->character;       /* return current char on exit */
		}
	}
	if ( number_of_hits == 1 )
		return ret_char;
	else
	{
		send_to_char( "No one like that waiting for authorization.\n\r", ch );
		return NULL;
	}
}

void do_bamfin( CHAR_DATA *ch, char *argument )
{
	if ( !IS_NPC(ch) )
	{
		smash_tilde( argument );
		DISPOSE( ch->pcdata->bamfin );
		ch->pcdata->bamfin = str_dup( argument );
		send_to_char_color( "&YBamfin set.\n\r", ch );
	}
	return ;
}

void do_bamfout( CHAR_DATA *ch, char *argument )
{
	if ( !IS_NPC(ch) )
	{
		smash_tilde( argument );
		DISPOSE( ch->pcdata->bamfout );
		ch->pcdata->bamfout = str_dup( argument );
		send_to_char_color( "&YBamfout set.\n\r", ch );
	}
	return ;
}

void do_rank( CHAR_DATA *ch, char *argument )
{

	set_char_color( AT_IMMORT, ch );

	if ( IS_NPC(ch) )
		return ;
	if ( !argument || argument[0] == '\0' )
	{
		send_to_char( "Usage:  rank <string>.\n\r", ch );
		send_to_char( "   or:  rank none.\n\r", ch );
		return ;
	}
	smash_tilde( argument );
	DISPOSE( ch->pcdata->rank );
	if ( !str_cmp( argument, "none" ) )
		ch->pcdata->rank = str_dup( "" );
	else
		ch->pcdata->rank = str_dup( argument );
	send_to_char( "Ok.\n\r", ch );
	return ;
}

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

	set_char_color( AT_IMMORT, ch );

	one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_char( "Retire whom?\n\r", ch );
		return ;
	}
	if ( ( victim = get_char_world( ch, arg ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return ;
	}
	if ( IS_NPC( victim ) )
	{
		send_to_char( "Not on NPC's.\n\r", ch );
		return ;
	}
	if ( get_trust( victim ) >= get_trust( ch ) )
	{
		send_to_char( "You failed.\n\r", ch );
		return ;
	}
	if ( victim->level < LEVEL_SAVIOR )
	{
		send_to_char( "The minimum level for retirement is savior.\n\r", ch );
		return ;
	}
	if ( IS_RETIRED( victim ) )
	{
		REMOVE_BIT( victim->pcdata->flags, PCFLAG_RETIRED );
		ch_printf( ch, "%s returns from retirement.\n\r", victim->name );
		ch_printf( victim, "%s brings you back from retirement.\n\r", ch->name );
	}
	else
	{
		SET_BIT( victim->pcdata->flags, PCFLAG_RETIRED );
		ch_printf( ch, "%s is now a retired immortal.\n\r", victim->name );
		ch_printf( victim, "Courtesy of %s, you are now a retired immortal.\n\r", ch->name );
	}
	return ;
}

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

	set_char_color( AT_IMMORT, ch );

	argument = one_argument( argument, arg );
	if ( !*arg )
	{
		send_to_char( "Syntax:  delay <victim> <# of rounds>\n\r", ch );
		return ;
	}
	if ( !( victim = get_char_world( ch, arg ) ) )
	{
		send_to_char( "No such character online.\n\r", ch );
		return ;
	}
	if ( IS_NPC( victim ) )
	{
		send_to_char( "Mobiles are unaffected by lag.\n\r", ch );
		return ;
	}
	if ( !IS_NPC(victim) && get_trust( victim ) >= get_trust( ch ) )
	{
		send_to_char( "You haven't the power to succeed against them.\n\r", ch );
		return ;
	}
	argument = one_argument(argument, arg);
	if ( !*arg )
	{
		send_to_char( "For how long do you wish to delay them?\n\r", ch );
		return ;
	}
	if ( !str_cmp( arg, "none" ) )
	{
		send_to_char( "All character delay removed.\n\r", ch );
		victim->wait = 0;
		return ;
	}
	delay = atoi( arg );
	if ( delay < 1 )
	{
		send_to_char( "Pointless.  Try a positive number.\n\r", ch );
		return ;
	}
	if ( delay > 999 )
	{
		send_to_char( "You cruel bastard.  Just kill them.\n\r", ch );
		return ;
	}
	WAIT_STATE( victim, delay * PULSE_VIOLENCE );
	ch_printf( ch, "You've delayed %s for %d rounds.\n\r", victim->name, delay );
	return ;
}

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

	set_char_color( AT_IMMORT, ch );

	one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_char( "Deny whom?\n\r", ch );
		return ;
	}
	if ( ( victim = get_char_world( ch, arg ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return ;
	}
	if ( IS_NPC( victim ) )
	{
		send_to_char( "Not on NPC's.\n\r", ch );
		return ;
	}
	if ( get_trust( victim ) >= get_trust( ch ) )
	{
		send_to_char( "You failed.\n\r", ch );
		return ;
	}
	xSET_BIT(victim->act, PLR_DENY);
	set_char_color( AT_IMMORT, victim );
	send_to_char( "You are denied access!\n\r", victim );
	ch_printf( ch, "You have denied access to %s.\n\r", victim->name );
	if ( victim->fighting )
		stop_fighting( victim, TRUE ); /* Blodkai, 97 */
	add_hiscore( "pkill", victim->name, 0 );
	add_hiscore( "sparwins", victim->name, 0 );
	add_hiscore( "sparloss", victim->name, 0 );
	add_hiscore( "mkills", victim->name, 0 );
	add_hiscore( "deaths", victim->name, 0 );
	add_hiscore_ld( "powerlevel", victim->name, 0 );
	if (is_saiyan(ch))
		add_hiscore_ld( "plsaiyan", victim->name, 0 );
	if (is_human(ch))
		add_hiscore_ld( "plhuman", victim->name, 0 );
	if (is_hb(ch))
		add_hiscore_ld( "plhalfbreed", victim->name, 0 );
	if (is_namek(ch))
		add_hiscore_ld( "plnamek", victim->name, 0 );
	if (is_android(ch))
		add_hiscore_ld( "plandroid", victim->name, 0 );
	if (is_icer(ch))
		add_hiscore_ld( "plicer", victim->name, 0 );
	if (is_bio(ch))
		add_hiscore_ld( "plbio-android", victim->name, 0 );
	if (is_kaio(ch))
                add_hiscore_ld( "plkaio", victim->name, 0 );
	if (is_demon(ch))
                add_hiscore_ld( "pldemon", victim->name, 0 );
	add_hiscore( "played", victim->name, 0 );
	add_hiscore( "zeni", victim->name, 0 );
	add_hiscore( "bounty", victim->name, 0 );
	do_quit( victim, "" );
	return ;
}

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

	set_char_color( AT_IMMORT, ch );

	one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_char( "Disconnect whom?\n\r", ch );
		return ;
	}
	if ( ( victim = get_char_world( ch, arg ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return ;
	}
	if ( victim->desc == NULL )
	{
		act( AT_PLAIN, "$N doesn't have a descriptor.", ch, NULL, victim, TO_CHAR );
		return ;
	}
	if ( get_trust(ch) <= get_trust( victim ) )
	{
		send_to_char( "They might not like that...\n\r", ch );
		return ;
	}

	for ( d = first_descriptor; d; d = d->next )
	{
		if ( d == victim->desc )
		{
			close_socket( d, FALSE );
			send_to_char( "Ok.\n\r", ch );
			return ;
		}
	}
	bug( "Do_disconnect: *** desc not found ***.", 0 );
	send_to_char( "Descriptor not found!\n\r", ch );
	return ;
}


/*
 * Force a level one player to quit.             Gorog
 */
void do_fquit( CHAR_DATA *ch, char *argument )
{
	CHAR_DATA *victim;
	char arg1[MAX_INPUT_LENGTH];

	set_char_color( AT_IMMORT, ch );

	argument = one_argument( argument, arg1 );
	if ( arg1[0] == '\0' )
	{
		send_to_char( "Force whom to quit?\n\r", ch );
		return ;
	}
	if ( !( victim = get_char_world( ch, arg1 ) ) )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return ;
	}
	if ( victim->level != 1 && !IS_IMMORTAL( ch ) )
	{
		send_to_char( "They are not level one!\n\r", ch );
		return ;
	}
	set_char_color( AT_IMMORT, victim );
	send_to_char( "You have been forced to quit...\n\r", victim );
	if ( victim->fighting )
		stop_fighting( victim, TRUE );
	do_quit (victim, "");
	ch_printf( ch, "You have forced %s to quit.\n\r", victim->name );
	return ;
}

void do_forceclose( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	DESCRIPTOR_DATA *d;
	int desc;

	set_char_color( AT_IMMORT, ch );

	one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_char( "Usage: forceclose <descriptor#>\n\r", ch );
		return ;
	}

	desc = atoi( arg );
	for ( d = first_descriptor; d; d = d->next )
	{
		if ( d->descriptor == desc )
		{
			if ( d->character && get_trust(d->character) >= get_trust(ch) )
			{
				send_to_char( "They might not like that...\n\r", ch );
				return ;
			}
			close_socket( d, FALSE );
			send_to_char( "Ok.\n\r", ch );
			return ;
		}
	}
	send_to_char( "Not found!\n\r", ch );
	return ;
}

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

	set_char_color( AT_IMMORT, ch );

	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );
	if ( arg1[0] == '\0' || arg2[0] == '\0' )
	{
		send_to_char( "Syntax: pardon <character> <killer|thief|attacker>.\n\r", ch );
		return ;
	}
	if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return ;
	}
	if ( IS_NPC( victim ) )
	{
		send_to_char( "Not on NPC's.\n\r", ch );
		return ;
	}

	if ( !str_cmp( arg2, "attacker" ) )
	{
		if ( xIS_SET(victim->act, PLR_ATTACKER) )
		{
			xREMOVE_BIT( victim->act, PLR_ATTACKER );
			ch_printf( ch, "Attacker flag removed from %s.\n\r", victim->name );
			set_char_color( AT_IMMORT, victim );
			send_to_char( "You are no longer an ATTACKER.\n\r", victim );
		}
		return ;
	}
	if ( !str_cmp( arg2, "killer" ) )
	{
		if ( xIS_SET(victim->act, PLR_KILLER) )
		{
			xREMOVE_BIT(victim->act, PLR_KILLER );
			ch_printf( ch, "Killer flag removed from %s.\n\r", victim->name );
			set_char_color( AT_IMMORT, victim );
			send_to_char( "You are no longer a KILLER.\n\r", victim );
		}
		return ;
	}
	if ( !str_cmp( arg2, "thief" ) )
	{
		if ( xIS_SET(victim->act, PLR_THIEF) )
		{
			xREMOVE_BIT(victim->act, PLR_THIEF );
			ch_printf( ch, "Thief flag removed from %s.\n\r", victim->name );
			set_char_color( AT_IMMORT, victim );
			send_to_char( "You are no longer a THIEF.\n\r", victim );
		}
		return ;
	}
	send_to_char( "Syntax: pardon <character> <killer|thief>.\n\r", ch );
	return ;
}

void echo_to_all( sh_int AT_COLOR, char *argument, sh_int tar )
{
	DESCRIPTOR_DATA *d;

	if ( !argument || argument[0] == '\0' )
		return ;

	for ( d = first_descriptor; d; d = d->next )
	{
		/* Added showing echoes to players who are editing, so they won't
		   miss out on important info like upcoming reboots. --Narn */
		if ( d->connected == CON_PLAYING || d->connected == CON_EDITING )
		{
			/* This one is kinda useless except for switched.. */
			if ( tar == ECHOTAR_PC && IS_NPC(d->character) )
				continue;
			else if ( tar == ECHOTAR_IMM && !IS_IMMORTAL(d->character) )
				continue;
			set_char_color( AT_COLOR, d->character );
			send_to_char( argument, d->character );
			send_to_char( "\n\r", d->character );
		}
	}
	return ;
}

void do_ech( CHAR_DATA *ch, char *argument )
{
	send_to_char_color( "&YIf you want to echo something, use 'echo'.\n\r", ch );
	return ;
}

void do_echo( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	sh_int color;
	int target;
	char *parg;
	char message[MAX_STRING_LENGTH];

	set_char_color( AT_IMMORT, ch );

	if ( xIS_SET(ch->act, PLR_NO_EMOTE) )
	{
		send_to_char( "You can't do that right now.\n\r", ch );
		return ;
	}
	if ( argument[0] == '\0' )
	{
		send_to_char( "Echo what?\n\r", ch );
		return ;
	}

	if ( (color = get_color(argument)) )
		argument = one_argument(argument, arg);
	parg = argument;
	argument = one_argument(argument, arg);
	if ( !str_cmp( arg, "PC" )
	     || !str_cmp( arg, "player" ) )
		target = ECHOTAR_PC;
	else if ( !str_cmp( arg, "imm" ) )
		target = ECHOTAR_IMM;
	else
	{
		target = ECHOTAR_ALL;
		argument = parg;
	}
	if ( !color && (color = get_color(argument)) )
		argument = one_argument(argument, arg);
	if ( !color )
		color = AT_IMMORT;
	one_argument(argument, arg);
	sprintf( message, "%s", argument );
	while ( strstr( message, "/n" ) && get_trust( ch ) >= LEVEL_ASCENDANT )
	{
		char *ptr;

		ptr = strstr( message, "/n" );

		*ptr = '\n';
		ptr++;
		*ptr = '\r';
	}

	echo_to_all ( color, message, target );
}

void echo_to_room( sh_int AT_COLOR, ROOM_INDEX_DATA *room, char *argument )
{
	CHAR_DATA *vic;

	if (room == NULL)
	{
		bug( "NULL ROOM: echo_to_room() %s", argument, 0 );
		return ;
	}

	for ( vic = room->first_person; vic; vic = vic->next_in_room )
	{
		if (!vic)
		{
			continue;
		}
		set_char_color( AT_COLOR, vic );
		send_to_char( argument, vic );
		send_to_char( "\n\r", vic );
	}
}
void echo_to_area( AREA_DATA *area, char *argument )
{
    CHAR_DATA *vic;

        if (area == NULL)
        {
                bug( "NULL AREA: echo_to_area() %s", argument, 0 );
                return;
        }

	for ( vic = first_char; vic; vic = vic->next )
        {
            if (!vic)
                continue;
	    if( IS_NPC(vic) )
		continue;
	    if( vic->in_room->area != area )
		continue;
            send_to_char( argument, vic );
            send_to_char( "\n\r", vic );
        }
}

void do_recho( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	sh_int color;
	char message[MAX_STRING_LENGTH];

	set_char_color( AT_IMMORT, ch );

	if ( xIS_SET(ch->act, PLR_NO_EMOTE) )
	{
		send_to_char( "You can't do that right now.\n\r", ch );
		return ;
	}
	if ( argument[0] == '\0' )
	{
		send_to_char( "Recho what?\n\r", ch );
		return ;
	}

	one_argument( argument, arg );

	if ( (color = get_color ( argument )) )
	{
		argument = one_argument ( argument, arg );
		sprintf( message, "%s", argument );
		while ( strstr( message, "/n" ) && get_trust( ch ) >= 55 )
		{
			char *ptr;

			ptr = strstr( message, "/n" );

			*ptr = '\n';
			ptr++;
			*ptr = '\r';
		}
		echo_to_room ( color, ch->in_room, message );
	}
	else
	{
		sprintf( message, "%s", argument );
		while ( strstr( message, "/n" ) && get_trust( ch ) >= 55 )
		{
			char *ptr;

			ptr = strstr( message, "/n" );

			*ptr = '\n';
			ptr++;
			*ptr = '\r';
		}
		echo_to_room ( AT_IMMORT, ch->in_room, message );
	}
}

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

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

	if (!str_cmp(arg, "pk")) /* "Goto pk", "at pk", etc */
		return get_room_index( last_pkroom );

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

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

	return NULL;
}

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

	set_char_color( AT_IMMORT, ch );

	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );
	if ( arg1[0] == '\0' )
	{
		send_to_char( "Transfer whom (and where)?\n\r", ch );
		return ;
	}
	if ( !str_cmp( arg1, "all" ) && get_trust(ch) >= LEVEL_SUB_IMPLEM)
	{
		for ( d = first_descriptor; d; d = d->next )
		{
			if ( d->connected == CON_PLAYING
			     && d->character != ch
			     && d->character->in_room
			     && d->newstate != 2
			     && can_see( ch, d->character ) )
			{
				char buf[MAX_STRING_LENGTH];
				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 ) ) == NULL )
		{
			send_to_char( "No such location.\n\r", ch );
			return ;
		}
		if ( room_is_private( location ) && get_trust( ch ) < sysdata.level_override_private )
		{
			send_to_char( "That room is private right now.\n\r", ch );
			return ;
		}
		if( room_is_dnd( ch, location ) )
		{
			send_to_char( "That room is marked 'DND' right now.\n\r", ch );
			return;
		}
	}
	if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return ;
	}
/*
	if ( NOT_AUTHED( victim ) )
	{
	   send_to_char( "They might not be in the auth list yet!\n\r", ch);
	   return;
	}
*/
	if ( !victim->in_room )
	{
		send_to_char( "They have no physical location!\n\r", ch );
		return ;
	}
	if ( get_trust( ch ) < get_trust( victim ) && !IS_NPC(victim) )
	{
		send_to_char( "You better not, that person is more goddly than you.\n\r", ch );
		return ;
	}
	/* modification to prevent a low level imm from transferring a */
	/* higher level imm with the DND flag on.  - Gorog             */
	if ( !IS_NPC(victim) && get_trust(ch) < get_trust(victim)
	     && victim->desc
	     && (victim->desc->connected == CON_PLAYING
	         || victim->desc->connected == CON_EDITING )
	     && IS_SET(victim->pcdata->flags, PCFLAG_DND) )
	{
		pager_printf( ch,
		              "Sorry. %s does not wish to be disturbed.\n\r", victim->name);
		pager_printf( victim,
		              "Your DND flag just foiled %s's transfer command.\n\r", ch->name);
		return ;
	}
	/* end of modification                                         */

	if ( victim->fighting )
		stop_fighting( victim, TRUE );
	act( AT_MAGIC, "$n disappears in a cloud of swirling colors.", victim, NULL, NULL, TO_ROOM );
	victim->retran = victim->in_room->vnum;
	char_from_room( victim );
	char_to_room( victim, location );
	act( AT_MAGIC, "$n arrives from a puff of smoke.", victim, NULL, NULL, TO_ROOM );
	if ( ch != victim )
		act( AT_IMMORT, "$n has transferred you.", ch, NULL, victim, TO_VICT );
	do_look( victim, "auto" );
	if ( !IS_IMMORTAL( victim ) && !IS_NPC( victim )
	     && !in_hard_range( victim, location->area ) )
		act( AT_DANGER, "Warning:  this player's level is not within the area's level range.", ch, NULL, NULL, TO_CHAR );
}

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

	set_char_color( AT_IMMORT, ch );

	argument = one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_char("Retransfer whom?\n\r", ch );
		return ;
	}
	if ( !(victim = get_char_world(ch, arg)) )
	{
		send_to_char("They aren't here.\n\r", ch );
		return ;
	}
	sprintf(buf, "'%s' %d", victim->name, victim->retran);
	do_transfer(ch, buf);
	return ;
}

void do_regoto( CHAR_DATA *ch, char *argument )
{
	char buf[MAX_STRING_LENGTH];

	sprintf(buf, "%d", ch->regoto);
	do_goto(ch, buf);
	return ;
}

/*  Added do_at and do_atobj to reduce lag associated with at
 *  --Shaddai
 */
void do_at( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	ROOM_INDEX_DATA *location = NULL;
	ROOM_INDEX_DATA *original;
	CHAR_DATA *wch = NULL, *victim;

	set_char_color( AT_IMMORT, ch );

	argument = one_argument( argument, arg );
	if ( arg[0] == '\0' || argument[0] == '\0' )
	{
		send_to_char( "At where what?\n\r", ch );
		return ;
	}
	if ( is_number( arg ) )
		location = get_room_index( atoi( arg ) );
	else if ( !str_cmp(arg, "pk"))
		location = get_room_index( last_pkroom );
	else if ( ( wch = get_char_world( ch, arg ) ) == NULL
	          || wch->in_room == NULL)
	{
		send_to_char( "No such mobile or player in existance.\n\r", ch );
		return ;
	}
	if ( !location && wch )
		location = wch->in_room;

	if ( !location )
	{
		send_to_char( "No such location exists.\n\r", ch );
		return ;
	}

	/* The following mod is used to prevent players from using the */
	/* at command on a higher level immortal who has a DND flag    */
	if ( wch && !IS_NPC(wch)
	     && IS_SET(wch->pcdata->flags, PCFLAG_DND)
	     && get_trust(ch) < get_trust(wch) )
	{
		pager_printf( ch,
		              "Sorry. %s does not wish to be disturbed.\n\r",
		              wch->name);
		pager_printf( wch,
		              "Your DND flag just foiled %s's at command.\n\r", ch->name);
		return ;
	}
	/* End of modification  -- Gorog */


	if ( room_is_private( location ) )
	{
		if ( get_trust( ch ) < sysdata.level_override_private )
		{
			send_to_char( "That room is private right now.\n\r", ch );
			return ;
		}
		else
			send_to_char( "Overriding private flag!\n\r", ch );
	}

	if ( (victim = room_is_dnd(ch, location)) )
	{
		pager_printf( ch, "That room is \"do not disturb\" right now.\n\r" );
		pager_printf( victim,
		              "Your DND flag just foiled %s's atmob command\n\r", ch->name );
		return ;
	}

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

	if ( !char_died(ch) )
	{
		char_from_room( ch );
		char_to_room( ch, original );
	}
	return ;
}

void do_atobj( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	ROOM_INDEX_DATA *location;
	ROOM_INDEX_DATA *original;
	OBJ_DATA *obj;
	CHAR_DATA *victim;

	set_char_color( AT_IMMORT, ch );

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

	if ( ( obj = get_obj_world( ch, arg ) ) == NULL
	     || !obj->in_room )
	{
		send_to_char( "No such object in existance.\n\r", ch );
		return ;
	}
	location = obj->in_room;
	if ( room_is_private( location ) )
	{
		if ( get_trust( ch ) < sysdata.level_override_private )
		{
			send_to_char( "That room is private right now.\n\r", ch );
			return ;
		}
		else
			send_to_char( "Overriding private flag!\n\r", ch );
	}

	if ( (victim = room_is_dnd(ch, location)) )
	{
		pager_printf( ch, "That room is \"do not disturb\" right now.\n\r" );
		pager_printf( victim,
		              "Your DND flag just foiled %s's atobj command\n\r", ch->name );
		return ;
	}

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

	if ( !char_died(ch) )
	{
		char_from_room( ch );
		char_to_room( ch, original );
	}
	return ;
}

void do_rat( CHAR_DATA *ch, char *argument )
{
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	ROOM_INDEX_DATA *location;
	ROOM_INDEX_DATA *original;
	int Start, End, vnum;

	set_char_color( AT_IMMORT, ch );

	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );
	if ( arg1[0] == '\0' || arg2[0] == '\0' || argument[0] == '\0' )
	{
		send_to_char( "Syntax: rat <start> <end> <command>\n\r", ch );
		return ;
	}

	Start = atoi( arg1 );
	End = atoi( arg2 );
	if ( Start < 1 || End < Start || Start > End || Start == End || End > MAX_VNUMS )
	{
		send_to_char( "Invalid range.\n\r", ch );
		return ;
	}
	if ( !str_cmp( argument, "quit" ) )
	{
		send_to_char( "I don't think so!\n\r", ch );
		return ;
	}

	original = ch->in_room;
	for ( vnum = Start; vnum <= End; vnum++ )
	{
		if ( (location = get_room_index(vnum)) == NULL )
			continue;
		char_from_room( ch );
		char_to_room( ch, location );
		interpret( ch, argument );
	}

	char_from_room( ch );
	char_to_room( ch, original );
	send_to_char( "Done.\n\r", ch );
	return ;
}

void do_rstat( CHAR_DATA *ch, char *argument )
{
	char buf[MAX_STRING_LENGTH];
	char arg[MAX_INPUT_LENGTH];
	char *sect;
	ROOM_INDEX_DATA *location;
	OBJ_DATA *obj;
	CHAR_DATA *rch;
	EXIT_DATA *pexit;
	AFFECT_DATA *paf;
	int cnt;
	static char *dir_text[] = { "n", "e", "s", "w", "u", "d", "ne", "nw", "se", "sw", "?" };

	one_argument( argument, arg );
	if ( !str_cmp( arg, "ex" ) || !str_cmp( arg, "exits" ) )
	{
		location = ch->in_room;

		if (!xIS_SET(location->room_flags, ROOM_PROTOTYPE)
		    && get_trust( ch ) < sysdata.level_modify_proto )
		{
			send_to_char( "You don't have the power to do that.\n\r", ch );
			return ;
		}

		ch_printf_color( ch, "&cExits for room '&W%s&c'  Vnum &W%d\n\r",
		                 location->name, location->vnum );
		for ( cnt = 0, pexit = location->first_exit; pexit; pexit = pexit->next )
			ch_printf_color( ch,
			                 "&W%2d) &w%2s to %-5d  &cKey: &w%d  &cFlags: &w%d  &cKeywords: '&w%s&c'\n\r     Exdesc: &w%s     &cBack link: &w%d  &cVnum: &w%d  &cDistance: &w%d  &cPulltype: &w%s  &cPull: &w%d\n\r",
			                 ++cnt,
			                 dir_text[pexit->vdir],
			                 pexit->to_room ? pexit->to_room->vnum : 0,
			                 pexit->key,
			                 pexit->exit_info,
			                 pexit->keyword,
			                 pexit->description[0] != '\0'
			                 ? pexit->description : "(none).\n\r",
			                 pexit->rexit ? pexit->rexit->vnum : 0,
			                 pexit->rvnum,
			                 pexit->distance,
			                 pull_type_name(pexit->pulltype),
			                 pexit->pull );
		return ;
	}
	location = ( arg[0] == '\0' ) ? ch->in_room : find_location( ch, arg );
	if ( !location )
	{
		send_to_char( "No such location.\n\r", ch );
		return ;
	}

/*
	if (!xIS_SET(location->room_flags, ROOM_PROTOTYPE)
	    && get_trust( ch ) < sysdata.level_modify_proto )
	{
		send_to_char( "You don't have the power to do that.\n\r", ch );
		return ;
	}
*/
	if ( ch->in_room != location && room_is_private( location ) )
	{
		if ( get_trust( ch ) < sysdata.level_override_private )
		{
			send_to_char( "That room is private right now.\n\r", ch );
			return ;
		}
		else
			send_to_char( "Overriding private flag!\n\r", ch );
	}

	ch_printf_color( ch, "&cName: &w%s\n\r&cArea: &w%s  &cFilename: &w%s\n\r",
	                 location->name,
	                 location->area ? location->area->name : "None????",
	                 location->area ? location->area->filename : "None????" );

	switch ( ch->in_room->sector_type )
	{
		default:
			sect = "BUG: NOTIFY GOKU";
			break;
		case SECT_INSIDE:
			sect = "Inside";
			break;
		case SECT_CITY:
			sect = "City";
			break;
		case SECT_FIELD:
			sect = "Field";
			break;
		case SECT_FOREST:
			sect = "Forest";
			break;
		case SECT_HILLS:
			sect = "Hills";
			break;
		case SECT_MOUNTAIN:
			sect = "Mountains";
			break;
		case SECT_WATER_SWIM:
			sect = "Swim";
			break;
		case SECT_WATER_NOSWIM:
			sect = "Noswim";
			break;
		case SECT_UNDERWATER:
			sect = "Underwater";
			break;
		case SECT_AIR:
			sect = "Air";
			break;
		case SECT_DESERT:
			sect = "Desert";
			break;
		case SECT_OCEANFLOOR:
			sect = "Oceanfloor";
			break;
		case SECT_UNDERGROUND:
			sect = "Underground";
			break;
		case SECT_LAVA:
			sect = "Lava";
			break;
		case SECT_SWAMP:
			sect = "Swamp";
			break;
		case SECT_SPACE:
			sect = "Space";
			break;
	}

	ch_printf_color( ch, "&cVnum: &w%d   &cSector: &w%d (%s)   &cLight: &w%d",
	                 location->vnum,
	                 location->sector_type,
	                 sect,
	                 location->light );
	if ( location->tunnel > 0 )
		ch_printf_color( ch, "   &cTunnel: &W%d", location->tunnel );
	send_to_char( "\n\r", ch );
	if ( location->tele_delay > 0 || location->tele_vnum > 0 )
		ch_printf_color( ch, "&cTeleDelay: &R%d   &cTeleVnum: &R%d\n\r",
		                 location->tele_delay,
		                 location->tele_vnum );
	ch_printf_color( ch, "&cRoom flags: &w%s\n\r",
	                 ext_flag_string(&location->room_flags, r_flags) );
	ch_printf_color( ch, "&cDescription:\n\r&w%s", location->description );
	if ( location->first_extradesc )
	{
		EXTRA_DESCR_DATA *ed;

		send_to_char_color( "&cExtra description keywords: &w'", ch );
		for ( ed = location->first_extradesc; ed; ed = ed->next )
		{
			send_to_char( ed->keyword, ch );
			if ( ed->next )
				send_to_char( " ", ch );
		}
		send_to_char( "'\n\r", ch );
	}
	for ( paf = location->first_affect; paf; paf = paf->next )
		ch_printf_color( ch, "&cAffect: &w%s &cby &w%d.\n\r",
		                 affect_loc_name( paf->location ), paf->modifier );

	send_to_char_color( "&cCharacters: &w", ch );
	for ( rch = location->first_person; rch; rch = rch->next_in_room )
	{
		if ( can_see( ch, rch ) )
		{
			send_to_char( " ", ch );
			one_argument( rch->name, buf );
			send_to_char( buf, ch );
		}
	}

	send_to_char_color( "\n\r&cObjects:    &w", ch );
	for ( obj = location->first_content; obj; obj = obj->next_content )
	{
		send_to_char( " ", ch );
		one_argument( obj->name, buf );
		send_to_char( buf, ch );
	}
	send_to_char( "\n\r", ch );

	if ( location->first_exit )
		send_to_char_color( "&c------------------- &wEXITS &c-------------------\n\r", ch );
	for ( cnt = 0, pexit = location->first_exit; pexit; pexit = pexit->next )
		ch_printf( ch,
		           "%2d) %-2s to %-5d.  Key: %d  Flags: %d  Keywords: %s.\n\r",
		           ++cnt,
		           dir_text[pexit->vdir],
		           pexit->to_room ? pexit->to_room->vnum : 0,
		           pexit->key,
		           pexit->exit_info,
		           pexit->keyword[0] != '\0' ? pexit->keyword : "(none)" );
	return ;
}

/* Face-lift by Demora */
void do_ostat( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	AFFECT_DATA *paf;
	OBJ_DATA *obj;
	double plMod;

	set_char_color( AT_CYAN, ch );

	one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_char( "Ostat what?\n\r", ch );
		return ;
	}
	if ( arg[0] != '\'' && arg[0] != '"' && strlen(argument) > strlen(arg) )
		strcpy( arg, argument );

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

	if ( !IS_OBJ_STAT(obj, ITEM_PROTOTYPE)
	     && get_trust( ch ) < sysdata.level_modify_proto )
	{
		send_to_char( "You don't have the power to do that.\n\r", ch );
		return ;
	}
	ch_printf(ch,"\n\r");
	ch_printf_color( ch, "&cName: &C%s\n\r", obj->name );
	ch_printf_color( ch, "&cVnum: &w%d  ", obj->pIndexData->vnum );
	ch_printf_color( ch, "&cType: &w%s  ", item_type_name( obj ) );
	ch_printf_color( ch, "&cCount:  &w%d  ", obj->pIndexData->count );
	ch_printf_color( ch, "&cGcount: &w%d\n\r", obj->count );
	ch_printf_color( ch, "&cSerial#: &w%d  ", obj->serial );
	ch_printf_color( ch, "&cTopIdxSerial#: &w%d  ", obj->pIndexData->serial );
	ch_printf_color( ch, "&cTopSerial#: &w%d\n\r", cur_obj_serial );
	ch_printf_color( ch, "&cShort description: &C%s\n\r", obj->short_descr);
	ch_printf_color( ch, "&cLong description : &C%s\n\r", obj->description);
	if ( obj->action_desc[0] != '\0' )
		ch_printf_color( ch, "&cAction description: &w%s\n\r", obj->action_desc );
	ch_printf_color( ch, "&cWear flags : &w%s\n\r", flag_string(obj->wear_flags, w_flags) );
	ch_printf_color( ch, "&cExtra flags: &w%s\n\r", ext_flag_string(&obj->extra_flags, o_flags) );
	ch_printf_color( ch, "&cMagic flags: &w%s\n\r", magic_bit_name( obj->magic_flags ) );
	ch_printf_color( ch, "&cNumber: &w%d/%d   ", 1, get_obj_number(obj) );
	ch_printf_color( ch, "&cWeight: &w%s/%s   ", num_punct(obj->weight), num_punct(get_obj_weight(obj)) );
	ch_printf_color( ch, "&cLayers: &w%d   ", obj->pIndexData->layers );
	ch_printf_color( ch, "&cWear_loc: &w%d\n\r", obj->wear_loc );
	ch_printf_color( ch, "&cCost: &Y%s  ", num_punct(obj->cost) );
	ch_printf_color( ch, "&cRent: &w%s  ", num_punct(obj->pIndexData->rent) );
	send_to_char_color( "&cTimer: ", ch );
	if ( obj->timer > 0 )
		ch_printf_color( ch, "&R%d  ", obj->timer );
	else
		ch_printf_color( ch, "&w%d  ", obj->timer );
	ch_printf_color( ch, "&cLevel: &P%s\n\r", num_punct_ld(obj->level) );
	ch_printf_color( ch, "&cIn room: &w%d  ", obj->in_room == NULL ? 0 : obj->in_room->vnum );
	ch_printf_color( ch, "&cIn object: &w%s  ", obj->in_obj == NULL ? "(none)" : obj->in_obj->short_descr );
	ch_printf_color( ch, "&cCarried by: &C%s\n\r", obj->carried_by == NULL ? "(none)" : obj->carried_by->name );
	ch_printf_color( ch, "&cIndex Values : &w%d %d %d %d %d %d.\n\r",
	                 obj->pIndexData->value[0], obj->pIndexData->value[1],
	                 obj->pIndexData->value[2], obj->pIndexData->value[3],
	                 obj->pIndexData->value[4], obj->pIndexData->value[5] );
	ch_printf_color( ch, "&cObject Values: &w%d %d %d %d %d %d.\n\r",
	                 obj->value[0], obj->value[1], obj->value[2], obj->value[3],
	                 obj->value[4], obj->value[5] );
	if (obj->item_type == ITEM_ARMOR && obj->value[3] > 0)
	{
		plMod = obj->value[3];
		plMod = plMod/10000;
		ch_printf_color( ch, "&W *Object Value 3 is giving a %f%% bonus to PL gains.\n\r", plMod * 100 );
	}
	if ( obj->pIndexData->first_extradesc )
	{
		EXTRA_DESCR_DATA *ed;
		send_to_char( "Primary description keywords:   '", ch );
		for ( ed = obj->pIndexData->first_extradesc; ed; ed = ed->next )
		{
			send_to_char( ed->keyword, ch );
			if ( ed->next )
				send_to_char( " ", ch );
		}
		send_to_char( "'.\n\r", ch );
	}
	if ( obj->first_extradesc )
	{
		EXTRA_DESCR_DATA *ed;
		send_to_char( "Secondary description keywords: '", ch );
		for ( ed = obj->first_extradesc; ed; ed = ed->next )
		{
			send_to_char( ed->keyword, ch );
			if ( ed->next )
				send_to_char( " ", ch );
		}
		send_to_char( "'.\n\r", ch );
	}
	for ( paf = obj->first_affect; paf; paf = paf->next )
		ch_printf_color( ch, "&cAffects &w%s &cby &w%d. (extra)\n\r",
		                 affect_loc_name( paf->location ), paf->modifier );
	for ( paf = obj->pIndexData->first_affect; paf; paf = paf->next )
		ch_printf_color( ch, "&cAffects &w%s &cby &w%d.\n\r",
		                 affect_loc_name( paf->location ), paf->modifier );
	return ;
}


void do_mstat( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	char hpbuf[MAX_STRING_LENGTH];
	char mnbuf[MAX_STRING_LENGTH];
	char mvbuf[MAX_STRING_LENGTH];
	//    char bdbuf[MAX_STRING_LENGTH];
	AFFECT_DATA *paf;
	CHAR_DATA *victim;
	SKILLTYPE *skill;
	int x;

	set_pager_color( AT_CYAN, ch );

	one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_pager( "Mstat whom?\n\r", ch );
		return ;
	}
	if ( arg[0] != '\'' && arg[0] != '"' && strlen(argument) > strlen(arg) )
		strcpy( arg, argument );

	if ( ( victim = get_char_world( ch, arg ) ) == NULL )
	{
		send_to_pager( "They aren't here.\n\r", ch );
		return ;
	}
	if ( get_trust( ch ) < get_trust( victim ) && !IS_NPC(victim) )
	{
		set_pager_color( AT_IMMORT, ch );
		send_to_pager( "Their godly glow prevents you from getting a good look.\n\r", ch );
		return ;
	}
	if ( IS_NPC( victim) && get_trust( ch ) < LEVEL_GREATER
	     && xIS_SET( victim->act, ACT_STATSHIELD ) )
	{
		set_pager_color( AT_IMMORT, ch );
		send_to_pager( "Their godly glow prevents you from getting a good look.\n\r", ch );
		return ;
	}

	if ( !IS_NPC(victim) && get_trust( ch ) < LEVEL_DEMI /*LEVEL_SUB_IMPLEM*/ )
	{
		send_to_char( "You don't have the power to do that.\n\r", ch );
		return ;
	}


	if ( IS_NPC(victim) && !xIS_SET(victim->act, ACT_PROTOTYPE)
	     && get_trust( ch ) < sysdata.level_modify_proto )
	{
		send_to_char( "You don't have the power to do that.\n\r", ch );
		return ;
	}

	pager_printf_color( ch, "\n\r&c%s: &C%-20s", IS_NPC(victim) ? "Mobile name" : "Name", victim->name );
	if ( !IS_NPC(victim) )
		pager_printf_color( ch, "&cStatus : &w%-10s", CAN_PKILL(victim) ? "Deadly" :
		                    IS_PKILL(victim) ? "Pre-Deadly" : "Non-Deadly" );
	if ( !IS_NPC(victim) && victim->pcdata->clan )
		pager_printf_color( ch, "   &c%s: &w%s",
		                    victim->pcdata->clan->clan_type == CLAN_ORDER ? "Order" :
		                    victim->pcdata->clan->clan_type == CLAN_GUILD ? "Guild" : "Clan",
		                    victim->pcdata->clan->name );
	send_to_pager( "\n\r", ch );
	if ( get_trust(ch) >= LEVEL_GOD && !IS_NPC(victim) && victim->desc )
		pager_printf_color( ch, "&cUser: &w%s@%s   Descriptor: %d  &cTrust: &w%d  &cAuthBy: &w%s\n\r",
		                    victim->desc->user, victim->desc->host, victim->desc->descriptor,
		                    victim->trust, victim->pcdata->authed_by[0] != '\0' ?
		                    victim->pcdata->authed_by : "(unknown)" );
	if ( !IS_NPC(victim) && victim->pcdata->release_date != 0 )
		pager_printf_color( ch, "&cHelled until %24.24s by %s.\n\r",
		                    ctime(&victim->pcdata->release_date),
		                    victim->pcdata->helled_by);
	pager_printf_color( ch, "&cVnum: &w%-5d    &cSex: &w%-6s    &cRoom: &w%-5d    &cCount: &w%d   &cKilled: &w%d\n\r",
	                    IS_NPC(victim) ? victim->pIndexData->vnum : 0,
	                    victim->sex == SEX_MALE ? "male" :
	                    victim->sex == SEX_FEMALE ? "female" : "neutral",
	                    victim->in_room == NULL ? 0 : victim->in_room->vnum,
	                    IS_NPC(victim) ? victim->pIndexData->count : 1,
	                    IS_NPC(victim) ? victim->pIndexData->killed
	                    : victim->pcdata->mdeaths + victim->pcdata->pdeaths );
	pager_printf_color( ch, "&cStr: &C%2d&c )( Int: &C%2d&c )( Wis: &C0&c )( Dex: &C%2d&c )( Con: &C%2d&c )( Cha: &C0&c )( Lck: &C%2d&c\n\r",
	                    get_curr_str(victim),
	                    get_curr_int(victim),
	                    get_curr_dex(victim),
	                    get_curr_con(victim),
	                    get_curr_lck(victim) );
	pager_printf_color( ch,
	                    "&cLevel   : &P%-2d              ", victim->level );
	pager_printf_color( ch, "&cClass  : &w%-2.2d/%-10s   &cRace      : &w%-2.2d/%-10s\n\r",
	                    victim->class,
	                    IS_NPC(victim) ? victim->class < MAX_NPC_CLASS && victim->class >= 0 ?
                    npc_class[victim->class] : "unknown" : victim->class < MAX_PC_CLASS &&
	                    class_table[victim->class]->who_name &&
	                    class_table[victim->class]->who_name[0] != '\0' ?
	                    class_table[victim->class]->who_name : "unknown",
	                    victim->race,
	                    IS_NPC(victim) ? victim->race < MAX_NPC_RACE && victim->race >= 0 ?
                    npc_race[victim->race] : "unknown" : victim->race < MAX_PC_RACE &&
	                    race_table[victim->race]->race_name &&
	                    race_table[victim->race]->race_name[0] != '\0' ?
	                    race_table[victim->race]->race_name : "unknown",
	                    npc_race[victim->race],
	                    victim->position );
	sprintf( hpbuf, "%d/%d", victim->hit, victim->max_hit );
	sprintf( mnbuf, "%d/%d", victim->mana, victim->max_mana );
	sprintf( mvbuf, "%d/%d", get_armor(victim), get_maxarmor(victim) );
	pager_printf_color( ch, "&cHps     : &w%-12s    &cMana   : &w%-12s    &cArmor     : &w%-12s\n\r",
	                    hpbuf, mnbuf, mvbuf );
	pager_printf_color( ch, "&cHitroll : &CN/A             &cAlign  : &w%-5d           &cDamage %% : &w%d\n\r",
	                    victim->alignment, GET_AC(victim) );
	pager_printf_color( ch, "&cDamroll : &C%-5d           &cWimpy  : &w%-5d           &cPosition  : &w%d\n\r",
	                    GET_DAMROLL(victim), victim->wimpy, victim->position );
	pager_printf_color( ch, "&cFighting: &w%-13s   &cMaster : &w%-13s   &cLeader    : &w%s\n\r",
	                    victim->fighting ? victim->fighting->who->name : "(none)",
	                    victim->master ? victim->master->name : "(none)",
	                    victim->leader ? victim->leader->name : "(none)" );
	if ( IS_NPC(victim) )
		pager_printf_color( ch, "&cHating  : &w%-13s   &cHunting: &w%-13s   &cFearing   : &w%s\n\r",
		                    victim->hating ? victim->hating->name : "(none)",
		                    victim->hunting ? victim->hunting->name : "(none)",
		                    victim->fearing ? victim->fearing->name : "(none)" );
	else
		pager_printf_color( ch, "&cDeity   : &w%-13s&w   &cFavor  : &w%-5d           &cGlory     : &w%-d (%d)\n\r",
		                    victim->pcdata->deity ? victim->pcdata->deity->name : "(none)",
		                    victim->pcdata->favor,
		                    victim->pcdata->quest_curr,
		                    victim->pcdata->quest_accum );
	if ( IS_NPC( victim ) )
		pager_printf_color( ch, "&cMob hitdie : &C%dd%d+%d    &cMob damdie : &C%dd%d+%d          &cNumAttacks(extra) : &C%d\n\r",
		                    victim->pIndexData->hitnodice,
		                    victim->pIndexData->hitsizedice,
		                    victim->pIndexData->hitplus,
		                    victim->pIndexData->damnodice,
		                    victim->pIndexData->damsizedice,
		                    victim->pIndexData->damplus,
		                    victim->numattacks );
	pager_printf_color( ch, "&cMentalState: &w%-3d   &cEmotionalState: &w%-3d   ",
	                    victim->mental_state, victim->emotional_state );
	if ( !IS_NPC( victim ) )
		pager_printf_color( ch, "&cThirst: &w%d   &cFull: &w%d   &cDrunk: &w%d\n\r",
		                    victim->pcdata->condition[COND_THIRST],
		                    victim->pcdata->condition[COND_FULL],
		                    victim->pcdata->condition[COND_DRUNK] );
	else
		send_to_pager( "\n\r", ch );
	pager_printf_color( ch, "&cSave versus: &w%d %d %d %d %d       &cItems: &w(%d/%d)  &cWeight &w(%s/%s)\n\r",
	                    victim->saving_poison_death,
	                    victim->saving_wand,
	                    victim->saving_para_petri,
	                    victim->saving_breath,
	                    victim->saving_spell_staff,
	                    victim->carry_number,
	                    can_carry_n(victim),
	                    num_punct(victim->carry_weight),
	                    num_punct(can_carry_w(victim)) );
	pager_printf_color( ch, "&cYear: &w%-5d  &cSecs: &w%d  &cTimer: &w%d  &cZeni: &Y%s\n\r",
	                    get_age( victim ), (int) victim->played, victim->timer, num_punct(victim->gold) );
	if ( get_timer( victim, TIMER_PKILLED ) )
		pager_printf_color( ch, "&cTimerPkilled:  &R%d\n\r",
		                    get_timer( victim, TIMER_PKILLED ) );
	if ( get_timer( victim, TIMER_RECENTFIGHT ) )
		pager_printf_color( ch, "&cTimerRecentfight:  &R%d\n\r",
		                    get_timer( victim, TIMER_RECENTFIGHT ) );
	if ( get_timer( victim, TIMER_ASUPRESSED ) )
		pager_printf_color( ch, "&cTimerAsupressed:  &R%d\n\r",
		                    get_timer( victim, TIMER_ASUPRESSED ) );
	if ( IS_NPC( victim ) )
		pager_printf_color( ch, "&cAct Flags  : &w%s\n\r", ext_flag_string(&victim->act, act_flags) );
	else
	{
//		pager_printf_color( ch, "&cPlayerFlags: &w%s\n\r", ext_flag_string( &victim->act, plr_flags ) );
		pager_printf_color( ch, "&cPcflags    : &w%s\n\r", flag_string( victim->pcdata->flags, pc_flags ) );
		if( ch->level >= 63 )
		{
		  if( xIS_SET(victim->act, PLR_NOSCREAM) )
		    pager_printf(ch, "&cNoscream: &wYes.\n\r");
		  else
		    pager_printf(ch, "&cNoscream: &wNo.\n\r");
		}
		if ( victim->pcdata->nuisance )
		{
			pager_printf_color( ch, "&RNuisance   &cStage: (&R%d&c/%d)  Power:  &w%d  &cTime:  &w%s.\n\r", victim->pcdata->nuisance->flags,
			                    MAX_NUISANCE_STAGE, victim->pcdata->nuisance->power,
			                    ctime(&victim->pcdata->nuisance->time));
		}
		if ( victim->pcdata
		     && victim->pcdata->nextHBTCDate > 0 )
		{
			pager_printf_color( ch, "&cNextHBTCDate: &W%24.24s&w\n\r",
			                    ctime( &victim->pcdata->nextHBTCDate ) );
		}
		if ( victim->pcdata
		     && victim->pcdata->HBTCTimeLeft > 0 )
		{
			pager_printf_color( ch, "&cHBTCTimeLeft: &W%d&w\n\r",
			                    victim->pcdata->HBTCTimeLeft );
		}
		if ( victim->pcdata
		     && victim->pcdata->HBTCPartner != '\0' )
		{
			pager_printf_color( ch, "&cHBTCPartner: &W%s&w\n\r",
			                    victim->pcdata->HBTCPartner );
		}
	}
	if ( victim->morph )
	{
		if ( victim->morph->morph )
			pager_printf_color(ch, "&cMorphed as : (&C%d&c) &C%s    &cTimer: &C%d\n\r",
			                   victim->morph->morph->vnum, victim->morph->morph->short_desc,
			                   victim->morph->timer );
		else
			pager_printf_color (ch, "&cMorphed as: Morph was deleted.\n\r" );
	}
	pager_printf_color( ch, "&cAffected by: &C%s\n\r",
	                    affect_bit_name( &victim->affected_by ) );
	pager_printf_color( ch, "&cSpeaks: &w%d   &cSpeaking: &w%d   &cPowerLevel: &w%s",
	                    victim->speaks, victim->speaking,
		(get_trust( ch ) < 59 && !IS_NPC(victim)) ? "0" : num_punct_ld(victim->exp) );
        if( IS_NPC(victim) )
	  pager_printf( ch, "&c/&w%s",num_punct_ld(victim->pl) );
	if ( !IS_NPC( victim ) && victim->wait )
		pager_printf_color( ch, "   &cWaitState: &R%d\n\r",
		                    victim->wait / 12 );
	else
		send_to_pager( "\n\r", ch );
	send_to_pager_color( "&cLanguages  : &w", ch );
	for ( x = 0; lang_array[x] != LANG_UNKNOWN; x++ )
		if ( knows_language( victim, lang_array[x], victim )
		     || (IS_NPC(victim) && victim->speaks == 0) )
		{
			if ( IS_SET(lang_array[x], victim->speaking)
			     || (IS_NPC(victim) && !victim->speaking) )
				set_pager_color( AT_RED, ch );
			send_to_pager( lang_names[x], ch );
			send_to_pager( " ", ch );
			set_pager_color( AT_PLAIN, ch );
		}
		else
			if ( IS_SET(lang_array[x], victim->speaking)
			     || (IS_NPC(victim) && !victim->speaking) )
			{
				set_pager_color( AT_PINK, ch );
				send_to_pager( lang_names[x], ch );
				send_to_pager( " ", ch );
				set_pager_color( AT_PLAIN, ch );
			}
	send_to_pager( "\n\r", ch );
	if ( victim->pcdata && victim->pcdata->bestowments
	     && victim->pcdata->bestowments[0] != '\0' )
		pager_printf_color( ch, "&cBestowments: &w%s\n\r", victim->pcdata->bestowments );
	if ( IS_NPC( victim ) )
		pager_printf_color( ch, "&cShortdesc  : &w%s\n\r&cLongdesc   : &w%s",
		                    victim->short_descr[0] != '\0' ? victim->short_descr : "(none set)",
		                    victim->long_descr[0] != '\0' ? victim->long_descr : "(none set)\n\r" );
	else
	{
		if ( victim->short_descr[0] != '\0' )
			pager_printf_color( ch, "&cShortdesc  : &w%s\n\r",
			                    victim->short_descr );
		if ( victim->long_descr[0] != '\0' )
			pager_printf_color( ch, "&cLongdesc   : &w%s\n\r",
			                    victim->long_descr );
	}
	if ( IS_NPC(victim) && victim->spec_fun )
		pager_printf_color( ch, "&cMobile has spec fun: &w%s\n\r",
		                    lookup_spec( victim->spec_fun ) );
	if ( IS_NPC( victim ) )
		pager_printf_color( ch, "&cBody Parts : &w%s\n\r",
		                    flag_string(victim->xflags, part_flags) );
	if ( victim->resistant > 0 )
		pager_printf_color( ch, "&cResistant  : &w%s\n\r", flag_string(victim->resistant, ris_flags) );
	if ( victim->immune > 0 )
		pager_printf_color( ch, "&cImmune     : &w%s\n\r", flag_string(victim->immune, ris_flags) );
	if ( victim->susceptible > 0 )
		pager_printf_color( ch, "&cSusceptible: &w%s\n\r", flag_string(victim->susceptible, ris_flags) );
	if ( IS_NPC( victim ) )
	{
		pager_printf_color( ch, "&cAttacks    : &w%s\n\r",
		                    ext_flag_string(&victim->attacks, attack_flags) );
		pager_printf_color( ch, "&cDefenses   : &w%s\n\r",
		                    ext_flag_string(&victim->defenses, defense_flags) );
	}
	for ( paf = victim->first_affect; paf; paf = paf->next )
	{
		if ( (skill = get_skilltype(paf->type)) != NULL )
			pager_printf_color( ch,
			                    "&c%s: &w'%s' mods %s by %d for %d rnds with bits %s.",
			                    skill_tname[skill->type],
			                    skill->name,
			                    affect_loc_name( paf->location ),
			                    paf->modifier,
			                    paf->duration,
			                    affect_bit_name( &paf->bitvector )
			                  );
		send_to_char("\n\r", ch);
	}
	ch_printf(ch,"\n\r&cFusions: &w%d\n\r", victim->fusions );
        ch_printf(ch,"&cFusionflags: &w%s\n\r",
                flag_string(victim->fusionflags,fusion_flags) );
        ch_printf(ch,"&cFused with: ");
	int a = 0;
        for( a = 0; a < victim->fusions; a++ )
        {
          ch_printf(ch,"&w%s ", victim->fused[a] );
        }
	ch_printf(ch,"\n\r");
	if( is_android(victim) || is_superandroid(victim) )
	{
	  ch_printf(ch,"&cAndroid Stored Cores Pl: &w%s\n\r", num_punct_ld(victim->corespl) );
	  ch_printf(ch,"&cAbsorbed FM type core: &w%s\n\r",
			((victim->fm_core) ? "Yes" : "No") );
	  ch_printf(ch,"&cAbsorbed E type core: &w%s\n\r",
                        ((victim->e_core) ? "Yes" : "No") );
	  ch_printf(ch,"&cAbsorbed H type core: &w%s\n\r",
                        ((victim->h_core) ? "Yes" : "No") );
	}
	if( victim->pcdata && ch->level >= 63 )
	{
	  ch_printf(ch,"&cUpdateL: &w%d\n\r", victim->pcdata->upgradeL);
	}
	if( is_kaio(victim) )
	{
	  ch_printf(ch,"&cKai rank: &w%d &c(&w%s&c)\n\r",
			victim->kairank, get_kai(victim) );
	}
	if( is_demon(victim) )
        {
          ch_printf(ch,"&cDemon rank: &w%d &c(&w%s&c)\n\r",
                        victim->demonrank, get_demon(victim) );
        }
        ch_printf(ch,"\n\r");
	return ;
}

void do_mfind( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	MOB_INDEX_DATA *pMobIndex;
	int hash;
	int nMatch;
	bool fAll;

	set_pager_color( AT_PLAIN, ch );

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

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

	/*
	 * This goes through all the hash entry points (1024), and is therefore
	 * much faster, though you won't get your vnums in order... oh well. :)
	 *
	 * Tests show that Furey's method will usually loop 32,000 times, calling
	 * get_mob_index()... which loops itself, an average of 1-2 times...
	 * So theoretically, the above routine may loop well over 40,000 times,
	 * and my routine bellow will loop for as many index_mobiles are on
	 * your mud... likely under 3000 times.
	 * -Thoric
	 */
	for ( hash = 0; hash < MAX_KEY_HASH; hash++ )
		for ( pMobIndex = mob_index_hash[hash];
		      pMobIndex;
		      pMobIndex = pMobIndex->next )
			if ( fAll || nifty_is_name( arg, pMobIndex->player_name ) )
			{
				nMatch++;
				pager_printf( ch, "[%5d] %s\n\r",
				              pMobIndex->vnum, capitalize( pMobIndex->short_descr ) );
			}

	if ( nMatch )
		pager_printf( ch, "Number of matches: %d\n", nMatch );
	else
		send_to_char( "Nothing like that in hell, earth, or heaven.\n\r", ch );
	return ;
}

void do_ofind( CHAR_DATA *ch, char *argument )
{
	char arg[MAX_INPUT_LENGTH];
	OBJ_INDEX_DATA *pObjIndex;
	int hash;
	int nMatch;
	bool fAll;

	set_pager_color( AT_PLAIN, ch );

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

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

	/*
	 * This goes through all the hash entry points (1024), and is therefore
	 * much faster, though you won't get your vnums in order... oh well. :)
	 *
	 * Tests show that Furey's method will usually loop 32,000 times, calling
	 * get_obj_index()... which loops itself, an average of 2-3 times...
	 * So theoretically, the above routine may loop well over 50,000 times,
	 * and my routine bellow will loop for as many index_objects are on
	 * your mud... likely under 3000 times.
	 * -Thoric
	 */
	for ( hash = 0; hash < MAX_KEY_HASH; hash++ )
		for ( pObjIndex = obj_index_hash[hash];
		      pObjIndex;
		      pObjIndex = pObjIndex->next )
			if ( fAll || nifty_is_name( arg, pObjIndex->name ) )
			{
				nMatch++;
				pager_printf( ch, "[%5d] %s\n\r",
				              pObjIndex->vnum, capitalize( pObjIndex->short_descr ) );
			}

	if ( nMatch )
		pager_printf( ch, "Number of matches: %d\n", nMatch );
	else
		send_to_char( "Nothing like that in hell, earth, or heaven.\n\r", ch );
	return ;
}

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

	set_pager_color( AT_PLAIN, ch );

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

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

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

void do_gwhere( CHAR_DATA *ch, char *argument )
{
	CHAR_DATA *victim;
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char arg3[MAX_INPUT_LENGTH];
	DESCRIPTOR_DATA *d;
	bool found = FALSE, pmobs = FALSE;
	int low = 1, high = 65, count = 0;

	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );
	if ( arg1[0] != '\0' )
	{
		if ( arg1[0] == '\0' || arg2[0] == '\0' )
		{
			send_to_pager_color( "\n\r&wSyntax:  gwhere | gwhere <low> <high> | gwhere <low> <high> mobs\n\r", ch );
			return ;
		}
		low = atoi( arg1 );
		high = atoi( arg2 );
	}
	if ( low < 1 || high < low || low > high || high > 65 )
	{
		send_to_pager_color( "&wInvalid level range.\n\r", ch );
		return ;
	}
	argument = one_argument( argument, arg3 );
	if ( !str_cmp( arg3, "mobs" ) )
		pmobs = TRUE;

	pager_printf_color( ch, "\n\r&cGlobal %s locations:&w\n\r", pmobs ? "mob" : "player" );
	if ( !pmobs )
	{
		for ( d = first_descriptor; d; d = d->next )
			if ( (d->connected == CON_PLAYING || d->connected == CON_EDITING )
			     && ( victim = d->character ) != NULL && !IS_NPC(victim) && victim->in_room
			     && can_see( ch, victim )
			     && victim->level >= low && victim->level <= high )
			{
				found = TRUE;
				pager_printf_color( ch, "&c(&C%2d&c) &w%-12.12s   [%-5d - %-19.19s]   &c%-25.25s\n\r",
				                    victim->level, victim->name, victim->in_room->vnum, victim->in_room->area->name, victim->in_room->name );
				count++;
			}
	}
	else
	{
		for ( victim = first_char; victim; victim = victim->next )
			if ( IS_NPC(victim)
			     && victim->in_room && can_see( ch, victim )
			     && victim->level >= low && victim->level <= high )
			{
				found = TRUE;
				pager_printf_color( ch, "&c(&C%2d&c) &w%-12.12s   [%-5d - %-19.19s]   &c%-25.25s\n\r",
				                    victim->level, victim->name, victim->in_room->vnum, victim->in_room->area->name, victim->in_room->name );
				count++;
			}
	}
	pager_printf_color( ch, "&c%d %s found.\n\r", count, pmobs ? "mobs" : "characters" );
	return ;
}

void do_gfighting( CHAR_DATA *ch, char *argument )
{
	CHAR_DATA *victim;
	DESCRIPTOR_DATA *d;
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char arg3[MAX_INPUT_LENGTH];
	bool found = FALSE, pmobs = FALSE, phating = FALSE, phunting = FALSE;
	int low = 1, high = 65, count = 0;

	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );
	if ( arg1[0] != '\0' )
	{
		if ( arg1[0] == '\0' || arg2[0] == '\0' )
		{
			send_to_pager_color( "\n\r&wSyntax:  gfighting | gfighting <low> <high> | gfighting <low> <high> mobs\n\r", ch );
			return ;
		}
		low = atoi( arg1 );
		high = atoi( arg2 );
	}
	if ( low < 1 || high < low || low > high || high > 65 )
	{
		send_to_pager_color( "&wInvalid level range.\n\r", ch );
		return ;
	}
	argument = one_argument( argument, arg3 );
	if ( !str_cmp( arg3, "mobs" ) )
		pmobs = TRUE;
	else if ( !str_cmp( arg3, "hating" ) )
		phating = TRUE;
	else if ( !str_cmp( arg3, "hunting" ) )
		phunting = TRUE;

	pager_printf_color( ch, "\n\r&cGlobal %s conflict:\n\r", pmobs ? "mob" : "character" );
	if ( !pmobs && !phating && !phunting)
	{
		for ( d = first_descriptor; d; d = d->next )
			if ( (d->connected == CON_PLAYING || d->connected == CON_EDITING )
			     && ( victim = d->character ) != NULL && !IS_NPC( victim ) && victim->in_room
			     && can_see( ch, victim )
			     && victim->fighting && victim->level >= low && victim->level <= high )
			{
				found = TRUE;
				pager_printf_color( ch, "&w%-12.12s &C|%2d &wvs &C%2d| &w%-16.16s [%5d]  &c%-20.20s [%5d]\n\r",
				                    victim->name, victim->level, victim->fighting->who->level,
				                    IS_NPC( victim->fighting->who ) ? victim->fighting->who->short_descr : victim->fighting->who->name,
				                    IS_NPC( victim->fighting->who ) ? victim->fighting->who->pIndexData->vnum : 0,
				                    victim->in_room->area->name, victim->in_room == NULL ? 0 : victim->in_room->vnum );
				count++;
			}
	}
	else if ( !phating && !phunting)
	{
		for ( victim = first_char; victim; victim = victim->next )
			if ( IS_NPC( victim )
			     && victim->in_room && can_see( ch, victim )
			     && victim->fighting && victim->level >= low && victim->level <= high )
			{
				found = TRUE;
				pager_printf_color( ch, "&w%-12.12s &C|%2d &wvs &C%2d| &w%-16.16s [%5d]  &c%-20.20s [%5d]\n\r",
				                    victim->name, victim->level, victim->fighting->who->level,
				                    IS_NPC( victim->fighting->who ) ? victim->fighting->who->short_descr : victim->fighting->who->name,
				                    IS_NPC( victim->fighting->who ) ? victim->fighting->who->pIndexData->vnum : 0,
				                    victim->in_room->area->name, victim->in_room == NULL ? 0 : victim->in_room->vnum );
				count++;
			}
	}
	else if ( !phunting && phating)
	{
		for ( victim = first_char; victim; victim = victim->next )
			if ( IS_NPC( victim )
			     && victim->in_room && can_see( ch, victim )
			     && victim->hating && victim->level >= low && victim->level <= high )
			{
				found = TRUE;
				pager_printf_color( ch, "&w%-12.12s &C|%2d &wvs &C%2d| &w%-16.16s [%5d]  &c%-20.20s [%5d]\n\r",
				                    victim->name, victim->level, victim->hating->who->level, IS_NPC( victim->hating->who ) ?
				                    victim->hating->who->short_descr : victim->hating->who->name, IS_NPC( victim->hating->who ) ?
				                    victim->hating->who->pIndexData->vnum : 0, victim->in_room->area->name, victim->in_room == NULL ? 0 :
				                    victim->in_room->vnum );
				count++;
			}
	}
	else if ( phunting )
	{
		for ( victim = first_char; victim; victim = victim->next )
			if ( IS_NPC( victim )
			     && victim->in_room && can_see( ch, victim )
			     && victim->hunting && victim->level >= low && victim->level <= high )
			{
				found = TRUE;
				pager_printf_color( ch, "&w%-12.12s &C|%2d &wvs &C%2d| &w%-16.16s [%5d]  &c%-20.20s [%5d]\n\r",
				                    victim->name, victim->level, victim->hunting->who->level, IS_NPC( victim->hunting->who ) ?
				                    victim->hunting->who->short_descr : victim->hunting->who->name, IS_NPC( victim->hunting->who ) ? victim->hunting->who->pIndexData->vnum : 0,
				                    victim->in_room->area->name, victim->in_room == NULL ? 0 : victim->in_room->vnum );
				count++;
			}
	}
	pager_printf_color( ch, "&c%d %s conflicts located.\n\r", count, pmobs ? "mob" : "character" );
	return ;
}

/* Added 'show' argument for lowbie imms without ostat -- Blodkai */
/* Made show the default action :) Shaddai */
/* Trimmed size, added vict info, put lipstick on the pig -- Blod */
void do_bodybag( CHAR_DATA *ch, char *argument )
{
	char buf2[MAX_STRING_LENGTH];
	char buf3[MAX_STRING_LENGTH];
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	CHAR_DATA *owner;
	OBJ_DATA *obj;
	bool found = FALSE, bag = FALSE;

	argument = one_argument( argument, arg1 );
	if ( arg1[0] == '\0' )
	{
		send_to_char_color( "&PSyntax:  bodybag <character> | bodybag <character> yes/bag/now\n\r", ch );
		return ;
	}

	sprintf( buf3, " " );
	sprintf( buf2, "the corpse of %s", arg1 );
	argument = one_argument( argument, arg2 );

	if ( arg2[0] != '\0' && ( str_cmp( arg2, "yes" )
	                          && str_cmp( arg2, "bag" ) && str_cmp( arg2, "now" ) ) )
	{
		send_to_char_color( "\n\r&PSyntax:  bodybag <character> | bodybag <character> yes/bag/now\n\r", ch );
		return ;
	}
	if ( !str_cmp( arg2, "yes" ) || !str_cmp( arg2, "bag" )
	     || !str_cmp( arg2, "now" ) )
		bag = TRUE;

	pager_printf_color( ch, "\n\r&P%s remains of %s ... ",
	                    bag ? "Retrieving" : "Searching for",
	                    capitalize( arg1 ) );
	for ( obj = first_object; obj; obj = obj->next )
	{
		if ( obj->in_room
		     && !str_cmp( buf2, obj->short_descr )
		     && (obj->pIndexData->vnum == 11 ) )
		{
			send_to_pager( "\n\r", ch );
			found = TRUE;
			pager_printf_color( ch, "&P%s:  %s%-12.12s %s  &PIn:  &w%-22.22s  &P[&w%5d&P]   &PTimer:  %s%2d",
			                    bag ? "Bagging" : "Corpse",
			                    bag ? "&Y" : "&w",
			                    capitalize( arg1 ),
			                    IS_OBJ_STAT( obj, ITEM_CLANCORPSE ) ? "&RPK" : "&R  ",
			                    obj->in_room->area->name,
			                    obj->in_room->vnum,
			                    obj->timer < 1 ? "&w" : obj->timer < 5 ? "&R" : obj->timer < 10 ? "&Y" : "&w",
			                    obj->timer );
			if ( bag )
			{
				obj_from_room( obj );
				obj = obj_to_char( obj, ch );
				obj->timer = -1;
				save_char_obj( ch );
			}
		}
	}
	if ( !found )
	{
		send_to_pager_color( "&Pno corpse was found.\n\r", ch );
		return ;
	}
	send_to_pager( "\n\r", ch );
	for ( owner = first_char; owner; owner = owner->next )
	{
		if ( IS_NPC( owner ) )
			continue;
		if ( can_see( ch, owner) && !str_cmp( arg1, owner->name ) )
			break;
	}
	if ( owner == NULL )
	{
		pager_printf_color( ch, "&P%s is not currently online.\n\r",
		                    capitalize( arg1 ) );
		return ;
	}
	if ( owner->pcdata->deity )
		pager_printf_color( ch, "&P%s (%d) has %d favor with %s (needed to supplicate: %d)\n\r",
		                    owner->name,
		                    owner->level,
		                    owner->pcdata->favor,
		                    owner->pcdata->deity->name,
		                    owner->pcdata->deity->scorpse );
	else
		pager_printf_color( ch, "&P%s (%d) has no deity.\n\r",
		                    owner->name, owner->level );
	return ;
}

#if 0
/* New owhere by Altrag, 03/14/96 */
void do_owhere( CHAR_DATA *ch, char *argument )
{
	char buf[MAX_STRING_LENGTH];
	char arg[MAX_INPUT_LENGTH];
	char arg1[MAX_INPUT_LENGTH];
	OBJ_DATA *obj;
	bool found;
	int icnt = 0;

	set_pager_color( AT_PLAIN, ch );

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

	argument = one_argument(argument, arg1);
	if ( arg1[0] != '\0' && !str_prefix(arg1, "nesthunt") )
	{
		if ( !(obj = get_obj_world(ch, arg)) )
		{
			send_to_char( "Nesthunt for what object?\n\r", ch );
			return ;
		}
		for ( ; obj->in_obj; obj = obj->in_obj )
		{
			pager_printf(ch, "[%5d] %-28s in object [%5d] %s\n\r",
			             obj->pIndexData->vnum, obj_short(obj),
			             obj->in_obj->pIndexData->vnum, obj->in_obj->short_descr);
			++icnt;
		}
		sprintf(buf, "[%5d] %-28s in ", obj->pIndexData->vnum,
		        obj_short(obj));
		if ( obj->carried_by )
			sprintf(buf + strlen(buf), "invent [%5d] %s\n\r",
			        (IS_NPC(obj->carried_by) ? obj->carried_by->pIndexData->vnum
			         : 0), PERS(obj->carried_by, ch));
		else if ( obj->in_room )
			sprintf(buf + strlen(buf), "room   [%5d] %s\n\r",
			        obj->in_room->vnum, obj->in_room->name);
		else if ( obj->in_obj )
		{
			bug("do_owhere: obj->in_obj after NULL!", 0);
			strcat(buf, "object??\n\r");
		}
		else
		{
			bug("do_owhere: object doesnt have location!", 0);
			strcat(buf, "nowhere??\n\r");
		}
		send_to_pager(buf, ch);
		++icnt;
		pager_printf(ch, "Nested %d levels deep.\n\r", icnt);
		return ;
	}

	found = FALSE;
	for ( obj = first_object; obj; obj = obj->next )
	{
		if ( !nifty_is_name( arg, obj->name ) )
			continue;
		found = TRUE;

		sprintf(buf, "(%3d) [%5d] %-28s in ", ++icnt, obj->pIndexData->vnum,
		        obj_short(obj));
		if ( obj->carried_by )
			sprintf(buf + strlen(buf), "invent [%5d] %s\n\r",
			        (IS_NPC(obj->carried_by) ? obj->carried_by->pIndexData->vnum
			         : 0), PERS(obj->carried_by, ch));
		else if ( obj->in_room )
			sprintf(buf + strlen(buf), "room   [%5d] %s\n\r",
			        obj->in_room->vnum, obj->in_room->name);
		else if ( obj->in_obj )
			sprintf(buf + strlen(buf), "object [%5d] %s\n\r",
			        obj->in_obj->pIndexData->vnum, obj_short(obj->in_obj));
		else
		{
			bug("do_owhere: object doesnt have location!", 0);
			strcat(buf, "nowhere??\n\r");
		}
		send_to_pager(buf, ch);
	}

	if ( !found )
		act( AT_PLAIN, "You didn't find any $T.", ch, NULL, arg, TO_CHAR );
	else
		pager_printf(ch, "%d matches.\n\r", icnt);
	return ;
}
#endif

void do_reboo( CHAR_DATA *ch, char *argument )
{
	send_to_char_color( "&YIf 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 mud_down;
	CHAR_DATA *vch;

	set_char_color( AT_IMMORT, ch );

	if ( str_cmp( argument, "mud now" )
	     && str_cmp( argument, "nosave" )
	     && str_cmp( argument, "and sort skill table" ) )
	{
		send_to_char( "Syntax:  'reboot mud now' or 'reboot nosave'\n\r", ch );
		return ;
	}

	if ( auction->item )
		do_auction( ch, "stop");
	sprintf( buf, "Reboot by %s.", ch->name );
	do_echo( ch, buf );

	if ( !str_cmp(argument, "and sort skill table") )
	{
		sort_skill_table();
		save_skill_table();
	}

	/* Save all characters before booting. */
	if ( str_cmp(argument, "nosave") )
		for ( vch = first_char; vch; vch = vch->next )
			if ( !IS_NPC( vch ) )
				save_char_obj( vch );

	mud_down = TRUE;
	return ;
}

void do_shutdow( CHAR_DATA *ch, char *argument )
{
	send_to_char_color( "&YIf 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 mud_down;
	CHAR_DATA *vch;

	set_char_color( AT_IMMORT, ch );

	if ( str_cmp( argument, "mud now" ) && str_cmp(argument, "nosave") )
	{
		send_to_char( "Syntax:  'shutdown mud now' or 'shutdown nosave'\n\r", ch );
		return ;
	}

	if ( auction->item )
		do_auction( ch, "stop");
	sprintf( buf, "Shutdown by %s.", ch->name );
	append_file( ch, SHUTDOWN_FILE, buf );
	strcat( buf, "\n\r" );
	do_echo( ch, buf );

	/* Save all characters before booting. */
	if ( str_cmp(argument, "nosave") )
		for ( vch = first_char; vch; vch = vch->next )
			if ( !IS_NPC( vch ) )
				save_char_obj( vch );
	mud_down = TRUE;
	return ;
}

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

	set_char_color( AT_IMMORT, ch );

	one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_char( "Snoop whom?\n\r", ch );
		return ;
	}
	if ( ( victim = get_char_world( ch, arg ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return ;
	}
	if ( !victim->desc )
	{
		send_to_char( "No descriptor to snoop.\n\r", ch );
		return ;
	}
	if ( victim == ch )
	{
		send_to_char( "Cancelling all snoops.\n\r", ch );
		for ( d = first_descriptor; d; d = d->next )
			if ( d->snoop_by == ch->desc )
				d->snoop_by = NULL;
		return ;
	}
	if ( victim->desc->snoop_by )
	{
		send_to_char( "Busy already.\n\r", ch );
		return ;
	}

	/*
	 * Minimum snoop level... a secret mset value
	 * makes the snooper think that the victim is already being snooped
	 */
	if ( get_trust( victim ) >= get_trust( ch )
	     || (victim->pcdata && victim->pcdata->min_snoop > get_trust( ch )) )
	{
		send_to_char( "Busy already.\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( "No snoop loops.\n\r", ch );
				return ;
			}
	}

	/*  Snoop notification for higher imms, if desired, uncomment this */
#ifdef TOOSNOOPY
	if ( get_trust(victim) > LEVEL_GOD && get_trust(ch) < LEVEL_SUPREME )
		write_to_descriptor( victim->desc->descriptor, "\n\rYou feel like someone is watching your every move...\n\r", 0 );
#endif

	victim->desc->snoop_by = ch->desc;
	send_to_char( "Ok.\n\r", ch );
	return ;
}

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

	set_char_color( AT_IMMORT, ch );

	one_argument( argument, arg );
	if ( IS_NPC ( ch ) || get_trust( ch ) < LEVEL_GREATER )
	{
		send_to_char( "Huh?\n\r", ch );
		return ;
	}
	if ( arg[0] == '\0' )
	{
		send_to_char( "Statshield which mobile?\n\r", ch );
		return ;
	}
	if ( ( victim = get_char_world( ch, arg ) ) == NULL )
	{
		send_to_char( "No such mobile.\n\r", ch );
		return ;
	}
	if ( !IS_NPC( victim ) )
	{
		send_to_char( "You can only statshield mobiles.\n\r", ch );
		return ;
	}
	if ( xIS_SET( victim->act, ACT_STATSHIELD ) )
	{
		xREMOVE_BIT( victim->act, ACT_STATSHIELD );
		ch_printf( ch, "You have lifted the statshield on %s.\n\r", victim->short_descr );
	}
	else
	{
		xSET_BIT( victim->act, ACT_STATSHIELD );
		ch_printf( ch, "You have applied a statshield to %s.\n\r", victim->short_descr );
	}
	return ;
}


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

	set_char_color( AT_IMMORT, ch );

	one_argument( argument, arg );
	if ( arg[0] == '\0' )
	{
		send_to_char( "Switch into whom?\n\r", ch );
		return ;
	}
	if ( !ch->desc )
		return ;
	if ( ch->desc->original )
	{
		send_to_char( "You are already switched.\n\r", ch );
		return ;
	}
	if ( ( victim = get_char_world( ch, arg ) ) == NULL )
	{
		send_to_char( "They aren't here.\n\r", ch );
		return ;
	}
	if ( victim == ch )
	{
		send_to_char( "Ok.\n\r", ch );
		return ;
	}
	if ( IS_NPC( victim ) && xIS_SET( victim->act, ACT_STATSHIELD )
	     && get_trust( ch ) < LEVEL_GREATER )
	{
		set_pager_color( AT_IMMORT, ch );
		send_to_pager( "Their godly glow prevents you from getting close enough.\n\r", ch );
		return ;
	}
	if ( victim->desc )
	{
		send_to_char( "Character in use.\n\r", ch );
		return ;
	}
	if ( !IS_NPC(victim) && ch->level < LEVEL_GREATER )
	{
		send_to_char( "You cannot switch into a player!\n\r", ch );
		return ;
	}
	if ( victim->switched )
	{
		send_to_char( "You can't switch into a player that is switched!\n\r", ch);
		return ;
	}
	if ( !IS_NPC(victim) && xIS_SET(victim->act, PLR_FREEZE) )
	{
		send_to_char( "You shouldn't switch into a player that is frozen!\n\r", ch);
		return ;
	}
	ch->desc->character = victim;
	ch->desc->original = ch;
	victim->desc = ch->desc;
	ch->desc = NULL;
	ch->switched	= victim;
	send_to_char( "Ok.\n\r", victim );
	return ;
}

void do_return( CHAR_DATA *ch, char *argument )
              {

	              if ( !IS_NPC( ch ) && get_trust(ch) < LEVEL_IMMORTAL )
	              {
		              send_to_char("Huh?\n\r", ch );
		              return ;
	              }
	              set_char_color( AT_IMMORT, ch );

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

	              send_to_char( "You return to your original body.\n\r", ch );

	              if ( IS_NPC( ch ) && IS_AFFECTED( ch, AFF_POSSESS ) )
	              {
		              affect_strip( ch, gsn_possess );
		              xREMOVE_BIT( ch->affected_by, AFF_POSSESS );
	              }

	              ch->desc->character = ch->desc->original;
	              ch->desc->original = NULL;
	              ch->desc->character->desc = ch->desc;
	              ch->desc->character->switched = NULL;
	              ch->desc = NULL;
	              return ;
              }

              void do_minvoke( CHAR_DATA *ch, char *argument )
              {
	              char arg[MAX_INPUT_LENGTH];
	              MOB_INDEX_DATA *pMobIndex;
	              CHAR_DATA *victim;
	              int vnum;

	              set_char_color( AT_IMMORT, ch );

	              one_argument( argument, arg );
	              if ( arg[0] == '\0' )
	              {
		              send_to_char( "Syntax:  minvoke <vnum>\n\r", ch );
		              return ;
	              }
	              if ( !is_number( arg ) )
	              {
		              char arg2[MAX_INPUT_LENGTH];
		              int hash, cnt;
		              int count = number_argument( arg, arg2 );

		              vnum = -1;
		              for ( hash = cnt = 0; hash < MAX_KEY_HASH; hash++ )
			              for ( pMobIndex = mob_index_hash[hash];
			                    pMobIndex;
			                    pMobIndex = pMobIndex->next )
				              if ( nifty_is_name( arg2, pMobIndex->player_name )
				                   && ++cnt == count )
				              {
					              vnum = pMobIndex->vnum;
					              break;
				              }
		              if ( vnum == -1 )
		              {
			              send_to_char( "No such mobile exists.\n\r", ch );
			              return ;
		              }
	              }
	              else
		              vnum = atoi( arg );

	              if ( get_trust(ch) < sysdata.level_modify_proto )
	              {
		              AREA_DATA *pArea;

		              if ( IS_NPC(ch) )
		              {
			              send_to_char( "Huh?\n\r", ch );
			              return ;
		              }
		              if ( !ch->pcdata || !(pArea = ch->pcdata->area) )
		              {
			              send_to_char( "You must have an assigned area to invoke this mobile.\n\r", ch );
			              return ;
		              }
		              if ( vnum < pArea->low_m_vnum
		                   && vnum > pArea->hi_m_vnum )
		              {
			              send_to_char( "That number is not in your allocated range.\n\r", ch );
			              return ;
		              }
	              }
	              if ( ( pMobIndex = get_mob_index( vnum ) ) == NULL )
	              {
		              send_to_char( "No mobile has that vnum.\n\r", ch );
		              return ;
	              }

	              if (!xIS_SET(pMobIndex->act, ACT_PROTOTYPE)
	                  && ch->level < sysdata.level_modify_proto)
	              {
		              send_to_char( "You can't invoke non-prototype mobs.\n\r", ch );
		              return ;
	              }

	              victim = create_mobile( pMobIndex );
	              char_to_room( victim, ch->in_room );
	              act( AT_IMMORT, "$n invokes $N!", ch, NULL, victim, TO_ROOM );
	              /*How about seeing what we're invoking for a change. -Blodkai*/
	              ch_printf_color( ch, "&YYou invoke %s (&W#%d &Y- &W%s &Y- &Wlvl %d&Y)\n\r",
	                               pMobIndex->short_descr, pMobIndex->vnum, pMobIndex->player_name, victim->level );
	              return ;
              }

              void do_oinvoke( CHAR_DATA *ch, char *argument )
              {
	              char arg1[MAX_INPUT_LENGTH];
	              char arg2[MAX_INPUT_LENGTH];
	              OBJ_INDEX_DATA *pObjIndex;
	              OBJ_DATA *obj;
	              int vnum;
	              int level;


	              set_char_color( AT_IMMORT, ch );

	              argument = one_argument( argument, arg1 );
	              argument = one_argument( argument, arg2 );
	              if ( arg1[0] == '\0' )
	              {
		              send_to_char( "Syntax: oinvoke <vnum> <level>.\n\r", ch );
		              return ;
	              }
	              if ( arg2[0] == '\0' )
	              {
		              level = get_trust( ch );
	              }
	              else
	              {
		              if ( !is_number( arg2 ) )
		              {
			              send_to_char( "Syntax:  oinvoke <vnum> <level>\n\r", ch );
			              return ;
		              }
		              level = atoi( arg2 );
		              if ( level < 0 || level > get_trust( ch ) )
		              {
			              send_to_char( "Limited to your trust level.\n\r", ch );
			              return ;
		              }
	              }
	              if ( !is_number( arg1 ) )
	              {
		              char arg[MAX_INPUT_LENGTH];
		              int hash, cnt;
		              int count = number_argument( arg1, arg );

		              vnum = -1;
		              for ( hash = cnt = 0; hash < MAX_KEY_HASH; hash++ )
			              for ( pObjIndex = obj_index_hash[hash];
			                    pObjIndex;
			                    pObjIndex = pObjIndex->next )
				              if ( nifty_is_name( arg, pObjIndex->name )
				                   && ++cnt == count )
				              {
					              vnum = pObjIndex->vnum;
					              break;
				              }
		              if ( vnum == -1 )
		              {
			              send_to_char( "No such object exists.\n\r", ch );
			              return ;
		              }
	              }
	              else
		              vnum = atoi( arg1 );

	              if ( ch->level < sysdata.level_modify_proto )
	              {
		              AREA_DATA *pArea;

		              if ( IS_NPC(ch) )
		              {
			              send_to_char( "Huh?\n\r", ch );
			              return ;
		              }
		              if ( !ch->pcdata || !(pArea = ch->pcdata->area) )
		              {
			              send_to_char( "You must have an assigned area to invoke this object.\n\r", ch );
			              return ;
		              }
		              if ( vnum < pArea->low_o_vnum
		                   && vnum > pArea->hi_o_vnum )
		              {
			              send_to_char( "That number is not in your allocated range.\n\r", ch );
			              return ;
		              }
	              }
	              if ( ( pObjIndex = get_obj_index( vnum ) ) == NULL )
	              {
		              send_to_char( "No object has that vnum.\n\r", ch );
		              return ;
	              }

	              if ( !IS_OBJ_STAT(pObjIndex, ITEM_PROTOTYPE)
	                   && get_trust( ch ) < sysdata.level_modify_proto )
	              {
		              send_to_char( "You can't invoke non-prototype objects.\n\r", ch );
		              return ;
	              }

		      if( (pObjIndex->item_type == ITEM_DRAGONBALL ||
			   pObjIndex->item_type == ITEM_DRAGONRADAR)
			   && ch->level < 63 )
		      {
			ch_printf(ch,"Access denied.\n\r");
			return;
		      }

	              if ( level == 0 )
	              {
		              AREA_DATA *temp_area;

		              if ( (temp_area = get_area_obj(pObjIndex)) == NULL )
			              level = ch->level;
		              else
		              {
			              level = generate_itemlevel( temp_area, pObjIndex);
			              level = URANGE(0, level, LEVEL_AVATAR);
		              }
	              }


	              obj = create_object_new( pObjIndex, level, ORIGIN_OINVOKE, ch->name );
	              if ( CAN_WEAR(obj, ITEM_TAKE) )
	              {
		              obj = obj_to_char( obj, ch );
	              }
	              else
	              {
		              obj = obj_to_room( obj, ch->in_room );
		              act( AT_IMMORT, "$n fashions $p from ether!", ch, obj, NULL, TO_ROOM );
	              }
	              /* I invoked what? --Blodkai */
	              ch_printf_color( ch, "&YYou invoke %s (&W#%d &Y- &W%s &Y- &Wlvl %d&Y)\n\r",
	                               pObjIndex->short_descr, pObjIndex->vnum, pObjIndex->name, obj->level );
	              return ;
              }

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

	              set_char_color( AT_IMMORT, ch );

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

		              for ( victim = ch->in_room->first_person; victim; victim = vnext )
		              {
			              vnext = victim->next_in_room;
			              if ( IS_NPC(victim) && victim != ch)
				              extract_char( victim, TRUE );
		              }

		              for ( obj = ch->in_room->first_content; obj; obj = obj_next )
		              {
			              obj_next = obj->next_content;
			              extract_obj( obj );
		              }

		              act( AT_IMMORT, "$n purges the room!", ch, NULL, NULL, TO_ROOM);
		              act( AT_IMMORT, "You have purged the room!", ch, NULL, NULL, TO_CHAR );
		              save_house_by_vnum(ch->in_room->vnum); /* Prevent House Object Duplication */
		              return ;
	              }
	              victim = NULL;
	              obj = NULL;

	              /* fixed to get things in room first -- i.e., purge portal (obj),
	               * no more purging mobs with that keyword in another room first
	               * -- Tri */
	              if ( ( victim = get_char_room( ch, arg ) ) == NULL
	                   && ( obj = get_obj_here( ch, arg ) ) == NULL )
	              {
		              if ( ( victim = get_char_world( ch, arg ) ) == NULL
		                   && ( obj = get_obj_world( ch, arg ) ) == NULL )  /* no get_obj_room */
		              {
			              send_to_char( "They aren't here.\n\r", ch );
			              return ;
		              }
	              }

	              /* Single object purge in room for high level purge - Scryn 8/12*/
	              if ( obj )
	              {
		              int vnum = (obj->in_room ? obj->in_room->vnum : ROOM_VNUM_LIMBO);
		              separate_obj( obj );
		              act( AT_IMMORT, "$n purges $p.", ch, obj, NULL, TO_ROOM);
		              act( AT_IMMORT, "You make $p disappear in a puff of smoke!", ch, obj, NULL, TO_CHAR);
		              extract_obj( obj );
		              save_house_by_vnum(vnum); /* Prevent House Object Duplication */
		              return ;
	              }

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

	              if ( victim == ch )
	              {
		              send_to_char( "You cannot purge yourself!\n\r", ch );
		              return ;
	              }

	              act( AT_IMMORT, "$n purges $N.", ch, NULL, victim, TO_NOTVICT );
	              act( AT_IMMORT, "You make $N disappear in a puff of smoke!", ch, NULL, victim, TO_CHAR );
	              extract_char( victim, TRUE );
	              return ;
              }

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

	              set_char_color( AT_IMMORT, ch );

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

	              victim = NULL;
	              obj = NULL;
	              if ( ( victim = get_char_room( ch, arg ) ) == NULL
	                   && ( obj = get_obj_here ( ch, arg ) ) == NULL )
	              {
		              send_to_char( "You can't find that here.\n\r", ch );
		              return ;
	              }

	              if ( obj )
	              {
		              separate_obj( obj );
		              act( AT_IMMORT, "$n purges $p!", ch, obj, NULL, TO_ROOM );
		              act( AT_IMMORT, "You make $p disappear in a puff of smoke!", ch, obj, NULL, TO_CHAR );
		              extract_obj( obj );
		              return ;
	              }

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

	              if ( victim == ch )
	              {
		              send_to_char( "You cannot purge yourself!\n\r", ch );
		              return ;
	              }

	              act( AT_IMMORT, "$n purges $N.", ch, NULL, victim, TO_NOTVICT );
	              act( AT_IMMORT, "You make $N disappear in a puff of smoke!", ch, NULL, victim, TO_CHAR );
	              extract_char( victim, TRUE );
	              return ;
              }

              void do_balzhur( CHAR_DATA *ch, char *argument )
              {
	              char arg[MAX_INPUT_LENGTH];
	              char buf[MAX_STRING_LENGTH];
	              char buf2[MAX_STRING_LENGTH];
	              char *name;
	              CHAR_DATA *victim;
	              AREA_DATA *pArea;
	              int sn;

	              set_char_color( AT_BLOOD, ch );

	              argument = one_argument( argument, arg );
	              if ( arg[0] == '\0' )
	              {
		              send_to_char( "Who is deserving of such a fate?\n\r", ch );
		              return ;
	              }
	              if ( ( victim = get_char_world( ch, arg ) ) == NULL )
	              {
		              send_to_char( "They aren't currently playing.\n\r", ch);
		              return ;
	              }
	              if ( IS_NPC( victim ) )
	              {
		              send_to_char( "This will do little good on mobiles.\n\r", ch );

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

Site Stats

Snippets: 1791
Codebases: 571