act_wiz.c
dotd-2.3.7/src/act_wiz.c · 248.4 KB
From the archive dotd-2.3.7.tar.bz2
Download the archive « Back to the archive contents
/****************************************************************************
* [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame | \\._.// *
* -----------------------------------------------------------| (0...0) *
* SMAUG 1.0 (C) 1994, 1995, 1996 by Derek Snider | ).:.( *
* -----------------------------------------------------------| {o o} *
* SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus, | / ' ' \ *
* Scryn, Rennard, Swordbearer, Gorog, Grishnakh and Tricops |~'~.VxvxV.~'~*
* ------------------------------------------------------------------------ *
* Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* ------------------------------------------------------------------------ *
* Wizard/god command module *
****************************************************************************/
/*static char rcsid[] = "$Id: act_wiz.c,v 1.166 2004/04/06 22:00:08 dotd Exp $";*/
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "mud.h"
#include "gsn.h"
#include "mxp.h"
#include "currency.h"
#include "christen.h"
#include "rareobj.h"
#ifdef IRC
#include "irc.h"
#endif
#define RESTORE_INTERVAL 21600
char * const save_flag[] =
{ "death", "kill", "passwd", "drop", "put", "give", "auto", "zap",
"auction", "get", "receive", "idle", "backup", "r13", "r14", "r15", "r16",
"r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27",
"r28", "r29", "r30", "r31" };
/*
* Local functions.
*/
void save_banlist args( ( void ) );
int get_color (char *argument); /* function proto */
/*
* Global variables.
*/
char reboot_time[50];
time_t new_boot_time_t;
extern struct tm new_boot_struct;
extern ROOM_INDEX_DATA *room_index_hash[MAX_KEY_HASH];
extern OBJ_INDEX_DATA *obj_index_hash[MAX_KEY_HASH];
extern MOB_INDEX_DATA *mob_index_hash[MAX_KEY_HASH];
extern bool mud_down;
extern bool wizlock;
extern int top_room_vnum;
extern int top_obj_vnum;
ALIAS_DATA *find_alias args( ( CHAR_DATA *ch, char *argument ) );
int get_npc_race args( ( char *type ) );
DECLARE_DO_FUN(do_help);
DECLARE_DO_FUN(do_cedit);
DECLARE_DO_FUN(do_quit);
DECLARE_DO_FUN(do_look);
DECLARE_DO_FUN(do_goto);
DECLARE_DO_FUN(do_auction);
DECLARE_DO_FUN(do_restore);
DECLARE_DO_FUN(do_save);
DECLARE_DO_FUN(do_makewizlist);
DECLARE_DO_FUN(do_sit);
DECLARE_DO_FUN(do_say);
DECLARE_DO_FUN(do_recall);
DECLARE_DO_FUN(do_restoretime);
DECLARE_DO_FUN(do_rent);
int get_saveflag( char *name )
{
unsigned int x;
for ( x = 0; x < sizeof(save_flag) / sizeof(save_flag[0]); x++ )
if ( !str_cmp( name, save_flag[x] ) )
return x;
return -1;
}
void do_wizhelp( CHAR_DATA *ch, char *argument )
{
CMDTYPE * cmd;
int col, c, loopcolor, hash, lev=0, color;
bool only = FALSE;
if (!(lev = atoi(argument)))
{
if (*argument=='=' && (lev = atoi(argument+1)))
only = TRUE;
else
lev = get_trust(ch);
}
else
lev = UMIN(get_trust(ch), lev);
col = 0;
set_pager_color( AT_PLAIN, ch );
for ( c = 0; c < 12; c++ )
{
switch (c)
{
case 0: loopcolor = AT_DANGER; break;
case 1: loopcolor = AT_WHITE; break;
case 2: loopcolor = AT_YELLOW; break;
case 3: loopcolor = AT_DGREEN; break;
case 4: loopcolor = AT_PURPLE; break;
case 5: loopcolor = AT_PINK; break;
case 6: loopcolor = AT_CYAN; break;
case 7: loopcolor = AT_GREEN; break;
case 8: loopcolor = AT_LBLUE; break;
case 9: loopcolor = AT_BLUE; break;
case 10: loopcolor = AT_ORANGE; break;
default: loopcolor = AT_PLAIN; break;
}
for ( hash = 0; hash < 126; hash++ )
for ( cmd = command_hash[hash]; cmd; cmd = cmd->next )
{
if ( !only && ( cmd->level < LEVEL_HERO ||
cmd->level > lev ) )
continue;
if ( only && cmd->level != lev )
continue;
if (IS_SET(cmd->flags, CMD_EXPERIMENTAL))
color = AT_DANGER;
else if (IS_SET(cmd->flags, CMD_SYSTEM))
color = AT_WHITE;
else if (IS_SET(cmd->flags, CMD_COMMUNICATION))
color = AT_YELLOW;
else if (IS_SET(cmd->flags, CMD_UTILITY))
color = AT_DGREEN;
else if (IS_SET(cmd->flags, CMD_CREATION))
color = AT_PURPLE;
else if (IS_SET(cmd->flags, CMD_DELETION))
color = AT_PINK;
else if (IS_SET(cmd->flags, CMD_MODIFICATION))
color = AT_CYAN;
else if (IS_SET(cmd->flags, CMD_MAINTENANCE))
color = AT_GREEN;
else if (IS_SET(cmd->flags, CMD_BUILDING))
color = AT_LBLUE;
else if (IS_SET(cmd->flags, CMD_INFORMATIONAL))
color = AT_BLUE;
else if (IS_SET(cmd->flags, CMD_IMC))
color = AT_ORANGE;
else
color = AT_PLAIN;
if (color != loopcolor)
continue;
pager_printf( ch, "%s%-13s%s",
color_str(color, ch),
cmd->name,
color_str(AT_PLAIN, ch) );
if ( ++col % 6 == 0 )
send_to_pager( "\n\r", ch );
}
}
if ( col % 6 != 0 )
send_to_pager( "\n\r", ch );
return;
}
void do_restrict( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
sh_int level, hash;
CMDTYPE *cmd;
bool found;
found = FALSE;
argument = one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Restrict which command?\n\r", ch );
return;
}
argument = one_argument ( argument, arg2 );
if ( arg2[0] == '\0' )
level = get_trust( ch );
else
level = atoi( arg2 );
level = UMAX( UMIN( get_trust( ch ), level ), 0 );
hash = arg[0] % 126;
for ( cmd = command_hash[hash]; cmd; cmd = cmd->next )
{
if ( !str_prefix( arg, cmd->name )
&& cmd->level <= get_trust( ch ) )
{
found = TRUE;
break;
}
}
if ( found )
{
if ( !str_prefix( arg2, "show" ) )
{
sprintf(buf, "%s show", cmd->name);
do_cedit(ch, buf);
/* ch_printf( ch, "%s is at level %d.\n\r", cmd->name, cmd->level );*/
return;
}
cmd->level = level;
ch_printf( ch, "You restrict %s to level %d\n\r",
cmd->name, level );
sprintf( log_buf, "%s restricting %s to level %d",
ch->name, cmd->name, level );
log_string_plus( log_buf, LOG_MONITOR, LEVEL_LOG_CSET, SEV_NOTICE );
}
else
send_to_char( "You may not restrict that command.\n\r", ch );
return;
}
/*
* Check if the name prefix uniquely identifies a char descriptor
*/
CHAR_DATA *get_waiting_desc( CHAR_DATA *ch, char *name )
{
DESCRIPTOR_DATA *d;
CHAR_DATA *ret_char=NULL;
static unsigned int number_of_hits;
number_of_hits = 0;
for ( d = first_descriptor; d; d = d->next )
{
if ( d->character && (!str_prefix( name, d->character->name )) &&
IS_WAITING_FOR_AUTH(d->character) )
{
if ( ++number_of_hits > 1 )
{
ch_printf( ch, "%s does not uniquely identify a char.\n\r", name );
return NULL;
}
ret_char = d->character; /* return current char on exit */
}
}
if ( number_of_hits==1 )
return ret_char;
else
{
send_to_char( "No one like that waiting for authorization.\n\r", ch );
return NULL;
}
}
void do_authorize( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
DESCRIPTOR_DATA *d;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' )
{
send_to_char( "Usage: authorize <player> <yes|name|no/deny>\n\r", ch );
send_to_char( "Pending authorizations:\n\r", ch );
send_to_char( " Chosen Character Name\n\r", ch );
send_to_char( "---------------------------------------------\n\r", ch );
for ( d = first_descriptor; d; d = d->next )
if ( (victim = d->character) != NULL && IS_WAITING_FOR_AUTH(victim) )
ch_printf( ch, " %s@%s new %s %s...\n\r",
victim->name,
victim->desc->host,
race_table[victim->race].race_name,
GetClassString(victim) );
return;
}
victim = get_waiting_desc( ch, arg1 );
if ( victim == NULL )
return;
if ( arg2[0]=='\0' || !str_cmp( arg2,"accept" ) || !str_cmp( arg2,"yes" ))
{
victim->pcdata->auth_state = 3;
if ( victim->pcdata->authed_by )
STRFREE( victim->pcdata->authed_by );
victim->pcdata->authed_by = QUICKLINK( ch->name );
sprintf( log_buf, "%s authorized %s", ch->name,
victim->name );
log_string_plus(log_buf,LOG_MONITOR,LEVEL_IMMORTAL,SEV_NOTICE);
ch_printf( ch, "You have authorized %s.\n\r", victim->name);
/* Below sends a message to player when name is accepted - Brittany */
ch_printf( victim, /* B */
"The MUD Administrators have accepted the name %s.\n\r" /* B */
"You will be authorized to enter the realm at the end of " /* B */
"this area.\n\r",victim->name); /* B */
return;
}
else if ( !str_cmp( arg2, "no" ) || !str_cmp( arg2, "deny" ) )
{
send_to_char( "You have been denied access.\n\r", victim);
sprintf( log_buf, "%s denied authorization to %s", ch->name,
victim->name );
log_string_plus(log_buf,LOG_MONITOR,LEVEL_IMMORTAL,SEV_NOTICE);
ch_printf( ch, "You have denied %s.\n\r", victim->name);
do_quit(victim, "yes");
}
else if ( !str_cmp( arg2, "name" ) || !str_cmp(arg2, "n" ) )
{
victim->pcdata->auth_state = 2;
sprintf( log_buf, "%s has denied %s's name", ch->name,
victim->name );
log_string_plus(log_buf,LOG_MONITOR,LEVEL_IMMORTAL,SEV_NOTICE);
ch_printf (victim,
"The MUD Administrators have found the name %s "
"to be unacceptable.\n\r"
"You may choose a new name when you reach " /* B */
"the end of this area.\n\r" /* B */
"The name you choose must be medieval and original.\n\r"
"No titles, descriptive words, or names close to any existing "
"Immortal's name.\n\r", victim->name);
ch_printf( ch, "You requested %s change names.\n\r", victim->name);
return;
}
else
{
send_to_char("Invalid argument.\n\r", ch);
return;
}
}
void do_bamfin( CHAR_DATA *ch, char *argument )
{
if ( !IS_NPC(ch) )
{
smash_tilde( argument );
STRFREE( ch->pcdata->bamfin );
ch->pcdata->bamfin = STRALLOC( argument );
send_to_char( "Ok.\n\r", ch );
}
return;
}
void do_bamfout( CHAR_DATA *ch, char *argument )
{
if ( !IS_NPC(ch) )
{
smash_tilde( argument );
STRFREE( ch->pcdata->bamfout );
ch->pcdata->bamfout = STRALLOC( argument );
send_to_char( "Ok.\n\r", ch );
}
return;
}
void do_rank( CHAR_DATA *ch, char *argument )
{
if ( IS_NPC(ch) )
return;
if ( !argument || argument[0] == '\0' )
{
send_to_char( "Usage: rank <string>.\n\r", ch );
send_to_char( " or: rank none.\n\r", ch );
return;
}
smash_tilde( argument );
DISPOSE( ch->pcdata->rank );
if ( !str_cmp( argument, "none" ) )
ch->pcdata->rank = str_dup( "" );
else
ch->pcdata->rank = str_dup( argument );
send_to_char( "Ok.\n\r", ch );
return;
}
void do_retire( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Retire whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "Not on NPC's.\n\r", ch );
return;
}
if ( get_trust( victim ) >= get_trust( ch ) )
{
send_to_char( "You failed.\n\r", ch );
return;
}
if ( GetMaxLevel(victim) < LEVEL_SAVIOR )
{
send_to_char( "The minimum level for retirement is savior.\n\r", ch );
return;
}
if ( IS_RETIRED( victim ) )
{
REMOVE_BIT( victim->pcdata->flags, PCFLAG_RETIRED );
ch_printf( ch, "%s returns from retirement.\n\r", victim->name );
ch_printf( victim, "%s brings you back from retirement.\n\r", ch->name );
}
else
{
SET_BIT( victim->pcdata->flags, PCFLAG_RETIRED );
ch_printf( ch, "%s is now a retired immortal.\n\r", victim->name );
ch_printf( victim, "Courtesy of %s, you are now a retired immortal.\n\r", ch->name );
}
return;
}
void do_deny( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Deny whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "Not on NPC's.\n\r", ch );
return;
}
if ( get_trust( victim ) >= get_trust( ch ) )
{
send_to_char( "You failed.\n\r", ch );
return;
}
SET_BIT(victim->act, PLR_DENY);
send_to_char( "You are denied access!\n\r", victim );
send_to_char( "OK.\n\r", ch );
do_quit( victim, "yes" );
return;
}
void do_disconnect( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Disconnect whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( victim->desc == NULL )
{
act( AT_PLAIN, "$N doesn't have a descriptor.", ch, NULL, victim, TO_CHAR );
return;
}
if ( get_trust(ch) <= get_trust( victim ) )
{
send_to_char( "They might not like that...\n\r", ch );
return;
}
close_socket( victim->desc, FALSE );
send_to_char( "Ok.\n\r", ch );
return;
}
/*
* Force a level one player to quit. Gorog
*/
void do_fquit( CHAR_DATA *ch, char *argument )
{
CHAR_DATA *victim;
char arg1[MAX_INPUT_LENGTH];
argument = one_argument( argument, arg1 );
if ( arg1[0] == '\0' )
{
send_to_char( "Force whom to quit?\n\r", ch );
return;
}
if ( !( victim = get_char_world( ch, arg1 ) ) )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( GetMaxLevel(victim) != 1 )
{
send_to_char( "They are not level one!\n\r", ch );
return;
}
send_to_char( "The MUD administrators force you to quit\n\r", victim );
do_quit (victim, "yes");
send_to_char( "Ok.\n\r", ch );
return;
}
void do_forceclose( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
DESCRIPTOR_DATA *d;
#ifndef MUD_LISTENER
int descriptor;
#else
int uid;
#endif
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
#ifndef MUD_LISTENER
send_to_char( "Usage: forceclose <descriptor#>\n\r", ch );
#else
send_to_char( "Usage: forceclose <uid>\n\r", ch );
#endif
return;
}
#ifndef MUD_LISTENER
descriptor = atoi( arg );
#else
uid = atoi( arg );
#endif
for ( d = first_descriptor; d; d = d->next )
{
#ifndef MUD_LISTENER
if ( d->descriptor == descriptor )
#else
if ( d->uid == uid )
#endif
{
if ( d->character && get_trust(d->character) >= get_trust(ch) )
{
send_to_char( "They might not like that...\n\r", ch );
return;
}
close_socket( d, FALSE );
send_to_char( "Ok.\n\r", ch );
return;
}
}
send_to_char( "Not found!\n\r", ch );
return;
}
void do_pardon( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' || arg2[0] == '\0' )
{
send_to_char( "Syntax: pardon <character> <killer|thief|attacker>.\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "Not on NPC's.\n\r", ch );
return;
}
if ( !str_cmp( arg2, "attacker" ) )
{
if ( IS_SET(victim->act, PLR_ATTACKER) )
{
REMOVE_BIT( victim->act, PLR_ATTACKER );
send_to_char( "Attacker flag removed.\n\r", ch );
send_to_char( "You are no longer an ATTACKER.\n\r", victim );
}
return;
}
if ( !str_cmp( arg2, "killer" ) )
{
if ( IS_SET(victim->act, PLR_KILLER) )
{
REMOVE_BIT( victim->act, PLR_KILLER );
send_to_char( "Killer flag removed.\n\r", ch );
send_to_char( "You are no longer a KILLER.\n\r", victim );
}
return;
}
if ( !str_cmp( arg2, "thief" ) )
{
if ( IS_SET(victim->act, PLR_THIEF) )
{
REMOVE_BIT( victim->act, PLR_THIEF );
send_to_char( "Thief flag removed.\n\r", ch );
send_to_char( "You are no longer a THIEF.\n\r", victim );
}
return;
}
send_to_char( "Syntax: pardon <character> <killer|thief>.\n\r", ch );
return;
}
void echo_to_all( sh_int AT_COLOR, char *argument, sh_int tar )
{
CHAR_DATA *vch;
if ( !argument || argument[0] == '\0' )
return;
for (vch = first_char; vch; vch = vch->next)
{
if (GET_CON_STATE(vch) != CON_PLAYING &&
GET_CON_STATE(vch) != CON_EDITING)
continue;
/* This one is kinda useless except for switched.. */
if ( tar == ECHOTAR_PC && IS_NPC(vch) )
continue;
if ( tar == ECHOTAR_IMM && !IS_IMMORTAL(vch) )
continue;
if ( tar == ECHOTAR_OUTSIDE && !IS_OUTSIDE(vch) )
continue;
if (MXP_ON(vch))
send_to_char(MXP_TAG_SECURE, vch);
set_char_color( AT_COLOR, vch );
ch_printf(vch, "%s\n\r", argument);
}
}
void do_echo( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
sh_int color;
int target;
char *parg;
if ( IS_SET(ch->act, PLR_NO_EMOTE) )
{
send_to_char( "You are noemoted and can not echo.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char( "Echo what?\n\r", ch );
return;
}
if ( (color = get_color(argument)) )
argument = one_argument(argument, arg);
parg = argument;
argument = one_argument(argument, arg);
if ( !str_cmp( arg, "PC" )
|| !str_cmp( arg, "player" ) )
target = ECHOTAR_PC;
else if ( !str_cmp( arg, "imm" ) )
target = ECHOTAR_IMM;
else
{
target = ECHOTAR_ALL;
argument = parg;
}
if ( !color && (color = get_color(argument)) )
argument = one_argument(argument, arg);
if ( !color )
color = AT_IMMORT;
one_argument(argument, arg);
if ( !str_cmp( arg, "Thoric" )
|| !str_cmp( arg, "Dominus" )
|| !str_cmp( arg, "Circe" )
|| !str_cmp( arg, "Haus" )
|| !str_cmp( arg, "Narn" )
|| !str_cmp( arg, "Scryn" )
|| !str_cmp( arg, "Damian" )
|| !str_cmp( arg, "Blodkai" ))
{
ch_printf( ch, "I don't think %s would like that!\n\r", arg );
return;
}
echo_to_all ( color, argument, target );
}
void echo_to_room( sh_int AT_COLOR, ROOM_INDEX_DATA *room, char *argument )
{
CHAR_DATA *vic;
for ( vic = room->first_person; vic; vic = vic->next_in_room )
{
if (MXP_ON(vic))
send_to_char(MXP_TAG_SECURE, vic);
set_char_color( AT_COLOR, vic );
send_to_char( argument, vic );
send_to_char( "\n\r", vic );
}
}
void do_recho( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
sh_int color;
if ( IS_SET(ch->act, PLR_NO_EMOTE) )
{
send_to_char( "You are noemoted and can not recho.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char( "Recho what?\n\r", ch );
return;
}
one_argument( argument, arg );
if ( !str_cmp( arg, "Thoric" )
|| !str_cmp( arg, "Dominus" )
|| !str_cmp( arg, "Circe" )
|| !str_cmp( arg, "Haus" )
|| !str_cmp( arg, "Narn" )
|| !str_cmp( arg, "Scryn" )
|| !str_cmp( arg, "Blodkai" )
|| !str_cmp( arg, "Damian" ) )
{
ch_printf( ch, "I don't think %s would like that!\n\r", arg );
return;
}
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 ( ( victim = get_char_world( ch, arg ) ) != NULL )
return victim->in_room;
if ( ( obj = get_obj_world( ch, arg ) ) != NULL )
return obj->in_room;
if (!str_cmp(arg, "home") && !IS_NPC(ch))
return get_room_index(ch->pcdata->home);
return NULL;
}
void do_transfer( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *location;
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' )
{
send_to_char( "Transfer whom (and where)?\n\r", ch );
return;
}
if ( !str_cmp( arg1, "all" ) )
{
for ( d = first_descriptor; d; d = d->next )
{
if ( d->connected == CON_PLAYING
&& d->character != ch
&& d->character->in_room
&& d->newstate != 2
&& can_see( ch, d->character ) )
{
char buf[MAX_STRING_LENGTH];
sprintf( buf, "%s %s", d->character->name, arg2 );
do_transfer( ch, buf );
}
}
return;
}
/*
* Thanks to Grodyn for the optional location parameter.
*/
if ( arg2[0] == '\0' )
{
location = ch->in_room;
}
else
{
if ( ( location = find_location( ch, arg2 ) ) == NULL )
{
send_to_char( "No such location.\n\r", ch );
return;
}
if ( room_is_private( location ) )
{
send_to_char( "That room is private right now.\n\r", ch );
return;
}
}
if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( GetMaxLevel(victim) > GetMaxLevel(ch) )
{
send_to_char("That's not a good idea.\n\r", ch);
return;
}
if (NOT_AUTHED(victim))
{
send_to_char( "They are not authorized yet!\n\r", ch);
return;
}
if ( !victim->in_room )
{
send_to_char( "They are in limbo.\n\r", ch );
return;
}
if ( GetMaxLevel(ch) < MAX_LEVEL-3 &&
IS_ROOM_FLAG(ch->in_room, ROOM_DEATH ) )
{
log_printf_plus(LOG_MONITOR, UMAX(GetMaxLevel(ch),LEVEL_IMMORTAL), SEV_CRIT,
"do_transfer: %s tried to transfer %s to death room",
GET_NAME(ch), GET_NAME(victim));
send_to_char( "You can't transfer people to death rooms.\n\r", ch);
return;
}
if ( victim->fighting )
stop_fighting( victim, TRUE );
act( AT_MAGIC, "$n disappears in a cloud of swirling colors.", victim, NULL, NULL, TO_ROOM );
victim->retran = victim->in_room->vnum;
char_from_room( victim );
char_to_room( victim, location );
act( AT_MAGIC, "$n arrives from a puff of smoke.", victim, NULL, NULL, TO_ROOM );
if ( ch != victim )
act( AT_IMMORT, "$n has transferred you.", ch, NULL, victim, TO_VICT );
do_look( victim, "auto" );
send_to_char( "Ok.\n\r", ch );
if (!IS_IMMORTAL(victim) && !IS_NPC(victim)
&& !in_hard_range( victim, location->area ) )
send_to_char("Warning: the player's level is not within the area's level range.\n\r", ch);
}
void do_retran( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
char buf[MAX_STRING_LENGTH];
argument = one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char("Retransfer whom?\n\r", ch );
return;
}
if ( !(victim = get_char_world(ch, arg)) )
{
send_to_char("They aren't here.\n\r", ch );
return;
}
sprintf(buf, "'%s' %d", victim->name, victim->retran);
do_transfer(ch, buf);
return;
}
void do_regoto( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
sprintf(buf, "%d", ch->regoto);
do_goto(ch, buf);
return;
}
void do_at( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *location;
ROOM_INDEX_DATA *original;
CHAR_DATA *wch;
argument = one_argument( argument, arg );
if ( arg[0] == '\0' || argument[0] == '\0' )
{
send_to_char( "At where what?\n\r", ch );
return;
}
if ( ( location = find_location( ch, arg ) ) == NULL )
{
send_to_char( "No such location.\n\r", ch );
return;
}
if ( room_is_private( location ) )
{
if ( get_trust( ch ) < LEVEL_GREATER )
{
send_to_char( "That room is private right now.\n\r", ch );
return;
}
else
{
send_to_char( "Overriding private flag!\n\r", ch );
}
}
original = ch->in_room;
char_from_room( ch );
char_to_room( ch, location );
interpret( ch, argument );
/*
* See if 'ch' still exists before continuing!
* Handles 'at XXXX quit' case.
*/
for ( wch = first_char; wch; wch = wch->next )
{
if ( wch == ch )
{
char_from_room( ch );
char_to_room( ch, original );
break;
}
}
return;
}
void do_rat( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *location;
ROOM_INDEX_DATA *original;
int Start, End, vnum;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' || arg2[0] == '\0' || argument[0] == '\0' )
{
send_to_char( "Syntax: rat <start> <end> <command>\n\r", ch );
return;
}
Start = atoi( arg1 ); End = atoi( arg2 );
if ( Start < 1 || End < Start || Start > End || Start == End || End > top_room_vnum )
{
send_to_char( "Invalid range.\n\r", ch );
return;
}
if ( !str_cmp( argument, "quit" ) )
{
send_to_char( "I don't think so!\n\r", ch );
return;
}
original = ch->in_room;
for ( vnum = Start; vnum <= End; vnum++ )
{
if ( (location = get_room_index(vnum)) == NULL )
continue;
char_from_room( ch );
char_to_room( ch, location );
interpret( ch, argument );
}
char_from_room( ch );
char_to_room( ch, original );
send_to_char( "Done.\n\r", ch );
return;
}
void do_rstat( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *location;
OBJ_DATA *obj;
CHAR_DATA *rch;
EXIT_DATA *pexit;
int x;
char s1[16], s2[16], s3[16], s4[16];
static char *dir_text[LAST_NORMAL_DIR+1] = { "n", "e", "s", "w", "u", "d", "ne", "nw", "se", "sw", "?" };
sprintf(s1,"%s",color_str(AT_SCORE,ch));
sprintf(s2,"%s",color_str(AT_SCORE2,ch));
sprintf(s3,"%s",color_str(AT_SCORE3,ch));
sprintf(s4,"%s",color_str(AT_SCORE4,ch));
one_argument( argument, arg );
if ( !str_cmp( arg, "exits" ) )
{
location = ch->in_room;
ch_printf( ch, "%sExits for room '%s%s%s' vnum %s%d\n\r",
s1, s3, location->name,
s1, s2, location->vnum );
for ( pexit = location->first_exit; pexit; pexit = pexit->next )
{
buf[0]='\0';
for (x=0;x<MAX_EXFLAG;x++)
if (IS_SET(pexit->exit_info,1<<x))
{
strcat(buf,ex_flags[x]);
strcat(buf," ");
}
ch_printf( ch,
"%s%2d%s) %s%2s %sto %s%-5d %sKey: %s%2d \n\r%sFlags: %s%s\n\r%sKeywords: '%s%s%s'\n\r%sDescription: %s%s%sExit links back to vnum: %s%d %sExit's RoomVnum: %s%d %sDistance: %s%d\n\r",
s2, pexit->vdir,
s1, s3, pexit->vdir<=LAST_NORMAL_DIR?dir_text[pexit->vdir]:exit_name(pexit),
s1, s2, pexit->to_room ? pexit->to_room->vnum : 0,
s1, s2, pexit->key,
s1, s2, buf,
s1, s3, pexit->keyword,
s1, s1, s3, pexit->description[0] != '\0'
? pexit->description : "(none)\n\r",
s1, s2, pexit->rexit ? pexit->rexit->vnum : 0,
s1, s2, pexit->rvnum,
s1, s2, pexit->distance );
}
return;
}
location = ( arg[0] == '\0' ) ? ch->in_room : find_location( ch, arg );
if ( !location )
{
send_to_char( "No such location.\n\r", ch );
return;
}
if ( ch->in_room != location && room_is_private( location ) )
{
if ( get_trust( ch ) < LEVEL_GREATER )
{
send_to_char( "That room is private right now.\n\r", ch );
return;
}
else
{
send_to_char( "Overriding private flag!\n\r", ch );
}
}
ch_printf( ch, "%sName: %s%s %sSpecial: %s%s\n\r%sArea: %s%s ",
s1, s3, location->name,
s1, s3, location->spec_fun ? r_lookup_spec(location->spec_fun) : "none",
s1, s3, location->area ? location->area->name : "None????" );
#ifndef USE_DB
ch_printf( ch, "%sFilename: %s%s\n\r",
s1, s3, location->area ? location->area->filename : "None????" );
#endif
ch_printf( ch, "%sVnum: %s%d %sCurrency vnum: %s%d\n\r%sSector: %s%s %sLight: %s%d %sTeleDelay: %s%d %sTeleVnum: %s%d %sTunnel: %s%d\n\r",
s1, s2, location->vnum,
s1, s2, location->currindex ? location->currindex->vnum : -1,
s1, s2, sect_types[location->sector_type],
s1, room_is_dark(location)?color_str(AT_DGREY,ch):s2, location->light,
s1, s2, location->tele_delay,
s1, s2, location->tele_vnum,
s1, s2, location->tunnel );
ch_printf( ch, "%sElevation: %s%d %sDepth: %s%d %sSpeed: %s%d\n\r",
s1, s2, location->elevation,
s1, s2, location->river ? location->river->depth : 0,
s1, s2, location->river ? location->river->speed : 0);
ch_printf( ch, "%sRoom flags: %s%s\n\r",
s1, s3, flag_string(location->room_flags, r_flags) );
if (location->description)
{
ch_printf( ch, "%sDescription:\n\r%s%s",
s1, s3, location->description );
}
else ch_printf( ch, "%sDescription:%s (NULL)\n\r", s1, s3);
if ( location->first_extradesc )
{
EXTRA_DESCR_DATA *ed;
ch_printf( ch, "%sExtra description keywords: '%s", s1, s3 );
for ( ed = location->first_extradesc; ed; ed = ed->next )
{
send_to_char( ed->keyword, ch );
if ( ed->next )
send_to_char( " ", ch );
}
ch_printf( ch, "%s'\n\r", s1 );
}
ch_printf( ch, "%sCharacters:%s", s1, s3 );
for ( rch = location->first_person; rch; rch = rch->next_in_room )
{
if ( can_see( ch, rch ) )
{
char buf2[128];
one_argument( rch->name, buf );
if (IS_NPC(rch) && rch->vnum)
sprintf(buf2, "(%d)", rch->vnum);
else if (IS_NPC(rch))
sprintf(buf2, "(%s)", "NP");
else
sprintf(buf2, "(%s)", "PC");
ch_printf(ch, " %s%s", buf, buf2);
}
}
ch_printf( ch, "\n\r%sObjects: %s", s1, s3 );
for ( obj = location->first_content; obj; obj = obj->next_content )
{
char buf2[128];
one_argument( obj->name, buf );
if (obj->vnum)
sprintf(buf2, "(%d)", obj->vnum);
else
sprintf(buf2, "(%s)", "NP");
ch_printf(ch, " %s%s", buf, buf2);
}
send_to_char( "\n\r", ch );
if ( location->first_exit )
{
ch_printf( ch, "%s------------------- EXITS -------------------\n\r", s1 );
for ( pexit = location->first_exit; pexit; pexit = pexit->next )
ch_printf( ch,
"%s%2d%s) %s%-2s %sto %s%-5d %sKey: %s%2d %sFlags: %s%2d %sKeywords: %s%s\n\r",
s2, pexit->vdir,
s1, s3, pexit->vdir<=LAST_NORMAL_DIR?dir_text[pexit->vdir]:exit_name(pexit),
s1, s2, pexit->to_room ? pexit->to_room->vnum : 0,
s1, s2, pexit->key,
s1, s2, pexit->exit_info,
s1, s3, pexit->keyword[0] != '\0' ? pexit->keyword : "(none)" );
}
return;
}
void do_ostat( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
AFFECT_DATA *paf;
OBJ_DATA *obj;
char s1[16], s2[16], s3[16], s4[16];
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Ostat what?\n\r", ch );
return;
}
if ( arg[0] != '\'' && arg[0] != '"' && strlen(argument) > strlen(arg) )
strcpy( arg, argument );
if ( ( obj = get_obj_world( ch, arg ) ) == NULL )
{
send_to_char( "Nothing like that in hell, earth, or heaven.\n\r", ch );
return;
}
sprintf(s1,"%s",color_str(AT_SCORE,ch));
sprintf(s2,"%s",color_str(AT_SCORE2,ch));
sprintf(s3,"%s",color_str(AT_SCORE3,ch));
sprintf(s4,"%s",color_str(AT_SCORE4,ch));
ch_printf( ch, "%sName: %s%s %sArea: %s%s %sSpecial: %s%s\n\r",
s1, s3, obj->name,
s1, s3, obj->pIndexData->area?obj->pIndexData->area->name:"(none)",
s1, s3, obj->spec_fun ? o_lookup_spec(obj->spec_fun) : "(none)" );
ch_printf( ch, "%sVnum: %s%d %sUnum: %s%d %sType: %s%s %sCount: %s%d %sGcount: %s%d %sSerial#: %s%d\n\r",
s1, s2, obj->vnum,
s1, s2, obj->unum,
s1, s3, item_type_name( obj ),
s1, s2, obj->pIndexData->count,
s1, s4, obj->count,
s1, s2, obj->serial );
ch_printf( ch, "%sShort description: %s%s\n\r%sLong description: %s%s\n\r",
s1, s3, obj->short_descr,
s1, s3, obj->description );
if ( obj->action_desc[0] != '\0' )
ch_printf( ch, "%sAction description: %s%s\n\r",
s1, s3, obj->action_desc );
if ( obj->last_carried_by && obj->last_carried_by[0] != '\0' )
ch_printf( ch, "%sLast carried by: %s%s\n\r",
s1, s3, obj->last_carried_by );
if ( obj->christened )
{
ch_printf( ch, "%sChristened: %s%s %sBy: %s%s %sCvnum/Ovnum: %s%d%s/%s%d\n\r %sTime christened: %s%24.24s\n\r",
s1, s3, get_christen_name(obj),
s1, s3, obj->christened->owner,
s1, s2, obj->christened->cvnum,
s1, s4, obj->christened->ovnum,
s1, s3, ctime(&obj->christened->when));
}
if (obj->wear_flags)
ch_printf( ch, "%sWear flags : %s%s\n\r", s1, s3, flag_string(obj->wear_flags, w_flags) );
if (obj->extra_flags)
ch_printf( ch, "%sExtra flags: %s%s\n\r", s1, s3, flag_string(obj->extra_flags, o_flags) );
if (obj->extra_flags2)
ch_printf( ch, "%sExtra flag2: %s%s\n\r", s1, s3, flag_string(obj->extra_flags2, o2_flags) );
if (obj->magic_flags)
ch_printf( ch, "%sMagic flags: %s%s\n\r", s1, s3, flag_string(obj->magic_flags, mag_flags) );
ch_printf( ch, "%sNumber: %s%d%s/%s%d %sWeight: %s%d%s/%s%d %sLayers: %s%d\n\r",
s1, s2, 1,
s1, s4, get_obj_number( obj ),
s1, s2, obj->weight,
s1, s4, get_obj_weight( obj ),
s1, s2, obj->pIndexData->layers );
{
int itemsave=0, x;
for (x=0;x<100;x++)
itemsave += ItemSave(obj,TYPE_UNDEFINED);
ch_printf( ch, "%sCost: %s%d%s/%s%s %sRent: %s%d %sTimer: %s%d %sEgo: %s%d %sItemSave(TYPE_UNDEFINED)%%: %s%d\n\r",
s1, s2, obj->cost,
s1, s3, curr_types[obj->currtype],
s1, s2, obj->pIndexData->rent,
s1, s2, obj->timer,
s1, s2, item_ego(obj),
s1, s2, itemsave );
}
if ( obj->in_room )
ch_printf( ch,
"%sIn Room: %s%d %s(%s%s%s)\n\r",
s1, s2, obj->in_room->vnum,
s1, s3, obj->in_room->name,
s1);
else if ( obj->in_obj )
ch_printf( ch,
"%sIn Object: %s%s\n\r",
s1, s3, obj->in_obj->short_descr );
else if ( obj->carried_by )
ch_printf( ch,
"%sCarried by: %s%s\n\r",
s1, s3, obj->carried_by->name );
if (GetMaxLevel(ch) == MAX_LEVEL)
ch_printf( ch,
"%sRoom: %s%p %sObject: %s%p %sCarried: %s%p\n\r",
s1, s2, obj->in_room,
s1, s2, obj->in_obj,
s1, s2, obj->carried_by);
if ( obj->wear_loc != WEAR_NONE )
ch_printf( ch,
"%sWear_loc: %s%s\n\r",
s1, s3, wear_locs[obj->wear_loc] );
ch_printf( ch, "%sIndex Values : %s%-3d %s%-3d %s%-3d %s%-3d %s%-3d %s%-3d\n\r",
s1, s2, obj->pIndexData->value[0],
s4, obj->pIndexData->value[1],
s2, obj->pIndexData->value[2],
s4, obj->pIndexData->value[3],
s2, obj->pIndexData->value[4],
s4, obj->pIndexData->value[5] );
ch_printf( ch, "%sObject Values: %s%-3d %s%-3d %s%-3d %s%-3d %s%-3d %s%-3d%s\n\r",
s1, s2, obj->value[0],
s4, obj->value[1],
s2, obj->value[2],
s4, obj->value[3],
s2, obj->value[4],
s4, obj->value[5],
s1 );
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 )
ch_printf(ch, " '%s%s%s'", s3, ed->keyword, s1);
send_to_char( "\n\r", ch);
}
if ( obj->first_extradesc )
{
EXTRA_DESCR_DATA *ed;
send_to_char( "Secondary description keywords:", ch );
for ( ed = obj->first_extradesc; ed; ed = ed->next )
ch_printf(ch, " '%s%s%s'", s3, ed->keyword, s1);
send_to_char( "\n\r", ch);
}
for ( paf = obj->pIndexData->first_affect; paf; paf = paf->next )
{
send_to_char("-", ch);
showaffect(ch, paf);
}
for ( paf = obj->first_affect; paf; paf = paf->next )
{
send_to_char("*", ch);
showaffect(ch, paf);
}
}
void do_mstat( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
AFFECT_DATA *paf;
CHAR_DATA *victim;
SKILLTYPE *skill;
int x, i;
char s1[16], s2[16], s3[16], s4[16];
set_char_color( AT_PLAIN, ch );
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Mstat whom?\n\r", ch );
return;
}
if ( arg[0] != '\'' && arg[0] != '"' && strlen(argument) > strlen(arg) )
strcpy( arg, argument );
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( get_trust( ch ) < get_trust( victim ) && !IS_NPC(victim) )
{
set_char_color( AT_IMMORT, ch );
send_to_char( "Their godly glow prevents you from getting a good look.\n\r", ch );
return;
}
sprintf(s1,"%s",color_str(AT_SCORE,ch));
sprintf(s2,"%s",color_str(AT_SCORE2,ch));
sprintf(s3,"%s",color_str(AT_SCORE3,ch));
sprintf(s4,"%s",color_str(AT_SCORE4,ch));
ch_printf( ch, "%sName: %s%s %sWhere: %s%s%s/%s%s\n\r",
s1, s3, victim->name,
s1, s3, victim->in_room->name,
s1, s3, victim->in_room->area->name);
ch_printf( ch, "%sVnum: %s%d %sUnum: %s%d %sSex: %s%s %sRoom: %s%d %sCount: %s%d %sKilled: %s%d\n\r",
s1, s2, victim->vnum,
s1, s2, victim->unum,
s1, s3, victim->sex == SEX_MALE ? "male" :
victim->sex == SEX_FEMALE ? "female" : "neutral",
s1, s2, victim->in_room == NULL ? 0 : victim->in_room->vnum,
s1, s2, IS_NPC(victim) ? victim->pIndexData->count : 1,
s1, s2, IS_NPC(victim) ? victim->pIndexData->killed
: victim->pcdata->mdeaths + victim->pcdata->pdeaths
);
ch_printf( ch, "%sStr: %s%d %sInt: %s%d %sWis: %s%d %sDex: %s%d %sCon: %s%d %sCha: %s%d %sLck: %s%d\n\r",
s1, s2, get_curr_str(victim),
s1, s2, get_curr_int(victim),
s1, s2, get_curr_wis(victim),
s1, s2, get_curr_dex(victim),
s1, s2, get_curr_con(victim),
s1, s2, get_curr_cha(victim),
s1, s2, get_curr_lck(victim) );
if (IS_VAMPIRE(victim) && !IS_NPC(victim))
ch_printf( ch, "%sHps: %s%d%s/%s%d%s+%s%d %sBlood: %s%d%s/%s%d%s+%s%d %sMove: %s%d%s/%s%d%s+%s%d %sPractices: %s%d\n\r",
s1, s2, GET_HIT(victim),
s1, s4, GET_MAX_HIT(victim),
s1, s2, victim->hit_regen,
s1, s2, GET_COND(victim, COND_BLOODTHIRST),
s1, s4, GET_MAX_BLOOD(victim),
s1, s2, victim->mana_regen,
s1, s2, GET_MOVE(victim),
s1, s4, GET_MAX_MOVE(victim),
s1, s2, victim->move_regen,
s1, s2, victim->practice );
else
ch_printf( ch, "%sHps: %s%d%s/%s%d%s+%s%d %sMana: %s%d%s/%s%d%s+%s%d %sMove: %s%d%s/%s%d%s+%s%d %sPractices: %s%d\n\r",
s1, s2, GET_HIT(victim),
s1, s4, GET_MAX_HIT(victim),
s1, s2, victim->hit_regen,
s1, s2, GET_MANA(victim),
s1, s4, GET_MAX_MANA(victim),
s1, s2, victim->mana_regen,
s1, s2, GET_MOVE(victim),
s1, s4, GET_MAX_MOVE(victim),
s1, s2, victim->move_regen,
s1, s2, victim->practice );
ch_printf( ch,
"%sRace: %s%s %sAlign: %s%d %sAC: %s%d %sXP: %s%d %sAntiMag: %s%d%% %sSF: %s%d\n\r",
s1, s3, race_table[victim->race].race_name,
s1, s2, victim->alignment,
s1, s2, GET_AC(victim),
s1, s2, victim->exp,
s1, s2, GET_AMAGICP(victim),
s1, s2, victim->spellfail );
for (x=0;x<MAX_CURR_TYPE;x++)
ch_printf(ch, "%s%s: %s%d%s+%s%d ",
s1, cap_curr_types[x], s2, GET_MONEY(victim,x),
s1, s4, GET_BALANCE(victim,x) );
ch_printf( ch, "\n\r%sRent: %s%d", s1, s2, calc_rent(victim));
ch_printf( ch, " %sEgo: %s%d", s1, s2, char_ego(victim));
ch_printf( ch, " %sGML: %s%d", s1, s2, GetMaxLevel(victim));
ch_printf( ch, " %sHMC: %s%d", s1, s2, HowManyClasses(victim));
ch_printf( ch, " %sCalcThaco: %s%d\n\r", s1, s2, CalcThaco(victim));
ch_printf( ch, "%sClass : %s%s %sDeity: %s%s\n\r",
s1, s3, GetClassString(victim),
s1, s3, ( IS_NPC( victim ) || !victim->pcdata->deity ) ? "(none)"
: victim->pcdata->deity->name );
ch_printf( ch, "%sLevels:", s1);
for (i = 0; i < MAX_CLASS; ++i)
if ( GET_LEVEL(victim, i) > 0 )
ch_printf(ch, " %s%2d", s2, GET_LEVEL(victim, i) );
ch_printf(ch, "\n\r");
ch_printf( ch, "%sFighting: %s%s %sMaster: %s%s %sLeader: %s%s\n\r",
s1, s3, victim->fighting ? victim->fighting->who->name : "(none)",
s1, s3, victim->master ? victim->master->name : "(none)",
s1, s3, victim->leader ? victim->leader->name : "(none)" );
if (victim->hunting)
ch_printf( ch, "%sHunting: %s%s %sSince: %s%24.24s\n\r",
s1, s3, GET_NAME(victim->hunting->who),
s1, s2, ctime(&victim->hunting->start_time) );
if (victim->hating)
ch_printf( ch, "%sHating : %s%s %sSince: %s%24.24s\n\r",
s1, s3, GET_NAME(victim->hating->who),
s1, s2, ctime(&victim->hating->start_time) );
if (victim->fearing)
ch_printf( ch, "%sFearing: %s%s %sSince: %s%24.24s\n\r",
s1, s3, GET_NAME(victim->fearing->who),
s1, s2, ctime(&victim->fearing->start_time) );
ch_printf( ch, "%sHitroll: %s%d%s/%s%d %sDamroll: %s%d%s/%s%d %sPosition: %s%d%s/%s%d %sWimpy: %s%d %sBare: %s%d%sd%s%d\n\r",
s1, s2, GET_HITROLL(victim),
s1, s4, victim->hitroll,
s1, s2, GET_DAMROLL(victim),
s1, s4, victim->damroll,
s1, s2, victim->position,
s1, s4, victim->position,
s1, s2, victim->wimpy,
s1, s2, victim->barenumdie,
s1, s4, victim->baresizedie );
if ( !IS_NPC(victim) )
ch_printf( ch, "%sThirst: %s%d %sFull: %s%d %sDrunk: %s%d\n\r",
s1, s2, GET_COND(victim, COND_THIRST),
s1, s2, GET_COND(victim, COND_FULL),
s1, s2, GET_COND(victim, COND_DRUNK));
else
ch_printf( ch, "%sHit dice: %s%d%sd%s%d%s+%s%d %sDamage dice: %s%d%sd%s%d%s+%s%d\n\r",
s1, s2, victim->pIndexData->hitnodice,
s1, s4, victim->pIndexData->hitsizedice,
s1, s2, victim->pIndexData->hitplus,
s1, s2, victim->pIndexData->damnodice,
s1, s4, victim->pIndexData->damsizedice,
s1, s2, victim->pIndexData->damplus );
ch_printf( ch, "%sMentalState: %s%d %sEmotionalState: %s%d ",
s1, s2, victim->mental_state,
s1, s2, victim->emotional_state );
ch_printf( ch, "%sSaving throws: %s%d %s%d %s%d %s%d %s%d\n\r",
s1, s2, victim->saving_poison_death,
s4, victim->saving_wand,
s2, victim->saving_para_petri,
s4, victim->saving_breath,
s2, victim->saving_spell_staff );
ch_printf( ch, "%sCarry figures: items %s%d%s(%s%d%s)/%s%d %sweight %s%d%s(%s%d%s)/%s%d %sNumattacks: %s%1.3f%s/%s%1.3f\n\r",
s1, s2, victim->carry_number,
s1, s2, carry_n(victim),
s1, s4, can_carry_n(victim),
s1, s2, victim->carry_weight,
s1, s2, carry_w(victim),
s1, s4, can_carry_w(victim),
s1, s2, (float)victim->numattacks/1000,
s1, s4, (float)get_numattacks(victim)/1000 );
ch_printf( ch, "%sYears: %s%d %sSeconds Played: %s%d %sTimer: %s%d %sAct: %s%d %sAct2: %s%d\n\r",
s1, s2, get_age(victim),
s1, s2, (int)victim->played,
s1, s2, victim->timer,
s1, s2, victim->act,
s1, s2, victim->act2 );
if (IS_NPC(victim)) {
if (victim->act)
ch_printf(ch, "%sAct flags: %s%s\n\r",
s1, s3, flag_string(victim->act, act_flags));
if (victim->act2)
ch_printf(ch, "%sAct2 flags: %s%s\n\r",
s1, s3, flag_string(victim->act2, act2_flags));
}
else
{
if (victim->act)
ch_printf(ch, "%sPlayer flags: %s%s\n\r",
s1, s3, flag_string(victim->act, plr_flags));
if (victim->act2)
ch_printf(ch, "%sPlayer2 flags: %s%s\n\r",
s1, s3, flag_string(victim->act2, plr2_flags));
}
if (victim->affected_by)
ch_printf(ch, "%sAffected by: %s%s\n\r",
s1, s3, flag_string(victim->affected_by, a_flags));
if (victim->affected_by2 )
ch_printf(ch, "%sAffected by2: %s%s\n\r",
s1, s3, flag_string(victim->affected_by2, a2_flags));
ch_printf(ch, "%sSpeaks: %s%d %sSpeaking: %s%d\n\r",
s1, s2, victim->speaks,
s1, s4, victim->speaking);
ch_printf(ch, "%sLanguages: ", s1);
for ( x = 0; lang_array[x] != LANG_UNKNOWN; x++)
if (knows_language( victim, lang_array[x], victim))
{
if (IS_SET(lang_array[x], victim->speaking) ||
(IS_NPC(victim) && !victim->speaking))
set_char_color(AT_RED, ch);
send_to_char(lang_names[x], ch);
send_to_char(" ", ch);
set_char_color(AT_PLAIN, ch);
}
else
if (IS_SET(lang_array[x], victim->speaking) ||
(IS_NPC(victim) && !victim->speaking))
{
set_char_color(AT_PINK, ch);
send_to_char(lang_names[x], ch);
send_to_char(" ", ch);
set_char_color(AT_PLAIN, ch);
}
send_to_char("\n\r", ch);
if ( victim->short_descr && *victim->short_descr )
ch_printf( ch, "%sShort description: %s%s\n\r",
s1, s3, victim->short_descr);
if ( victim->long_descr && *victim->long_descr )
ch_printf( ch, "%sLong description : %s%s",
s1, s3, victim->long_descr);
if ( victim->intro_descr && *victim->intro_descr )
ch_printf( ch, "%sIntro Description: %s%s\n\r",
s1, s3, victim->intro_descr );
if ( IS_NPC(victim) && victim->spec_fun )
ch_printf( ch, "%sMobile has spec : %s%s\n\r",
s1, s3, m_lookup_spec( victim->spec_fun ) );
if ( victim->xflags )
ch_printf( ch, "%sBody Parts : %s%s\n\r",
s1, s3, flag_string(victim->xflags, part_flags) );
if ( victim->resistant )
ch_printf( ch, "%sResistant : %s%s\n\r",
s1, s3, flag_string(victim->resistant, ris_flags) );
if ( victim->immune )
ch_printf( ch, "%sImmune : %s%s\n\r",
s1, s3, flag_string(victim->immune, ris_flags) );
if ( victim->susceptible )
ch_printf( ch, "%sSusceptible: %s%s\n\r",
s1, s3, flag_string(victim->susceptible, ris_flags) );
if ( victim->absorb )
ch_printf( ch, "%sAbsorb : %s%s\n\r",
s1, s3, flag_string(victim->absorb, ris_flags) );
if ( victim->attacks )
ch_printf( ch, "%sAttacks : %s%s\n\r",
s1, s3, flag_string(victim->attacks, attack_flags) );
if ( victim->defenses )
ch_printf( ch, "%sDefenses : %s%s\n\r",
s1, s3, flag_string(victim->defenses, defense_flags) );
for ( paf = victim->first_affect; paf; paf = paf->next )
if ( (skill=get_skilltype(paf->type)) != NULL )
ch_printf( ch,
"%s%s: '%s%s%s' modifies %s%s %sby %s%d %sfor %s%d %srounds with bits %s%s\n\r",
s1, skill_tname[skill->type],
s3, skill->name, s1,
s3, affect_loc_name( paf->location ),
s1, s2, paf->modifier,
s1, s4, paf->duration,
s1, s3, flag_string( paf->bitvector, a_flags )
);
return;
}
void do_pstat(CHAR_DATA *ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
char s1[16], s2[16], s3[16], s4[16];
int i;
set_char_color( AT_PLAIN, ch );
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Pstat whom?\n\r", ch );
return;
}
if ( arg[0] != '\'' && arg[0] != '"' && strlen(argument) > strlen(arg) )
strcpy( arg, argument );
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if (IS_NPC(victim))
{
send_to_char("You can only use pstat on PC's\n\r", ch);
return;
}
if (get_trust( ch ) < get_trust( victim ))
{
set_char_color( AT_IMMORT, ch );
send_to_char( "Their godly glow prevents you from getting a good look.\n\r", ch );
return;
}
sprintf(s1,"%s",color_str(AT_SCORE,ch));
sprintf(s2,"%s",color_str(AT_SCORE2,ch));
sprintf(s3,"%s",color_str(AT_SCORE3,ch));
sprintf(s4,"%s",color_str(AT_SCORE4,ch));
ch_printf( ch, "%sName: %s%s %sTrust: %s%d %sMax/MinLevel: %s%d%s/%s%d %sArea: %s%s\n\r",
s1, s3, victim->name,
s1, s2, get_trust(victim),
s1, s2, GetMaxLevel(victim),
s1, s4, GetMinLevel(victim),
s1, s3, !victim->pcdata->area ? "(none)" :
victim->pcdata->area->name);
if ( get_trust(ch) >= LEVEL_GOD && victim->desc )
#ifndef MUD_LISTENER
ch_printf( ch, "%sUser: %s%s@%s\n\r%sDescriptor: %s%d %sConnId: %s%d %sAuthedBy: %s%s\n\r",
#else
ch_printf( ch, "%sUser: %s%s@%s\n\r%sUID: %s%d %sConnId: %s%d %sAuthedBy: %s%s\n\r",
#endif
s1, s3, victim->desc->user, victim->desc->host,
#ifndef MUD_LISTENER
s1, s2, victim->desc->descriptor,
#else
s1, s2, victim->desc->uid,
#endif
s1, s2, victim->desc->conn_id,
s1, s3, victim->pcdata->authed_by ?
victim->pcdata->authed_by : "(unknown)" );
if ( victim->desc )
ch_printf( ch, "%sMXP: %s%d %sMSP: %s%d\n\r",
s1, s2,
#ifdef MXP
victim->desc->mxp_detected,
#else
0,
#endif
s1, s2,
#ifdef MSP
victim->desc->msp_detected
#else
0
#endif
);
ch_printf( ch, "%sClass: %s%s %sRace: %s%s\n\r%sDeity: %s%s %sCouncil: %s%s %sClan: %s%s\n\r",
s1, s3, GetClassString(victim),
s1, s3, race_table[GET_RACE(victim)].race_name,
s1, s3, victim->pcdata->deity ? victim->pcdata->deity->name : "(none)",
s1, s3, victim->pcdata->council ? victim->pcdata->council->name : "(none)",
s1, s3, victim->pcdata->clan ? victim->pcdata->clan->name : "(none)");
if (!IS_IMMORTAL(victim))
{
ch_printf( ch, "%sLevels:\n\r", s1);
for (i = 0; i < MAX_CLASS; ++i)
if ( GET_LEVEL(victim, i) > 0 )
ch_printf(ch, " %s%s: %s%-2d %s%-10.10s%-10.10s%-10.10s\n\r",
s1, short_pc_class[i],
s2, GET_LEVEL(victim, i),
s1,
IS_ACTIVE(victim, i)?"ACTIVE":"",
IS_FALLEN(victim, i)?"FALLEN":"",
HAD_CLASS(victim, i)?"HADCLASS":"");
}
ch_printf( ch, "%sChannels:%s", s1, s3);
for (i = 0; i < 32; i++)
if (!IS_SET( victim->deaf, 1<<i))
ch_printf( ch, " %s", channel_names[i] );
send_to_char("\n\r", ch);
#ifdef I3
ch_printf( ch, "%sI3 Channels: %s%s\n\r",
s1, s3, I3LISTEN(victim)?I3LISTEN(victim):"" );
#endif
if (victim->pcdata->bamfin || victim->pcdata->bamfout)
ch_printf( ch, "%sBamfin: %s%s\n\r%sBamfout: %s%s\n\r",
s1, s3, victim->pcdata->bamfin,
s1, s3, victim->pcdata->bamfout);
if (victim->pcdata->bestowments)
ch_printf( ch, "%sBestowments: %s%s\n\r",
s1, s3, victim->pcdata->bestowments);
ch_printf( ch, "%sRank: %s%s\n\r%sTitle: %s%s\n\r%sPrompt: %s%s\n\r",
s1, s3, victim->pcdata->rank,
s1, s3, victim->pcdata->title,
s1, s3, victim->pcdata->prompt);
ch_printf(ch, "%sTimes played (>5 minutes): %s%d\n\r",
s1, s2, victim->pcdata->times_played);
ch_printf(ch, "%sLogged on : %s%24.24s\n\r",
s1, s3, ctime(&victim->logon));
if (victim->pcdata->release_date)
ch_printf(ch, "%sHelled until : %s%24.24s %sby %s%s.\n\r",
s1, s3, ctime(&victim->pcdata->release_date),
s1, s3, victim->pcdata->helled_by);
if (victim->pcdata->restore_time)
ch_printf(ch, "%sLast time restored somebody: %s%24.24s\n\r",
s1, s3, ctime(&victim->pcdata->restore_time));
if (victim->pcdata->time_created)
ch_printf(ch, "%sTime of Creation : %s%24.24s\n\r",
s1, s3, ctime(&victim->pcdata->time_created));
if (victim->pcdata->time_immortal)
ch_printf(ch, "%sBecame Immortal : %s%24.24s\n\r",
s1, s3, ctime(&victim->pcdata->time_immortal));
if (victim->pcdata->time_to_die)
ch_printf(ch, "%sTime to Die : %s%24.24s\n\r",
s1, s3, ctime(&victim->pcdata->time_to_die));
ch_printf( ch, "%sPKills: %s%d %sIllegal PK: %s%d %sPDeaths: %s%d %sMKills: %s%d %sMDeaths: %s%d\n\r",
s1, s2, victim->pcdata->pkills,
s1, s4, victim->pcdata->illegal_pk,
s1, s2, victim->pcdata->pdeaths,
s1, s4, victim->pcdata->mkills,
s1, s2, victim->pcdata->mdeaths);
ch_printf( ch, "%sHome: %s%d %sFavor: %s%d %sGlory: %s%d%s/%s%d %sPercent of money online: %s%d%%\n\r%sInterface: %s%d %sPagerLen: %s%d\n\r",
s1, s2, victim->pcdata->home,
s1, s4, victim->pcdata->favor,
s1, s2, victim->pcdata->quest_curr,
s1, s4, victim->pcdata->quest_accum,
s1, s2, player_worth_percentage(victim),
s1, s2, victim->pcdata->interface,
s1, s4, victim->pcdata->pagerlen);
if (victim->act)
ch_printf(ch, "%sPlayer flags: %s%s\n\r",
s1, s3, flag_string(victim->act, plr_flags));
if (victim->act2)
ch_printf(ch, "%sPlayer2 flags: %s%s\n\r",
s1, s3, flag_string(victim->act2, plr2_flags));
if (victim->pcdata->flags)
ch_printf(ch, "%sPcflags: %s%s\n\r",
s1, s3, flag_string(victim->pcdata->flags, pc_flags));
ch_printf( ch, "%sRoom range: %s%5d%s-%s%-5d\n\r%sObject range: %s%5d%s-%s%-5d\n\r%sMob range: %s%5d%s-%s%-5d\n\r",
s1, s2, victim->pcdata->r_range_lo,
s1, s4, victim->pcdata->r_range_hi,
s1, s2, victim->pcdata->o_range_lo,
s1, s4, victim->pcdata->o_range_hi,
s1, s2, victim->pcdata->m_range_lo,
s1, s4, victim->pcdata->m_range_hi);
#ifdef VTRACK
ch_printf( ch, "%sExplored rooms : %s%-6d %s(%s%.2f%%%s)\n\r",
s1, s2, vtrack_count_room(victim),
s1, s4, vtrack_percent_room(victim),
s1 );
ch_printf( ch, "%sExplored mobiles: %s%-6d %s(%s%.2f%%%s)\n\r",
s1, s2, vtrack_count_mob(victim),
s1, s4, vtrack_percent_mob(victim),
s1 );
ch_printf( ch, "%sKilled mobiles : %s%-6d %s(%s%.2f%%%s)\n\r",
s1, s2, vtrack_count_mobkill(victim),
s1, s4, vtrack_percent_mobkill(victim),
s1 );
ch_printf( ch, "%sExplored objects: %s%-6d %s(%s%.2f%%%s)\n\r",
s1, s2, vtrack_count_obj(victim),
s1, s4, vtrack_percent_obj(victim),
s1 );
#endif
}
void do_mfind( CHAR_DATA *ch, char *argument )
{
/* extern int top_mob_index; */
char arg[MAX_INPUT_LENGTH];
MOB_INDEX_DATA *pMobIndex;
/* int vnum; */
int hash;
int nMatch = 0;
int act = 0, act2 = 0, aff = 0, race = -1;
argument = one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Mfind whom?\n\r", ch );
return;
}
set_pager_color( AT_PLAIN, ch );
if ( !str_cmp(arg, "act") )
{
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Mfind what act flag?\n\r", ch );
return;
}
act = get_actflag(arg);
if ( act < 0 )
{
ch_printf( ch, "Invalid flag: %s\n\r", arg );
return;
}
arg[0] = '\0';
}
else if ( !str_cmp(arg, "act2") )
{
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Mfind what act flag?\n\r", ch );
return;
}
act2 = get_act2flag(arg);
if ( act2 < 0 )
{
ch_printf( ch, "Invalid flag: %s\n\r", arg );
return;
}
arg[0] = '\0';
}
else if ( !str_cmp(arg, "aff") )
{
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Mfind what act flag?\n\r", ch );
return;
}
aff = get_aflag(arg);
if ( aff < 0 )
{
ch_printf( ch, "Invalid flag: %s\n\r", arg );
return;
}
arg[0] = '\0';
}
else if ( !str_cmp(arg, "race") )
{
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Mfind what race?\n\r", ch );
return;
}
race = get_npc_race(arg);
if ( race < 0 )
{
ch_printf( ch, "Invalid race: %s\n\r", arg );
return;
}
arg[0] = '\0';
}
/*
* This goes through all the hash entry points (1024), and is therefore
* much faster, though you won't get your vnums in order... oh well. :)
*
* Tests show that Furey's method will usually loop 32,000 times, calling
* get_mob_index()... which loops itself, an average of 1-2 times...
* So theoretically, the above routine may loop well over 40,000 times,
* and my routine bellow will loop for as many index_mobiles are on
* your mud... likely under 3000 times.
* -Thoric
*/
for ( hash = 0; hash < MAX_KEY_HASH; hash++ )
for ( pMobIndex = mob_index_hash[hash];
pMobIndex;
pMobIndex = pMobIndex->next )
if ( (arg[0] != '\0' && nifty_is_name( arg, pMobIndex->player_name )) ||
(act != 0 && IS_ACT_FLAG(pMobIndex, act)) ||
(act2 != 0 && IS_ACT2_FLAG(pMobIndex, act2)) ||
(aff != 0 && IS_AFFECTED(pMobIndex, aff)) ||
(race != -1 && pMobIndex->race == race) )
{
nMatch++;
pager_printf( ch, "[%5d] %s\n\r",
pMobIndex->ivnum, capitalize( pMobIndex->short_descr ) );
}
if ( nMatch )
pager_printf( ch, "Number of matches: %d\n", nMatch );
else
send_to_char( "Nothing like that in hell, earth, or heaven.\n\r", ch );
return;
}
void do_rfind( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
ROOM_INDEX_DATA *pRoom;
int hash;
int nMatch;
bool name = FALSE, desc = FALSE;
argument = one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Rfind what?\n\r", ch );
return;
}
if ( !str_cmp(arg, "desc") )
{
if ( !argument || !*argument )
{
send_to_char( "Rfind desc what?\n\r", ch );
return;
}
desc = TRUE;
}
else
name = TRUE;
set_pager_color( AT_PLAIN, ch );
nMatch = 0;
for ( hash = 0; hash < MAX_KEY_HASH; hash++ )
for ( pRoom = room_index_hash[hash];
pRoom;
pRoom = pRoom->next )
if ( (name && nifty_is_name_prefix( arg, pRoom->name )) ||
(desc && nifty_is_name_prefix( arg, pRoom->description )) )
{
nMatch++;
pager_printf( ch, "[%5d] %s\n\r",
pRoom->vnum, pRoom->name );
}
if ( nMatch )
pager_printf( ch, "Number of matches: %d\n", nMatch );
else
send_to_char( "Nowhere like that in hell, earth, or heaven.\n\r", ch );
return;
}
void do_ofind( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
OBJ_INDEX_DATA *pObjIndex;
int hash;
int nMatch;
int otype=-1;
argument = one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Ofind what?\n\r", ch );
return;
}
if ( !str_cmp(arg, "type") )
{
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Ofind what item type?\n\r", ch );
return;
}
otype = get_otype(arg);
if ( otype < 0 )
{
ch_printf( ch, "Invalid type: %s\n\r", arg );
return;
}
}
set_pager_color( AT_PLAIN, ch );
nMatch = 0;
for ( hash = 0; hash < MAX_KEY_HASH; hash++ )
for ( pObjIndex = obj_index_hash[hash];
pObjIndex;
pObjIndex = pObjIndex->next )
if ( pObjIndex->item_type == otype ||
(otype < 0 && nifty_is_name( arg, pObjIndex->name )) )
{
nMatch++;
pager_printf( ch, "[%5d] %s\n\r",
pObjIndex->ivnum, capitalize( pObjIndex->short_descr ) );
}
if ( nMatch )
pager_printf( ch, "Number of matches: %d\n", nMatch );
else
send_to_char( "Nothing like that in hell, earth, or heaven.\n\r", ch );
return;
}
void do_mwhere( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
int icnt = 0;
bool found;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Mwhere whom?\n\r", ch );
return;
}
set_pager_color( AT_PLAIN, ch );
found = FALSE;
for ( victim = first_char; victim; victim = victim->next )
{
if ( victim->in_room && can_see(ch, victim) &&
( nifty_is_name( arg, victim->name ) ||
victim->unum == unum_arg(arg) ||
victim->vnum == vnum_arg(arg) ) )
{
found = TRUE;
pager_printf( ch, "%3d) u%-6d [%5d] %-24s [%5d] %s\n\r",
++icnt,
victim->unum,
victim->vnum,
PERS(victim, ch),
victim->in_room->vnum,
victim->in_room->name );
}
}
if ( !found )
act( AT_PLAIN, "You didn't find any $T.", ch, NULL, arg, TO_CHAR );
else
pager_printf(ch, "%d matches.\n\r", icnt);
return;
}
void do_gfighting( CHAR_DATA *ch, char *argument )
{
CHAR_DATA *victim = NULL;
DESCRIPTOR_DATA *d;
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char arg3[MAX_INPUT_LENGTH];
bool found = FALSE, pmobs = FALSE, phating = FALSE, phunting = FALSE;
int low = 1, high = 65, count = 0;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] != '\0' )
{
if ( arg1[0] == '\0' || arg2[0] == '\0' )
{
send_to_pager_color( "\n\rSyntax: gfighting | gfighting <low> <high> | gfighting <low> <high> mobs\n\r", ch );
return;
}
low = atoi( arg1 );
high = atoi( arg2 );
}
if ( low < 1 || high < low || low > high || high > 65 )
{
send_to_pager_color( "Invalid level range.\n\r", ch );
return;
}
argument = one_argument( argument, arg3 );
if ( !str_cmp( arg3, "mobs" ) )
pmobs = TRUE;
else if ( !str_cmp( arg3, "hating" ) )
phating = TRUE;
else if ( !str_cmp( arg3, "hunting" ) )
phunting = TRUE;
pager_printf( ch, "\n\rGlobal %s conflict:\n\r", pmobs ? "mob" : "character" );
if ( !pmobs && !phating && !phunting)
{
for ( d = first_descriptor; d; d = d->next )
if ( (d->connected == CON_PLAYING || d->connected == CON_EDITING )
&& ( victim = d->character ) != NULL && !IS_NPC( victim ) && victim->in_room
&& can_see( ch, victim )
&& victim->fighting && GetMaxLevel(victim) >= low && GetMaxLevel(victim) <= high )
{
found = TRUE;
pager_printf( ch, "%-12.12s |%2d vs %2d| %-16.16s [%5d] %-20.20s [%5d]\n\r",
victim->name, GetMaxLevel(victim), GetMaxLevel(victim->fighting->who),
IS_NPC( victim->fighting->who ) ? victim->fighting->who->short_descr : victim->fighting->who->name,
victim->fighting->who->vnum,
victim->in_room->area->name, victim->in_room == NULL ? 0 : victim->in_room->vnum );
count++;
}
}
else if ( !phating && !phunting)
{
for ( victim = first_char; victim; victim = victim->next )
if ( IS_NPC( victim )
&& victim->in_room && can_see( ch, victim )
&& victim->fighting && GetMaxLevel(victim) >= low && GetMaxLevel(victim) <= high )
{
found = TRUE;
pager_printf( ch, "%-12.12s |%2d vs %2d| %-16.16s [%5d] %-20.20s [%5d]\n\r",
victim->name, GetMaxLevel(victim), GetMaxLevel(victim->fighting->who),
IS_NPC( victim->fighting->who ) ? victim->fighting->who->short_descr : victim->fighting->who->name,
victim->fighting->who->vnum,
victim->in_room->area->name, victim->in_room == NULL ? 0 : victim->in_room->vnum );
count++;
}
}
else if ( !phunting && phating)
{
for ( victim = first_char; victim; victim = victim->next )
if ( IS_NPC( victim )
&& victim->in_room && can_see( ch, victim )
&& victim->hating && GetMaxLevel(victim) >= low && GetMaxLevel(victim) <= high )
{
found = TRUE;
pager_printf( ch, "%-12.12s |%2d vs %2d| %-16.16s [%5d] %-20.20s [%5d]\n\r",
victim->name, GetMaxLevel(victim), GetMaxLevel(victim->hating->who), IS_NPC( victim->hating->who ) ?
victim->hating->who->short_descr : victim->hating->who->name,
victim->hating->who->vnum,
victim->in_room->area->name, victim->in_room == NULL ? 0 :
victim->in_room->vnum );
count++;
}
}
else if ( phunting )
{
for ( victim = first_char; victim; victim = victim->next )
if ( IS_NPC( victim )
&& victim->in_room && can_see( ch, victim )
&& victim->hunting && GetMaxLevel(victim) >= low && GetMaxLevel(victim) <= high )
{
found = TRUE;
pager_printf( ch, "%-12.12s |%2d vs %2d| %-16.16s [%5d] %-20.20s [%5d]\n\r",
victim->name, GetMaxLevel(victim), GetMaxLevel(victim->hunting->who), IS_NPC( victim->hunting->who ) ?
victim->hunting->who->short_descr : victim->hunting->who->name,
victim->hunting->who->vnum,
victim->in_room->area->name, victim->in_room == NULL ? 0 : victim->in_room->vnum );
count++;
}
}
pager_printf( ch, "%d %s conflicts located.\n\r", count, pmobs ? "mob" : "character" );
return;
}
/* Added 'show' argument for lowbie imms without ostat -- Blodkai */
/* Made show the default action :) Shaddai */
/* Trimmed size, added vict info, put lipstick on the pig -- Blod */
void do_bodybag( CHAR_DATA *ch, char *argument )
{
char buf2[MAX_STRING_LENGTH];
char buf3[MAX_STRING_LENGTH];
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
CHAR_DATA *owner;
OBJ_DATA *obj;
bool found = FALSE, bag = FALSE;
argument = one_argument( argument, arg1 );
if ( arg1[0] == '\0' )
{
send_to_char( "Syntax: bodybag <character> | bodybag <character> yes/bag/now\n\r", ch );
return;
}
sprintf( buf3, " " );
sprintf( buf2, "the corpse of %s", arg1 );
argument = one_argument( argument, arg2 );
if ( arg2[0] !='\0' && ( str_cmp( arg2, "yes" )
&& str_cmp( arg2, "bag" ) && str_cmp( arg2, "now" ) ) )
{
send_to_char( "\n\rSyntax: bodybag <character> | bodybag <character> yes/bag/now\n\r", ch );
return;
}
if ( !str_cmp( arg2, "yes" ) || !str_cmp( arg2, "bag" )
|| !str_cmp( arg2, "now" ) )
bag = TRUE;
pager_printf( ch, "\n\r%s remains of %s ... ",
bag ? "Retrieving" : "Searching for",
capitalize( arg1 ) );
for ( obj = first_object; obj; obj = obj->next )
{
if ( obj->in_room
&& !str_cmp( buf2, obj->short_descr )
&& (obj->vnum == OBJ_VNUM_CORPSE_PC ) )
{
send_to_pager( "\n\r", ch );
found = TRUE;
pager_printf( ch, "%s: %-12.12s In: %-22.22s [%5d] Timer: %2d",
bag ? "Bagging" : "Corpse",
capitalize( arg1 ),
obj->in_room->area->name,
obj->in_room->vnum,
obj->timer );
if ( bag )
{
obj_from_room( obj );
obj = obj_to_char( obj, ch );
obj->timer = -1;
save_char_obj( ch );
}
}
}
if ( !found )
{
send_to_pager( "No corpse was found.\n\r", ch );
return;
}
send_to_pager( "\n\r", ch );
for ( owner = first_char; owner; owner = owner->next )
{
if ( IS_NPC( owner ) )
continue;
if ( can_see( ch, owner) && !str_cmp( arg1, owner->name ) )
break;
}
if ( owner == NULL )
{
pager_printf( ch, "%s is not currently online.\n\r",
capitalize( arg1 ) );
return;
}
if ( owner->pcdata->deity )
pager_printf( ch, "%s (%d) has %d favor with %s (needed to supplicate: %d)\n\r",
owner->name,
GetMaxLevel(owner),
owner->pcdata->favor,
owner->pcdata->deity->name,
owner->pcdata->deity->scorpse );
else
pager_printf( ch, "%s (%d) has no deity.\n\r",
owner->name, GetMaxLevel(owner) );
return;
}
/* New owhere by Altrag, 03/14/96 */
void do_owhere( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
char arg1[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
bool found;
int icnt = 0;
argument = one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Owhere what?\n\r", ch );
return;
}
argument = one_argument(argument, arg1);
set_pager_color( AT_PLAIN, ch );
if ( arg1[0] != '\0' && !str_prefix(arg1, "nesthunt") )
{
if ( !(obj = get_obj_world(ch, arg)) )
{
send_to_char( "Nesthunt for what object?\n\r", ch );
return;
}
for ( ; obj->in_obj; obj = obj->in_obj )
{
pager_printf(ch, "[%5d] %-28s in object [%5d] %s\n\r",
obj->vnum, obj_short(obj),
obj->in_obj->vnum, obj->in_obj->short_descr);
++icnt;
}
sprintf(buf, "[%5d] %-28s in ", obj->vnum,
obj_short(obj));
if ( obj->carried_by )
sprintf(buf+strlen(buf), "invent [%5d] %s\n\r",
obj->carried_by->vnum, PERS(obj->carried_by, ch));
else if ( obj->in_room )
sprintf(buf+strlen(buf), "room [%5d] %s\n\r",
obj->in_room->vnum, obj->in_room->name);
else if ( obj->in_obj )
{
bug("do_owhere: obj->in_obj after NULL!");
strcat(buf, "object??\n\r");
}
else if ( obj_extracted(obj) )
{
bug("do_owhere: object extracted!");
strcat(buf, "extracted??\n\r");
}
else
{
bug("do_owhere: object doesnt have location!");
strcat(buf, "nowhere??\n\r");
}
send_to_pager(buf, ch);
++icnt;
pager_printf(ch, "Nested %d levels deep.\n\r", icnt);
return;
}
found = FALSE;
for ( obj = first_object; obj; obj = obj->next )
{
if (obj_extracted(obj))
continue;
if ( !nifty_is_name( arg, obj->name ) &&
obj->unum != unum_arg(arg) &&
obj->vnum != vnum_arg(arg) )
continue;
found = TRUE;
sprintf(buf, "%3d) u%-6d [%5d] %-24s in ",
++icnt, obj->unum, obj->vnum, obj_short(obj));
if ( obj->carried_by )
sprintf(buf+strlen(buf), "invent [%5d] %s\n\r",
obj->carried_by->vnum, PERS(obj->carried_by, ch));
else if ( obj->in_room )
sprintf(buf+strlen(buf), "room [%5d] %s\n\r",
obj->in_room->vnum, obj->in_room->name);
else if ( obj->in_obj )
sprintf(buf+strlen(buf), "object [%5d] %s\n\r",
obj->in_obj->vnum, obj_short(obj->in_obj));
else
{
bug("do_owhere: object doesnt have location!");
strcat(buf, "nowhere??\n\r");
}
send_to_pager(buf, ch);
}
if ( !found )
act( AT_PLAIN, "You didn't find any $T.", ch, NULL, arg, TO_CHAR );
else
pager_printf(ch, "%d matches.\n\r", icnt);
return;
}
void do_reboo( CHAR_DATA *ch, char *argument )
{
send_to_char( "If you want to REBOOT, spell it out.\n\r", ch );
return;
}
#ifdef USE_CRBS
void do_clogoff(CHAR_DATA *ch, char *argument);
#endif
void do_reboot( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
CHAR_DATA *vch;
if ( str_cmp( argument, "mud now" )
&& str_cmp( argument, "nosave" )
&& str_cmp( argument, "and sort skill table" )
&& str_cmp( argument, "and sort skill table by sn" ) )
{
send_to_char( "Syntax: 'reboot mud now' or 'reboot nosave'\n\r", ch );
return;
}
if ( auction->item )
do_auction( ch, "stop");
sprintf( buf, "Reboot by %s.", ch->name );
do_echo( ch, buf );
if ( !str_cmp(argument, "and sort skill table") )
{
sort_skill_table();
save_skill_table();
}
else if ( !str_cmp(argument, "and sort skill table by sn") )
{
sort_skill_table_sn();
save_skill_table();
}
/* Save all characters before booting. */
if ( str_cmp(argument, "nosave") )
for ( vch = first_char; vch; vch = vch->next )
if ( !IS_NPC( vch ) )
{
save_char_obj( vch );
#ifdef IRC
irc_logoff(vch);
#endif
#ifdef USE_CRBS
do_clogoff(vch, NULL); /* CRBS logoff */
#endif
}
mud_down = TRUE;
return;
}
void do_shutdow( CHAR_DATA *ch, char *argument )
{
send_to_char( "If you want to SHUTDOWN, spell it out.\n\r", ch );
return;
}
void do_shutdown( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
CHAR_DATA *vch;
if ( auction->item )
do_auction( ch, "stop");
sprintf( buf, "Shutdown by %s.", ch->name );
append_file( ch, SHUTDOWN_FILE, buf );
strcat( buf, "\n\r" );
do_echo( ch, buf );
/* Save all characters before booting. */
if ( str_cmp(argument, "nosave") )
for ( vch = first_char; vch; vch = vch->next )
if ( !IS_NPC( vch ) )
{
save_char_obj( vch );
#ifdef IRC
irc_logoff(vch);
#endif
#ifdef USE_CRBS
do_clogoff(vch, NULL); /* CRBS logoff */
#endif
}
mud_down = TRUE;
return;
}
void do_snoop( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
DESCRIPTOR_DATA *d;
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Snoop whom?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( !victim->desc )
{
send_to_char( "No descriptor to snoop.\n\r", ch );
return;
}
if ( victim == ch )
{
send_to_char( "Cancelling all snoops.\n\r", ch );
for ( d = first_descriptor; d; d = d->next )
if ( d->snoop_by == ch->desc )
d->snoop_by = NULL;
return;
}
if ( victim->desc->snoop_by )
{
send_to_char( "Busy already.\n\r", ch );
return;
}
/*
* Minimum snoop level... a secret mset value
* makes the snooper think that the victim is already being snooped
*/
if ( get_trust( victim ) >= get_trust( ch )
|| (victim->pcdata && victim->pcdata->min_snoop > get_trust( ch )) )
{
send_to_char( "Busy already.\n\r", ch );
return;
}
if ( ch->desc )
{
for ( d = ch->desc->snoop_by; d; d = d->snoop_by )
if ( d->character == victim || d->original == victim )
{
send_to_char( "No snoop loops.\n\r", ch );
return;
}
}
victim->desc->snoop_by = ch->desc;
send_to_char( "Ok.\n\r", ch );
return;
}
void do_switch( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Switch into whom?\n\r", ch );
return;
}
if ( !ch->desc )
return;
if ( ch->desc->original )
{
send_to_char( "You are already switched.\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( victim == ch )
{
send_to_char( "Ok.\n\r", ch );
return;
}
if ( victim->desc )
{
send_to_char( "Character in use.\n\r", ch );
return;
}
if ( !IS_NPC(victim) && GetMaxLevel(ch) < LEVEL_IMPLEMENTOR )
{
send_to_char( "You cannot switch into a player!\n\r", ch );
return;
}
/* let people switch into their bestowed mob */
if ( IS_NPC(victim) && GetMaxLevel(ch) < LEVEL_GREATER )
{
char buf[MAX_INPUT_LENGTH];
sprintf(buf, "mob:%d", victim->vnum);
if (!is_name(buf, ch->pcdata->bestowments))
return;
}
ch->desc->character = victim;
ch->desc->original = ch;
victim->desc = ch->desc;
ch->desc = NULL;
ch->switched = victim;
send_to_char( "Ok.\n\r", victim );
return;
}
void do_return( CHAR_DATA *ch, char *argument )
{
if ( !ch->desc )
return;
if (IS_SET(ch->act, ACT_POLYMORPHED))
{
send_to_char("Use revert to return from a polymorphed mob.\n\r", ch);
return;
}
if ( !ch->desc->original )
{
send_to_char( "You aren't switched.\n\r", ch );
return;
}
send_to_char( "You return to your original body.\n\r", ch );
if ( IS_NPC( ch ) && IS_AFFECTED( ch, AFF_POSSESS ) )
{
affect_strip( ch, gsn_possess );
REMOVE_BIT( ch->affected_by, AFF_POSSESS );
}
/* if ( IS_NPC( ch->desc->character ) )
REMOVE_BIT( ch->desc->character->affected_by, AFF_POSSESS );*/
ch->desc->character = ch->desc->original;
ch->desc->original = NULL;
ch->desc->character->desc = ch->desc;
ch->desc->character->switched = NULL;
ch->desc = NULL;
return;
}
void do_minvoke( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
MOB_INDEX_DATA *pMobIndex;
CHAR_DATA *victim;
int vnum;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Syntax: load m <vnum>.\n\r", ch );
return;
}
if ( !is_number( arg ) )
{
char arg2[MAX_INPUT_LENGTH];
int hash, cnt;
int count = number_argument( arg, arg2 );
vnum = -1;
for ( hash = cnt = 0; hash < MAX_KEY_HASH; hash++ )
for ( pMobIndex = mob_index_hash[hash];
pMobIndex;
pMobIndex = pMobIndex->next )
if ( nifty_is_name( arg2, pMobIndex->player_name )
&& ++cnt == count )
{
vnum = pMobIndex->ivnum;
break;
}
}
else
vnum = atoi( arg );
if ( !mob_exists_index( vnum ) )
{
send_to_char("No such mobile exists.\n\r", ch);
return;
}
if ( (vnum<VNUM_START_SCRATCH || vnum>VNUM_END_SCRATCH) &&
get_trust(ch) < LEVEL_DEMI )
{
AREA_DATA *pArea;
if ( IS_NPC(ch) )
{
send_to_char( "Huh?\n\r", ch );
return;
}
if ( !ch->pcdata || !(pArea=ch->pcdata->area) )
{
send_to_char( "You must have an assigned area to invoke this mobile.\n\r", ch );
return;
}
if ( vnum < pArea->low_m_vnum
&& vnum > pArea->hi_m_vnum )
{
send_to_char( "That number is not in your allocated range.\n\r", ch );
return;
}
}
if ( ( victim = create_mobile( vnum ) ) == NULL )
{
send_to_char( "No mobile has that vnum.\n\r", ch );
return;
}
char_to_room( victim, ch->in_room );
ch_printf(ch, "Mobile has unum %d\n\r", victim->unum);
mprog_birth_trigger(ch, victim);
if (ch->pcdata && !ch->pcdata->wizinvis)
act( AT_IMMORT, "$n has created $N!", ch, NULL, victim, TO_ROOM );
act( AT_IMMORT, "You have created $N!", ch, NULL, victim, TO_CHAR );
return;
}
void do_oinvoke( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
OBJ_INDEX_DATA *pObjIndex;
OBJ_DATA *obj;
int vnum;
argument = one_argument( argument, arg1 );
if ( arg1[0] == '\0' )
{
send_to_char( "Syntax: load o <vnum>.\n\r", ch );
return;
}
if ( !is_number( arg1 ) )
{
char arg[MAX_INPUT_LENGTH];
int hash, cnt;
int count = number_argument( arg1, arg );
vnum = -1;
for ( hash = cnt = 0; hash < MAX_KEY_HASH; hash++ )
for ( pObjIndex = obj_index_hash[hash];
pObjIndex;
pObjIndex = pObjIndex->next )
if ( nifty_is_name( arg, pObjIndex->name )
&& ++cnt == count )
{
vnum = pObjIndex->ivnum;
break;
}
}
else
vnum = atoi( arg1 );
if ( !obj_exists_index( vnum ) )
{
send_to_char("No such object exists.\n\r", ch);
return;
}
if ( (vnum<VNUM_START_SCRATCH || vnum>VNUM_END_SCRATCH) &&
get_trust(ch) < LEVEL_DEMI )
{
AREA_DATA *pArea;
if ( IS_NPC(ch) )
{
send_to_char( "Huh?\n\r", ch );
return;
}
if ( !ch->pcdata || !(pArea=ch->pcdata->area) )
{
send_to_char( "You must have an assigned area to invoke this object.\n\r", ch );
return;
}
if ( vnum < pArea->low_o_vnum
&& vnum > pArea->hi_o_vnum )
{
send_to_char( "That number is not in your allocated range.\n\r", ch );
return;
}
}
if ( ( obj = create_object( vnum ) ) == NULL )
{
send_to_char( "No object has that vnum.\n\r", ch );
return;
}
if ( CAN_WEAR(obj, ITEM_TAKE) )
obj = obj_to_char( obj, ch );
else
obj = obj_to_room( obj, ch->in_room );
ch_printf(ch, "Object has unum %d\n\r", obj->unum);
if (ch->pcdata && !ch->pcdata->wizinvis)
act( AT_IMMORT, "$n has created $p!", ch, obj, NULL, TO_ROOM );
act( AT_IMMORT, "You have created $p!", ch, obj, NULL, TO_CHAR );
return;
}
void do_load(CHAR_DATA *ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
argument = one_argument(argument, arg);
if (arg[0] == '\0')
{
do_minvoke(ch, "");
do_oinvoke(ch, "");
return;
}
if (!str_prefix(arg, "mobile"))
{
do_minvoke(ch, argument);
}
else if (!str_prefix(arg, "object"))
{
do_oinvoke(ch, argument);
}
else {
send_to_char("Sorry we don't have those here.\n\r", ch);
}
}
void do_purge( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim, *tch;
OBJ_DATA *obj;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
/* 'purge' */
CHAR_DATA *vnext;
OBJ_DATA *obj_next;
for ( victim = ch->in_room->first_person; victim; victim = vnext )
{
vnext = victim->next_in_room;
for (tch=ch->in_room->first_person; tch; tch = tch->next_in_room)
if (!IS_NPC(tch) && tch->dest_buf == victim)
break;
if (tch && !IS_NPC(tch) && tch->dest_buf == victim)
continue;
if ( IS_NPC(victim) && victim != ch && !IS_SET(victim->act, ACT_POLYMORPHED))
extract_char( victim, TRUE );
}
for ( obj = ch->in_room->first_content; obj; obj = obj_next )
{
obj_next = obj->next_content;
for (tch=ch->in_room->first_person; tch; tch = tch->next_in_room)
if (!IS_NPC(tch) && tch->dest_buf == obj)
break;
if (tch && !IS_NPC(tch) && tch->dest_buf == obj)
continue;
extract_obj( obj );
}
act( AT_IMMORT, "$n purges the room!", ch, NULL, NULL, TO_ROOM);
send_to_char( "Ok.\n\r", ch );
return;
}
victim = NULL; obj = NULL;
/* fixed to get things in room first -- i.e., purge portal (obj),
* no more purging mobs with that keyword in another room first
* -- Tri */
if ( ( victim = get_char_room( ch, arg ) ) == NULL
&& ( obj = get_obj_here( ch, arg ) ) == NULL )
{
if ( ( victim = get_char_world( ch, arg ) ) == NULL
&& ( obj = get_obj_world( ch, arg ) ) == NULL ) /* no get_obj_room */
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
}
/* Single object purge in room for high level purge - Scryn 8/12*/
if ( obj )
{
for (tch=ch->in_room->first_person; tch; tch = tch->next_in_room)
if (!IS_NPC(tch) && tch->dest_buf == obj)
{
send_to_char("You cannot purge something being edited.\n\r", ch);
return;
}
separate_obj( obj );
act( AT_IMMORT, "$n purges $p.", ch, obj, NULL, TO_ROOM);
act( AT_IMMORT, "You make $p disappear in a puff of smoke!", ch, obj, NULL, TO_CHAR);
extract_obj( obj );
return;
}
if ( !IS_NPC(victim) )
{
send_to_char( "Not on PC's.\n\r", ch );
return;
}
if ( victim == ch )
{
send_to_char( "You cannot purge yourself!\n\r", ch );
return;
}
for (tch=ch->in_room->first_person; tch; tch = tch->next_in_room)
if (!IS_NPC(tch) && tch->dest_buf == victim)
{
send_to_char("You cannot purge something being edited.\n\r", ch);
return;
}
if (IS_SET(victim->act, ACT_POLYMORPHED))
{
send_to_char("You cannot purge a polymorphed player.\n\r", ch);
return;
}
act( AT_IMMORT, "$n purges $N.", ch, NULL, victim, TO_NOTVICT );
act( AT_IMMORT, "You purge $N.", ch, NULL, victim, TO_CHAR );
send_to_char("Ok.\n\r", ch);
extract_char( victim, TRUE );
return;
}
void do_low_purge( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
OBJ_DATA *obj;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Purge what?\n\r", ch );
return;
}
victim = NULL; obj = NULL;
if ( ( victim = get_char_room( ch, arg ) ) == NULL
&& ( obj = get_obj_here ( ch, arg ) ) == NULL )
{
send_to_char( "You can't find that here.\n\r", ch );
return;
}
if ( obj )
{
separate_obj( obj );
act( AT_IMMORT, "$n purges $p!", ch, obj, NULL, TO_ROOM );
act( AT_IMMORT, "You make $p disappear in a puff of smoke!", ch, obj, NULL, TO_CHAR );
extract_obj( obj );
return;
}
if ( !IS_NPC(victim) )
{
send_to_char( "Not on PC's.\n\r", ch );
return;
}
if ( victim == ch )
{
send_to_char( "You cannot purge yourself!\n\r", ch );
return;
}
act( AT_IMMORT, "$n purges $N.", ch, NULL, victim, TO_NOTVICT );
act( AT_IMMORT, "You make $N disappear in a puff of smoke!", ch, NULL, victim, TO_CHAR );
extract_char( victim, TRUE );
return;
}
void do_balzhur( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
CHAR_DATA *victim;
AREA_DATA *pArea, *pArea_next;
int sn;
int i;
int level;
if ( IS_NPC(ch) )
return;
argument = one_argument( argument, arg );
argument = one_argument( argument, arg2 );
if (is_number(arg2))
{
level = atoi(arg2);
}
else
{
send_to_char( "Usage: demote <char> <level>\n\r", ch);
return;
}
if ( arg[0] == '\0' )
{
send_to_char( "Who is deserving of such a fate?\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL )
{
send_to_char( "They aren't playing.\n\r", ch);
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "Not on NPC's.\n\r", ch );
return;
}
if ( GetMaxLevel(victim) >= get_trust( ch ) )
{
send_to_char( "I wouldn't even think of that if I were you...\n\r", ch );
return;
}
send_to_char( "You summon the demon Balzhur to wreak your wrath!\n\r", ch );
send_to_char( "Balzhur sneers at you evilly, then vanishes in a puff of smoke.\n\r", ch );
send_to_char( "You hear an ungodly sound in the distance that makes your blood run cold!\n\r", victim );
sprintf( buf, "Balzhur screams, 'You are MINE %s!!!'", victim->name );
echo_to_all( AT_IMMORT, buf, ECHOTAR_ALL );
for (i = 0; i < MAX_CLASS; ++i) {
if (HAD_CLASS(victim, i)) {
victim->classes[i] = 0;
GET_LEVEL(victim, i) = 0;
} else if (IS_ACTIVE(victim, i)) {
GET_LEVEL(victim, i) = level;
} else {
GET_LEVEL(victim, i) = 0;
}
}
victim->trust = level;
victim->exp = 2000;
victim->max_hit = 10;
victim->max_mana = 0;
victim->max_move = 0;
for ( sn = 0; sn < top_sn; sn++ )
victim->pcdata->learned[sn] = 0;
victim->practice = 0;
GET_HIT(victim) = GET_MAX_HIT(victim);
GET_MANA(victim) = GET_MAX_MANA(victim);
GET_MOVE(victim) = GET_MAX_MOVE(victim);
sprintf( buf, "%s%s", GOD_DIR, capitalize(victim->name) );
if ( !remove( buf ) )
send_to_char( "Player's immortal data destroyed.\n\r", ch );
else if ( errno != ENOENT )
{
ch_printf( ch, "Unknown error #%d - %s (immortal data). Report to Thoric\n\r",
errno, strerror( errno ) );
sprintf( buf2, "%s balzhuring %s", ch->name, buf );
perror( buf2 );
}
sprintf( buf2, "%s.are", capitalize(arg) );
for ( pArea = first_build; pArea; pArea = pArea_next )
{
pArea_next = pArea->next;
if ( !pArea->filename )
continue;
if ( !strcmp( pArea->filename, buf2 ) )
{
sprintf( buf, "%s%s", BUILD_DIR, buf2 );
if ( IS_SET( pArea->status, AREA_LOADED ) )
fold_area( pArea, buf, FALSE );
close_area( pArea, TRUE );
sprintf( buf2, "%s.bak", buf );
set_char_color( AT_RED, ch ); /* Log message changes colors */
if ( !rename( buf, buf2 ) )
send_to_char( "Player's area data destroyed. Area saved as backup.\n\r", ch);
else if ( errno != ENOENT )
{
ch_printf( ch, "Unknown error #%d - %s (area data). Report to Thoric.\n\r",
errno, strerror( errno ) );
sprintf( buf2, "%s destroying %s", ch->name, buf );
perror( buf2 );
}
}
}
make_wizlist();
do_help(victim, "M_BALZHUR_" );
send_to_char( "You awake after a long period of time...\n\r", victim );
while ( victim->first_carrying )
extract_obj( victim->first_carrying );
return;
}
void do_advance( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char arg3[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
int level;
int iLevel;
sh_int ch_class;
if ( IS_NPC(ch) )
return;
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
argument = one_argument( argument, arg3 );
if ( arg1[0] == '\0' || arg2[0] == '\0' ||
arg3[0] == '\0' || !is_number(arg3) )
{
send_to_char( "Syntax: advance <char> <class name> <level>\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
{
send_to_char( "That player is not here.\n\r", ch);
return;
}
if ( IS_NPC(victim) )
{
send_to_char( "Not on NPC's.\n\r", ch );
return;
}
/* You can demote yourself but not someone else at your own trust.
* -- Narn
*/
if ( get_trust( ch ) <= get_trust( victim ) && ch != victim )
{
send_to_char( "You can't do that.\n\r", ch );
return;
}
if ( ( level = atoi( arg3 ) ) < 1 || level > MAX_LEVEL )
{
send_to_char( "Level must be 1 to 75.\n\r", ch );
return;
}
if ( ( ch_class = get_classtype( arg2 ) ) < 0 )
{
send_to_char( "Invalid Class.\n\r", ch);
return;
}
if ( level > get_trust( ch ) )
{
send_to_char( "Limited to your trust level.\n\r", ch );
return;
}
/*
* Lower level:
* Reset to level 1.
* Then raise again.
* Currently, an imp can lower another imp.
* -- Swiftest
*/
if ( level <= GET_LEVEL(victim, ch_class) )
{
send_to_char("You can't lower a level with advance.\n\r", ch);
}
else
{
send_to_char( "Raising a player's level!\n\r", ch );
if (GET_LEVEL(victim, ch_class) >= LEVEL_AVATAR)
{
act( AT_IMMORT, "$n makes some arShowing the first 100 KB of 248.4 KB. Download the archive for the full file.