Ejemplo n.º 1
0
void
char__do_cards (CHAR_DATA * ch, char *argument, int cmd)
{
  char buf[AVG_STRING_LENGTH] = "";
  OBJ_DATA *card = NULL;

  if (ch->right_hand && GET_ITEM_TYPE (ch->right_hand) == ITEM_CARD)
    {
      send_to_char ("<carried in right hand>  ", ch);
      show_obj_to_char (ch->right_hand, ch, 1);
      for (card = ch->right_hand; card != NULL; card = card->next_content)
	{
	  strcpy (buf, "    #2");
	  strcat (buf, card->short_description);
	  strcat (buf, "#0\n");
	  send_to_char (buf, ch);
	}
    }
  if (ch->left_hand && GET_ITEM_TYPE (ch->left_hand) == ITEM_CARD)
    {
      send_to_char ("<carried in left hand>  ", ch);
      show_obj_to_char (ch->left_hand, ch, 1);
      for (card = ch->left_hand; card != NULL; card = card->next_content)
	{
	  strcpy (buf, "    #2");
	  strcat (buf, obj_short_desc (card));
	  strcat (buf, "#0\n");
	  send_to_char (buf, ch);
	}
    }

}
Ejemplo n.º 2
0
void list_obj_to_char(struct obj_data *list,struct char_data *ch, int mode,
                      bool show) {
    struct obj_data *i;
    bool found;

    found = FALSE;
    for ( i = list ; i ; i = i->next_content ) {
        if (CAN_SEE_OBJ(ch,i)) {
            show_obj_to_char(i, ch, mode);
            found = TRUE;
        }
    }
    if ((! found) && (show)) send_to_char("Nothing\n\r", ch);
}
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
void show_char_to_char(struct char_data *i, struct char_data *ch, int mode)
{
    char buffer[MAX_STRING_LENGTH];
    int j, found, percent;
    struct obj_data *tmp_obj;

    if (mode == 0) {

        if (IS_AFFECTED(i, AFF_HIDE) || !CAN_SEE(ch,i)) {
            if (IS_AFFECTED(ch, AFF_SENSE_LIFE))
                send_to_char("You sense a hidden life form in the room.\n\r", ch);
            return;
        }

        if (!(i->player.long_descr)||(GET_POS(i) != i->specials.default_pos)) {
            /* A player char or a mobile without long descr, or not in default pos. */
            if (!IS_NPC(i)) {
                strcpy(buffer,GET_NAME(i));
                strcat(buffer," ");
                strcat(buffer,GET_TITLE(i));
            } else {
                strcpy(buffer, i->player.short_descr);
                CAP(buffer);
            }

            if ( IS_AFFECTED(i,AFF_INVISIBLE))
                strcat(buffer," (invisible)");

            switch(GET_POS(i)) {
            case POSITION_STUNNED  :
                strcat(buffer," is lying here, stunned.");
                break;
            case POSITION_INCAP    :
                strcat(buffer," is lying here, incapacitated.");
                break;
            case POSITION_MORTALLYW:
                strcat(buffer," is lying here, mortally wounded.");
                break;
            case POSITION_DEAD     :
                strcat(buffer," is lying here, dead.");
                break;
            case POSITION_STANDING :
                strcat(buffer," is standing here.");
                break;
            case POSITION_SITTING  :
                strcat(buffer," is sitting here.");
                break;
            case POSITION_RESTING  :
                strcat(buffer," is resting here.");
                break;
            case POSITION_SLEEPING :
                strcat(buffer," is sleeping here.");
                break;
            case POSITION_FIGHTING :
                if (i->specials.fighting) {

                    strcat(buffer," is here, fighting ");
                    if (i->specials.fighting == ch)
                        strcat(buffer," YOU!");
                    else {
                        if (i->in_room == i->specials.fighting->in_room)
                            if (IS_NPC(i->specials.fighting))
                                strcat(buffer, i->specials.fighting->player.short_descr);
                            else
                                strcat(buffer, GET_NAME(i->specials.fighting));
                        else
                            strcat(buffer, "someone who has already left.");
                    }
                } else /* NIL fighting pointer */
                    strcat(buffer," is here struggling with thin air.");
                break;
            default :
                strcat(buffer," is floating here.");
                break;
            }
            if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
                if (IS_EVIL(i))
                    strcat(buffer, " (Red Aura)");
            }

            strcat(buffer,"\n\r");
            send_to_char(buffer, ch);
        }
        else  /* npc with long */
        {
            if (IS_AFFECTED(i,AFF_INVISIBLE))
                strcpy(buffer,"*");
            else
                *buffer = '\0';

            if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
                if (IS_EVIL(i))
                    strcat(buffer, " (Red Aura)");
            }

            strcat(buffer, i->player.long_descr);

            send_to_char(buffer, ch);
        }

        if (IS_AFFECTED(i,AFF_SANCTUARY))
            act("$n glows with a bright light!", FALSE, i, 0, ch, TO_VICT);

    } else if (mode == 1) {

        if (i->player.description)
            send_to_char(i->player.description, ch);
        else {
            act("You see nothing special about $m.", FALSE, i, 0, ch, TO_VICT);
        }

        /* Show a character to another */

        if (GET_MAX_HIT(i) > 0)
            percent = (100*GET_HIT(i))/GET_MAX_HIT(i);
        else
            percent = -1; /* How could MAX_HIT be < 1?? */

        if (IS_NPC(i))
            strcpy(buffer, i->player.short_descr);
        else
            strcpy(buffer, GET_NAME(i));

        if (percent >= 100)
            strcat(buffer, " is in an excellent condition.\n\r");
        else if (percent >= 90)
            strcat(buffer, " has a few scratches.\n\r");
        else if (percent >= 75)
            strcat(buffer, " has some small wounds and bruises.\n\r");
        else if (percent >= 50)
            strcat(buffer, " has quite a few wounds.\n\r");
        else if (percent >= 30)
            strcat(buffer, " has some big nasty wounds and scratches.\n\r");
        else if (percent >= 15)
            strcat(buffer, " looks pretty hurt.\n\r");
        else if (percent >= 0)
            strcat(buffer, " is in an awful condition.\n\r");
        else
            strcat(buffer, " is bleeding awfully from big wounds.\n\r");

        send_to_char(buffer, ch);

        found = FALSE;
        for (j=0; j< MAX_WEAR; j++) {
            if (i->equipment[j]) {
                if (CAN_SEE_OBJ(ch,i->equipment[j])) {
                    found = TRUE;
                }
            }
        }
        if (found) {
            act("\n\r$n is using:", FALSE, i, 0, ch, TO_VICT);
            for (j=0; j< MAX_WEAR; j++) {
                if (i->equipment[j]) {
                    if (CAN_SEE_OBJ(ch,i->equipment[j])) {
                        send_to_char(where[j],ch);
                        show_obj_to_char(i->equipment[j],ch,1);
                    }
                }
            }
        }
        if ((GET_CLASS(ch) == CLASS_THIEF) && (ch != i)) {
            found = FALSE;
            send_to_char("\n\rYou attempt to peek at the inventory:\n\r", ch);
            for(tmp_obj = i->carrying; tmp_obj; tmp_obj = tmp_obj->next_content) {
                if (CAN_SEE_OBJ(ch, tmp_obj) && (number(0,20) < GET_LEVEL(ch))) {
                    show_obj_to_char(tmp_obj, ch, 1);
                    found = TRUE;
                }
            }
            if (!found)
                send_to_char("You can't see anything.\n\r", ch);
        }

    } else if (mode == 2) {

        /* Lists inventory */
        act("$n is carrying:", FALSE, i, 0, ch, TO_VICT);
        list_obj_to_char(i->carrying,ch,1,TRUE);
    }
}