Beispiel #1
0
void show_news( CHAR_DATA *ch, int show_type, int count )
{
    NEWS_DATA              *news = NULL,
        *curr_news = NULL;
    int                     nCount = 1;
    char                    buf[MAX_NEWS_LENGTH * 2];
    char                    bar[MAX_NEWS_LENGTH * 2];

    if ( IS_BLIND( ch ) ) {
        send_to_char( "Noticias de 6 Dragones\r\n\r\n", ch );
    }
    else {
        sprintf( bar,
                 "%s--------------------------------=[ %sNoticias de 6Dragones %s]=---------------------------------\r\n",
                 AT_6D, AT_TRANS, AT_6D );
        send_to_pager_color( bar, ch );
    }
    switch ( show_type ) {
        case TYPE_SHOW_ONE:
            for ( news = first_news; news; news = news->next ) {
                if ( nCount++ != count )
                    continue;
                sprintf( buf, "%s%2.2d%s/%s%2.2d%s/%s%4.4d  %s%s\r\n", AT_DATE, news->month,
                         AT_SEPARATOR, AT_DATE, news->day, AT_SEPARATOR, AT_DATE, news->year,
                         AT_NEWS, news->data );
                send_to_pager_color( buf, ch );
                break;
            }
            break;

        case TYPE_IMM_LIST:
            for ( news = first_news, nCount = 1; news != NULL; news = news->next, nCount++ ) {
                sprintf( buf, "%s%10d%s]  %s%s\r\n", AT_DATE, nCount, AT_SEPARATOR, AT_NEWS,
                         news->data );
                send_to_pager_color( buf, ch );
            }
            break;

        case TYPE_NORMAL:
        case TYPE_ALL:
        case TYPE_LIST_FIRST:
            for ( news = first_news, nCount = 1; news != NULL; news = news->next, nCount++ ) {
                bool                    fShow = FALSE;
                bool                    fBreakOut = FALSE;

                if ( show_type == TYPE_ALL )
                    fShow = TRUE;
                else if ( show_type == TYPE_NORMAL
                          && ( ( news->time_stamp > ch->pcdata->last_read_news ) || !news->next ) )
                    fShow = TRUE;
                else if ( show_type == TYPE_LIST_FIRST ) {
                    if ( count > 0 ) {
                        if ( nCount <= count )
                            fShow = TRUE;
                    }
                    else {
                        news = first_news;
                        fShow = TRUE;
                        fBreakOut = TRUE;
                    }
                }
                if ( news && fShow == TRUE ) {
                    sprintf( buf, "%s%2.2d%s/%s%2.2d%s/%s%4.4d  %s%s\r\n", AT_DATE, news->month,
                             AT_SEPARATOR, AT_DATE, news->day, AT_SEPARATOR, AT_DATE, news->year,
                             AT_NEWS, news->data );
                    send_to_pager_color( buf, ch );
                    if ( news->time_stamp > ch->pcdata->last_read_news ) {
                        ch->pcdata->last_read_news = news->time_stamp;
                    }
                    if ( fBreakOut == TRUE )
                        break;
                }
            }
            break;

        case TYPE_LIST_LAST:
            if ( count > 0 ) {
                for ( news = last_news, nCount = 1; news != NULL && nCount <= count;
                      news = news->prev, nCount++ ) {
                    curr_news = news;
                }
            }
            else
                curr_news = last_news;

            for ( news = curr_news; news != NULL; news = news->next ) {
                if ( news ) {
                    sprintf( buf, "%s%2.2d%s/%s%2.2d%s/%s%4.4d  %s%s\r\n", AT_DATE, news->month,
                             AT_SEPARATOR, AT_DATE, news->day, AT_SEPARATOR, AT_DATE, news->year,
                             AT_NEWS, news->data );
                    send_to_pager_color( buf, ch );
                    if ( news->time_stamp > ch->pcdata->last_read_news ) {
                        ch->pcdata->last_read_news = news->time_stamp;
                    }
                }
            }
            break;

        default:
            break;
    }
}
Beispiel #2
0
/** Function: do_slay
  * Descr   : Slays (kills) a player, optionally sending one of several
  *           predefined "slay option" messages to those involved.
  * Returns : (void)
  * Syntax  : slay (who) [option]
  * Written : v1.0 12/97
  * Author  : Gary McNickle <*****@*****.**>
  * Ported to Smaug 1.02a by: Samson
  * Updated to work with Smaug 1.4 by Samson 8-3-98
  * v2.0 added support for online editing
  */
void do_slay( CHAR_DATA * ch, char *argument )
{
   CHAR_DATA *victim;
   SLAY_DATA *slay;
   char type[MAX_INPUT_LENGTH];
   char who[MAX_INPUT_LENGTH];
   bool found = FALSE;

   if( IS_NPC( ch ) )
   {
      send_to_char( "Mobs can't use the slay command.\r\n", ch );
      return;
   }

   argument = one_argument( argument, who );
   argument = one_argument( argument, type );

   if( !str_prefix( who, "list" ) || who == NULL )
   {
      set_char_color( AT_GREEN, ch );
      send_to_char( "Syntax: slay <victim> [type]\r\n", ch );
      send_to_char( "Where type is one of the above...\r\n", ch );

      send_to_pager_color( "&YSlay 			  &ROwner\r\n", ch );
      send_to_pager_color( "&g-------------------------+---------------\r\n", ch );
      for( slay = first_slay; slay; slay = slay->next )
         pager_printf_color( ch, "&G%-14s	&g%13s\r\n", slay->type, slay->owner );

      send_to_char( "\r\nTyping just 'slay <player>' will work too...\r\n", ch );
      return;
   }

   if( ( victim = get_char_room( ch, who ) ) == NULL )
   {
      send_to_char( "They aren't here.\r\n", ch );
      return;
   }

   if( ch == victim )
   {
      send_to_char( "Suicide is a mortal sin.\r\n", ch );
      return;
   }

   if( !IS_NPC( victim ) && victim->level > ch->level )
   {
      send_to_char( "You cannot slay someone who is above your level.\r\n", ch );
      return;
   }

   if( type[0] == '\0' )
   {
      act( AT_IMMORT, "You brutally slay $N!", ch, NULL, victim, TO_CHAR );
      act( AT_IMMORT, "$n chops you up into little pieces!", ch, NULL, victim, TO_VICT );
      act( AT_IMMORT, "$n brutally slays $N!", ch, NULL, victim, TO_NOTVICT );
      set_cur_char( victim );
      raw_kill( ch, victim );
      return;
   }
   else
   {
      for( slay = first_slay; slay; slay = slay->next )
      {
         if( ( !str_cmp( type, slay->type ) && !str_cmp( "Any", slay->owner ) )
             || ( !str_cmp( slay->owner, ch->name ) && !str_cmp( type, slay->type ) ) )
         {
            found = TRUE;
            act( slay->color, slay->cmsg, ch, NULL, victim, TO_CHAR );
            act( slay->color, slay->vmsg, ch, NULL, victim, TO_VICT );
            act( slay->color, slay->rmsg, ch, NULL, victim, TO_NOTVICT );
            set_cur_char( victim );
            raw_kill( ch, victim );
            return;
         }
      }
   }

   if( !found )
      send_to_char
         ( "&RSlay type not defined, or not owned by you. Type \"slay list\" for a complete listing of types available to you.\r\n",
           ch );

   return;
}  /* end of func: "do_slay" */