Exemplo n.º 1
0
void
sort_keeper_objs(struct char_data * keeper, int shop_nr)
{
  struct obj_data *list = 0, *temp;

  while (SHOP_SORT(shop_nr) < IS_CARRYING_N(keeper))
    {
      temp = keeper->carrying;
      obj_from_char(temp);
      temp->next_content = list;
      list = temp;
    }

  while (list)
    {
      temp = list;
      list = list->next_content;
      if ((shop_producing(temp, shop_nr)) &&
      !(get_obj_in_list_num(GET_OBJ_RNUM(temp), keeper->carrying)))
    {
      obj_to_char(temp, keeper);
      SHOP_SORT(shop_nr)++;
    } else
      (void) slide_obj(temp, keeper, shop_nr);
    }
}
Exemplo n.º 2
0
void quest_join(struct char_data *ch, struct char_data *qm, char argument[MAX_INPUT_LENGTH])
{
  qst_vnum vnum;
  qst_rnum rnum;
  char buf[MAX_INPUT_LENGTH];

  if (!*argument)
    snprintf(buf, sizeof(buf),
             "%s What quest did you wish to join?", GET_NAME(ch));
  else if (GET_QUEST(ch) != NOTHING)
    snprintf(buf, sizeof(buf),
             "%s But you are already part of a quest!", GET_NAME(ch));
  else if((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING)
    snprintf(buf, sizeof(buf),
             "%s I don't know of such a quest!", GET_NAME(ch));
  else if ((rnum = real_quest(vnum)) == NOTHING)
    snprintf(buf, sizeof(buf),
             "%s I don't know of such a quest!", GET_NAME(ch));
  else if (GET_LEVEL(ch) < QST_MINLEVEL(rnum))
    snprintf(buf, sizeof(buf),
             "%s You are not experienced enough for that quest!", GET_NAME(ch));
  else if (GET_LEVEL(ch) > QST_MAXLEVEL(rnum))
    snprintf(buf, sizeof(buf),
             "%s You are too experienced for that quest!", GET_NAME(ch));
  else if (is_complete(ch, vnum))
    snprintf(buf, sizeof(buf),
             "%s You have already completed that quest!", GET_NAME(ch));
  else if ((QST_PREV(rnum) != NOTHING) && !is_complete(ch, QST_PREV(rnum)))
    snprintf(buf, sizeof(buf),
             "%s That quest is not available to you yet!", GET_NAME(ch));
  else if ((QST_PREREQ(rnum) != NOTHING) &&
           (real_object(QST_PREREQ(rnum)) != NOTHING) &&
           (get_obj_in_list_num(real_object(QST_PREREQ(rnum)),
       ch->carrying) == NULL))
    snprintf(buf, sizeof(buf),
             "%s You need to have %s first!", GET_NAME(ch),
      obj_proto[real_object(QST_PREREQ(rnum))].short_description);
  else {
    act("You join the quest.",    TRUE, ch, NULL, NULL, TO_CHAR);
    act("$n has joined a quest.", TRUE, ch, NULL, NULL, TO_ROOM);
    snprintf(buf, sizeof(buf),
             "%s Listen carefully to the instructions.", GET_NAME(ch));
    do_tell(qm, buf, cmd_tell, 0);
    set_quest(ch, rnum);
    send_to_char(ch, "%s", QST_INFO(rnum));
    if (QST_TIME(rnum) != -1)
      snprintf(buf, sizeof(buf),
        "%s You have a time limit of %d turn%s to complete the quest.",
        GET_NAME(ch), QST_TIME(rnum), QST_TIME(rnum) == 1 ? "" : "s");
    else
      snprintf(buf, sizeof(buf),
        "%s You can take however long you want to complete the quest.",
 GET_NAME(ch));
  }
  do_tell(qm, buf, cmd_tell, 0);
  save_char(ch);
}
Exemplo n.º 3
0
int
social (CHAR_DATA * ch, char *argument)
{
	char buf[MAX_INPUT_LENGTH];
	SOCIAL_DATA *action;
	CHAR_DATA *victim;
	int i;

	argument = one_argument (argument, buf);

	if (ch->room->nVirtual == AMPITHEATRE && IS_MORTAL (ch))
	{
		if (!get_obj_in_list_num (VNUM_SPEAKER_TOKEN, ch->right_hand) &&
			!get_obj_in_list_num (VNUM_SPEAKER_TOKEN, ch->left_hand))
		{
			send_to_char
				("You decide against making a commotion. PETITION to request to speak.\n",
				ch);
			return 0;
		}
	}

	for (i = 0; i < list_top; i++)
	{
		if (is_abbrev (buf, social_messages[i].social_command))
			break;
	}

	if (i == list_top)
		return 0;

	action = &social_messages[i];

	if (action->char_found)
		one_argument (argument, buf);
	else
		*buf = '\0';

	if (!*buf)
	{
		send_to_char (action->char_no_arg, ch);
		send_to_char ("\n\r", ch);
		if (action->others_no_arg)
			act (action->others_no_arg, action->hide, ch, 0, 0, TO_ROOM);

		return 1;
	}

	if (!(victim = get_char_room_vis (ch, buf)))
	{
		send_to_char (action->not_found, ch);
		send_to_char ("\n\r", ch);
	}

	else if (victim == ch)
	{
		send_to_char (action->char_auto, ch);
		send_to_char ("\n\r", ch);
		if (action->others_auto)
			act (action->others_auto, action->hide, ch, 0, 0, TO_ROOM);
	}

	else if (GET_POS (victim) < action->min_victim_position)
		act ("$N is not in a proper position for that.",
		false, ch, 0, victim, TO_CHAR);

	else
	{
		if (action->char_found)
			act (action->char_found, 0, ch, 0, victim, TO_CHAR);

		if (action->others_found)
			act (action->others_found, action->hide, ch, 0, victim, TO_NOTVICT);

		if (action->vict_found)
			act (action->vict_found, action->hide, ch, 0, victim, TO_VICT);
	}

	return 1;
}
Exemplo n.º 4
0
bool assemblyCheckComponents( long lVnum, struct char_data *pCharacter )
{
    bool         bOk = TRUE;
    long         i = 0;
    long         lRnum = 0;
    struct obj_data **ppComponentObjects = NULL;
    ASSEMBLY     *pAssembly = NULL;

    if( pCharacter == NULL )
    {
        log( "SYSERR: NULL assemblyCheckComponents(): 'pCharacter'." );
        return (FALSE);
    }
    else if( (pAssembly = assemblyGetAssemblyPtr( lVnum )) == NULL )
    {
        log( "SYSERR: NULL assemblyCheckComponents(): Invalid 'lVnum' #%ld.", lVnum );
        return (FALSE);
    }

    if( pAssembly->pComponents == NULL )
        return (FALSE);
    else if( pAssembly->lNumComponents <= 0 )
        return (FALSE);

    CREATE( ppComponentObjects, struct obj_data*, pAssembly->lNumComponents );

    for( i = 0; i < pAssembly->lNumComponents && bOk; i++ )
    {
        if( (lRnum = real_object( pAssembly->pComponents[ i ].lVnum )) < 0 )
            bOk = FALSE;
        else
        {
            if( pAssembly->pComponents[ i ].bInRoom )
            {
                if( (ppComponentObjects[ i ] = get_obj_in_list_num( lRnum,
                                               world[ IN_ROOM( pCharacter ) ].contents )) == NULL )
                    bOk = FALSE;
                else
                    obj_from_room( ppComponentObjects[ i ] );
            }
            else
            {
                if( (ppComponentObjects[ i ] = get_obj_in_list_num( lRnum,
                                               pCharacter->carrying )) == NULL )
                    bOk = FALSE;
                else
                    obj_from_char( ppComponentObjects[ i ] );
            }
        }
    }


    for( i = 0; i < pAssembly->lNumComponents; i++ )
    {
        if( ppComponentObjects[ i ] == NULL )
            continue;

        if( pAssembly->pComponents[ i ].bExtract && bOk )
            extract_obj( ppComponentObjects[ i ] );
        else if( pAssembly->pComponents[ i ].bInRoom )
            obj_to_room( ppComponentObjects[ i ], IN_ROOM( pCharacter ) );
        else
            obj_to_char( ppComponentObjects[ i ], pCharacter );
    }

    free( ppComponentObjects );

    return (bOk);
}
Exemplo n.º 5
0
int chalice(struct char_data *ch, int cmd, char *arg)
{
	/* 222 is the normal chalice, 223 is chalice-on-altar */

	struct obj_data *chalice;
	char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH];
	static int chl = -1, achl = -1;

	if (chl < 1)
	{
		chl = real_object(222);
		achl = real_object(223);
	}

	switch(cmd)
	{
		case 10:    /* get */
			if (!(chalice = get_obj_in_list_num(chl,
				world[ch->in_room].contents))
				&& CAN_SEE_OBJ(ch, chalice))
				if (!(chalice = get_obj_in_list_num(achl,
					world[ch->in_room].contents)) && CAN_SEE_OBJ(ch, chalice))
					return(0);
	
			/* we found a chalice.. now try to get us */			
			do_get(ch, arg, cmd);
			/* if got the altar one, switch her */
			if (chalice == get_obj_in_list_num(achl, ch->carrying))
			{
				extract_obj(chalice);
				chalice = read_object(chl, VIRTUAL);
				obj_to_char(chalice, ch);
			}
			return(1);
		break;
		case 67: /* put */
			if (!(chalice = get_obj_in_list_num(chl, ch->carrying)))
				return(0);

			argument_interpreter(arg, buf1, buf2);
			if (!str_cmp(buf1, "chalice") && !str_cmp(buf2, "altar"))
			{
				extract_obj(chalice);
				chalice = read_object(achl, VIRTUAL);
				obj_to_room(chalice, ch->in_room);
				send_to_char("Ok.\n\r", ch);
			}
			return(1);
		break;
		case 176: /* pray */
			if (!(chalice = get_obj_in_list_num(achl,
				world[ch->in_room].contents)))
				return(0);

			do_action(ch, arg, cmd);  /* pray */
			send_to_char(CHAL_ACT, ch);
			extract_obj(chalice);
			act("$n is torn out of existence!", TRUE, ch, 0, 0, TO_ROOM);
			char_from_room(ch);
			char_to_room(ch, real_room(2500));   /* before the fiery gates */
			do_look(ch, "", 15);
			return(1);
		break;
		default:
			return(0);
		break;
	}
}
Exemplo n.º 6
0
int worm_ritual(struct char_data *ch, int cmd, char *arg)
{
	struct obj_data *scroll, *herbs, *blood;
	struct char_data *tmpch;
	char buf[MAX_INPUT_LENGTH];
	bool found, equipped = FALSE;
	int room;
	static int scroll_nr = -1, herbs_nr = -1, blood_nr = -1, to_room = -1;

	if (scroll_nr < 1) {
		scroll_nr = real_object(5012);
		herbs_nr = real_object(5002);
		blood_nr = real_object(5003);
		to_room = real_room(5040);
	}

	if (cmd != 207)
		return FALSE;

   arg = one_argument(arg,buf);

	if (!(scroll = get_obj_in_list_vis(ch,buf,ch->carrying))) {
		scroll = ch->equipment[HOLD];
		equipped = TRUE;
	}

   /* which scroll */
	found = (scroll && (scroll->item_number == scroll_nr));

	if (!found)
		return FALSE;

	act("$n recites $p.", TRUE, ch, scroll, 0, TO_ROOM);
	act("You recite $p which dissolves.",FALSE,ch,scroll,0,TO_CHAR);

	room = ch->in_room;
	blood = get_obj_in_list_num(blood_nr,world[room].contents);
	herbs = get_obj_in_list_num(herbs_nr,world[room].contents);

	if (!blood || !herbs || (blood->obj_flags.value[1] < 2))
		return TRUE;

   act("$p dissolves into thin air.", TRUE, ch, herbs, 0, TO_ROOM);
	act("$p dissolves into thin air.", TRUE, ch, herbs, 0, TO_CHAR);
	act("$p is emptied from blood.", FALSE, ch, blood, 0, TO_ROOM);
	act("$p is emptied from blood.", FALSE, ch, blood, 0, TO_CHAR);

	obj_from_room(herbs);
	extract_obj(herbs);            /* herbs dissapear */
	blood->obj_flags.value[1] = 0; /* empty for blood */
	blood->obj_flags.weight -= 2;  /* correct weight  */

   if (equipped)
      unequip_char(ch, HOLD);

   extract_obj(scroll);

   act("You feel yanked downwards.....", FALSE, ch, 0, 0, TO_ROOM);
	act("You feel yanked downwards.....", FALSE, ch, 0, 0, TO_CHAR);

	/* Move'em */
	tmpch = world[room].people;
	while (world[room].people){
		char_from_room(tmpch);
		char_to_room(tmpch,to_room);
		tmpch = world[room].people;
	}
	return TRUE;
}