Пример #1
0
void do_map( CHAR_DATA * ch, char *argument )
{
   int counter, size, min, max;
   char mline[430];

   if( !sector_translation[SECT_MAX + 1][0] )
   {
      send_to_char_color( "&C&wYour sector translation table needs to be updated to match your current"
                          " sector types.\r\n", ch );
      return;
   }

   if( argument && !str_cmp( argument, "legend" ) )
   {
      send_to_char_color( "&C&G[MAP LEGEND]\r\n", ch );
      for( counter = 0; counter < SECT_MAX + 2; ++counter )
         if( counter != SECT_MAX )
            ch_printf_color( ch, "   %s - %s\r\n", sector_translation[counter][0], sector_translation[counter][1] );
      return;
   }

   if( argument && argument[0] != '\0' )
   {
      send_to_char_color( "&C&wSyntax: \r\n", ch );
      send_to_char_color( "&C&wmap legend &G- &wMap Symbol Explanation\r\n", ch );
      send_to_char_color( "&C&wOtherwise just try map with no arguments.\r\n", ch );
      return;
   }

   size = 6;
   min = ( 215 / 2 ) - size / 2;
   max = ( 215 / 2 ) + size / 2;

   prep_map( ch->in_room, min, max );

   strcpy( mline, "&C&c." );

   for( counter = 0; counter < size; counter++ )
      strcat( mline, "&C&c-" );

   strcat( mline, "&C&c.\r\n" );


   for( counter = min; counter < max; counter++ )
   {
      strcat( mline, make_map_line( counter, min, max ) );
      strcat( mline, "\r\n" );
   }

   strcat( mline, "&C&c'" );

   for( counter = 0; counter < size; counter++ )
      strcat( mline, "&C&c-" );

   strcat( mline, "&C&c'\r\n" );

   send_to_char_color( mline, ch );

   return;
}
Пример #2
0
void do_news( CHAR_DATA *ch, char *argument )
{
    char                    arg1[MAX_NEWS_LENGTH],
                            buf[MIL],
                            arg2[MAX_NEWS_LENGTH];

    if ( IS_NPC( ch ) )
        return;

    if ( argument && argument[0] == '\0' ) {
        send_to_char( "\r\nuso: noticias [<opción>]\r\n", ch );
        send_to_char( "Opción puede ser: version, todas, ultima [<#>], primera [<#>], [#]\r\n", ch );
        if ( IS_IMMORTAL( ch ) ) {
            send_to_char( "\r\nUso: noticias [<campo>]\r\n", ch );
            send_to_char( "Campo puede ser: agregar, cargar, editar, eliminar\r\n", ch );
            send_to_char( "  <fecha>, lista\r\n", ch );
            return;
        }
        return;
    }

    if ( argument && argument[0] != '\0' ) {
        argument = one_argument( argument, arg1 );
        if ( !str_cmp( arg1, "version" ) ) {
            ch_printf_color( ch, "&cT&Che &cE&Clder &cC&Chronicles &cV&Cersion&c: &W%s&c.\r\n",
                             NEWS_VERSION );
            return;
        }
        else if ( is_number( arg1 ) ) {
            show_news( ch, TYPE_SHOW_ONE, atoi( arg1 ) );
            return;
        }
        else if ( !str_cmp( arg1, "todas" ) ) {
            show_news( ch, TYPE_ALL, -1 );
            send_to_char( "\r\nPara más detalles teclea 'ayuda noticias'\r\n", ch );
            return;
        }
        else if ( !str_cmp( arg1, "primera" ) ) {
            int                     show_count = -1;

            argument = one_argument( argument, arg2 );
            if ( !arg2 || arg2[0] == '\0' ) {
                show_count = -1;
            }
            else {
                if ( is_number( arg2 ) )
                    show_count = atoi( arg2 );
                else
                    show_count = -1;
            }
            show_news( ch, TYPE_LIST_FIRST, show_count );
        }
        else if ( !str_cmp( arg1, "ultima" ) ) {
            int                     show_count = -1;

            argument = one_argument( argument, arg2 );
            if ( !arg2 || arg2[0] == '\0' ) {
                show_count = 5;
            }
            else {
                if ( is_number( arg2 ) )
                    show_count = atoi( arg2 );
                else
                    show_count = -1;
            }

            show_news( ch, TYPE_LIST_LAST, show_count );
            send_to_char( "\r\nPara más detalles teclea 'ayuda noticias'\r\n", ch );
            return;
        }
        else if ( !IS_IMMORTAL( ch ) ) {
            show_news( ch, TYPE_NORMAL, -1 );
            return;
        }
        else if ( !str_cmp( arg1, "html" ) ) {
            if ( !argument || argument[0] == '\0' ) {
                ch_printf_color( ch, "&C&Gel sistema de noticias en HTML está &C&W%s&C&G.\r\n",
                                 USE_HTML_NEWS == TRUE ? "activado" : "desactivado" );
                return;
            }
            else if ( !str_cmp( argument, "cambiar" ) || !str_cmp( argument, "activar" )
                      || !str_cmp( argument, "desactivar" ) ) {
                if ( !str_cmp( argument, "cambiar" ) )
                    USE_HTML_NEWS = !USE_HTML_NEWS;
                else if ( !str_cmp( argument, "activar" ) )
                    USE_HTML_NEWS = TRUE;
                else
                    USE_HTML_NEWS = FALSE;

                do_news( ch, ( char * ) "html" );
                write_news(  );
                if ( USE_HTML_NEWS == TRUE )
                    generate_html_news(  );
                return;
            }
            else {
                do_news( ch, ( char * ) "html" );
                do_help( ch, ( char * ) "noticias" );
                return;
            }
        }
        else if ( !str_cmp( arg1, "agregar" ) && ( argument && argument[0] != '\0' ) ) {
            add_news( argument );
            send_to_char_color( "&C&GNoticia añadida.\r\n", ch );
            /*
             * Send the message about a note being posted to the mud 
             */
            snprintf( buf, MIL, "¡Hay una nueva noticia por %s!", ch->name );
            announce( buf );

        }
        else if ( !str_cmp( arg1, "cargar" ) ) {
            clear_news( FALSE, 0 );
            load_news(  );
            if ( USE_HTML_NEWS == TRUE )
                generate_html_news(  );
            send_to_char_color( "&C&GNoticias cargadas.\r\n", ch );
        }
        else if ( !str_cmp( arg1, "lista" ) ) {
            show_news( ch, TYPE_IMM_LIST, -1 );
        }
        else if ( !str_cmp( arg1, "eliminar" ) && ( argument && argument[0] != '\0' ) ) {
            bool                    clearAll = FALSE;

            if ( !str_cmp( argument, "todas" ) ) {
                clearAll = TRUE;
            }
            if ( !clearAll && !is_number( argument ) ) {
                send_to_char_color( "El argumento debe ser un número de noticia o todas.\r\n", ch );
                return;
            }
            if ( clearAll != TRUE )
                clear_news( TRUE, atoi( argument ) );
            else
                clear_news( FALSE, 0 );
            write_news(  );
            if ( USE_HTML_NEWS == TRUE )
                generate_html_news(  );
            send_to_char_color( "&C&GNoticias eliminadas.\r\n", ch );
        }
        else {
            do_help( ch, ( char * ) "noticias" );
            return;
        }
    }
    else {
        show_news( ch, TYPE_NORMAL, -1 );
    }
}
Пример #3
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;
   }
}
Пример #4
0
/* Affects-at-a-glance, Blodkai */
void do_affected( CHAR_DATA* ch, const char* argument)
{
   char arg[MAX_INPUT_LENGTH];
   AFFECT_DATA *paf;
   SKILLTYPE *skill;

   if( IS_NPC( ch ) )
      return;

   set_char_color( AT_SCORE, ch );

   argument = one_argument( argument, arg );
   if( !str_cmp( arg, "by" ) )
   {
      send_to_char_color( "\r\n&BImbued with:\r\n", ch );
      ch_printf_color( ch, "&C%s\r\n", !xIS_EMPTY( ch->affected_by ) ? affect_bit_name( &ch->affected_by ) : "nothing" );
      if( ch->level >= 20 )
      {
         send_to_char( "\r\n", ch );
         if( ch->resistant > 0 )
         {
            send_to_char_color( "&BResistances:  ", ch );
            ch_printf_color( ch, "&C%s\r\n", flag_string( ch->resistant, ris_flags ) );
         }
         if( ch->immune > 0 )
         {
            send_to_char_color( "&BImmunities:   ", ch );
            ch_printf_color( ch, "&C%s\r\n", flag_string( ch->immune, ris_flags ) );
         }
         if( ch->susceptible > 0 )
         {
            send_to_char_color( "&BSuscepts:     ", ch );
            ch_printf_color( ch, "&C%s\r\n", flag_string( ch->susceptible, ris_flags ) );
         }
      }
      return;
   }

   if( !ch->first_affect )
   {
      send_to_char_color( "\r\n&CNo cantrip or skill affects you.\r\n", ch );
   }
   else
   {
      send_to_char( "\r\n", ch );
      for( paf = ch->first_affect; paf; paf = paf->next )
         if( ( skill = get_skilltype( paf->type ) ) != NULL )
         {
            set_char_color( AT_BLUE, ch );
            send_to_char( "Affected:  ", ch );
            set_char_color( AT_SCORE, ch );
            if( ch->level >= 20 || IS_PKILL( ch ) )
            {
               if( paf->duration < 25 )
                  set_char_color( AT_WHITE, ch );
               if( paf->duration < 6 )
                  set_char_color( AT_WHITE + AT_BLINK, ch );
               ch_printf( ch, "(%5d)   ", paf->duration );
            }
            ch_printf( ch, "%-18s\r\n", skill->name );
         }
   }
   return;
}