示例#1
0
void do_classes( CHAR_DATA *ch, char *argument )
{
    int                     iClass = 0;
    int                     counter = 0;

    if ( !IS_IMMORTAL( ch ) )
        counter = 1;
    send_to_pager( "\r\n", ch );
    for ( iClass = 0; iClass < MAX_PC_CLASS; iClass++ ) {
        if ( !class_table[iClass] || !VLD_STR( class_table[iClass]->who_name ) ) {
            if ( IS_IMMORTAL( ch ) )
                counter++;
            continue;
        }
        pager_printf( ch, "&c[&C%2d&c]&W %-15s", counter, class_table[iClass]->who_name );
        if ( IS_IMMORTAL( ch ) )
            pager_printf( ch,
                          " &cStarting:&W%3s &cExpbase:&W %-5d &cPrime: &W%-14s &cMana: &W%2d-%-2d",
                          class_table[iClass]->starting ? "Yes" : "No",
                          class_table[iClass]->exp_base, a_types[class_table[iClass]->attr_prime],
                          class_table[iClass]->mana_min, class_table[iClass]->mana_max );
        pager_printf( ch, "&D\r\n" );
        counter++;
    }
    return;
}
示例#2
0
void translate_objvals( CHAR_DATA * ch, AREA_DATA * area, RENUMBER_AREA * r_area, bool verbose )
{
   int i, new_vnum;
   OBJ_INDEX_DATA *obj;

   for( i = area->low_o_vnum; i <= area->hi_o_vnum; i++ )
   {
      obj = get_obj_index( i );
      if( !obj )
         continue;

      if( obj->item_type == ITEM_CONTAINER )
      {
         new_vnum = find_translation( obj->value[2], r_area->r_obj );
         if( new_vnum != NOT_FOUND )
         {
            if( verbose )
               pager_printf( ch, "...    container %d; fixing objval2 (key vnum) %d -> %d\r\n", i, obj->value[2], new_vnum );
            obj->value[2] = new_vnum;
         }
         else if( verbose )
            pager_printf( ch, "...    container %d; no need to fix.\r\n", i );
      }
      else if( obj->item_type == ITEM_SWITCH || obj->item_type == ITEM_LEVER ||
               obj->item_type == ITEM_PULLCHAIN || obj->item_type == ITEM_BUTTON )
      {
         /*
          * levers might have room vnum references in their objvals 
          */
         if( IS_SET( obj->value[0], TRIG_TELEPORT )
             || IS_SET( obj->value[0], TRIG_TELEPORTALL )
             || IS_SET( obj->value[0], TRIG_TELEPORTPLUS )
             || IS_SET( obj->value[0], TRIG_RAND4 )
             || IS_SET( obj->value[0], TRIG_RAND6 ) || IS_SET( obj->value[0], TRIG_DOOR ) )
         {
            new_vnum = find_translation( obj->value[1], r_area->r_room );
            if( new_vnum != NOT_FOUND )
            {
               if( verbose )
                  pager_printf( ch, "...    lever %d: fixing source room (%d -> %d)\r\n", i, obj->value[1], new_vnum );
               obj->value[1] = new_vnum;
            }
            if( IS_SET( obj->value[0], TRIG_DOOR ) && IS_SET( obj->value[0], TRIG_PASSAGE ) )
            {
               new_vnum = find_translation( obj->value[2], r_area->r_room );
               if( new_vnum != NOT_FOUND )
               {
                  if( verbose )
                     pager_printf( ch, "...    lever %d: fixing dest room (passage) (%d -> %d)\r\n",
                                   i, obj->value[2], new_vnum );
                  obj->value[2] = new_vnum;
               }
            }
         }
      }
   }
}
示例#3
0
void do_fileio( CHAR_DATA *ch, char *argument )
{
    FILE_DATA              *filedata;
    char                    buf[MSL];
    int                     count = 0;

    pager_printf( ch,
                  "        &YFilename             &wMode      &WOpened                     &CFunction         &OLine\r\n" );
    send_to_pager
        ( "&c------------------------------------------------------------------------------------------\r\n",
          ch );
    if ( !first_filedata )
        send_to_pager( "\r\n&RCongrats, &Yyou have no &WOpen &Yfiles!\r\n", ch );

    for ( filedata = first_filedata; filedata; filedata = filedata->next ) {
        sprintf( buf, "&Y%-25.25s     &w%-1.1s       &W%-20.20s     &C%-15.15s     &O%-4.4d\r\n",
                 filedata->filename, filedata->mode, filedata->file, filedata->function,
                 filedata->line );
        count++;
        send_to_pager( buf, ch );
    }

    // *Add to the evil* //
    send_to_pager( "\r\n", ch );

    // *Make sure the count is right.* //
    if ( FilesOpen != count ) {
        send_to_pager( "&RThats Odd, the FilesOpen and count don't match!!!!", ch );
    }
    return;
}
示例#4
0
void warn_in_prog( CHAR_DATA * ch, int low, int high, const char *where, int vnum, MPROG_DATA * mprog, RENUMBER_AREA * r_area )
{
   const char *p, *start_number;
   int num;

   p = mprog->comlist;
   while( *p )
   {
      if( isdigit( *p ) )
      {
         start_number = p;
         while( isdigit( *p ) && *p )
            p++;

         char* temp = (char*) malloc((p - start_number + 1) * sizeof(char));
         memcpy(temp, start_number, p - start_number + 1);
         num = atoi( temp );
         free(temp);

         if( num >= low && num <= high )
         {
            pager_printf( ch,
                          "Warning! %s prog in %s vnum %d might contain a reference to %d.\r\n(Translation: Room %d, Obj %d, Mob %d)\r\n",
                          mprog_type_to_name( mprog->type ), where, vnum, num, find_translation( num, r_area->r_room ),
                          find_translation( num, r_area->r_obj ), find_translation( num, r_area->r_mob ) );
         }
         if( *p == '\0' )
            break;
      }
      p++;
   }
}
示例#5
0
文件: ban.c 项目: dhasenan/SmaugFUSS
/*
 * Print the bans out to the screen.  Shaddai
 */
void show_bans( CHAR_DATA * ch, int type )
{
    BAN_DATA *pban;
    int bnum;

    set_pager_color( AT_IMMORT, ch );

    switch ( type )
    {
    case BAN_SITE:
        send_to_pager( "Banned sites:\r\n", ch );
        send_to_pager( "[ #] Warn (Lv) Time                     By              For   Site\r\n", ch );
        send_to_pager( "---- ---- ---- ------------------------ --------------- ----  ---------------\r\n", ch );
        pban = first_ban;
        set_pager_color( AT_PLAIN, ch );
        for( bnum = 1; pban; pban = pban->next, bnum++ )
        {
            pager_printf( ch, "[%2d] %-4s (%2d) %-24s %-15s %4d  %c%s%c\r\n",
                          bnum, ( pban->warn ) ? "YES" : "no", pban->level,
                          pban->ban_time, pban->ban_by, pban->duration,
                          ( pban->prefix ) ? '*' : ' ', pban->name, ( pban->suffix ) ? '*' : ' ' );
        }
        return;
    case BAN_RACE:
        send_to_pager( "Banned races:\r\n", ch );
        send_to_pager( "[ #] Warn (Lv) Time                     By              For   Race\r\n", ch );
        pban = first_ban_race;
        break;
    case BAN_CLASS:
        send_to_pager( "Banned classes:\r\n", ch );
        send_to_pager( "[ #] Warn (Lv) Time                     By              For   Class\r\n", ch );
        pban = first_ban_class;
        break;
    default:
        bug( "Bad type in show_bans: %d", type );
        return;
    }
    send_to_pager( "---- ---- ---- ------------------------ --------------- ----  ---------------\r\n", ch );
    set_pager_color( AT_PLAIN, ch );
    for( bnum = 1; pban; pban = pban->next, bnum++ )
        pager_printf( ch, "[%2d] %-4s (%2d) %-24s %-15s %4d  %s\r\n", bnum,
                      ( pban->warn ) ? "YES" : "no", pban->level, pban->ban_time, pban->ban_by, pban->duration, pban->name );
    return;
}
示例#6
0
void show_colors( CHAR_DATA * ch )
{
   short count;

   send_to_pager( "&BSyntax: color [color type] [color] | default\r\n", ch );
   send_to_pager( "&BSyntax: color _reset_ (Resets all colors to default set)\r\n", ch );
   send_to_pager( "&BSyntax: color _all_ [color] (Sets all color types to [color])\r\n\r\n", ch );
   send_to_pager( "&BSyntax: color theme [name] (Sets all color types to a defined theme)\r\n\r\n", ch );

   send_to_pager( "&W********************************[ COLORS ]*********************************\r\n", ch );

   for( count = 0; count < 16; ++count )
   {
      if( ( count % 8 ) == 0 && count != 0 )
      {
         send_to_pager( "\r\n", ch );
      }
      pager_printf( ch, "%s%-10s", color_str( count, ch ), pc_displays[count] );
   }

   send_to_pager( "\r\n\r\n&W******************************[ COLOR TYPES ]******************************\r\n", ch );

   for( count = 32; count < MAX_COLORS; ++count )
   {
      if( ( count % 8 ) == 0 && count != 32 )
      {
         send_to_pager( "\r\n", ch );
      }
      pager_printf( ch, "%s%-10s%s", color_str( count, ch ), pc_displays[count], ANSI_RESET );
   }
   send_to_pager( "\r\n\r\n", ch );
   send_to_pager( "&YAvailable colors are:\r\n", ch );

   for( count = 0; valid_color[count][0] != '\0'; ++count )
   {
      if( ( count % 8 ) == 0 && count != 0 )
         send_to_pager( "\r\n", ch );

      pager_printf( ch, "%s%-10s", color_str( AT_PLAIN, ch ), valid_color[count] );
   }
   send_to_pager( "\r\n", ch );
   show_colorthemes( ch );
   return;
}
示例#7
0
void translate_exits( CHAR_DATA * ch, AREA_DATA * area, RENUMBER_AREA * r_area, bool verbose )
{
   int i, new_vnum;
   EXIT_DATA *pexit, *rv_exit;
   ROOM_INDEX_DATA *room;
   int old_vnum;

   for( i = area->low_r_vnum; i <= area->hi_r_vnum; i++ )
   {
      room = get_room_index( i );
      if( !room )
         continue;
      for( pexit = room->first_exit; pexit; pexit = pexit->next )
      {
         /*
          * translate the exit destination, if it was moved 
          */
         new_vnum = find_translation( pexit->vnum, r_area->r_room );
         if( new_vnum != NOT_FOUND )
            pexit->vnum = new_vnum;
         /*
          * if this room was moved 
          */
         if( pexit->rvnum != i )
         {
            old_vnum = pexit->rvnum;
            pexit->rvnum = i;
            /*
             * all reverse exits in other areas will be wrong 
             */
            rv_exit = get_exit_to( pexit->to_room, rev_dir[pexit->vdir], old_vnum );
            if( rv_exit && pexit->to_room->area != area )
            {
               if( rv_exit->vnum != i )
               {
                  pager_printf( ch, "...    fixing reverse exit in area %s.\r\n", pexit->to_room->area->filename );
                  rv_exit->vnum = i;
               }
            }
         }

         /*
          * translate the key 
          */
         if( pexit->key != -1 )
         {
            new_vnum = find_translation( pexit->key, r_area->r_obj );
            if( new_vnum == NOT_FOUND )
               continue;
            pexit->key = new_vnum;
         }
      }
   }
}
示例#8
0
文件: player.c 项目: Igdra/smaugfuss
/* 1997, Blodkai */
void do_remains( CHAR_DATA* ch, const char* argument)
{
   char buf[MAX_STRING_LENGTH];
   OBJ_DATA *obj;
   bool found = FALSE;

   if( IS_NPC( ch ) )
      return;

   set_char_color( AT_MAGIC, ch );
   if( !ch->pcdata->deity )
   {
      send_to_pager( "You have no deity from which to seek such assistance...\r\n", ch );
      return;
   }

   if( ch->pcdata->favor < ch->level * 2 )
   {
      send_to_pager( "Your favor is insufficient for such assistance...\r\n", ch );
      return;
   }

   pager_printf( ch, "%s appears in a vision, revealing that your remains... ", ch->pcdata->deity->name );
   snprintf( buf, MAX_STRING_LENGTH, "the corpse of %s", ch->name );
   for( obj = first_object; obj; obj = obj->next )
   {
      if( obj->in_room && !str_cmp( buf, obj->short_descr ) && ( obj->pIndexData->vnum == OBJ_VNUM_CORPSE_PC ) )
      {
         found = TRUE;
         pager_printf( ch, "\r\n  - at %s will endure for %d ticks", obj->in_room->name, obj->timer );
      }
   }
   if( !found )
      send_to_pager( " no longer exist.\r\n", ch );
   else
   {
      send_to_pager( "\r\n", ch );
      ch->pcdata->favor -= ch->level * 2;
   }
   return;
}
示例#9
0
void do_holidays( CHAR_DATA* ch, const char* argument)
{
   HOLIDAY_DATA *day;

   send_to_pager( "&RHoliday		       &YMonth	        &GDay\r\n", ch );
   send_to_pager( "&g----------------------+----------------+---------------\r\n", ch );

   for( day = first_holiday; day; day = day->next )
      pager_printf( ch, "&G%-21s	&g%-11s	%-2d\r\n", day->name, month_name[day->month - 1], day->day );

   return;
}
示例#10
0
void show_colorthemes( CHAR_DATA * ch )
{
   DIR *dp;
   struct dirent *dentry;
   int count = 0, col = 0;

   send_to_pager( "&YThe following themes are available:\r\n", ch );

   dp = opendir( COLOR_DIR );
   dentry = readdir( dp );
   while( dentry )
   {
      /*
       * Added by Tarl 3 Dec 02 because we are now using CVS 
       */
      if( !str_cmp( dentry->d_name, "CVS" ) )
      {
         dentry = readdir( dp );
         continue;
      }
      if( dentry->d_name[0] != '.' )
      {
         ++count;
         pager_printf( ch, "%s%-15.15s", color_str( AT_PLAIN, ch ), dentry->d_name );
         if( ++col % 6 == 0 )
            send_to_pager( "\r\n", ch );
      }
      dentry = readdir( dp );
   }
   closedir( dp );

   if( count == 0 )
      send_to_pager( "No themes defined yet.\r\n", ch );

   if( col % 6 != 0 )
      send_to_pager( "\r\n", ch );
   return;
}
示例#11
0
文件: player.c 项目: Igdra/smaugfuss
/*
 * New score command by Haus
 */
