📄 act_info.c
字号:
return;
}
}
pdesc = get_extra_descr( arg1, ch->in_room->extra_descr );
if ( pdesc != NULL )
{
send_to_char( pdesc, ch );
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' )
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] != ' ' )
{
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;
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 );
}
}
return;
}
/*
* Thanks to Zrin for auto-exit part.
*/
void do_exits( CHAR_DATA *ch, char *argument )
{
extern char * const dir_name[];
char buf[MAX_STRING_LENGTH];
EXIT_DATA *pexit;
bool found;
bool fAuto;
int door;
buf[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++ )
{
if ( ( pexit = ch->in_room->exit[door] ) != NULL
&& pexit->to_room != NULL
&& !IS_SET(pexit->exit_info, EX_CLOSED) )
{
found = TRUE;
if ( fAuto )
{
strcat( buf, " " );
strcat( buf, dir_name[door] );
}
else
{
sprintf( buf + strlen(buf), "%-5s - %s\n\r",
capitalize( dir_name[door] ),
room_is_dark( pexit->to_room )
? "Too dark to tell"
: pexit->to_room->name
);
}
}
}
if ( !found )
strcat( buf, fAuto ? " none" : "None.\n\r" );
if ( fAuto )
strcat( buf, "]\n\r" );
send_to_char( buf, ch );
return;
}
void do_score( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
AFFECT_DATA *paf;
sprintf( buf,
"You are %s%s, level %d, %d years old (%d hours).\n\r",
ch->name,
IS_NPC(ch) ? "" : ch->pcdata->title,
ch->level,
get_age(ch),
(get_age(ch) - 17) * 2 );
send_to_char( buf, ch );
if ( get_trust( ch ) != ch->level )
{
sprintf( buf, "You are trusted at level %d.\n\r",
get_trust( ch ) );
send_to_char( buf, ch );
}
sprintf( buf,
"You have %d/%d hit, %d/%d mana, %d/%d movement, %d practices.\n\r",
ch->hit, ch->max_hit,
ch->mana, ch->max_mana,
ch->move, ch->max_move,
ch->practice );
send_to_char( buf, ch );
sprintf( buf,
"You are carrying %d/%d items with weight %d/%d kg.\n\r",
ch->carry_number, can_carry_n(ch),
ch->carry_weight, can_carry_w(ch) );
send_to_char( buf, ch );
sprintf( buf,
"Str: %d Int: %d Wis: %d Dex: %d Con: %d.\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 );
sprintf( buf,
"You have scored %d exp, and have %d gold coins.\n\r",
ch->exp, ch->gold );
send_to_char( buf, ch );
sprintf( buf,
"Autoexit: %s. Autoloot: %s. Autosac: %s.\n\r",
(!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT)) ? "yes" : "no",
(!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOLOOT)) ? "yes" : "no",
(!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOSAC) ) ? "yes" : "no" );
send_to_char( buf, ch );
sprintf( buf, "Wimpy set to %d hit points.\n\r", ch->wimpy );
send_to_char( buf, ch );
if ( !IS_NPC( ch ) )
{
sprintf( buf, "Page pausing set to %d lines of text.\n\r",
ch->pcdata->pagelen );
send_to_char( buf, ch );
}
if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10 )
send_to_char( "You are drunk.\n\r", ch );
if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] == 0 )
send_to_char( "You are thirsty.\n\r", ch );
if ( !IS_NPC(ch) && ch->pcdata->condition[COND_FULL] == 0 )
send_to_char( "You are hungry.\n\r", ch );
switch ( ch->position )
{
case POS_DEAD:
send_to_char( "You are DEAD!!\n\r", ch );
break;
case POS_MORTAL:
send_to_char( "You are mortally wounded.\n\r", ch );
break;
case POS_INCAP:
send_to_char( "You are incapacitated.\n\r", ch );
break;
case POS_STUNNED:
send_to_char( "You are stunned.\n\r", ch );
break;
case POS_SLEEPING:
send_to_char( "You are sleeping.\n\r", ch );
break;
case POS_RESTING:
send_to_char( "You are resting.\n\r", ch );
break;
case POS_STANDING:
send_to_char( "You are standing.\n\r", ch );
break;
case POS_FIGHTING:
send_to_char( "You are fighting.\n\r", ch );
break;
}
if ( ch->level >= 25 )
{
sprintf( buf, "AC: %d. ", GET_AC(ch) );
send_to_char( buf, ch );
}
send_to_char( "You are ", ch );
if ( GET_AC(ch) >= 101 ) send_to_char( "WORSE than naked!\n\r", ch );
else if ( GET_AC(ch) >= 80 ) send_to_char( "naked.\n\r", ch );
else if ( GET_AC(ch) >= 60 ) send_to_char( "wearing clothes.\n\r", ch );
else if ( GET_AC(ch) >= 40 ) send_to_char( "slightly armored.\n\r", ch );
else if ( GET_AC(ch) >= 20 ) send_to_char( "somewhat armored.\n\r", ch );
else if ( GET_AC(ch) >= 0 ) send_to_char( "armored.\n\r", ch );
else if ( GET_AC(ch) >= - 20 ) send_to_char( "well armored.\n\r", ch );
else if ( GET_AC(ch) >= - 40 ) send_to_char( "strongly armored.\n\r", ch );
else if ( GET_AC(ch) >= - 60 ) send_to_char( "heavily armored.\n\r", ch );
else if ( GET_AC(ch) >= - 80 ) send_to_char( "superbly armored.\n\r", ch );
else if ( GET_AC(ch) >= -100 ) send_to_char( "divinely armored.\n\r", ch );
else send_to_char( "invincible!\n\r", ch );
if ( ch->level >= 15 )
{
sprintf( buf, "Hitroll: %d Damroll: %d.\n\r",
GET_HITROLL(ch), GET_DAMROLL(ch) );
send_to_char( buf, ch );
}
if ( ch->level >= 10 )
{
sprintf( buf, "Alignment: %d. ", ch->alignment );
send_to_char( buf, ch );
}
send_to_char( "You are ", ch );
if ( ch->alignment > 900 ) send_to_char( "angelic.\n\r", ch );
else if ( ch->alignment > 700 ) send_to_char( "saintly.\n\r", ch );
else if ( ch->alignment > 350 ) send_to_char( "good.\n\r", ch );
else if ( ch->alignment > 100 ) send_to_char( "kind.\n\r", ch );
else if ( ch->alignment > -100 ) send_to_char( "neutral.\n\r", ch );
else if ( ch->alignment > -350 ) send_to_char( "mean.\n\r", ch );
else if ( ch->alignment > -700 ) send_to_char( "evil.\n\r", ch );
else if ( ch->alignment > -900 ) send_to_char( "demonic.\n\r", ch );
else send_to_char( "satanic.\n\r", ch );
if ( ch->affected != NULL )
{
send_to_char( "You are affected by:\n\r", ch );
for ( paf = ch->affected; paf != NULL; paf = paf->next )
{
sprintf( buf, "Spell: '%s'", skill_table[paf->type].name );
send_to_char( buf, ch );
if ( ch->level >= 20 )
{
sprintf( buf,
" modifies %s by %d for %d hours",
affect_loc_name( paf->location ),
paf->modifier,
paf->duration );
send_to_char( buf, ch );
}
send_to_char( ".\n\r", ch );
}
}
return;
}
char * const day_name [] =
{
"the Moon", "the Bull", "Deception", "Thunder", "Freedom",
"the Great Gods", "the Sun"
};
char * const month_name [] =
{
"Winter", "the Winter Wolf", "the Frost Giant", "the Old Forces",
"the Grand Struggle", "the Spring", "Nature", "Futility", "the Dragon",
"the Sun", "the Heat", "the Battle", "the Dark Shades", "the Shadows",
"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\rMerc 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];
static char * const sky_look[4] =
{
"cloudless",
"cloudy",
"rainy",
"lit by flashes of lightning"
};
if ( !IS_OUTSIDE(ch) )
{
send_to_char( "You can't see the weather indoors.\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"
);
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 = help_first; 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.
*/
void do_who( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
DESCRIPTOR_DATA *d;
int iClass;
int iLevelLower;
int iLevelUpper;
int nNumber;
int nMatch;
bool rgfClass[MAX_CLASS];
bool fClassRestrict;
bool fImmortalOnly;
/*
* Set default arguments.
*/
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.
*/
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 )
{
send_to_char( "That's not a class.\n\r", ch );
return;
}
}
}
}
/*
* Now show matching chars.
*/
nMatch = 0;
buf[0] = '\0';
for ( d = descriptor_list; 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.
*/
if ( d->connected != CON_PLAYING || !can_see( ch, d->character ) )
continue;
wch = ( d->original != NULL ) ? d->original : d->character;
if ( wch->level < iLevelLower
|| wch->level > iLevelUpper
|| ( fImmortalOnly && wch->level < LEVEL_HERO )
|| ( fClassRestrict && !rgfClass[wch->class] ) )
continue;
nMatch++;
/*
* Figure out what to print for class.
*/
class = class_table[wch->class].who_name;
switch ( wch->level )
{
default: break;
case MAX_LEVEL - 0: class = "GOD"; break;
case MAX_LEVEL - 1: class = "SUP"; break;
case MAX_LEVEL - 2: class = "DEI"; break;
case MAX_LEVEL - 3: class = "ANG"; break;
}
/*
* Format it up.
*/
sprintf( buf + strlen(buf), "[%s][%2d %s] %s%s%s%s\n\r",
race_table[wch->race].who_name,
wch->level,
class,
IS_SET(wch->act, PLR_KILLER) ? "(KILLER) " : "",
IS_SET(wch->act, PLR_THIEF) ? "(THIEF) " : "",
wch->name,
wch->pcdata->title );
}
sprintf( buf2, "You see %d player%s in the game.\n\r",
nMatch, nMatch == 1 ? "" : "s" );
strcat( buf, buf2 );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -