Beispiel #1
0
void quest_quit(struct char_data *ch)
{
  qst_rnum rnum;

  if (GET_QUEST(ch) == NOTHING)
    send_to_char(ch, "But you currently aren't on a quest!\r\n");
  else if ((rnum = real_quest(GET_QUEST(ch))) == NOTHING) {
    clear_quest(ch);
    send_to_char(ch, "You are now no longer part of the quest.\r\n");
    save_char(ch);
  } else {
    clear_quest(ch);
    if (QST_QUIT(rnum) && (str_cmp(QST_QUIT(rnum), "undefined") != 0))
      send_to_char(ch, "%s", QST_QUIT(rnum));
    else
      send_to_char(ch, "You are now no longer part of the quest.\r\n");
    if (QST_PENALTY(rnum)) {
      GET_QUESTPOINTS(ch) -= QST_PENALTY(rnum);
      send_to_char(ch,
        "You have lost %d quest points for your cowardice.\r\n",
        QST_PENALTY(rnum));
    }
    save_char(ch);
  }
}
Beispiel #2
0
void quest_timeout(struct char_data *ch)
{
  if ((GET_QUEST(ch) != NOTHING) && (GET_QUEST_TIME(ch) != -1)) {
    clear_quest(ch);
    send_to_char(ch, "You have run out of time to complete the quest.\r\n");
  }
}
Beispiel #3
0
void quest_cancel(  )
{
    if ( quest_mob )
        do_crusade( quest_mob, "Shoot! Just forget about recovering ANYTHING for me, ok?" );

    clear_quest(  );
    return;
}
Beispiel #4
0
void quest_complete( CHAR_DATA * ch )
{
    char buf[MAX_STRING_LENGTH];

    snprintf( buf, MSL, qmessages[quest_personality][16].message1, ch->get_name(), quest_object->short_descr );
    do_crusade( quest_mob, buf );
    clear_quest(  );
    return;
}
Beispiel #5
0
void quest_cancel()
{
   extern CHAR_DATA *quest_mob;
   extern bool auto_quest;
    if ( quest_mob )
       do_crusade( quest_mob, "{RShoot! Just forget about recovering ANYTHING for me, ok?{x", 9 );


    clear_quest();
    auto_quest = TRUE;
    return;   
}   
Beispiel #6
0
 * quest_inform : Makes the questing mobile give out information to the
 * players on the mud.  Starts off real simple, and gets more helpful as
 * time runs out :P
 */

void quest_inform( void )
{
   char buf[MAX_STRING_LENGTH];
   extern CHAR_DATA *quest_mob;
   extern CHAR_DATA *quest_target;
   extern OBJ_DATA *quest_object;
   extern int quest_timer;
   extern sh_int quest_personality;
   extern const struct qmessage_type  qmessages[4][17]; 



   /* Work out what the mob should tell the players.... */
   /* Add random element to each case so quests look different each time? */
   if ( quest_timer < 7 )
   {
    sprintf( buf, qmessages[quest_personality][quest_timer].message1, quest_object->short_descr );
   }
   else
   { 
   if (quest_target)
	sprintf ( buf, qmessages[quest_personality][quest_timer].message1,
			 quest_target->short_descr,quest_object->short_descr );
   else
      sprintf( buf, qmessages[quest_personality][quest_timer].message2,
		 quest_object->short_descr );
   }



   quest_timer++;
   
   if ( quest_mob && quest_timer < 16 )
        do_crusade( quest_mob, buf, 9 );
	
   if ( quest_timer == 1 )
   {
     sprintf( buf, " {x%s{x is crusading for {x%s{x ", quest_mob->pIndexData->short_descr, quest_object->short_descr);
    /*
     info( buf, 5 );
     */
  }
   if ( !quest_mob )
   {
     clear_quest();
   }    
   return;
}
Beispiel #7
0
void quest_complete( CHAR_DATA *ch )
{
   extern CHAR_DATA *quest_mob;
   extern bool auto_quest;
   extern OBJ_DATA *quest_object;
   extern sh_int quest_personality;
   extern const struct qmessage_type  qmessages[4][17]; 


   char buf[MAX_STRING_LENGTH];

   sprintf( buf, qmessages[quest_personality][16].message1, ch->name, quest_object->short_descr );

   do_crusade( quest_mob, buf, 9 );

  clear_quest();
  auto_quest = TRUE;
   return;
}   
Beispiel #8
0
void quest_inform( void )
{
    char buf[MAX_STRING_LENGTH];

    /*
     * Work out what the mob should tell the players....
     */
    /*
     * Add random element to each case so quests look different each time?
     */
    if ( quest_timer < 7 )
    {
        snprintf( buf, MSL, qmessages[quest_personality][quest_timer].message1, quest_object->short_descr );
    }
    else
    {
        if ( quest_target )
            snprintf( buf, MSL, qmessages[quest_personality][quest_timer].message1,
                      quest_target->get_name(), quest_object->short_descr );
        else
            snprintf( buf, MSL, qmessages[quest_personality][quest_timer].message2, quest_object->short_descr );
    }



    quest_timer++;
    if ( quest_mob && quest_timer < 16 )
        do_crusade( quest_mob, buf );
    if ( quest_timer == 1 )
    {
        snprintf( buf, MSL, "%s is crusading for %s ", quest_mob->get_name(), quest_object->short_descr );
        info( buf, 5 );
    }
    if ( !quest_mob )
    {
        clear_quest(  );
    }
    return;
}
Beispiel #9
0
void quest_progress(struct char_data *ch)
{
  qst_rnum rnum;

  if (GET_QUEST(ch) == NOTHING)
    send_to_char(ch, "But you currently aren't on a quest!\r\n");
  else if ((rnum = real_quest(GET_QUEST(ch))) == NOTHING) {
    clear_quest(ch);
    send_to_char(ch, "Your quest seems to no longer exist.\r\n");
  } else {
    send_to_char(ch, "You are on the following quest:\r\n%s\r\n%s",
        QST_DESC(rnum), QST_INFO(rnum));
    if (QST_QUANTITY(rnum) > 1)
      send_to_char(ch,
          "You still have to achieve %d out of %d goals for the quest.\r\n",
   GET_QUEST_COUNTER(ch), QST_QUANTITY(rnum));
    if (GET_QUEST_TIME(ch) > 0)
      send_to_char(ch,
          "You have %d turn%s remaining to complete the quest.\r\n",
   GET_QUEST_TIME(ch),
   GET_QUEST_TIME(ch) == 1 ? "" : "s");
  }
}
Beispiel #10
0
void do_quest( CHAR_DATA *ch, char *argument )
{
   extern bool quest;
   extern bool auto_quest;
   extern CHAR_DATA *quest_mob;
   extern CHAR_DATA *quest_target;
   extern OBJ_DATA *quest_object;
   extern int quest_timer;
   extern int quest_wait;
  
   char buf[MAX_STRING_LENGTH];
   char new_long_desc[MAX_STRING_LENGTH];
   
   if ( argument[0] == '\0' )	/* Display status */
   {
      if ( !quest )
      {
         send_to_char( "There is no quest currently running.\n\r", ch );
         if ( auto_quest )
            send_to_char( "Quests are currently running automatically.\n\r", ch );
         if ( quest_wait > 0 )
         {
            sprintf( buf, "The next quest may occur in %d minutes.\n\r", (quest_wait * 2) );
            send_to_char( buf, ch );
         }
         return;
      }
      else
         send_to_char( "There is currently a quest running ", ch );
      
      if ( auto_quest )
         send_to_char( "(Automatically)", ch );
      
      send_to_char( "\n\rQuest Details:\n\r\n\r", ch );
      if ( quest_mob )
      {

        sprintf( buf, "The questing mobile is: {x%s{x [In Room %d]\n\r", 
           quest_mob->short_descr, quest_mob->in_room->vnum );
        send_to_char( buf, ch );
      }
      else
      {
        send_to_char( "The questing mobile is dead!\n\r", ch );
      }
      if ( quest_target )
      {
        sprintf( buf, "Target Mobile is: {x%s{x [In Room %d]\n\r",
           quest_target->short_descr, quest_target->in_room->vnum );
        send_to_char( buf, ch );
      }
      else
        send_to_char( "The target mobile is dead!\n\r", ch );

      sprintf( buf, "Target Object is: {x%s{x.\n\r", quest_object->short_descr );
      send_to_char( buf, ch );

      sprintf( buf, "Quest Object is worth: %d QP, %d XP, %d raise points and %d GP\n\r",
         quest_object->value[0], (ch->level < LVL_MOBXPCAP) ? quest_object->value[1] : 0,
         quest_object->value[4], quest_object->value[2]);
      send_to_char( buf, ch );

      
      sprintf( buf, "The Quest has been running for %d/30 minutes.\n\r", (quest_timer * 2) );
      send_to_char( buf, ch );
      
      return;
   }
   if ( !strcmp( argument, "stop" ) )
   {
     if ( quest )
     {
		 /*
       sprintf( buf, "@@NThe quest has been stopped by an {mImmortal@@N. Please speak up if you have already gotten the item.\n\r" );
       do_gecho( ch, buf );
	     */
       clear_quest();
     }
     return;
   }

   if ( !strcmp( argument, "start" ) )
   {
      DESCRIPTOR_DATA *d;
      int a = 80;
      int b = 0;
      sh_int player_count = 0, average_level= 0, total_levels = 0;
      
      /* generate a new quest! */
      if ( quest )
      {
         send_to_char( "There is already a quest running...\n\r", ch );
         return;
      }
      
      if ( auto_quest )
      {
         auto_quest = FALSE;
         send_to_char( "Automatic Quests now OFF.\n\r", ch );
      }
      
      /* Work out levels of currently playing folks */
      for ( d = descriptor_list; d; d = d->next )
      {
         if (  ( d->connected != CON_PLAYING )
            || ( IS_IMMORTAL( d->character )  ) )
            continue;
         player_count += 1;
         total_levels += d->character->level;
      }
      average_level = ( ( ( total_levels == 0 ) ? 30 : total_levels ) /
                        ( ( player_count == 0 ) ? 1 : player_count ) );
      a = average_level - 20;
      b = average_level + 20;

	  sprintf(buf, "Mob lLevel: %d hLevel: %d\n\r", a, b);
	  stc(buf,ch);
      quest_mob    = get_quest_giver(a, b);
      if ( quest_mob == NULL )
      {
         send_to_char( "Failed to find a quest mob\n\r", ch );
         return;
      }
      b = UMIN( b, 110 );
      a = UMAX( 20, a );

      quest_target = get_quest_target( a, b );
      if (  ( quest_target == NULL )
         || ( quest_target == quest_mob )  )
      {
         send_to_char( "Failed to find a quest target\n\r", ch );
         return;
      }
      quest_object = load_quest_object( quest_target );
      if ( quest_object == NULL )
      {
         send_to_char( "An invalid quest object was encountered.  Check log files.\n\r", ch );
         quest = FALSE;
         return;
      }
      /* Set values on quest item for Qp, Pracs, Exp, Gold */
      quest_object->value[0] = UMAX( 1, ( quest_target->level / 3) );
      quest_object->value[1] = number_range(1, 60);
      quest_object->value[2] = ( quest_target->level * 100 );
      quest_object->value[4] = 2;

      if ( number_percent() < 10 )
      {
         quest_object->value[0] += 2;
         quest_object->value[1] += 3;
         quest_object->value[2] *= 2;
         quest_object->value[4] *= 3;
      }
      
      quest_timer = 0;
      quest = TRUE;
      new_long_desc[0] = '\0';
      if ( quest_mob->pIndexData->long_descr_orig != NULL )
        free_string( quest_mob->pIndexData->long_descr_orig );
      quest_mob->pIndexData->long_descr_orig = str_dup(quest_mob->long_descr );
      sprintf( new_long_desc, "%s {xsays have you found %s?\n\r",
         quest_mob->pIndexData->short_descr, quest_object->short_descr );
      if ( quest_mob->long_descr != NULL )      
        free_string( quest_mob->long_descr );    
      quest_mob->long_descr = str_dup( new_long_desc );
      SET_BIT( quest_mob->act, PLR_NOSUMMON );
      REMOVE_BIT(quest_mob->act, ACT_AGGRESSIVE);
     /* T!!! */
      new_long_desc[0] = '\0';
      if ( quest_target->pIndexData->long_descr_orig != NULL )
        free_string( quest_target->pIndexData->long_descr_orig );
      quest_target->pIndexData->long_descr_orig = str_dup( quest_target->long_descr );
      sprintf( new_long_desc, "%s {xsays I stole the {x%s{x!\n\r",
        quest_target->pIndexData->short_descr, quest_object->short_descr );
      if ( quest_target->long_descr != NULL )     
        free_string( quest_target->long_descr );   
      quest_target->long_descr = str_dup( new_long_desc );

      SET_BIT( quest_target->act, PLR_NOSUMMON );

      send_to_char( "QUEST STARTED!\n\r\n\r", ch );
            
      sprintf( buf, "The questing mobile is: {x%s{x [In Room %d]\n\r", 
         quest_mob->pIndexData->short_descr, quest_mob->in_room->vnum );
      send_to_char( buf, ch );
      
      sprintf( buf, "Target Mobile is: {x%s{x [In Room %d]\n\r",
         quest_target->pIndexData->short_descr, quest_target->in_room->vnum );
      send_to_char( buf, ch );
      
      sprintf( buf, "Target Object is: {x%s{x.\n\r", quest_object->short_descr );
      send_to_char( buf, ch );
      
      sprintf( buf, "Quest Object is worth: %d QP, %d XP, %d raise points and %d GP\n\r",
         quest_object->value[0], quest_object->value[1],
         quest_object->value[4], quest_object->value[2] );
      send_to_char( buf, ch );
      
      return;
   }
   if ( !str_cmp( argument, "auto" ) )
   {
      send_to_char( "AutoQuest now initiated!\n\r", ch );
      auto_quest = TRUE;
	  quest_wait = 360;
      return;
   }
   
   
   return;
}      
Beispiel #11
0
void generic_complete_quest(struct char_data *ch)
{
  qst_rnum rnum;
  qst_vnum vnum = GET_QUEST(ch);
  struct obj_data *new_obj;
  int happy_qp, happy_gold, happy_exp;

  if (--GET_QUEST_COUNTER(ch) <= 0) {
    rnum = real_quest(vnum);
    if (IS_HAPPYHOUR && IS_HAPPYQP) {
      happy_qp = (int)(QST_POINTS(rnum) * (((float)(100+HAPPY_QP))/(float)100));
      happy_qp = MAX(happy_qp, 0);
      GET_QUESTPOINTS(ch) += happy_qp;
      send_to_char(ch,
          "%s\r\nYou have been awarded %d quest points for your service.\r\n",
          QST_DONE(rnum), happy_qp);
	} else {
      GET_QUESTPOINTS(ch) += QST_POINTS(rnum);
      send_to_char(ch,
          "%s\r\nYou have been awarded %d quest points for your service.\r\n",
          QST_DONE(rnum), QST_POINTS(rnum));
    }
    if (QST_GOLD(rnum)) {
      if ((IS_HAPPYHOUR) && (IS_HAPPYGOLD)) {
        happy_gold = (int)(QST_GOLD(rnum) * (((float)(100+HAPPY_GOLD))/(float)100));
        happy_gold = MAX(happy_gold, 0);
        increase_gold(ch, happy_gold);
        send_to_char(ch,
              "You have been awarded %d gold coins for your service.\r\n",
              happy_gold);
	  } else {
        increase_gold(ch, QST_GOLD(rnum));
        send_to_char(ch,
              "You have been awarded %d gold coins for your service.\r\n",
              QST_GOLD(rnum));
      }
    }
    if (QST_EXP(rnum)) {
      gain_exp(ch, QST_EXP(rnum));
      if ((IS_HAPPYHOUR) && (IS_HAPPYEXP)) {
        happy_exp = (int)(QST_EXP(rnum) * (((float)(100+HAPPY_EXP))/(float)100));
        happy_exp = MAX(happy_exp, 0);
        send_to_char(ch,
              "You have been awarded %d experience for your service.\r\n",
              happy_exp);
      } else {
        send_to_char(ch,
              "You have been awarded %d experience points for your service.\r\n",
              QST_EXP(rnum));
      }
    }
    if (QST_OBJ(rnum) && QST_OBJ(rnum) != NOTHING) {
      if (real_object(QST_OBJ(rnum)) != NOTHING) {
        if ((new_obj = read_object((QST_OBJ(rnum)),VIRTUAL)) != NULL) {
            obj_to_char(new_obj, ch);
            send_to_char(ch, "You have been presented with %s%s for your service.\r\n",
                GET_OBJ_SHORT(new_obj), CCNRM(ch, C_NRM));
        }
      }
    }
    if (!IS_SET(QST_FLAGS(rnum), AQ_REPEATABLE))
      add_completed_quest(ch, vnum);
    clear_quest(ch);
    if ((real_quest(QST_NEXT(rnum)) != NOTHING) &&
        (QST_NEXT(rnum) != vnum) &&
        !is_complete(ch, QST_NEXT(rnum))) {
      rnum = real_quest(QST_NEXT(rnum));
      set_quest(ch, rnum);
      send_to_char(ch,
          "The next stage of your quest awaits:\r\n%s",
          QST_INFO(rnum));
    }
  }
  save_char(ch);
}