void do_search( CHAR_DATA *ch, char *argument )
{
char arg [MAX_INPUT_LENGTH];
OBJ_DATA *obj;
OBJ_DATA *container;
OBJ_DATA *startobj;
int percent, door;
door = -1;
switch( ch->substate )
{
default:
if ( IS_NPC(ch) && IS_AFFECTED( ch, AFF_CHARM ) )
{
send_to_char( "You can't concentrate enough for that.\n\r", ch );
return;
}
if ( ch->mount )
{
send_to_char( "You can't do that while mounted.\n\r", ch );
return;
}
argument = one_argument( argument, arg );
if ( arg[0] != '\0' && (door = get_door( arg )) == -1 )
{
container = get_obj_here( ch, arg );
if ( !container )
{
send_to_char( "You can't find that here.\n\r", ch );
return;
}
if ( container->item_type != ITEM_CONTAINER )
{
send_to_char( "You can't search in that!\n\r", ch );
return;
}
if ( IS_SET(container->value[1], CONT_CLOSED) )
{
send_to_char( "It is closed.\n\r", ch );
return;
}
}
add_timer( ch, TIMER_DO_FUN, UMIN(skill_table[gsn_search]->beats / 10, 3),
do_search, 1 );
send_to_char( "You begin your search...\n\r", ch );
ch->alloc_ptr = str_dup( arg );
return;
case 1:
if ( !ch->alloc_ptr )
{
send_to_char( "Your search was interrupted!\n\r", ch );
bug( "do_search: alloc_ptr NULL", 0 );
return;
}
strcpy( arg, ch->alloc_ptr );
DISPOSE( ch->alloc_ptr );
break;
case SUB_TIMER_DO_ABORT:
DISPOSE( ch->alloc_ptr );
ch->substate = SUB_NONE;
send_to_char( "You stop your search...\n\r", ch );
return;
}
ch->substate = SUB_NONE;
if ( arg[0] == '\0' )
startobj = ch->in_room->first_content;
else
{
if ( (door = get_door( arg )) != -1 )
startobj = NULL;
else
{
container = get_obj_here( ch, arg );
if ( !container )
{
send_to_char( "You can't find that here.\n\r", ch );
return;
}
startobj = container->first_content;
}
}
if ( (!startobj && door == -1) || IS_NPC(ch) )
{
send_to_char( "You find nothing.\n\r", ch );
learn_from_failure( ch, gsn_search );
return;
}
percent = number_percent( ) + number_percent( ) - ( ch->level / 10 );
if ( door != -1 )
{
EXIT_DATA *pexit;
if ( (pexit = get_exit( ch->in_room, door )) != NULL
&& IS_SET( pexit->exit_info, EX_SECRET )
&& IS_SET( pexit->exit_info, EX_xSEARCHABLE )
&& can_use_skill( ch, percent, gsn_search ) )
{
act( AT_SKILL, "Your search reveals the $d!", ch, NULL, pexit->keyword, TO_CHAR );
act( AT_SKILL, "$n finds the $d!", ch, NULL, pexit->keyword, TO_ROOM );
REMOVE_BIT( pexit->exit_info, EX_SECRET );
learn_from_success( ch, gsn_search );
return;
}
}
else
for ( obj = startobj; obj; obj = obj->next_content )
{
if ( IS_OBJ_STAT( obj, ITEM_HIDDEN )
&& can_use_skill(ch, percent, gsn_search ) )
{
separate_obj(obj);
xREMOVE_BIT( obj->extra_flags, ITEM_HIDDEN );
act( AT_SKILL, "Your search reveals $p!", ch, obj, NULL, TO_CHAR );
act( AT_SKILL, "$n finds $p!", ch, obj, NULL, TO_ROOM );
learn_from_success( ch, gsn_search );
return;
}
}
send_to_char( "You find nothing.\n\r", ch );
learn_from_failure( ch, gsn_search );
return;
}
This is the "search" skill. What would I have to change in it give the player full ability to use it without trains? I know, you're saying to yourself "This guy has no idea what's he's doing." Well, you're right. I just need someone to point me in the right direction. :)
-Alexander |