📄 act_move.c
字号:
if ( pexit->key < 0 )
{ send_to_char( "It can't be unlocked.\n\r", ch ); return; }
if ( !has_key( ch, pexit->key) )
{ send_to_char( "You lack the key.\n\r", ch ); return; }
if ( !IS_SET(pexit->exit_info, EX_LOCKED) )
{ send_to_char( "It's already unlocked.\n\r", ch ); return; }
REMOVE_BIT(pexit->exit_info, EX_LOCKED);
send_to_char( "*Click*\n\r", ch );
act( "$n unlocks the $d.", ch, NULL, pexit->keyword, TO_ROOM );
/* unlock the other side */
if ( ( to_room = pexit->to_room ) != NULL
&& ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL
&& pexit_rev->to_room == ch->in_room )
{
REMOVE_BIT( pexit_rev->exit_info, EX_LOCKED );
}
}
return;
}
void do_pick( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *gch;
OBJ_DATA *obj;
int door;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Pick what?\n\r", ch );
return;
}
WAIT_STATE( ch, skill_table[gsn_pick_lock].beats );
/* look for guards */
for ( gch = ch->in_room->people; gch; gch = gch->next_in_room )
{
if ( IS_NPC(gch) && IS_AWAKE(gch) && ch->level + 5 < gch->level )
{
act( "$N is standing too close to the lock.",
ch, NULL, gch, TO_CHAR );
return;
}
}
if ( !IS_NPC(ch) && number_percent( ) > ch->pcdata->learned[gsn_pick_lock] )
{
send_to_char( "You failed.\n\r", ch);
return;
}
if ( ( obj = get_obj_here( ch, arg ) ) != NULL )
{
/* 'pick object' */
if ( obj->item_type != ITEM_CONTAINER )
{ send_to_char( "That's not a container.\n\r", ch ); return; }
if ( !IS_SET(obj->value[1], CONT_CLOSED) )
{ send_to_char( "It's not closed.\n\r", ch ); return; }
if ( obj->value[2] < 0 )
{ send_to_char( "It can't be unlocked.\n\r", ch ); return; }
if ( !IS_SET(obj->value[1], CONT_LOCKED) )
{ send_to_char( "It's already unlocked.\n\r", ch ); return; }
if ( IS_SET(obj->value[1], CONT_PICKPROOF) )
{ send_to_char( "You failed.\n\r", ch ); return; }
REMOVE_BIT(obj->value[1], CONT_LOCKED);
send_to_char( "*Click*\n\r", ch );
act( "$n picks $p.", ch, obj, NULL, TO_ROOM );
return;
}
if ( ( door = find_door( ch, arg ) ) >= 0 )
{
/* 'pick door' */
ROOM_INDEX_DATA *to_room;
EXIT_DATA *pexit;
EXIT_DATA *pexit_rev;
pexit = ch->in_room->exit[door];
if ( !IS_SET(pexit->exit_info, EX_CLOSED) )
{ send_to_char( "It's not closed.\n\r", ch ); return; }
if ( pexit->key < 0 )
{ send_to_char( "It can't be picked.\n\r", ch ); return; }
if ( !IS_SET(pexit->exit_info, EX_LOCKED) )
{ send_to_char( "It's already unlocked.\n\r", ch ); return; }
if ( IS_SET(pexit->exit_info, EX_PICKPROOF) )
{ send_to_char( "You failed.\n\r", ch ); return; }
REMOVE_BIT(pexit->exit_info, EX_LOCKED);
send_to_char( "*Click*\n\r", ch );
act( "$n picks the $d.", ch, NULL, pexit->keyword, TO_ROOM );
/* pick the other side */
if ( ( to_room = pexit->to_room ) != NULL
&& ( pexit_rev = to_room->exit[rev_dir[door]] ) != NULL
&& pexit_rev->to_room == ch->in_room )
{
REMOVE_BIT( pexit_rev->exit_info, EX_LOCKED );
}
}
return;
}
void do_stand( CHAR_DATA *ch, char *argument )
{
switch ( ch->position )
{
case POS_SLEEPING:
if ( IS_AFFECTED(ch, AFF_SLEEP) )
{ send_to_char( "You can't wake up!\n\r", ch ); return; }
send_to_char( "You wake and stand up.\n\r", ch );
act( "$n wakes and stands up.", ch, NULL, NULL, TO_ROOM );
ch->position = POS_STANDING;
break;
case POS_RESTING:
send_to_char( "You stand up.\n\r", ch );
act( "$n stands up.", ch, NULL, NULL, TO_ROOM );
ch->position = POS_STANDING;
break;
case POS_STANDING:
send_to_char( "You are already standing.\n\r", ch );
break;
case POS_FIGHTING:
send_to_char( "You are already fighting!\n\r", ch );
break;
}
return;
}
void do_rest( CHAR_DATA *ch, char *argument )
{
switch ( ch->position )
{
case POS_SLEEPING:
send_to_char( "You are already sleeping.\n\r", ch );
break;
case POS_RESTING:
send_to_char( "You are already resting.\n\r", ch );
break;
case POS_STANDING:
send_to_char( "You rest.\n\r", ch );
act( "$n rests.", ch, NULL, NULL, TO_ROOM );
ch->position = POS_RESTING;
break;
case POS_FIGHTING:
send_to_char( "You are already fighting!\n\r", ch );
break;
}
return;
}
void do_sleep( CHAR_DATA *ch, char *argument )
{
switch ( ch->position )
{
case POS_SLEEPING:
send_to_char( "You are already sleeping.\n\r", ch );
break;
case POS_RESTING:
case POS_STANDING:
send_to_char( "You sleep.\n\r", ch );
act( "$n sleeps.", ch, NULL, NULL, TO_ROOM );
ch->position = POS_SLEEPING;
break;
case POS_FIGHTING:
send_to_char( "You are already fighting!\n\r", ch );
break;
}
return;
}
void do_wake( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{ do_stand( ch, argument ); return; }
if ( !IS_AWAKE(ch) )
{ send_to_char( "You are asleep yourself!\n\r", ch ); return; }
if ( ( victim = get_char_room( ch, arg ) ) == NULL )
{ send_to_char( "They aren't here.\n\r", ch ); return; }
if ( IS_AWAKE(victim) )
{ act( "$N is already awake.", ch, NULL, victim, TO_CHAR ); return; }
if ( IS_AFFECTED(victim, AFF_SLEEP) )
{ act( "You can't wake $M!", ch, NULL, victim, TO_CHAR ); return; }
act( "You wake $M.", ch, NULL, victim, TO_CHAR );
act( "$n wakes you.", ch, NULL, victim, TO_VICT );
victim->position = POS_STANDING;
return;
}
void do_sneak( CHAR_DATA *ch, char *argument )
{
AFFECT_DATA af;
send_to_char( "You attempt to move silently.\n\r", ch );
affect_strip( ch, gsn_sneak );
if ( IS_NPC(ch) || number_percent( ) < ch->pcdata->learned[gsn_sneak] )
{
af.type = gsn_sneak;
af.duration = ch->level;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_SNEAK;
affect_to_char( ch, &af );
}
return;
}
void do_hide( CHAR_DATA *ch, char *argument )
{
send_to_char( "You attempt to hide.\n\r", ch );
if ( IS_AFFECTED(ch, AFF_HIDE) )
REMOVE_BIT(ch->affected_by, AFF_HIDE);
if ( IS_NPC(ch) || number_percent( ) < ch->pcdata->learned[gsn_hide] )
SET_BIT(ch->affected_by, AFF_HIDE);
return;
}
/*
* Contributed by Alander.
*/
void do_visible( CHAR_DATA *ch, char *argument )
{
affect_strip ( ch, gsn_invis );
affect_strip ( ch, gsn_mass_invis );
affect_strip ( ch, gsn_sneak );
REMOVE_BIT ( ch->affected_by, AFF_HIDE );
REMOVE_BIT ( ch->affected_by, AFF_INVISIBLE );
REMOVE_BIT ( ch->affected_by, AFF_SNEAK );
send_to_char( "Ok.\n\r", ch );
return;
}
void do_recall( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
CHAR_DATA *victim;
ROOM_INDEX_DATA *location;
act( "$n prays for transportation!", ch, 0, 0, TO_ROOM );
// if ( ( location = get_room_index( ROOM_VNUM_TEMPLE ) ) == NULL )
if ( ( location = get_room_index( race_table[ch->race].city_temple ) ) == NULL )
{
send_to_char( "You are completely lost.\n\r", ch );
return;
}
if ( ch->in_room == location )
return;
if ( IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL)
|| IS_AFFECTED(ch, AFF_CURSE) )
{
send_to_char( "God has forsaken you.\n\r", ch );
return;
}
if ( ( victim = ch->fighting ) != NULL )
{
int lose;
if ( number_bits( 1 ) == 0 )
{
WAIT_STATE( ch, 4 );
lose = (ch->desc != NULL) ? 50 : 100;
gain_exp( ch, 0 - lose );
sprintf( buf, "You failed! You lose %d exps.\n\r", lose );
send_to_char( buf, ch );
return;
}
lose = (ch->desc != NULL) ? 100 : 200;
gain_exp( ch, 0 - lose );
sprintf( buf, "You recall from combat! You lose %d exps.\n\r", lose );
send_to_char( buf, ch );
stop_fighting( ch, TRUE );
}
ch->move /= 2;
act( "$n disappears.", ch, NULL, NULL, TO_ROOM );
char_from_room( ch );
char_to_room( ch, location );
act( "$n appears in the room.", ch, NULL, NULL, TO_ROOM );
do_look( ch, "auto" );
return;
}
/* { "identify", do_identify, POS_STANDING, 0, LOG_NORMAL }, */
#define MOB_VNUM_SAGE 8911
void do_identify( CHAR_DATA *ch, char *argument )
{
OBJ_DATA *obj;
CHAR_DATA *rch;
if ( ( obj = get_obj_carry( ch, argument ) ) == NULL )
{
send_to_char( "You are not carrying that.\n\r", ch );
return;
}
for ( rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room )
if (IS_NPC(rch) && rch->pIndexData->vnum == MOB_VNUM_SAGE)
break;
if (!rch)
{
send_to_char("No one here seems to know much about that.\n\r", ch);
return;
}
if (IS_IMMORTAL(ch))
act( "$n cackles and comps you!\n\r", rch, obj, ch, TO_VICT );
else if (ch->gold < obj->level * 100 + 50)
{
act( "$n resumes tossing bones without looking at $p.",
rch, obj, 0, TO_ROOM );
return;
}
else
{
ch->gold -= obj->level * 100 + 50;
send_to_char("Your purse feels lighter.\n\r", ch);
}
act( "$n fondles $p and tosses some chicken bones to the ground.",
rch, obj, 0, TO_ROOM );
spell_identify( 0, 0, ch, obj );
}
void do_train( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
CHAR_DATA *mob;
int hp_gain = 0;
int mana_gain = 0;
sh_int *pAbility;
char *pOutput;
int cost;
if ( IS_NPC(ch) )
return;
/*
* Check for trainer.
*/
for ( mob = ch->in_room->people; mob; mob = mob->next_in_room )
{
if ( IS_NPC(mob) && IS_SET(mob->act, ACT_TRAIN) )
break;
}
if ( mob == NULL )
{
send_to_char( "You can't do that here.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
sprintf( buf, "You have %d practice sessions.\n\r", ch->practice );
send_to_char( buf, ch );
argument = "foo";
}
cost = 5;
if ( !str_cmp( argument, "str" ) )
{
if ( class_table[ch->class].attr_prime == APPLY_STR )
cost = 3;
pAbility = &ch->pcdata->perm_str;
pOutput = "strength";
}
else if ( !str_cmp( argument, "int" ) )
{
if ( class_table[ch->class].attr_prime == APPLY_INT )
cost = 3;
pAbility = &ch->pcdata->perm_int;
pOutput = "intelligence";
}
else if ( !str_cmp( argument, "wis" ) )
{
if ( class_table[ch->class].attr_prime == APPLY_WIS )
cost = 3;
pAbility = &ch->pcdata->perm_wis;
pOutput = "wisdom";
}
else if ( !str_cmp( argument, "dex" ) )
{
if ( class_table[ch->class].attr_prime == APPLY_DEX )
cost = 3;
pAbility = &ch->pcdata->perm_dex;
pOutput = "dexterity";
}
else if ( !str_cmp( argument, "con" ) )
{
if ( class_table[ch->class].attr_prime == APPLY_CON )
cost = 3;
pAbility = &ch->pcdata->perm_con;
pOutput = "constitution";
}
else if ( !str_cmp( argument, "hp" ) )
{
pAbility = &ch->max_hit;
pOutput = "number of hit points";
cost = 1; /* this is pracs per "train hp" */
hp_gain = 2; /* this is hp gained per "train hp" */
}
else if ( !str_cmp( argument, "mana" ) )
{
pAbility = &ch->max_mana;
pOutput = "amount of mana";
cost =1;
mana_gain = 3;
}
else
{
strcpy( buf, "You can train: hp mana" );
if ( ch->pcdata->perm_str < 18 ) strcat( buf, " str" );
if ( ch->pcdata->perm_int < 18 ) strcat( buf, " int" );
if ( ch->pcdata->perm_wis < 18 ) strcat( buf, " wis" );
if ( ch->pcdata->perm_dex < 18 ) strcat( buf, " dex" );
if ( ch->pcdata->perm_con < 18 ) strcat( buf, " con" );
// if ( buf[strlen(buf)-1] != ':' )
// {
strcat( buf, ".\n\r" );
send_to_char( buf, ch );
// }
// else
// {
// /*
// * This message dedicated to Jordan ... you big stud!
// */
// act( "You have nothing left to train, you $T!",
// ch, NULL,
// ch->sex == SEX_MALE ? "big stud" :
// ch->sex == SEX_FEMALE ? "hot babe" :
// "wild thing",
// TO_CHAR );
// }
return;
}
if ( !str_cmp( argument, "hp" ) )
{
if ( cost > ch->practice )
{
send_to_char( "You don't have enough practices.\n\r", ch );
return;
}
ch->practice -= cost;
*pAbility += hp_gain;
act( "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
act( "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
return;
}
if ( !str_cmp( argument, "mana" ) )
{
if ( cost > ch->practice )
{
send_to_char( "You don't have enough practices.\n\r", ch );
return;
}
ch->practice -= cost;
*pAbility += mana_gain;
act( "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
act( "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
return;
}
if ( *pAbility >= 18 )
{
act( "Your $T is already at maximum.", ch, NULL, pOutput, TO_CHAR );
return;
}
if ( cost > ch->practice )
{
send_to_char( "You don't have enough practices.\n\r", ch );
return;
}
ch->practice -= cost;
*pAbility += 1;
act( "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
act( "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -