Esempio n. 1
0
void beat_punish(CHAR_DATA * i)
{
	int restore;
	// Проверяем на выпуск чара из кутузки
	if (PLR_FLAGGED(i, PLR_HELLED) && HELL_DURATION(i) && HELL_DURATION(i) <= time(NULL))
	{
		restore = PLR_TOG_CHK(i, PLR_HELLED);
		if (HELL_REASON(i))
			free(HELL_REASON(i));
		HELL_REASON(i) = 0;
		GET_HELL_LEV(i) = 0;
		HELL_GODID(i) = 0;
		HELL_DURATION(i) = 0;
		send_to_char("Вас выпустили из темницы.\r\n", i);
		if ((restore = GET_LOADROOM(i)) == NOWHERE)
			restore = calc_loadroom(i);
		restore = real_room(restore);
		if (restore == NOWHERE)
		{
			if (GET_LEVEL(i) >= LVL_IMMORT)
				restore = r_immort_start_room;
			else
				restore = r_mortal_start_room;
		}
		char_from_room(i);
		char_to_room(i, restore);
		look_at_room(i, restore);
		act("Насвистывая \"От звонка до звонка...\", $n появил$u в центре комнаты.",
			FALSE, i, 0, 0, TO_ROOM);
	}
	if (PLR_FLAGGED(i, PLR_NAMED) && NAME_DURATION(i) && NAME_DURATION(i) <= time(NULL))
	{
		restore = PLR_TOG_CHK(i, PLR_NAMED);
		if (NAME_REASON(i))
			free(NAME_REASON(i));
		NAME_REASON(i) = 0;
		GET_NAME_LEV(i) = 0;
		NAME_GODID(i) = 0;
		NAME_DURATION(i) = 0;
		send_to_char("Вас выпустили из КОМНАТЫ ИМЕНИ.\r\n", i);

		if ((restore = GET_LOADROOM(i)) == NOWHERE)
			restore = calc_loadroom(i);
		restore = real_room(restore);
		if (restore == NOWHERE)
		{
			if (GET_LEVEL(i) >= LVL_IMMORT)
				restore = r_immort_start_room;
			else
				restore = r_mortal_start_room;
		}
		char_from_room(i);
		char_to_room(i, restore);
		look_at_room(i, restore);
		act("С ревом \"Имья, сестра, имья...\", $n появил$u в центре комнаты.",
			FALSE, i, 0, 0, TO_ROOM);
	}
	if (PLR_FLAGGED(i, PLR_MUTE) && MUTE_DURATION(i) != 0 && MUTE_DURATION(i) <= time(NULL))
	{
		restore = PLR_TOG_CHK(i, PLR_MUTE);
		if (MUTE_REASON(i))
			free(MUTE_REASON(i));
		MUTE_REASON(i) = 0;
		GET_MUTE_LEV(i) = 0;
		MUTE_GODID(i) = 0;
		MUTE_DURATION(i) = 0;
		send_to_char("Вы можете орать.\r\n", i);
	}
	if (PLR_FLAGGED(i, PLR_DUMB) && DUMB_DURATION(i) != 0 && DUMB_DURATION(i) <= time(NULL))
	{
		restore = PLR_TOG_CHK(i, PLR_DUMB);
		if (DUMB_REASON(i))
			free(DUMB_REASON(i));
		DUMB_REASON(i) = 0;
		GET_DUMB_LEV(i) = 0;
		DUMB_GODID(i) = 0;
		DUMB_DURATION(i) = 0;
		send_to_char("Вы можете говорить.\r\n", i);
	}

	if (!PLR_FLAGGED(i, PLR_REGISTERED) && UNREG_DURATION(i) != 0 && UNREG_DURATION(i) <= time(NULL))
	{
		restore = PLR_TOG_CHK(i, PLR_REGISTERED);
		if (UNREG_REASON(i))
			free(UNREG_REASON(i));
		UNREG_REASON(i) = 0;
		GET_UNREG_LEV(i) = 0;
		UNREG_GODID(i) = 0;
		UNREG_DURATION(i) = 0;
		send_to_char("Ваша регистрация восстановлена.\r\n", i);

		if (IN_ROOM(i) == r_unreg_start_room)
		{
			if ((restore = GET_LOADROOM(i)) == NOWHERE)
				restore = calc_loadroom(i);

			restore = real_room(restore);

			if (restore == NOWHERE)
			{
				if (GET_LEVEL(i) >= LVL_IMMORT)
					restore = r_immort_start_room;
				else
					restore = r_mortal_start_room;
			}

			char_from_room(i);
			char_to_room(i, restore);
			look_at_room(i, restore);

			act("$n появил$u в центре комнаты, с гордостью показывая всем штампик регистрации!",
				FALSE, i, 0, 0, TO_ROOM);
		};

	}

	if (GET_GOD_FLAG(i, GF_GODSLIKE) && GCURSE_DURATION(i) != 0 && GCURSE_DURATION(i) <= time(NULL))
	{
		CLR_GOD_FLAG(i, GF_GODSLIKE);
		send_to_char("Вы более не под защитой Богов.\r\n", i);
	}
	if (GET_GOD_FLAG(i, GF_GODSCURSE) && GCURSE_DURATION(i) != 0 && GCURSE_DURATION(i) <= time(NULL))
	{
		CLR_GOD_FLAG(i, GF_GODSCURSE);
		send_to_char("Боги более не в обиде на вас.\r\n", i);
	}
	if (PLR_FLAGGED(i, PLR_FROZEN) && FREEZE_DURATION(i) != 0 && FREEZE_DURATION(i) <= time(NULL))
	{
		restore = PLR_TOG_CHK(i, PLR_FROZEN);
		if (FREEZE_REASON(i))
			free(FREEZE_REASON(i));
		FREEZE_REASON(i) = 0;
		GET_FREEZE_LEV(i) = 0;
		FREEZE_GODID(i) = 0;
		FREEZE_DURATION(i) = 0;
		send_to_char("Вы оттаяли.\r\n", i);
		Glory::remove_freeze(GET_UNIQUE(i));
	}
	// Проверяем а там ли мы где должны быть по флагам.
	if (IN_ROOM(i) == STRANGE_ROOM)
		restore = i->get_was_in_room();
	else
		restore = IN_ROOM(i);

	if (PLR_FLAGGED(i, PLR_HELLED))
	{
		if (restore != r_helled_start_room)
		{
			if (IN_ROOM(i) == STRANGE_ROOM)
				i->set_was_in_room(r_helled_start_room);
			else
			{
				send_to_char("Чья-то злая воля вернула вас в темницу.\r\n", i);
				act("$n возвращен$a в темницу.",
					FALSE, i, 0, 0, TO_ROOM);

				char_from_room(i);
				char_to_room(i, r_helled_start_room);
				look_at_room(i, r_helled_start_room);
				i->set_was_in_room(NOWHERE);
			};
		}
	}
	else if (PLR_FLAGGED(i, PLR_NAMED))
	{
		if (restore != r_named_start_room)
		{
			if (IN_ROOM(i) == STRANGE_ROOM)
				i->set_was_in_room(r_named_start_room);
			else
			{
				send_to_char("Чья-то злая воля вернула вас в комнату имени.\r\n", i);
				act("$n возвращен$a в комнату имени.",
					FALSE, i, 0, 0, TO_ROOM);
				char_from_room(i);
				char_to_room(i, r_named_start_room);
				look_at_room(i, r_named_start_room);
				i->set_was_in_room(NOWHERE);
			};
		};
	}
	else if (!RegisterSystem::is_registered(i) && i->desc && STATE(i->desc) == CON_PLAYING)
	{
		if (restore != r_unreg_start_room
				&& !RENTABLE(i)
				&& !DeathTrap::is_slow_dt(IN_ROOM(i))
				&& !check_dupes_host(i->desc, 1))
		{
			if (IN_ROOM(i) == STRANGE_ROOM)
				i->set_was_in_room(r_unreg_start_room);
			else
			{
				act("$n водворен$a в комнату для незарегистрированных игроков, играющих через прокси.\r\n",
					FALSE, i, 0, 0, TO_ROOM);
				char_from_room(i);
				char_to_room(i, r_unreg_start_room);
				look_at_room(i, r_unreg_start_room);
				i->set_was_in_room(NOWHERE);
			};
		}
		else if (restore == r_unreg_start_room && check_dupes_host(i->desc, 1) && !IS_IMMORTAL(i))
		{
			send_to_char("Неведомая вытолкнула вас из комнаты для незарегистрированных игроков.\r\n", i);
			act("$n появил$u в центре комнаты, правда без штампика регистрации...\r\n",
				FALSE, i, 0, 0, TO_ROOM);
			restore = i->get_was_in_room();
			if (restore == NOWHERE || restore == r_unreg_start_room)
			{
				restore = GET_LOADROOM(i);
				if (restore == NOWHERE)
					restore = calc_loadroom(i);
				restore = real_room(restore);
			}
			char_from_room(i);
			char_to_room(i, restore);
			look_at_room(i, restore);
			i->set_was_in_room(NOWHERE);
		}
	}
}
Esempio n. 2
0
bool spec_newbie_pilot( CHAR_DATA * ch )
{
   int home = 32149;
   CHAR_DATA *victim;
   CHAR_DATA *v_next;
   OBJ_DATA *obj;
   char buf[MAX_STRING_LENGTH];
   bool diploma = FALSE;

   for( victim = ch->in_room->first_person; victim; victim = v_next )
   {
      v_next = victim->next_in_room;

      if( IS_NPC( victim ) || victim->position == POS_FIGHTING )
         continue;

      for( obj = victim->last_carrying; obj; obj = obj->prev_content )
         if( obj->pIndexData->vnum == OBJ_VNUM_SCHOOL_DIPLOMA )
            diploma = TRUE;

      if( !diploma )
         continue;

      switch ( victim->race )
      {
         case RACE_MON_CALAMARI:
            home = 21100;
            strcpy( buf, "After a brief journey you arrive on Mon Calamari.\r\n\r\n" );
            echo_to_room( AT_ACTION, ch->in_room, buf );
            break;

         case RACE_QUARREN:
            home = 6904;
            strcpy( buf, "After a brief journey you arrive on Mon Calamari.\r\n\r\n" );
            echo_to_room( AT_ACTION, ch->in_room, buf );
            break;

         case RACE_GAMORREAN:
            home = 28038;
            strcpy( buf, "After a brief journey you arrive on Gamorr.\r\n\r\n" );
            echo_to_room( AT_ACTION, ch->in_room, buf );
            break;

         case RACE_ADARIAN:
            home = 29006;
            strcpy( buf, "After a brief journey you arrive on Adari.\r\n\r\n" );
            echo_to_room( AT_ACTION, ch->in_room, buf );
            break;

         case RACE_JAWA:
            home = 31821;
            strcpy( buf, "After a brief journey you arrive on Tatooine.\r\n\r\n" );
            echo_to_room( AT_ACTION, ch->in_room, buf );
            break;

         case RACE_WOOKIEE:
            home = 28600;
            strcpy( buf, "After a brief journey you arrive on Kashyyyk.\r\n\r\n" );
            echo_to_room( AT_ACTION, ch->in_room, buf );
            break;

         case RACE_HUMAN:
            home = 201;
            strcpy( buf, "After a brief journey you arrive at Coruscants Menari Spaceport.\r\n\r\n" );
            echo_to_room( AT_ACTION, ch->in_room, buf );
            break;

         case RACE_NOGHRI:
            home = 1001;
            strcpy( buf, "After a brief journey you arrive at Honoghr's Nystao Spaceport.\r\n\r\n" );
            echo_to_room( AT_ACTION, ch->in_room, buf );
            break;

         default:
            sprintf( buf, "Hmm, a %s.", race_table[victim->race].race_name );
            do_look( ch, victim->name );
            do_say( ch, buf );
            do_say( ch, "You're home planet is a little hard to get to right now." );
            do_say( ch, "I'll take you to the Pluogus instead." );
            echo_to_room( AT_ACTION, ch->in_room,
                          "After a brief journey the shuttle docks with the Serin Pluogus.\r\n\r\n" );
            break;
      }

      char_from_room( victim );
      char_to_room( victim, get_room_index( home ) );

      do_look( victim, "" );

      sprintf( buf, "%s steps out and the shuttle quickly returns to the academy.\r\n", victim->name );
      echo_to_room( AT_ACTION, ch->in_room, buf );
   }
   return FALSE;
}
Esempio n. 3
0
void do_hologramtransfer( CHAR_DATA *ch, char *argument)
{
    CHAR_DATA *victim;
    char arg[MAX_INPUT_LENGTH];

    if ( IS_NPC(ch) )
	return;

    argument = one_argument (argument, arg);

    if (!IS_CLASS(ch, CLASS_SAMURAI) )
	{
         send_to_char("Huh?\n\r",ch);
	   return;
	}

    if ( arg[0] == '\0' )
    {
	send_to_char( "Walk the ancestrial path to whom?\n\r", ch );
	return;
    }

    if ( ( victim = get_char_world( ch, arg ) ) == NULL )
    {
	send_to_char( "They are not of this world.\n\r", ch );
	return;
    }
    
   if( ch->move < 1000) 
    {
     stc( "The path escapes your senses as you loose control over your inner energies.\n\r",ch);
     return;
    }

 if( IS_SET(victim->in_room->room_flags, ROOM_ASTRAL))
  { 
    stc( "You can't find it's room.\n\r",ch);
    return; 
  } 
    if (IS_SET(victim->act, ACT_NOTRAVEL))
  {
  	send_to_char("No Can Do.\n\r", ch);
  	return;
  }
  if( IS_SET(ch->in_room->room_flags, ROOM_ASTRAL))
  {
    stc( "You cannot sense any paths leading from this room.\n\r",ch);
    return;
  }

    if (ch == victim)
    {
        send_to_char("But you're already at yourself!\n\r",ch);
	  return;
    }
    if ( room_is_private(victim->in_room ) )
    {
        send_to_char( "That room is private right now.\n\r", ch );
        return;
    }
    if ( !IS_NPC(victim) && !IS_IMMUNE(victim, IMM_SUMMON) )
    {	
	send_to_char( "They don't want you near them.\n\r", ch );
        return;
    }
    if (victim->in_room == ch->in_room)
    {
	send_to_char("But you're already there!\n\r",ch);
        return;
    }

    act("You follow the path to $N.", ch, NULL, victim, TO_CHAR);
    act("$n steps into the air, leaving behind no trace whatsoever.", ch, NULL, victim, TO_ROOM);
    char_from_room(ch);
    char_to_room(ch,victim->in_room);
    ch->move -= 1000;
    act("$n steps out of the air in front of $N.", ch, NULL, victim, TO_NOTVICT);
    act("$n steps out of the air in front of you.", ch, NULL, victim, TO_VICT);
    do_look(ch,"auto");
    return;
}
Esempio n. 4
0
int delete_room(room_rnum rnum)
{
  int i, j;
  struct char_data *ppl, *next_ppl;
  struct obj_data *obj, *next_obj;
  struct room_data *room;

  if (rnum <= 0 || rnum > top_of_world)	/* Can't delete void yet. */
    return FALSE;

  room = &world[rnum];

  add_to_save_list(zone_table[room->zone].number, SL_WLD);

  /* This is something you might want to read about in the logs. */
  log("GenOLC: delete_room: Deleting room #%d (%s).", room->number, room->name);

  if (r_mortal_start_room == rnum) {
    log("WARNING: GenOLC: delete_room: Deleting mortal start room!");
    r_mortal_start_room = 0;	/* The Void */
  }
  if (r_immort_start_room == rnum) {
    log("WARNING: GenOLC: delete_room: Deleting immortal start room!");
    r_immort_start_room = 0;	/* The Void */
  }
  if (r_newbie_start_room == rnum) {
    log("WARNING: GenOLC: delete_room: Deleting newbie start room!");
    r_newbie_start_room = 0;	/* The Void */
  }
  if (r_sorin_start_room == rnum) {
    log("WARNING: GenOLC: delete_room: Deleting sorin start room!");
    r_sorin_start_room = 0;	/* The Void */
  }
  if (r_frozen_start_room == rnum) {
    log("WARNING: GenOLC: delete_room: Deleting frozen start room!");
    r_frozen_start_room = 0;	/* The Void */
  }

  /*
   * Dump the contents of this room into the Void.  We could also just
   * extract the people, mobs, and objects here.
   */
  for (obj = world[rnum].contents; obj; obj = next_obj) {
    next_obj = obj->next_content;
    obj_from_room(obj);
    obj_to_room(obj, 0);
  }
  for (ppl = world[rnum].people; ppl; ppl = next_ppl) {
    next_ppl = ppl->next_in_room;
    char_from_room(ppl);
    char_to_room(ppl, 0);
  }

  free_room_strings(room);

  /*
   * Change any exit going to this room to go the void.
   * Also fix all the exits pointing to rooms above this.
   */
  for (i = top_of_world; i >= 0; i--)
    for (j = 0; j < NUM_OF_DIRS; j++)
      if (W_EXIT(i, j) == NULL)
        continue;
      else if (W_EXIT(i, j)->to_room > rnum)
        W_EXIT(i, j)->to_room--;
      else if (W_EXIT(i, j)->to_room == rnum)
        W_EXIT(i, j)->to_room = 0;	/* Some may argue -1. */

  /*
   * Find what zone that room was in so we can update the loading table.
   */
  for (i = 0; i <= top_of_zone_table; i++)
    for (j = 0; ZCMD(i , j).command != 'S'; j++)
      switch (ZCMD(i, j).command) {
      case 'M':
      case 'O':
      case 'T':
      case 'V':
	if (ZCMD(i, j).arg3 == rnum)
	  ZCMD(i, j).command = '*';	/* Cancel command. */
	else if (ZCMD(i, j).arg3 > rnum)
	  ZCMD(i, j).arg3--;
	break;
      case 'D':
      case 'R':
	if (ZCMD(i, j).arg1 == rnum)
	  ZCMD(i, j).command = '*';	/* Cancel command. */
	else if (ZCMD(i, j).arg1 > rnum)
	  ZCMD(i, j).arg1--;
      case 'G':
      case 'P':
      case 'E':
      case '*':
        /* Known zone entries we don't care about. */
        break;
      default:
        mudlog(BRF, LVL_DEITY, TRUE, "SYSERR: GenOLC: delete_room: Unknown zone entry found!");
      }

  /*
   * Now we actually move the rooms down.
   */
  for (i = rnum; i < top_of_world; i++) {
    world[i] = world[i + 1];

    for (ppl = world[i].people; ppl; ppl = ppl->next_in_room)
      IN_ROOM(ppl) -= (IN_ROOM(ppl) != NOWHERE);	/* Redundant check? */

    for (obj = world[i].contents; obj; obj = obj->next_content)
      IN_ROOM(obj) -= (IN_ROOM(obj) != NOWHERE);	/* Redundant check? */
  }

  top_of_world--;
  RECREATE(world, struct room_data, top_of_world + 1);

  return TRUE;
}
Esempio n. 5
0
/*
 * Lets the mobile transfer people.  The 'all' argument transfers
 *  everyone in the current room to the specified location
 *
 * Syntax: mob transfer [target|'all'] [location]
 */
void do_mptransfer( CHAR_DATA *ch, char *argument )
{
    char             arg1[ MAX_INPUT_LENGTH ];
    char             arg2[ MAX_INPUT_LENGTH ];
    char	     buf[MAX_STRING_LENGTH];
    ROOM_INDEX_DATA *location;
    CHAR_DATA       *victim;

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );

    if ( arg1[0] == '\0' )
    {
	bug( "Mptransfer - Bad syntax from vnum %d.", 
		IS_NPC(ch) ? ch->pIndexData->vnum : 0 );
	return;
    }

    if ( !str_cmp( arg1, "all" ) )
    {
	CHAR_DATA *victim_next;

	for ( victim = ch->in_room->people; victim != NULL; victim = victim_next )
	{
	    victim_next = victim->next_in_room;
	    if ( !IS_NPC(victim) )
	    {
		sprintf( buf, "%s %s", victim->name, arg2 );
		do_mptransfer( ch, buf );
	    }
	}
	return;
    }

    /*
     * Thanks to Grodyn for the optional location parameter.
     */
    if ( arg2[0] == '\0' )
    {
	location = ch->in_room;
    }
    else
    {
	if ( ( location = find_location( ch, arg2 ) ) == NULL )
	{
	    bug( "Mptransfer - No such location from vnum %d.",
	        IS_NPC(ch) ? ch->pIndexData->vnum : 0 );
	    return;
	}

	if ( room_is_private( location ) )
	    return;
    }

    if ( ( victim = get_char_world( ch, arg1 ) ) == NULL )
	return;

    if ( victim->in_room == NULL )
	return;

    if ( victim->fighting != NULL )
	stop_fighting( victim, TRUE );
    char_from_room( victim );
    char_to_room( victim, location );
    do_look( victim, "auto" );

    return;
}
Esempio n. 6
0
void do_mptransfer(CHAR_DATA * ch, char *argument)
{
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	ROOM_INDEX_DATA *location;
	DESCRIPTOR_DATA *d;
	CHAR_DATA *victim;

	if (!IS_NPC(ch)) {
		send_to_char(C_DEFAULT, "Huh?\n\r", ch);
		return;
	}

	if (IS_SET(ch->act, ACT_PET) || IS_AFFECTED(ch, AFF_CHARM))
		return;

	argument = one_argument(argument, arg1);
	argument = one_argument(argument, arg2);

	if (arg1[0] == '\0') {
		sprintf(log_buf,
			"Mptransfer - Bad syntax: vnum %d name %s short %s.",
			ch->pIndexData->vnum, ch->name, ch->short_descr);
		bug(log_buf, -1);
		return;
	}

	if (!str_cmp(arg1, "all")) {
		for (d = descriptor_list; d != NULL; d = d->next) {
			if (d->connected == CON_PLAYING
			    && d->character != ch
			    && d->character->in_room != NULL
			    && can_see(ch, d->character)) {
				char buf[MAX_STRING_LENGTH];
				sprintf(buf, "%s %s", d->character->name, arg2);
				do_transfer(ch, buf);
			}
		}
		return;
	}

	if (!str_cmp(arg1, "room")) {
		for (d = descriptor_list; d != NULL; d = d->next) {
			if (d->connected == CON_PLAYING
			    && d->character != ch
			    && d->character->in_room != NULL
			    && can_see(ch, d->character)
			    && d->character->in_room == ch->in_room) {
				char buf[MAX_STRING_LENGTH];
				sprintf(buf, "%s %s", d->character->name, arg2);
				do_transfer(ch, buf);
			}
		}
		return;
	}

	/*
	 * Thanks to Grodyn for the optional location parameter.
	 */
	if (arg2[0] == '\0') {
		location = ch->in_room;
	} else {
		if ((location = find_location(ch, arg2)) == NULL) {
			sprintf(log_buf,
				"Mptransfer - No such location: vnum %d name %s short %s.",
				ch->pIndexData->vnum, ch->name,
				ch->short_descr);
			bug(log_buf, -1);
			return;
		}

		if (room_is_private(location)) {
			sprintf(log_buf,
				"Mptransfer - Private room: vnum %d name %s short %s.",
				ch->pIndexData->vnum, ch->name,
				ch->short_descr);
			bug(log_buf, -1);
			return;
		}
	}

	if ((victim = get_char_world(ch, arg1)) == NULL) {
		sprintf(log_buf,
			"Mptransfer - No such person: vnum %d name %s short %s.",
			ch->pIndexData->vnum, ch->name, ch->short_descr);
		bug(log_buf, -1);
		return;
	}

	if (victim->in_room == NULL) {
		sprintf(log_buf,
			"Mptransfer - Victim in Limbo: vnum %d name %s short %s.",
			ch->pIndexData->vnum, ch->name, ch->short_descr);
		bug(log_buf, -1);
		return;
	}

	if (victim->in_room == location)
		return;

	if (victim->fighting != NULL)
		stop_fighting(victim, TRUE);

	char_from_room(victim);
	char_to_room(victim, location);

	return;
}
Esempio n. 7
0
void suffer_activity(int pulse)
{
  struct char_data *ch, *next_ch;
  char *desc;
  char dam_msg1[120] = "msg1 for suffer room not defined, report this to an imm!\r\n";
  char dam_msg2[120] = "msg2 for suffer room not defined, report this to an imm!\r\n";
  char dam_msg3[120] = "msg3 for suffer room not defined, report this to an imm!\r\n";
  char dam_msg4[120] = "msg4 for suffer room not defined, report this to an imm!\r\n";
  char death_char[120] = "You drift into coma and die.";
  char death_room[120] = "$n has drifted into coma and dies.";
  char suffer_msg[120] = "$n is suffering.";
  int percent_hp;
  int min_dam = 10, max_dam = 20, dam_amount;
  int hot = FALSE, cold = FALSE , dry = FALSE;

  for (ch = character_list; ch; ch = next_ch) {
       next_ch = ch->next;

      if (GET_LEVEL(ch) >= LVL_IMMORT) /* Lets not hurt our immortals */
          continue;

      if (IS_NPC(ch))
          continue;

      // I'm adding in a check to make outlaws "suffer" if in a peace room
      // Added by Sanji
      if( (ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL) || IN_ARENA(ch) ||  IS_SET_AR(ROOM_FLAGS((ch)->in_room), ROOM_CLAN)) &&
        (IS_SET_AR(PLR_FLAGS(ch), PLR_HUNTED) || IS_SET_AR(PLR_FLAGS(ch), PLR_THIEF))) {
            int to_room = 18001;	// Samsera center

            // hurt the little cheater
            GET_HIT(ch)  = MAX(1, GET_HIT(ch) - GET_MAX_HIT(ch)/8);
            GET_MANA(ch) = MAX(0, GET_MANA(ch) - GET_MAX_MANA(ch)/8);
            GET_MOVE(ch) = MAX(0, GET_MOVE(ch) - GET_MAX_MOVE(ch)/8);

            // where to send the victim?
            //do
            //{
            //    to_room = number( 0, top_of_world );
            //} while (IS_SET_AR(world[to_room].room_flags, ROOM_PRIVATE) ||
            //        IS_SET_AR(world[to_room].room_flags, ROOM_DEATH) ||
            //        IS_SET_AR(world[to_room].room_flags, ROOM_PEACEFUL));

            // Lets send out a message, more can be added later.
            //
            send_to_char("Naughty naughty.  No hiding!\r\n", ch);

            // Time to move the victim
            char_from_room(ch);
            char_to_room(ch, real_room(to_room));
            look_at_room(ch, 0);
      }

      hot = (ROOM_FLAGGED(IN_ROOM(ch), ROOM_HOT));
      cold = (ROOM_FLAGGED(IN_ROOM(ch), ROOM_COLD));
      dry = (ROOM_FLAGGED(IN_ROOM(ch), ROOM_DRY));

      if (!hot && !cold && !dry)
          continue;


      /* Getting ready to pull the damage amount out of the extra desc in the room */
      if ((desc = find_exdesc("min_dam", world[ch->in_room].ex_description)) != NULL)
           min_dam = atoi(desc);
      else
           min_dam = 0;

      if ((desc = find_exdesc("max_dam", world[ch->in_room].ex_description)) != NULL)
          max_dam = atoi(desc);
      else
          max_dam = 25;

     if (max_dam < min_dam) {
         send_to_char("SYSERR: Max damage lower then Min damage.  Report to an Immortal.\r\n", ch);
         return;
     }

     dam_amount = number(min_dam, max_dam);

     if ((desc = find_exdesc("suffer1", world[ch->in_room].ex_description)) != NULL)
          sprintf(dam_msg1, "%s", desc);
     if ((desc = find_exdesc("suffer2", world[ch->in_room].ex_description)) != NULL)
          sprintf(dam_msg2, "%s", desc);
     if ((desc = find_exdesc("suffer3", world[ch->in_room].ex_description)) != NULL)
          sprintf(dam_msg3, "%s", desc);
     if ((desc = find_exdesc("suffer4", world[ch->in_room].ex_description)) != NULL)
	  sprintf(dam_msg4, "%s", desc);
     if ((desc = find_exdesc("death_char", world[ch->in_room].ex_description)) != NULL)
          sprintf(death_char, "%s", desc);
     if ((desc = find_exdesc("death_room", world[ch->in_room].ex_description)) != NULL)
          sprintf(death_room, "%s", desc);
     if ((desc = find_exdesc("suffer_msg", world[ch->in_room].ex_description)) != NULL)
          sprintf(suffer_msg, "%s", desc);


     if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_COLD) && IS_AFFECTED(ch, AFF_NO_COLD))
         continue;
     else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_HOT) && IS_AFFECTED(ch, AFF_NO_HOT))
         continue;
     else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_HOT) && IS_AFFECTED(ch, AFF_NO_DRY))
         continue;

    // DUH! added a check for soak
     if (((ROOM_FLAGGED(IN_ROOM(ch), ROOM_HOT) || ROOM_FLAGGED(IN_ROOM(ch), ROOM_DRY)) && (GET_COND(ch, THIRST) > 0)))
         GET_COND(ch, THIRST) = 0;


     if (dam_amount >= GET_HIT(ch))
         dam_amount = GET_HIT(ch) + number(4, 7);
     else
        act(suffer_msg, FALSE, ch, 0, 0, TO_ROOM);

     GET_HIT(ch) -= dam_amount;

     percent_hp = (100 * GET_HIT(ch)) / GET_MAX_HIT(ch);
