act_wiz.c

LOP/src/act_wiz.c · 166.7 KB

From the archive LOP1.35.tgz

Download the archive   « Back to the archive contents

/*****************************************************************************
 * DikuMUD (C) 1990, 1991 by:                                                *
 *   Sebastian Hammer, Michael Seifert, Hans Henrik Staefeldt, Tom Madsen,   *
 *   and Katja Nyboe.                                                        *
 *---------------------------------------------------------------------------*
 * MERC 2.1 (C) 1992, 1993 by:                                               *
 *   Michael Chastain, Michael Quan, and Mitchell Tse.                       *
 *---------------------------------------------------------------------------*
 * SMAUG 1.4 (C) 1994, 1995, 1996, 1998 by: Derek Snider.                    *
 *   Team: Thoric, Altrag, Blodkai, Narn, Haus, Scryn, Rennard, Swordbearer, *
 *         gorog, Grishnakh, Nivek, Tricops, and Fireblade.                  *
 *---------------------------------------------------------------------------*
 * SMAUG 1.7 FUSS by: Samson and others of the SMAUG community.              *
 *                    Their contributions are greatly appreciated.           *
 *---------------------------------------------------------------------------*
 * LoP (C) 2006, 2007, 2008, 2009 by: the LoP team.                          *
 *---------------------------------------------------------------------------*
 *                         Wizard/god command module                         *
 *****************************************************************************/

#include <stdio.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include "h/mud.h"
#include "h/sha256.h"

#define RESTORE_INTERVAL 21600

void rename_locker( CHAR_DATA *ch, char *newname );

/* from comm.c */
bool write_to_descriptor( DESCRIPTOR_DATA *d, char *txt, int length );
bool check_parse_name( char *name, bool newchar );
void save_weatherdata( void );

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

int get_defenseflag( char *flag );
int get_attackflag( char *flag );

/* Local functions. */
void close_area( AREA_DATA *pArea );
int get_color( char *argument ); /* function proto */

/* Global variables. */
extern OBJ_INDEX_DATA *obj_index_hash[MKH];
extern MOB_INDEX_DATA *mob_index_hash[MKH];
extern ROOM_INDEX_DATA *room_index_hash[MKH];

/*
 * Toggle "Do Not Disturb" flag. Used to prevent lower level imms from
 * using commands like "trans" and "goto" on higher level imms.
 */
CMDF( do_dnd )
{
   if( is_npc( ch ) || !ch->pcdata )
   {
      send_to_char( "huh?\r\n", ch );
      return;
   }
   xTOGGLE_BIT( ch->pcdata->flags, PCFLAG_DND );
   ch_printf( ch, "Your 'do not disturb' flag is now %s.\r\n",
      xIS_SET( ch->pcdata->flags, PCFLAG_DND ) ? "on" : "off" );
}

/* 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.\r\n", 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.\r\n", ch );
      return NULL;
   }
}

/* 02-07-99  New auth messages --Mystaric */
CMDF( do_authorize )
{
   char arg1[MIL], arg2[MIL];
   CHAR_DATA *victim;
   DESCRIPTOR_DATA *d;
   bool first = true;

   set_char_color( AT_LOG, ch );

   argument = one_argument( argument, arg1 );
   argument = one_argument( argument, arg2 );
   if( arg1 == NULL || arg1[0] == '\0' )
   {
      send_to_char( "Usage: authorize <player> [name/no]\r\n", ch );
      for( d = first_descriptor; d; d = d->next )
      {
         if( ( victim = d->character ) && is_waiting_for_auth( victim ) )
         {
            if( first )
            {
               send_to_char( "Pending authorizations:\r\n", ch );
               send_to_char( " Character Name\r\n", ch );
               send_to_char( "---------------------------------------------\r\n", ch );
            }
            first = false;
            ch_printf( ch, " %s@%s new %s %s (%s)...\r\n",
               victim->name, victim->desc->host, dis_race_name( victim->race ),
               dis_main_class_name( victim ), is_pkill( victim ) ? "Deadly" : "Peaceful" );
         }
      }
      if( first )
         send_to_char( "There currently is no one waiting to be authorized.\r\n", ch );
      return;
   }

   if( !( victim = get_waiting_desc( ch, arg1 ) ) )
      return;

   set_char_color( AT_IMMORT, victim );
   if( arg2 == NULL || arg2[0] == '\0' )
   {
      victim->pcdata->auth_state = 0; /* If your going to use mpapply and mpapplyb set this to 3 */
      STRSET( victim->pcdata->authed_by, ch->name );
      xREMOVE_BIT( victim->pcdata->flags, PCFLAG_UNAUTHED ); /* if your going to use mpapply and mpapplyb remove this */
      to_channel_printf( "auth", PERM_IMM, "%s: authorized", victim->name );
      ch_printf( ch, "You have authorized %s.\r\n", victim->name );
      ch_printf( victim, "\r\n&GThe MUD Administrators have accepted the name %s.\r\n"
         "You're authorized to enter the Realms at the end of this area.\r\n", victim->name );
      return;
   }
   else if( !str_cmp( arg2, "no" ) )
   {
      send_to_char( "&RThe name you have chosen and/or the actions you have taken have\r\n"
         "been deemed grossly unacceptable to the administration of this mud.\r\n"
         "We ask you to discontinue such behaviour, or suffer possible banishmemt\r\n"
         "from this mud.\r\n", victim );
      to_channel_printf( "auth", PERM_IMM, "%s: denied authorization", victim->name );
      ch_printf( ch, "You have denied %s.\r\n", victim->name );
      do_quit( victim, (char *)"" );
   }
   else if( !str_cmp( arg2, "name" ) )
   {
      to_channel_printf( "auth", PERM_IMM, "%s: name denied", victim->name );
      ch_printf( victim, "&R\r\nThe MUD Administrators have found the name %s to be unacceptable.\r\n", victim->name );
      ch_printf( ch, "You requested %s change names.\r\n", victim->name );
   }
   else
   {
      send_to_char( "Invalid argument.\r\n", ch );
      return;
   }
   victim->pcdata->auth_state = 2;
}

CMDF( do_bamfin )
{
   if( is_npc( ch ) )
      return;
   set_char_color( AT_IMMORT, ch );
   if( argument && argument[0] != '\0' && !nifty_is_name( ch->name, argument ) )
   {
      send_to_char( "Your bamfin must have your name in it somewhere.\r\n", ch );
      return;
   }
   STRSET( ch->pcdata->bamfin, argument );
   if( !ch->pcdata->bamfin ||  ch->pcdata->bamfin[0] == '\0' )
      send_to_char( "Bamfin set to nothing.\r\n", ch );
   else
      send_to_char( "Bamfin set.\r\n", ch );
}

CMDF( do_bamfout )
{
   if( is_npc( ch ) )
      return;
   set_char_color( AT_IMMORT, ch );
   if( argument && argument[0] != '\0' && !nifty_is_name( ch->name, argument ) )
   {
      send_to_char( "Your bamfout must have your name in it somewhere.\r\n", ch );
      return;
   }
   STRSET( ch->pcdata->bamfout, argument );
   if( !ch->pcdata->bamfout || ch->pcdata->bamfout[0] == '\0' )
      send_to_char( "Bamfout set to nothing.\r\n", ch );
   else
      send_to_char( "Bamfout set.\r\n", ch );
}

CMDF( do_rank )
{
   if( is_npc( ch ) )
      return;
   set_char_color( AT_IMMORT, ch );
   STRSET( ch->pcdata->rank, argument );
   if( !ch->pcdata->rank || ch->pcdata->rank[0] == '\0' )
      send_to_char( "Rank set to nothing.\r\n", ch );
   else
      send_to_char( "Rank set.\r\n", ch );
}

CMDF( do_retire )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Retire whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You can't succeed against them.\r\n", ch );
      return;
   }
   if( get_trust( victim ) < PERM_LEADER )
   {
      send_to_char( "The minimum level for retirement is leader.\r\n", ch );
      return;
   }
   xTOGGLE_BIT( victim->pcdata->flags, PCFLAG_RETIRED );
   if( is_retired( victim ) )
   {
      ch_printf( ch, "%s is now a retired immortal.\r\n", victim->name );
      ch_printf( victim, "Courtesy of %s, you're now a retired immortal.\r\n", ch->name );
   }
   else
   {
      ch_printf( ch, "%s returns from retirement.\r\n", victim->name );
      ch_printf( victim, "%s brings you back from retirement.\r\n", ch->name );
   }
}

CMDF( do_guest )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Whom would you like to make a guest?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You can't succeed against them.\r\n", ch );
      return;
   }
   xTOGGLE_BIT( victim->pcdata->flags, PCFLAG_GUEST );
   if( is_guest( victim ) )
   {
      ch_printf( ch, "%s is now a guest immortal.\r\n", victim->name );
      ch_printf( victim, "Courtesy of %s, you're now a guest immortal.\r\n", ch->name );
   }
   else
   {
      ch_printf( ch, "%s is no longer a guest.\r\n", victim->name );
      ch_printf( victim, "%s stops you from being a guest.\r\n", ch->name );
   }
}

CMDF( do_delay )
{
   CHAR_DATA *victim;
   char arg[MIL];
   int delay;

   set_char_color( AT_IMMORT, ch );

   argument = one_argument( argument, arg );
   if( arg == NULL || arg[0] == '\0' )
   {
      send_to_char( "Usage:  delay <victim> <# of rounds>\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, arg ) ) )
   {
      send_to_char( "No such character online.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Mobiles are unaffected by lag.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You haven't the power to succeed against them.\r\n", ch );
      return;
   }
   argument = one_argument( argument, arg );
   if( arg == NULL || arg[0] == '\0' )
   {
      send_to_char( "For how long do you wish to delay them?\r\n", ch );
      return;
   }
   if( ( delay = atoi( arg ) ) < 0 || delay > 999 )
   {
      send_to_char( "Delay range is 0 to 999.\r\n", ch );
      return;
   }
   wait_state( victim, delay * PULSE_VIOLENCE );
   ch_printf( ch, "You've delayed %s for %d rounds.\r\n", victim->name, delay );
}

CMDF( do_deny )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Deny whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You failed.\r\n", ch );
      return;
   }
   xSET_BIT( victim->act, PLR_DENY );
   set_char_color( AT_IMMORT, victim );
   send_to_char( "You're denied access!\r\n", victim );
   ch_printf( ch, "You have denied access to %s.\r\n", victim->name );
   stop_fighting( victim, true );
   do_quit( victim, (char *)"" );
}

CMDF( do_disconnect )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Disconnect whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( !victim->desc )
   {
      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...\r\n", ch );
      return;
   }
   close_socket( victim->desc, false );
   send_to_char( "Ok.\r\n", ch );
}

/* Force a level one player to quit. Gorog */
CMDF( do_fquit )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Force whom to quit?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( victim->level != 1 )
   {
      send_to_char( "They aren't level one!\r\n", ch );
      return;
   }
   set_char_color( AT_IMMORT, victim );
   send_to_char( "The MUD administrators force you to quit...\r\n", victim );
   stop_fighting( victim, true );
   do_quit( victim, (char *)"" );
   ch_printf( ch, "You have forced %s to quit.\r\n", victim->name );
}

