Exemplo n.º 1
0
char *get_exits( CHAR_DATA * ch )
{
	static char buf[MAX_STRING_LENGTH];
	EXIT_DATA *pexit;
	bool found = FALSE;

	buf[0] = '\0';

	if ( !check_blind( ch ) )
		return buf;

	set_char_color( AT_EXITS, ch );

	mudstrlcpy( buf, "[Exits:", MAX_STRING_LENGTH );

	for ( pexit = ch->in_room->first_exit; pexit; pexit = pexit->next )
	{
		if ( IS_IMMORTAL( ch ) )
			/*
			 * Immortals see all exits, even secret ones 
			 */
		{
			if ( pexit->to_room )
			{
				found = TRUE;
				mudstrlcat( buf, " ", MAX_STRING_LENGTH );

				mudstrlcat( buf, capitalize( dir_name[pexit->vdir] ), MAX_STRING_LENGTH );

				/*
				 * New code added to display closed, or otherwise invisible exits to immortals 
				 * Installed by Samson 1-25-98 
				 */
				if ( IS_SET( pexit->exit_info, EX_CLOSED ) )
					mudstrlcat( buf, "->(Closed)", MAX_STRING_LENGTH );
				if ( IS_SET( pexit->exit_info, EX_DIG ) )
					mudstrlcat( buf, "->(Dig)", MAX_STRING_LENGTH );
				if ( IS_SET( pexit->exit_info, EX_WINDOW ) )
					mudstrlcat( buf, "->(Window)", MAX_STRING_LENGTH );
				if ( IS_SET( pexit->exit_info, EX_HIDDEN ) )
					mudstrlcat( buf, "->(Hidden)", MAX_STRING_LENGTH );
				if ( xIS_SET( pexit->to_room->room_flags, ROOM_DEATH ) )
					mudstrlcat( buf, "->(Deathtrap)", MAX_STRING_LENGTH );
			}
		}
		else
		{
			if ( pexit->to_room
				&& !IS_SET( pexit->exit_info, EX_SECRET ) && ( !IS_SET( pexit->exit_info, EX_WINDOW ) || IS_SET( pexit->exit_info, EX_ISDOOR ) ) && !IS_SET( pexit->exit_info, EX_HIDDEN ) )
			{
				found = TRUE;
				mudstrlcat( buf, " ", MAX_STRING_LENGTH );

				mudstrlcat( buf, capitalize( dir_name[pexit->vdir] ), MAX_STRING_LENGTH );

				if ( IS_SET( pexit->exit_info, EX_CLOSED ) )
					mudstrlcat( buf, "->(Closed)", MAX_STRING_LENGTH );
				if ( IS_AFFECTED( ch, AFF_DETECTTRAPS ) && xIS_SET( pexit->to_room->room_flags, ROOM_DEATH ) )
					mudstrlcat( buf, "->(Deathtrap)", MAX_STRING_LENGTH );
			}
		}
	}

	if ( !found )
		mudstrlcat( buf, " none]", MAX_STRING_LENGTH );
	else
		mudstrlcat( buf, "]", MAX_STRING_LENGTH );
	mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH );
	return buf;
}
Exemplo n.º 2
0
void do_scan( CHAR_DATA *ch, char *argument )
{
    EXIT_DATA       *pexit;
    ROOM_INDEX_DATA *room;
    ROOM_INDEX_DATA *in_room;
    DESCRIPTOR_DATA * d;
    extern char *const dir_name[];
    char buf[ MAX_STRING_LENGTH ];
    char exitname[ MAX_STRING_LENGTH ];
    int lookdoor, door, iter;
    int distance, max_dist;
    int mob_count, mob_count_new;
    bool darkness = FALSE;
    const char *dir_long_name[] = { "pó³noc", "wschód", "po³udnie", "zachód", "góra", "dó³" };
    lookdoor = -1;
    door = -1;

    if ( !IS_NPC( ch ) && ch->pcdata->mind_in )
    {
        in_room = ch->pcdata->mind_in;
    }
    else
    {
        if ( !check_blind( ch ) )
        {
            return ;
        }
        in_room = ch->in_room;
    }

    if ( argument[0] != '\0' )
    {
        if ( IS_AFFECTED( ch, AFF_MAZE ) )
        {
            send_to_char("Nie bardzo wiesz w która stronê popatrzeæ.\n\r", ch);
            return;
        }

        //wieza obserwacyjna
        if( !str_prefix( argument, "around" ) )
        {
            if ( !EXT_IS_SET( ch->in_room->room_flags, ROOM_WATCH_TOWER ) )
            {
                send_to_char( "Musisz byæ na szczycie wie¿y obserwacyjnej.\n\r", ch );
                return;
            }

            if ( ch->position != POS_STANDING )
            {
                send_to_char( "Najpierw wstañ.\n\r", ch );
                return;
            }

            send_to_char( "Ze szczytu wie¿y ogl±dasz uwa¿nie ca³± okolicê.\n\r", ch );
            act( "Stoj±c na szczycie wie¿y $n uwa¿nie omiata wzrokiem ca³± okolicê.", ch, NULL, NULL, TO_ROOM );

            for ( d = descriptor_list; d != NULL; d = d->next )
            {
                if ( !d->character || d->connected < 0 )
                {
                    continue;
                }
                if( d->connected != CON_PLAYING || d->character == ch || d->character->in_room == NULL )
                {
                    continue;
                }
                if ( !SAME_AREA( d->character->in_room->area, ch->in_room->area ) || !SAME_AREA_PART( d->character, ch ) )
                {
                    continue;
                }
                if ( !can_see( ch, d->character ) )
                {
                    continue;
                }
                if ( EXT_IS_SET( d->character->in_room->room_flags, ROOM_INDOORS ) || IS_SET( sector_table[ d->character->in_room->sector_type ].flag, SECT_NOWEATHER ) )
                {
                    continue;
                }
                if ( ch->in_room == d->character->in_room )
                {
                    continue;
                }
                print_char( ch, "{x%s - Widzisz tam {C%s{x.\n\r", d->character->in_room->name, d->character->name4 );
            }
            return;
        }
        door = get_door( ch, argument );
        if ( door >= 0 && check_vname( ch, door, FALSE ) )
        {
            send_to_char("W ktorym kierunku chcesz siê rozejrzeæ?\n\r", ch);
            return;
        }
        if ( door < 0 )
        {
            door = -1;
            for ( iter = 0; iter <= 5; iter++ )
            {
                if ( ( pexit = in_room->exit[iter] ) != NULL &&   !str_prefix( argument, pexit->vName ) &&  !( (IS_SET(pexit->exit_info, EX_SECRET) || IS_SET(pexit->exit_info, EX_HIDDEN))&& !IS_AFFECTED(ch,AFF_DETECT_HIDDEN) ) )
                {
                    door = iter;
                    break;
                }
            }
        }
        if ( door < 0 || in_room->exit[door] == NULL )
        {
            send_to_char("W ktorym kierunku chcesz siê rozejrzeæ?\n\r", ch);
            return;
        }
        lookdoor = door;
        door = -1;
    }
    if ( lookdoor < 0 )
    {
        if ( IS_NPC( ch ) || !ch->pcdata->mind_in )
        {
            act("$n rozgl±da siê dooko³a.", ch, NULL, NULL, TO_ROOM);
        }
        send_to_char("Rozgl±daj±c siê dooko³a widzisz:\n\r", ch);
        sprintf( buf, "{CTutaj{x\n\r" );
        mob_count = 0;
        mob_count_new = scan_room (ch, in_room, buf, 0);
        if ( mob_count_new < 0 )
        {
            send_to_char( "{CTutaj{x{c - nieprzenikniona ciemno¶æ.{x\n\r", ch );
            darkness = TRUE;
        }
        else
        {
            mob_count += mob_count_new;
        }
        strcat(buf, "{x");
        if ( mob_count > 0 )
        {
            send_to_char ( buf, ch );
        }
        else
        {
            if ( mob_count == 0 && !darkness)
            {
                send_to_char( "{CTutaj{x{c - nikogo nie ma.{x\n\r", ch );
            }
        }
    }
    darkness = FALSE;

    if ( !IS_NPC( ch ) && !EXT_IS_SET( ch->act, PLR_HOLYLIGHT ) )
    {
        if ( room_is_dark(ch, in_room) && !IS_AFFECTED(ch, AFF_INFRARED) )
        {
            send_to_char("Jest tutaj zbyt ciemno aby powiedzieæ co¶ o okolicy.\n\r", ch);
            return;
        }
    }
    for ( door = 0; door < MAX_DIR; door++ )
    {
        room = in_room;
        if ( lookdoor >= 0 && door != lookdoor )
        {
            continue;
        }
        if ( ( pexit = room->exit[door] ) == NULL )
        {
            continue;
        }
        if ( lookdoor >= 0 || !( ( IS_SET(pexit->exit_info, EX_SECRET) && !IS_SET(pexit->exit_info, EX_HIDDEN) ) || ( IS_SET(pexit->exit_info, EX_HIDDEN) && !IS_AFFECTED(ch,AFF_DETECT_HIDDEN) ) ) )
        {
            if ( pexit )
            {
                if ( pexit->vName && pexit->vName[0] != '\0' )
                {
                    sprintf( exitname, "%s", pexit->vName );
                }
                else
                {
                    if ( IS_AFFECTED( ch, AFF_MAZE ) )
                    {
                        sprintf ( exitname, "%s", capitalize( dir_long_name[ number_range( 0, 5 ) ] ) );
                    }
                    else
                    {
                        sprintf( exitname, "%s", capitalize( dir_name[door] ) );
                    }
                }
            }
            else
            {
                exitname[0] = '\0';
            }
            if ( !room_is_dark( ch, in_room ) )
            {
                if ( IS_SET( pexit->exit_info, EX_HIDDEN ) )
                {
                    sprintf( buf, "{C%s{x{c - kto¶ stara³ siê ukryæ to przej¶cie.{x\n\r", exitname );
                    send_to_char( buf, ch );
                    continue;
                }
                else if ( IS_SET( pexit->exit_info, EX_CLOSED ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) )
                {
                    if ( pexit->biernik != NULL && pexit->biernik[ 0 ] != '\0' && pexit->biernik[ 0 ] != ' ' )
                    {
                        if( !pexit->liczba_mnoga )
                        {
                            sprintf( buf, "{C%s{x{c - nic nie widzisz przez zamkniêt± %s.{x\n\r", exitname, pexit->biernik );
                        }
                        else
                        {
                            sprintf( buf, "{C%s{x{c - nic nie widzisz przez zamkniête %s.{x\n\r", exitname, pexit->biernik );
                        }
                        send_to_char( buf, ch );
                    }
                    else
                    {
                        sprintf( buf, "{C%s{x{c - nic nie widzisz przez zamkniête drzwi.{x\n\r", exitname );
                        send_to_char( buf, ch );
                    }
                    continue;
                }
                else if ( IS_SET( pexit->exit_info, EX_WALL_OF_MIST ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) )
                {
                    sprintf( buf, "{C%s{x{c - ¶ciana mg³y zas³ania ci widoczno¶æ.{x\n\r", exitname );
                    send_to_char( buf, ch );
                    continue;
                }
            }

            buf[0] = '\0';
            mob_count = 0;
            max_dist = (lookdoor < 0)? 2:4;

            /**
             * imorovmen range for elfs
             * http://forum.mud.pl/viewtopic.php?t=5457
             */
            if(!str_cmp( race_table[ GET_RACE(ch) ].name, "elf" ))
            {
                max_dist += number_range(0, 2);
            }
            for ( distance = 1 ; distance < max_dist; distance++ )
            {
                pexit = room->exit[door];
                if ( !pexit || !pexit->u1.to_room || ( IS_SET( pexit->exit_info, EX_CLOSED ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) ) || ( IS_SET( pexit->exit_info, EX_WALL_OF_MIST ) && !IS_AFFECTED(ch, AFF_PIERCING_SIGHT) ))
                {
                    break;
                }
                darkness = FALSE;
                mob_count_new = scan_room ( ch, pexit->u1.to_room, buf, distance);
                if (  mob_count_new < 0)
                {
                    printf_to_char( ch, "{C%s{x{c - panuje tam nieprzenikniona ciemno¶æ.{x\n\r", exitname );
                    darkness = TRUE;
                }
                else
                {
                    mob_count += mob_count_new;
                }

                room = pexit->u1.to_room;
            }
            strcat(buf, "{x");

            if ( mob_count > 0 && !darkness )
            {
                if ( room_is_dark( ch, in_room ) )
                {
                    printf_to_char( ch, "{C%s{x{c - widaæ tam chyba kogo¶.{x\n\r", exitname );
                }
                else
                {
                    print_char( ch, "{C%s{x\n\r", exitname );
                    send_to_char ( buf, ch );
                }
            }
            else if ( !room_is_dark( ch, in_room ) && !darkness )
            {
                if ( mob_count == 0 && in_room->exit[door])
                {
                    printf_to_char( ch, "{C%s{x{c - nikogo tam nie widaæ.{x\n\r", exitname );
                }
            }
            darkness = FALSE;
        }
    }

    if ( room_is_dark( ch, in_room ) )
    {
        send_to_char("\n\rJest tutaj zbyt ciemno aby powiedzieæ co¶ dok³adniej o okolicy.\n\r", ch);
        return;
    }
    return;
}