void do_score( CHAR_DATA* ch, const char* argument )
{
   char buf[MAX_STRING_LENGTH];
   AFFECT_DATA *paf;
   int iLang;
   /*const char *suf;
   short day;

   day = ch->pcdata->day + 1;

   if( day > 4 && day < 20 )
      suf = "th";
   else if( day % 10 == 1 )
      suf = "st";
   else if( day % 10 == 2 )
      suf = "nd";
   else if( day % 10 == 3 )
      suf = "rd";
   else
      suf = "th";
   * - Uncomment this if you want Birthdays dispayed on score for players - Kayle 1/22/08
   */

   set_pager_color( AT_SCORE, ch );

   pager_printf( ch, "\r\nScore for %s%s.\r\n", ch->name, IS_NPC(ch) ? "" : ch->pcdata->title );
   if( get_trust( ch ) != ch->level )
      pager_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) );

   send_to_pager( "----------------------------------------------------------------------------\r\n", ch );

   /*if( time_info.day == ch->pcdata->day && time_info.month == ch->pcdata->month )
      send_to_char( "Today is your birthday!\r\n", ch );
   else
      ch_printf( ch, "Your birthday is: Day of %s, %d%s day in the Month of %s, in the year %d.\r\n",
                 day_name[ch->pcdata->day % sysdata.daysperweek], day, suf, month_name[ch->pcdata->month], ch->pcdata->year );
   send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
   * - Uncomment this if you want players to see their birthday's on score. - Kayle 1/22/08
   */

   pager_printf( ch, "LEVEL: %-3d         Race : %-10.10s        Played: %ld hours\r\n",
                 ch->level, capitalize( get_race( ch ) ), ( long int )GET_TIME_PLAYED( ch ) );

   pager_printf( ch, "YEARS: %-6d      Class: %-11.11s       Log In: %s\r",
                 calculate_age( ch ), capitalize( get_class( ch ) ), ctime( &( ch->logon ) ) );

   if( ch->level >= 15 || IS_PKILL( ch ) )
   {
      pager_printf( ch, "STR  : %2.2d(%2.2d)    HitRoll: %-4d              Saved:  %s\r",
                    get_curr_str( ch ), ch->perm_str, GET_HITROLL( ch ),
                    ch->save_time ? ctime( &( ch->save_time ) ) : "no save this session\n" );

      pager_printf( ch, "INT  : %2.2d(%2.2d)    DamRoll: %-4d              Time:   %s\r",
                    get_curr_int( ch ), ch->perm_int, GET_DAMROLL( ch ), ctime( &current_time ) );
   }
   else
   {
      pager_printf( ch, "STR  : %2.2d(%2.2d)                               Saved:  %s\r",
                    get_curr_str( ch ), ch->perm_str, ch->save_time ? ctime( &( ch->save_time ) ) : "no\n" );

      pager_printf( ch, "INT  : %2.2d(%2.2d)                               Time:   %s\r",
                    get_curr_int( ch ), ch->perm_int, ctime( &current_time ) );
   }

   if( GET_AC( ch ) >= 101 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the rags of a beggar" );
   else if( GET_AC( ch ) >= 80 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "improper for adventure" );
   else if( GET_AC( ch ) >= 55 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "shabby and threadbare" );
   else if( GET_AC( ch ) >= 40 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "of poor quality" );
   else if( GET_AC( ch ) >= 20 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "scant protection" );
   else if( GET_AC( ch ) >= 10 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "that of a knave" );
   else if( GET_AC( ch ) >= 0 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "moderately crafted" );
   else if( GET_AC( ch ) >= -10 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "well crafted" );
   else if( GET_AC( ch ) >= -20 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of squires" );
   else if( GET_AC( ch ) >= -40 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "excellently crafted" );
   else if( GET_AC( ch ) >= -60 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of knights" );
   else if( GET_AC( ch ) >= -80 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of barons" );
   else if( GET_AC( ch ) >= -100 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of dukes" );
   else if( GET_AC( ch ) >= -200 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of emperors" );
   else
      snprintf( buf, MAX_STRING_LENGTH, "%s", "that of an avatar" );
   if( ch->level > 24 )
      pager_printf( ch, "WIS  : %2.2d(%2.2d)      Armor: %4.4d, %s\r\n",
                    get_curr_wis( ch ), ch->perm_wis, GET_AC( ch ), buf );
   else
      pager_printf( ch, "WIS  : %2.2d(%2.2d)      Armor: %s \r\n", get_curr_wis( ch ), ch->perm_wis, buf );

   if( ch->alignment > 900 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "devout" );
   else if( ch->alignment > 700 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "noble" );
   else if( ch->alignment > 350 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "honorable" );
   else if( ch->alignment > 100 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "worthy" );
   else if( ch->alignment > -100 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "neutral" );
   else if( ch->alignment > -350 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "base" );
   else if( ch->alignment > -700 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "evil" );
   else if( ch->alignment > -900 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "ignoble" );
   else
      snprintf( buf, MAX_STRING_LENGTH, "%s", "fiendish" );
   if( ch->level < 10 )
      pager_printf( ch, "DEX  : %2.2d(%2.2d)      Align: %-20.20s    Items: %5.5d   (max %5.5d)\r\n",
                    get_curr_dex( ch ), ch->perm_dex, buf, ch->carry_number, can_carry_n( ch ) );
   else
      pager_printf( ch, "DEX  : %2.2d(%2.2d)      Align: %+4.4d, %-14.14s   Items: %5.5d   (max %5.5d)\r\n",
                    get_curr_dex( ch ), ch->perm_dex, ch->alignment, buf, ch->carry_number, can_carry_n( ch ) );

   switch ( ch->position )
   {
      case POS_DEAD:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "slowly decomposing" );
         break;
      case POS_MORTAL:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "mortally wounded" );
         break;
      case POS_INCAP:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "incapacitated" );
         break;
      case POS_STUNNED:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "stunned" );
         break;
      case POS_SLEEPING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "sleeping" );
         break;
      case POS_RESTING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "resting" );
         break;
      case POS_STANDING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "standing" );
         break;
      case POS_FIGHTING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting" );
         break;
      case POS_EVASIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (evasive)" );   /* Fighting style support -haus */
         break;
      case POS_DEFENSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (defensive)" );
         break;
      case POS_AGGRESSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (aggressive)" );
         break;
      case POS_BERSERK:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (berserk)" );
         break;
      case POS_MOUNTED:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "mounted" );
         break;
      case POS_SITTING:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "sitting" );
         break;
   }
   pager_printf( ch, "CON  : %2.2d(%2.2d)      Pos'n: %-21.21s  Weight: %5.5d (max %7.7d)\r\n",
                 get_curr_con( ch ), ch->perm_con, buf, ch->carry_weight, can_carry_w( ch ) );


   /*
    * Fighting style support -haus
    */
   pager_printf( ch, "CHA  : %2.2d(%2.2d)      Wimpy: %-5d      ", get_curr_cha( ch ), ch->perm_cha, ch->wimpy );

   switch ( ch->style )
   {
      case STYLE_EVASIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "evasive" );
         break;
      case STYLE_DEFENSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "defensive" );
         break;
      case STYLE_AGGRESSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "aggressive" );
         break;
      case STYLE_BERSERK:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "berserk" );
         break;
      default:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "standard" );
         break;
   }
   pager_printf( ch, "Style: %-10.10s\r\n", buf );

   pager_printf( ch, "LCK  : %2.2d(%2.2d) \r\n", get_curr_lck( ch ), ch->perm_lck );

   pager_printf( ch, "Glory: %4.4d(%4.4d) \r\n", ch->pcdata->quest_curr, ch->pcdata->quest_accum );

   pager_printf( ch, "PRACT: %3.3d         Hitpoints: %-5d of %5d   Pager: (%c) %3d    AutoExit(%c)\r\n",
                 ch->practice, ch->hit, ch->max_hit,
                 IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? 'X' : ' ',
                 ch->pcdata->pagerlen, xIS_SET( ch->act, PLR_AUTOEXIT ) ? 'X' : ' ' );

   if( IS_VAMPIRE( ch ) )
      pager_printf( ch, "XP   : %-9d       Blood: %-5d of %5d   MKills:  %-5.5d    AutoLoot(%c)\r\n",
                    ch->exp, ch->pcdata->condition[COND_BLOODTHIRST], 10 + ch->level, ch->pcdata->mkills,
                    xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' );
   else if( ch->Class == CLASS_WARRIOR )
      pager_printf( ch, "XP   : %-9d                               MKills:  %-5.5d    AutoLoot(%c)\r\n",
                    ch->exp, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' );
   else
      pager_printf( ch, "XP   : %-9d        Mana: %-5d of %5d   MKills:  %-5.5d    AutoLoot(%c)\r\n",
                    ch->exp, ch->mana, ch->max_mana, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' );

   pager_printf( ch, "GOLD : %-13s    Move: %-5d of %5d   Mdeaths: %-5.5d    AutoSac (%c)\r\n",
                 num_punct( ch->gold ), ch->move, ch->max_move, ch->pcdata->mdeaths, xIS_SET( ch->act,
                                                                                              PLR_AUTOSAC ) ? 'X' : ' ' );

   if( !IS_NPC( ch ) && ch->pcdata->condition[COND_DRUNK] > 10 )
      send_to_pager( "You are drunk.\r\n", ch );
   if( !IS_NPC( ch ) && ch->pcdata->condition[COND_THIRST] == 0 )
      send_to_pager( "You are in danger of dehydrating.\r\n", ch );
   if( !IS_NPC( ch ) && ch->pcdata->condition[COND_FULL] == 0 )
      send_to_pager( "You are starving to death.\r\n", ch );
   if( ch->position != POS_SLEEPING )
      switch ( ch->mental_state / 10 )
      {
         default:
            send_to_pager( "You're completely messed up!\r\n", ch );
            break;
         case -10:
            send_to_pager( "You're barely conscious.\r\n", ch );
            break;
         case -9:
            send_to_pager( "You can barely keep your eyes open.\r\n", ch );
            break;
         case -8:
            send_to_pager( "You're extremely drowsy.\r\n", ch );
            break;
         case -7:
            send_to_pager( "You feel very unmotivated.\r\n", ch );
            break;
         case -6:
            send_to_pager( "You feel sedated.\r\n", ch );
            break;
         case -5:
            send_to_pager( "You feel sleepy.\r\n", ch );
            break;
         case -4:
            send_to_pager( "You feel tired.\r\n", ch );
            break;
         case -3:
            send_to_pager( "You could use a rest.\r\n", ch );
            break;
         case -2:
            send_to_pager( "You feel a little under the weather.\r\n", ch );
            break;
         case -1:
            send_to_pager( "You feel fine.\r\n", ch );
            break;
         case 0:
            send_to_pager( "You feel great.\r\n", ch );
            break;
         case 1:
            send_to_pager( "You feel energetic.\r\n", ch );
            break;
         case 2:
            send_to_pager( "Your mind is racing.\r\n", ch );
            break;
         case 3:
            send_to_pager( "You can't think straight.\r\n", ch );
            break;
         case 4:
            send_to_pager( "Your mind is going 100 miles an hour.\r\n", ch );
            break;
         case 5:
            send_to_pager( "You're high as a kite.\r\n", ch );
            break;
         case 6:
            send_to_pager( "Your mind and body are slipping apart.\r\n", ch );
            break;
         case 7:
            send_to_pager( "Reality is slipping away.\r\n", ch );
            break;
         case 8:
            send_to_pager( "You have no idea what is real, and what is not.\r\n", ch );
            break;
         case 9:
            send_to_pager( "You feel immortal.\r\n", ch );
            break;
         case 10:
            send_to_pager( "You are a Supreme Entity.\r\n", ch );
            break;
      }
   else if( ch->mental_state > 45 )
      send_to_pager( "Your sleep is filled with strange and vivid dreams.\r\n", ch );
   else if( ch->mental_state > 25 )
      send_to_pager( "Your sleep is uneasy.\r\n", ch );
   else if( ch->mental_state < -35 )
      send_to_pager( "You are deep in a much needed sleep.\r\n", ch );
   else if( ch->mental_state < -25 )
      send_to_pager( "You are in deep slumber.\r\n", ch );
   send_to_pager( "Languages: ", ch );
   for( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ )
      if( knows_language( ch, lang_array[iLang], ch ) || ( IS_NPC( ch ) && ch->speaks == 0 ) )
      {
         if( lang_array[iLang] & ch->speaking || ( IS_NPC( ch ) && !ch->speaking ) )
            set_pager_color( AT_RED, ch );
         send_to_pager( lang_names[iLang], ch );
         send_to_pager( " ", ch );
         set_pager_color( AT_SCORE, ch );
      }
   send_to_pager( "\r\n", ch );

   if( ch->pcdata->bestowments && ch->pcdata->bestowments[0] != '\0' )
      pager_printf( ch, "You are bestowed with the command(s): %s.\r\n", ch->pcdata->bestowments );

   if( ch->morph && ch->morph->morph )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      if( IS_IMMORTAL( ch ) )
         pager_printf( ch, "Morphed as (%d) %s with a timer of %d.\r\n",
                       ch->morph->morph->vnum, ch->morph->morph->short_desc, ch->morph->timer );
      else
         pager_printf( ch, "You are morphed into a %s.\r\n", ch->morph->morph->short_desc );
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
   }
   if( CAN_PKILL( ch ) )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      pager_printf( ch, "PKILL DATA:  Pkills (%3.3d)     Illegal Pkills (%3.3d)     Pdeaths (%3.3d)\r\n",
                    ch->pcdata->pkills, ch->pcdata->illegal_pk, ch->pcdata->pdeaths );
   }
   if( ch->pcdata->clan && ch->pcdata->clan->clan_type != CLAN_ORDER && ch->pcdata->clan->clan_type != CLAN_GUILD )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      pager_printf( ch, "CLAN STATS:  %-14.14s  Clan AvPkills : %-5d  Clan NonAvpkills : %-5d\r\n",
                    ch->pcdata->clan->name, ch->pcdata->clan->pkills[6],
                    ( ch->pcdata->clan->pkills[1] + ch->pcdata->clan->pkills[2] +
                      ch->pcdata->clan->pkills[3] + ch->pcdata->clan->pkills[4] + ch->pcdata->clan->pkills[5] ) );
      pager_printf( ch, "                             Clan AvPdeaths: %-5d  Clan NonAvpdeaths: %-5d\r\n",
                    ch->pcdata->clan->pdeaths[6],
                    ( ch->pcdata->clan->pdeaths[1] + ch->pcdata->clan->pdeaths[2] +
                      ch->pcdata->clan->pdeaths[3] + ch->pcdata->clan->pdeaths[4] + ch->pcdata->clan->pdeaths[5] ) );
   }
   if( ch->pcdata->deity )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      if( ch->pcdata->favor > 2250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "loved" );
      else if( ch->pcdata->favor > 2000 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "cherished" );
      else if( ch->pcdata->favor > 1750 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "honored" );
      else if( ch->pcdata->favor > 1500 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "praised" );
      else if( ch->pcdata->favor > 1250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "favored" );
      else if( ch->pcdata->favor > 1000 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "respected" );
      else if( ch->pcdata->favor > 750 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "liked" );
      else if( ch->pcdata->favor > 250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "tolerated" );
      else if( ch->pcdata->favor > -250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "ignored" );
      else if( ch->pcdata->favor > -750 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "shunned" );
      else if( ch->pcdata->favor > -1000 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "disliked" );
      else if( ch->pcdata->favor > -1250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "dishonored" );
      else if( ch->pcdata->favor > -1500 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "disowned" );
      else if( ch->pcdata->favor > -1750 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "abandoned" );
      else if( ch->pcdata->favor > -2000 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "despised" );
      else if( ch->pcdata->favor > -2250 )
         snprintf( buf, MAX_STRING_LENGTH, "%s", "hated" );
      else
         snprintf( buf, MAX_STRING_LENGTH, "%s", "damned" );
      pager_printf( ch, "Deity:  %-20s  Favor: %s\r\n", ch->pcdata->deity->name, buf );
   }
   if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_ORDER )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      pager_printf( ch, "Order:  %-20s  Order Mkills:  %-6d   Order MDeaths:  %-6d\r\n",
                    ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths );
   }
   if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_GUILD )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      pager_printf( ch, "Guild:  %-20s  Guild Mkills:  %-6d   Guild MDeaths:  %-6d\r\n",
                    ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths );
   }
   if( IS_IMMORTAL( ch ) )
   {
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );

      pager_printf( ch, "IMMORTAL DATA:  Wizinvis [%s]  Wizlevel (%d)\r\n",
                    xIS_SET( ch->act, PLR_WIZINVIS ) ? "X" : " ", ch->pcdata->wizinvis );

      pager_printf( ch, "Bamfin:  %s %s\r\n", ch->name, ( ch->pcdata->bamfin[0] != '\0' )
                    ? ch->pcdata->bamfin : "appears in a swirling mist." );
      pager_printf( ch, "Bamfout: %s %s\r\n", ch->name, ( ch->pcdata->bamfout[0] != '\0' )
                    ? ch->pcdata->bamfout : "leaves in a swirling mist." );


      /*
       * Area Loaded info - Scryn 8/11
       */
      if( ch->pcdata->area )
      {
         pager_printf( ch, "Vnums:   Room (%-5.5d - %-5.5d)   Object (%-5.5d - %-5.5d)   Mob (%-5.5d - %-5.5d)\r\n",
                       ch->pcdata->area->low_r_vnum, ch->pcdata->area->hi_r_vnum,
                       ch->pcdata->area->low_o_vnum, ch->pcdata->area->hi_o_vnum,
                       ch->pcdata->area->low_m_vnum, ch->pcdata->area->hi_m_vnum );
         pager_printf( ch, "Area Loaded [%s]\r\n", ( IS_SET( ch->pcdata->area->status, AREA_LOADED ) ) ? "yes" : "no" );
      }
   }
   if( ch->first_affect )
   {
      int i;
      SKILLTYPE *sktmp;

      i = 0;
      send_to_pager( "----------------------------------------------------------------------------\r\n", ch );
      send_to_pager( "AFFECT DATA:                            ", ch );
      for( paf = ch->first_affect; paf; paf = paf->next )
      {
         if( ( sktmp = get_skilltype( paf->type ) ) == NULL )
            continue;
         if( ch->level < 20 )
         {
            pager_printf( ch, "[%-34.34s]    ", sktmp->name );
            if( i == 0 )
               i = 2;
            if( ( ++i % 3 ) == 0 )
               send_to_pager( "\r\n", ch );
         }
         if( ch->level >= 20 )
         {
            if( paf->modifier == 0 )
               pager_printf( ch, "[%-24.24s;%5d rds]    ", sktmp->name, paf->duration );
            else if( paf->modifier > 999 )
               pager_printf( ch, "[%-15.15s; %7.7s;%5d rds]    ",
                             sktmp->name, tiny_affect_loc_name( paf->location ), paf->duration );
            else
               pager_printf( ch, "[%-11.11s;%+-3.3d %7.7s;%5d rds]    ",
                             sktmp->name, paf->modifier, tiny_affect_loc_name( paf->location ), paf->duration );
            if( i == 0 )
               i = 1;
            if( ( ++i % 2 ) == 0 )
               send_to_pager( "\r\n", ch );
         }
      }
   }
   send_to_pager( "\r\n", ch );
   return;
}
示例#12
0
文件: boards.c 项目: ccubed/SWRCustom
void do_note( CHAR_DATA * ch, char *arg_passed, bool IS_MAIL )
{
  char buf[MAX_STRING_LENGTH];
  char arg[MAX_INPUT_LENGTH];
  NOTE_DATA *pnote = NULL;
  BOARD_DATA *board = NULL;
  int vnum = 0;
  int anum = 0;
  int first_list = 0;
  OBJ_DATA *paper = NULL, *tmpobj = NULL;
  EXTRA_DESCR_DATA *ed = NULL;
  char notebuf[MAX_STRING_LENGTH];
  char short_desc_buf[MAX_STRING_LENGTH];
  char long_desc_buf[MAX_STRING_LENGTH];
  char keyword_buf[MAX_STRING_LENGTH];
  bool mfound = FALSE;
  bool wasfound = FALSE;

  if( IS_NPC( ch ) )
    return;

  if( !ch->desc )
  {
    bug( "do_note: no descriptor", 0 );
    return;
  }

  switch ( ch->substate )
  {
    default:
      break;
    case SUB_WRITING_NOTE:
      if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL
	  || paper->item_type != ITEM_PAPER )
      {
	bug( "do_note: player not holding paper", 0 );
	stop_editing( ch );
	return;
      }
      ed = ( EXTRA_DESCR_DATA * ) ch->dest_buf;
      STRFREE( ed->description );
      ed->description = copy_buffer( ch );
      stop_editing( ch );
      return;
  }

  set_char_color( AT_NOTE, ch );
  arg_passed = one_argument( arg_passed, arg );
  smash_tilde( arg_passed );

  if( !str_cmp( arg, "list" ) )
  {
    board = find_board( ch );
    if( !board )
    {
      send_to_char( "There is no board here to look at.\r\n", ch );
      return;
    }
    if( !can_read( ch, board ) )
    {
      send_to_char
	( "You cannot make any sense of the cryptic scrawl on this board...\r\n",
	  ch );
      return;
    }

    first_list = atoi( arg_passed );
    if( first_list )
    {
      if( IS_MAIL )
      {
	send_to_char
	  ( "You cannot use a list number (at this time) with mail.\r\n",
	    ch );
	return;
      }

      if( first_list < 1 )
      {
	send_to_char( "You can't read a message before 1!\r\n", ch );
	return;
      }
    }


    if( !IS_MAIL )
    {
      vnum = 0;
      set_pager_color( AT_NOTE, ch );
      for( pnote = board->first_note; pnote; pnote = pnote->next )
      {
	vnum++;
	if( ( first_list && vnum >= first_list ) || !first_list )
	  pager_printf( ch, "%2d%c %-12s%c %-12s %s\r\n",
	      vnum,
	      is_note_to( ch, pnote ) ? ')' : '}',
	      pnote->sender,
	      ( pnote->voting !=
		VOTE_NONE ) ? ( pnote->voting ==
		  VOTE_OPEN ? 'V' : 'C' ) : ':',
	      pnote->to_list, pnote->subject );
      }
      act( AT_ACTION, "$n glances over the messages.", ch, NULL, NULL,
	  TO_ROOM );
      return;
    }
    else
    {
      vnum = 0;


      if( IS_MAIL )		/* SB Mail check for Brit */
      {
	for( pnote = board->first_note; pnote; pnote = pnote->next )
	  if( is_note_to( ch, pnote ) )
	    mfound = TRUE;

	if( !mfound && !IS_IMMORTAL( ch ) )
	{
	  ch_printf( ch, "You have no mail.\r\n" );
	  return;
	}
      }

      for( pnote = board->first_note; pnote; pnote = pnote->next )
	if( is_note_to( ch, pnote ) || IS_IMMORTAL( ch ) )
	  ch_printf( ch, "%2d%c %s: %s\r\n",
	      ++vnum,
	      is_note_to( ch, pnote ) ? '-' : '}',
	      pnote->sender, pnote->subject );
      return;
    }
  }

  if( !str_cmp( arg, "read" ) )
  {
    bool fAll = FALSE;

    board = find_board( ch );
    if( !board )
    {
      send_to_char( "There is no board here to look at.\r\n", ch );
      return;
    }
    if( !can_read( ch, board ) )
    {
      send_to_char
	( "You cannot make any sense of the cryptic scrawl on this board...\r\n",
	  ch );
      return;
    }

    if( !str_cmp( arg_passed, "all" ) )
    {
      fAll = TRUE;
      anum = 0;
    }
    else if( is_number( arg_passed ) )
    {
      fAll = FALSE;
      anum = atoi( arg_passed );
    }
    else
    {
      send_to_char( "Note read which number?\r\n", ch );
      return;
    }

    set_pager_color( AT_NOTE, ch );
    if( !IS_MAIL )
    {
      vnum = 0;
      for( pnote = board->first_note; pnote; pnote = pnote->next )
      {
	vnum++;
	if( vnum == anum || fAll )
	{
	  wasfound = TRUE;
	  pager_printf( ch, "[%3d] %s: %s\r\n%s\r\nTo: %s\r\n%s",
	      vnum,
	      pnote->sender,
	      pnote->subject,
	      pnote->date, pnote->to_list, pnote->text );

	  if( pnote->yesvotes[0] != '\0' || pnote->novotes[0] != '\0'
	      || pnote->abstentions[0] != '\0' )
	  {
	    send_to_pager
	      ( "------------------------------------------------------------\r\n",
		ch );
	    pager_printf( ch,
		"Votes:\r\nYes:     %s\r\nNo:      %s\r\nAbstain: %s\r\n",
		pnote->yesvotes, pnote->novotes,
		pnote->abstentions );
	  }
	  act( AT_ACTION, "$n reads a message.", ch, NULL, NULL,
	      TO_ROOM );
	}
      }
      if( !wasfound )
	ch_printf( ch, "No such message: %d\r\n", anum );
      return;
    }
    else
    {
      vnum = 0;
      for( pnote = board->first_note; pnote; pnote = pnote->next )
      {
	if( is_note_to( ch, pnote ) || IS_IMMORTAL( ch ) )
	{
	  vnum++;
	  if( vnum == anum || fAll )
	  {
	    wasfound = TRUE;
	    pager_printf( ch, "[%3d] %s: %s\r\n%s\r\nTo: %s\r\n%s",
		vnum,
		pnote->sender,
		pnote->subject,
		pnote->date,
		pnote->to_list, pnote->text );
	  }
	}
      }
      if( !wasfound )
	ch_printf( ch, "No such message: %d\r\n", anum );
      return;
    }
  }

  /* Voting added by Narn, June '96 */
  if( !str_cmp( arg, "vote" ) )
  {
    char arg2[MAX_INPUT_LENGTH];
    arg_passed = one_argument( arg_passed, arg2 );

    board = find_board( ch );
    if( !board )
    {
      send_to_char( "There is no bulletin board here.\r\n", ch );
      return;
    }
    if( !can_read( ch, board ) )
    {
      send_to_char( "You cannot vote on this board.\r\n", ch );
      return;
    }

    if( is_number( arg2 ) )
      anum = atoi( arg2 );
    else
    {
      send_to_char( "Note vote which number?\r\n", ch );
      return;
    }

    vnum = 1;
    for( pnote = board->first_note; pnote && vnum < anum;
	pnote = pnote->next )
      vnum++;
    if( !pnote )
    {
      send_to_char( "No such note.\r\n", ch );
      return;
    }

    /* Options: open close yes no abstain */
    /* If you're the author of the note and can read the board you can open 
       and close voting, if you can read it and voting is open you can vote.
       */
    if( !str_cmp( arg_passed, "open" ) )
    {
      if( str_cmp( ch->name, pnote->sender ) )
      {
	send_to_char( "You are not the author of this message.\r\n",
	    ch );
	return;
      }
      pnote->voting = VOTE_OPEN;
      act( AT_ACTION, "$n opens voting on a note.", ch, NULL, NULL,
	  TO_ROOM );
      send_to_char( "Voting opened.\r\n", ch );
      write_board( board );
      return;
    }
    if( !str_cmp( arg_passed, "close" ) )
    {
      if( str_cmp( ch->name, pnote->sender ) )
      {
	send_to_char( "You are not the author of this message.\r\n",
	    ch );
	return;
      }
      pnote->voting = VOTE_CLOSED;
      act( AT_ACTION, "$n closes voting on a note.", ch, NULL, NULL,
	  TO_ROOM );
      send_to_char( "Voting closed.\r\n", ch );
      write_board( board );
      return;
    }

    /* Make sure the note is open for voting before going on. */
    if( pnote->voting != VOTE_OPEN )
    {
      send_to_char( "Voting is not open on this note.\r\n", ch );
      return;
    }

    /* Can only vote once on a note. */
    sprintf( buf, "%s %s %s",
	pnote->yesvotes, pnote->novotes, pnote->abstentions );
    if( is_name( ch->name, buf ) )
    {
      send_to_char( "You have already voted on this note.\r\n", ch );
      return;
    }
    if( !str_cmp( arg_passed, "yes" ) )
    {
      sprintf( buf, "%s %s", pnote->yesvotes, ch->name );
      DISPOSE( pnote->yesvotes );
      pnote->yesvotes = str_dup( buf );
      act( AT_ACTION, "$n votes on a note.", ch, NULL, NULL, TO_ROOM );
      send_to_char( "Ok.\r\n", ch );
      write_board( board );
      return;
    }
    if( !str_cmp( arg_passed, "no" ) )
    {
      sprintf( buf, "%s %s", pnote->novotes, ch->name );
      DISPOSE( pnote->novotes );
      pnote->novotes = str_dup( buf );
      act( AT_ACTION, "$n votes on a note.", ch, NULL, NULL, TO_ROOM );
      send_to_char( "Ok.\r\n", ch );
      write_board( board );
      return;
    }
    if( !str_cmp( arg_passed, "abstain" ) )
    {
      sprintf( buf, "%s %s", pnote->abstentions, ch->name );
      DISPOSE( pnote->abstentions );
      pnote->abstentions = str_dup( buf );
      act( AT_ACTION, "$n votes on a note.", ch, NULL, NULL, TO_ROOM );
      send_to_char( "Ok.\r\n", ch );
      write_board( board );
      return;
    }
    do_note( ch, STRLIT_EMPTY, FALSE );
  }
  if( !str_cmp( arg, "write" ) )
  {
    if( ch->substate == SUB_RESTRICTED )
    {
      send_to_char
	( "You cannot write a note from within another command.\r\n",
	  ch );
      return;
    }
    if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL
	|| paper->item_type != ITEM_PAPER )
    {
      paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) );
      if( ( tmpobj = get_eq_char( ch, WEAR_HOLD ) ) != NULL )
	unequip_char( ch, tmpobj );
      paper = obj_to_char( paper, ch );
      equip_char( ch, paper, WEAR_HOLD );
      act( AT_MAGIC, "$n grabs a message disk to record a note.",
	  ch, NULL, NULL, TO_ROOM );
      act( AT_MAGIC, "You get a message disk to record your note.",
	  ch, NULL, NULL, TO_CHAR );
    }
    if( paper->value[0] < 2 )
    {
      paper->value[0] = 1;
      ed = SetOExtra( paper, "_text_" );
      ch->substate = SUB_WRITING_NOTE;
      ch->dest_buf = ed;
      start_editing( ch, ed->description );
      return;
    }
    else
    {
      send_to_char( "You cannot modify this message.\r\n", ch );
      return;
    }
  }

  if( !str_cmp( arg, "subject" ) )
  {
    if( !arg_passed || arg_passed[0] == '\0' )
    {
      send_to_char( "What do you wish the subject to be?\r\n", ch );
      return;
    }
    if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL
	|| paper->item_type != ITEM_PAPER )
    {
      paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) );
      if( ( tmpobj = get_eq_char( ch, WEAR_HOLD ) ) != NULL )
	unequip_char( ch, tmpobj );
      paper = obj_to_char( paper, ch );
      equip_char( ch, paper, WEAR_HOLD );
      act( AT_MAGIC, "$n grabs a message disk.",
	  ch, NULL, NULL, TO_ROOM );
      act( AT_MAGIC, "You get a message disk to record your note.",
	  ch, NULL, NULL, TO_CHAR );
    }
    if( paper->value[1] > 1 )
    {
      send_to_char( "You cannot modify this message.\r\n", ch );
      return;
    }
    else
    {
      paper->value[1] = 1;
      ed = SetOExtra( paper, "_subject_" );
      STRFREE( ed->description );
      ed->description = STRALLOC( arg_passed );
      send_to_char( "Ok.\r\n", ch );
      return;
    }
  }

  if( !str_cmp( arg, "to" ) )
  {
    struct stat fst;
    char fname[1024];
    if( !arg_passed || arg_passed[0] == '\0' )
    {
      send_to_char( "Please specify an addressee.\r\n", ch );
      return;
    }
    if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL
	|| paper->item_type != ITEM_PAPER )
    {
      paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) );
      if( ( tmpobj = get_eq_char( ch, WEAR_HOLD ) ) != NULL )
	unequip_char( ch, tmpobj );
      paper = obj_to_char( paper, ch );
      equip_char( ch, paper, WEAR_HOLD );
      act( AT_MAGIC, "$n gets a message disk to record a note.",
	  ch, NULL, NULL, TO_ROOM );
      act( AT_MAGIC, "You grab a message disk to record your note.",
	  ch, NULL, NULL, TO_CHAR );
    }

    if( paper->value[2] > 1 )
    {
      send_to_char( "You cannot modify this message.\r\n", ch );
      return;
    }

    arg_passed[0] = UPPER( arg_passed[0] );

    sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower( ( int ) arg_passed[0] ),
	capitalize( arg_passed ) );

    if( !IS_MAIL || stat( fname, &fst ) != -1
	|| !str_cmp( arg_passed, "all" ) )
    {
      paper->value[2] = 1;
      ed = SetOExtra( paper, "_to_" );
      STRFREE( ed->description );
      ed->description = STRALLOC( arg_passed );
      send_to_char( "Ok.\r\n", ch );
      return;
    }
    else
    {
      send_to_char( "No player exists by that name.\r\n", ch );
      return;
    }

  }

  if( !str_cmp( arg, "show" ) )
  {
    const char *subject = "";
    const char *to_list = "";
    const char *text = "";

    if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL
	|| paper->item_type != ITEM_PAPER )
    {
      send_to_char( "You are not holding a message disk.\r\n", ch );
      return;
    }

    if( ( subject =
	  get_extra_descr( "_subject_", paper->first_extradesc ) ) == NULL )
      subject = "(no subject)";
    if( ( to_list =
	  get_extra_descr( "_to_", paper->first_extradesc ) ) == NULL )
      to_list = "(nobody)";
    sprintf( buf, "%s: %s\r\nTo: %s\r\n", ch->name, subject, to_list );
    send_to_char( buf, ch );
    if( ( text =
	  get_extra_descr( "_text_", paper->first_extradesc ) ) == NULL )
      text = "The disk is blank.\r\n";
    send_to_char( text, ch );
    return;
  }

  if( !str_cmp( arg, "post" ) )
  {
    char *strtime = NULL;
    const char *text = NULL;

    if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL
	|| paper->item_type != ITEM_PAPER )
    {
      send_to_char( "You are not holding a message disk.\r\n", ch );
      return;
    }

    if( paper->value[0] == 0 )
    {
      send_to_char( "There is nothing written on this disk.\r\n", ch );
      return;
    }

    if( paper->value[1] == 0 )
    {
      send_to_char( "This message has no subject... using 'none'.\r\n",
	  ch );
      paper->value[1] = 1;
      ed = SetOExtra( paper, "_subject_" );
      STRFREE( ed->description );
      ed->description = STRALLOC( "none" );
    }

    if( paper->value[2] == 0 )
    {
      if( IS_MAIL )
      {
	send_to_char( "This message is addressed to no one!\r\n", ch );
	return;
      }
      else
      {
	send_to_char
	  ( "This message is addressed to no one... sending to 'all'!\r\n",
	    ch );
	paper->value[2] = 1;
	ed = SetOExtra( paper, "_to_" );
	STRFREE( ed->description );
	ed->description = STRALLOC( "All" );
      }
    }

    board = find_board( ch );
    if( !board )
    {
      send_to_char
	( "There is no terminal here to upload your message to.\r\n",
	  ch );
      return;
    }
    if( !can_post( ch, board ) )
    {
      send_to_char
	( "You cannot use this terminal. It is encrypted...\r\n", ch );
      return;
    }

    if( board->num_posts >= board->max_posts )
    {
      send_to_char
	( "This terminal is full. There is no room for your message.\r\n",
	  ch );
      return;
    }

    act( AT_ACTION, "$n uploads a message.", ch, NULL, NULL, TO_ROOM );

    strtime = ctime( &current_time );
    strtime[strlen( strtime ) - 1] = '\0';
    CREATE( pnote, NOTE_DATA, 1 );
    pnote->date = STRALLOC( strtime );

    text = get_extra_descr( "_text_", paper->first_extradesc );
    pnote->text = text ? STRALLOC( text ) : STRALLOC( "" );
    text = get_extra_descr( "_to_", paper->first_extradesc );
    pnote->to_list = text ? STRALLOC( text ) : STRALLOC( "all" );
    text = get_extra_descr( "_subject_", paper->first_extradesc );
    pnote->subject = text ? STRALLOC( text ) : STRALLOC( "" );
    pnote->sender = QUICKLINK( ch->name );
    pnote->voting = 0;
    pnote->yesvotes = str_dup( "" );
    pnote->novotes = str_dup( "" );
    pnote->abstentions = str_dup( "" );

    LINK( pnote, board->first_note, board->last_note, next, prev );
    board->num_posts++;
    write_board( board );
    send_to_char( "You upload your message to the terminal.\r\n", ch );
    extract_obj( paper );
    return;
  }

  if( !str_cmp( arg, "remove" )
      || !str_cmp( arg, "take" ) || !str_cmp( arg, "copy" ) )
  {
    char take = 0;

    board = find_board( ch );
    if( !board )
    {
      send_to_char
	( "There is no terminal here to download a note from!\r\n", ch );
      return;
    }
    if( !str_cmp( arg, "take" ) )
      take = 1;
    else if( !str_cmp( arg, "copy" ) )
    {
      if( !IS_IMMORTAL( ch ) )
      {
	send_to_char( "Huh?  Type 'help note' for usage.\r\n", ch );
	return;
      }
      take = 2;
    }
    else
      take = 0;

    if( !is_number( arg_passed ) )
    {
      send_to_char( "Note remove which number?\r\n", ch );
      return;
    }

    if( !can_read( ch, board ) )
    {
      send_to_char
	( "You can't make any sense of what's posted here, let alone remove anything!\r\n",
	  ch );
      return;
    }

    anum = atoi( arg_passed );
    vnum = 0;
    for( pnote = board->first_note; pnote; pnote = pnote->next )
    {
      if( IS_MAIL && ( ( is_note_to( ch, pnote ) )
	    || IS_IMMORTAL( ch ) ) )
	vnum++;
      else if( !IS_MAIL )
	vnum++;
      if( ( !str_cmp( ch->name, pnote->sender )
	    || can_remove( ch, board ) ) && ( vnum == anum ) )
      {
	if( ( is_name( "all", pnote->to_list ) )
	    && ( !IS_IMMORTAL( ch ) ) && ( take == 1 ) )
	{
	  send_to_char
	    ( "Notes addressed to 'all' can not be taken.\r\n", ch );
	  return;
	}

	if( take != 0 )
	{
	  paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) );
	  ed = SetOExtra( paper, "_sender_" );
	  STRFREE( ed->description );
	  ed->description = QUICKLINK( pnote->sender );
	  ed = SetOExtra( paper, "_text_" );
	  STRFREE( ed->description );
	  ed->description = QUICKLINK( pnote->text );
	  ed = SetOExtra( paper, "_to_" );
	  STRFREE( ed->description );
	  ed->description = QUICKLINK( pnote->to_list );
	  ed = SetOExtra( paper, "_subject_" );
	  STRFREE( ed->description );
	  ed->description = QUICKLINK( pnote->subject );
	  ed = SetOExtra( paper, "_date_" );
	  STRFREE( ed->description );
	  ed->description = QUICKLINK( pnote->date );
	  ed = SetOExtra( paper, "note" );
	  STRFREE( ed->description );
	  sprintf( notebuf, "From: " );
	  strcat( notebuf, pnote->sender );
	  strcat( notebuf, "\r\nTo: " );
	  strcat( notebuf, pnote->to_list );
	  strcat( notebuf, "\r\nSubject: " );
	  strcat( notebuf, pnote->subject );
	  strcat( notebuf, "\r\n\r\n" );
	  strcat( notebuf, pnote->text );
	  strcat( notebuf, "\r\n" );
	  ed->description = STRALLOC( notebuf );
	  paper->value[0] = 2;
	  paper->value[1] = 2;
	  paper->value[2] = 2;
	  sprintf( short_desc_buf, "a note from %s to %s",
	      pnote->sender, pnote->to_list );
	  STRFREE( paper->short_descr );
	  paper->short_descr = STRALLOC( short_desc_buf );
	  sprintf( long_desc_buf,
	      "A note from %s to %s lies on the ground.",
	      pnote->sender, pnote->to_list );
	  STRFREE( paper->description );
	  paper->description = STRALLOC( long_desc_buf );
	  sprintf( keyword_buf, "note parchment paper %s",
	      pnote->to_list );
	  STRFREE( paper->name );
	  paper->name = STRALLOC( keyword_buf );
	}
	if( take != 2 )
	  note_remove( board, pnote );
	send_to_char( "Ok.\r\n", ch );
	if( take == 1 )
	{
	  act( AT_ACTION, "$n downloads a message.", ch, NULL, NULL,
	      TO_ROOM );
	  obj_to_char( paper, ch );
	}
	else if( take == 2 )
	{
	  act( AT_ACTION, "$n copies a message.", ch, NULL, NULL,
	      TO_ROOM );
	  obj_to_char( paper, ch );
	}
	else
	  act( AT_ACTION, "$n removes a message.", ch, NULL, NULL,
	      TO_ROOM );
	return;
      }
    }

    send_to_char( "No such message.\r\n", ch );
    return;
  }

  send_to_char( "Huh? Type 'help note' for usage.\r\n", ch );
}
示例#13
0
void do_renumber( CHAR_DATA* ch, const char* argument)
{
   RENUMBER_AREA *r_area;
   AREA_DATA *area;
   bool is_proto;
   char arg1[MAX_INPUT_LENGTH];
   int new_base;
   bool fill_gaps, verbose;

   /*
    * parse the first two parameters 
    */
   /*
    * first, area 
    */
   argument = one_argument( argument, arg1 );

   if( arg1[0] == '\0' )
   {
      ch_printf( ch, "What area do you want to renumber?\r\n" );
      return;
   }

   area = find_area( arg1, &is_proto );

   if( area == NULL )
   {
      ch_printf( ch, "No such area '%s'.\r\n", arg1 );
      return;
   }

   /*
    * and new vnum base 
    */
   argument = one_argument( argument, arg1 );
   if( arg1[0] == '\0' )
   {
      ch_printf( ch, "What will be the new vnum base for this area?\r\n" );
      return;
   }

   if( !is_number( arg1 ) )
   {
      ch_printf( ch, "Sorry, '%s' is not a valid vnum base number!\r\n", arg1 );
      return;
   }

   new_base = atoi( arg1 );

   /*
    * parse the flags 
    */
   fill_gaps = FALSE;
   verbose = FALSE;

   for( ;; )
   {
      argument = one_argument( argument, arg1 );

      if( arg1[0] == '\0' )
         break;
      else if( !str_prefix( arg1, "fillgaps" ) )
         fill_gaps = TRUE;
      else if( !str_prefix( arg1, "verbose" ) )
         verbose = TRUE;
      else
      {
         ch_printf( ch, "Invalid flag '%s'.\r\n", arg1 );
         return;
      }
   }

   /*
    * sanity check 
    */
   if( new_base == area->low_r_vnum && new_base == area->low_o_vnum && new_base == area->low_m_vnum && !fill_gaps )
   {
      ch_printf( ch,
                 "You don't want to change the base vnum and you don't want to fill gaps...\r\nSo what DO you wanna do?\r\n" );
      return;
   }

   /*
    * some restrictions 
    */
   if( IS_NPC( ch ) )
   {
      ch_printf( ch, "Yeah, right.\r\n" );
      return;
   }

   if( ch->level < LEVEL_SAVIOR )
   {
      ch_printf( ch, "You don't have enough privileges.\r\n" );
      return;
   }

   if( ch->level == LEVEL_SAVIOR )
   {
      if( area->low_r_vnum < ch->pcdata->r_range_lo || area->hi_r_vnum > ch->pcdata->r_range_hi ||
          area->low_m_vnum < ch->pcdata->m_range_lo || area->hi_m_vnum > ch->pcdata->m_range_hi ||
          area->low_o_vnum < ch->pcdata->o_range_lo || area->hi_o_vnum > ch->pcdata->o_range_hi )
      {
         ch_printf( ch, "You can't renumber that area ('%s').\r\n", area->filename );
         return;
      }
   }

   /*
    * get the renumber data 
    */
   r_area = gather_renumber_data( area, new_base, fill_gaps );

   /*
    * one more restriction 
    */
   if( ch->level == LEVEL_SAVIOR )
   {
      if( r_area->low_room < ch->pcdata->r_range_lo || r_area->hi_room > ch->pcdata->r_range_hi ||
          r_area->low_obj < ch->pcdata->o_range_lo || r_area->hi_obj > ch->pcdata->o_range_hi ||
          r_area->low_mob < ch->pcdata->m_range_lo || r_area->hi_mob > ch->pcdata->m_range_hi )
      {
         DISPOSE( r_area );
         ch_printf( ch, "The renumbered area would be outside your assigned vnum range.\r\n" );
         return;
      }
   }
   else if( is_proto )
   {
      if( r_area->low_room < area->low_r_vnum || r_area->hi_room > area->hi_r_vnum ||
          r_area->low_obj < area->low_o_vnum || r_area->hi_obj > area->hi_o_vnum ||
          r_area->low_mob < area->low_m_vnum || r_area->hi_mob > area->hi_m_vnum )
      {
         DISPOSE( r_area );
         ch_printf( ch, "Moving a proto area out of its range would create problems.\r\nWait till the area is finished to move it.\r\n" );
         return;
      }
   }

   /*
    * no overwriting of dest vnums
    *
    * Bugfix - Memory leak if r_area was valid.
    */
   if( check_vnums( ch, area, r_area ) )
   {
      if( r_area )
         DISPOSE( r_area );
      return;
   }

   /*
    * another sanity check :) 
    */
   if( r_area == NULL || ( r_area->r_obj == NULL && r_area->r_mob == NULL && r_area->r_room == NULL ) )
   {
      ch_printf( ch, "No changes to make.\r\n" );
      if( r_area != NULL )
         DISPOSE( r_area );
      return;
   }

   /*
    * ok, do it! 
    */
   pager_printf( ch, "Renumbering area '%s' to new base %d, filling gaps: %s\r\n",
                 area->filename, new_base, fill_gaps ? "yes" : "no" );
   renumber_area( ch, area, r_area, is_proto, verbose );
   pager_printf( ch, "Done.\r\n" );

   /*
    * clean up and goodbye 
    */
   if( r_area->r_room != NULL )
      free_renumber_data( r_area->r_room );
   if( r_area->r_obj != NULL )
      free_renumber_data( r_area->r_obj );
   if( r_area->r_mob != NULL )
      free_renumber_data( r_area->r_mob );
   DISPOSE( r_area );
}
示例#14
0
void renumber_area( CHAR_DATA * ch, AREA_DATA * area, RENUMBER_AREA * r_area, bool area_is_proto, bool verbose )
/* this is the function that actualy does the renumbering of "area" according
   to the renumber data in "r_area". "ch" is to show messages. */
{
   RENUMBER_DATA *r_data;
   ROOM_INDEX_DATA *room, *room_prev, *room_list, *room_next;
   MOB_INDEX_DATA *mob, *mob_prev, *mob_list, *mob_next;
   OBJ_INDEX_DATA *obj, *obj_prev, *obj_list, *obj_next;
   RESET_DATA *preset, *treset;
   int iHash;
   int low, high;

   high = UMAX( area->hi_r_vnum, UMIN( area->hi_o_vnum, area->hi_m_vnum ) );
   low = UMIN( area->low_r_vnum, UMIN( area->low_o_vnum, area->low_m_vnum ) );

   pager_printf( ch, "(Room) Renumbering...\r\n" );

   /*
    * what we do here is, for each list (room/obj/mob) first we
    * * take each element out of the hash array, change the vnum,
    * * and move it to our own list. after everything's moved out
    * * we put it in again. this is to avoid problems in situations
    * * where where room A is being moved to position B, but theres
    * * already a room B wich is also being moved to position C.
    * * a straightforward approach would result in us moving A to
    * * position B first, and then again to position C, and room
    * * B being lost inside the hash array, still there, but not
    * * foundable (its "covered" by A because they'd have the same 
    * * vnum). 
    */

   room_list = NULL;
   for( r_data = r_area->r_room; r_data; r_data = r_data->next )
   {
      if( verbose )
         pager_printf( ch, "(Room) %d -> %d\r\n", r_data->old_vnum, r_data->new_vnum );

      room = get_room_index( r_data->old_vnum );
      if( !room )
      {
         bug( "renumber_area: NULL room %d", r_data->old_vnum );
         continue;
      }

      /*
       * remove it from the hash list 
       */
      iHash = r_data->old_vnum % MAX_KEY_HASH;
      if( room_index_hash[iHash] == room )
         room_index_hash[iHash] = room->next;
      else
      {
         for( room_prev = room_index_hash[iHash]; room_prev && room_prev->next != room; room_prev = room_prev->next )
            ;
         if( room_prev == NULL )
         {
            bug( "renumber_area: Couldn't find a room in the hash table! Skipping it.\r\n" );
            continue;
         }
         room_prev->next = room->next;
         room->next = NULL;
      }

      /*
       * change the vnum 
       */
      room->vnum = r_data->new_vnum;

      /*
       * move it to the temporary list 
       */
      room->next = room_list;
      room_list = room;
   }
   /*
    * now move everything back into the hash array 
    */
   for( room = room_list; room; room = room_next )
   {
      room_next = room->next;
      /*
       * add it to the hash list again (new position) 
       */
      iHash = room->vnum % MAX_KEY_HASH;
      room->next = room_index_hash[iHash];
      room_index_hash[iHash] = room;
   }
   /*
    * if nothing was moved, or if the area is proto, dont change this 
    */
   if( r_area->r_room != NULL && !area_is_proto )
   {
      area->low_r_vnum = r_area->low_room;
      area->hi_r_vnum = r_area->hi_room;
   }

   pager_printf( ch, "(Mobs) Renumbering...\r\n" );
   mob_list = NULL;
   for( r_data = r_area->r_mob; r_data; r_data = r_data->next )
   {
      if( verbose )
         pager_printf( ch, "(Mobs) %d -> %d\r\n", r_data->old_vnum, r_data->new_vnum );

      mob = get_mob_index( r_data->old_vnum );
      if( !mob )
      {
         bug( "renumber_area: NULL mob %d", r_data->old_vnum );
         continue;
      }

      /*
       * fix references to this mob from shops while renumbering this mob 
       */
      if( mob->pShop )
      {
         if( verbose )
            pager_printf( ch, "(Mobs) Fixing shop for mob %d -> %d\r\n", r_data->old_vnum, r_data->new_vnum );
         mob->pShop->keeper = r_data->new_vnum;
      }
      if( mob->rShop )
      {
         if( verbose )
            pager_printf( ch, "(Mobs) Fixing repair shop for mob %d -> %d\r\n", r_data->old_vnum, r_data->new_vnum );
         mob->rShop->keeper = r_data->new_vnum;
      }

      /*
       * remove it from the hash list 
       */
      iHash = r_data->old_vnum % MAX_KEY_HASH;
      if( mob_index_hash[iHash] == mob )
         mob_index_hash[iHash] = mob->next;
      else
      {
         for( mob_prev = mob_index_hash[iHash]; mob_prev && mob_prev->next != mob; mob_prev = mob_prev->next )
            ;
         if( mob_prev == NULL )
         {
            bug( "renumber_area: Couldn't find a mob in the hash table! Skipping it.\r\n" );
            continue;
         }
         mob_prev->next = mob->next;
         mob->next = NULL;
      }

      /*
       * change the vnum 
       */
      mob->vnum = r_data->new_vnum;

      /*
       * move to private list 
       */
      mob->next = mob_list;
      mob_list = mob;
   }
   for( mob = mob_list; mob; mob = mob_next )
   {
      mob_next = mob->next;
      /*
       * add it to the hash list again 
       */
      iHash = mob->vnum % MAX_KEY_HASH;
      mob->next = mob_index_hash[iHash];
      mob_index_hash[iHash] = mob;
   }
   if( r_area->r_mob && !area_is_proto )
   {
      area->low_m_vnum = r_area->low_mob;
      area->hi_m_vnum = r_area->hi_mob;
   }

   pager_printf( ch, "(Objs) Renumbering...\r\n" );
   obj_list = NULL;
   for( r_data = r_area->r_obj; r_data; r_data = r_data->next )
   {
      if( verbose )
         pager_printf( ch, "(Objs) %d -> %d\r\n", r_data->old_vnum, r_data->new_vnum );
      obj = get_obj_index( r_data->old_vnum );
      if( !obj )
      {
         bug( "renumber_area: NULL obj %d", r_data->old_vnum );
         continue;
      }

      /*
       * remove it from the hash list 
       */
      iHash = r_data->old_vnum % MAX_KEY_HASH;
      if( obj_index_hash[iHash] == obj )
         obj_index_hash[iHash] = obj->next;
      else
      {
         for( obj_prev = obj_index_hash[iHash]; obj_prev && obj_prev->next != obj; obj_prev = obj_prev->next )
            ;
         if( obj_prev == NULL )
         {
            bug( "renumber_area: Couldn't find an obj in the hash table! Skipping it.\r\n" );
            continue;
         }
         obj_prev->next = obj->next;
         obj->next = NULL;
      }

      /*
       * change the vnum 
       */
      obj->vnum = r_data->new_vnum;

      /*
       * to our list 
       */
      obj->next = obj_list;
      obj_list = obj;
   }
   for( obj = obj_list; obj; obj = obj_next )
   {
      obj_next = obj->next;
      /*
       * add it to the hash list again 
       */
      iHash = obj->vnum % MAX_KEY_HASH;
      obj->next = obj_index_hash[iHash];
      obj_index_hash[iHash] = obj;
   }
   if( r_area->r_obj && !area_is_proto )
   {
      area->low_o_vnum = r_area->low_obj;
      area->hi_o_vnum = r_area->hi_obj;
   }

   pager_printf( ch, "Fixing references...\r\n" );

   pager_printf( ch, "... fixing objvals...\r\n" );
   translate_objvals( ch, area, r_area, verbose );

   pager_printf( ch, "... fixing exits...\r\n" );
   translate_exits( ch, area, r_area, verbose );

   pager_printf( ch, "... fixing resets...\r\n" );
   for( room = area->first_room; room; room = room->next_aroom )
   {
      for( preset = room->first_reset; preset; preset = preset->next )
      {
         translate_reset( preset, r_area );
         for( treset = preset->first_reset; treset; treset = preset->next_reset )
            translate_reset( treset, r_area );
      }
   }

   if( verbose )
   {
      pager_printf( ch, "Searching progs for references to renumbered vnums...\r\n" );
      warn_progs( ch, low, high, area, r_area );
   }
}
示例#15
0
void do_hintedit( CHAR_DATA* ch, const char* argument)
{
   char arg[MAX_STRING_LENGTH];
   char arg2[MAX_STRING_LENGTH];
   char arg3[MAX_STRING_LENGTH];
   HINT_DATA *hintData;
   int i;
   int no = 0;
   int ano = 0;
   bool found = FALSE;

   if( IS_NPC( ch ) )
      return;

   if( !IS_IMMORTAL( ch ) )
      return;

   set_char_color( AT_LBLUE, ch );
   argument = one_argument( argument, arg );
   argument = one_argument( argument, arg2 );
   argument = one_argument( argument, arg3 );
   if( !str_cmp( arg, "help" ) || arg[0] == '\0' )
   {
      do_help( ch, "imm_hints" );
      return;
   }

   if( !str_cmp( arg, "list" ) )
   {
      if( first_hint )
      {
         pager_printf( ch, "No | Low | High |            Text             \r\n" );
         pager_printf( ch, "---|-----|------|--------------------------------------------------\r\n" );
         i = 0;
         for( hintData = first_hint; hintData; hintData = hintData->next )
         {
            ++i;
            pager_printf( ch, "%2d | %3d | %4d | %-30s\r\n", i, hintData->low, hintData->high, hintData->text );
         }
         pager_printf( ch, "\r\n%d hints in file.\r\n", i );
      }
      else
         send_to_char( "No hints in file.\r\n", ch );
      return;
   }

   else if( !str_cmp( arg, "remove" ) )
   {
      no = 0;
      if( !is_number( arg2 ) )
      {
         send_to_char_color( "Remove which hint?\r\n", ch );
         return;
      }
      ano = atoi( arg2 );
      found = FALSE;
      for( hintData = first_hint; hintData; hintData = hintData->next )
      {
         ++no;
         if( no == ano )
         {
            ch_printf_color( ch, "&CHint Number %d removed\r\n", ano );
            UNLINK( hintData, first_hint, last_hint, next, prev );
            STRFREE( hintData->text );
            DISPOSE( hintData );
            found = TRUE;
            break;
         }
      }
      if( !found )
      {
         send_to_char( "Hint not found\r\n", ch );
         return;
      }
      return;
   }
   else if( !str_cmp( arg, "add" ) )
   {
      if( arg2 == '\0' )
      {
         send_to_char( "What is the minimum level for this hint?\r\n", ch );
         return;
      }
      if( arg3 == '\0' )
      {
         send_to_char( "What is the maximum level for this hint?\r\n", ch );
         return;
      }
      if( atoi( arg2 ) > atoi( arg3 ) )
      {
         send_to_char( "Aborting:  max less than min!\r\n", ch );
         return;
      }
      CREATE( hintData, HINT_DATA, 1 );
      hintData->low = atoi( arg2 );
      hintData->high = atoi( arg3 );
      hintData->text = STRALLOC( argument );
      LINK( hintData, first_hint, last_hint, next, prev );
      send_to_char( "Ok.  Hint created\r\n", ch );
      return;
   }
   else if( !str_cmp( arg, "force" ) )
   {
      ch_printf_color( ch, "&p( &wHINT&p ):  &P%s\r\n", get_hint( LEVEL_AVATAR ) );
      return;
   }
   else if( !str_cmp( arg, "edit" ) )
   {
      no = 0;
      i = 0;

      if( arg2[0] == '\0' )
      {
         send_to_char( "Edit which hint number?\r\n", ch );
         return;
      }
      else
         no = atoi( arg2 );
      if( arg3[0] == '\0' )
      {
         ch_printf( ch, "Edit which field of hint %d (low/high/text)?\r\n", no );
         return;
      }
      if( argument[0] == '\0' )
      {
         ch_printf( ch, "Change hint %d's field %s to what ?\r\n", no, arg3 );
         return;
      }
      for( hintData = first_hint; hintData; hintData = hintData->next )
      {
         ++i;
         if( i == no )
         {
            found = TRUE;
            break;
         }
      }
      if( !found )
      {
         ch_printf( ch, "Hint %d not found.\r\n", no );
         return;
      }
      else
      {
         if( !str_cmp( arg3, "text" ) )
         {
            STRFREE( hintData->text );
            hintData->text = STRALLOC( argument );
            send_to_char( "Hint text changed!\r\n", ch );
            return;
         }
         else if( !str_cmp( arg3, "low" ) )
         {
            if( atoi( argument ) > hintData->high )
            {
               send_to_char( "Aborting:  min higher than max.\r\n", ch );
               return;
            }
            hintData->low = atoi( argument );
            send_to_char( "Minimum level for hint changed.\r\n", ch );
            return;
         }
         else if( !str_cmp( arg3, "high" ) )
         {
            if( atoi( argument ) < hintData->low )
            {
               send_to_char( "Aborting:  max lower than min.\r\n", ch );
               return;
            }
            hintData->high = atoi( argument );
            send_to_char( "Maximum level for hint changed.\r\n", ch );
            return;
         }
         else
         {
            send_to_char( "Valid fields are:  low/high/text\r\n", ch );
            return;
         }
      }
   }
   else if( !str_cmp( arg, "save" ) )
   {
      write_hint(  );
      send_to_char( "Saved.\r\n", ch );
      return;
   }
   else
   {
      send_to_char( "Syntax:  hint (list/add/remove/edit/save/force)\r\n", ch );
      return;
   }
}
示例#16
0
void do_journal( CHAR_DATA *ch, char *argument )
{
    QUEST_DATA             *quest;
    CHQUEST_DATA           *chquest;
    CHAP_DATA              *chap;
    char                    arg1[MIL],
                            arg2[MIL];
    char                   *chapdesc;
    int                     x = 0,
        total = 0,
        cando = 0,
        done = 0,
        num = 0,
        progress = 0,
        avail = 0;
    bool                    found = FALSE,
        completed = FALSE;

    set_char_color( AT_PLAIN, ch );

    if ( IS_NPC( ch ) ) {
        error( ch );
        return;
    }

    argument = one_argument( argument, arg1 );

    if ( VLD_STR( arg1 ) && !str_cmp( arg1, "completados" ) ) {
        completed = TRUE;
        argument = one_argument( argument, arg1 );
    }

    argument = one_argument( argument, arg2 );

    if ( !arg1 || arg1[0] == '\0' ) {
        char                    questtime[MSL] = "";
        char                    chaptime[MSL] = "";
        char                    minsecs[MSL] = "";
        int                     time = 0,
            mins = 0,
            secs = 0;

        ch_printf( ch, "\r\n&YQUESTS De  %s&D\r\n\r\n", ch->name );
        send_to_char( "&cNIV           Quest      Capítulo      Progreso&D\r\n", ch );

        for ( quest = first_quest; quest; quest = quest->next ) {
            num = quest->number;
            total++;
            if ( ch->level < quest->level )
                continue;
            cando++;

            for ( chquest = ch->pcdata->first_quest; chquest; chquest = chquest->next ) {
                if ( chquest->questnum == quest->number ) {
                    progress = chquest->progress;
                    break;
                }
            }
            if ( !progress || !chquest )
                continue;

            chap = get_chap_from_quest( progress, quest );

            if ( !completed ) {
                if ( progress > quest->chapters ) {
                    done++;
                    continue;
                }

                if ( !chap )
                    continue;

                if ( chap && chap->desc )
                    chapdesc = chap->desc;
                else
                    chapdesc = ( char * ) "NULL: No desc for this chapter.";
            }
            else {                                     /* Only show completed quest */

                if ( progress > quest->chapters ) {
                    chapdesc = ( char * ) "¡quest completado!";
                    done++;
                }
                else
                    continue;
            }

            avail++;

            if ( ch->level == quest->level )
                send_to_char( "&Y", ch );
            else if ( quest->level >= ( ch->level - 3 ) )
                send_to_char( "&G", ch );
            else
                send_to_char( "&z", ch );
            ch_printf( ch, "%3d %20s %7d %s", quest->level, capitalize( quest->name ), progress,
                       chapdesc );
            if ( chquest->kamount > 0 )
                ch_printf( ch, "&R(%d)&D", chquest->kamount );
            send_to_char( "\r\n", ch );
            if ( chquest->chaplimit > 0 )
                ch_printf( ch, "Te queda %s para completar el capítulo.\r\n",
                           show_timeleft( chquest->chaplimit ) );
            if ( chquest->questlimit > 0 )
                ch_printf( ch, "Te queda %s para finalizar el quest.\r\n",
                           show_timeleft( chquest->questlimit ) );
        }

        if ( avail == 0 && done == 0 )
            send_to_char( "&B¡No has terminado ningún quest! ¡Ve a explorar!&D", ch );

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

        if ( IS_IMMORTAL( ch ) )
            ch_printf( ch, "&cquest disponibles:  &C%d\r\n", total );
        ch_printf( ch, "&cQuests encontrado: &C%d    &cQuests Finalizados: &C%d&D\r\n", avail, done );
        send_to_char( "\r\n&GMás información de un quest: &WDiario <nombre>&D\r\n", ch );
        send_to_char( "\r\n&Gpara ver los quest completados: &Wdiario completados&D\r\n", ch );
        return;
    }

    quest = get_quest_from_name( arg1 );
    if ( !quest ) {
        send_to_char( "&Gsintaxis: diario \r\n                diario <nombre del quest>&D\r\n",
                      ch );
        return;
    }

    for ( chquest = ch->pcdata->first_quest; chquest; chquest = chquest->next ) {
        if ( chquest->questnum != quest->number )
            continue;
        send_to_char( "&GLeyendo la descripción del quest...\r\n", ch );
        pager_printf( ch, "&W%s&D\r\n", quest->desc ? quest->desc : "(Not created!)" );
        found = TRUE;
        break;
    }

    if ( !found )
        send_to_char( "¡Este no es un quest de tu diario!\r\n", ch );
}
示例#17
0
文件: player.c 项目: Igdra/smaugfuss
void do_worth( CHAR_DATA* ch, const char* argument)
{
   char buf[MAX_STRING_LENGTH];
   char buf2[MAX_STRING_LENGTH];

   if( IS_NPC( ch ) )
      return;

   set_pager_color( AT_SCORE, ch );
   pager_printf( ch, "\r\nWorth for %s%s.\r\n", ch->name, ch->pcdata->title );
   send_to_pager( " ----------------------------------------------------------------------------\r\n", ch );
   if( !ch->pcdata->deity )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "N/A" );
   else if( ch->pcdata->favor > 2250 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "loved" );
   else if( ch->pcdata->favor > 2000 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "cherished" );
   else if( ch->pcdata->favor > 1750 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "honored" );
   else if( ch->pcdata->favor > 1500 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "praised" );
   else if( ch->pcdata->favor > 1250 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "favored" );
   else if( ch->pcdata->favor > 1000 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "respected" );
   else if( ch->pcdata->favor > 750 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "liked" );
   else if( ch->pcdata->favor > 250 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "tolerated" );
   else if( ch->pcdata->favor > -250 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "ignored" );
   else if( ch->pcdata->favor > -750 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "shunned" );
   else if( ch->pcdata->favor > -1000 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "disliked" );
   else if( ch->pcdata->favor > -1250 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "dishonored" );
   else if( ch->pcdata->favor > -1500 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "disowned" );
   else if( ch->pcdata->favor > -1750 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "abandoned" );
   else if( ch->pcdata->favor > -2000 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "despised" );
   else if( ch->pcdata->favor > -2250 )
      snprintf( buf, MAX_STRING_LENGTH, "%s", "hated" );
   else
      snprintf( buf, MAX_STRING_LENGTH, "%s", "damned" );

   if( ch->level < 10 )
   {
      if( ch->alignment > 900 )
         snprintf( buf2, MAX_STRING_LENGTH, "%s", "devout" );
      else if( ch->alignment > 700 )
         snprintf( buf2, MAX_STRING_LENGTH, "%s", "noble" );
      else if( ch->alignment > 350 )
         snprintf( buf2, MAX_STRING_LENGTH, "%s", "honorable" );
      else if( ch->alignment > 100 )
         snprintf( buf2, MAX_STRING_LENGTH, "%s", "worthy" );
      else if( ch->alignment > -100 )
         snprintf( buf2, MAX_STRING_LENGTH, "%s", "neutral" );
      else if( ch->alignment > -350 )
         snprintf( buf2, MAX_STRING_LENGTH, "%s", "base" );
      else if( ch->alignment > -700 )
         snprintf( buf2, MAX_STRING_LENGTH, "%s", "evil" );
      else if( ch->alignment > -900 )
         snprintf( buf2, MAX_STRING_LENGTH, "%s", "ignoble" );
      else
         snprintf( buf2, MAX_STRING_LENGTH, "%s", "fiendish" );
   }
   else
      snprintf( buf2, MAX_STRING_LENGTH, "%d", ch->alignment );
   pager_printf( ch, "|Level: %-4d |Favor: %-10s |Alignment: %-9s |Experience: %-9d|\r\n", ch->level, buf, buf2, ch->exp );
   send_to_pager( " ----------------------------------------------------------------------------\r\n", ch );
   switch ( ch->style )
   {
      case STYLE_EVASIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "evasive" );
         break;
      case STYLE_DEFENSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "defensive" );
         break;
      case STYLE_AGGRESSIVE:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "aggressive" );
         break;
      case STYLE_BERSERK:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "berserk" );
         break;
      default:
         snprintf( buf, MAX_STRING_LENGTH, "%s", "standard" );
         break;
   }
   pager_printf( ch, "|Glory: %-4d |Weight: %-9d |Style: %-13s |Gold: %-14s |\r\n",
                 ch->pcdata->quest_curr, ch->carry_weight, buf, num_punct( ch->gold ) );
   send_to_pager( " ----------------------------------------------------------------------------\r\n", ch );
   if( ch->level < 15 && !IS_PKILL( ch ) )
      pager_printf( ch, "|            |Hitroll: -------- |Damroll: ----------- |                     |\r\n" );
   else
      pager_printf( ch, "|            |Hitroll: %-8d |Damroll: %-11d |                     |\r\n", GET_HITROLL( ch ),
                    GET_DAMROLL( ch ) );
   send_to_pager( " ----------------------------------------------------------------------------\r\n", ch );
   return;
}
示例#18
0
void do_changes( CHAR_DATA * ch, char *argument )
{
    char arg[MIL];
    char buf[MSL];
    char *test;
    int today;
    int i;
    bool fAll;
    int totalpages = 1;

    one_argument( argument, arg );

    if( IS_NPC( ch ) )
        return;

    if( str_cmp( arg, "code" ) && str_cmp( arg, "area" ) && str_cmp( arg, "help" ) && str_cmp( arg, "rule" )
            && str_cmp( arg, "typo" ) && str_cmp( arg, "all" ) && !NULLSTR( arg ) )
    {
        send_to_char( "Incorrect Type!  Must be code, area, help, rule, type or ALL\n\r", ch );
        return;
    }

    if( maxChanges < 1 )
        return;

    i = 0;
    test = current_date(  );
    today = 0;

    for( i = 0; i < maxChanges; i++ )
        if( !str_cmp( test, changes_table[i].date ) )
            today++;

    if( NULLSTR( arg ) )
        fAll = FALSE;
    else
        fAll = TRUE;

    send_to_char( "\n\r", ch );
    xprintf( buf, "#R-=[ #W%s Changelog #R]=-", MUDNAME );
    cent_to_char( buf, ch );
    pager_to_char( "#R--------------------------------------------------------------------------------#n\n\r", ch );
    pager_to_char( "#wNo.  Coder        Date        Type    Change#n\n\r", ch );
    pager_to_char( "#R--------------------------------------------------------------------------------#n\n\r", ch );

    if( is_number( arg ) )
    {
        int page = atoi( arg );
        int number;

        number = page * 10;

        if( page < 0 || page > totalpages )
        {
            ch_printf( ch, "#RPage must be between 1 and %d!!!\n\r", totalpages );
            return;
        }

        for( i = ( number - 10 ); ( i < number && i < maxChanges ); i++ )
        {
            pager_printf( ch, "#0[#R%3d#0] %-11s #c*%-6s #P%-5s #w%-45s#n\n\r", ( i + 1 ), changes_table[i].coder,
                          changes_table[i].date, changes_table[i].type, change_justify( changes_table[i].change, 45 ) );
        }
    }
    else {

        for( i = 0; i < maxChanges; i++ )
        {
            if( !fAll && changes_table[i].mudtime + ( 7 * 24L * 3600L ) < current_time )
                continue;

            if( !str_cmp( arg, "code" ) && str_cmp( changes_table[i].type, "code" ) )
                continue;
            if( !str_cmp( arg, "area" ) && str_cmp( changes_table[i].type, "area" ) )
                continue;
            if( !str_cmp( arg, "help" ) && str_cmp( changes_table[i].type, "help" ) )
                continue;
            if( !str_cmp( arg, "rule" ) && str_cmp( changes_table[i].type, "rule" ) )
                continue;
            if( !str_cmp( arg, "typo" ) && str_cmp( changes_table[i].type, "typo" ) )
                continue;

            pager_printf( ch, "#0[#R%3d#0] %-11s #c*%-6s #P%-5s #w%-55s#D\n\r", ( i + 1 ), changes_table[i].coder,
                          changes_table[i].date, changes_table[i].type, change_justify( changes_table[i].change, 55 ) );
        }
    }
    pager_to_char( "#R--------------------------------------------------------------------------------#n\n\r", ch );
    pager_printf( ch, "#w    There are #D[ #Y%d#D ] #wchanges in the database, #Y%d #wof them were added today.#n\n\r",
                  maxChanges, today );
    pager_to_char( "#0       Also see: '#Cchanges all#0' for a list of all the changes.#0\n\r", ch );
    pager_to_char( "#0             Or: '#Cchanges <type>#0' for a filtered list of all.#n\n\r", ch );
    if( totalpages > 1 )
    {
        pager_printf( ch, "#0             Or: '#Cchanges <1 to %d>#0' for individual pages.#n\n\r", totalpages );
    }
    pager_to_char( "#R--------------------------------------------------------------------------------#n\n\r", ch );
    return;
}
示例#19
0
void do_color( CHAR_DATA* ch, const char* argument)
{
   bool dMatch, cMatch;
   short count = 0, y = 0;
   int x;
   char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
   char log_buf[MAX_STRING_LENGTH];

   dMatch = FALSE;
   cMatch = FALSE;

   if( IS_NPC( ch ) )
   {
      send_to_pager( "Only PC's can change colors.\r\n", ch );
      return;
   }

   if( !argument || argument[0] == '\0' )
   {
      show_colors( ch );
      return;
   }

   argument = one_argument( argument, arg );

   if( !str_cmp( arg, "savetheme" ) && IS_IMMORTAL( ch ) )
   {
      FILE *fp;
      char filename[256];

      if( !argument || argument[0] == '\0' )
      {
         send_to_char( "You must specify a name for this theme to save it.\r\n", ch );
         return;
      }

      if( strstr( argument, "." ) || strstr( argument, "/" ) || strstr( argument, "\\" ) )
      {
         send_to_char( "Invalid theme name.\r\n", ch );
         return;
      }

      snprintf( filename, sizeof( filename ), "%s%s", COLOR_DIR, argument );
      if( !( fp = fopen( filename, "w" ) ) )
      {
         ch_printf( ch, "Unable to write to color file %s\r\n", filename );
         return;
      }
      fprintf( fp, "%s", "#COLORTHEME\n" );
      fprintf( fp, "Name         %s~\n", argument );
      fprintf( fp, "MaxColors    %d\n", MAX_COLORS );
      fprintf( fp, "%s", "Colors      " );
      for( x = 0; x < MAX_COLORS; ++x )
         fprintf( fp, " %d", ch->colors[x] );
      fprintf( fp, "%s", "\nEnd\n" );
      fclose( fp );
      fp = NULL;
      ch_printf( ch, "Color theme %s saved.\r\n", argument );
      return;
   }

   if( !str_cmp( arg, "theme" ) )
   {
      FILE *fp;
      char filename[256];
      int max_colors = 0;

      if( !argument || argument[0] == '\0' )
      {
         show_colorthemes( ch );
         return;
      }

      if( strstr( argument, "." ) || strstr( argument, "/" ) || strstr( argument, "\\" ) )
      {
         send_to_char( "Invalid theme.\r\n", ch );
         return;
      }

      snprintf( filename, sizeof( filename ), "%s%s", COLOR_DIR, argument );
      if( !( fp = fopen( filename, "r" ) ) )
      {
         ch_printf( ch, "There is no theme called %s.\r\n", argument );
         return;
      }

      while( !feof( fp ) )
      {
         char *word = fread_word( fp );
         if( !str_cmp( word, "MaxColors" ) )
         {
            int temp = fread_number( fp );
            max_colors = UMIN( temp, MAX_COLORS );
            continue;
         }
         if( !str_cmp( word, "Colors" ) )
         {
            for( x = 0; x < max_colors; ++x )
               ch->colors[x] = fread_number( fp );
            fread_to_eol( fp );
            continue;
         }
         if( !str_cmp( word, "End" ) )
         {
            fclose( fp );
            fp = NULL;
            ch_printf( ch, "Color theme has been changed to %s.\r\n", argument );
            save_char_obj( ch );
            return;
         }
      }
      fclose( fp );
      fp = NULL;
      ch_printf( ch, "An error occured while trying to set color theme %s.\r\n", argument );
      return;
   }

   if( !str_cmp( arg, "ansitest" ) )
   {
      snprintf( log_buf, MAX_STRING_LENGTH, "%sBlack\r\n", ANSI_BLACK );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Red\r\n", ANSI_DRED );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Green\r\n", ANSI_DGREEN );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sOrange/Brown\r\n", ANSI_ORANGE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Blue\r\n", ANSI_DBLUE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sPurple\r\n", ANSI_PURPLE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sCyan\r\n", ANSI_CYAN );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sGrey\r\n", ANSI_GREY );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Grey\r\n", ANSI_DGREY );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sRed\r\n", ANSI_RED );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sGreen\r\n", ANSI_GREEN );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sYellow\r\n", ANSI_YELLOW );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sBlue\r\n", ANSI_BLUE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sPink\r\n", ANSI_PINK );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sLight Blue\r\n", ANSI_LBLUE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sWhite\r\n", ANSI_WHITE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sBlack\r\n", BLINK_BLACK );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Red\r\n", BLINK_DRED );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Green\r\n", BLINK_DGREEN );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sOrange/Brown\r\n", BLINK_ORANGE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Blue\r\n", BLINK_DBLUE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sPurple\r\n", BLINK_PURPLE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sCyan\r\n", BLINK_CYAN );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sGrey\r\n", BLINK_GREY );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Grey\r\n", BLINK_DGREY );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sRed\r\n", BLINK_RED );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sGreen\r\n", BLINK_GREEN );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sYellow\r\n", BLINK_YELLOW );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sBlue\r\n", BLINK_BLUE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sPink\r\n", BLINK_PINK );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sLight Blue\r\n", BLINK_LBLUE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sWhite\r\n", BLINK_WHITE );
      write_to_buffer( ch->desc, log_buf, 0 );
      write_to_buffer( ch->desc, ANSI_RESET, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sBlack\r\n", ANSI_WHITE, BACK_BLACK );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sDark Red\r\n", ANSI_BLACK, BACK_DRED );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sDark Green\r\n", ANSI_BLACK, BACK_DGREEN );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sOrange/Brown\r\n", ANSI_BLACK, BACK_ORANGE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sDark Blue\r\n", ANSI_BLACK, BACK_DBLUE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sPurple\r\n", ANSI_BLACK, BACK_PURPLE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sCyan\r\n", ANSI_BLACK, BACK_CYAN );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sGrey\r\n", ANSI_BLACK, BACK_GREY );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sDark Grey Background\r\n", ANSI_BLACK, BACK_DGREY );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sRed Background\r\n", ANSI_BLACK, BACK_RED );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sGreen Background\r\n", ANSI_BLACK, BACK_GREEN );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sYellow Background\r\n", ANSI_BLACK, BACK_YELLOW );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sBlue Background\r\n", ANSI_BLACK, BACK_BLUE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sPink Background\r\n", ANSI_BLACK, BACK_PINK );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sLight Blue Background\r\n", ANSI_BLACK, BACK_LBLUE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sWhite Background\r\n", ANSI_BLACK, BACK_WHITE );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%s%sItalics%s\r\n", ANSI_GREY, ANSI_ITALIC, ANSI_RESET );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sStrikeout%s\r\n", ANSI_STRIKEOUT, ANSI_RESET );
      write_to_buffer( ch->desc, log_buf, 0 );
      snprintf( log_buf, MAX_STRING_LENGTH, "%sUnderline\r\n", ANSI_UNDERLINE );
      write_to_buffer( ch->desc, log_buf, 0 );
      write_to_buffer( ch->desc, ANSI_RESET, 0 );
      return;
   }

   if( !str_prefix( arg, "_reset_" ) )
   {
      reset_colors( ch );
      send_to_pager( "All color types reset to default colors.\r\n", ch );
      return;
   }

   argument = one_argument( argument, arg2 );

   if( arg[0] == '\0' )
   {
      send_to_char( "Change which color type?\r\n", ch );
      return;
   }

   if( !str_prefix( arg, "_all_" ) )
   {
      dMatch = TRUE;
      count = -1;

      /*
       * search for a valid color setting 
       */
      for( y = 0; y < 16; y++ )
      {
         if( !str_cmp( arg2, valid_color[y] ) )
         {
            cMatch = TRUE;
            break;
         }
      }
   }
   else if( arg2[0] == '\0' )
      cMatch = FALSE;
   else
   {
      /*
       * search for the display type and str_cmp
       */
      for( count = 0; count < MAX_COLORS; count++ )
      {
         if( !str_prefix( arg, pc_displays[count] ) )
         {
            dMatch = TRUE;
            break;
         }
      }

      if( !dMatch )
      {
         ch_printf( ch, "%s is an invalid color type.\r\n", arg );
         send_to_char( "Type color with no arguments to see available options.\r\n", ch );
         return;
      }

      if( !str_cmp( arg2, "default" ) )
      {
         ch->colors[count] = default_set[count];
         ch_printf( ch, "Display %s set back to default.\r\n", pc_displays[count] );
         return;
      }

      /*
       * search for a valid color setting
       */
      for( y = 0; y < 16; y++ )
      {
         if( !str_cmp( arg2, valid_color[y] ) )
         {
            cMatch = TRUE;
            break;
         }
      }
   }

   if( !cMatch )
   {
      if( arg[0] )
         ch_printf( ch, "Invalid color for type %s.\n", arg );
      else
         send_to_pager( "Invalid color.\r\n", ch );

      send_to_pager( "Choices are:\r\n", ch );

      for( count = 0; count < 16; count++ )
      {
         if( count % 5 == 0 && count != 0 )
            send_to_pager( "\r\n", ch );

         pager_printf( ch, "%-10s", valid_color[count] );
      }
      pager_printf( ch, "%-10s\r\n", "default" );
      return;
   }
   else
      pager_printf( ch, "Color type %s set to color %s.\r\n", count == -1 ? "_all_" : pc_displays[count], valid_color[y] );

   if( !str_cmp( argument, "blink" ) )
      y += AT_BLINK;

   if( count == -1 )
   {
      int ccount;

      for( ccount = 0; ccount < MAX_COLORS; ++ccount )
         ch->colors[ccount] = y;

      set_pager_color( y, ch );

      pager_printf( ch, "All color types set to color %s%s.%s\r\n",
                    valid_color[y > AT_BLINK ? y - AT_BLINK : y], y > AT_BLINK ? " [BLINKING]" : "", ANSI_RESET );
   }
   else
   {
      ch->colors[count] = y;

      set_pager_color( count, ch );

      if( !str_cmp( argument, "blink" ) )
         ch_printf( ch, "Display %s set to color %s [BLINKING]%s\r\n",
                    pc_displays[count], valid_color[y - AT_BLINK], ANSI_RESET );
      else
         ch_printf( ch, "Display %s set to color %s.\r\n", pc_displays[count], valid_color[y] );
   }
   return;
}
示例#20
0
/* Display class information -Thoric */
void do_showclass( CHAR_DATA *ch, char *argument )
{
    char                    arg1[MIL],
                            arg2[MIL];
    struct class_type      *Class;
    int                     cl,
                            low,
                            hi,
                            ct,
                            i;

    set_pager_color( AT_PLAIN, ch );
    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
    if ( !VLD_STR( arg1 ) ) {
        do_classes( ch, ( char * ) "" );
        send_to_char( "Syntax: showclass <class> [level range]\r\n", ch );
        return;
    }
    if ( is_number( arg1 ) && ( cl = atoi( arg1 ) ) >= 0 && cl < MAX_CLASS )
        Class = class_table[cl];
    else {
        Class = NULL;
        for ( cl = 0; cl < MAX_CLASS && class_table[cl]; cl++ )
            if ( !str_cmp( class_table[cl]->who_name, arg1 ) ) {
                Class = class_table[cl];
                break;
            }
    }
    if ( !Class ) {
        send_to_char( "No such class.\r\n", ch );
        return;
    }
    pager_printf( ch, "&wCLASS: &W%s\r\n&w",
                  VLD_STR( Class->who_name ) ? Class->who_name : "(Not set)" );
    pager_printf( ch, "&wFilename: &W%s\r\n&w",
                  VLD_STR( Class->filename ) ? Class->filename : "(Not set)" );
    pager_printf( ch, "&wPrime Attribute:     &W%-14s\r\n", a_types[Class->attr_prime] );
    pager_printf( ch, "&wSecond Attribute:    &W%-14s\r\n", a_types[Class->attr_second] );
    pager_printf( ch, "&wDeficient Attribute: &W%-14s\r\n", a_types[Class->attr_deficient] );
    ct = 0;
    send_to_pager( "&wDisallowed Races:&W\r\n", ch );
    for ( i = 0; i < MAX_RACE; i++ ) {
        if ( IS_SET( Class->race_restriction, 1 << i ) ) {
            ct++;
            pager_printf( ch, "%10s ", race_table[i]->race_name );
            if ( ct % 6 == 0 )
                send_to_pager( "\r\n", ch );
        }
    }
    if ( ( ct % 6 != 0 ) || ( ct == 0 ) )
        send_to_pager( "\r\n", ch );
    ct = 0;
    send_to_pager( "&wAllowed Races:&W\r\n", ch );
    for ( i = 0; i < MAX_RACE; i++ ) {
        if ( !IS_SET( Class->race_restriction, 1 << i ) ) {
            ct++;
            pager_printf( ch, "%10s ", race_table[i]->race_name );
            if ( ct % 6 == 0 )
                send_to_pager( "\r\n", ch );
        }
    }

    // Added in combo restrictions by: Taon...
/*
  if((ct % 6 != 0) || (ct == 0))
    send_to_pager("\r\n", ch);
  ct = 0;

  send_to_pager("&wAllowed combos:&W\r\n", ch);
  for(i = 0; i < MAX_CLASS; i++)
  {
    ct++;

    if(!IS_SET(Class->combo_restriction, 1 << i))
    {
      pager_printf(ch, "%10s ", class_table[i]->who_name);
      send_to_pager("\r\n", ch);
    }
  }
  if((ct % 6 != 0) || (ct == 0))
    send_to_pager("\r\n", ch);
  ct = 0;

  send_to_pager("&wNot Allowed combos:&W\r\n", ch);
  for(i = 0; i < MAX_CLASS; i++)
  {
    ct++;
    if(IS_SET(Class->combo_restriction, 1 << i))
    {
      pager_printf(ch, "%10s ", class_table[i]->who_name);
      send_to_pager("\r\n", ch);
    }
  }
*/
    send_to_char( "\r\n", ch );
    pager_printf( ch,
                  "&wMax Skill Adept: &W%-3d             &wThac0 : &W%-5d     &wThac32: &W%d\r\n",
                  Class->skill_adept, Class->thac0_00, Class->thac0_32 );
    pager_printf( ch,
                  "&wHp Min/Hp Max  : &W%-2d/%-2d     &wMana Min/Max: &W%-2d/%-2d &wExpBase: &W%d\r\n",
                  Class->hp_min, Class->hp_max, Class->mana_min, Class->mana_max, Class->exp_base );
    pager_printf( ch, "&W%s &wClass\r\n", Class->starting ? "Starting" : "Non-Starting" );
    pager_printf( ch, "&wAffected by:  &W%s\r\n",
                  !xIS_EMPTY( Class->affected ) ? ext_flag_string( &Class->affected,
                                                                   a_flags ) : "Nothing" );
    pager_printf( ch, "&wResistant to: &W%s\r\n", flag_string( Class->resist, ris_flags ) );
    pager_printf( ch, "&wSusceptible to: &W%s\r\n", flag_string( Class->suscept, ris_flags ) );
    pager_printf( ch, "&wCrafting Base: &W%d\r\n", Class->craft_base );

    /*
     * These are no longer in use. -Taon if(Class->reclass1 > 0) pager_printf(ch, "%s ",
     * class_table[class->reclass1]->who_name); if(Class->reclass2 > 0) pager_printf(ch,
     * "%s ", class_table[class->reclass2]->who_name); if(Class->reclass3 > 0)
     * pager_printf(ch, "%s ", class_table[class->reclass3]->who_name);
     * send_to_pager("\r\n", ch); 
     */

/*
  if(VLD_STR(arg2))
  {
    int x, y, cnt;

    low = UMAX(0, atoi(arg2));
    hi = URANGE(low, atoi(argument), MAX_LEVEL);
    for(x = low; x <= hi; x++)
    {
      set_pager_color(AT_LBLUE, ch);
      pager_printf(ch, "Male: %-30s Female: %s\r\n", title_table[cl][x][0], title_table[cl][x][1]);
      cnt = 0;
      set_pager_color(AT_BLUE, ch);
      for(y = gsn_first_spell; y < gsn_top_sn; y++)
        if(skill_table[y]->skill_level[cl] == x)
        {
          pager_printf(ch, "  %-7s %-19s%3d     ", skill_tname[skill_table[y]->type], skill_table[y]->name, skill_table[y]->skill_adept[cl]);
          if(++cnt % 2 == 0)
            send_to_pager("\r\n", ch);
          if(cnt % 2 != 0)
            send_to_pager("\r\n", ch);
          send_to_pager("\r\n", ch);
        }
    }
  }
*/

    if ( arg2 && arg2[0] != '\0' ) {
        int                     x,
                                y,
                                cnt;

        low = UMAX( 0, atoi( arg2 ) );
        hi = URANGE( low, atoi( argument ), MAX_LEVEL );
        for ( x = low; x <= hi; x++ ) {
            pager_printf( ch, "&wMale: &W%-30s &wFemale: &W%s\r\n", title_table[cl][x][0],
                          title_table[cl][x][1] );
            cnt = 0;
            for ( y = gsn_first_spell; y < gsn_top_sn; y++ )
                if ( skill_table[y]->skill_level[cl] == x ) {
                    pager_printf( ch, "  &[skill]%-7s %-19s%3d     ",
                                  skill_tname[skill_table[y]->type], skill_table[y]->name,
                                  skill_table[y]->skill_adept[cl] );
                    if ( ++cnt % 2 == 0 )
                        send_to_pager( "\r\n", ch );
                }
            if ( cnt % 2 != 0 )
                send_to_pager( "\r\n", ch );
            send_to_pager( "\r\n", ch );
        }
    }

    return;
}