act_info.c
ackmud/src/act_info.c · 173.3 KB
From the archive ack43mud.tar.gz
Download the archive « Back to the archive contents
/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* Ack 2.2 improvements copyright (C) 1994 by Stephen Dooley *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* _/ _/_/_/ _/ _/ _/ ACK! MUD is modified *
* _/_/ _/ _/ _/ _/ Merc2.0/2.1/2.2 code *
* _/ _/ _/ _/_/ _/ (c)Stephen Zepp 1998 *
* _/_/_/_/ _/ _/ _/ Version #: 4.3 *
* _/ _/ _/_/_/ _/ _/ _/ *
* *
* http://ackmud.nuc.net/ *
* zenithar@ackmud.nuc.net *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "ack.h"
#include "tables.h"
#include "cursor.h"
#include <math.h>
#ifndef DEC_MAGIC_H
#include "magic.h"
#endif
#ifndef DEC_MONEY_H
#include "money.h"
#endif
extern bool deathmatch;
char * const where_name [] =
{
" ", /* light */
"-*floating above*- ",
"-*enveloped by*- ",
"-*worn on horns*- ",
"-*worn on head*- ",
"-*worn on face*- ",
"-*worn on beak*- ",
"-*worn on ear*- ",
"-*worn on ear*- ",
"-*worn on neck*- ",
"-*worn on neck*- ", /* 10 */
"-*worn on wings*- ",
"-*worn on shoulders*- ",
"-*worn on arms*- ",
"-*worn around wrist*- ",
"-*worn around wrist*- ", /* 15 */
"-*worn on hands*- ",
"-*worn on finger*- ",
"-*worn on finger*- ",
"-*worn on claws*- ",
"-*held in left hand*- ", /* 20 */
"-*held in right hand*-",
"-*worn as a cape*- ",
"-*worn about waist*- ",
"-*worn on body*- ",
"-*worn on tail*- ",
"-*worn on legs*- ",
"-*worn on feet*- ",
"-*worn on hooves*- ",
};
/*
* Local functions.
*/
char * format_obj_to_char args( ( OBJ_DATA *obj, CHAR_DATA *ch,
bool fShort ) );
void show_list_to_char args( ( OBJ_DATA *list, CHAR_DATA *ch,
bool fShort, bool fShowNothing ) );
void show_char_to_char_0 args( ( CHAR_DATA *victim, CHAR_DATA *ch ) );
void show_char_to_char_1 args( ( CHAR_DATA *victim, CHAR_DATA *ch ) );
void show_char_to_char args( ( CHAR_DATA *list, CHAR_DATA *ch ) );
bool check_blind args( ( CHAR_DATA *ch ) );
char *format_obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort )
{
static char buf[MAX_STRING_LENGTH];
sprintf( buf, "%s", color_string( ch, "objects" ) );
if ( IS_OBJ_STAT(obj, ITEM_INVIS) ) safe_strcat(MAX_STRING_LENGTH, buf, "(Invis) " );
if ( ( IS_AFFECTED(ch, AFF_DETECT_EVIL) || item_has_apply( ch, ITEM_APPLY_DET_EVIL ) )
&& IS_OBJ_STAT(obj, ITEM_EVIL) ) safe_strcat(MAX_STRING_LENGTH, buf, "(Red Aura) " );
if ( ( IS_AFFECTED(ch, AFF_DETECT_MAGIC)|| item_has_apply( ch, ITEM_APPLY_DET_MAG) )
&& IS_OBJ_STAT(obj, ITEM_MAGIC) ) safe_strcat(MAX_STRING_LENGTH, buf, "(Magical) " );
if ( IS_OBJ_STAT(obj, ITEM_GLOW) ) safe_strcat(MAX_STRING_LENGTH, buf, "(Glowing) " );
if ( IS_OBJ_STAT(obj, ITEM_HUM) ) safe_strcat(MAX_STRING_LENGTH, buf, "(Humming) " );
if ( fShort )
{
if ( obj->short_descr != NULL )
safe_strcat(MAX_STRING_LENGTH, buf, obj->short_descr );
}
else
{
if ( obj->description != NULL )
safe_strcat(MAX_STRING_LENGTH, buf, obj->description );
}
safe_strcat( MAX_STRING_LENGTH, buf, color_string( ch, "normal" ) );
return buf;
}
/*
* Show a list to a character.
* Can coalesce duplicated items.
*/
void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing )
{
char buf[MAX_STRING_LENGTH];
char **prgpstrShow;
int *prgnShow;
char *pstrShow;
OBJ_DATA *obj;
int nShow;
int iShow;
int count;
bool fCombine;
if ( ch->desc == NULL )
return;
buf[0] = '\0';
/*
* Alloc space for output lines.
*/
count = 0;
for ( obj = list; obj != NULL; obj = obj->next_in_carry_list )
count++;
prgpstrShow = qgetmem( count * sizeof(char *) );
prgnShow = qgetmem( count * sizeof(int) );
nShow = 0;
/*
* Format the list of objects.
*/
for ( obj = list; obj != NULL; obj = obj->next_in_carry_list )
{
if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) )
{
pstrShow = format_obj_to_char( obj, ch, fShort );
fCombine = FALSE;
if ( IS_NPC(ch) || IS_SET(ch->config, CONFIG_COMBINE) )
{
/*
* Look for duplicates, case sensitive.
* Matches tend to be near end so run loop backwords.
*/
for ( iShow = nShow - 1; iShow >= 0; iShow-- )
{
if ( !strcmp( prgpstrShow[iShow], pstrShow ) )
{
prgnShow[iShow]++;
fCombine = TRUE;
break;
}
}
}
/*
* Couldn't combine, or didn't want to.
*/
if ( !fCombine )
{
prgpstrShow [nShow] = str_dup( pstrShow );
prgnShow [nShow] = 1;
nShow++;
}
}
}
/*
* Output the formatted list.
*/
for ( iShow = 0; iShow < nShow; iShow++ )
{
if ( IS_NPC(ch) || IS_SET(ch->config, CONFIG_COMBINE) )
{
if ( prgnShow[iShow] != 1 )
{
sprintf( buf, "(%2d) ", prgnShow[iShow] );
send_to_char( buf, ch );
}
else
{
send_to_char( " ", ch );
}
}
send_to_char( prgpstrShow[iShow], ch );
send_to_char( "\n\r", ch );
free_string( prgpstrShow[iShow] );
}
if ( fShowNothing && nShow == 0 )
{
if ( IS_NPC(ch) || IS_SET(ch->config, CONFIG_COMBINE) )
send_to_char( " ", ch );
send_to_char( "Nothing.\n\r", ch );
}
/*
* Clean up.
*/
qdispose( prgpstrShow, count * sizeof(char *) );
qdispose( prgnShow, count * sizeof(int) );
return;
}
void show_room_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing )
{
char buf[MAX_STRING_LENGTH];
char **prgpstrShow;
int *prgnShow;
char *pstrShow;
OBJ_DATA *obj;
int nShow;
int iShow;
int count;
bool fCombine;
if ( ch->desc == NULL )
return;
buf[0] = '\0';
/*
* Alloc space for output lines.
*/
count = 0;
for ( obj = list; obj != NULL; obj = obj->next_in_room )
count++;
prgpstrShow = qgetmem( count * sizeof(char *) );
prgnShow = qgetmem( count * sizeof(int) );
nShow = 0;
/*
* Format the list of objects.
*/
for ( obj = list; obj != NULL; obj = obj->next_in_room )
{
if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) && str_cmp( obj->description, "" ) )
{
pstrShow = format_obj_to_char( obj, ch, fShort );
fCombine = FALSE;
if ( IS_NPC(ch) || IS_SET(ch->config, CONFIG_COMBINE) )
{
/*
* Look for duplicates, case sensitive.
* Matches tend to be near end so run loop backwords.
*/
for ( iShow = nShow - 1; iShow >= 0; iShow-- )
{
if ( !strcmp( prgpstrShow[iShow], pstrShow ) )
{
prgnShow[iShow]++;
fCombine = TRUE;
break;
}
}
}
/*
* Couldn't combine, or didn't want to.
*/
if ( !fCombine )
{
prgpstrShow [nShow] = str_dup( pstrShow );
prgnShow [nShow] = 1;
nShow++;
}
}
}
/*
* Output the formatted list.
*/
for ( iShow = 0; iShow < nShow; iShow++ )
{
if ( ( IS_NPC(ch) || IS_SET(ch->config, CONFIG_COMBINE) ) && str_cmp( prgpstrShow[iShow], "" ) )
{
if ( prgnShow[iShow] != 1 )
{
sprintf( buf, "(%2d) ", prgnShow[iShow] );
send_to_char( buf, ch );
}
else
{
send_to_char( " ", ch );
}
}
send_to_char( prgpstrShow[iShow], ch );
send_to_char( "\n\r", ch );
free_string( prgpstrShow[iShow] );
}
if ( fShowNothing && nShow == 0 )
{
if ( IS_NPC(ch) || IS_SET(ch->config, CONFIG_COMBINE) )
send_to_char( " ", ch );
send_to_char( "Nothing.\n\r", ch );
}
/*
* Clean up.
*/
qdispose( prgpstrShow, count * sizeof(char *));
qdispose( prgnShow, count * sizeof(int) );
return;
}
void show_char_to_char_0( CHAR_DATA *victim, CHAR_DATA *ch )
{
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
sprintf( buf, "%s", color_string( ch, "mobiles" ) );
buf2[0] = '\0';
/* This is temporary....
* Zen WOLF
*
*/
if ( !IS_NPC( victim ) && IS_WOLF( victim ) )
{
if ( IS_SHIFTED( victim ) )
{
send_to_char( "A large wolf scampers before you.@@N\n\r", ch );
return;
}
else
if ( IS_RAGED( victim ) )
{
send_to_char( "A @@bWEREWOLF in @@rFULL RAGE stands before you!\n\r", ch );
return;
}
}
if ( !IS_NPC( victim ) )
{
/* Then show what race they are (about time this added ;) */
sprintf( buf2, "(%s) ", race_table[victim->race].race_name );
safe_strcat(MAX_STRING_LENGTH, buf, buf2 );
}
if ( IS_NPC( victim ) )
{
if ( IS_SET( victim->act, ACT_UNDEAD ) &&
( is_affected( ch, skill_lookup( "detect undead" ) ) || item_has_apply( ch, ITEM_APPLY_DET_UNDEAD ) ) )
safe_strcat(MAX_STRING_LENGTH, buf, "(UnDead) " );
if ( IS_SET( victim->act, ACT_INTELLIGENT ) )
safe_strcat( MAX_STRING_LENGTH, buf, "(Int) ");
}
if ( IS_AFFECTED(victim, AFF_INVISIBLE) ) safe_strcat(MAX_STRING_LENGTH, buf, "(Invis) " );
if ( IS_AFFECTED(victim, AFF_HIDE) || item_has_apply( victim, ITEM_APPLY_HIDE ) )
safe_strcat(MAX_STRING_LENGTH, buf, "(Hide) " );
if ( IS_AFFECTED(victim, AFF_CHARM) ) safe_strcat(MAX_STRING_LENGTH, buf, "(Charm) " );
if ( IS_AFFECTED(victim, AFF_PASS_DOOR) || item_has_apply( victim, ITEM_APPLY_PASS_DOOR) )
safe_strcat(MAX_STRING_LENGTH, buf, "(Clear) ");
if ( IS_AFFECTED(victim, AFF_FAERIE_FIRE) ) safe_strcat(MAX_STRING_LENGTH, buf, "(Pink) " );
if ( IS_EVIL(victim)
&& (IS_AFFECTED(ch, AFF_DETECT_EVIL)|| item_has_apply( ch, ITEM_APPLY_DET_EVIL) ) )
safe_strcat(MAX_STRING_LENGTH, buf, "(Red) " );
if ( IS_AFFECTED(victim, AFF_SANCTUARY) || item_has_apply( victim, ITEM_APPLY_SANC ) )
safe_strcat(MAX_STRING_LENGTH, buf, "(White) " );
if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER ) )
safe_strcat(MAX_STRING_LENGTH, buf, "(KILLER) " );
if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF ) )
safe_strcat(MAX_STRING_LENGTH, buf, "(THIEF) " );
/* strcat to buf *linkdead* if not connected? */
if ( !IS_NPC(victim) )
if ( (victim->desc) != NULL
&& victim->desc->connected != CON_PLAYING )
safe_strcat( MAX_STRING_LENGTH, buf, "(LINKDEAD)" );
if ( !IS_NPC( victim ) && IS_SET( victim->pcdata->pflags, PFLAG_RULER ) )
safe_strcat( MSL, buf,
get_ruler_title( victim->pcdata->ruler_rank, victim->login_sex ) );
if ( victim->position == POS_STANDING && victim->long_descr[0] != '\0' )
{
safe_strcat(MAX_STRING_LENGTH, buf, victim->long_descr );
safe_strcat(MAX_STRING_LENGTH, buf, color_string( ch, "normal" ) );
if ( ( IS_AFFECTED( victim, AFF_CLOAK_FLAMING ) )
|| ( IS_AFFECTED( victim, AFF_CLOAK_ABSORPTION ) )
|| ( IS_AFFECTED( victim, AFF_CLOAK_REFLECTION ) )
|| ( is_affected( victim, skill_lookup( "cloak:misery" ) ) ) )
{
safe_strcat( MAX_STRING_LENGTH, buf, " @@NCLOAK:" );
if ( IS_AFFECTED( victim, AFF_CLOAK_FLAMING ) )
safe_strcat( MAX_STRING_LENGTH, buf, " @@eFLAMING@@N" );
if ( IS_AFFECTED( victim, AFF_CLOAK_ABSORPTION ) )
safe_strcat( MAX_STRING_LENGTH, buf, " @@lABSORB@@N" );
if ( IS_AFFECTED( victim, AFF_CLOAK_REFLECTION ) )
safe_strcat( MAX_STRING_LENGTH, buf, " @@mREFLECT@@N" );
if ( is_affected( victim, skill_lookup( "cloak:misery" ) ) )
safe_strcat( MSL, buf, " @@RMISERY@@N" );
safe_strcat( MAX_STRING_LENGTH, buf, "\n\r" );
}
if ( victim->first_shield != NULL )
{
MAGIC_SHIELD * this_shield;
safe_strcat( MSL, buf, " @@WSHIELD: @@N" );
for ( this_shield = victim->first_shield; this_shield != NULL; this_shield = this_shield->next )
safe_strcat( MSL, buf, this_shield->name );
safe_strcat( MSL, buf, "\n\r" );
}
send_to_char( buf, ch );
return;
}
safe_strcat(MAX_STRING_LENGTH, buf, PERS( victim, ch ) );
if ( !IS_NPC(victim) && !IS_SET(ch->config, CONFIG_BRIEF) )
safe_strcat(MAX_STRING_LENGTH, buf, victim->pcdata->title );
switch ( victim->position )
{
case POS_DEAD: safe_strcat(MAX_STRING_LENGTH, buf, " is DEAD!!" ); break;
case POS_MORTAL: safe_strcat(MAX_STRING_LENGTH, buf, " is mortally wounded." ); break;
case POS_INCAP: safe_strcat(MAX_STRING_LENGTH, buf, " is incapacitated." ); break;
case POS_STUNNED: safe_strcat(MAX_STRING_LENGTH, buf, " is lying here stunned." ); break;
case POS_SLEEPING: safe_strcat(MAX_STRING_LENGTH, buf, " is sleeping here." ); break;
case POS_RESTING:
if ( victim->sitting != NULL
&& victim->sitting->in_room == victim->in_room )
{
char sit[MAX_INPUT_LENGTH];
sprintf( sit, " is here, resting on %s.", victim->sitting->short_descr );
safe_strcat( MAX_STRING_LENGTH, buf, sit );
}
else
safe_strcat(MAX_STRING_LENGTH, buf, " is resting here." );
break;
case POS_STANDING:
{
safe_strcat(MAX_STRING_LENGTH, buf, " is here" );
if ( !IS_NPC( victim )
&& ( victim->stance > 0 )
&& ( victim->stance != STANCE_AMBUSH ) )
{
char stance_buf[MSL];
sprintf( stance_buf, " in the Stance of the %s.", stance_app[victim->stance].name );
safe_strcat( MSL, buf, stance_buf );
}
else
safe_strcat( MSL, buf, "." );
break;
}
case POS_WRITING: safe_strcat(MAX_STRING_LENGTH, buf, " is writing a note." ); break;
case POS_BUILDING: safe_strcat(MAX_STRING_LENGTH, buf, " is BUILDING!!" ); break;
case POS_FIGHTING:
safe_strcat(MAX_STRING_LENGTH, buf, " is here, fighting " );
if ( victim->fighting == NULL )
safe_strcat(MAX_STRING_LENGTH, buf, "thin air??" );
else if ( victim->fighting == ch )
safe_strcat(MAX_STRING_LENGTH, buf, "YOU!" );
else if ( victim->in_room == victim->fighting->in_room )
{
safe_strcat(MAX_STRING_LENGTH, buf, PERS( victim->fighting, ch ) );
safe_strcat(MAX_STRING_LENGTH, buf, "." );
}
else
safe_strcat(MAX_STRING_LENGTH, buf, "somone who left??" );
break;
}
/* buf[0] = UPPER(buf[0]); */
safe_strcat( MAX_STRING_LENGTH, buf, color_string( ch, "normal" ) );
safe_strcat(MAX_STRING_LENGTH, buf, "\n\r" );
if ( ( IS_AFFECTED( victim, AFF_CLOAK_FLAMING ) )
|| ( IS_AFFECTED( victim, AFF_CLOAK_ADEPT ) )
|| ( IS_AFFECTED( victim, AFF_CLOAK_REGEN ) )
|| ( IS_AFFECTED( victim, AFF_CLOAK_ABSORPTION ) )
|| ( IS_AFFECTED( victim, AFF_CLOAK_REFLECTION ) )
|| ( is_affected( victim, skill_lookup( "cloak:misery" ) ) ) )
{
safe_strcat( MAX_STRING_LENGTH, buf, " @@NCLOAK:" );
if ( IS_AFFECTED( victim, AFF_CLOAK_FLAMING ) )
safe_strcat( MAX_STRING_LENGTH, buf, " @@eFLAMING@@N" );
if ( IS_AFFECTED( victim, AFF_CLOAK_ABSORPTION ) )
safe_strcat( MAX_STRING_LENGTH, buf, " @@lABSORB@@N" );
if ( IS_AFFECTED( victim, AFF_CLOAK_REFLECTION ) )
safe_strcat( MAX_STRING_LENGTH, buf, " @@mREFLECT@@N" );
if ( IS_AFFECTED( victim, AFF_CLOAK_ADEPT ) )
safe_strcat( MAX_STRING_LENGTH, buf, " @@WADEPT@@N" );
if ( IS_AFFECTED( victim, AFF_CLOAK_REGEN ) )
safe_strcat( MAX_STRING_LENGTH, buf, " @@rREGEN@@N" );
if ( is_affected( victim, skill_lookup( "cloak:misery" ) ) )
safe_strcat( MSL, buf, " @@RMISERY@@N" );
safe_strcat( MAX_STRING_LENGTH, buf, "\n\r" );
}
if ( victim->first_shield != NULL )
{
MAGIC_SHIELD * this_shield;
safe_strcat( MSL, buf, " @@WSHIELD: @@N" );
for ( this_shield = victim->first_shield; this_shield != NULL; this_shield = this_shield->next )
safe_strcat( MSL, buf, this_shield->name );
safe_strcat( MSL, buf, "\n\r" );
}
if ( victim->riding != NULL )
{
sprintf( buf2, " riding %s.\n\r", victim->riding->short_descr );
safe_strcat( MSL, buf, buf2 );
}
send_to_char( buf, ch );
return;
}
void show_char_to_char_1( CHAR_DATA *victim, CHAR_DATA *ch )
{
char buf[MAX_STRING_LENGTH];
OBJ_DATA *obj;
int iWear;
int pct;
bool found;
buf[0] = '\0';
if ( can_see( victim, ch ) )
{
act( "$n looks at you.", ch, NULL, victim, TO_VICT );
act( "$n looks at $N.", ch, NULL, victim, TO_NOTVICT );
}
if ( victim->description[0] != '\0' )
{
send_to_char( victim->description, ch );
}
else
{
act( "You see nothing special about $M.", ch, NULL, victim, TO_CHAR );
}
if ( victim->max_hit > 0 )
pct = ( 100 * victim->hit ) / victim->max_hit;
else
pct = -1;
strcpy( buf, PERS(victim, ch) );
if ( pct >= 100 ) safe_strcat(MAX_STRING_LENGTH, buf, " is in pristine condition.\n\r" );
else if ( pct >= 90 ) safe_strcat(MAX_STRING_LENGTH, buf, " is slightly scratched.\n\r" );
else if ( pct >= 80 ) safe_strcat(MAX_STRING_LENGTH, buf, " has some light bruising.\n\r" );
else if ( pct >= 70 ) safe_strcat(MAX_STRING_LENGTH, buf, " has some shallow cuts.\n\r" );
else if ( pct >= 60 ) safe_strcat(MAX_STRING_LENGTH, buf, " has several weeping wounds.\n\r" );
else if ( pct >= 50 ) safe_strcat(MAX_STRING_LENGTH, buf, " looks like a traffic accident.\n\r" );
else if ( pct >= 40 ) safe_strcat(MAX_STRING_LENGTH, buf, " is bleeding slowly into a puddle.\n\r" );
else if ( pct >= 30 ) safe_strcat(MAX_STRING_LENGTH, buf, " is spraying blood all over.\n\r" );
else if ( pct >= 20 ) safe_strcat(MAX_STRING_LENGTH, buf, " is having trouble living.\n\r" );
else if ( pct >= 10 ) safe_strcat(MAX_STRING_LENGTH, buf, " looks ready to kick the bucket.\n\r" );
else safe_strcat(MAX_STRING_LENGTH, buf, " is DYING.\n\r" );
buf[0] = UPPER(buf[0]);
send_to_char( buf, ch );
found = FALSE;
if ( !IS_NPC( victim ) && IS_WOLF( victim )
&& ( IS_SHIFTED( victim ) || IS_RAGED( victim ) ) )
{
}
else
{
for ( iWear = 0; iWear < MAX_WEAR; iWear++ )
{
if ( ( obj = get_eq_char( victim, iWear ) ) != NULL
&& can_see_obj( ch, obj ) )
{
if ( !found )
{
send_to_char( "\n\r", ch );
act( "$N is using:", ch, NULL, victim, TO_CHAR );
found = TRUE;
}
send_to_char( where_name[iWear], ch );
send_to_char( format_obj_to_char( obj, ch, TRUE ), ch );
send_to_char( "\n\r", ch );
}
}
if ( victim != ch
&& !IS_NPC(ch)
&& number_percent( ) < ch->pcdata->learned[gsn_peek] )
{
send_to_char( "\n\rYou peek at the inventory:\n\r", ch );
show_list_to_char( victim->first_carry, ch, TRUE, TRUE );
}
}
return;
}
void show_char_to_char( CHAR_DATA *list, CHAR_DATA *ch )
{
CHAR_DATA *rch;
for ( rch = list; rch != NULL; rch = rch->next_in_room )
{
if ( rch == ch )
continue;
if ( !IS_NPC(rch)
&& IS_SET(rch->act, PLR_WIZINVIS)
&& get_trust( ch ) < rch->invis )
continue;
if ( ( rch->rider != NULL )
&& ( rch->rider != ch ) )
continue; /* show under the rider */
if ( can_see( ch, rch ) )
{
show_char_to_char_0( rch, ch );
}
else if ( room_is_dark( ch->in_room )
&& (IS_AFFECTED(rch, AFF_INFRARED )|| item_has_apply( rch, ITEM_APPLY_INFRA)) )
{
send_to_char( "You see glowing red eyes watching YOU!\n\r", ch );
}
}
return;
}
bool check_blind( CHAR_DATA *ch )
{
if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_HOLYLIGHT) )
return TRUE;
if ( IS_AFFECTED(ch, AFF_BLIND) )
{
send_to_char( "You cannot see a thing!\n\r", ch );
return FALSE;
}
return TRUE;
}
void do_look( CHAR_DATA *ch, char *argument )
{
char buf [MAX_STRING_LENGTH];
char arg1 [MAX_INPUT_LENGTH];
char arg2 [MAX_INPUT_LENGTH];
char out [MAX_STRING_LENGTH];
CHAR_DATA *ppl;
ROOM_INDEX_DATA *room;
EXIT_DATA *pexit;
CHAR_DATA *victim;
OBJ_DATA *obj;
char pdesc[MSL];
int door;
bool found;
buf[0] = '\0';
out[0] = '\0';
if ( !IS_NPC( ch ) && ch->desc == NULL )
return;
if ( ch->position < POS_SLEEPING )
{
send_to_char( "You cannot see anything but stars!\n\r", ch );
return;
}
if ( ch->position == POS_SLEEPING )
{
send_to_char( "You are sleeping!\n\r", ch );
return;
}
if ( !check_blind( ch ) )
return;
if ( !IS_NPC(ch)
&& !IS_SET(ch->act, PLR_HOLYLIGHT)
&& room_is_dark( ch->in_room ) )
{
send_to_char( "It is pitch black ... \n\r", ch );
show_char_to_char( ch->in_room->first_person, ch );
return;
}
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) )
{
/* 'look' or 'look auto' */
if ( IS_SWITCHED( ch ) || ( !IS_NPC(ch) && IS_SET(ch->config, CONFIG_MAPPER) ) )
{
send_to_char( "\n\r", ch );
do_mapper( ch, "7" );
send_to_char( "\n\r", ch );
}
else
{
sprintf( out, "%s%s%s\n\r", color_string( ch, "rooms" ),
ch->in_room->name, color_string( ch, "normal" ) );
send_to_char( out, ch );
if ( IS_SWITCHED( ch ) || ( !IS_NPC(ch) && IS_SET(ch->config, CONFIG_AUTOEXIT) ) )
do_exits(ch, "auto" );
if ( arg1[0] == '\0'
|| ( IS_SWITCHED( ch ) || ( !IS_NPC(ch) && !IS_SET(ch->config, CONFIG_BRIEF) ) ) )
{
char *string_format(char *str, int *numlines, int width, int height, bool unjust);
int wid = (IS_NPC(ch) ? 80 : ch->pcdata->term_columns);
sprintf( out, "%s%s%s\n\r", color_string( ch, "rooms" ),
string_format(ch->in_room->description, NULL, wid, 10000,
!IS_SET(ch->config, CONFIG_JUSTIFY)),
color_string( ch, "normal" ) );
send_to_char( out, ch );
}
}
/* Show any room-affects */
if ( ( ch->in_room->affected_by != 0 )
&& ( ( is_affected( ch, skill_lookup( "detect magic" ) ) )
|| ( item_has_apply( ch, ITEM_APPLY_DET_MAG ) ) ) )
{
sprintf( out, "%s", color_string( ch, "rooms" ) );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_SHADE ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA menacing @@ddark shadow@@N hangs in the sky above you.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_ENCAPS ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA barely visible @@renergy web@@N is blocking all exits here.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_FIRE_RUNE ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA mystical @@eFire @@NRune@@N hangs in the air above you.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_SHOCK_RUNE ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA mystical @@lShock@@N Rune@@N hangs in the air above you.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_POISON_RUNE ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA mystical @@dPoison@@N Rune hangs in the air above you.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_HEAL_REGEN ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA majestic @@mHealing Light@@N encompasses the room.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_HEAL_STEAL ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA menacing @@dWithering shadow@@N enfolds the room.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_MANA_REGEN ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA powerful @@eMana Flare@@N empowers the room.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_MANA_STEAL ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA mind sapping @@dMana Drain@@N enfolds the room.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_HOLD ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NThe magical bars of a @@rCage@@N surround the room.\n\r" );
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_SOUL_NET ) )
safe_strcat( MAX_STRING_LENGTH, out, "@@NA demonic @@dSoul Net@@N enshrouds the room.\n\r" );
safe_strcat( MAX_STRING_LENGTH, out, color_string( ch, "normal" ) );
send_to_char( out, ch );
}
if ( !IS_NPC( ch ) && ( IS_VAMP( ch ) || IS_WOLF( ch ) ) )
if ( ch->in_room->first_mark_list != NULL )
{
MARK_LIST_MEMBER *marks;
sh_int num_marks = 0;
for ( marks = ch->in_room->first_mark_list; marks != NULL; marks = marks->next )
if ( ( ( marks->mark->type == WOLF ) && IS_WOLF( ch ) )
|| ( ( marks->mark->type == VAMP ) && IS_VAMP( ch ) ) )
num_marks++;
if ( num_marks > 0 )
{
char marksbuf[MSL];
if ( IS_WOLF( ch ) )
{
sprintf( marksbuf, "@@aThis room has @@W%d @@a%s@@W.@@N\n\r", num_marks, ( num_marks > 1 ) ? "scents" : "scent" );
}
else if ( IS_VAMP( ch ) )
{
sprintf( marksbuf, "@@mThis room has @@W%d @@eBlood%s@@N.\n\r", num_marks, ( num_marks > 1) ? "Signs" : "Sign" );
}
send_to_char( marksbuf, ch );
}
}
show_room_list_to_char( ch->in_room->first_content, ch, FALSE, FALSE );
show_char_to_char( ch->in_room->first_person, ch );
{
char money_show[MSL];
sprintf( money_show, "%s lie in a pile.\n\r", money_string( ch->in_room->treasure ) );
if ( str_prefix( " lie", money_show ) )
send_to_char( money_show, ch );
}
return;
}
if ( !str_cmp( arg1, "i" ) || !str_cmp( arg1, "in" ) )
{
/* 'look in' */
if ( arg2[0] == '\0' )
{
send_to_char( "Look in what?\n\r", ch );
return;
}
if ( ( obj = get_obj_here( ch, arg2 ) ) == NULL )
{
send_to_char( "You do not see that here.\n\r", ch );
return;
}
switch ( obj->item_type )
{
default:
send_to_char( "That is not a container.\n\r", ch );
break;
case ITEM_PORTAL:
if ( obj->value[1] == 0 )
{
act( "You don't seem to be able to look in $p.", ch, obj, NULL, TO_CHAR );
return;
}
if ( ( room = get_room_index( obj->value[0] ) ) == NULL )
{
send_to_char( "You see nothing but blackness!\n\r", ch );
return;
}
act( "$n looks into $p.", ch, obj, NULL, TO_ROOM );
if ( !IS_NPC(ch)
&& !IS_SET(ch->act, PLR_HOLYLIGHT)
&& room_is_dark( ch->in_room ) )
{
act( "$p comes out into a dark place. You see nothing!\n\r", ch, obj, NULL, TO_CHAR );
return;
}
sprintf( buf, "You look in $p and see: %s%s.%s", color_string( ch, "rooms" ),
room->name, color_string( ch, "normal" ) );
act( buf, ch, obj, NULL, TO_CHAR );
found = FALSE;
if ( room->first_person != NULL )
{
send_to_char( "You see the following beings:\n\r", ch );
for ( ppl = room->first_person; ppl != NULL; ppl = ppl->next_in_room )
{
if ( can_see( ch, ppl ) )
{
found = TRUE;
sprintf( buf, "%s%s%s\n\r", color_string( ch, "mobiles" ),
(IS_NPC(ppl) ? ppl->short_descr : ppl->name ),
color_string( ch, "normal" ) );
send_to_char( buf, ch );
}
}
}
if ( !found )
act( "You see no beings through $p.", ch, obj, NULL, TO_CHAR );
if ( room->first_content != NULL )
{
send_to_char( "Some objects are visible:\n\r", ch );
show_room_list_to_char( room->first_content, ch, TRUE, FALSE );
}
else
act( "You see no objects through $p.", ch, obj, NULL, TO_CHAR );
break;
case ITEM_DRINK_CON:
if ( obj->value[1] <= 0 )
{
send_to_char( "It is empty.\n\r", ch );
break;
}
sprintf( buf, "It's %s full of a %s liquid.\n\r",
obj->value[1] < obj->value[0] / 4
? "less than" :
obj->value[1] < 3 * obj->value[0] / 4
? "about" : "more than",
liq_table[obj->value[2]].liq_color
);
send_to_char( buf, ch );
break;
case ITEM_SPELL_MATRIX:
case ITEM_CONTAINER:
case ITEM_CORPSE_NPC:
case ITEM_CORPSE_PC:
if ( IS_SET(obj->value[1], CONT_CLOSED) )
{
send_to_char( "It is closed.\n\r", ch );
break;
}
act( "$p contains:", ch, obj, NULL, TO_CHAR );
show_list_to_char( obj->first_in_carry_list, ch, TRUE, TRUE );
{
char money_show[MSL];
sprintf( money_show, "%s lie within.\n\r", money_string( obj->money ) );
if ( str_prefix( " lie", money_show ) )
send_to_char( money_show, ch );
}
break;
}
return;
}
if ( !str_cmp( arg1, "board" ) || !str_cmp( arg2, "board" ) )
{
/*int bnum;*/
if ( ( obj = get_obj_here( ch, "board" ) ) == NULL )
{
send_to_char( "You do not see that here.\n\r", ch );
return;
}
do_show_contents( ch, obj );
return;
}
if ( ( victim = get_char_room( ch, arg1 ) ) != NULL )
{
show_char_to_char_1( victim, ch );
return;
}
for ( obj = ch->first_carry; obj != NULL; obj = obj->next_in_carry_list)
{
if ( can_see_obj( ch, obj ) )
{
sprintf( pdesc, "\n\r%s", get_extra_descr( arg1, obj->first_exdesc ) );
if ( str_cmp( pdesc, "\n\r(null)" ) )
{
send_to_char( pdesc, ch );
act( "$L$n closely examines $p.", ch, obj, NULL, TO_ROOM );
return;
}
sprintf( pdesc, "\n\r%s", get_extra_descr( arg1, obj->pIndexData->first_exdesc ) );
if ( str_cmp( pdesc, "\n\r(null)" ) )
{
send_to_char( pdesc, ch );
act( "$L$n closely examines $p.", ch, obj, NULL, TO_ROOM );
return;
}
}
if ( is_name( arg1, obj->name ) )
{
send_to_char( obj->description, ch );
return;
}
}
for ( obj = ch->in_room->first_content; obj != NULL; obj = obj->next_in_room)
{
if ( can_see_obj( ch, obj ) )
{
sprintf( pdesc, "\n\r%s", get_extra_descr( arg1, obj->first_exdesc ) );
if ( str_cmp( pdesc, "\n\r(null)" ) )
{
send_to_char( pdesc, ch );
act( "$L$n closely examines $p.", ch, obj, NULL, TO_ROOM );
return;
}
sprintf( pdesc, "\n\r%s", get_extra_descr( arg1, obj->pIndexData->first_exdesc ) );
if ( str_cmp( pdesc, "\n\r(null)" ) )
{
send_to_char( pdesc, ch );
act( "$L$n closely examines $p.", ch, obj, NULL, TO_ROOM );
return;
}
}
if ( is_name( arg1, obj->name ) )
{
send_to_char( obj->description, ch );
act( "$L$n closely examines $p.", ch, obj, NULL, TO_ROOM );
return;
}
}
sprintf( pdesc, "\n\r%s", get_extra_descr( arg1, ch->in_room->first_exdesc ) );
if ( str_cmp( pdesc, "\n\r(null)" ) )
{
send_to_char( pdesc, ch );
act( "$L$n closely examines the $t.", ch, arg1, NULL, TO_ROOM );
return;
}
if ( !str_cmp( arg1, "n" ) || !str_cmp( arg1, "north" ) ) door = 0;
else if ( !str_cmp( arg1, "e" ) || !str_cmp( arg1, "east" ) ) door = 1;
else if ( !str_cmp( arg1, "s" ) || !str_cmp( arg1, "south" ) ) door = 2;
else if ( !str_cmp( arg1, "w" ) || !str_cmp( arg1, "west" ) ) door = 3;
else if ( !str_cmp( arg1, "u" ) || !str_cmp( arg1, "up" ) ) door = 4;
else if ( !str_cmp( arg1, "d" ) || !str_cmp( arg1, "down" ) ) door = 5;
else
{
send_to_char( "You do not see that here.\n\r", ch );
return;
}
/* 'look direction' */
if ( ( pexit = ch->in_room->exit[door] ) == NULL )
{
send_to_char( "Nothing special there.\n\r", ch );
return;
}
if ( ( pexit->description != NULL )
&& ( pexit->description[0] != '\0' )
&& ( ( !str_cmp( pexit->keyword, "" ) )
|| ( ( str_cmp( pexit->keyword, "" ) )
&& ( !str_cmp( pexit->keyword, arg1 ) ) ) ) )
send_to_char( pexit->description, ch );
else
send_to_char( "Nothing special there.\n\r", ch );
if ( ( pexit->keyword != NULL )
&& ( pexit->keyword[0] != '\0' )
&& ( pexit->keyword[0] != ' ' )
&& ( !str_cmp( pexit->keyword, arg1 ) ) )
{
if ( IS_SET(pexit->exit_info, EX_CLOSED) )
{
act( "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR );
}
else if ( IS_SET(pexit->exit_info, EX_ISDOOR) )
{
act( "The $d is open.", ch, NULL, pexit->keyword, TO_CHAR );
}
}
return;
}
void do_examine( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
buf[0] = '\0';
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Examine what?\n\r", ch );
return;
}
do_look( ch, arg );
if ( ( obj = get_obj_here( ch, arg ) ) != NULL )
{
switch ( obj->item_type )
{
default:
break;
case ITEM_DRINK_CON:
case ITEM_CONTAINER:
case ITEM_CORPSE_NPC:
case ITEM_CORPSE_PC:
send_to_char( "When you look inside, you see:\n\r", ch );
sprintf( buf, "in %s", arg );
do_look( ch, buf );
}
if ( ch->position > POS_RESTING )
trigger_handler( ch, obj, TRIGGER_EXAMINE );
}
return;
}
/*
* Thanks to Zrin for auto-exit part.
*/
void do_exits( CHAR_DATA *ch, char *argument )
{
extern char * const compass_name[];
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
EXIT_DATA *pexit;
bool found;
bool fAuto;
int door;
buf[0] = '\0';
buf2[0] = '\0';
fAuto = !str_cmp( argument, "auto" );
if ( !check_blind( ch ) )
return;
strcpy( buf, fAuto ? "[Exits:" : "Obvious exits:\n\r" );
found = FALSE;
for ( door = 0; door <= 5; door++ )
{
/* check for players that are blind (irl) */
if ( !IS_NPC( ch ) && IS_SET( ch->pcdata->pflags, PFLAG_BLIND_PLAYER ) )
{
if ( ( pexit = ch->in_room->exit[door] ) != NULL
&& pexit->to_room != NULL )
{
found = TRUE;
if ( IS_SET( pexit->exit_info, EX_CLOSED ) )
{
sprintf( buf2, " closed %s", ( !str_cmp( pexit->keyword, "" )
? compass_name[door]
: pexit->keyword ) );
}
else
{
sprintf( buf2, " %s", ( !str_cmp( pexit->keyword, "" )
? compass_name[door]
: pexit->keyword ) );
}
safe_strcat( MAX_STRING_LENGTH, buf, buf2 );
continue;
}
}
/* Check for thieves with find_doors... */
if ( !IS_NPC( ch ) )
if ( ( pexit = ch->in_room->exit[door] ) != NULL
&& pexit->to_room != NULL
&& IS_SET( pexit->exit_info, EX_CLOSED )
&& !IS_SET( pexit->exit_info, EX_NODETECT )
&& ( ch->pcdata->learned[gsn_find_doors] > number_percent() )
&& ( !str_cmp( pexit->keyword, "" ) ) )
{
found = TRUE;
if ( fAuto )
sprintf( buf2, " (%s)", compass_name[door] );
else
sprintf( buf2, "%-5s - Door.\n\r",
capitalize( compass_name[door] ) );
safe_strcat( MAX_STRING_LENGTH, buf, buf2 );
continue;
}
if ( ( pexit = ch->in_room->exit[door] ) != NULL
&& pexit->to_room != NULL
&& !IS_SET(pexit->exit_info, EX_CLOSED)
&& ( !str_cmp( pexit->keyword, "" ) ) )
{
found = TRUE;
if ( fAuto )
{
safe_strcat(MAX_STRING_LENGTH, buf, " " );
safe_strcat(MAX_STRING_LENGTH, buf, compass_name[door] );
}
else
{
sprintf( buf + strlen(buf), "%-5s - %s\n\r",
capitalize( compass_name[door] ),
room_is_dark( pexit->to_room )
? "Too dark to tell"
: pexit->to_room->name
);
}
}
}
if ( !found )
safe_strcat(MAX_STRING_LENGTH, buf, fAuto ? " none" : "None.\n\r" );
if ( fAuto )
safe_strcat(MAX_STRING_LENGTH, buf, "]\n\r" );
send_to_char( buf, ch );
return;
}
void do_score( CHAR_DATA *ch, char *argument )
{
/* Score text has been re-formatted to look a little nicer ;)
* Affected by now dealt with by command 'affected'
* Also now added color
* -- Stephen
*/
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int cnt;
sprintf( buf, "@@y%s%s, Race: %s%s, Clan: %s\n\rAge: ",
IS_NPC(ch) ? ch->short_descr : ch->name,
IS_NPC(ch) ? "" : ch->pcdata->title,
IS_NPC(ch) ? "n/a" : race_table[ch->race].race_title,
IS_VAMP(ch) ? "@@e(Vampire)@@N" : IS_WOLF( ch ) ? "@@r(Werewolf)@@N" : "",
IS_NPC(ch) ? "n/a" : clan_table[ch->pcdata->clan].clan_name );
my_get_age( ch, buf );
send_to_char( buf, ch );
sprintf( buf, " (%d hours RL)\n\r", my_get_hours( ch ) );
send_to_char( buf, ch );
/*
sprintf( buf,
"@@WYou are: @@y%s%s \n\r@@WAge: @@y%d @@W( @@y%d @@Whrs ) Race: @@y%s @@WClan: @@y%s.@@g\n\r",
IS_NPC(ch) ? ch->short_descr : ch->name,
IS_NPC(ch) ? "" : ch->pcdata->title,
get_age(ch),
(get_age(ch) - 17) * 2,
IS_NPC(ch) ? "n/a" : IS_VAMP(ch) ? "Vampire" : race_table[ch->race].race_title,
IS_NPC(ch) ? " n/a" : clan_table[ch->pcdata->clan].clan_name );
send_to_char( buf, ch );
*/
sprintf( buf,
"@@c+===============================================================+\n\r");
send_to_char( buf, ch );
sprintf( buf,
"| @@y%4d/%4d @@WHit @@y%4d/%4d @@WMana @@y%4d/%4d @@WMovement @@y%3d @@WPractices@@c |\n\r",
ch->hit, ch->max_hit,
ch->mana, ch->max_mana,
ch->move, ch->max_move,
ch->practice );
send_to_char( buf, ch );
if ( IS_NPC( ch ) )
{
sprintf( buf,
"| @@R[ @@WStr: @@y%2d @@WInt: @@y%2d @@WWis: @@y%2d @@WDex: @@y%2d @@WCon: @@y%2d @@R] @@c|\n\r",
get_curr_str( ch ), get_curr_int( ch ),
get_curr_wis( ch ), get_curr_dex( ch ),
get_curr_con( ch ) );
send_to_char( buf, ch );
}
else
{
sprintf( buf,
"| @@R[ @@WStr:@@y%2d/%2d @@WInt:@@y%2d/%2d @@WWis:@@y%2d/%2d @@WDex:@@y%2d/%2d @@WCon:@@y%2d/%2d @@R] @@c|\n\r",
get_curr_str(ch), ch->pcdata->max_str,
get_curr_int(ch), ch->pcdata->max_int,
get_curr_wis(ch), ch->pcdata->max_wis,
get_curr_dex(ch), ch->pcdata->max_dex,
get_curr_con(ch), ch->pcdata->max_con );
send_to_char( buf, ch );
}
if ( !IS_NPC( ch ) )
{
buf2[0] = '\0';
for ( cnt = 0; cnt < MAX_CLASS; cnt++ )
{
sprintf( buf, "@@c%s", class_table[cnt].who_name );
safe_strcat(MAX_STRING_LENGTH, buf2, buf );
if ( ch->lvl[cnt] != -1 )
sprintf( buf, ":@@W%2d ", ch->lvl[cnt] );
else
sprintf( buf, "@@c:%s ", " 0" );
safe_strcat(MAX_STRING_LENGTH, buf2, buf );
}
}
else
sprintf( buf2, " @@WLevel: @@y%d", ch->level );
sprintf( buf, "@@c|%s @@c|\n\r", center_text(buf2, 62) );
send_to_char( buf, ch );
buf2[0] = '\0';
if ( is_remort( ch ) )
{
for ( cnt = 0; cnt < MAX_CLASS; cnt++ )
{
if ( ch->lvl2[cnt] != -1 )
{
sprintf( buf, "@@m%s:@@W%2d ",
remort_table[cnt].who_name, ch->lvl2[cnt] );
safe_strcat(MAX_STRING_LENGTH, buf2, buf );
}
}
sprintf( buf, "@@c|%s @@c|\n\r", center_text(buf2, 62) );
send_to_char( buf, ch );
}
if ( ch->adept_level > 0 )
{
sprintf( buf, "@@WADEPT@@N: %s ", get_adept_name( ch ) );
buf2[0] = '\0';
safe_strcat( MAX_STRING_LENGTH, buf2, buf );
sprintf( buf, "@@c|%s @@c|\n\r", center_text(buf2, 62) );
send_to_char( buf, ch );
}
sprintf( buf,
"X========= @@WExps: @@y%9d @@c========= @@aQuest Points: @@y%4d @@c========X\n\r",
ch->exp, ch->quest_points);
send_to_char( buf, ch );
if ( get_trust( ch ) != ch->level )
{
sprintf( buf,
"X================= @@WYou are trusted at level @@y%2d @@c=================X\n\r",
get_trust( ch ) );
send_to_char( buf, ch );
}
sprintf( buf,
"| @@WYou are carrying @@y%4d/%4d @@Witems, weight @@y%4.2f/%7d @@Wkg. @@c|\n\r",
ch->carry_number, can_carry_n(ch),
ch->carry_weight, can_carry_w(ch) );
send_to_char( buf, ch );
sprintf( buf,
"| @@WAutoexit: @@y%s @@WAutoloot: @@y%s @@WAutosac: @@y%s @@c|\n\r",
(!IS_NPC(ch) && IS_SET(ch->config, CONFIG_AUTOEXIT)) ? "*ON* " : "*OFF*",
(!IS_NPC(ch) && IS_SET(ch->config, CONFIG_AUTOLOOT)) ? "*ON* " : "*OFF*",
(!IS_NPC(ch) && IS_SET(ch->config, CONFIG_AUTOSAC) ) ? "*ON* " : "*OFF*" );
send_to_char( buf, ch );
if ( !IS_NPC( ch ) )
{
sprintf( buf, " @@WYou have killed a total of: @@y%d @@WNPCs, and @@y%d @@WPlayers.",
ch->pcdata->mkills, ch->pcdata->pkills );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf,62) );
send_to_char( buf2, ch );
sprintf( buf, " @@WA total of @@y%d @@WNPCs and @@y%d @@WPlayers have killed you.",
ch->pcdata->mkilled, ch->pcdata->pkilled );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf, 62 ) );
send_to_char( buf2, ch );
sprintf( buf, " @@WWimpy Set to @@y%d @@WHitPoints. Page Length is @@y%d @@Wlines.",
ch->wimpy, ch->pcdata->pagelen );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf, 62) );
send_to_char( buf2, ch );
sprintf( buf, " @@WDrunk: @@y%3s @@WThirsty: @@y%3s @@WHungry: @@y%3s",
( ch->pcdata->condition[COND_DRUNK] > 10 ) ? "Yes" : "No",
( ch->pcdata->condition[COND_THIRST] == 0 ) ? "Yes" : "No",
( ch->pcdata->condition[COND_FULL] == 0 ) ? "Yes" : "No" );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf,62) );
send_to_char( buf2, ch );
if ( IS_VAMP( ch ) )
{
sprintf( buf, "@@eBLOODLUST@@W: @@e%d@@W/@@e%d@@N", ch->pcdata->bloodlust, ch->pcdata->bloodlust_max );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf,62) );
send_to_char( buf2, ch );
sprintf( buf, "@@dKindred Rank:@@N %d @@rGeneration:@@N %d @@mKnowledge Avail:@@N %d",
ch->pcdata->vamp_level, ch->pcdata->generation, ch->pcdata->vamp_pracs );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf, 62) );
send_to_char( buf2, ch );
sprintf( buf, "@@WFAMILY: %s", get_family_name( ch ) );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf, 62) );
send_to_char( buf2, ch );
}
else
if ( IS_WOLF( ch ) )
{
sprintf( buf, "@@eRAGE@@W: @@e%d@@W/@@e%d@@N", ch->pcdata->bloodlust, ch->pcdata->bloodlust_max );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf,62) );
send_to_char( buf2, ch );
sprintf( buf, "@@rTribe Rank@@W:@@N %d @@yTribe Standing@@W:@@N %s @@GKnowledge Avail:@@N %d",
ch->pcdata->vamp_level, get_tribe_standing_name( ch->pcdata->generation ), ch->pcdata->vamp_pracs );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf, 62) );
send_to_char( buf2, ch );
sprintf( buf, "@@bTRIBE: %s", get_tribe_name( ch ) );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf, 62) );
send_to_char( buf2, ch );
}
}
sprintf( buf, "%s", "" );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf, 62) );
send_to_char( buf2, ch );
sprintf( buf, "@@WYou have assumed the @@yStance @@Wof the@@N %s.", stance_app[ch->stance].name );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf, 62) );
send_to_char( buf2, ch );
switch ( ch->position )
{
case POS_DEAD:
sprintf( buf, " You are @@yDEAD!!" );
break;
case POS_MORTAL:
sprintf( buf, " You are @@ymortally wounded." );
break;
case POS_INCAP:
sprintf( buf, " You are @@yincapaciated." );
break;
case POS_STUNNED:
sprintf( buf, " You are @@ystunned." );
break;
case POS_SLEEPING:
sprintf( buf, " You are @@ysleeping." );
break;
case POS_RESTING:
sprintf( buf, " You are @@yresting." );
break;
case POS_STANDING:
sprintf( buf, " You are @@ystanding." );
break;
case POS_FIGHTING:
sprintf( buf, " You are @@yfighting." );
break;
}
sprintf( buf2, "|@@W%s @@c|\n\r", center_text(buf,62) );
send_to_char( buf2, ch );
sprintf( buf, "@@WYou are " );
if ( GET_AC(ch) >= 101 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@yall skin and bones." );
else if ( GET_AC(ch) >= 80 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ynaked." );
else if ( GET_AC(ch) >= 0 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ybadly armored." );
else if ( GET_AC(ch) >= -100 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@yslightly armored." );
else if ( GET_AC(ch) >= -300 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ysomewhat armored." );
else if ( GET_AC(ch) >= -500 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@yarmored." );
else if ( GET_AC(ch) >= - 800 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ywell armored." );
else if ( GET_AC(ch) >= - 1400 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ystrongly armored." );
else if ( GET_AC(ch) >= - 2000 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@yheavily armored." );
else if ( GET_AC(ch) >= - 3000 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ysuperbly armored." );
else if ( GET_AC(ch) >= -4500 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ydivinely armored." );
else safe_strcat( MAX_STRING_LENGTH, buf, "@@yalmost invincible!" );
sprintf( buf2, " @@WArmor Class: @@y%5d. %s", GET_AC( ch ), buf );
sprintf( buf, "@@c|%s @@c|\n\r", center_text(buf2,62) );
send_to_char( buf, ch );
sprintf( buf, " @@WHitroll: @@y%-5d @@WDamroll: @@y%-5d", GET_HITROLL(ch), GET_DAMROLL(ch) );
sprintf( buf2, "@@c|%s @@c|\n\r", center_text(buf,62) );
send_to_char( buf2, ch );
sprintf( buf, " @@WYou are " );
if ( ch->alignment > 900 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@yangelic." );
else if ( ch->alignment > 700 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ysaintly." );
else if ( ch->alignment > 300 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ygood." );
else if ( ch->alignment > 100 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ykind." );
else if ( ch->alignment > -100 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@yneutral." );
else if ( ch->alignment > -350 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ymean." );
else if ( ch->alignment > -700 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@yevil." );
else if ( ch->alignment > -900 ) safe_strcat( MAX_STRING_LENGTH, buf, "@@ydemonic." );
else safe_strcat( MAX_STRING_LENGTH, buf, "@@ysatanic!" );
sprintf( buf2, " @@WAlignment: @@y%5d. %s", ch->alignment, buf );
sprintf( buf, "@@c|%s @@c|\n\r", center_text(buf2,62) );
send_to_char( buf, ch );
sprintf( buf,
"+===============================================================+@@g\n\r");
send_to_char( buf, ch );
return;
}
void do_affected( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
AFFECT_DATA *paf;
buf[0] = '\0';
send_to_char(
"\n\r@@a********************** @@mYou are affected by: @@a*********************@@N\n\r",
ch );
if ( ch->first_affect != NULL )
{
for ( paf = ch->first_affect; paf != NULL; paf = paf->next )
{
sprintf( buf, "Spell: '%s'", skill_table[paf->type].name );
send_to_char( buf, ch );
if ( ch->level >= 16 )
{
if ( paf->location > APPLY_NONE )
{
sprintf( buf,
" modifies %s by %d for %d hours",
affect_loc_name( paf->location ),
paf->modifier,
paf->duration );
}
else
sprintf( buf, " lasts for %d hours", paf->duration );
send_to_char( buf, ch );
}
send_to_char( ".\n\r", ch );
}
/* Check to see if items have applies... */
}
if ( item_has_apply( ch, ITEM_APPLY_INFRA ) )
send_to_char( "Spell: 'Infravision' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_INV ) )
send_to_char( "Spell: 'Invisibilty' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_DET_INV ) )
send_to_char( "Spell: 'Detect Invisibilty' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_SANC ) )
send_to_char( "Spell: 'Sanctuary' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_SNEAK ) )
send_to_char( "Skill: 'Sneak' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_HIDE ) )
send_to_char( "Skill: 'Hide' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_PROT ) )
send_to_char( "Spell: 'Protection' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_ENHANCED ) )
send_to_char( "Skill: 'Enhanced Damage' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_DET_MAG ) )
send_to_char( "Spell: 'Detect Magic' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_DET_HID ) )
send_to_char( "Spell: 'Detect Hidden' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_DET_EVIL ) )
send_to_char( "Spell: 'Detect Evil' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_PASS_DOOR ) )
send_to_char( "Spell: 'Pass Door' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_DET_POISON ) )
send_to_char( "Spell: 'Detect Posion' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_FLY ) )
send_to_char( "Spell: 'Fly' permanent duration.\n\r", ch );
if ( item_has_apply( ch, ITEM_APPLY_KNOW_ALIGN ) )
send_to_char( "Spell: 'Know Alignment' permanent duration.\n\r", ch );
sprintf( buf,
"*****************************************************************\n\r");
send_to_char( buf, ch );
return;
}
char * const day_name [] =
{
"the Moon", "the Bull", "Deception", "Thunder", "Freedom",
"the Great Gods", "the Sun"
};
/*
* Number of months reduced from 17 (!) to 8
* This is to bring the time it takes a character to age on mud year
* down from 200+ rl hrs to 64 rl hrs
* (Player's age stats were screwed in base merc!)
*/
char * const month_name [] =
{
"the Frost Giant", "the Old Forces",
"the Grand Struggle", "Futility",
"the Dark Shades", "the Long Shadows",
"the Ancient Darkness", "the Great Evil"
};
void do_time( CHAR_DATA *ch, char *argument )
{
extern char str_boot_time[];
char buf[MAX_STRING_LENGTH];
char *suf;
int day;
day = time_info.day + 1;
if ( day > 4 && day < 20 ) suf = "th";
else if ( day % 10 == 1 ) suf = "st";
else if ( day % 10 == 2 ) suf = "nd";
else if ( day % 10 == 3 ) suf = "rd";
else suf = "th";
sprintf( buf,
"It is %d o'clock %s, Day of %s, %d%s the Month of %s.\n\rAck! started up at %s\rThe system time is %s\r",
(time_info.hour % 12 == 0) ? 12 : time_info.hour % 12,
time_info.hour >= 12 ? "pm" : "am",
day_name[day % 7],
day, suf,
month_name[time_info.month],
str_boot_time,
(char *) ctime( ¤t_time )
);
send_to_char( buf, ch );
return;
}
void do_weather( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char buf2[MSL];
static char * const sky_look[4] =
{
"cloudless",
"cloudy",
"rainy",
"lit by flashes of lightning"
};
buf[0] = '\0';
buf2[0] = '\0';
if ( !IS_OUTSIDE(ch) )
{
send_to_char( "You can't see the weather indoors.\n\r", ch );
return;
}
if ( IS_SET( ch->in_room->affected_by, ROOM_BV_SHADE ) )
{
send_to_char( "You see no weather - a dark shadow masks the sky.\n\r", ch );
return;
}
sprintf( buf, "The sky is %s and %s.\n\r",
sky_look[weather_info.sky],
weather_info.change >= 0
? "a warm southerly breeze blows"
: "a cold northern gust blows"
);
switch ( weather_info.moon_loc )
{
case MOON_DOWN: safe_strcat( MSL, buf, "The moon is not in the sky.\n\r");
break;
case MOON_RISE: sprintf( buf2, "A %s @@yMoon@@N is just rising.\n\r", get_moon_phase_name( ) );
safe_strcat( MSL, buf, buf2 );
break;
case MOON_LOW: sprintf( buf2, "A %s @@yMoon@@N is low on the horizon.\n\r", get_moon_phase_name( ) );
safe_strcat( MSL, buf, buf2 );
break;
case MOON_PEAK: sprintf( buf2, "A %s @@yMoon@@N is high above you.\n\r", get_moon_phase_name( ) );
safe_strcat( MSL, buf, buf2 );
break;
case MOON_FALL: sprintf( buf2, "A %s @@yMoon@@N is falling.\n\r", get_moon_phase_name( ) );
safe_strcat( MSL, buf, buf2 );
break;
case MOON_SET: sprintf( buf2, "A %s @@yMoon@@N has just set.\n\r", get_moon_phase_name( ) );
safe_strcat( MSL, buf, buf2 );
break;
}
send_to_char( buf, ch );
return;
}
void do_help( CHAR_DATA *ch, char *argument )
{
HELP_DATA *pHelp;
if ( argument[0] == '\0' )
argument = "summary";
for ( pHelp = first_help; pHelp != NULL; pHelp = pHelp->next )
{
if ( pHelp->level > get_trust( ch ) )
continue;
if ( is_name( argument, pHelp->keyword ) )
{
if ( pHelp->level >= 0 && str_cmp( argument, "imotd" ) )
{
send_to_char( pHelp->keyword, ch );
send_to_char( "\n\r", ch );
}
/*
* Strip leading '.' to allow initial blanks.
*/
if ( pHelp->text[0] == '.' )
send_to_char( pHelp->text+1, ch );
else
send_to_char( pHelp->text , ch );
return;
}
}
send_to_char( "No help on that word.\n\r", ch );
return;
}
/*
* New 'who' command originally by Alander of Rivers of Mud.
* Changed a lot since then though :P
* List comes in 4 parts: Imms, Adepts, remorts then morts
*/
#define SHOW_IMMORT 0
#define SHOW_ADEPT 1
#define SHOW_REMORT 2
#define SHOW_MORTAL 3
#define SHOW_FINISH 4
#ifdef AA
void do_who( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
char buf[MAX_STRING_LENGTH*10];
char buf2[MAX_STRING_LENGTH*4];
char buf3[MAX_STRING_LENGTH*4];
char buf4[MAX_STRING_LENGTH*4];
char fgs[MAX_STRING_LENGTH*4];
char clan_job[MAX_STRING_LENGTH];
int iClass;
int iLevelLower;
int iLevelUpper;
int nNumber;
int nMatch;
bool rgfClass[MAX_CLASS];
bool fClassRestrict;
bool fImmortalOnly;
bool fadeptonly = FALSE;
bool fremortonly = FALSE;
int cnt, slength, excess, nlength;
int true_cnt=0;
static int max_players;
int list;
int number[3];
bool idle = FALSE, invis = FALSE, wanted = FALSE;
bool cangroup = FALSE;
int stop_counter = 0;
/*
* Set default arguments.
*/
buf[0] = '\0';
buf2[0] = '\0';
buf3[0] = '\0';
buf4[0] = '\0';
iLevelLower = 0;
iLevelUpper = MAX_LEVEL;
fClassRestrict = FALSE;
fImmortalOnly = FALSE;
for ( iClass = 0; iClass < MAX_CLASS; iClass++ )
rgfClass[iClass] = FALSE;
/*
* Parse arguments.
*/
nNumber = 0;
for ( ;; )
{
char arg[MAX_STRING_LENGTH];
argument = one_argument( argument, arg );
if ( arg[0] == '\0' )
break;
if ( is_number( arg ) )
{
switch ( ++nNumber )
{
case 1: iLevelLower = atoi( arg ); break;
case 2: iLevelUpper = atoi( arg ); break;
default:
send_to_char( "Only two level numbers allowed.\n\r", ch );
return;
}
}
else
{
int iClass;
if ( strlen(arg) < 3 )
{
send_to_char( "Classes must be longer than that.\n\r", ch );
return;
}
/*
* Look for classes to turn on.
*/
if ( !str_prefix( arg, "group" ) )
{
cangroup = TRUE;
break;
}
if ( !str_prefix( arg, "adept" ) )
{
fadeptonly = TRUE;
break;
}
if ( !str_prefix( arg, "remort" ) )
{
fremortonly = TRUE;
break;
}
arg[3] = '\0';
if ( !str_cmp( arg, "imm" ) )
{
fImmortalOnly = TRUE;
}
else
{
fClassRestrict = TRUE;
for ( iClass = 0; iClass < MAX_CLASS; iClass++ )
{
if ( !str_cmp( arg, class_table[iClass].who_name ) )
{
rgfClass[iClass] = TRUE;
break;
}
}
if ( ( iClass == MAX_CLASS ) && ( !( cangroup ) ) )
{
send_to_char( "That's not a class.\n\r", ch );
return;
}
}
}
}
buf[0] = '\0';
sprintf( buf,
"The Mighty Adventurers of " mudnamecolor "\n\r" );
safe_strcat( MAX_STRING_LENGTH, buf, "@@b|-----------------------------------------------------------------------------+\n\r" );
safe_strcat( MAX_STRING_LENGTH, buf, "| @@mSo An Ki Ne Mo@@b |\n\r" );
safe_strcat( MAX_STRING_LENGTH, buf, "| @@cMa Cl Th Wa Ps @@yRace Clan @@dA@@bB@@rJ@@eP@@WW @@aAdventurer @@mTitle @@r (flags) @@b|\n\r" );
safe_strcat( MAX_STRING_LENGTH, buf, "|---------------------------------|-------------------------------------------|\n\r" );
for ( list = SHOW_IMMORT; list < SHOW_FINISH; list ++)
{
number[list] = 0;
for ( d = first_desc; d != NULL; d = d->next )
{
CHAR_DATA *wch;
if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) )
continue;
wch = ( d->original != NULL ) ? d->original : d->character;
if ( ( list == SHOW_IMMORT && wch->level < LEVEL_HERO )
|| ( list == SHOW_REMORT && ( !is_remort( wch ) || wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_MORTAL && ( is_remort( wch ) || wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_ADEPT && ( wch->adept_level < 1 ) )
|| ( list == SHOW_ADEPT && ( wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_REMORT && ( wch->adept_level > 0 ) ) )
continue;
if ( wch->level < iLevelLower
|| wch->level > iLevelUpper
|| ( fImmortalOnly && wch->level < LEVEL_HERO )
|| ( fadeptonly && ( ( wch->adept_level < 1 ) || wch->level >= LEVEL_HERO ) )
|| ( fClassRestrict && !rgfClass[wch->class] )
|| ( fremortonly && ( !is_remort( wch )
|| ( wch->level >= LEVEL_HERO )
|| ( wch->adept_level > 0 ) ) ) )
continue;
/* Multiple grouping restriction checks Zen */
{
bool ch_adept = FALSE, ch_dremort = FALSE, ch_sremort = FALSE, victim_adept = FALSE,
victim_dremort = FALSE, victim_sremort = FALSE, legal_group = FALSE;
if ( ch->adept_level > 0 )
ch_adept = TRUE;
if ( wch->adept_level > 0 )
victim_adept = TRUE;
if ( get_psuedo_level( ch ) > 97 )
ch_dremort = TRUE;
if ( get_psuedo_level( wch ) > 97 )
victim_dremort = TRUE;
if ( get_psuedo_level( ch ) > 80 )
ch_sremort = TRUE;
if ( get_psuedo_level( wch ) > 80 )
victim_sremort = TRUE;
if ( ch_adept && victim_adept )
{
legal_group = TRUE;
}
else
if ( ( ch_adept && victim_dremort )
|| ( victim_adept && ch_dremort ) )
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 9 )
legal_group = TRUE;
else
legal_group = FALSE;
}
else
if ( ch_dremort || victim_dremort || ch_sremort || victim_sremort )
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) < 8 ) )
legal_group = TRUE;
}
else
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 21 )
legal_group = TRUE;
/* send_to_char( "No Remorts\n\r", ch ); */
}
if ( IS_IMMORTAL( wch ) )
legal_group = FALSE;
if ( !legal_group && cangroup )
continue;
}
number[list]++;
}
}
/*
* Now show matching chars.
*/
nMatch = 0;
buf3[0] = '\0';
buf4[0] = '\0';
for ( list = SHOW_IMMORT; list < SHOW_FINISH; list++ )
{
stop_counter = 0;
if ( number[list] == 0 )
continue;
switch ( list )
{
case SHOW_IMMORT:
safe_strcat( MAX_STRING_LENGTH, buf,
"@@b @@WGods@@b @@g\n\r" );
break;
case SHOW_ADEPT:
safe_strcat( MAX_STRING_LENGTH, buf,
"@@b @@cAdepts@@b @@g\n\r" );
break;
case SHOW_REMORT:
safe_strcat( MAX_STRING_LENGTH, buf,
"@@b @@mRemortals@@b @@g\n\r" );
break;
case SHOW_MORTAL:
safe_strcat( MAX_STRING_LENGTH, buf,
"@@b @@cMortals@@b @@g\n\r" );
break;
}
true_cnt = 0;
for ( d = first_desc; d != NULL; d = d->next )
{
CHAR_DATA *wch;
char const *class;
/*
* Check for match against restrictions.
* Don't use trust as that exposes trusted mortals.
*/
true_cnt++;
if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) )
continue;
wch = ( d->original != NULL ) ? d->original : d->character;
/* Check to see if we're showing the correct character for
* each segment of the loop...
*/
if ( ( list == SHOW_IMMORT && wch->level < LEVEL_HERO )
|| ( list == SHOW_REMORT && ( !is_remort( wch ) || wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_MORTAL && ( is_remort( wch ) || wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_ADEPT && ( wch->adept_level < 1 ) )
|| ( list == SHOW_ADEPT && ( wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_REMORT && ( wch->adept_level > 0 ) ) )
continue;
if ( wch->level < iLevelLower
|| wch->level > iLevelUpper
|| ( fImmortalOnly && wch->level < LEVEL_HERO )
|| ( fadeptonly && ( ( wch->adept_level < 1 ) || wch->level >= LEVEL_HERO ) )
|| ( fClassRestrict && !rgfClass[wch->class] )
|| ( fremortonly && ( !is_remort( wch )
|| ( wch->level >= LEVEL_HERO )
|| ( wch->adept_level > 0 ) ) ) )
continue;
/* Multiple grouping restriction checks Zen */
{
bool ch_adept = FALSE, ch_dremort = FALSE, ch_sremort = FALSE, victim_adept = FALSE,
victim_dremort = FALSE, victim_sremort = FALSE, legal_group = FALSE;
if ( ch->adept_level > 0 )
ch_adept = TRUE;
if ( wch->adept_level > 0 )
victim_adept = TRUE;
if ( get_psuedo_level( ch ) > 97 )
ch_dremort = TRUE;
if ( get_psuedo_level( wch ) > 97 )
victim_dremort = TRUE;
if ( get_psuedo_level( ch ) > 80 )
ch_sremort = TRUE;
if ( get_psuedo_level( wch ) > 80 )
victim_sremort = TRUE;
if ( ch_adept && victim_adept )
{
legal_group = TRUE;
}
else
if ( ( ch_adept && victim_dremort )
|| ( victim_adept && ch_dremort ) )
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 9 )
legal_group = TRUE;
}
else
if ( ch_dremort || victim_dremort || ch_sremort || victim_sremort )
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 8 )
legal_group = TRUE;
else
legal_group = FALSE;
}
else
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 21 )
legal_group = TRUE;
/* send_to_char( "No Remorts\n\r", ch ); */
}
if ( IS_IMMORTAL( wch ) )
legal_group = FALSE;
if ( !legal_group && cangroup )
continue;
}
if ( stop_counter > 45 )
continue;
stop_counter++;
nMatch++;
/*
* Figure out what to print for class.
*/
class = class_table[wch->class].who_name;
if ( str_cmp( wch->pcdata->who_name, "off" ) )
class = wch->pcdata->who_name;
else
{
switch ( wch->level )
{
default: break;
case MAX_LEVEL - 0: class = "@@l-* CREATOR *-@@g "; break;
case MAX_LEVEL - 1: class = "@@B-= SUPREME =-@@g "; break;
case MAX_LEVEL - 2: class = "@@a-- DEITY --@@g "; break;
case MAX_LEVEL - 3: class = "@@c - IMMORTAL- @@g "; break;
case MAX_LEVEL - 4: class = "@@W ADEPT @@N "; break;
}
}
if ( IS_SET( wch->pcdata->pflags, PFLAG_AMBAS ) )
{
sprintf( buf3, " AMBASSADOR " );
}
else
{
if ( wch->level >= ( MAX_LEVEL - 4 )
|| str_cmp(wch->pcdata->who_name, "off" ) )
{
switch( wch->level )
{
case MAX_LEVEL - 0:
sprintf( buf3, "@@l %s@@g", class );
break;
case MAX_LEVEL - 1:
sprintf( buf3, "@@B %s@@g", class );
break;
case MAX_LEVEL - 2:
sprintf( buf3, "@@a %s@@g", class );
break;
case MAX_LEVEL - 3:
sprintf( buf3, "@@c %s@@g", class );
break;
default:
sprintf( buf3, "@@W %s@@g", class );
break;
}
}
else
{
buf4[0] = '\0';
buf3[0] = '\0';
for ( cnt = 0; cnt < MAX_CLASS; cnt++ )
{
if ( wch->lvl2[cnt] > 0 )
{
sprintf( buf4, "@@m%3d@@N", wch->lvl2[cnt] );
}
else
{
if ( wch->lvl[cnt] <= 0 )
sprintf( buf4, "@@d%3d@@N", 0 );
else
sprintf( buf4, "@@b%3d@@N", wch->lvl[cnt] );
}
safe_strcat(MAX_STRING_LENGTH, buf3, buf4 );
}
}
}
/* Work out what to show for 'flags' column.
PKOK, AFK, LEADER, WRITING, BUILDING
ADDED: race and clan (Stephen)*/
clan_job[0] = '\0';
if ( IS_SET(wch->pcdata->pflags, PFLAG_CLAN_BOSS ) )
safe_strcat( MAX_STRING_LENGTH, clan_job, "*" );
else if ( IS_SET( wch->pcdata->pflags, PFLAG_CLAN_LEADER ) )
safe_strcat( MAX_STRING_LENGTH, clan_job, "L" );
else if ( IS_SET( wch->pcdata->pflags, PFLAG_CLAN_ARMOURER ) )
safe_strcat( MAX_STRING_LENGTH, clan_job, "!" );
else
safe_strcat( MAX_STRING_LENGTH, clan_job, " ") ;
sprintf( fgs, "%3s %5s %s%s%s%s%s",
race_table[wch->race].race_name,
clan_table[wch->pcdata->clan].clan_abbr,
IS_SET( wch->pcdata->pflags, PFLAG_AFK ) ? "A" : " ",
wch->position == POS_BUILDING ? "B" : " ",
clan_job,
IS_SET( wch->pcdata->pflags, PFLAG_PKOK ) ? "P" : " ",
wch->position == POS_WRITING ? "W" : " " );
/* Oh look... another hack needed due to change in who format! */
/* Make sure that the title (and wanted/idle flag) will fit ok */
/* excess holds number of chars we have to lose ): */
nlength = strlen( wch->name );
slength = 1 + my_strlen(wch->pcdata->title) + nlength;
excess = 0;
idle = FALSE;
wanted = FALSE;
invis = FALSE;
if ( IS_SET(wch->act, PLR_WIZINVIS ) )
{
excess += 6;
invis = TRUE;
}
else
{
if ( IS_SET(wch->act, PLR_KILLER ) || IS_SET(wch->act, PLR_THIEF ) )
{
excess += 8;
wanted = TRUE;
}
if ( wch->timer > 5 )
{
excess += 10;
idle = TRUE;
}
}
sprintf( buf4, "%s", wch->pcdata->title );
if ( slength+excess > 43 )
{
if ( invis )
sprintf( buf4, "%1.26s", wch->pcdata->title );
else if ( idle && !wanted )
sprintf( buf4, "%1.24s", wch->pcdata->title );
else if ( !idle && wanted )
sprintf( buf4, "%1.28s", wch->pcdata->title );
else if ( idle && wanted )
sprintf( buf4, "%1.18s", wch->pcdata->title );
else
sprintf( buf4, "%1.31s", wch->pcdata->title );
}
else
{
for ( cnt = slength+excess; cnt < 43; cnt ++ )
{
strcat( buf4, " " );
}
}
if ( invis )
{
if ( slength+excess <= 43 )
{
sprintf( buf + strlen(buf), "@@b|%s%s%s %s @@b| %s%s%s%s",
color_string( ch, "stats" ),
buf3,
color_string( ch, "stats" ),
fgs,
color_string( ch, "stats" ),
wch->name,
buf4,
IS_SET(wch->act, PLR_WIZINVIS ) ?
"@@y(WIZI)@@b" : "" );
sprintf( buf + strlen( buf ), "@@b|@@g\n\r" );
}
else
{
sprintf( buf + strlen(buf), "@@b|%s%s%s %s @@b| %s%s%s%s",
color_string( ch, "stats" ),
buf3,
color_string( ch, "stats" ),
fgs,
color_string( ch, "stats" ),
wch->name,
buf4,
IS_SET(wch->act, PLR_WIZINVIS ) ?
" @@y(WIZI)@@b " : "" );
sprintf( buf + strlen( buf ), "@@b|@@g\n\r" );
}
}
else
{
sprintf( buf + strlen(buf), "@@b|%s%s%s %s @@b| %s%s%s%s",
color_string( ch, "stats" ),
buf3,
color_string( ch, "stats" ),
fgs,
color_string( ch, "stats" ),
wch->name,
buf4,
( IS_SET(wch->act, PLR_KILLER) || IS_SET(wch->act, PLR_THIEF) ) ?
"(WANTED)" : "" );
if ( wch->timer > 5 )
sprintf( buf + strlen(buf), "[IDLE:%2d] @@b|@@g\n\r", wch->timer );
else
sprintf( buf + strlen( buf ), "@@b|@@g\n\r" );
}
}
safe_strcat( MAX_STRING_LENGTH, buf,
"@@b_______________________________________________________________________________\n\r" );
send_to_char( buf, ch );
buf[0] = '\0';
}
if ( true_cnt > max_players )
max_players = true_cnt+15;
sprintf( buf4, "@@y(%d @@gAdventurer%s@@y) @@gKEY: (@@dA@@g)fk (@@bB@@g)uilding (@@eP@@g)kok (@@WW@@g)riting",
nMatch, nMatch == 1 ? "" : "s" );
sprintf( buf2, "@@b|@@G %s @@b|\n\r", center_text( buf4, 75 ) );
safe_strcat(MAX_STRING_LENGTH, buf, buf2 );
sprintf( buf4," @@g(@@y*@@g) Clan Boss (@@yL@@g) Clan Leader (@@rJ@@g) Clan Job (@@y!@@g) Clan Armourer@@N " );
sprintf( buf2, "@@b|@@G %s @@b|\n\r", center_text( buf4, 75 ) );
safe_strcat(MAX_STRING_LENGTH, buf, buf2 );
sprintf( buf4, "@@GThere has been a maximum of @@W%d @@eadventurer%s @@Glogged on this session@@N",
max_players, max_players == 1 ? "" : "s" );
sprintf( buf2, "@@b|@@G %s @@b|\n\r", center_text( buf4, 75 ) );
safe_strcat( MAX_STRING_LENGTH, buf, buf2 );
safe_strcat( MAX_STRING_LENGTH, buf,
"@@b_______________________________________________________________________________\n\r" );
/* Removed this... out is used once, to add a single color code... D'Oh! to me --Stimpy
sprintf( out, "%s%s", buf, color_string( ch, "normal" ) );
*/
send_to_char( buf, ch );
send_to_char( color_string( ch, "normal" ), ch );
/* #endif */
return;
}
#else
void do_who( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
char buf[MAX_STRING_LENGTH*10];
char buf2[MAX_STRING_LENGTH*4];
char buf3[MAX_STRING_LENGTH*4];
char buf4[MAX_STRING_LENGTH*4];
char fgs[MAX_STRING_LENGTH*4];
char clan_job[MAX_STRING_LENGTH];
int iClass;
int iLevelLower;
int iLevelUpper;
int nNumber;
int nMatch;
bool rgfClass[MAX_CLASS];
bool fClassRestrict;
bool fImmortalOnly;
bool fadeptonly = FALSE;
bool fremortonly = FALSE;
int cnt, slength, excess, nlength;
int true_cnt=0;
static int max_players;
int list;
int number[3];
bool idle = FALSE, invis = FALSE, wanted = FALSE;
bool cangroup = FALSE;
int stop_counter = 0;
/*
* Set default arguments.
*/
buf[0] = '\0';
buf2[0] = '\0';
buf3[0] = '\0';
buf4[0] = '\0';
iLevelLower = 0;
iLevelUpper = MAX_LEVEL;
fClassRestrict = FALSE;
fImmortalOnly = FALSE;
for ( iClass = 0; iClass < MAX_CLASS; iClass++ )
rgfClass[iClass] = FALSE;
/*
* Parse arguments.
*/
nNumber = 0;
for ( ;; )
{
char arg[MAX_STRING_LENGTH];
argument = one_argument( argument, arg );
if ( arg[0] == '\0' )
break;
if ( is_number( arg ) )
{
switch ( ++nNumber )
{
case 1: iLevelLower = atoi( arg ); break;
case 2: iLevelUpper = atoi( arg ); break;
default:
send_to_char( "Only two level numbers allowed.\n\r", ch );
return;
}
}
else
{
int iClass;
if ( strlen(arg) < 3 )
{
send_to_char( "Classes must be longer than that.\n\r", ch );
return;
}
/*
* Look for classes to turn on.
*/
if ( !str_prefix( arg, "group" ) )
{
cangroup = TRUE;
break;
}
if ( !str_prefix( arg, "adept" ) )
{
fadeptonly = TRUE;
break;
}
if ( !str_prefix( arg, "remort" ) )
{
fremortonly = TRUE;
break;
}
arg[3] = '\0';
if ( !str_cmp( arg, "imm" ) )
{
fImmortalOnly = TRUE;
}
else
{
fClassRestrict = TRUE;
for ( iClass = 0; iClass < MAX_CLASS; iClass++ )
{
if ( !str_cmp( arg, class_table[iClass].who_name ) )
{
rgfClass[iClass] = TRUE;
break;
}
}
if ( ( iClass == MAX_CLASS ) && ( !( cangroup ) ) )
{
send_to_char( "That's not a class.\n\r", ch );
return;
}
}
}
}
buf[0] = '\0';
sprintf( buf,
"WHO Listing: " mudnamecolor "\n\r" );
safe_strcat( MAX_STRING_LENGTH, buf, "@@R+-----------------------------------------------------------------------------+\n\r" );
safe_strcat( MAX_STRING_LENGTH, buf, "| @@mSo An Ki Ne Mo@@R |\n\r" );
safe_strcat( MAX_STRING_LENGTH, buf, "| @@bMa Cl Th Wa Ps @@eRace Clan ABJPW Player Title @@R(flags) @@R|\n\r" );
safe_strcat( MAX_STRING_LENGTH, buf, "|---------------------------------+-------------------------------------------|\n\r" );
for ( list = SHOW_IMMORT; list < SHOW_FINISH; list ++)
{
number[list] = 0;
for ( d = first_desc; d != NULL; d = d->next )
{
CHAR_DATA *wch;
if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) )
continue;
wch = ( d->original != NULL ) ? d->original : d->character;
if ( ( list == SHOW_IMMORT && wch->level < LEVEL_HERO )
|| ( list == SHOW_REMORT && ( !is_remort( wch ) || wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_MORTAL && ( is_remort( wch ) || wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_ADEPT && ( wch->adept_level < 1 ) )
|| ( list == SHOW_ADEPT && ( wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_REMORT && ( wch->adept_level > 0 ) ) )
continue;
if ( wch->level < iLevelLower
|| wch->level > iLevelUpper
|| ( fImmortalOnly && wch->level < LEVEL_HERO )
|| ( fadeptonly && ( ( wch->adept_level < 1 ) || wch->level >= LEVEL_HERO ) )
|| ( fClassRestrict && !rgfClass[wch->class] )
|| ( fremortonly && ( !is_remort( wch )
|| ( wch->level >= LEVEL_HERO )
|| ( wch->adept_level > 0 ) ) ) )
continue;
/* Multiple grouping restriction checks Zen */
{
bool ch_adept = FALSE, ch_dremort = FALSE, ch_sremort = FALSE, victim_adept = FALSE,
victim_dremort = FALSE, victim_sremort = FALSE, legal_group = FALSE;
if ( ch->adept_level > 0 )
ch_adept = TRUE;
if ( wch->adept_level > 0 )
victim_adept = TRUE;
if ( get_psuedo_level( ch ) > 97 )
ch_dremort = TRUE;
if ( get_psuedo_level( wch ) > 97 )
victim_dremort = TRUE;
if ( get_psuedo_level( ch ) > 80 )
ch_sremort = TRUE;
if ( get_psuedo_level( wch ) > 80 )
victim_sremort = TRUE;
if ( ch_adept && victim_adept )
{
legal_group = TRUE;
}
else
if ( ( ch_adept && victim_dremort )
|| ( victim_adept && ch_dremort ) )
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 9 )
legal_group = TRUE;
else
legal_group = FALSE;
}
else
if ( ch_dremort || victim_dremort || ch_sremort || victim_sremort )
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) < 8 ) )
legal_group = TRUE;
}
else
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 21 )
legal_group = TRUE;
/* send_to_char( "No Remorts\n\r", ch ); */
}
if ( IS_IMMORTAL( wch ) )
legal_group = FALSE;
if ( !legal_group && cangroup )
continue;
}
number[list]++;
}
}
/*
* Now show matching chars.
*/
nMatch = 0;
buf3[0] = '\0';
buf4[0] = '\0';
for ( list = SHOW_IMMORT; list < SHOW_FINISH; list++ )
{
stop_counter = 0;
if ( number[list] == 0 )
continue;
switch ( list )
{
case SHOW_IMMORT:
safe_strcat( MAX_STRING_LENGTH, buf,
"@@R|---------------------------------|----------@@lImmortals@@R------------------------|@@g\n\r" );
break;
case SHOW_ADEPT:
safe_strcat( MAX_STRING_LENGTH, buf,
"@@R|---------------------------------|------------@@WAdepts@@R-------------------------|@@g\n\r" );
break;
case SHOW_REMORT:
safe_strcat( MAX_STRING_LENGTH, buf,
"@@R|---------------------------------|----------@@mRemortals@@R------------------------|@@g\n\r" );
break;
case SHOW_MORTAL:
safe_strcat( MAX_STRING_LENGTH, buf,
"@@R|---------------------------------|-----------@@cMortals@@R-------------------------|@@g\n\r" );
break;
}
true_cnt = 0;
for ( d = first_desc; d != NULL; d = d->next )
{
CHAR_DATA *wch;
char const *class;
/*
* Check for match against restrictions.
* Don't use trust as that exposes trusted mortals.
*/
true_cnt++;
if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) )
continue;
wch = ( d->original != NULL ) ? d->original : d->character;
/* Check to see if we're showing the correct character for
* each segment of the loop...
*/
if ( ( list == SHOW_IMMORT && wch->level < LEVEL_HERO )
|| ( list == SHOW_REMORT && ( !is_remort( wch ) || wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_MORTAL && ( is_remort( wch ) || wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_ADEPT && ( wch->adept_level < 1 ) )
|| ( list == SHOW_ADEPT && ( wch->level >= LEVEL_HERO ) )
|| ( list == SHOW_REMORT && ( wch->adept_level > 0 ) ) )
continue;
if ( wch->level < iLevelLower
|| wch->level > iLevelUpper
|| ( fImmortalOnly && wch->level < LEVEL_HERO )
|| ( fadeptonly && ( ( wch->adept_level < 1 ) || wch->level >= LEVEL_HERO ) )
|| ( fClassRestrict && !rgfClass[wch->class] )
|| ( fremortonly && ( !is_remort( wch )
|| ( wch->level >= LEVEL_HERO )
|| ( wch->adept_level > 0 ) ) ) )
continue;
/* Multiple grouping restriction checks Zen */
{
bool ch_adept = FALSE, ch_dremort = FALSE, ch_sremort = FALSE, victim_adept = FALSE,
victim_dremort = FALSE, victim_sremort = FALSE, legal_group = FALSE;
if ( ch->adept_level > 0 )
ch_adept = TRUE;
if ( wch->adept_level > 0 )
victim_adept = TRUE;
if ( get_psuedo_level( ch ) > 97 )
ch_dremort = TRUE;
if ( get_psuedo_level( wch ) > 97 )
victim_dremort = TRUE;
if ( get_psuedo_level( ch ) > 80 )
ch_sremort = TRUE;
if ( get_psuedo_level( wch ) > 80 )
victim_sremort = TRUE;
if ( ch_adept && victim_adept )
{
legal_group = TRUE;
}
else
if ( ( ch_adept && victim_dremort )
|| ( victim_adept && ch_dremort ) )
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 9 )
legal_group = TRUE;
}
else
if ( ch_dremort || victim_dremort || ch_sremort || victim_sremort )
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 8 )
legal_group = TRUE;
else
legal_group = FALSE;
}
else
{
if ( abs( get_psuedo_level( ch ) - get_psuedo_level( wch ) ) < 21 )
legal_group = TRUE;
/* send_to_char( "No Remorts\n\r", ch ); */
}
if ( IS_IMMORTAL( wch ) )
legal_group = FALSE;
if ( !legal_group && cangroup )
continue;
}
if ( stop_counter > 45 )
continue;
stop_counter++;
nMatch++;
/*
* Figure out what to print for class.
*/
class = class_table[wch->class].who_name;
if ( str_cmp( wch->pcdata->who_name, "off" ) )
class = wch->pcdata->who_name;
else
{
switch ( wch->level )
{
default: break;
case MAX_LEVEL - 0: class = "@@l-* CREATOR *-@@g "; break;
case MAX_LEVEL - 1: class = "@@B-= SUPREME =-@@g "; break;
case MAX_LEVEL - 2: class = "@@a-- DEITY --@@g "; break;
case MAX_LEVEL - 3: class = "@@c - IMMORTAL- @@g "; break;
case MAX_LEVEL - 4: class = "@@W ADEPT @@N "; break;
}
}
if ( IS_SET( wch->pcdata->pflags, PFLAG_AMBAS ) )
{
sprintf( buf3, " AMBASSADOR " );
}
else
{
if ( wch->level >= ( MAX_LEVEL - 4 )
|| str_cmp(wch->pcdata->who_name, "off" ) )
{
switch( wch->level )
{
case MAX_LEVEL - 0:
sprintf( buf3, "@@l %s@@g", class );
break;
case MAX_LEVEL - 1:
sprintf( buf3, "@@B %s@@g", class );
break;
case MAX_LEVEL - 2:
sprintf( buf3, "@@a %s@@g", class );
break;
case MAX_LEVEL - 3:
sprintf( buf3, "@@c %s@@g", class );
break;
default:
sprintf( buf3, "@@W %s@@g", class );
break;
}
}
else
{
buf4[0] = '\0';
buf3[0] = '\0';
for ( cnt = 0; cnt < MAX_CLASS; cnt++ )
{
if ( wch->lvl2[cnt] > 0 )
{
sprintf( buf4, "@@m%3d@@N", wch->lvl2[cnt] );
}
else
{
if ( wch->lvl[cnt] <= 0 )
sprintf( buf4, "@@d%3d@@N", 0 );
else
sprintf( buf4, "@@b%3d@@N", wch->lvl[cnt] );
}
safe_strcat(MAX_STRING_LENGTH, buf3, buf4 );
}
}
}
/* Work out what to show for 'flags' column.
PKOK, AFK, LEADER, WRITING, BUILDING
ADDED: race and clan (Stephen)*/
clan_job[0] = '\0';
if ( IS_SET(wch->pcdata->pflags, PFLAG_CLAN_BOSS ) )
safe_strcat( MAX_STRING_LENGTH, clan_job, "*" );
else if ( IS_SET( wch->pcdata->pflags, PFLAG_CLAN_LEADER ) )
safe_strcat( MAX_STRING_LENGTH, clan_job, "L" );
else if ( IS_SET( wch->pcdata->pflags, PFLAG_CLAN_ARMOURER ) )
safe_strcat( MAX_STRING_LENGTH, clan_job, "!" );
else
safe_strcat( MAX_STRING_LENGTH, clan_job, " ") ;
sprintf( fgs, "%3s %5s %s%s%s%s%s",
race_table[wch->race].race_name,
clan_table[wch->pcdata->clan].clan_abbr,
IS_SET( wch->pcdata->pflags, PFLAG_AFK ) ? "A" : " ",
wch->position == POS_BUILDING ? "B" : " ",
clan_job,
IS_SET( wch->pcdata->pflags, PFLAG_PKOK ) ? "P" : " ",
wch->position == POS_WRITING ? "W" : " " );
/* Oh look... another hack needed due to change in who format! */
/* Make sure that the title (and wanted/idle flag) will fit ok */
/* excess holds number of chars we have to lose ): */
nlength = strlen( wch->name );
slength = 1 + my_strlen(wch->pcdata->title) + nlength;
excess = 0;
idle = FALSE;
wanted = FALSE;
invis = FALSE;
if ( IS_SET(wch->act, PLR_WIZINVIS ) )
{
excess += 6;
invis = TRUE;
}
else
{
if ( IS_SET(wch->act, PLR_KILLER ) || IS_SET(wch->act, PLR_THIEF ) )
{
excess += 8;
wanted = TRUE;
}
if ( wch->timer > 5 )
{
excess += 10;
idle = TRUE;
}
}
sprintf( buf4, "%s", wch->pcdata->title );
if ( slength+excess > 43 )
{
if ( invis )
sprintf( buf4, "%1.26s", wch->pcdata->title );
else if ( idle && !wanted )
sprintf( buf4, "%1.24s", wch->pcdata->title );
else if ( !idle && wanted )
sprintf( buf4, "%1.28s", wch->pcdata->title );
else if ( idle && wanted )
sprintf( buf4, "%1.18s", wch->pcdata->title );
else
sprintf( buf4, "%1.31s", wch->pcdata->title );
}
else
{
for ( cnt = slength+excess; cnt < 43; cnt ++ )
{
strcat( buf4, " " );
}
}
if ( invis )
{
if ( slength+excess <= 43 )
{
sprintf( buf + strlen(buf), "@@R|%s%s%s %s @@R| %s%s%s%s",
color_string( ch, "stats" ),
buf3,
color_string( ch, "stats" ),
fgs,
color_string( ch, "stats" ),
wch->name,
buf4,
IS_SET(wch->act, PLR_WIZINVIS ) ?
"(WIZI)" : "" );
sprintf( buf + strlen( buf ), "@@R|@@g\n\r" );
}
else
{
sprintf( buf + strlen(buf), "@@R|%s%s%s %s @@R| %s%s%s%s",
color_string( ch, "stats" ),
buf3,
color_string( ch, "stats" ),
fgs,
color_string( ch, "stats" ),
wch->name,
buf4,
IS_SET(wch->act, PLR_WIZINVIS ) ?
" (WIZI) " : "" );
sprintf( buf + strlen( buf ), "@@R|@@g\n\r" );
}
}
else
{
sprintf( buf + strlen(buf), "@@R|%s%s%s %s @@R| %s%s%s%s",
color_string( ch, "stats" ),
buf3,
color_string( ch, "stats" ),
fgs,
color_string( ch, "stats" ),
wch->name,
buf4,
( IS_SET(wch->act, PLR_KILLER) || IS_SET(wch->act, PLR_THIEF) ) ?
"(WANTED)" : "" );
if ( wch->timer > 5 )
sprintf( buf + strlen(buf), "[IDLE:%2d] @@R|@@g\n\r", wch->timer );
else
sprintf( buf + strlen( buf ), "@@R|@@g\n\r" );
}
}
safe_strcat( MAX_STRING_LENGTH, buf,
"@@R|---------------------------------+-------------------------------------------|\n\r" );
send_to_char( buf, ch );
buf[0] = '\0';
}
if ( true_cnt > max_players )
max_players = true_cnt;
sprintf( buf4, "(%d Player%s) KEY: (A)fk (B)uilding (*)Clan Boss (P)kok (W)riting",
nMatch, nMatch == 1 ? "" : "s" );
sprintf( buf2, "@@R|@@G %s @@R|\n\r", center_text( buf4, 75 ) );
safe_strcat(MAX_STRING_LENGTH, buf, buf2 );
sprintf( buf4," (L) Clan Leader (!) Clan Armourer " );
sprintf( buf2, "@@R|@@G %s @@R|\n\r", center_text( buf4, 75 ) );
safe_strcat(MAX_STRING_LENGTH, buf, buf2 );
sprintf( buf4, "There have been a maximum of %d player%s logged on this session",
max_players, max_players == 1 ? "" : "s" );
sprintf( buf2, "@@R|@@G %s @@R|\n\r", center_text( buf4, 75 ) );
safe_strcat( MAX_STRING_LENGTH, buf, buf2 );
safe_strcat( MAX_STRING_LENGTH, buf,
"@@R+-----------------------------------------------------------------------------+\n\r" );
/* Removed this... out is used once, to add a single color code... D'Oh! to me --Stimpy
sprintf( out, "%s%s", buf, color_string( ch, "normal" ) );
*/
send_to_char( buf, ch );
send_to_char( color_string( ch, "normal" ), ch );
/* #endif */
return;
}
#endif
void do_inventory( CHAR_DATA *ch, char *argument )
{
if ( !IS_NPC( ch ) && IS_WOLF( ch )
&& ( IS_SHIFTED( ch ) || IS_RAGED( ch ) ) )
{
send_to_char( "All your inventory has transformed into fur!!!@@N\n\r", ch );
return;
}
send_to_char( "You are carrying:\n\r", ch );
show_list_to_char( ch->first_carry, ch, TRUE, TRUE );
return;
}
void do_equipment( CHAR_DATA *ch, char *argument )
{
do_wear( ch, "" );
return;
}
void do_compare( CHAR_DATA *ch, char *argument )
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
OBJ_DATA *obj1;
OBJ_DATA *obj2;
int value1;
int value2;
char *msg;
if ( !IS_NPC( ch ) && IS_WOLF( ch )
&& ( IS_SHIFTED( ch ) || IS_RAGED( ch ) ) )
{
send_to_char( "All your inventory has transformed into fur!!!@@N\n\r", ch );
return;
}
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if ( arg1[0] == '\0' )
{
send_to_char( "Compare what to what?\n\r", ch );
return;
}
if ( ( obj1 = get_obj_carry( ch, arg1 ) ) == NULL )
{
send_to_char( "You do not have that item.\n\r", ch );
return;
}
if ( arg2[0] == '\0' )
{
for ( obj2 = ch->first_carry; obj2 != NULL; obj2 = obj2->next_in_carry_list )
{
if ( obj2->wear_loc != WEAR_NONE
&& can_see_obj( ch, obj2 )
&& obj1->item_type == obj2->item_type
&& ( obj1->wear_flags & obj2->wear_flags & ~ITEM_TAKE) != 0 )
break;
}
if ( obj2 == NULL )
{
send_to_char( "You aren't wearing anything comparable.\n\r", ch );
return;
}
}
else
{
if ( ( obj2 = get_obj_carry( ch, arg2 ) ) == NULL )
{
send_to_char( "You do not have that item.\n\r", ch );
return;
}
}
msg = NULL;
value1 = 0;
value2 = 0;
if ( obj1 == obj2 )
{
msg = "You compare $p to itself. It looks about the same.";
}
else if ( obj1->item_type != obj2->item_type )
{
msg = "You can't compare $p and $P.";
}
else
{
switch ( obj1->item_type )
{
default:
msg = "You can't compare $p and $P.";
break;
case ITEM_ARMOR:
value1 = obj1->value[0];
value2 = obj2->value[0];
break;
case ITEM_WEAPON:
value1 = obj1->value[1] + obj1->value[2];
value2 = obj2->value[1] + obj2->value[2];
break;
}
}
if ( msg == NULL )
{
if ( value1 == value2 ) msg = "$p and $P look about the same.";
else if ( value1 > value2 ) msg = "$p looks better than $P.";
else msg = "$p looks worse than $P.";
}
act( msg, ch, obj1, obj2, TO_CHAR );
return;
}
void do_credits( CHAR_DATA *ch, char *argument )
{
do_help( ch, "diku" );
do_help( ch, "merc" );
do_help( ch, "ack" );
return;
}
void do_where( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
DESCRIPTOR_DATA *d;
bool found;
buf[0] = '\0';
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Players near you:\n\r", ch );
sprintf( buf, "In %s %s @@N:\n\r",ch->in_room->area->level_label,
ch->in_room->area->name );
send_to_char( buf, ch );
found = FALSE;
for ( d = first_desc; d; d = d->next )
{
if ( d->connected == CON_PLAYING
&& ( victim = d->character ) != NULL
&& !IS_NPC(victim)
&& victim->in_room != NULL
&& victim->in_room->area == ch->in_room->area
&& can_see( ch, victim )
&& ( !IS_WOLF( victim ) || ( !IS_SHIFTED( victim ) && !IS_RAGED( victim ) ) ) )
{
found = TRUE;
sprintf( buf, "%-28s %s\n\r",
victim->name, victim->in_room->name );
send_to_char( buf, ch );
}
}
if ( !found )
send_to_char( "None\n\r", ch );
}
else
{
found = FALSE;
for ( victim = first_char; victim != NULL; victim = victim->next )
{
/* && victim->in_room->area == ch->in_room->area
* taken out from below to allow global where use
* and then put back in... global where no fun at all. ;)
* -- Stephen
*/
if ( victim->in_room != NULL
&& ( !IS_AFFECTED(victim, AFF_HIDE) && !item_has_apply( victim, ITEM_APPLY_HIDE ) )
&& ( victim->in_room->area == ch->in_room->area )
&& ( !IS_AFFECTED(victim, AFF_SNEAK) && !item_has_apply( victim, ITEM_APPLY_SNEAK ) )
&& can_see( ch, victim )
&& is_name( arg, victim->name ) )
{
found = TRUE;
sprintf( buf, "%-28s %s\n\r",
PERS(victim, ch), victim->in_room->name );
send_to_char( buf, ch );
break;
}
}
if ( !found )
act( "You didn't find any $T.", ch, NULL, arg, TO_CHAR );
}
return;
}
void do_consider( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
char *msg = '\0';
char *buf = '\0';
char *buf2 = '\0';
char *buf3 = '\0';
char *buf4 = '\0';
float diff;
int hpdiff;
int hrdiff;
int drdiff;
int acdiff;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Consider killing whom?\n\r", ch );
return;
}
if ( ( victim = get_char_room( ch, arg ) ) == NULL )
{
send_to_char( "They're not here.\n\r", ch );
return;
}
if ( !IS_NPC( victim ) )
send_to_char( "Remember there are downfalls to PKilling!\n\r", ch );
/* Stephen - bypass class adjustment if victim == NPC */
/* Also, only look at modifiers if victim == NPC */
/* diff = victim->level - ch->level; */
diff = (get_psuedo_level( victim ) - get_psuedo_level( ch ));
/* Additions for difficulty. */
/* Class: */
if ( !IS_NPC( victim ) )
{
switch (ch->class)
{
case 0: diff+=0.3; break; /* Mage */
case 1: diff+=0.4; break; /* Cleric */
case 2: diff+=0.1; break; /* Thief */
case 3: diff+=0 ; break; /* Warrior */
case 4: diff-=0.4; break; /* Psionicist */
case 5: diff+=0.5; break; /* Conjurer */
case 6: diff-=0.2; break; /* Templar */
case 7: diff+=0.2; break; /* Ranger */
}
}
/* Mod rolls. */
if ( IS_NPC( victim ) )
{
diff+=victim->hr_mod/4;
diff+=victim->dr_mod/4;
diff-=victim->ac_mod/30;
}
if ( diff >= 10 ) msg = "Death will thank you for your gift.";
if ( diff <= 9 ) msg = "$N laughs at you mercilessly.";
if ( diff <= 4 ) msg = "$N says 'Do you feel lucky, punk?'.";
if ( diff <= 1 ) msg = "The perfect match!";
if ( diff <= -2 ) msg = "$N looks like an easy kill.";
if ( diff <= -5 ) msg = "$N is no match for you.";
if ( diff <= -10 ) msg = "You can kill $N naked and weaponless.";
act( msg, ch, NULL, victim, TO_CHAR );
msg = "";
/* additions by king@tinuviel.cs.wcu.edu */
hpdiff = ( ch->hit - victim->hit );
if ( ( ( diff >= 0) && ( hpdiff <= 0 ) )
|| ( ( diff <= 0 ) && ( hpdiff >= 0 ) ) )
{
send_to_char( "Also,", ch );
}
else
{
send_to_char( "However,", ch );
}
if ( hpdiff >= 101 )
buf = " you are currently much healthier than $E.";
if ( hpdiff <= 100 )
buf = " you are currently healthier than $E.";
if ( hpdiff <= 50 )
buf = " you are currently slightly healthier than $E.";
if ( hpdiff <= 25 )
buf = " you are a teensy bit healthier than $E.";
if ( hpdiff <= 0 )
buf = " $E is a teensy bit healthier than you.";
if ( hpdiff <= -25 )
buf = " $E is slightly healthier than you.";
if ( hpdiff <= -50 )
buf = " $E is healthier than you.";
if ( hpdiff <= -100 )
buf = " $E is much healthier than you.";
act( buf, ch, NULL, victim, TO_CHAR );
buf = "";
/* LLolth added the following code to make consider show more information */
/* root@vampyre.net */
drdiff = ( GET_DAMROLL(ch) - GET_DAMROLL(victim) );
if ( drdiff >= 20 ) buf2 = "You hit alot harder than $E.";
if ( drdiff <= 10 ) buf2 = "You hit slightly harder than $E.";
if ( drdiff <= 5 ) buf2 = "$E hits about the same as you.";
if ( drdiff <= -5 ) buf2 = "$E hits about the same as you.";
if ( drdiff <= -10 ) buf2 = "$E hits slightly harder than you.";
if ( drdiff <= -20 ) buf2 = "$E hits alot harder than you.";
act( buf2, ch, NULL, victim, TO_CHAR );
buf = "";
hrdiff = (GET_HITROLL(ch) - GET_HITROLL(victim) );
if ( hrdiff >= 20 ) buf3 = "You hit alot more often than $E.";
if ( hrdiff <= 10 ) buf3 = "You hit slightly more often than $E.";
if ( hrdiff <= 5 ) buf3 = "You and $E hit about equally as often.";
if ( hrdiff <= -10 ) buf3 = "$E hits slightly more often than you.";
if ( hrdiff <= -20 ) buf3 = "$E hits alot more often than you.";
act( buf3, ch, NULL, victim, TO_CHAR );
buf3 = "";
acdiff = (GET_AC(victim) - GET_AC(ch));
if ( acdiff >= 100 ) buf4 = "You are Armored like a tank compared to $E.";
if ( acdiff <= 75 ) buf4 = "You are armored quite a bit better than $E is.";
if ( acdiff <= 50 ) buf4 = "You are more heavily armored than $E is.";
if ( acdiff <= 25 ) buf4 = "You are slightly more armored than $E is.";
if ( acdiff <= 5 ) buf4 = "You and $E are armored pretty equally.";
if ( acdiff <= -6 ) buf4 = "$E is slightly more armored than you are.";
if ( acdiff <= -50 ) buf4 = "$E is more heavily armored than you are.";
if ( acdiff <= -75 ) buf4 = "$E is armored quite a bit better than you are.";
if ( acdiff <= -100 ) buf4 = "$E is armored like a tank compared to you.";
act( buf4, ch, NULL, victim, TO_CHAR );
buf = "";
return;
}
void set_title( CHAR_DATA *ch, char *title )
{
char buf[MAX_STRING_LENGTH];
buf[0] = '\0';
if ( IS_NPC(ch) )
{
bug( "Set_title: NPC.", 0 );
return;
}
if ( isalpha(title[0]) || isdigit(title[0]) )
{
buf[0] = ' ';
strcpy( buf+1, title );
}
else
{
strcpy( buf, title );
}
free_string( ch->pcdata->title );
ch->pcdata->title = str_dup( buf );
return;
}
void do_title( CHAR_DATA *ch, char *argument )
{
/* Changed this to limit title length, and to remove and brackets. -S- */
char buf[MAX_STRING_LENGTH];
int cnt;
bool changed;
buf[0] = '\0';
if ( IS_NPC(ch) )
return;
if ( argument[0] == '\0' )
{
send_to_char( "Change your title to what?\n\r", ch );
return;
}
changed = FALSE;
for ( cnt = 0; cnt < strlen(argument); cnt++ )
{
if ( argument[cnt] == '[' || argument[cnt] == ']' )
{
changed = TRUE;
argument[cnt] = ( argument[cnt] == ']' ) ? '>' : '<';
}
}
if ( changed )
send_to_char( "You used either [ or ] in your title. They have been removed!\n\r", ch );
/* my_strlen handles color codes as zero length */
if ( my_strlen(argument) > 29 )
{
send_to_char( "Title too long. Please try again.\n\r", ch );
return;
}
smash_tilde( argument );
set_title( ch, argument );
sprintf( buf, "You are now: %s%s.\n\r", ch->name, ch->pcdata->title );
send_to_char( buf, ch );
}
void do_description( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
buf[0] = '\0';
if ( argument[0] != '\0' )
{
buf[0] = '\0';
smash_tilde( argument );
if ( argument[0] == '+' )
{
if ( ch->description != NULL )
safe_strcat(MAX_STRING_LENGTH, buf, ch->description );
argument++;
while ( isspace(*argument) )
argument++;
}
if ( strlen(buf) + strlen(argument) >= MAX_STRING_LENGTH - 2 )
{
send_to_char( "Description too long.\n\r", ch );
return;
}
safe_strcat(MAX_STRING_LENGTH, buf, argument );
safe_strcat(MAX_STRING_LENGTH, buf, "\n\r" );
free_string( ch->description );
ch->description = str_dup( buf );
}
send_to_char( "Your description is:\n\r", ch );
send_to_char( ch->description ? ch->description : "(None).\n\r", ch );
return;
}
void do_report( CHAR_DATA *ch, char *argument )
{
char buf[MAX_INPUT_LENGTH];
sprintf( buf,
"You report: %d/%d hp %d/%d mana %d/%d mv %d xp.\n\r",
ch->hit, ch->max_hit,
ch->mana, ch->max_mana,
ch->move, ch->max_move,
ch->exp );
send_to_char( buf, ch );
sprintf( buf, "$n reports: %d/%d hp %d/%d mana %d/%d mv %d xp.",
ch->hit, ch->max_hit,
ch->mana, ch->max_mana,
ch->move, ch->max_move,
ch->exp );
act( buf, ch, NULL, NULL, TO_ROOM );
return;
}
void do_practice( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char buf1[MAX_STRING_LENGTH];
CHAR_DATA *mob;
int cnt;
int sn;
int ack;
int class;
/* Now need to check through ch->lvl[] to see if player's level in
* the required class is enough for him/her to be able to prac the
* skill/spell. Eg if char is cle:10 and war:50, we don't want the
* player to be getting level 50 cleric spells, which would happen
* if ch->class was used here! -S-
*/
buf[0] = '\0';
buf1[0] = '\0';
if ( IS_NPC(ch) )
return;
buf1[0] = '\0';
if ( ch->level < 3 )
{
send_to_char(
"You must be third level to practice. Go train instead!\n\r",
ch );
return;
}
/* moved check for mob here. -S- */
for ( mob = ch->in_room->first_person; mob != NULL; mob = mob->next_in_room )
{
if ( IS_NPC(mob) && IS_SET(mob->act, ACT_PRACTICE) )
break;
}
if ( argument[0] == '\0' )
{
int col;
bool ok;
col = 0Showing the first 100 KB of 173.3 KB. Download the archive for the full file.