// need a check here to see if the char is still in the room!
   if ((ROOM_FLAGGED(IN_ROOM(ch), ROOM_HOT)) || (ROOM_FLAGGED(IN_ROOM(ch), ROOM_COLD)) || (ROOM_FLAGGED(IN_ROOM(ch), ROOM_DRY))){
     if (percent_hp > 75)
         send_to_char(dam_msg1, ch);
     else if (percent_hp > 50)
              send_to_char(dam_msg2, ch);
     else if (percent_hp > 30)
              send_to_char(dam_msg3, ch);
     else if (percent_hp >= 15)
              send_to_char(dam_msg4, ch);
     else if (percent_hp >= 1) {
	      GET_HIT(ch) = number (-3, -5);
              send_to_char("You have passed out.\r\n", ch);
	      act("$n has passed out and fallen to the ground.",
		   FALSE, ch, 0, 0, TO_ROOM);
              update_pos(ch);
     } else {
          GET_HIT(ch) = number(-7, -10);
          act(death_char, FALSE, ch, 0, 0, TO_CHAR);
          act(death_room, FALSE, ch, 0, 0, TO_ROOM);
          update_pos(ch);
          GET_MANA(ch) = 1;
          die(ch, NULL, 0);
     }
    }
  } /* End of for loop */
}
Esempio n. 8
0
/*
 *      -3      Both died
 *      -2      Just actor died
 *	-1	Just victim died.
 *	= 0	No damage.
 *	> 0	How much damage done.
 */
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype)
{
  int result, ret;
  
  if (GET_POS(victim) <= POS_DEAD) {
    /* This is "normal"-ish now with delayed extraction. -gg 3/15/2001 */
    if (PLR_FLAGGED(victim, PLR_NOTDEADYET) || MOB_FLAGGED(victim, MOB_NOTDEADYET))
      return (-1);

    log("SYSERR: Attempt to damage corpse '%s' in room #%d by '%s'.",
		GET_NAME(victim), GET_ROOM_VNUM(IN_ROOM(victim)), GET_NAME(ch));
    die(victim, ch);
    return (-1);			/* -je, 7/7/92 */
  }

  result = script_char_damage_char(&ch, &victim, &dam, &attacktype, &ret);
  
  if (IS_SET(result, SCRIPT_RET_VICT_DEAD)) {
	  if (IS_SET(result, SCRIPT_RET_ACTOR_DEAD))
		  return -3;
	  return -1;
  }
  
  if (IS_SET(result, SCRIPT_RET_ACTOR_DEAD)) {
	  return -2;
  }
  
  if (IS_SET(result, SCRIPT_RET_INTERCEPT)) {
	  return ret;
  }

  /* peaceful rooms */
  if (ch->nr != real_mobile(DG_CASTER_PROXY) &&
      ch != victim && ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL)) {
    send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n");
    return (0);
  }

  /* shopkeeper protection */
  if (!ok_damage_shopkeeper(ch, victim))
    return (0);

  /* You can't damage an immortal! */
  if (!IS_NPC(victim) && (GET_LEVEL(victim) >= LVL_IMMORT))
    dam = 0;

  if (victim != ch) {
    /* Start the attacker fighting the victim */
    if (GET_POS(ch) > POS_STUNNED && (FIGHTING(ch) == NULL))
      set_fighting(ch, victim);

    /* Start the victim fighting the attacker */
    if (GET_POS(victim) > POS_STUNNED && (FIGHTING(victim) == NULL)) {
      set_fighting(victim, ch);
      if (MOB_FLAGGED(victim, MOB_MEMORY) && !IS_NPC(ch))
	remember(victim, ch);
    }
  }

  /* If you attack a pet, it hates your guts */
  if (victim->master == ch)
    stop_follower(victim);

  /* If the attacker is invisible, he becomes visible */
  if (AFF_FLAGGED(ch, AFF_INVISIBLE | AFF_HIDE))
    appear(ch);

  /* Cut damage in half if victim has sanct, to a minimum 1 */
  if (AFF_FLAGGED(victim, AFF_SANCTUARY) && dam >= 2)
    dam /= 2;

  /* Check for PK if this is not a PK MUD */
  if (!CONFIG_PK_ALLOWED) {
    check_killer(ch, victim);
    if (PLR_FLAGGED(ch, PLR_KILLER) && (ch != victim))
      dam = 0;
  }

  /* Set the maximum damage per round and subtract the hit points */
  dam = MAX(MIN(dam, 100), 0);
  GET_HIT(victim) -= dam;

  /* Gain exp for the hit */
  if (ch != victim)
    gain_exp(ch, GET_LEVEL(victim) * dam);

  update_pos(victim);

  /*
   * skill_message sends a message from the messages file in lib/misc.
   * dam_message just sends a generic "You hit $n extremely hard.".
   * skill_message is preferable to dam_message because it is more
   * descriptive.
   * 
   * If we are _not_ attacking with a weapon (i.e. a spell), always use
   * skill_message. If we are attacking with a weapon: If this is a miss or a
   * death blow, send a skill_message if one exists; if not, default to a
   * dam_message. Otherwise, always send a dam_message.
   */
  if (!IS_WEAPON(attacktype))
    skill_message(dam, ch, victim, attacktype);
  else {
    if (GET_POS(victim) == POS_DEAD || dam == 0) {
      if (!skill_message(dam, ch, victim, attacktype))
	dam_message(dam, ch, victim, attacktype);
    } else {
      dam_message(dam, ch, victim, attacktype);
    }
  }

  /* Use send_to_char -- act() doesn't send message if you are DEAD. */
  switch (GET_POS(victim)) {
  case POS_MORTALLYW:
    act("$n is mortally wounded, and will die soon, if not aided.", TRUE, victim, 0, 0, TO_ROOM);
    send_to_char(victim, "You are mortally wounded, and will die soon, if not aided.\r\n");
    break;
  case POS_INCAP:
    act("$n is incapacitated and will slowly die, if not aided.", TRUE, victim, 0, 0, TO_ROOM);
    send_to_char(victim, "You are incapacitated an will slowly die, if not aided.\r\n");
    break;
  case POS_STUNNED:
    act("$n is stunned, but will probably regain consciousness again.", TRUE, victim, 0, 0, TO_ROOM);
    send_to_char(victim, "You're stunned, but will probably regain consciousness again.\r\n");
    break;
  case POS_DEAD:
    act("$n is dead!  R.I.P.", FALSE, victim, 0, 0, TO_ROOM);
    send_to_char(victim, "You are dead!  Sorry...\r\n");
    break;

  default:			/* >= POSITION SLEEPING */
    if (dam > (GET_MAX_HIT(victim) / 4))
      send_to_char(victim, "That really did HURT!\r\n");

    if (GET_HIT(victim) < (GET_MAX_HIT(victim) / 4)) {
      send_to_char(victim, "%sYou wish that your wounds would stop BLEEDING so much!%s\r\n",
		CCRED(victim, C_SPR), CCNRM(victim, C_SPR));
      if (ch != victim && MOB_FLAGGED(victim, MOB_WIMPY))
	do_flee(victim, NULL, 0, 0, 0);
    }
    if (!IS_NPC(victim) && GET_WIMP_LEV(victim) && (victim != ch) &&
	GET_HIT(victim) < GET_WIMP_LEV(victim) && GET_HIT(victim) > 0) {
      send_to_char(victim, "You wimp out, and attempt to flee!\r\n");
      do_flee(victim, NULL, 0, 0, 0);
    }
    break;
  }

  /* Help out poor linkless people who are attacked */
  if (!IS_NPC(victim) && !(victim->desc) && GET_POS(victim) > POS_STUNNED) {
    do_flee(victim, NULL, 0, 0, 0);
    if (!FIGHTING(victim)) {
      act("$n is rescued by divine forces.", FALSE, victim, 0, 0, TO_ROOM);
      GET_WAS_IN(victim) = IN_ROOM(victim);
      char_from_room(victim);
      char_to_room(victim, 0);
    }
  }

  /* stop someone from fighting if they're stunned or worse */
  if (GET_POS(victim) <= POS_STUNNED && FIGHTING(victim) != NULL)
    stop_fighting(victim);

  /* Uh oh.  Victim died. */
  if (GET_POS(victim) == POS_DEAD) {
    if (ch != victim && (IS_NPC(victim) || victim->desc)) {
      if (AFF_FLAGGED(ch, AFF_GROUP))
	group_gain(ch, victim);
      else
        solo_gain(ch, victim);
    }

    if (!IS_NPC(victim)) {
      mudlog(BRF, LVL_IMMORT, TRUE, "%s killed by %s at %s", GET_NAME(victim), GET_NAME(ch), world[IN_ROOM(victim)].name);
      if (MOB_FLAGGED(ch, MOB_MEMORY))
	forget(ch, victim);
    }
    die(victim, ch);
    return (-1);
  }
  return (dam);
}
Esempio n. 9
0
int delete_room(room_rnum rnum)
{
  room_rnum i;
  int j;
  struct char_data *ppl, *next_ppl;
  struct obj_data *obj, *next_obj;
  struct room_data *room;

  if (rnum <= 0 || rnum > top_of_world)	/* Can't delete void yet. */
    return FALSE;

  room = &world[rnum];

  add_to_save_list(zone_table[room->zone].number, SL_WLD);

  /* remove from realnum lookup tree */
  htree_del(room_htree, room->number);

  /* This is something you might want to read about in the logs. */
  log("GenOLC: delete_room: Deleting room #%d (%s).", room->number, room->name);

  if (r_mortal_start_room == rnum) {
    log("WARNING: GenOLC: delete_room: Deleting mortal start room!");
    r_mortal_start_room = 0;	/* The Void */
  }
  if (r_immort_start_room == rnum) {
    log("WARNING: GenOLC: delete_room: Deleting immortal start room!");
    r_immort_start_room = 0;	/* The Void */
  }
  if (r_frozen_start_room == rnum) {
    log("WARNING: GenOLC: delete_room: Deleting frozen start room!");
    r_frozen_start_room = 0;	/* The Void */
  }

  /*
   * Dump the contents of this room into the Void.  We could also just
   * extract the people, mobs, and objects here.
   */
  for (obj = world[rnum].contents; obj; obj = next_obj) {
    next_obj = obj->next_content;
    obj_from_room(obj);
    obj_to_room(obj, 0);
  }
  for (ppl = world[rnum].people; ppl; ppl = next_ppl) {
    next_ppl = ppl->next_in_room;
    char_from_room(ppl);
    char_to_room(ppl, 0);
  }

  free_room_strings(room);
  if (SCRIPT(room))
    extract_script(room, WLD_TRIGGER);
  free_proto_script(room, WLD_TRIGGER);

  /*
   * Change any exit going to this room to go the void.
   * Also fix all the exits pointing to rooms above this.
   */
  i = top_of_world + 1;
  do {
    i--;
    for (j = 0; j < NUM_OF_DIRS; j++)
      if (W_EXIT(i, j) == NULL)
        continue;
      else if (W_EXIT(i, j)->to_room > rnum)
        W_EXIT(i, j)->to_room -= (W_EXIT(i, j)->to_room != NOWHERE); /* with unsigned NOWHERE > any rnum */
      else if (W_EXIT(i, j)->to_room == rnum) {
      	if ((!W_EXIT(i, j)->keyword || !*W_EXIT(i, j)->keyword) &&
      	    (!W_EXIT(i, j)->general_description || !*W_EXIT(i, j)->general_description)) {
          /* no description, remove exit completely */
          if (W_EXIT(i, j)->keyword)
            free(W_EXIT(i, j)->keyword);
          if (W_EXIT(i, j)->general_description)
            free(W_EXIT(i, j)->general_description);
          free(W_EXIT(i, j));
          W_EXIT(i, j) = NULL;
        } else { 
          /* description is set, just point to nowhere */
          W_EXIT(i, j)->to_room = NOWHERE;
        }
      }
  } while (i > 0);

  /*
   * Find what zone that room was in so we can update the loading table.
   */
  for (i = 0; i <= top_of_zone_table; i++)
    for (j = 0; ZCMD(i , j).command != 'S'; j++)
      switch (ZCMD(i, j).command) {
      case 'M':
      case 'O':
      case 'T':
      case 'V':
	if (ZCMD(i, j).arg3 == rnum)
	  ZCMD(i, j).command = '*';	/* Cancel command. */
	else if (ZCMD(i, j).arg3 > rnum)
	  ZCMD(i, j).arg3 -= (ZCMD(i, j).arg3 != NOWHERE); /* with unsigned NOWHERE > any rnum */
	break;
      case 'D':
      case 'R':
	if (ZCMD(i, j).arg1 == rnum)
	  ZCMD(i, j).command = '*';	/* Cancel command. */
	else if (ZCMD(i, j).arg1 > rnum)
	  ZCMD(i, j).arg1 -= (ZCMD(i, j).arg1 != NOWHERE); /* with unsigned NOWHERE > any rnum */
      case 'G':
      case 'P':
      case 'E':
      case '*':
        /* Known zone entries we don't care about. */
        break;
      default:
        mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: delete_room: Unknown zone entry found!");
      }

  /*
   * Remove this room from all shop lists.
   */
  {
    extern int top_shop;
    for (i = 0;i < top_shop;i++) {
      for (j = 0;SHOP_ROOM(i, j) != NOWHERE;j++) {
        if (SHOP_ROOM(i, j) == world[rnum].number)
          SHOP_ROOM(i, j) = 0; /* set to the void */
      }
    }
  }
  /*
   * Now we actually move the rooms down.
   */
  for (i = rnum; i < top_of_world; i++) {
    world[i] = world[i + 1];
    update_wait_events(&world[i], &world[i+1]);

    for (ppl = world[i].people; ppl; ppl = ppl->next_in_room)
      IN_ROOM(ppl) -= (IN_ROOM(ppl) != NOWHERE);	/* Redundant check? */

    for (obj = world[i].contents; obj; obj = obj->next_content)
      IN_ROOM(obj) -= (IN_ROOM(obj) != NOWHERE);	/* Redundant check? */
  }

  top_of_world--;
  RECREATE(world, struct room_data, top_of_world + 1);

  return TRUE;
}
Esempio n. 10
0
void do_crecall( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA       *victim;
    ROOM_INDEX_DATA *location;
    char             buf [ MAX_STRING_LENGTH ];
    int              place;

    if ( !is_clan( ch ) )
    {
	send_to_char( "You aren't a clansman!\n\r", ch );
	return;
    }

    act( "$n prays for transportation!", ch, NULL, NULL, TO_ROOM );

    if ( IS_SET( ch->in_room->room_flags, ROOM_NO_RECALL )
	|| IS_AFFECTED( ch, AFF_CURSE ) )
    {
	send_to_char( "God has forsaken you.\n\r", ch );
	return;
    }

    place = ch->pcdata->clan->recall;
    if ( !( location = get_room_index( place ) ) )
    {
	send_to_char( "You are completely lost.\n\r", ch );
	return;
    }

    if ( ch->in_room == location )
	return;

    if ( ( victim = ch->fighting ) )
    {
	int lose;

	if ( number_bits( 1 ) == 0 )
	{
	    WAIT_STATE( ch, 4 );
	    lose = ( ch->desc ) ? 25 : 50;
	    gain_exp( ch, 0 - lose );
	    sprintf( buf, "You failed!  You lose %d exps.\n\r", lose );
	    send_to_char( buf, ch );
	    return;
	}

	lose = ( ch->desc ) ? 50 : 100;
	gain_exp( ch, 0 - lose );
	sprintf( buf, "You recall from combat!  You lose %d exps.\n\r", lose );
	send_to_char( buf, ch );
	stop_fighting( ch, TRUE );
    }

    ch->move /= 2;
    act( "$n disappears.", ch, NULL, NULL, TO_ROOM );
    char_from_room( ch );
    char_to_room( ch, location );
    act( "$n appears in the room.", ch, NULL, NULL, TO_ROOM );
    do_look( ch, "auto" );

    return;
}
Esempio n. 11
0
void do_chaosgate(CHAR_DATA *ch, char *argument)
{
    char arg[MAX_INPUT_LENGTH];
    ROOM_INDEX_DATA *location;
    CHAR_DATA *victim;
    int random_room;

    one_argument (argument, arg);

    if (IS_NPC(ch)) return;
    if (!IS_CLASS(ch, CLASS_TANARRI))
    {
        send_to_char("Huh?\n\r",ch);
        return;
    }
    if (!IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_CHAOSGATE))
    {
        send_to_char("You don't have that power yet.\n\r",ch);
        return;
    }
    if ((victim = get_char_world(ch, arg)) == NULL)
    {
        send_to_char("Chaosgate to whom?\n\r", ch );
        return;
    }
    if (IS_SET(victim->in_room->room_flags, ROOM_ASTRAL))
    {
        stc( "You can't find it's room.\n\r",ch);
        return;
    }
    if (IS_IMMUNE(victim, IMM_TRAVEL) && !IS_NPC(victim))
    {
        send_to_char("I don't think they want you to do that.\n\r",ch);
        return;
    }
    if (IS_SET(victim->act, ACT_NOTRAVEL))
    {
        send_to_char("No Can Do.\n\r", ch);
        return;
    }
    if (IS_SET(ch->in_room->room_flags, ROOM_ASTRAL))
    {
        stc( "Your room is not connected to the astral plane.\n\r",ch);
        return;
    }
    if (ch->move < 1000)
    {
        send_to_char("You don't have the move to open a chaosgate.\n\r", ch );
        return;
    }
    if (number_range(1,15)!=1) location = victim->in_room;
    else
    {
        send_to_char("Something went wrong.\n\r",ch);
        for ( ; ; )
        {
            random_room = number_range(1000, 65535);
            location = get_room_index(random_room);
            if (location != NULL)
                if (!IS_SET(location->room_flags, ROOM_PRIVATE) && !IS_SET(location->room_flags, ROOM_SOLITARY)
                        &&  !IS_SET(location->room_flags, ROOM_NO_TELEPORT)) break;
        }
    }
    act("You open a gate made from pure chaos and steps into it.", ch, NULL, NULL, TO_CHAR);
    act("$n opens a gate of pure chaos and steps into it.", ch, NULL, NULL, TO_ROOM);
    ch->move -= 1000;
    char_from_room(ch);
    char_to_room(ch, location);
    do_look(ch, "auto");
    act("You step out of the gate.", ch, NULL, NULL, TO_CHAR);
    act("A gate appears from out of nowhere and $n steps out of it.", ch, NULL, NULL, TO_ROOM);
    return;
}
Esempio n. 12
0
void do_crusade(CHAR_DATA *ch, char *argument)
{
    DESCRIPTOR_DATA* d;
    CHAR_DATA *questman;
    CHAR_DATA *boss;
    char buf  [MAX_STRING_LENGTH];
    char arg1 [MAX_INPUT_LENGTH];
    char arg2 [MAX_INPUT_LENGTH];

    argument = one_argument(argument, arg1);
    argument = one_argument(argument, arg2);

    if (arg1[0] == '\0')
    {
        send_to_char(AT_WHITE, "CRUSADE commands: POINTS INFO TIME REQUEST COMPLETE LIST BUY ADVANCE.\n\r",ch);
        send_to_char(AT_WHITE, "For more information, type 'HELP CRUSADE'.\n\r",ch);
        return;
    }

    if (!str_cmp(arg1, "time"))
    {
	if (IS_SET(ch->act2, PLR_RELQUEST))
	{
		sprintf(buf, "You have %d minutes left on your crusade!\n\r", ch->rcountdown);
	} else
	{
		if (ch->rnextquest > 0)
		{
			sprintf(buf, "You have %d minutes left before your next crusade!\n\r", ch->rnextquest);
		} else
		{
			strcpy(buf, "You are free to do a crusade right now!\n\r");
		}
	}
	send_to_char(AT_WHITE, buf, ch);
	return;
    } else if (!str_cmp(arg1, "points"))
    {
	sprintf(buf, "You have %d relgion points.\n\r", ch->rquestpoints);
	send_to_char(AT_WHITE, buf, ch);
	return;
    } else if (!str_cmp(arg1, "info"))
    {
	OBJ_INDEX_DATA* oinfo;
	MOB_INDEX_DATA* minfo;

	if (!IS_SET(ch->act2, PLR_RELQUEST))
	{
		send_to_char(AT_WHITE, "You are not on a crusade!\n\r", ch);
		return;
	}

	if (ch->rquestobj[ch->relquest_level]==0 && ch->rquestmob[ch->relquest_level]==0)
	{
		if (ch->in_room->vnum <= REL_VNUM_UPPER && ch->in_room->vnum >= REL_VNUM_LOWER)
		{
			send_to_char(AT_WHITE, "You are almost finished your crusade.\n\rFind the portal to the next level!\n\r", ch);
			return;
		} else
		{
			send_to_char(AT_WHITE, "You are almost finished your crusade!\n\rFind your DEITY and COMPLETE you quest!\n\r",ch);
			return;
		}
	} 

	if (ch->rquestmob[ch->relquest_level])
	{
		if (ch->rquestmob[ch->relquest_level] == -1)
		{
			send_to_char(AT_WHITE, "You are almost done your crusade!\n\rFind the boss and ADVANCE!\n\r", ch);
			return;
		} else
		{
			minfo = get_mob_index( ch->rquestmob[ch->relquest_level] );
			sprintf(buf, "You are on a crusade to slay the dreaded %s!\n\r", minfo->short_descr);
		}
   	} else
	{
		oinfo = get_obj_index( ch->rquestobj[ch->relquest_level] );
		sprintf(buf, "You are on a crusade to retrieve the fabled %s!\n\r", oinfo->short_descr);
	}
	send_to_char(AT_WHITE, buf, ch);
	return; 
    }

    for ( questman = ch->in_room->people; questman != NULL; questman = questman->next_in_room)
    {
        if (!IS_NPC(questman)) continue;
        if (IS_SET(questman->act, ACT_IS_DEITY)) break;
    }

    for (boss = ch->in_room->people; boss; boss = boss->next_in_room)
    {
	if (!IS_NPC(boss)) continue;
	if (IS_SET(boss->act, ACT_RELBOSS)) break;
    }


    if (!str_cmp(arg1, "request"))
    {
        int member_count = 0;
	CHAR_DATA* group[MAX_GROUP];

  	if (questman==NULL)
        {
   		send_to_char(AT_WHITE, "Your deity is not here!\n\r", ch);
    	  	return;
        }


        if (IS_SET(ch->act2, PLR_RELQUEST))
	{
		send_to_char(AT_WHITE, "You are already ON a crusade!\n\r",ch);
		return;
	}
	if (relquest)
	{
		send_to_char(AT_WHITE, "The gods have already set a crusade to be finished!\n\r",ch);
		return;
	}
	if (ch->master)
	{
	    send_to_char(AT_WHITE, "Only your group leader can ask for a crusade!\n\r", ch);
	    return;
	}
	if (ch->alignment > -500 && ch->alignment < 500) /* || (ch->religion == TIME_AND_FATE */
	{
	    send_to_char(AT_WHITE, "You are neutral. You cannot go upon a crusade!\n\r",ch);
	    return;
	}
	if (ch->leader)
	{
	    send_to_char(AT_WHITE, "Only the leader of your group can request a crusade!\n\r", ch);
	    return;
	}
	for ( d = descriptor_list; d; d = d->next )
        {
	    RELIGION_DATA* rd = NULL;
	    CHAR_DATA* gch = NULL;

	    if ( d->connected != CON_PLAYING )
        	continue;

	    gch = d->character;

	    if ( !is_same_group(gch , ch ) )
                continue;

	    if ( gch->in_room != ch->in_room )
	    {
		send_to_char(AT_WHITE, "Your must gather your party before venturing forth!\n\r", ch);
		return;
	    }

	    if ( gch->rnextquest > 0 )
	    {
		sprintf(buf, "%s must wait before doing another crusade!\n\r", gch->name);
		send_to_char(AT_WHITE, "You must wait before your next Crusade!\n\r", gch);
		send_to_char(AT_WHITE, buf, ch);
		return;
	    }
          
	    if ( gch->level < REL_QUEST_MIN )
	    {
		sprintf(buf, "%s is not high enough level to do a Crusade!\n\r", gch->name);
		send_to_char(AT_WHITE, "You are not high enough level to complete a Crusade!\n\r", gch);
		send_to_char(AT_WHITE, buf, ch);
		return;
	    }

	    rd = get_religion_index( ch->religion );
/*
Quest Restriction to Deities
Out for debug
	    if (!strstr(questman->short_descr, rd->deity ) )
	    {
	        sprintf(buf, "%s would not appreciate you devoting your crusades to %s!\n\rFind your own Deity!\n\r", rd->deity, questman->short_descr);
		send_to_char(AT_WHITE, buf, ch);
		return;
	    }
*/
	    group[member_count] = gch;
	    member_count++;
	    if (ch->alignment >= 500)
	    {
		if (gch->alignment <= -500) /* || gch->religion == EVIL */
		{
		    sprintf(buf, "Your deity will not accept %s upon your crusade!\n\r", gch->name);
		    send_to_char(AT_WHITE, buf, ch);
		    return;
		}
	    } else if (ch->alignment <= -500)
	    {
		if (gch->alignment >= 500) /* || gch->religion == GOOD */
		{
		    sprintf(buf, "Your deity will not accept %s upon your crusade!\n\r", gch->name);
		    send_to_char(AT_WHITE, buf, ch);
		    return;
		}
	    }
        }
        if (member_count < 2)
	{
	    send_to_char(AT_WHITE, "You need 2 or more heroes for a crusade!\n\r", ch);
	    return;
	}
        if (ch->alignment >= 500)
        {
 	    int levels = (((((ch->level > LEVEL_DEMIGOD) ? LEVEL_DEMIGOD : ch->level )) - REL_QUEST_MIN)/(14))+1;
	    if(rel_quest_gen(ch, ALIGN_GOOD, levels))
            {
		int qtime = number_range(15, 45);
		int curmemb;
		relquest=TRUE;
		/* Made it... let's go! */

		rel_quest_goals(ch, levels, ALIGN_GOOD);
		for ( curmemb = 0; curmemb < member_count; curmemb++)
        	{
		    int i;
		    for (i = 0; i < levels; i++)
		    {
			group[curmemb]->rquestobj[i] = ch->rquestobj[i];
			group[curmemb]->rquestmob[i] = ch->rquestmob[i];
		    }
		    group[curmemb]->relquest_level = 0;
		    group[curmemb]->rcountdown = qtime;
	    	    SET_BIT(group[curmemb]->act2, PLR_RELQUEST);
		    char_from_room(group[curmemb]);
		    char_to_room  (group[curmemb], get_room_index( REL_VNUM_UPPER ) );
		    send_to_char( AT_WHITE, "The smell of honey and sweet perfume fills your nose!\n\r", group[curmemb]);
		    interpret( group[curmemb], "look" );
		    interpret( group[curmemb], "crusade info" );
		}
	        return;

	    } else
	    {
		bug("rel_quest_gen: Failed to create quest!",0);
	    }                
	} else if (ch->alignment <= -500)
	{
	    int levels = (((((ch->level > LEVEL_DEMIGOD) ? LEVEL_DEMIGOD : ch->level )) - REL_QUEST_MIN)/( 14 ))+1;
	    if(rel_quest_gen(ch, ALIGN_EVIL, levels))
     	    {
		int qtime = number_range(15, 45);
		int curmemb;
		relquest=TRUE;

		/* Made it... let's go! */
		rel_quest_goals(ch, levels, ALIGN_EVIL);
		for ( curmemb=0; curmemb < member_count; curmemb++)
        	{
		    int i;
		    for (i = 0; i < levels; i++)
		    {
			group[curmemb]->rquestobj[i] = ch->rquestobj[i];
			group[curmemb]->rquestmob[i] = ch->rquestmob[i];
		    }
		    group[curmemb]->relquest_level = 0;
		    group[curmemb]->rcountdown = qtime;
	    	    SET_BIT(group[curmemb]->act2, PLR_RELQUEST);
		    char_from_room(group[curmemb]);
		    char_to_room  (group[curmemb], get_room_index( REL_VNUM_LOWER ) );
		    send_to_char( AT_RED, "The flames of hell singe your armor!\n\r", group[curmemb]);
		    interpret( group[curmemb], "look" );
	   	    interpret( group[curmemb], "crusade info" );
		}
	        return;
	    } else
	    {
		bug("rel_quest_gen: Failed to create quest!",0);
	    }                

	}
    } else if (!str_cmp(arg1,"complete"))
    {
    	if (questman==NULL)
    	{
   		send_to_char(AT_WHITE, "Your deity is not here!\n\r", ch);
    		return;
        }

	if (IS_SET(ch->act2, PLR_RELQUEST) && ch->rcountdown > 0)
        {
	    CHAR_DATA* gch = NULL;
	    int qp;
	    qp = number_range( ch->level/4, ch->level/2);
	    if (ch->leader || ch->master)
	    {
		send_to_char(AT_WHITE, "Only the group leader can complete a crusade!\n\r", ch);
		return;
	    }
	    for (d=descriptor_list; d; d = d->next)
	    {     
	    	if ( d->connected != CON_PLAYING )
        		continue;
		if (is_same_group(d->character, ch))
		{
			if (d->character->in_room != ch->in_room)
			{
				send_to_char(AT_WHITE, "You must gather your party before completing a crusade!\n\r", ch);
				return;
			}
		}	    	
	    }
	    // the whole party is in the room
	    for (gch=ch->in_room->people; gch; gch=gch->next_in_room)
	    {
	    	if (is_same_group(ch, gch))
		{
			int gqp = number_fuzzy(qp);
			sprintf(buf, "You have gained %d religion points for your service!\n\r", gqp);
			send_to_char(AT_WHITE, "YAY! You completed your crusade!\n\r",gch);
			gch->rquestpoints += gqp;
    			gch->rnextquest = number_range(10, 30);
    			gch->rcountdown = 0;
			send_to_char(AT_WHITE, buf, gch);
	    		REMOVE_BIT(gch->act2, PLR_RELQUEST);
		}
	    }

	    relquest=FALSE; 
	    return;
        } else
	{
	    send_to_char(AT_WHITE, "You are not on a religious crusade!\n\r",ch);
	    return;
	}
    } else if(!str_cmp(arg1, "list"))
    {
    	if (questman==NULL)
    	{
   		send_to_char(AT_WHITE, "Your deity is not here!\n\r", ch);
    		return;
    	}

	send_to_char(AT_WHITE, "Nothing to list yet.\n\r", ch);
	return;
    } else if(!str_cmp(arg1, "buy"))
    {
    	if (questman==NULL)
    	{
   		send_to_char(AT_WHITE, "Your deity is not here!\n\r", ch);
    		return;
	}

	send_to_char(AT_WHITE, "Nothing to buy quite yet.\n\r", ch);
	return;
    } else if(!str_cmp(arg1, "advance"))
    {
	DESCRIPTOR_DATA* d;

	if(!IS_SET(ch->act2, PLR_RELQUEST))
	{
		send_to_char(AT_WHITE, "You cannot advance a crusade if you are not on one!\n\r", ch);
		return;
	}
	if(ch->leader || ch->master)
	{
		send_to_char(AT_WHITE, "Only the group leader can advance a crusade!\n\r", ch);
		return;
	}
	
	if (!boss)
	{
		send_to_char(AT_WHITE, "You need to find the boss of this level before you can advance!\n\r", ch);
		return;
	}

	if (ch->rquestmob[ch->relquest_level] > 0 && ch->rcountdown > 0)
	{
		send_to_char(AT_WHITE, "You have not completed this section of your crusade!\n\r", ch);
		return;
	} else if (ch->rquestobj[ch->relquest_level] > 0 && ch->rcountdown > 0)
	{
		bool found = FALSE;
		OBJ_DATA* obj;
		for (obj = ch->carrying; obj; obj = obj->next)
		{
			if (obj->pIndexData->vnum == ch->rquestobj[ch->relquest_level])
			{
				found = TRUE;
				extract_obj(obj);
			}
		}
		if (!found)
		{
			send_to_char(AT_WHITE, "You have not completed this section of your crusade!\n\r", ch);
			return;
		}
	} 
	ch->rquestobj[ch->relquest_level]=0;
	ch->rquestmob[ch->relquest_level]=0;
	for (d=descriptor_list; d; d = d->next)
        {
                if ( d->connected != CON_PLAYING )
                        continue;
                if (is_same_group(d->character, ch))
                {
			d->character->rquestmob[ch->relquest_level] = 0;
			d->character->rquestobj[ch->relquest_level] = 0;
			send_to_char(AT_WHITE, "You feel free to pursue the next part of your crusade!\n\r", d->character);
		}
	} 
    } else
    {
        send_to_char(AT_WHITE, "CRUSADE commands: POINTS INFO TIME REQUEST COMPLETE LIST BUY ADVANCE.\n\r",ch);
        send_to_char(AT_WHITE, "For more information, type 'HELP CRUSADE'.\n\r",ch);
        return;
    }
}
Esempio n. 13
0
/* Extract a ch completely from the world, and leave his stuff behind */
void extract_char_smarter(struct char_data *ch, int save_room)
{
  struct obj_data *i;
  struct char_data *k, *next_char;
  struct descriptor_data *t_desc;
  int l, was_in, j;

  extern long mob_count;  
  extern struct char_data *combat_list;
  
  void do_save(struct char_data *ch, char *argument, int cmd);
  void do_return(struct char_data *ch, char *argument, int cmd);
  
  void die_follower(struct char_data *ch);

  if(IS_SET(ch->specials.act, ACT_FIGURINE) && ch->link)
     extract_obj(ch->link);
  
  if(!IS_NPC(ch) && !ch->desc)	{
    for(t_desc = descriptor_list; t_desc; t_desc = t_desc->next)
      if(t_desc->original==ch)
	do_return(t_desc->character, "", 0);
  }
  
  if (ch->in_room == NOWHERE) {
    log("NOWHERE extracting char. (handler.c, extract_char)");
    /*
     **  problem from linkdeath
     */
    char_to_room(ch, 4);  /* 4 == all purpose store */
  }
  
  if (ch->followers || ch->master)
    die_follower(ch);
  
  if(ch->desc) {
    /* Forget snooping */
    if ((ch->desc->snoop.snooping) && (ch->desc->snoop.snooping->desc))
      ch->desc->snoop.snooping->desc->snoop.snoop_by = 0;
    
    if (ch->desc->snoop.snoop_by) {
      send_to_char("Your victim is no longer among us.\n\r",
		   ch->desc->snoop.snoop_by);
      if (ch->desc->snoop.snoop_by->desc)
      ch->desc->snoop.snoop_by->desc->snoop.snooping = 0;
    }
    
    ch->desc->snoop.snooping = ch->desc->snoop.snoop_by = 0;
  }
  
  if (ch->carrying)	{
    /* transfer ch's objects to room */
    
    if (!IS_IMMORTAL(ch)) {

      while(ch->carrying) {
	i=ch->carrying;
	obj_from_char(i);
	obj_to_room(i, ch->in_room);
	check_falling_obj(i, ch->in_room);

      }
    } else {

      send_to_char("Here, you dropped some stuff, let me help you get rid of that.\n\r",ch);

      /*
	equipment too
	*/
      for (j=0; j<MAX_WEAR; j++) {
	if (ch->equipment[j])
	  obj_to_char(unequip_char(ch, j), ch);
      }      

      while (ch->carrying) {
         i = ch->carrying;
	 obj_from_char(i);
	 extract_obj(i);
      }
    }
    
  }
  
  if (ch->specials.fighting)
    stop_fighting(ch);
  
  for (k = combat_list; k ; k = next_char)	{
    next_char = k->next_fighting;
    if (k->specials.fighting == ch)
      stop_fighting(k);
  }

  if (MOUNTED(ch)) {
    Dismount(ch, MOUNTED(ch), POSITION_STANDING);    
  }

  if (RIDDEN(ch)) {
    Dismount(RIDDEN(ch), ch, POSITION_STANDING);
  }
  
  /* Must remove from room before removing the equipment! */
  was_in = ch->in_room;
  char_from_room(ch);
  
  /* clear equipment_list */
  for (l = 0; l < MAX_WEAR; l++)
    if (ch->equipment[l])
      obj_to_room(unequip_char(ch,l), was_in);
  
  
  if (IS_NPC(ch)) {
    for (k=character_list; k; k=k->next) {
      if (k->specials.hunting)
	if (k->specials.hunting == ch) {
	  k->specials.hunting = 0;
	}
      if (Hates(k, ch)) {
	RemHated(k, ch);
      }
      if (Fears(k, ch)) {
	RemFeared(k, ch);
      }
      if (k->orig == ch) {
	k->orig = 0;
      }
    }          
  } else {
    for (k=character_list; k; k=k->next) {
      if (k->specials.hunting)
	if (k->specials.hunting == ch) {
	  k->specials.hunting = 0;
	}
      if (Hates(k, ch)) {
	ZeroHatred(k, ch);
      }
      if (Fears(k, ch)) {
	ZeroFeared(k, ch);
      }
      if (k->orig == ch) {
	k->orig = 0;
      }
    }
    
  }
  /* pull the char from the list */
  
  if (ch == character_list)  
    character_list = ch->next;
  else   {
    for(k = character_list; (k) && (k->next != ch); k = k->next);
    if(k)
      k->next = ch->next;
    else {
      log("Trying to remove ?? from character_list.(handler.c,extract_char)");
      exit(0);
    }
  }

  if (ch->specials.gname)
    free(ch->specials.gname);
  
  GET_AC(ch) = 100;
  
  if (ch->desc)	{
    if (ch->desc->original)
      do_return(ch, "", 0);
    if (!strcmp(GET_NAME(ch), "Odin's heroic minion")) {
      free(GET_NAME(ch));
      GET_NAME(ch) = strdup("111111");
    }
    save_char(ch, save_room);
  }
  

  t_desc = ch->desc;

  if(ch->term) {
    ScreenOff(ch);
    ch->term = 0;
  }

  if (IS_NPC(ch)) 	{
    if (ch->nr > -1) /* if mobile */
      mob_index[ch->nr].number--;
    FreeHates(ch);
    FreeFears(ch);
    mob_count--;
    free_char(ch);
  }
  
  if (t_desc) {
    t_desc->connected = CON_SLCT;
    SEND_TO_Q(MENU, t_desc);
  }
}
Esempio n. 14
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;
	}
}
Esempio n. 15
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;
}