CMDF( do_forceclose )
{
   DESCRIPTOR_DATA *d;
   int desc;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' || !is_number( argument ) )
   {
      send_to_char( "Usage: forceclose <descriptor #>\r\n", ch );
      return;
   }

   desc = atoi( argument );
   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...\r\n", ch );
            return;
         }
         close_socket( d, false );
         send_to_char( "Ok.\r\n", ch );
         return;
      }
   }
   send_to_char( "Not found!\r\n", ch );
}

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

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

   for( d = first_descriptor; d; d = d->next )
   {
      if( d->connected == CON_PLAYING || d->connected == CON_EDITING )
      {
         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 );
         ch_printf( d->character, "%s\r\n", argument );
      }
   }
}

void do_echo( CHAR_DATA *ch, char *argument )
{
   char arg[MIL];
   short color;
   int target;
   char *parg;

   set_char_color( AT_IMMORT, ch );

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

   if( ( color = get_color( argument ) ) )
      argument = one_argument( argument, arg );
   parg = argument;
   argument = one_argument( argument, arg );
   if( !str_cmp( arg, "pc" ) )
      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 );
   echo_to_all( color, argument, target );
}

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

   for( vic = room->first_person; vic; vic = vic->next_in_room )
   {
      set_char_color( AT_COLOR, vic );
      send_to_char( argument, vic );
      send_to_char( "\r\n", vic );
   }
}

CMDF( do_recho )
{
   char arg[MIL];
   short color;

   set_char_color( AT_IMMORT, ch );

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

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 ) ) )
      return victim->in_room;

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

   return NULL;
}

/*
 * This function shared by do_transfer and do_mptransfer
 *
 * Immortals bypass most restrictions on where to transfer victims.
 * NPCs can't transfer victims who are:
 * 1. Not authorized yet.
 * 2. Outside of the level range for the target room's area.
 * 3. Being sent to private rooms.
 */
void transfer_char( CHAR_DATA *ch, CHAR_DATA *victim, ROOM_INDEX_DATA *location )
{
   if( !victim->in_room )
   {
      bug( "%s: victim in NULL room: %s", __FUNCTION__, victim->name );
      return;
   }

   if( is_npc( ch ) && room_is_private( location ) )
   {
      progbug( "Mptransfer - Private room", ch );
      return;
   }

   if( !can_see( ch, victim ) )
      return;

   if( is_npc(ch) && not_authed( victim ) && location->area != victim->in_room->area )
   {
      char buf[MSL];

      snprintf( buf, sizeof( buf ), "Mptransfer - unauthed char (%s)", victim->name );
      progbug( buf, ch );
      return;
   }

   /* If victim not in area's level range, do not transfer */
   if( is_npc(ch) && !in_hard_range( victim, location->area ) )
      return;

   stop_fighting( victim, true );

   if( !is_npc(ch) )
   {
      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 );
   if( !is_npc(ch) )
   {
      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, (char *)"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_transfer( CHAR_DATA *ch, char *argument )
{
   char arg1[MIL], arg2[MIL];
   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 == NULL || arg1[0] == '\0' )
   {
      send_to_char( "Transfer whom (and where)?\r\n", ch );
      return;
   }

   if( arg2 != NULL && arg2[0] != '\0' )
   {
      if( !( location = find_location( ch, arg2 ) ) )
      {
         send_to_char( "That location does not exist.\r\n", ch );
         return;
      }
   }
   else
      location = ch->in_room;

   if( !( victim = get_char_world( ch, arg1 ) ) )
   {
      if( !str_cmp( arg1, "all" ) && get_trust( ch ) >= PERM_HEAD )
      {
         for( d = first_descriptor; d; d = d->next )
         {
            if( d->connected != CON_PLAYING || !d->character || d->character == ch )
               continue;
            if( !is_npc( d->character ) )
            {
               if( get_trust( ch ) < get_trust( d->character ) )
                  continue;
               if( xIS_SET( d->character->pcdata->flags, PCFLAG_DND ) )
                  continue;
            }
            transfer_char( ch, d->character, location );
         }
      }
      else
         send_to_char( "They aren't here.\r\n", ch );
      return;
   }

   if( !is_npc( victim ) && get_trust( ch ) < get_trust( victim ) )
   {
      send_to_char( "You should ask them to come to you instead of transfering them around.\r\n", ch );
      return;
   }

   if( !is_npc( victim ) && get_trust( ch ) < get_trust( victim ) && victim->desc
   && ( victim->desc->connected == CON_PLAYING || victim->desc->connected == CON_EDITING )
   && xIS_SET( victim->pcdata->flags, PCFLAG_DND ) )
   {
      pager_printf( ch, "Sorry. %s does not wish to be disturbed currently.\r\n", victim->name );
      pager_printf( victim, "Your DND flag just foiled %s's transfer command.\r\n", ch->name );
      return;
   }

   transfer_char( ch, victim, location );
}

CMDF( do_retran )
{
   char buf[MSL];
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Retransfer whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( !victim->retran )
   {
      send_to_char( "No place to retransfer them to.\r\n", ch );
      return;
   }
   snprintf( buf, sizeof( buf ), "'%s' %d", victim->name, victim->retran );
   do_transfer( ch, buf );
}

CMDF( do_regoto )
{
   char buf[MSL];

   if( !ch->regoto )
   {
      send_to_char( "No place to go back to.\r\n", ch );
      return;
   }
   snprintf( buf, sizeof( buf ), "%d", ch->regoto );
   do_goto( ch, buf );
}

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

   set_char_color( AT_IMMORT, ch );

   argument = one_argument( argument, arg );
   if( arg == NULL || argument == NULL || arg[0] == '\0' || argument[0] == '\0' )
   {
      send_to_char( "At where what?\r\n", 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 ) ) || !wch->in_room )
   {
      send_to_char( "No such mobile or player in existance.\r\n", ch );
      return;
   }
   if( !location && wch )
      location = wch->in_room;

   if( !location )
   {
      send_to_char( "No such location exists.\r\n", 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 )
   && xIS_SET( wch->pcdata->flags, PCFLAG_DND ) && get_trust( ch ) < get_trust( wch ) )
   {
      pager_printf( ch, "Sorry. %s does not wish to be disturbed.\r\n", wch->name );
      pager_printf( wch, "Your DND flag just foiled %s's at command.\r\n", ch->name );
      return;
   }

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

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

CMDF( do_atobj )
{
   char arg[MIL];
   ROOM_INDEX_DATA *location = NULL, *original;
   OBJ_DATA *obj;
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );

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

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

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

