Ejemplo n.º 1
0
void look_room(struct char_data *ch, struct room_index_data *in_room) {
    if (!validate_look(ch)) {
	return;
    }

    if (in_room == NULL) {
	send_to_char("NOWHERE.", ch);
	return;
    }

    if (room_is_dark(ch, in_room) && !IS_SET(ch->act, PLR_HOLYLIGHT)) {
	send_to_char("It is pitch ```8black...`` \n\r", ch);
	show_char_to_char(in_room->people, ch);
	return;
    }


    send_to_char(in_room->name, ch);
    if ((IS_IMMORTAL(ch) && (IS_NPC(ch) || IS_SET(ch->act, PLR_HOLYLIGHT))) || IS_BUILDER(ch, in_room->area)) {
	printf_to_char(ch, " [`1Room `!%d``]", in_room->vnum);
    }

    send_to_char("\n\r", ch);
    if ((!IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF))) {
	send_to_char("  ", ch);
	send_to_char(in_room->description, ch);
    }

    send_to_char("\n\r", ch);

    if ((is_affected(ch, gsp_detect_magic) || IS_SET(ch->act, PLR_HOLYLIGHT))) {
	struct affect_data *paf;
	for (paf = in_room->affected; paf != NULL; paf = paf->next) {
	    send_to_char(room_affect(paf), ch);
	}
	send_to_char("\n\r", ch);
    }

    if (!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT))
	do_exits(ch, "auto");

    if (is_affected_room(in_room, gsp_faerie_fog))
	send_to_char("There is a `Ppurple haze`` floating throughout the room.\n\r", ch);

    show_list_to_char(in_room->contents, ch, false, false);
    show_char_to_char(in_room->people, ch);
    return;
}
Ejemplo n.º 2
0
void list_char_to_char(struct char_data *list, struct char_data *ch,
                       int mode) {
    struct char_data *i;

    for (i = list; i ; i = i->next_in_room) {
        if ( (ch!=i) && (IS_AFFECTED(ch, AFF_SENSE_LIFE) ||
                         (CAN_SEE(ch,i) && !IS_AFFECTED(i, AFF_HIDE))) )
            show_char_to_char(i,ch,0);
    }
}
Ejemplo n.º 3
0
void look_object(struct char_data *ch, struct gameobject *obj, const char *argument) {
    struct gameobject *portal;
    struct room_index_data *location;

    if (!validate_look(ch)) {
	return;
    }

    switch (obj->item_type) {
	default:
	    send_to_char("That is not a container.\n\r", ch);
	    break;

	case ITEM_DRINK_CON:
	    if (obj->value[1] == 0) {
		send_to_char("It is empty.\n\r", ch);
	    } else {
		printf_to_char(ch, "It's %sfilled with  a %s liquid.\n\r",
			obj->value[1] < obj->value[0] / 4
			? "less than half-" :
			obj->value[1] < 3 * obj->value[0] / 4
			? "about half-" : "more than half-",
			liq_table[obj->value[2]].liq_color);
	    }
	    break;

	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);
	    } else {
		act("$p holds```8:``", ch, obj, NULL, TO_CHAR);
		show_list_to_char(obj->contains, ch, true, true);
	    }
	    break;
	case ITEM_PORTAL:
	    portal = get_obj_list(ch, argument, ch->in_room->contents);
	    if (portal != NULL) {
		location = get_room_index(portal->value[3]);
		if (location == NULL) {
		    send_to_char("It looks very empty..\n\r", ch);
		} else {
		    send_to_char(location->name, ch);
		    send_to_char("\n\r", ch);
		    if (!IS_SET(location->room_flags, ROOM_INDOORS))
			print_weather(ch);
		    else
			send_to_char("You can not discern weather conditions beyond this portal.\n\r", ch);
		    if (!IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF)) {
			send_to_char(location->description, ch);
		    }
		    send_to_char("\n\r", ch);

		    if (!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT)) {
			char showexit[100];

			sprintf(showexit, "%ld exits auto", location->vnum);
			do_at(ch, showexit);
		    }

		    show_list_to_char(location->contents, ch, false, false);
		    show_char_to_char(location->people, ch);
		}
	    }
	    break;
    }
}
Ejemplo n.º 4
0
void do_look(struct char_data *ch, char *argument, int cmd)
{
    char buffer[MAX_STRING_LENGTH];
    char arg1[MAX_STRING_LENGTH];
    char arg2[MAX_STRING_LENGTH];
    int keyword_no;
    int j, bits, temp;
    bool found;
    struct obj_data *tmp_object, *found_object;
    struct char_data *tmp_char;
    char *tmp_desc;
    static char *keywords[]= {
        "north",
        "east",
        "south",
        "west",
        "up",
        "down",
        "in",
        "at",
        "",  /* Look at '' case */
        "\n"
    };

    if (!ch->desc)
        return;

    if (GET_POS(ch) < POSITION_SLEEPING)
        send_to_char("You can't see anything but stars!\n\r", ch);
    else if (GET_POS(ch) == POSITION_SLEEPING)
        send_to_char("You can't see anything, you're sleeping!\n\r", ch);
    else if ( IS_AFFECTED(ch, AFF_BLIND) )
        send_to_char("You can't see a damn thing, you're blinded!\n\r", ch);
    else if ( IS_DARK(ch->in_room) )
        send_to_char("It is pitch black...\n\r", ch);
    else {
        argument_split_2(argument,arg1,arg2);
        keyword_no = search_block(arg1, keywords, FALSE); /* Partiel Match */

        if ((keyword_no == -1) && *arg1) {
            keyword_no = 7;
            strcpy(arg2, arg1); /* Let arg2 become the target object (arg1) */
        }

        found = FALSE;
        tmp_object = 0;
        tmp_char	 = 0;
        tmp_desc	 = 0;

        switch(keyword_no) {
        /* look <dir> */
        case 0 :
        case 1 :
        case 2 :
        case 3 :
        case 4 :
        case 5 : {

            if (EXIT(ch, keyword_no)) {

                if (EXIT(ch, keyword_no)->general_description) {
                    send_to_char(EXIT(ch, keyword_no)->
                                 general_description, ch);
                } else {
                    send_to_char("You see nothing special.\n\r", ch);
                }

                if (IS_SET(EXIT(ch, keyword_no)->exit_info, EX_CLOSED) &&
                        (EXIT(ch, keyword_no)->keyword)) {
                    sprintf(buffer, "The %s is closed.\n\r",
                            fname(EXIT(ch, keyword_no)->keyword));
                    send_to_char(buffer, ch);
                }	else {
                    if (IS_SET(EXIT(ch, keyword_no)->exit_info, EX_ISDOOR) &&
                            EXIT(ch, keyword_no)->keyword) {
                        sprintf(buffer, "The %s is open.\n\r",
                                fname(EXIT(ch, keyword_no)->keyword));
                        send_to_char(buffer, ch);
                    }
                }
            } else {
                send_to_char("Nothing special there...\n\r", ch);
            }
        }
        break;

        /* look 'in'	*/
        case 6: {
            if (*arg2) {
                /* Item carried */

                bits = generic_find(arg2, FIND_OBJ_INV | FIND_OBJ_ROOM |
                                    FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object);

                if (bits) { /* Found something */
                    if (GET_ITEM_TYPE(tmp_object)== ITEM_DRINKCON)
                    {
                        if (tmp_object->obj_flags.value[1] <= 0) {
                            act("It is empty.", FALSE, ch, 0, 0, TO_CHAR);
                        } else {
                            temp=((tmp_object->obj_flags.value[1]*3)/tmp_object->obj_flags.value[0]);
                            sprintf(buffer,"It's %sfull of a %s liquid.\n\r",
                                    fullness[temp],color_liquid[tmp_object->obj_flags.value[2]]);
                            send_to_char(buffer, ch);
                        }
                    } else if (GET_ITEM_TYPE(tmp_object) == ITEM_CONTAINER) {
                        if (!IS_SET(tmp_object->obj_flags.value[1],CONT_CLOSED)) {
                            send_to_char(fname(tmp_object->name), ch);
                            switch (bits) {
                            case FIND_OBJ_INV :
                                send_to_char(" (carried) : \n\r", ch);
                                break;
                            case FIND_OBJ_ROOM :
                                send_to_char(" (here) : \n\r", ch);
                                break;
                            case FIND_OBJ_EQUIP :
                                send_to_char(" (used) : \n\r", ch);
                                break;
                            }
                            list_obj_to_char(tmp_object->contains, ch, 2, TRUE);
                        }
                        else
                            send_to_char("It is closed.\n\r", ch);
                    } else {
                        send_to_char("That is not a container.\n\r", ch);
                    }
                } else { /* wrong argument */
                    send_to_char("You do not see that item here.\n\r", ch);
                }
            } else { /* no argument */
                send_to_char("Look in what?!\n\r", ch);
            }
        }
        break;

        /* look 'at'	*/
        case 7 : {


            if (*arg2) {

                bits = generic_find(arg2, FIND_OBJ_INV | FIND_OBJ_ROOM |
                                    FIND_OBJ_EQUIP | FIND_CHAR_ROOM, ch, &tmp_char, &found_object);

                if (tmp_char) {
                    show_char_to_char(tmp_char, ch, 1);
                    if (ch != tmp_char) {
                        act("$n looks at you.", TRUE, ch, 0, tmp_char, TO_VICT);
                        act("$n looks at $N.", TRUE, ch, 0, tmp_char, TO_NOTVICT);
                    }
                    return;
                }


                /* Search for Extra Descriptions in room and items */

                /* Extra description in room?? */
                if (!found) {
                    tmp_desc = find_ex_description(arg2,
                                                   world[ch->in_room].ex_description);
                    if (tmp_desc) {
                        page_string(ch->desc, tmp_desc, 0);
                        return; /* RETURN SINCE IT WAS A ROOM DESCRIPTION */
                        /* Old system was: found = TRUE; */
                    }
                }

                /* Search for extra descriptions in items */

                /* Equipment Used */

                if (!found) {
                    for (j = 0; j< MAX_WEAR && !found; j++) {
                        if (ch->equipment[j]) {
                            if (CAN_SEE_OBJ(ch,ch->equipment[j])) {
                                tmp_desc = find_ex_description(arg2,
                                                               ch->equipment[j]->ex_description);
                                if (tmp_desc) {
                                    page_string(ch->desc, tmp_desc, 1);
                                    found = TRUE;
                                }
                            }
                        }
                    }
                }

                /* In inventory */

                if (!found) {
                    for(tmp_object = ch->carrying;
                            tmp_object && !found;
                            tmp_object = tmp_object->next_content) {
                        if CAN_SEE_OBJ(ch, tmp_object) {
                            tmp_desc = find_ex_description(arg2,
                                                           tmp_object->ex_description);
                            if (tmp_desc) {
                                page_string(ch->desc, tmp_desc, 1);
                                found = TRUE;
                            }
                        }
                    }
                }

                /* Object In room */

                if (!found) {
                    for(tmp_object = world[ch->in_room].contents;
                            tmp_object && !found;
                            tmp_object = tmp_object->next_content) {
                        if CAN_SEE_OBJ(ch, tmp_object) {
                            tmp_desc = find_ex_description(arg2,
                                                           tmp_object->ex_description);
                            if (tmp_desc) {
                                page_string(ch->desc, tmp_desc, 1);
                                found = TRUE;
                            }
                        }
                    }
                }
                /* wrong argument */

                if (bits) { /* If an object was found */
                    if (!found)
                        show_obj_to_char(found_object, ch, 5); /* Show no-description */
                    else
                        show_obj_to_char(found_object, ch, 6); /* Find hum, glow etc */
                } else if (!found) {
                    send_to_char("You do not see that here.\n\r", ch);
                }
            } else {
                /* no argument */

                send_to_char("Look at what?\n\r", ch);
            }
        }