CMDF( do_rat )
{
   char arg1[MIL], arg2[MIL];
   ROOM_INDEX_DATA *location, *original;
   int Start, End, vnum;

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

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

   original = ch->in_room;
   for( vnum = Start; vnum <= End; vnum++ )
   {
      if( !( location = get_room_index( vnum ) ) )
         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.\r\n", ch );
}

void do_rstat( CHAR_DATA *ch, char *argument )
{
   char buf[MSL], arg[MIL];
   ROOM_INDEX_DATA *location;
   OBJ_DATA *obj;
   CHAR_DATA *rch;
   EXIT_DATA *pexit;
   int cnt;
   static const 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;

      ch_printf( ch, "&cExits for room '&W%s&c'  Vnum &W%d\r\n", location->name, location->vnum );
      for( cnt = 0, pexit = location->first_exit; pexit; pexit = pexit->next )
      {
         ch_printf( ch, "&W%2d) &w%2s to %-5d  &cKey: &w%d  &cFlags: &w%s  ",
            ++cnt, dir_text[pexit->vdir],
            pexit->to_room ? pexit->to_room->vnum : 0,
            pexit->key, ext_flag_string( &pexit->exit_info, ex_flags ) );
         ch_printf( ch, "&cKeywords: '&w%s&c'\r\n     Exdesc: &w%s     &cBack link: &w%d  ",
            pexit->keyword ? pexit->keyword : "(Not Set)",
            pexit->description ? pexit->description : "(Not Set).\r\n",
            pexit->rexit ? pexit->rexit->vnum : 0 );
         ch_printf( ch, "&cVnum: &w%d  &cPulltype: &w%s  &cPull: &w%d\r\n",
            pexit->rvnum, 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.\r\n", ch );
      return;
   }

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

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

   ch_printf( ch, "&cVnum: &w%d   &cSector: &w(%s)   &cLight: &w%d",
      location->vnum, sect_flags[ch->in_room->sector_type], location->light );
   if( location->tunnel > 0 )
      ch_printf( ch, "   &cTunnel: &W%d", location->tunnel );
   send_to_char( "\r\n", ch );
   ch_printf( ch, "&cChars: &w%d  &cObjs: &w%d\r\n", location->charcount, location->objcount );
   if( location->tele_delay > 0 || location->tele_vnum > 0 )
      ch_printf( ch, "&cTeleDelay: &R%d   &cTeleVnum: &R%d\r\n", location->tele_delay, location->tele_vnum );
   ch_printf( ch, "&cRoom flags: &w%s\r\n", ext_flag_string( &location->room_flags, r_flags ) );

   if( !xIS_EMPTY( location->progtypes ) )
      ch_printf( ch, "&cPrograms: &w%s\r\n", ext_flag_string( &location->progtypes, prog_names ) );

   ch_printf( ch, "&cDescription:\r\n&w%s", location->description ? location->description : "(Not Set)\r\n" );
   if( location->first_extradesc )
   {
      EXTRA_DESCR_DATA *ed;

      send_to_char( "&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( "'\r\n", ch );
   }

   send_to_char( "&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( "\r\n&cObjects:&w\r\n", ch );
   for( obj = location->first_content; obj; obj = obj->next_content )
   {
      send_to_char( format_obj_to_char( obj, ch, true ), ch );
      send_to_char( "\r\n", ch );
   }

   if( location->first_exit )
      send_to_char( "&c------------------- &wEXITS &c-------------------\r\n", ch );
   for( cnt = 0, pexit = location->first_exit; pexit; pexit = pexit->next )
   {
      ++cnt;
      if( !pexit->to_room )
      {
         bug( "%s: NULL to_room for exit %2d) %-2s", __FUNCTION__, cnt, dir_text[pexit->vdir] );
         continue;
      }

      ch_printf( ch, "%2d) %-2s to %-5d. Name: %-10.10s",
         cnt, dir_text[pexit->vdir], pexit->to_room->vnum,
         pexit->to_room->name ? pexit->to_room->name : "(UNKNOWN)" );
      if( pexit->key > 0 )
         ch_printf( ch, " Key: %d", pexit->key );
      if( !xIS_EMPTY( pexit->exit_info ) )
         ch_printf( ch, " Flags: [%s]", ext_flag_string( &pexit->exit_info, ex_flags ) );
      if( pexit->keyword )
         ch_printf( ch, " Keywords: %s", pexit->keyword );
      send_to_char( "\r\n", ch );
   }
}

/* Face-lift by Demora */
void do_ostat( CHAR_DATA *ch, char *argument )
{
   char arg[MIL];
   AFFECT_DATA *paf;
   OBJ_DATA *obj;
   int stat, count = 0;

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

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

   ch_printf( ch, "&cName: &w%s\r\n", obj->name ? obj->name : "Not Set" );
   if( str_cmp( obj->name, obj->pIndexData->name ) )
      ch_printf( ch, "&cIndex Name: &r%s\r\n", obj->pIndexData->name );

   ch_printf( ch, "&cVnum: &w%d\r\n", obj->pIndexData->vnum );

   ch_printf( ch, "&cType: &w%d&c[&w%s&c]\r\n", obj->item_type, o_types[obj->item_type] );
   if( obj->item_type != obj->pIndexData->item_type )
      ch_printf( ch, "&cIndex Type: &r%d&c[&r%s&c]\r\n", obj->pIndexData->item_type, o_types[obj->pIndexData->item_type] );

   ch_printf( ch, "&cCount: &w%d&c(&r%d&c)\r\n", obj->count, obj->pIndexData->count );

   ch_printf( ch, "&cShort description : &w%s\r\n", obj->short_descr ? obj->short_descr : "Not Set" );
   if( str_cmp( obj->short_descr, obj->pIndexData->short_descr ) )
      ch_printf( ch, "&cIndex Short description : &r%s\r\n", obj->pIndexData->short_descr ? obj->pIndexData->short_descr : "Not Set" );

   ch_printf( ch, "&cLong description  : &w%s\r\n", obj->description ? obj->description : "Not Set" );
   if( str_cmp( obj->description, obj->pIndexData->description ) )
      ch_printf( ch, "&cIndex Long description  : &r%s\r\n", obj->pIndexData->description ? obj->pIndexData->description : "Not Set" );

   ch_printf( ch, "&cDesc              : &w%s\r\n", obj->desc ? obj->desc : "Not Set" );
   if( str_cmp( obj->desc, obj->pIndexData->desc ) )
      ch_printf( ch, "&cIndex Desc              : &r%s\r\n", obj->pIndexData->desc ? obj->pIndexData->desc : "Not Set" );

   ch_printf( ch, "&cAction description: &w%s\r\n", obj->action_desc ? obj->action_desc : "Not Set" );
   if( str_cmp( obj->action_desc, obj->pIndexData->action_desc ) )
      ch_printf( ch, "&cIndex Action description: &r%s\r\n", obj->pIndexData->action_desc ? obj->pIndexData->action_desc : "Not Set" );

   ch_printf( ch, "&cWear flags : &w%s\r\n", ext_flag_string( &obj->wear_flags, w_flags ) );
   if( !xSAME_BITS( obj->wear_flags, obj->pIndexData->wear_flags ) )
      ch_printf( ch, "&cIndex Wear flags : &r%s\r\n", ext_flag_string( &obj->pIndexData->wear_flags, w_flags ) );

   ch_printf( ch, "&cExtra flags: &w%s\r\n", ext_flag_string( &obj->extra_flags, o_flags ) );
   if( !xSAME_BITS( obj->extra_flags, obj->pIndexData->extra_flags ) )
      ch_printf( ch, "&cIndex Extra flags: &r%s\r\n", ext_flag_string( &obj->pIndexData->extra_flags, o_flags ) );

   ch_printf( ch, "&cIndex Programs: &r%s\r\n", ext_flag_string( &obj->pIndexData->progtypes, prog_names ) );

   ch_printf( ch, "&cNumber: &w%d/%d   ", 1, get_obj_number( obj ) );

   ch_printf( ch, "&cWeight: &w%d/%d   ", obj->weight, get_obj_weight( obj ) );

   ch_printf( ch, "&cLayers: &w%d\r\n", obj->pIndexData->layers );

   ch_printf( ch, "&cWear_loc: &w%d(%s)\r\n", obj->wear_loc, obj->wear_loc != WEAR_NONE ? wear_locs[obj->wear_loc] : "Not Worn" );

   ch_printf( ch, "&cCost: &w%d", obj->cost );
   if( obj->cost != obj->pIndexData->cost )
      ch_printf( ch, "&c(&r%d&c)", obj->pIndexData->cost );
   send_to_char( "\r\n", ch );

   if( obj->bsplatter )
      ch_printf( ch, "&cBlood: &w%d&c\r\n", obj->bsplatter );

   if( obj->bstain )
      ch_printf( ch, "&cStain: &w%d&c\r\n", obj->bstain );

   if( obj->timer )
      ch_printf( ch, "&cTimer: &w%d&c\r\n", obj->timer );

   send_to_char( "&cRequirements:\r\n", ch );
   ch_printf( ch, "&c%12s: &w%3d&c(&r%3d&c) ", "Level", obj->level, obj->pIndexData->level );
   /* Since displaying level as a requirement put count to 1 before loop */
   count++;
   for( stat = 0; stat < STAT_MAX; stat++ )
   {
      ch_printf( ch, "&c%12s: &w%3d&c(&r%3d&c)", capitalize( stattypes[stat] ), obj->stat_reqs[stat],
         obj->pIndexData->stat_reqs[stat] );
      if( ++count == 3 )
      {
         count = 0;
         send_to_char( "\r\n", ch );
      }
      else
         send_to_char( " ", ch );
   }
   if( count != 0 )
      send_to_char( "\r\n", ch );

   if( !xIS_EMPTY( obj->class_restrict ) )
      ch_printf( ch, "&cClass Restrictions:\r\n&w%s\r\n", ext_class_string( &obj->class_restrict ) );
   if( !xSAME_BITS( obj->class_restrict, obj->pIndexData->class_restrict ) )
      ch_printf( ch, "&cIndex Class Restrictions:\r\n&r%s\r\n", ext_class_string( &obj->pIndexData->class_restrict ) );

   if( !xIS_EMPTY( obj->race_restrict ) )
      ch_printf( ch, "&cRace Restrictions:\r\n&w%s\r\n", ext_race_string( &obj->race_restrict ) );
   if( !xSAME_BITS( obj->race_restrict, obj->pIndexData->race_restrict ) )
      ch_printf( ch, "&cIndex Race Restriction:\r\n&r%s\r\n", ext_race_string( &obj->pIndexData->race_restrict ) );

   if( obj->in_room )
      ch_printf( ch, "&cIn room: &w%d&c(&w%s&c)\r\n", obj->in_room->vnum,
         obj->in_room->name ? obj->in_room->name : "Not Set" );

   if( obj->carried_by )
      ch_printf( ch, "&cCarried by: &w%s\r\n", obj->carried_by->name );

   if( obj->in_obj )
   {
      OBJ_DATA *tobj = NULL;

      ch_printf( ch, "&cIn object: &w%s\r\n", obj->in_obj->short_descr );

      tobj = obj->in_obj;
      while( tobj->in_obj )
      {
         ch_printf( ch, "&cIn object: &w%s\r\n", tobj->in_obj->short_descr );
         tobj = tobj->in_obj;
      }
      if( tobj )
      {
         if( tobj->in_obj )
            ch_printf( ch, "&cIn object: &w%s\r\n", tobj->in_obj->short_descr );
         if( tobj->in_room )
            ch_printf( ch, "&cIn room: &w%d&c(&w%s&c)\r\n", tobj->in_room->vnum,
               tobj->in_room->name ? tobj->in_room->name : "Not Set" );
         if( tobj->carried_by )
            ch_printf( ch, "&cCarried by: &w%s\r\n", tobj->carried_by->name );
      }
   }

   ch_printf( ch, "&cIndex Values : &w%d %d %d %d %d %d.\r\n",
      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( ch, "&cObject Values: &w%d %d %d %d %d %d.\r\n",
      obj->value[0], obj->value[1], obj->value[2], obj->value[3], obj->value[4], obj->value[5] );

   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( "'.\r\n", 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( "'.\r\n", ch );
   }

   for( paf = obj->pIndexData->first_affect; paf; paf = paf->next )
      showaffect( ch, paf, false );

   for( paf = obj->first_affect; paf; paf = paf->next )
      showaffect( ch, paf, true );
}

void do_mstat( CHAR_DATA *ch, char *argument )
{
   char arg[MIL];
   AFFECT_DATA *paf;
   CHAR_DATA *victim;
   SKILLTYPE *skill;
   int x, stat;
   MOB_INDEX_DATA *mindex;

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

   if( !( victim = get_char_world( ch, arg ) ) )
   {
      send_to_pager( "They aren't here.\r\n", 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.\r\n", ch );
      return;
   }
   if( is_npc( victim ) && get_trust( ch ) < PERM_LEADER && 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.\r\n", ch );
      return;
   }

   mindex = victim->pIndexData;

   send_to_pager( "&WAll Data:\r\n", ch );

   pager_printf( ch, "&c%s: &w%-20s\r\n", is_npc( victim ) ? "Mobile name" : "Name", victim->name );
   if( mindex && str_cmp( victim->name, mindex->name ) )
      pager_printf( ch, "&cIndex Mobile Name: &r%-20s\r\n", mindex->name ? mindex->name : "(Not Set)" );

   pager_printf( ch, "&cSex: &w%s", sex_names[victim->sex] );
   if( mindex && victim->sex != mindex->sex )
      pager_printf( ch, "&c(&r%s&c)", sex_names[mindex->sex] );

   pager_printf( ch, " &cRoom: &w%d &cKilled: &w%d\r\n",
      victim->in_room ? victim->in_room->vnum : 0,
      mindex ? mindex->killed : victim->pcdata->mdeaths + victim->pcdata->pdeaths );

   pager_printf( ch, "&cLevel: &w%d", victim->level );
   if( mindex && victim->level != mindex->level )
      pager_printf( ch, "&c(&r%d&c)", mindex->level );
   send_to_pager( "\r\n", ch );

   for( stat = 0; stat < STAT_MAX; stat++ )
   {
      pager_printf( ch, "&c(%3.3s: &w%d+(%d)", capitalize( stattypes[stat] ), get_perm_stat( stat, victim ), get_mod_stat( stat, victim ) );
      if( stat == STAT_CHA )
      {
         short currcha = get_curr_stat( stat, victim );
         short scurrcha = ( get_perm_stat( stat, victim ) + get_mod_stat( stat, victim ) );

         if( currcha > scurrcha )
            pager_printf( ch, "+(%d)", ( currcha - scurrcha ) );
         else if( scurrcha > currcha )
            pager_printf( ch, "-(&r%d&w)", ( scurrcha - currcha ) );
      }
      if( mindex && get_perm_stat( stat, victim ) != mindex->perm_stats[stat] )
         pager_printf( ch, "&c[&r%d&c]", mindex->perm_stats[stat] );
      send_to_pager( "&c)", ch );
   }
   send_to_pager( "\r\n", ch );

   pager_printf( ch, "&cHps: &w%d&c/&w%d &c%s: &w%d&c/&w%d &cMove: &w%d&c/&w%d\r\n",
      victim->hit, victim->max_hit, is_vampire( victim ) ? "Blood" : "Mana",
      victim->mana, victim->max_mana, victim->move, victim->max_move );

   pager_printf( ch, "&cHitroll: &C%5d ", get_hitroll( victim ) );
   if( mindex && get_hitroll( victim ) != mindex->hitroll )
      pager_printf( ch, "&c[&R%5d&c] ", mindex->hitroll );
   pager_printf( ch, "&cAlign: &w%-5d &cArmorclass: &w%d\r\n", victim->alignment, get_ac( victim ) );

   pager_printf( ch, "&cDamroll: &C%5d ", get_damroll( victim ) );
   if( mindex && get_damroll( victim ) != mindex->damroll )
      pager_printf( ch, "&c[&R%5d&c] ", mindex->damroll );
   pager_printf( ch, "&cWimpy: &w%-5d &cPosition: &w%d[%s]\r\n",
      victim->wimpy, victim->position, pos_names[victim->position] );

   pager_printf( ch, "&cFighting: &w%-13s   &cMaster: &w%-13s   &cLeader: &w%s\r\n",
      victim->fighting ? victim->fighting->who->name : "(none)",
      victim->master ? victim->master->name : "(none)", victim->leader ? victim->leader->name : "(none)" );

   pager_printf( ch, "&cMentalState: &w%-3d\r\n", victim->mental_state );
   pager_printf( ch, "&cSave versus: &w%d %d %d %d %d       &cItems: &w(%d/%d)  &cWeight &w(%d/%d)\r\n",
      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 ), victim->carry_weight, can_carry_w( victim ) );
   pager_printf( ch, "&cYear: &w%-5d  &cSecs: &w%d  &cTimer: &w%d  &cGold: &w%s\r\n",
      get_age( victim ), ( int )victim->played, victim->timer, show_big_nums( victim->bgold, victim->gold ) );
   if( get_timer( victim, TIMER_PKILLED ) )
      pager_printf( ch, "&cTimerPkilled:  &w%d\r\n", get_timer( victim, TIMER_PKILLED ) );
   if( get_timer( victim, TIMER_RECENTFIGHT ) )
      pager_printf( ch, "&cTimerRecentfight:  &w%d\r\n", get_timer( victim, TIMER_RECENTFIGHT ) );
   if( get_timer( victim, TIMER_ASUPPRESSED ) )
      pager_printf( ch, "&cTimerAsuppressed:  &w%d\r\n", get_timer( victim, TIMER_ASUPPRESSED ) );

   if( victim->morph )
   {
      if( victim->morph->morph )
         pager_printf( ch, "&cMorphed as : (&w%d&c) &w%s    &cTimer: &w%d\r\n",
            victim->morph->morph->vnum, victim->morph->morph->short_desc, victim->morph->timer );
      else
         send_to_pager( "&cMorphed as: Morph was deleted.\r\n", ch );
   }
   pager_printf( ch, "&cAffected by: &w%s\r\n", ext_flag_string( &victim->affected_by, a_flags ) );
   if( mindex && !xSAME_BITS( victim->affected_by, mindex->affected_by ) )
      pager_printf( ch, "&cIndex Affected By: &r%s\r\n", ext_flag_string( &mindex->affected_by, a_flags ) );

   if( mindex )
      ch_printf( ch, "&cIndex Programs: &r%s\r\n", ext_flag_string( &mindex->progtypes, prog_names ) );

   pager_printf( ch, "&cSpeaks: &w%s", ext_flag_string( &victim->speaks, lang_names ) );
   if( mindex && !xSAME_BITS( victim->speaks, mindex->speaks ) )
      pager_printf( ch, "&c(&r%s&c)", ext_flag_string( &mindex->speaks, lang_names ) );
   pager_printf( ch, "\r\n&cSpeaking: &w%s", ext_flag_string( &victim->speaking, lang_names ) );
   if( mindex && !xSAME_BITS( victim->speaking, mindex->speaking ) )
      pager_printf( ch, "&c(&r%s&c)", ext_flag_string( &mindex->speaking, lang_names ) );
   send_to_pager( "\r\n", ch );

   send_to_pager( "&cLanguages: &w", ch );
   for( x = 0; lang_array[x] != LANG_UNKNOWN; x++ )
   {
      if( knows_language( victim, lang_array[x] ) )
      {
         if( xIS_SET( victim->speaking, lang_array[x] ) )
            send_to_pager( "&[red]", ch );
         send_to_pager( lang_names[x], ch );
         send_to_pager( "&D ", ch );
      }
      else if( xIS_SET( victim->speaking, lang_array[x] ) )
      {
         send_to_pager( "&[pink]", ch );
         send_to_pager( lang_names[x], ch );
         send_to_pager( "&D ", ch );
      }
   }
   send_to_pager( "&D\r\n", ch );

   if( victim->short_descr )
      pager_printf( ch, "&cShortdesc: &w%s\r\n", victim->short_descr );
   if( mindex && str_cmp( victim->short_descr, mindex->short_descr ) )
      pager_printf( ch, "&cIndex Shortdesc: &r%s\r\n", mindex->short_descr ? mindex->short_descr : "(Not Set)" );
   
   if( victim->long_descr )
      pager_printf( ch, "&cLongdesc: &w%s", victim->long_descr );
   if( mindex && str_cmp( victim->long_descr, mindex->long_descr ) )
      pager_printf( ch, "&cIndex Longdesc: &r%s", mindex->long_descr ? mindex->long_descr : "(Not Set)" );

   if( !xIS_EMPTY( victim->resistant ) )
      pager_printf( ch, "&cResistant  : &w%s\r\n", ext_flag_string( &victim->resistant, ris_flags ) );
   if( mindex && !xSAME_BITS( mindex->resistant, victim->resistant ) )
      pager_printf( ch, "&cIndex Resistant: &r%s\r\n", ext_flag_string( &mindex->resistant, ris_flags ) );

   if( !xIS_EMPTY( victim->immune ) )
      pager_printf( ch, "&cImmune: &w%s\r\n", ext_flag_string( &victim->immune, ris_flags ) );
   if( mindex && !xSAME_BITS( mindex->immune, victim->immune ) )
      pager_printf( ch, "&cIndex Immune: &r%s\r\n", ext_flag_string( &mindex->immune, ris_flags ) );

   if( !xIS_EMPTY( victim->absorb ) )
      pager_printf( ch, "&cAbsorb: &w%s\r\n", ext_flag_string( &victim->absorb, ris_flags ) );
   if( mindex && !xSAME_BITS( mindex->absorb, victim->absorb ) )
      pager_printf( ch, "&cIndex Absorb: &r%s\r\n", ext_flag_string( &mindex->absorb, ris_flags ) );

   if( !xIS_EMPTY( victim->susceptible ) )
      pager_printf( ch, "&cSusceptible: &w%s\r\n", ext_flag_string( &victim->susceptible, ris_flags ) );
   if( mindex && !xSAME_BITS( mindex->susceptible, victim->susceptible ) )
      pager_printf( ch, "&cIndex Susceptible: &r%s\r\n", ext_flag_string( &mindex->susceptible, ris_flags ) );

   /* Should show all affects listed not just ones with matching skills */
   for( paf = victim->first_affect; paf; paf = paf->next )
   {
      if( ( skill = get_skilltype( paf->type ) ) )
         ch_printf( ch, "&c%s: &w'%s' ", skill_tname[skill->type], skill->name );
      else
         ch_printf( ch, "&c%d: &w'Unknown' ", paf->type );

      if( paf->location == APPLY_STAT )
         ch_printf( ch, "Mods %s", ext_flag_string( &paf->bitvector, stattypes ) );
      else
         ch_printf( ch, "Mods %s", a_types[paf->location % REVERSE_APPLY] );

      if( paf->location == APPLY_RESISTANT || paf->location == APPLY_IMMUNE || paf->location == APPLY_SUSCEPTIBLE || paf->location == APPLY_ABSORB )
         ch_printf( ch, " to %s", ris_flags[paf->modifier] );
      else if( paf->location == APPLY_EXT_AFFECT )
      {
         if( paf->modifier == 0 )
            ch_printf( ch, " by %s", ext_flag_string( &paf->bitvector, a_flags ) );
         else if( paf->modifier > 0 && paf->modifier < AFF_MAX )
            ch_printf( ch, " by %s", a_flags[paf->modifier] );
         else
            ch_printf( ch, " by %d", paf->modifier );
      }
      else
         ch_printf( ch, " by %d", paf->modifier );
      ch_printf( ch, " for %d Seconds &D\r\n", paf->duration );
   }
   if( is_npc( victim ) )
   {
      HHF_DATA *hhf;

      pager_printf( ch, "&cVnum: &w%-5d &cCount: &w%d\r\n",
         victim->pIndexData->vnum, victim->pIndexData->count );

      if( victim->summoning )
         pager_printf( ch, "&cSummoning: &w%s\r\n", victim->summoning->name );
      if( victim->first_hating )
      {
         for( hhf = victim->first_hating; hhf; hhf = hhf->next )
            pager_printf( ch, "&cHating: &w%s\r\n", hhf->name );
      }
      if( victim->first_hunting )
      {
         for( hhf = victim->first_hunting; hhf; hhf = hhf->next )
            pager_printf( ch, "&cHunting: &w%s\r\n", hhf->name );
      }
      if( victim->first_fearing )
      {
         for( hhf = victim->first_fearing; hhf; hhf = hhf->next )
            pager_printf( ch, "&cFearing: &w%s\r\n", hhf->name );
      }

      pager_printf( ch, "&cMob hit min/max: &r%d&c-&r%d&c\r\n", mindex->minhit, mindex->maxhit );

      pager_printf( ch, "&cNumAttacks : &w%d", victim->numattacks );
      if( mindex->numattacks != victim->numattacks )
         pager_printf( ch, "(&r%d)", mindex->numattacks );
      send_to_pager( "\r\n", ch );

      if( victim->spec_fun )
         pager_printf( ch, "&cMobile has spec fun: &w%s\r\n", victim->spec_funname );
      if( str_cmp( mindex->spec_funname, victim->spec_funname ) )
         pager_printf( ch, "&cIndex spec fun: &r%s\r\n", mindex->spec_funname ? mindex->spec_funname : "(Not Set)" );

      if( !xIS_EMPTY( victim->xflags ) )
         pager_printf( ch, "&cBody Parts: &w%s\r\n", ext_flag_string( &victim->xflags, part_flags ) );
      if( !xSAME_BITS( mindex->xflags, victim->xflags ) )
         pager_printf( ch, "&cIndex Body Parts: &r%s\r\n", ext_flag_string( &mindex->xflags, part_flags ) );

      if( !xIS_EMPTY( victim->attacks ) )
         pager_printf( ch, "&cAttacks: &w%s\r\n", ext_flag_string( &victim->attacks, attack_flags ) );
      if( !xSAME_BITS( mindex->attacks, victim->attacks ) )
         pager_printf( ch, "&cIndex Attacks: &r%s\r\n", ext_flag_string( &mindex->attacks, attack_flags ) );

      if( !xIS_EMPTY( victim->defenses ) )
         pager_printf( ch, "&cDefenses: &w%s\r\n", ext_flag_string( &victim->defenses, defense_flags ) );
      if( !xSAME_BITS( mindex->defenses, victim->defenses ) )
         pager_printf( ch, "&cIndex Defenses: &r%s\r\n", ext_flag_string( &mindex->defenses, defense_flags ) );

      if( !xIS_EMPTY( victim->act ) )
         pager_printf( ch, "&cAct Flags: &w%s\r\n", ext_flag_string( &victim->act, act_flags ) );
      if( !xSAME_BITS( mindex->act, victim->act ) )
         pager_printf( ch, "&cIndex Act Flags: &r%s\r\n", ext_flag_string( &mindex->act, act_flags ) );
   }
   else
   {
      pager_printf( ch, "&cStatus: &w%-10s", can_pkill( victim ) ? "Deadly" :
         is_pkill( victim ) ? "Pre-Deadly" : "Non-Deadly" );
      if( victim->pcdata && victim->pcdata->bestowments )
         pager_printf( ch, "&cBestowments: &w%s\r\n", victim->pcdata->bestowments );
      if( victim->pcdata->clan )
      {
         pager_printf( ch, "   &c%s: &w%s",
            victim->pcdata->clan->clan_type == CLAN_NATION ? "Nation" : "Clan",
            victim->pcdata->clan->name );
      }
      send_to_pager( "\r\n", ch );
      if( get_trust( ch ) >= PERM_HEAD )
      {
         if( victim->desc )
         {
            pager_printf( ch, "&cHost: &w%s   &cDescriptor: &w%d   ",
               victim->desc->host, victim->desc->descriptor );
         }
         pager_printf( ch, "&cTrust: &w%d  &cAuthBy: &w%s\r\n",
            victim->trust, victim->pcdata->authed_by ? victim->pcdata->authed_by : "(No One)" );
      }

      {
         MCLASS_DATA *mclass;

         for( mclass = victim->pcdata->first_mclass; mclass; mclass = mclass->next )
            pager_printf( ch, "&cClass: &w%-2.2d/%s Level: %d Exp: %.f Percent %d\r\n",
               mclass->wclass, dis_class_name( mclass->wclass ), mclass->level, mclass->exp, mclass->cpercent );
      }
      pager_printf( ch, "&cRace: &w%-2.2d/%-10s\r\n", victim->race, dis_race_name( victim->race ) );

      if( victim->pcdata->deity )
         pager_printf( ch, "&CDeity: &w%s   ", victim->pcdata->deity->name );
      pager_printf( ch, "&cFavor: &w%-5d   &cGlory: &w%u\r\n",
         victim->pcdata->favor, victim->pcdata->quest_curr );
      pager_printf( ch, "&cThirst: &w%d   &cFull: &w%d   &cDrunk: &w%d\r\n",
         victim->pcdata->condition[COND_THIRST],
         victim->pcdata->condition[COND_FULL],
         victim->pcdata->condition[COND_DRUNK] );
      pager_printf( ch, "&cPlayerFlags: &w%s\r\n", ext_flag_string( &victim->act, plr_flags ) );
      pager_printf( ch, "&cPcflags: &w%s\r\n", ext_flag_string( &victim->pcdata->flags, pc_flags ) );
      if( victim->wait )
         pager_printf( ch, "&cWaitState: &R%d\r\n", victim->wait / 12 );
   }
}

CMDF( do_mfind )
{
   char arg[MIL];
   MOB_INDEX_DATA *pMobIndex;
   int hash, nMatch = 0, vnum = 0;
   bool fAll = false;

   set_pager_color( AT_PLAIN, ch );

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

   if( is_number( arg ) )
      vnum = atoi( arg );
   else if( !str_cmp( arg, "all" ) )
      fAll = true;

   for( hash = 0; hash < MKH; hash++ )
   {
      for( pMobIndex = mob_index_hash[hash]; pMobIndex; pMobIndex = pMobIndex->next )
      {
         if( fAll || vnum == pMobIndex->vnum || nifty_is_name( arg, pMobIndex->name ) )
         {
            nMatch++;
            pager_printf( ch, "[%5d] %s\r\n", 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.\r\n", ch );
}

CMDF( do_ofind )
{
   char arg[MIL];
   OBJ_INDEX_DATA *pObjIndex;
   int hash, nMatch = 0, vnum = 0;
   bool fAll = false;

   set_pager_color( AT_PLAIN, ch );

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

   if( is_number( arg ) )
      vnum = atoi( arg );
   else if( !str_cmp( arg, "all" ) )
      fAll = true;

   for( hash = 0; hash < MKH; hash++ )
   {
      for( pObjIndex = obj_index_hash[hash]; pObjIndex; pObjIndex = pObjIndex->next )
      {
         if( fAll || vnum == pObjIndex->vnum || nifty_is_name( arg, pObjIndex->name ) )
         {
            nMatch++;
            pager_printf( ch, "[%5d] %s\r\n", 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.\r\n", ch );
}

CMDF( do_mwhere )
{
   char arg[MIL];
   CHAR_DATA *victim;
   bool found;
   int vnum = 0;

   set_pager_color( AT_PLAIN, ch );

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

   if( is_number( arg ) )
      vnum = atoi( arg );

   found = false;
   for( victim = first_char; victim; victim = victim->next )
   {
      if( !is_npc( victim ) || !victim->in_room )
         continue;
      if( vnum > 0 && victim->pIndexData->vnum != vnum )
         continue;
      else if( vnum <= 0 && !nifty_is_name( arg, victim->name ) )
         continue;
      found = true;
      pager_printf( ch, "[%5d] %-28s [%5d] %s\r\n",
         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 );
}

CMDF( do_gwhere )
{
   CHAR_DATA *victim;
   char arg1[MIL], arg2[MIL], arg3[MIL];
   DESCRIPTOR_DATA *d;
   bool found = false, pmobs = false;
   int low = 1, high = MAX_LEVEL, count = 0;

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

   pager_printf( ch, "\r\n&cGlobal %s locations:&w\r\n", 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 ) && !is_npc( victim ) && victim->in_room
         && can_see( ch, victim ) && victim->level >= low && victim->level <= high )
         {
            found = true;
            pager_printf( ch, "&c(&C%2d&c) &w%-12.12s   [%-5d - %-19.19s]   &c%-25.25s\r\n",
               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( ch, "&c(&C%2d&c) &w%-12.12s   [%-5d - %-19.19s]   &c%-25.25s\r\n",
               victim->level, victim->name, victim->in_room->vnum, victim->in_room->area->name, victim->in_room->name );
            count++;
         }
      }
   }
   pager_printf( ch, "&c%d %s found.\r\n", count, pmobs ? "mobs" : "characters" );
}

CMDF( do_gfighting )
{
   HHF_DATA *hhf, *tmp_hhf = NULL;
   CHAR_DATA *victim;
   DESCRIPTOR_DATA *d;
   char arg1[MIL];
   bool found = false, pmobs = false, phating = false, phunting = false, pfearing = false, pall = false, psummoning = false;
   int low = 1, high = MAX_LEVEL, count = 0;

   argument = one_argument( argument, arg1 );
   if( arg1 != NULL && arg1[0] != '\0' )
   {
      if( is_number( arg1 ) )
      {
         low = atoi( arg1 );
         argument = one_argument( argument, arg1 );
         if( arg1 != NULL && arg1[0] != '\0' )
         {
            if( is_number( arg1 ) )
               high = atoi( arg1 );
            argument = one_argument( argument, arg1 );
         }
      }
   }

   if( arg1 != NULL && arg1[0] != '\0' )
   {
      if( !str_cmp( arg1, "mobs" ) )
         pmobs = true;
      else if( !str_cmp( arg1, "all" ) )
         pall = true;
      else if( !str_cmp( arg1, "hating" ) )
         phating = true;
      else if( !str_cmp( arg1, "hunting" ) )
         phunting = true;
      else if( !str_cmp( arg1, "fearing" ) )
         pfearing = true;
      else if( !str_cmp( arg1, "summoning" ) )
         psummoning = true;
      else
      {
         send_to_pager( "&wUsage: gfighting [<low>] [<high>] [all/mobs/hating/hunting/fearing/summoning]\r\n", ch );
         return;
      }
   }

   if( low < 1 || high < low || low > high || high > MAX_LEVEL )
   {
      send_to_pager( "&wInvalid level range.\r\n", ch );
      return;
   }

   if( pall || ( !pmobs && !phating && !phunting && !pfearing && !psummoning ) )
   {
      send_to_pager( "&cGlobal player conflict(s):\r\n", ch );
      for( d = first_descriptor; d; d = d->next )
      {
         if( ( d->connected == CON_PLAYING || d->connected == CON_EDITING )
         && ( victim = d->character ) && !is_npc( victim ) && victim->in_room
         && can_see( ch, victim ) && victim->fighting && victim->level >= low && victim->level <= high )
         {
            found = true;
            pager_printf( ch, "&w%-12.12s &C|%2d &wvs &C%2d| &w%-16.16s [%5d]  &c%-20.20s [%5d]\r\n",
               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 ? 0 : victim->in_room->vnum );
            count++;
         }
      }
   }

   if( pall || pmobs )
   {
      send_to_pager( "&cGlobal mob conflict(s):\r\n", ch );
      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( ch, "&w%-12.12s &C|%2d &wvs &C%2d| &w%-16.16s [%5d]  &c%-20.20s [%5d]\r\n",
               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 ? 0 : victim->in_room->vnum );
            count++;
         }
      }
   }

   if( pall || pfearing || phating || phunting || psummoning )
   {
      short tmp;

      for( tmp = 0; tmp < 3; tmp++ )
      {
         if( pfearing || ( pall && tmp == 0 ) )
            tmp_hhf = first_fearing;
         else if( psummoning || phating || ( pall && tmp == 1 ) )
            tmp_hhf = first_hating;
         else if( phunting || ( pall && tmp == 2 ) )
            tmp_hhf = first_hunting;

         pager_printf( ch, "&cGlobal mob %s conflict(s):\r\n",
            ( pfearing || ( pall && tmp == 0 ) ) ? "fearing" : 
            ( psummoning || phating || ( pall && tmp == 1 ) ) ? ( psummoning ? "summoning" : "hating" ) : 
            ( phunting || ( pall && tmp == 2 ) ) ? "hunting" : "unknown" );
         for( hhf = tmp_hhf; hhf; hhf = hhf->lnext )
         {
            if( !(victim = hhf->mob) )
            {
               bug( "%s: %s list contains a NULL mob pointer.", __FUNCTION__, 
                  ( pfearing || ( pall && tmp == 0 ) ) ? "Fearing" : 
                  ( phating || ( pall && tmp == 1 ) ) ? "Hating" : 
                  ( phunting || ( pall && tmp == 2 ) ) ? "Hunting" : "Unknown" );
               continue;
            }
            if( !victim->in_room || !can_see( ch, victim ) || victim->level < low || victim->level > high )
               continue;
            if( psummoning && victim->summoning != hhf->who )
               continue;
            found = true;
            pager_printf( ch, "&w%-12.12s &C|%2d &wvs &C%2d| &w%-16.16s [%5d]  &c%-20.20s [%5d]%s\r\n",
               victim->name, victim->level, hhf->who ? hhf->who->level : 0,
               hhf->who ? ( is_npc( hhf->who ) ?
               hhf->who->short_descr : hhf->who->name ) : hhf->name,
               hhf->who ? ( is_npc( hhf->who ) ? hhf->who->pIndexData->vnum : 0 ) : 0,
               victim->in_room->area->name, !victim->in_room ? 0 : victim->in_room->vnum,
               ( !psummoning && victim->summoning == hhf->who ) ? " &RSummoning" : "" );
            count++;
         }

         if( !pall ) /* If not in a pall stop after displaying one set */
            break;
      }
   }
   pager_printf( ch, "&c%d %s conflicts located.\r\n", count, pmobs ? "mob" : "character" );
}

/* 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 */
CMDF( do_bodybag )
{
   char buf2[MSL], arg1[MIL], arg2[MIL];
   CHAR_DATA *owner;
   OBJ_DATA *obj;
   bool found = false, bag = false;

   argument = one_argument( argument, arg1 );
   if( arg1 == NULL || arg1[0] == '\0' )
   {
      send_to_char( "&PUsage: bodybag <character> | bodybag <character> yes\r\n", ch );
      if( is_npc( ch ) )
         progbug( "Bodybag - called w/o enough argument(s)", ch );
      return;
   }

   snprintf( buf2, sizeof( buf2 ), "the corpse of %s", arg1 );

   argument = one_argument( argument, arg2 );
   if( !str_cmp( arg2, "yes" ) )
      bag = true;

   if( is_npc( ch ) )
   {
      if( !( owner = get_char_room( ch, arg1 ) ) )
      {
         send_to_char( "Victim must be in the same room as you.\r\n", ch );
         progbug( "Bodybag: victim not in same room", ch );
         return;
      }
      if( is_npc( owner ) )
      {
         progbug( "Bodybag: bodybagging a npc corpse", ch );
         return;
      }
      bag = true;
   }

   pager_printf( ch, "\r\n&P%s remains of %s ... ", bag ? "Retrieving" : "Searching for", capitalize( arg1 ) );
   for( obj = first_corpse; obj; obj = obj->next_corpse )
   {
      if( obj->pIndexData->vnum != OBJ_VNUM_CORPSE_PC || str_cmp( buf2, obj->short_descr ) )
         continue;
      found = true;
      pager_printf( ch, "\r\n&P%sCorpse: &w%-12.12s %2s ",
         bag ? "Bagging " : "", capitalize( arg1 ),
         is_obj_stat( obj, ITEM_CLANCORPSE ) ? "&RPK" : "" );
      if( obj->in_room )
         pager_printf( ch, "&PIn Room: &w%-22.22s &P[&w%5d&P] ", obj->in_room->area->name, obj->in_room->vnum );
      else if( obj->in_obj )
         pager_printf( ch, "&PIn Obj:  &w%-22.22s &P[&w%5d&P] ", obj->in_obj->short_descr, obj->in_obj->pIndexData->vnum );
      else if( obj->carried_by )
         pager_printf( ch, "&PCarried: &w%-30.30s ", obj->carried_by->name );
      else
         pager_printf( ch, "&P%-39.39s ", "Unknown Location!!!" );
      pager_printf( ch, "&PTimer: &w%d\r\n", obj->timer );

      /* Maybe we should only move the ones in a room */
      if( bag && obj->in_room )
      {
         obj_from_room( obj );
         obj = obj_to_char( obj, ch );
         obj->timer = -1;
         save_char_obj( ch );
      }
   }

   if( !found )
   {
      send_to_pager( "&PNo corpse was found.\r\n", ch );
      return;
   }

   if( is_npc( ch ) )
      return;

   send_to_pager( "\r\n", 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 )
   {
      pager_printf( ch, "&P%s is not currently online.\r\n", capitalize( arg1 ) );
      return;
   }

   pager_printf( ch, "&P%s (%d) has ", owner->name, owner->level );
   if( owner->pcdata->deity )
      pager_printf( ch, "%d favor with %s (needed to supplicate: %d)\r\n",
         owner->pcdata->favor, owner->pcdata->deity->name, owner->pcdata->deity->scorpse );
   else
      send_to_pager( "no deity.\r\n", ch );
}

/* New owhere by Altrag, 03/14/96 */
CMDF( do_owhere )
{
   OBJ_DATA *obj;
   int icnt = 0, cnt, x, vnum = 0;

   set_pager_color( AT_PLAIN, ch );

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

   if( is_number( argument ) )
      vnum = atoi( argument );

   for( obj = first_object; obj; obj = obj->next )
   {
      if( vnum <= 0 && !nifty_is_name( argument, obj->name ) )
         continue;
      else if( vnum > 0 && obj->pIndexData->vnum != vnum )
         continue;

      pager_printf( ch, "(%3d) [%5d] %-28s ", ++icnt, obj->pIndexData->vnum, obj_short( obj ) );

      if( obj->in_room )
         pager_printf( ch, "&cIn room: &w[%5d] &c(&w%s&c)\r\n", obj->in_room->vnum,
            obj->in_room->name ? obj->in_room->name : "Not Set" );

      if( obj->carried_by )
         pager_printf( ch, "&cCarried by: &w[%5d] %s\r\n",
            is_npc( obj->carried_by ) ? obj->carried_by->pIndexData->vnum : 0, PERS( obj->carried_by, ch ) );

      if( obj->in_obj )
      {
         OBJ_DATA *tobj = NULL;

         pager_printf( ch, "&cIn object: &w[%5d] %s\r\n", obj->in_obj->pIndexData->vnum, obj_short( obj->in_obj ) );

         tobj = obj->in_obj;
         cnt = 1;
         while( tobj->in_obj )
         {
            for( x = 0; x < cnt; x++ )
               send_to_pager( "  ", ch );
            pager_printf( ch, "&cIn object: &w[%5d] %s\r\n", tobj->in_obj->pIndexData->vnum, obj_short( tobj->in_obj ) );
            tobj = tobj->in_obj;
            cnt++;
         }
         if( tobj )
         {
            for( x = 0; x < cnt; x++ )
                send_to_pager( "  ", ch );
            if( tobj->in_obj )
               pager_printf( ch, "&cIn object: &w[%5d] %s\r\n",
                  tobj->in_obj->pIndexData->vnum, obj_short( tobj->in_obj ) );
            if( tobj->in_room )
               pager_printf( ch, "&cIn room: &w[%5d] &c(&w%s&c)\r\n", tobj->in_room->vnum,
                  tobj->in_room->name ? tobj->in_room->name : "Not Set" );
            if( tobj->carried_by )
               pager_printf( ch, "&cCarried by: &w[%5d] %s\r\n",
                  is_npc( tobj->carried_by ) ? tobj->carried_by->pIndexData->vnum : 0, PERS( tobj->carried_by, ch ) );
         }
      }
   }

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

CMDF( do_reboot )
{
   char buf[MSL];
   CHAR_DATA *vch;

   set_char_color( AT_IMMORT, ch );

   if( str_cmp( argument, "mud now" ) && str_cmp( argument, "nosave" ) )
   {
      send_to_char( "Usage: reboot [mud now/nosave]\r\n", ch );
      return;
   }

   snprintf( buf, sizeof( buf ), "Reboot by %s.", ch->name );
   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;
}

CMDF( do_shutdown )
{
   char buf[MSL];
   CHAR_DATA *vch;

   set_char_color( AT_IMMORT, ch );

   if( str_cmp( argument, "mud now" ) && str_cmp( argument, "nosave" ) )
   {
      send_to_char( "Usage: shutdown [mud now/nosave]\r\n", ch );
      return;
   }

   snprintf( buf, sizeof( buf ), "Shutdown by %s.", ch->name );
   append_file( ch, SHUTDOWN_FILE, buf );
   mudstrlcat( buf, "\r\n", sizeof( buf ) );
   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;
}

CMDF( do_snoop )
{
   char arg[MIL];
   DESCRIPTOR_DATA *d;
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );

   one_argument( argument, arg );
   if( arg == NULL || arg[0] == '\0' )
   {
      send_to_char( "Snoop whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, arg ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( !victim->desc )
   {
      send_to_char( "No descriptor to snoop.\r\n", ch );
      return;
   }
   if( victim == ch )
   {
      send_to_char( "Cancelling all snoops.\r\n", 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.\r\n", 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.\r\n", ch );
      return;
   }

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

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

CMDF( do_statshield )
{
   char arg[MIL];
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );

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

CMDF( do_minvoke )
{
   char arg[MIL], arg3[MIL];
   MOB_INDEX_DATA *pMobIndex;
   CHAR_DATA *victim = NULL;
   int vnum, mcount = 1, x;

   set_char_color( AT_IMMORT, ch );

   argument = one_argument( argument, arg );
   argument = one_argument( argument, arg3 );
   if( arg == NULL || arg[0] == '\0' )
   {
      send_to_char( "Usage: minvoke <vnum>\r\n", ch );
      return;
   }

   if( !is_number( arg ) )
   {
      char arg2[MIL];
      int hash, cnt;
      int count = number_argument( arg, arg2 );

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

   if( arg3 != NULL && is_number( arg3 ) )
      mcount = URANGE( 1, atoi( arg3 ), 10000 );

   if( get_trust( ch ) < PERM_LEADER )
   {
      AREA_DATA *pArea;

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

   for( x = 0; x < mcount; x++ )
   {
      victim = create_mobile( pMobIndex );
      if( victim )
         char_to_room( victim, ch->in_room );
   }
   if( !victim )
      return;
   act( AT_IMMORT, "$n invokes $N!", ch, NULL, victim, TO_ROOM );
   ch_printf( ch, "&YYou invoke %s (&W#%d &Y- &W%s &Y- &Wlvl %d&Y)\r\n", pMobIndex->short_descr, pMobIndex->vnum, pMobIndex->name, victim->level );
}

CMDF( do_oinvoke )
{
   char arg1[MIL], arg2[MIL];
   OBJ_INDEX_DATA *pObjIndex;
   OBJ_DATA *obj;
   int vnum, level;

   set_char_color( AT_IMMORT, ch );

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

      vnum = -1;
      for( hash = cnt = 0; hash < MKH; 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.\r\n", ch );
         return;
      }
   }
   else
      vnum = atoi( arg1 );

   if( get_trust( ch ) < PERM_LEADER )
   {
      AREA_DATA *pArea;

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

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

      if( !( temp_area = get_area_obj( pObjIndex ) ) )
         level = ch->level;
      else
         level = URANGE( 0, pObjIndex->level, MAX_LEVEL );
   }

   if( !( obj = create_object( pObjIndex, level ) ) )
   {
      send_to_char( "Failed to create object.\r\n", ch );
      bug( "%s: Failed to create_object for %d.\r\n", __FUNCTION__, pObjIndex->vnum );
      return;
   }
   if( !can_wear( obj, ITEM_NO_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 );
   }
   ch_printf( ch, "&YYou invoke %s (&W#%d &Y- &W%s &Y- &Wlvl %d&Y)\r\n",
      pObjIndex->short_descr, pObjIndex->vnum, pObjIndex->name, obj->level );
}

CMDF( do_purge )
{
   char arg[MIL];
   CHAR_DATA *victim = NULL;
   OBJ_DATA *obj = NULL, *obj_next = NULL;

   set_char_color( AT_IMMORT, ch );

   one_argument( argument, arg );
   /* 'purge' the room */
   if( arg == NULL || arg[0] == '\0' )
   {
      CHAR_DATA *vnext = NULL;

      if( !ch->in_room )
      {
         bug( "%s: (%s) in NULL room.", __FUNCTION__, ch->name );
         return;
      }

      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 );
      }

      /* Storage check */
      if( xIS_SET( ch->in_room->room_flags, ROOM_STORAGEROOM ) )
         save_storage( ch->in_room );
         
      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 );
      return;
   }

   /*
    * 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 ) ) && !( obj = get_obj_here( ch, arg ) ) )
   {
      if( !( victim = get_char_world( ch, arg ) ) && !( obj = get_obj_world( ch, arg ) ) )
      {
         send_to_char( "They aren't here.\r\n", ch );
         return;
      }
   }

   /* Single object purge in room for high level purge - Scryn 8/12*/
   if( obj )
   {
      ROOM_INDEX_DATA *room;
      bool storage = false;

      separate_obj( obj );
      if( ( victim = obj->carried_by ) && victim != ch )
         act( AT_IMMORT, "$n purges $p.", ch, obj, victim, TO_VICT );
      else
         act( AT_IMMORT, "$n purges $p.", ch, obj, NULL, TO_ROOM );

      if( ( room = obj->in_room ) )
         storage = true;

      act( AT_IMMORT, "You make $p disappear in a puff of smoke!", ch, obj, NULL, TO_CHAR );
      extract_obj( obj );

      /* Storage check */
      if( room && storage && xIS_SET( room->room_flags, ROOM_STORAGEROOM ) )
         save_storage( room );

      return;
   }

   if( !is_npc( victim ) )
   {
      send_to_char( "You can't purge a PC.\r\n", ch );
      return;
   }

   if( victim == ch )
   {
      send_to_char( "You can't purge yourself!\r\n", 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 );
}

CMDF( do_low_purge )
{
   char arg[MIL];
   CHAR_DATA *victim = NULL;
   OBJ_DATA *obj = NULL;

   set_char_color( AT_IMMORT, ch );

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

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

   if( obj )
   {
      ROOM_INDEX_DATA *room;
      bool storage = false;

      separate_obj( obj );
      if( ( victim = obj->carried_by ) && victim != ch )
         act( AT_IMMORT, "$n purges $p.", ch, obj, victim, TO_VICT );
      else
         act( AT_IMMORT, "$n purges $p!", ch, obj, NULL, TO_ROOM );

      if( ( room = obj->in_room ) )
         storage = true;

      act( AT_IMMORT, "You make $p disappear in a puff of smoke!", ch, obj, NULL, TO_CHAR );
      extract_obj( obj );

      /* Storage check */
      if( room && storage && xIS_SET( room->room_flags, ROOM_STORAGEROOM ) )
         save_storage( room );

      return;
   }

   if( !is_npc( victim ) )
   {
      send_to_char( "You can't purge a PC.\r\n", ch );
      return;
   }

   if( victim == ch )
   {
      send_to_char( "You can't purge yourself!\r\n", 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 );
}

CMDF( do_advance )
{
   CHAR_DATA *victim;
   MCLASS_DATA *mclass;
   char arg1[MIL], arg2[MIL], arg3[MIL];
   int level, iLevel, sn;
   bool call = false;

   if( !is_immortal( ch ) )
   {
      send_to_char( "Huh?\r\n", ch );
      return;
   }

   set_char_color( AT_IMMORT, ch );
   argument = one_argument( argument, arg1 );
   argument = one_argument( argument, arg2 );
   argument = one_argument( argument, arg3 );

   if( arg1 == NULL || arg1[0] == '\0' || arg2 == NULL || arg2[0] == '\0' || arg3 == NULL || arg3[0] == '\0' || !is_number( arg3 ) )
   {
      send_to_char( "Usage: advance <character> <class>/all <level>\r\n", ch );
      return;
   }

   if( !( victim = get_char_room( ch, arg1 ) ) )
   {
      send_to_char( "That character is not in the room.\r\n", ch );
      return;
   }

   if( is_npc( victim ) )
   {
      send_to_char( "You can't advance a mobile.\r\n", ch );
      return;

   }

   if( ch != victim && get_trust( ch ) <= get_trust( victim ) )
   {
      send_to_char( "You can't do that.\r\n", ch );
      return;
   }

   if( ( level = atoi( arg3 ) ) < 1 || level > MAX_LEVEL )
   {
      ch_printf( ch, "Level range is 1 to %d.\r\n", MAX_LEVEL );
      return;
   }

   if( !str_cmp( arg2, "all" ) )
      call = true;

   for( mclass = victim->pcdata->first_mclass; mclass; mclass = mclass->next )
   {
      if( !call && str_cmp( dis_class_name( mclass->wclass ), arg2 ) )
         continue;
      if( level < mclass->level )
      {
         set_char_color( AT_IMMORT, victim );
         ch_printf( ch, "Demoting %s from level %d to level %d for class %s!\r\n", victim->name, mclass->level, level, dis_class_name( mclass->wclass ) );
         ch_printf( victim, "Cursed and forsaken! The gods have lowered your level for class %s...\r\n", dis_class_name( mclass->wclass ) );
         mclass->level = level;
         mclass->exp = 0;
         advance_level( victim );
         for( sn = 0; sn <= MAX_SKILL; sn++ )
         {
            iLevel = get_adept( victim, sn );
            if( victim->pcdata->learned[sn] > iLevel )
            {
               victim->pcdata->learned[sn] = iLevel;
               if( iLevel <= 0 )
                  victim->practice++;
            }
         }
      }
      else if( level == mclass->level )
      {
         ch_printf( ch, "They are already at level %d for class %s.\r\n", mclass->level, dis_class_name( mclass->wclass ) );
         if( !call )
            return;
      }
      else
      {
         set_char_color( AT_IMMORT, victim );
         ch_printf( ch, "Raising %s from level %d to level %d for class %s!\r\n", victim->name, mclass->level, level, dis_class_name( mclass->wclass ) );
         ch_printf( victim, "The gods feel fit to raise your level for class %s!\r\n", dis_class_name( mclass->wclass ) );

         for( ; mclass->level < level; )
         {
            ++mclass->level;
            mclass->exp = 0;
            advance_level( victim );
         }
      }
      if( !call )
         return;
   }
   if( !call )
      ch_printf( ch, "They don't have a %s class to change to level %d.\r\n", arg2, level );
}

/* May be used to increase or decrease someones permission level. */
CMDF( do_elevate )
{
   char arg[MIL];
   CHAR_DATA *victim;
   int oldtrust;

   set_char_color( AT_IMMORT, ch );
   argument = one_argument( argument, arg );
   if( arg == NULL || arg[0] == '\0' )
   {
      send_to_char( "Usage: elevate <char> [imm/builder/leader/head/imp]\r\n", ch );
      return;
   }

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

   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   if( victim == ch )
   {
      send_to_char( "You can't elevate yourself.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You can't do anything with someone higher or the same trust as you.\r\n", ch );
      return;
   }
   if( get_trust( victim ) < PERM_IMM )
   {
      ch_printf( ch, "%s isn't an immortal yet.\r\n", victim->name );
      return;
   }

   argument = one_argument( argument, arg );
   oldtrust = get_trust( victim );
   if( arg == NULL || arg[0] == '\0' )
   {
      if( ( victim->trust + 1 ) >= PERM_MAX )
      {
         send_to_char( "You can't advance them any higher.\r\n", ch );
         return;
      }
      victim->trust++;
   }
   else
   {
      int temp;

      temp = get_flag( arg, perms_flag, PERM_MAX );
      if( temp <= PERM_ALL || temp == get_trust( victim ) || temp > get_trust( ch ) || temp >= PERM_MAX )
      {
         send_to_char( "Invalid permission.\r\n", ch );
         return;
      }
      victim->trust = temp;
   }
   /* Decreased their permission level */
   if( oldtrust > get_trust( victim ) )
      ch_printf( ch, "Dropping %s from %s to %s.\r\n", victim->name, perms_flag[oldtrust], perms_flag[victim->trust] );
   else
      ch_printf( ch, "Elevating %s from %s to %s.\r\n", victim->name, perms_flag[oldtrust], perms_flag[victim->trust] );
   act( AT_IMMORT, "$n begins to chant softly... then makes some arcane gestures...", ch, NULL, NULL, TO_ROOM );
   set_char_color( AT_IMMORT, victim );
   ch_printf( victim, "%s made you %s.\r\n", ch->name, perms_flag[victim->trust] );
   save_char_obj( victim );
   make_wizlist( );
}

CMDF( do_immortalize )
{
   CHAR_DATA *victim;
   MCLASS_DATA *mclass;
   char arg[MIL];
   int iLevel;

   set_char_color( AT_IMMORT, ch );

   argument = one_argument( argument, arg );
   if( arg == NULL || arg[0] == '\0' )
   {
      send_to_char( "Usage:  immortalize <char>\r\n", ch );
      return;
   }

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

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

   if( get_trust( victim ) >= PERM_IMM )
   {
      ch_printf( ch, "Don't be silly, %s is already immortal.\r\n", victim->name );
      return;
   }

   send_to_char( "Immortalizing a player...\r\n", ch );
   set_char_color( AT_IMMORT, victim );
   act( AT_IMMORT, "$n begins to chant softly... then raises $s arms to the sky...", ch, NULL, NULL, TO_ROOM );
   set_char_color( AT_WHITE, victim );
   send_to_char( "You suddenly feel very strange...\r\n\r\n", victim );
   set_char_color( AT_WHITE, victim );

   for( ; victim->level < MAX_LEVEL; )
   {
      for( mclass = victim->pcdata->first_mclass; mclass; mclass = mclass->next )
      {
         ++mclass->level;
         mclass->exp = 0;
      }
      advance_level( victim );
   }

   for( iLevel = 0; iLevel < top_sn; iLevel++ )
      victim->pcdata->learned[iLevel] = 100;
   send_to_char( "You know all available spells/skills/tongues/weapons now.\r\n", victim );
   send_to_char( "All available spells/skills/tongues/weapons have been set on them.\r\n", ch );

   for( iLevel = 0; iLevel < STAT_MAX; iLevel++ )
      victim->perm_stats[iLevel] = ( MAX_LEVEL + 25 );
   send_to_char( "You now have the max stats an immortal can have.\r\n", victim );
   send_to_char( "Their stats have been set to the max an immortal can have.\r\n", ch );

   victim->max_hit = 30000;
   victim->hit = victim->max_hit;
   victim->max_move = 30000;
   victim->move = victim->max_move;
   victim->max_mana = 30000;
   victim->mana = victim->max_mana;

   victim->trust = PERM_IMM;
   save_char_obj( victim );
   make_wizlist( );
}

CMDF( do_strip )
{
   CHAR_DATA *victim;
   OBJ_DATA *obj_next, *obj_lose;
   int count = 0;

   set_char_color( AT_OBJECT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Strip who?\r\n", ch );
      return;
   }
   if( !( victim = get_char_room( ch, argument ) ) )
   {
      send_to_char( "They're not here.\r\n", ch );
      return;
   }
   if( victim == ch )
   {
      send_to_char( "Kinky.\r\n", ch );
      return;
   }
   if( !is_npc( victim ) && get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You haven't the power to succeed against them.\r\n", ch );
      return;
   }
   act( AT_OBJECT, "Searching $N ...", ch, NULL, victim, TO_CHAR );
   for( obj_lose = victim->first_carrying; obj_lose; obj_lose = obj_next )
   {
      obj_next = obj_lose->next_content;
      obj_from_char( obj_lose );
      obj_to_char( obj_lose, ch );
      pager_printf( ch, "  &G... %s (&g%s) &Gtaken.\r\n", capitalize( obj_lose->short_descr ), obj_lose->name );
      count++;
   }
   if( !count )
      send_to_pager( "&GNothing found to take.\r\n", ch );
}

CMDF( do_restore )
{
   CHAR_DATA *vch, *vch_next;
   char arg[MIL];
   bool boost = false;

   set_char_color( AT_IMMORT, ch );

   argument = one_argument( argument, arg );
   if( arg == NULL || arg[0] == '\0' )
   {
      send_to_char( "Restore whom?\r\n", ch );
      return;
   }
   if( argument && !str_cmp( argument, "boost" ) && get_trust( ch ) >= PERM_HEAD )
   {
      send_to_char( "Boosting!\r\n", ch );
      boost = true;
   }
   if( !str_cmp( arg, "all" ) )
   {
      if( !ch->pcdata )
         return;

      if( get_trust( ch ) < PERM_HEAD )
      {
         if( is_npc( ch ) )
         {
            send_to_char( "You can't do that.\r\n", ch );
            return;
         }
         else
         {
            if( current_time - last_restore_all_time < RESTORE_INTERVAL )
            {
               send_to_char( "Sorry, you can't do a restore all yet.\r\n", ch );
               do_restoretime( ch, (char *)"" );
               return;
            }
         }
      }
      last_restore_all_time = current_time;
      ch->pcdata->restore_time = current_time;
      save_char_obj( ch );
      send_to_char( "Beginning 'restore all' ...\r\n", ch );
      for( vch = first_char; vch; vch = vch_next )
      {
         vch_next = vch->next;

         if( !is_npc( vch ) && !is_immortal( vch ) && !can_pkill( vch ) && !in_arena( vch ) )
         {
            if( boost )
            {
               vch->hit = UMAX( vch->max_hit, ( int )( vch->max_hit * 1.5 ) );
               vch->mana = UMAX( vch->max_mana, ( int )( vch->max_mana * 1.5 ) );
               vch->move = UMAX( vch->max_move, ( int )( vch->max_move * 1.5 ) );
            }
            else
            {
               vch->hit = vch->max_hit;
               vch->mana = vch->max_mana;
               vch->move = vch->max_move;
            }
            update_pos( vch );
            act( AT_IMMORT, "$n has restored you.", ch, NULL, vch, TO_VICT );
         }
      }
      send_to_char( "Restored.\r\n", ch );
      return;
   }

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

   if( get_trust( ch ) < PERM_LEADER && vch != ch && !( is_npc( vch ) && xIS_SET( vch->act, ACT_PROTOTYPE ) ) )
   {
      send_to_char( "You can't do that.\r\n", ch );
      return;
   }

   if( boost )
   {
      vch->hit = UMAX( vch->max_hit, ( int )( vch->max_hit * 1.5 ) );
      vch->mana = UMAX( vch->max_mana, ( int )( vch->max_mana * 1.5 ) );
      vch->move = UMAX( vch->max_move, ( int )( vch->max_move * 1.5 ) );
   }
   else
   {
      vch->hit = vch->max_hit;
      vch->mana = vch->max_mana;
      vch->move = vch->max_move;
   }
   update_pos( vch );
   if( ch != vch )
     act( AT_IMMORT, "$n has restored you.", ch, NULL, vch, TO_VICT );
   send_to_char( "Restored.\r\n", ch );
}

void do_restoretime( CHAR_DATA *ch, char *argument )
{
   long int time_passed;
   int hours = 0, minutes = 0, days = 0;

   set_char_color( AT_IMMORT, ch );

   if( !last_restore_all_time )
      send_to_char( "There has been no restore all since reboot.\r\n", ch );
   else
   {
      time_passed = current_time - last_restore_all_time;
      days = ( int )( time_passed / 43200 );
      time_passed -= ( days * 43200 );
      hours = ( int )( time_passed / 3600 );
      time_passed -= ( hours * 3600 );
      minutes = ( int )( time_passed / 60 );
      time_passed -= ( minutes * 60 );
      send_to_char( "The last restore all was ", ch );
      if( days )
         ch_printf( ch, "%d day%s ", days, days > 1 ? "s" : "" );
      if( hours )
         ch_printf( ch, "%d hour%s ", hours, hours > 1 ? "s" : "" );
      if( minutes )
         ch_printf( ch, "%d minute%s ", minutes, minutes > 1 ? "s" : "" );
      if( time_passed )
         ch_printf( ch, "%ld second%s ", time_passed, time_passed > 1 ? "s" : "" );
      send_to_char( "ago.\r\n", ch );
   }

   if( !ch->pcdata )
      return;

   if( !ch->pcdata->restore_time )
   {
      send_to_char( "You have never done a restore all.\r\n", ch );
      return;
   }

   time_passed = current_time - ch->pcdata->restore_time;
   days = ( int )( time_passed / 43200 );
   time_passed -= ( days * 43200 );
   hours = ( int )( time_passed / 3600 );
   time_passed -= ( hours * 3600 );
   minutes = ( int )( time_passed / 60 );
   time_passed -= ( minutes * 60 );
   send_to_char( "Your last restore all was ", ch );
   if( days )
      ch_printf( ch, "%d day%s ", days, days > 1 ? "s" : "" );
   if( hours )
      ch_printf( ch, "%d hour%s ", hours, hours > 1 ? "s" : "" );
   if( minutes )
      ch_printf( ch, "%d minute%s ", minutes, minutes > 1 ? "s" : "" );
   if( time_passed )
      ch_printf( ch, "%ld second%s ", time_passed, time_passed > 1 ? "s" : "" );
   send_to_char( "ago.\r\n", ch );
}

CMDF( do_freeze )
{
   CHAR_DATA *victim;

   set_char_color( AT_LBLUE, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Freeze whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   set_char_color( AT_LBLUE, victim );
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You failed, and they saw...\r\n", ch );
      ch_printf( victim, "%s is attempting to freeze you.\r\n", ch->name );
      return;
   }
   xTOGGLE_BIT( victim->act, PLR_FREEZE );
   if( !xIS_SET( victim->act, PLR_FREEZE ) )
   {
      send_to_char( "Your frozen form suddenly thaws.\r\n", victim );
      ch_printf( ch, "%s is now unfrozen.\r\n", victim->name );
   }
   else
   {
      send_to_char( "A godly force turns your body to ice!\r\n", victim );
      ch_printf( ch, "You have frozen %s.\r\n", victim->name );
   }
   save_char_obj( victim );
}

CMDF( do_log )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Log whom?\r\n", ch );
      return;
   }

   if( !str_cmp( argument, "all" ) )
   {
      fLogAll = !fLogAll;
      if( !fLogAll )
         send_to_char( "Log ALL off.\r\n", ch );
      else
         send_to_char( "Log ALL on.\r\n", ch );
      return;
   }

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

   if( victim == ch )
   {
      send_to_char( "You can't log/unlog yourself.\r\n", ch );
      return;
   }

   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You don't have the power to log them.\r\n", ch );
      return;
   }

   victim->logged = !victim->logged;
   if( !victim->logged )
      ch_printf( ch, "LOG removed from %s.\r\n", victim->name );
   else
      ch_printf( ch, "LOG applied to %s.\r\n", victim->name );
   save_char_obj( victim );
}

CMDF( do_noemote )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Noemote whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You failed.\r\n", ch );
      return;
   }
   set_char_color( AT_IMMORT, victim );
   xTOGGLE_BIT( victim->act, PLR_NO_EMOTE );
   if( !xIS_SET( victim->act, PLR_NO_EMOTE ) )
   {
      send_to_char( "You can emote again.\r\n", victim );
      ch_printf( ch, "NOEMOTE removed from %s.\r\n", victim->name );
   }
   else
   {
      send_to_char( "You can't emote!\r\n", victim );
      ch_printf( ch, "NOEMOTE applied to %s.\r\n", victim->name );
   }
}

CMDF( do_notell )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Notell whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You failed.\r\n", ch );
      return;
   }
   set_char_color( AT_IMMORT, victim );
   xTOGGLE_BIT( victim->act, PLR_NO_TELL );
   if( !xIS_SET( victim->act, PLR_NO_TELL ) )
   {
      send_to_char( "You can use tells again.\r\n", victim );
      ch_printf( ch, "NOTELL removed from %s.\r\n", victim->name );
   }
   else
   {
      send_to_char( "You can't use tells!\r\n", victim );
      ch_printf( ch, "NOTELL applied to %s.\r\n", victim->name );
   }
}

CMDF( do_notitle )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Notitle whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You failed.\r\n", ch );
      return;
   }
   set_char_color( AT_IMMORT, victim );
   xTOGGLE_BIT( victim->pcdata->flags, PCFLAG_NOTITLE );
   if( !xIS_SET( victim->pcdata->flags, PCFLAG_NOTITLE ) )
   {
      send_to_char( "You can set your own title again.\r\n", victim );
      ch_printf( ch, "NOTITLE removed from %s.\r\n", victim->name );
   }
   else
   {
      set_title( victim, (char *)"can't set their title now." );
      send_to_char( "You can't set your own title!\r\n", victim );
      ch_printf( ch, "NOTITLE set on %s.\r\n", victim->name );
   }
}

CMDF( do_silence )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Silence whom?", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You failed.\r\n", ch );
      return;
   }
   set_char_color( AT_IMMORT, victim );
   if( xIS_SET( victim->act, PLR_SILENCE ) )
      send_to_char( "Player already silenced, use unsilence to remove.\r\n", ch );
   else
   {
      xSET_BIT( victim->act, PLR_SILENCE );
      send_to_char( "You can't use channels!\r\n", victim );
      ch_printf( ch, "You SILENCE %s.\r\n", victim->name );
   }
}

/* Much better than toggling this with do_silence, yech --Blodkai */
CMDF( do_unsilence )
{
   CHAR_DATA *victim;

   set_char_color( AT_IMMORT, ch );
   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Unsilence whom?\r\n", ch );
      return;
   }
   if( !( victim = get_char_world( ch, argument ) ) )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }
   if( is_npc( victim ) )
   {
      send_to_char( "Not on NPC's.\r\n", ch );
      return;
   }
   if( get_trust( victim ) >= get_trust( ch ) )
   {
      send_to_char( "You failed.\r\n", ch );
      return;
   }
   set_char_color( AT_IMMORT, victim );
   if( xIS_SET( victim->act, PLR_SILENCE ) )
   {
      xREMOVE_BIT( victim->act, PLR_SILENCE );
      send_to_char( "You can use channels again.\r\n", victim );
      ch_printf( ch, "SILENCE removed from %s.\r\n", victim->name );
   }
   else
      send_to_char( "That player is not silenced.\r\n", ch );
}

CMDF( do_peace )
{
   CHAR_DATA *rch;

   act( AT_IMMORT, "$n booms, 'PEACE!'", ch, NULL, NULL, TO_ROOM );
   act( AT_IMMORT, "You boom, 'PEACE!'",

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

Site Stats

Snippets: 1791
Codebases: 571