예제 #1
0
파일: olc.c 프로젝트: MUDOmnibus/TinyROM
/* Area Interpreter, called by do_aedit. */
void aedit (CHAR_DATA * ch, char *argument)
{
    AREA_DATA *pArea;
    char command[MAX_INPUT_LENGTH];
    char arg[MAX_INPUT_LENGTH];
    int cmd;
    int value;

    EDIT_AREA (ch, pArea);
    smash_tilde (argument);
    strcpy (arg, argument);
    argument = one_argument (argument, command);

    if (!IS_BUILDER (ch, pArea))
    {
        send_to_char ("AEdit:  Insufficient security to modify area.\n\r",
                      ch);
        edit_done (ch);
        return;
    }

    if (!str_cmp (command, "done"))
    {
        edit_done (ch);
        return;
    }

    if (command[0] == '\0')
    {
        aedit_show (ch, argument);
        return;
    }

    if ((value = flag_value (area_flags, command)) != NO_FLAG)
    {
        TOGGLE_BIT (pArea->area_flags, value);

        send_to_char ("Flag toggled.\n\r", ch);
        return;
    }

    /* Search Table and Dispatch Command. */
    for (cmd = 0; aedit_table[cmd].name != NULL; cmd++)
    {
        if (!str_prefix (command, aedit_table[cmd].name))
        {
            if ((*aedit_table[cmd].olc_fun) (ch, argument))
            {
                SET_BIT (pArea->area_flags, AREA_CHANGED);
                return;
            }
            else
                return;
        }
    }

    /* Default to Standard Interpreter. */
    interpret (ch, arg);
    return;
}
예제 #2
0
void mpedit (CHAR_DATA * ch, char *argument)
{
    MPROG_CODE *pMcode;
    char arg[MAX_INPUT_LENGTH];
    char command[MAX_INPUT_LENGTH];
    int cmd;
    AREA_DATA *ad;

    smash_tilde (argument);
    strcpy (arg, argument);
    argument = one_argument (argument, command);

    EDIT_MPCODE (ch, pMcode);

    if (pMcode)
    {
        ad = get_vnum_area (pMcode->vnum);

        if (ad == NULL)
        {                        /* ??? */
            edit_done (ch);
            return;
        }

        if (!IS_BUILDER (ch, ad))
        {
            send_to_char ("MPEdit: Insufficient security to modify code.\n\r",
                          ch);
            edit_done (ch);
            return;
        }
    }

    if (command[0] == '\0')
    {
        mpedit_show (ch, argument);
        return;
    }

    if (!str_cmp (command, "done"))
    {
        edit_done (ch);
        return;
    }

    for (cmd = 0; mpedit_table[cmd].name != NULL; cmd++)
    {
        if (!str_prefix (command, mpedit_table[cmd].name))
        {
            if ((*mpedit_table[cmd].olc_fun) (ch, argument) && pMcode)
                if ((ad = get_vnum_area (pMcode->vnum)) != NULL)
                    SET_BIT (ad->area_flags, AREA_CHANGED);
            return;
        }
    }

    interpret (ch, arg);

    return;
}
예제 #3
0
파일: player.c 프로젝트: Igdra/smaugfuss
void do_title( CHAR_DATA* ch, const char* argument)
{
   if( IS_NPC( ch ) )
      return;

   set_char_color( AT_SCORE, ch );
   if( ch->level < 5 )
   {
      send_to_char( "Sorry... you must be at least level 5 to set your title...\r\n", ch );
      return;
   }
   if( IS_SET( ch->pcdata->flags, PCFLAG_NOTITLE ) )
   {
      set_char_color( AT_IMMORT, ch );
      send_to_char( "The Gods prohibit you from changing your title.\r\n", ch );
      return;
   }

   if( argument[0] == '\0' )
   {
      send_to_char( "Change your title to what?\r\n", ch );
      return;
   }

   char title[50];
   mudstrlcpy(title, argument, 50);

   smash_tilde( title );
   set_title( ch, title );
   send_to_char( "Ok.\r\n", ch );
}
예제 #4
0
파일: modify.c 프로젝트: matthewbode/mg2
/* Add user input to the 'current' string (as defined by d->str) */
void string_add(struct descriptor_data *d, char *str)
{
  int action;
/*  char *point; */

  delete_doubledollar(str);
  smash_tilde(str);

  /* determine if this is the terminal string, and truncate if so */
  /* changed to only accept '@' at the beginning of line - J. Elson 1/17/94 */
  if ((action = (*str == '@' || *str == '~')))
    *str = '\0';
  else
    if ((action = improved_editor_execute(d, str)) == STRINGADD_ACTION)
      return;

  if (!(*d->str)) {
    if (strlen(str) + 3 > d->max_str) {
      send_to_char("String too long - Truncated.\r\n", d->character);
      strcpy(&str[d->max_str - 3], "\r\n");
      CREATE(*d->str, char, d->max_str);
      strcpy(*d->str, str);
      if (!using_improved_editor)
        action = STRINGADD_SAVE;
    } else {  
예제 #5
0
파일: modify.c 프로젝트: ryantm/deimos-mud
/* Add user input to the 'current' string (as defined by d->str). This is still
 * overly complex. */
void string_add(struct descriptor_data *d, char *str)
{
  int action;

  /* Determine if this is the terminal string, and truncate if so. Changed to 
   * only accept '@' at the beginning of line. - JE */

  delete_doubledollar(str);
  smash_tilde(str);

  /* Determine if this is the terminal string, and truncate if so. Changed to 
   * only accept '@' if it's by itself. - fnord */
  if ((action = (*str == '@' && !str[1])))
    *str = '\0';
  else
    if ((action = improved_editor_execute(d, str)) == STRINGADD_ACTION)
      return;

  if (action != STRINGADD_OK)
    /* Do nothing. */ ;
  else if (!(*d->str)) {
    if (strlen(str) + 3 > d->max_str) { /* \r\n\0 */
      send_to_char(d->character, "String too long - Truncated.\r\n");
      strcpy(&str[d->max_str - 3], "\r\n");	/* strcpy: OK (size checked) */
      CREATE(*d->str, char, d->max_str);
      strcpy(*d->str, str);	/* strcpy: OK (size checked) */
      if (!using_improved_editor)
        action = STRINGADD_SAVE;
    } else {
예제 #6
0
파일: mail.c 프로젝트: KodersCo/hayalevi
void edit_mail_mode(USER_DATA *usr, char *argument) {
	char arg[INPUT];

	while (isspace(*argument))
		argument++;

	smash_tilde(argument);
	usr->timer = 0;

	argument = one_argument(argument, arg);

	if (arg[0] == '\0') {
		func_rnew_mail(usr);
		return;
	} else if (!str_cmp(arg, "?") || !str_cmp(arg, "h")) {
		do_help(usr, "MAIL_DATA-INDEX");
		return;
	} else if (!str_cmp(arg, "l")) {
		func_list_mail(usr);
		return;
	} else if (!str_cmp(arg, "r")) {
		func_reply_mail(usr, argument);
		return;
	} else if (!str_cmp(arg, "d")) {
		func_delete_mail(usr, argument);
		return;
	} else if (!str_cmp(arg, "q")) {
		func_quit_mail(usr);
		return;
	} else if (!str_cmp(arg, "c")) {
		if (argument[0] == '\0') {
			syntax("[#Wc#x]ompose <user name>", usr);
			return;
		}

		if (!is_user(argument)) {
			send_to_user("No such user.\n\r", usr);
			return;
		}

		if (is_enemy(usr, argument)) {
			send_to_user("You can't sent mail to your enemies.\n\r", usr);
			return;
		}

		mail_attach(usr);
		if (usr->pCurrentMail->to)
			free_string(usr->pCurrentMail->to);
		usr->pCurrentMail->to = str_dup(argument);
		EDIT_MODE(usr) = EDITOR_MAIL_SUBJECT;
		return;
	} else if (is_number(arg)) {
		func_read_mail(usr, arg);
		return;
	} else {
		send_to_user(
				"Unknown mail command, try '?' in order to show help.\n\r", usr);
		return;
	}
}
예제 #7
0
void bsedit( CHAR_DATA *ch, char *argument )
{
	BONUS_INDEX_DATA * pBonus;
	char arg[ MAX_INPUT_LENGTH ];
	char command[ MAX_INPUT_LENGTH ];
	int cmd;
	AREA_DATA *ad;

	smash_tilde( argument );
	strcpy( arg, argument );
	argument = one_argument( argument, command );

	EDIT_BSDATA( ch, pBonus );

	if ( pBonus )
	{
		ad = get_vnum_area( pBonus->vnum );

		if ( ad == NULL )
		{
			edit_done( ch );
			return ;
		}

		if ( !IS_BUILDER( ch, ad ) )
		{
			send_to_char( "BSEdit: Masz niewystarczaj±ce security.\n\r", ch );
			edit_done( ch );
			return ;
		}
	}

	if ( command[ 0 ] == '\0' )
	{
		bsedit_show( ch, argument );
		return ;
	}

	if ( !str_cmp( command, "done" ) )
	{
		edit_done( ch );
		return ;
	}

	for ( cmd = 0; bsedit_table[ cmd ].name != NULL; cmd++ )
	{
		if ( !str_prefix( command, bsedit_table[ cmd ].name ) )
		{
			if ( ( *bsedit_table[ cmd ].olc_fun ) ( ch, argument ) && pBonus )
				if ( ( ad = get_vnum_area( pBonus->vnum ) ) != NULL )
					SET_BIT( ad->area_flags, AREA_CHANGED );
			return ;
		}
	}

	interpret( ch, arg );
	return ;
}
예제 #8
0
void rdedit( CHAR_DATA *ch, char *argument)
{
    RAND_DESC_DATA *pDdata;
    char arg[MAX_INPUT_LENGTH];
    char command[MAX_INPUT_LENGTH];
    int cmd;
    AREA_DATA *ad;

    smash_tilde(argument);
    strcpy(arg, argument);
    argument = one_argument( argument, command);

    EDIT_RDESCDATA(ch, pDdata);

    if (pDdata)
    {
        ad = get_vnum_area( pDdata->vnum );

        if ( ad == NULL )
        {
            edit_done(ch);
            return;
        }

        if ( !IS_BUILDER(ch, ad) )
        {
            send_to_char("DescEdit: Brak praw dostêpu.\n\r", ch);
            edit_done(ch);
            return;
        }
    }

    if (command[0] == '\0')
    {
        rdedit_show(ch, argument);
        return;
    }

    if (!str_cmp(command, "done") )
    {
        edit_done(ch);
        return;
    }

    for (cmd = 0; rdedit_table[cmd].name != NULL; cmd++)
    {
        if (!str_prefix(command, rdedit_table[cmd].name) )
        {
            if ((*rdedit_table[cmd].olc_fun) (ch, argument) && pDdata)
                if ((ad = get_vnum_area(pDdata->vnum)) != NULL)
                    SET_BIT(ad->area_flags, AREA_CHANGED);
            return;
        }
    }

    interpret(ch, arg);
    return;
}
예제 #9
0
파일: hedit.c 프로젝트: Geadin/balrog
void hedit( CHAR_DATA *ch, char *argument)
{
    HELP_DATA * pHelp;
    HELP_AREA *had;
    char arg[MAX_INPUT_LENGTH];
    char command[MAX_INPUT_LENGTH];
    int cmd;

    smash_tilde(argument);
    strcpy(arg, argument);
    argument = one_argument( argument, command);

    EDIT_HELP(ch, pHelp);

    had = get_help_area(pHelp);

    if (had == NULL)
    {
    	bugf( "hedit : had para help %s NULL", pHelp->keyword );
    	edit_done(ch);
    	return;
    }

    if (ch->pcdata->security < 9)
    {
        send_to_char("HEdit: Insuficiente seguridad para editar help.\n\r",ch);
	edit_done(ch);
	return;
    }

    if (command[0] == '\0')
    {
	hedit_show(ch, argument);
        return;
    }

    if (!str_cmp(command, "done") )
    {
        edit_done(ch);
        return;
    }

    for (cmd = 0; hedit_table[cmd].name != NULL; cmd++)
    {
	if (!str_prefix(command, hedit_table[cmd].name) )
	{
		if ((*hedit_table[cmd].olc_fun) (ch, argument))
			had->changed = TRUE;
		return;
	}
    }

    interpret(ch, arg);
    return;
}
예제 #10
0
파일: olc.c 프로젝트: MUDOmnibus/TinyROM
/* Room Interpreter, called by do_redit. */
void redit (CHAR_DATA * ch, char *argument)
{
    AREA_DATA *pArea;
    ROOM_INDEX_DATA *pRoom;
    char arg[MAX_STRING_LENGTH];
    char command[MAX_INPUT_LENGTH];
    int cmd;

    EDIT_ROOM (ch, pRoom);
    pArea = pRoom->area;

    smash_tilde (argument);
    strcpy (arg, argument);
    argument = one_argument (argument, command);

    if (!IS_BUILDER (ch, pArea))
    {
        send_to_char ("REdit:  Insufficient security to modify room.\n\r",
                      ch);
        edit_done (ch);
        return;
    }

    if (!str_cmp (command, "done"))
    {
        edit_done (ch);
        return;
    }

    if (command[0] == '\0')
    {
        redit_show (ch, argument);
        return;
    }

    /* Search Table and Dispatch Command. */
    for (cmd = 0; redit_table[cmd].name != NULL; cmd++)
    {
        if (!str_prefix (command, redit_table[cmd].name))
        {
            if ((*redit_table[cmd].olc_fun) (ch, argument))
            {
                SET_BIT (pArea->area_flags, AREA_CHANGED);
                return;
            }
            else
                return;
        }
    }

    /* Default to Standard Interpreter. */
    interpret (ch, arg);
    return;
}
예제 #11
0
void handle_con_note_subject (DESCRIPTOR_DATA *d, char * argument)
{
	char buf [MAX_INPUT_LENGTH];
	CHAR_DATA *ch = d->character;

	if (!ch->pcdata->in_progress)
	{
		d->connected = CON_PLAYING;
		bug ("nanny: In CON_NOTE_SUBJECT, but no note in progress",0);
		return;
	}

	strcpy (buf, argument);
	smash_tilde (buf); /* change ~ to - as we save this field as a string later */

	/* Do not allow empty subjects */
	
	if (!buf[0])		
	{
		write_to_buffer (d, "Please find a meaningful subject!\n\r",0);
		write_to_buffer (d, BOLD YELLOW "Subject" NO_COLOR ": ", 0);
	}
	else  if (strlen(buf)>60)
	{
		write_to_buffer (d, "No, no. This is just the Subject. You're not writing the note yet. Twit.\n\r",0);
	}
	else
	/* advance to next stage */
	{
		ch->pcdata->in_progress->subject = str_dup(buf);
		if (IS_IMMORTAL(ch)) /* immortals get to choose number of expire days */
		{
			xprintf (buf,"\n\rHow many days do you want this note to expire in?\n\r"
			             "Press Enter for default value for this board, " BOLD "%d" NO_COLOR " days.\n\r"
           				 BOLD YELLOW "Expire" NO_COLOR ":  ",
		                 ch->pcdata->board->purge_days);
			write_to_buffer (d, buf, 0);				               
			d->connected = CON_NOTE_EXPIRE;
		}
		else
		{
			ch->pcdata->in_progress->expire = 
				current_time + ch->pcdata->board->purge_days * 24L * 3600L;				
			xprintf (buf, "This note will expire %s\r",ctime(&ch->pcdata->in_progress->expire));
			write_to_buffer (d,buf,0);
			write_to_buffer (d, "\n\rEnter text. Type " BOLD "~" NO_COLOR " or " BOLD "END" NO_COLOR " on an empty line to end note.\n\r"
			                    "=======================================================\n\r",0);
			d->connected = CON_NOTE_TEXT;
		}
	}
}
예제 #12
0
/*****************************************************************************
 *	do_medit
 *
 *	mobile editing interpreter
 *****************************************************************************/
void medit(struct char_data *ch, const char *argument)
{
    struct area_data *pArea;
    struct mob_index_data *pMob;
    char command[MAX_INPUT_LENGTH];
    char arg[MAX_STRING_LENGTH];
    const char *parg;
    int cmd;

    strcpy(arg, argument);
    smash_tilde(arg);
    parg = one_argument(arg, command);

    EDIT_MOB(ch, pMob);
    pArea = pMob->area;

    if (!IS_BUILDER(ch, pArea)) {
        send_to_char("MEdit: Insufficient security to modify area.\n\r", ch);
        edit_done(ch);
        return;
    }

    if (!str_cmp(command, "done")) {
        edit_done(ch);
        return;
    }

    if (command[0] == '\0') {
        medit_show(ch, parg);
        return;
    }

    /* Search Table and Dispatch Command. */
    for (cmd = 0; medit_table[cmd].name != NULL; cmd++) {
        if (!str_prefix(command, medit_table[cmd].name)) {
            if ((*medit_table[cmd].olc_fn)(ch, parg)) {
                SET_BIT(pArea->area_flags, AREA_CHANGED);
                return;
            } else {
                return;
            }
        }
    }

    /* Default to Standard Interpreter. */
    interpret(ch, arg);
    return;
}
예제 #13
0
파일: boards.c 프로젝트: ccubed/SWRCustom
void do_noteroom( CHAR_DATA * ch, char *argument )
{
  BOARD_DATA *board = NULL;
  char arg[MAX_STRING_LENGTH];
  char arg_passed[MAX_STRING_LENGTH];

  strcpy( arg_passed, argument );

  switch ( ch->substate )
  {
    case SUB_WRITING_NOTE:
      do_note( ch, arg_passed, FALSE );
      break;

    default:

      argument = one_argument( argument, arg );
      smash_tilde( argument );
      if( !str_cmp( arg, "write" ) || !str_cmp( arg, "to" )
	  || !str_cmp( arg, "subject" ) || !str_cmp( arg, "show" ) )
      {
	do_note( ch, arg_passed, FALSE );
	return;
      }

      board = find_board( ch );
      if( !board )
      {
	send_to_char( "There is no bulletin board here to look at.\r\n",
	    ch );
	return;
      }

      if( board->type != BOARD_NOTE )
      {
	send_to_char
	  ( "You can only use note commands on a message terminal.\r\n",
	    ch );
	return;
      }
      else
      {
	do_note( ch, arg_passed, FALSE );
	return;
      }
  }
}
예제 #14
0
void tedit( CHAR_DATA *ch, char *argument )
{
    char arg [MAX_INPUT_LENGTH];
    char command[MAX_INPUT_LENGTH];
    int cmd;

    smash_tilde( argument );
    strcpy( arg, argument );
    argument = one_argument( argument, command );

    if ( ch->pcdata->security < 8 )
	send_to_char( "HEdit: Insufficient security to modify text.\n\r", ch );

    if( command[0] == '\0' )
    {
	tedit_show( ch, argument );
	return;
    }

    if ( LOWER(command[0]) == 'd' && !str_cmp(command, "done") )
    {
	edit_done( ch );
	return;
    }

    if ( ch->pcdata->security < 8 )
    {
	substitute_alias( ch->desc, arg );
	return;
    }

    /* Search Table and Dispatch Command. */
    for ( cmd = 0; tedit_table[cmd].name[0] != '\0'; cmd++ )
    {
	if ( LOWER(command[0]) == LOWER(tedit_table[cmd].name[0])
	&&   !str_cmp( command, tedit_table[cmd].name ) )
	{
	    (*tedit_table[cmd].olc_fun) ( ch, argument );
	    return;
	}
    }

    /* Default to Standard Interpreter. */
    substitute_alias( ch->desc, arg );
    return;
}
예제 #15
0
파일: quest.c 프로젝트: doraemon332/Delanta
void set_qmark( CHAR_DATA *victim, char *arg )
{
    QMARK *qmark;

    if( qmark_free == NULL )
        qmark = alloc_perm( sizeof(*qmark) );
    else
    {
        qmark = qmark_free;    
        qmark_free = qmark_free->next;
    }    
    qmark->next = victim->pcdata->quest_mark;
    victim->pcdata->quest_mark = qmark;
    smash_tilde( arg );
    qmark->mark = str_dup( arg);
    return;
}
예제 #16
0
/* Area Interpreter, called by do_aedit. */
void matedit( CHAR_DATA *ch, char *argument )
{
    MAT_TYPE *pMat;
    char command[MAX_INPUT_LENGTH];
    char arg[MAX_INPUT_LENGTH];
    int  cmd;

    EDIT_MAT(ch, pMat);
    smash_tilde( argument );
    strcpy( arg, argument );
    argument = one_argument( argument, command );

    if ( !str_cmp(command, "done") )
    {
    	// save our materials
    	save_materials();
    	send_to_char("Materials Saved to disk.\n\r", ch);
		edit_done( ch );
		return;
    }

    if ( IS_NULLSTR(command) )
    {
		matedit_show( ch, argument );
		return;
    }

    /* Search Table and Dispatch Command. */
    for ( cmd = 0; matedit_table[cmd].name != NULL; cmd++ )
    {
	if ( !str_prefix( command, matedit_table[cmd].name ) )
	{
	    if ( (*matedit_table[cmd].olc_fun) ( ch, argument ) )
	    {
			return;
	    }
	    else
			return;
	}
    }

    /* Default to Standard Interpreter. */
    interpret( ch, arg );
    return;
}
예제 #17
0
파일: boards.c 프로젝트: ccubed/SWRCustom
void do_mailroom( CHAR_DATA * ch, char *argument )
{
  BOARD_DATA *board = NULL;
  char arg[MAX_STRING_LENGTH];
  char arg_passed[MAX_STRING_LENGTH];

  strcpy( arg_passed, argument );

  switch ( ch->substate )
  {
    case SUB_WRITING_NOTE:
      do_note( ch, arg_passed, TRUE );
      break;

    default:

      argument = one_argument( argument, arg );
      smash_tilde( argument );
      if( !str_cmp( arg, "write" ) || !str_cmp( arg, "to" )
	  || !str_cmp( arg, "subject" ) || !str_cmp( arg, "show" ) )
      {
	do_note( ch, arg_passed, TRUE );
	return;
      }

      board = find_board( ch );
      if( !board )
      {
	send_to_char( "There is no mail facility here.\r\n", ch );
	return;
      }

      if( board->type != BOARD_MAIL )
      {
	send_to_char
	  ( "You can only use mail commands in a post office.\r\n", ch );
	return;
      }
      else
      {
	do_note( ch, arg_passed, TRUE );
	return;
      }
  }
}
예제 #18
0
void
mpedit (CHAR_DATA * ch, char *argument)
{
  // MPROG_CODE *pMcode;
  char arg[MAX_INPUT_LENGTH];
  char command[MAX_INPUT_LENGTH];
  int cmd;

  smash_tilde (argument);
  strcpy (arg, argument);
  argument = one_argument (argument, command);

  //  EDIT_MPCODE (ch, pMcode);
  if (ch->pcdata->security < 7)
    {
      send_to_char ("MPEdit: Insufficient security to modify code\n\r", ch);
      edit_done (ch);
      return;
    }

  if (command[0] == '\0')
    {
      mpedit_show (ch, argument);
      return;
    }
  if (!str_cmp (command, "done"))
    {
      edit_done (ch);
      return;
    }

  for (cmd = 0; mpedit_table[cmd].name != NULL; cmd++)
    {
      if (!str_prefix (command, mpedit_table[cmd].name))
	{
	  (*mpedit_table[cmd].olc_fun) (ch, argument);
	  return;
	}
    }

  interpret (ch, arg);
  return;
}
예제 #19
0
void do_prompt( CHAR_DATA * ch, const char *argument )
{
	char arg[MAX_INPUT_LENGTH];

	set_char_color( AT_GREY, ch );

	if ( IS_NPC( ch ) )
	{
		send_to_char( "NPC's can't change their prompt..\r\n", ch );
		return;
	}
	smash_tilde( argument );
	one_argument( argument, arg );
	if ( !*arg || !str_cmp( arg, "display" ) )
	{
		send_to_char( "Your current prompt string:\r\n", ch );
		set_char_color( AT_WHITE, ch );
		ch_printf( ch, "%s\r\n", !str_cmp( ch->pcdata->prompt, "" ) ? "(default prompt)" : ch->pcdata->prompt );
		set_char_color( AT_GREY, ch );
		send_to_char( "Type 'help prompt' for information on changing your prompt.\r\n", ch );
		return;
	}
	send_to_char( "Replacing old prompt of:\r\n", ch );
	set_char_color( AT_WHITE, ch );
	ch_printf( ch, "%s\r\n", !str_cmp( ch->pcdata->prompt, "" ) ? "(default prompt)" : ch->pcdata->prompt );
	if ( ch->pcdata->prompt )
		STRFREE( ch->pcdata->prompt );

	char prompt[128];

	mudstrlcpy( prompt, argument, 128 );

	/*
	 * Can add a list of pre-set prompts here if wanted.. perhaps
	 * 'prompt 1' brings up a different, pre-set prompt 
	 */
	if ( !str_cmp( arg, "default" ) )
		ch->pcdata->prompt = STRALLOC( "" );
	else
		ch->pcdata->prompt = STRALLOC( prompt );
	return;
}
예제 #20
0
파일: boards.c 프로젝트: ccubed/SWRCustom
void do_makeboard( CHAR_DATA * ch, char *argument )
{
  BOARD_DATA *board = NULL;

  if( !argument || argument[0] == '\0' )
  {
    send_to_char( "Usage: makeboard <filename>\r\n", ch );
    return;
  }

  smash_tilde( argument );

  CREATE( board, BOARD_DATA, 1 );

  LINK( board, first_board, last_board, next, prev );
  board->note_file = str_dup( strlower( argument ) );
  board->read_group = str_dup( "" );
  board->post_group = str_dup( "" );
  board->extra_readers = str_dup( "" );
  board->extra_removers = str_dup( "" );
}
예제 #21
0
파일: slay.c 프로젝트: smaugmuds/xsmaug
/* Create a slaytype online - Samson 8-3-98 */
void do_makeslay( CHAR_DATA * ch, char *argument )
{
   SLAY_DATA *slay;

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

   if( !argument || argument[0] == '\0' )
   {
      send_to_char( "Usage: makeslay <slaytype>\r\n", ch );
      return;
   }

   smash_tilde( argument );

   /*
    * Glaring oversight just noticed - Samson 7-5-99 
    */
   if( ( slay = get_slay( argument ) ) != NULL )
   {
      send_to_char( "That slay type already exists.\r\n", ch );
      return;
   }

   CREATE( slay, SLAY_DATA, 1 );
   LINK( slay, first_slay, last_slay, next, prev );
   slay->type = STRALLOC( argument );
   slay->owner = STRALLOC( "Any" );
   slay->color = AT_IMMORT;
   slay->cmsg = STRALLOC( "You brutally slay $N!" );
   slay->vmsg = STRALLOC( "$n chops you up into little pieces!" );
   slay->rmsg = STRALLOC( "$n brutally slays $N!" );
   ch_printf( ch, "New slaytype %s added. Set to default values.\r\n", slay->type );
   save_slays(  );
   return;
}
예제 #22
0
void sedit( CHAR_DATA *ch, char *argument )
{
    SONG_DATA * pSong;
    char arg[ MAX_INPUT_LENGTH ];
    char command[ MAX_INPUT_LENGTH ];
    int cmd;

    smash_tilde( argument );
    strcpy( arg, argument );
    argument = one_argument( argument, command );

    EDIT_SDATA( ch, pSong );

    if ( command[ 0 ] == '\0' )
    {
        sedit_show( ch, argument );
        return ;
    }

    if ( !str_cmp( command, "done" ) )
    {
        edit_done( ch );
        return ;
    }

    for ( cmd = 0; sedit_table[ cmd ].name != NULL; cmd++ )
    {
        if ( !str_prefix( command, sedit_table[ cmd ].name ) )
        {
            ( *sedit_table[ cmd ].olc_fun ) ( ch, argument );
            return ;
        }
    }

    interpret( ch, arg );
    return ;
}
예제 #23
0
파일: mail.c 프로젝트: KodersCo/hayalevi
void edit_mail_subject(USER_DATA *usr, char *argument) {
	while (isspace(*argument))
		argument++;

	usr->timer = 0;

	mail_attach(usr);
	smash_tilde(argument);

	if (argument[0] == '\0') {
		/*	edit_mail_free(usr); BAXTER */
		EDIT_MODE(usr) = EDITOR_NONE;
		return;
	} else if (strlen(argument) > 20) {
		send_to_user("Subject too long.\n\r", usr);
		return;
	}

	if (usr->pCurrentMail->subject)
		free_string(usr->pCurrentMail->subject);
	usr->pCurrentMail->subject = str_dup(argument);
	EDIT_MODE(usr) = EDITOR_MAIL_WRITE;
	string_edit(usr, &usr->pCurrentMail->message);
}
예제 #24
0
파일: sedit.c 프로젝트: Wookiee-/ansr
void do_sedit (CHAR_DATA *ch, char *argument)
{
	char cmd[MAX_INPUT_LENGTH], social[MAX_INPUT_LENGTH];
	char buf[MAX_STRING_LENGTH];
	int iSocial;
	
	smash_tilde (argument);
	
	argument = one_argument (argument,cmd);
	argument = one_argument (argument,social);
	
	if (!cmd[0])
	{
		send_to_char ("Huh? Type HELP SEDIT to see syntax.\n\r",ch);
		return;
	}
		
	if (!social[0])
	{
		send_to_char ("What social do you want to operate on?\n\r",ch);
		return;
	}
	
	iSocial = social_lookup (social);
	
	if (str_cmp(cmd,"new") && (iSocial == -1))
	{
		send_to_char ("No such social exists.\n\r",ch);
		return;
	}

	if (!str_cmp(cmd, "delete")) /* Remove a social */
	{
		int i,j;
		struct social_type *new_table = malloc (sizeof(struct social_type) * maxSocial);
		
		if (!new_table)
		{
			send_to_char ("Memory allocation failed. Brace for impact...\n\r",ch);
			return;
		}
		
		/* Copy all elements of old table into new table, except the deleted social */
		for (i = 0, j = 0; i < maxSocial+1; i++)
			if (i != iSocial) /* copy, increase only if copied */
			{
				new_table[j] = social_table[i];
				j++;
			}
	
		free (social_table);
		social_table = new_table;
		
		maxSocial--; /* Important :() */
		
		send_to_char ("That social is history now.\n\r",ch);
				
	}
	
	else if (!str_cmp(cmd, "new")) /* Create a new social */
	{
		struct social_type *new_table;
		
		if (iSocial != -1)
		{
			send_to_char ("A social with that name already exists\n\r",ch);
			return;
		}
		
		/* reallocate the table */
		/* Note that the table contains maxSocial socials PLUS one empty spot! */
		
		maxSocial++;
		new_table = realloc (social_table, sizeof(struct social_type) * (maxSocial + 1));
		
		if (!new_table) /* realloc failed */
		{
			send_to_char ("Memory allocation failed. Brace for impact.\n\r",ch);
			return;
		}
		
		social_table = new_table;
		
		strcpy(social_table[maxSocial-1].name, str_dup (social));
		social_table[maxSocial-1].char_no_arg = str_dup ("");
		social_table[maxSocial-1].others_no_arg = str_dup ("");
		social_table[maxSocial-1].char_found = str_dup ("");
		social_table[maxSocial-1].others_found = str_dup ("");
		social_table[maxSocial-1].vict_found = str_dup ("");
		social_table[maxSocial-1].char_auto = str_dup ("");
		social_table[maxSocial-1].others_auto = str_dup ("");
		
		strcpy(social_table[maxSocial].name, str_dup ("")); /* 'terminating' empty string */
		
		send_to_char ("New social added.\n\r",ch);
			
	}
	
	else if (!str_cmp(cmd, "show")) /* Show a certain social */
	{
		sprintf (buf, "Social: %s\n\r"
		              "(cnoarg) No argument given, character sees:\n\r"
		              "%s\n\r\n\r"
		              "(onoarg) No argument given, others see:\n\r"
		              "%s\n\r\n\r"
		              "(cfound) Target found, character sees:\n\r"
		              "%s\n\r\n\r"
		              "(ofound) Target found, others see:\n\r"
		              "%s\n\r\n\r"
		              "(vfound) Target found, victim sees:\n\r"
		              "%s\n\r\n\r"
		              "(cself) Target is character himself:\n\r"
		              "%s\n\r\n\r"
		              "(oself) Target is character himself, others see:\n\r"
		              "%s\n\r",
		              
		              social_table[iSocial].name,
		              social_table[iSocial].char_no_arg,
		              social_table[iSocial].others_no_arg,
		              social_table[iSocial].char_found,
		              social_table[iSocial].others_found,
		              social_table[iSocial].vict_found,
		              social_table[iSocial].char_auto,
		              social_table[iSocial].others_auto);

		send_to_char (buf,ch);		          
		return; /* return right away, do not save the table */
	}
	
	else if (!str_cmp(cmd, "cnoarg")) /* Set that argument */
	{
		free_string (social_table[iSocial].char_no_arg);
		social_table[iSocial].char_no_arg = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Character will now see nothing when this social is used without arguments.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
	}
	
	else if (!str_cmp(cmd, "onoarg"))
	{
		free_string (social_table[iSocial].others_no_arg);
		social_table[iSocial].others_no_arg = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Others will now see nothing when this social is used without arguments.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
			
	}
	
	else if (!str_cmp(cmd, "cfound"))
	{
		free_string (social_table[iSocial].char_found);
		social_table[iSocial].char_found = str_dup(argument);		

		if (!argument[0])
			send_to_char ("The character will now see nothing when a target is found.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
			
	}
	
	else if (!str_cmp(cmd, "ofound"))
	{
		free_string (social_table[iSocial].others_found);
		social_table[iSocial].others_found = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Others will now see nothing when a target is found.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
			
	}
	
	else if (!str_cmp(cmd, "vfound"))
	{
		free_string (social_table[iSocial].vict_found);
		social_table[iSocial].vict_found = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Victim will now see nothing when a target is found.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
	}
	
	else if (!str_cmp(cmd, "cself"))
	{
		free_string (social_table[iSocial].char_auto);
		social_table[iSocial].char_auto = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Character will now see nothing when targetting self.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);

	}
	
	else if (!str_cmp(cmd, "oself"))
	{
		free_string (social_table[iSocial].others_auto);
		social_table[iSocial].others_auto = str_dup(argument);		

		if (!argument[0])
			send_to_char ("Others will now see nothing when character targets self.\n\r",ch);
		else
			printf_to_char (ch,"New message is now:\n\r%s\n\r", argument);
	}
	
	else
	{
		send_to_char ("Huh? Try HELP SEDIT.\n\r",ch);
		return;
	}
	
	/* We have done something. update social table */
	
	save_social_table();
}
예제 #25
0
파일: medit.c 프로젝트: axanon/tbamud
void medit_parse(struct descriptor_data *d, char *arg)
{
  int i = -1, j;
  char *oldtext = NULL;

  if (OLC_MODE(d) > MEDIT_NUMERICAL_RESPONSE) {
    i = atoi(arg);
    if (!*arg || (!isdigit(arg[0]) && ((*arg == '-') && !isdigit(arg[1])))) {
      write_to_output(d, "Try again : ");
      return;
    }
  } else {	/* String response. */
    if (!genolc_checkstring(d, arg))
      return;
  }
  switch (OLC_MODE(d)) {
  case MEDIT_CONFIRM_SAVESTRING:
    /* Ensure mob has MOB_ISNPC set. */
    SET_BIT_AR(MOB_FLAGS(OLC_MOB(d)), MOB_ISNPC);
    switch (*arg) {
    case 'y':
    case 'Y':
      /* Save the mob in memory and to disk. */
      medit_save_internally(d);
      mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits mob %d", GET_NAME(d->character), OLC_NUM(d));
      if (CONFIG_OLC_SAVE) {
        medit_save_to_disk(zone_table[real_zone_by_thing(OLC_NUM(d))].number);
        write_to_output(d, "Mobile saved to disk.\r\n");
      } else
        write_to_output(d, "Mobile saved to memory.\r\n");
      cleanup_olc(d, CLEANUP_ALL);
      return;
    case 'n':
    case 'N':
      /* If not saving, we must free the script_proto list. We do so by
       * assigning it to the edited mob and letting free_mobile in
       * cleanup_olc handle it. */
      OLC_MOB(d)->proto_script = OLC_SCRIPT(d);
      cleanup_olc(d, CLEANUP_ALL);
      return;
    default:
      write_to_output(d, "Invalid choice!\r\n");
      write_to_output(d, "Do you wish to save your changes? : ");
      return;
    }
    break;

  case MEDIT_MAIN_MENU:
    i = 0;
    switch (*arg) {
    case 'q':
    case 'Q':
      if (OLC_VAL(d)) {	/* Anything been changed? */
	write_to_output(d, "Do you wish to save your changes? : ");
	OLC_MODE(d) = MEDIT_CONFIRM_SAVESTRING;
      } else
	cleanup_olc(d, CLEANUP_ALL);
      return;
    case '1':
      OLC_MODE(d) = MEDIT_SEX;
      medit_disp_sex(d);
      return;
    case '2':
      OLC_MODE(d) = MEDIT_KEYWORD;
      i--;
      break;
    case '3':
      OLC_MODE(d) = MEDIT_S_DESC;
      i--;
      break;
    case '4':
      OLC_MODE(d) = MEDIT_L_DESC;
      i--;
      break;
    case '5':
      OLC_MODE(d) = MEDIT_D_DESC;
      send_editor_help(d);
      write_to_output(d, "Enter mob description:\r\n\r\n");
      if (OLC_MOB(d)->player.description) {
	write_to_output(d, "%s", OLC_MOB(d)->player.description);
	oldtext = strdup(OLC_MOB(d)->player.description);
      }
      string_write(d, &OLC_MOB(d)->player.description, MAX_MOB_DESC, 0, oldtext);
      OLC_VAL(d) = 1;
      return;
    case '6':
      OLC_MODE(d) = MEDIT_POS;
      medit_disp_positions(d);
      return;
    case '7':
      OLC_MODE(d) = MEDIT_DEFAULT_POS;
      medit_disp_positions(d);
      return;
    case '8':
      OLC_MODE(d) = MEDIT_ATTACK;
      medit_disp_attack_types(d);
      return;
    case '9':
      OLC_MODE(d) = MEDIT_STATS_MENU;
      medit_disp_stats_menu(d);
      return;
    case 'a':
    case 'A':
      OLC_MODE(d) = MEDIT_NPC_FLAGS;
      medit_disp_mob_flags(d);
      return;
    case 'b':
    case 'B':
      OLC_MODE(d) = MEDIT_AFF_FLAGS;
      medit_disp_aff_flags(d);
      return;
    case 'w':
    case 'W':
      write_to_output(d, "Copy what mob? ");
      OLC_MODE(d) = MEDIT_COPY;
      return;
    case 'x':
    case 'X':
      write_to_output(d, "Are you sure you want to delete this mobile? ");
      OLC_MODE(d) = MEDIT_DELETE;
      return;
    case 's':
    case 'S':
      OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
      dg_script_menu(d);
      return;
    default:
      medit_disp_menu(d);
      return;
    }
    if (i == 0)
      break;
    else if (i == 1)
      write_to_output(d, "\r\nEnter new value : ");
    else if (i == -1)
      write_to_output(d, "\r\nEnter new text :\r\n] ");
    else
      write_to_output(d, "Oops...\r\n");
    return;

  case MEDIT_STATS_MENU:
    i=0;
    switch(*arg) {
    case 'q':
    case 'Q':
      medit_disp_menu(d);
      return;
    case '1':  /* Edit level */
      OLC_MODE(d) = MEDIT_LEVEL;
      i++;
      break;
    case '2':  /* Autoroll stats */
      medit_autoroll_stats(d);
      medit_disp_stats_menu(d);
      OLC_VAL(d) = TRUE;
      return;
    case '3':
      OLC_MODE(d) = MEDIT_NUM_HP_DICE;
      i++;
      break;
    case '4':
      OLC_MODE(d) = MEDIT_SIZE_HP_DICE;
      i++;
      break;
    case '5':
      OLC_MODE(d) = MEDIT_ADD_HP;
      i++;
      break;
    case '6':
      OLC_MODE(d) = MEDIT_NDD;
      i++;
      break;
    case '7':
      OLC_MODE(d) = MEDIT_SDD;
      i++;
      break;
    case '8':
      OLC_MODE(d) = MEDIT_DAMROLL;
      i++;
      break;
    case 'a':
    case 'A':
      OLC_MODE(d) = MEDIT_AC;
      i++;
      break;
    case 'b':
    case 'B':
      OLC_MODE(d) = MEDIT_EXP;
      i++;
      break;
    case 'c':
    case 'C':
      OLC_MODE(d) = MEDIT_GOLD;
      i++;
      break;
    case 'd':
    case 'D':
      OLC_MODE(d) = MEDIT_HITROLL;
      i++;
      break;
    case 'e':
    case 'E':
      OLC_MODE(d) = MEDIT_ALIGNMENT;
      i++;
      break;
    case 'f':
    case 'F':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_STR;
      i++;
      break;
    case 'g':
    case 'G':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_INT;
      i++;
      break;
    case 'h':
    case 'H':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_WIS;
      i++;
      break;
    case 'i':
    case 'I':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_DEX;
      i++;
      break;
    case 'j':
    case 'J':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_CON;
      i++;
      break;
    case 'k':
    case 'K':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_CHA;
      i++;
      break;
    case 'l':
    case 'L':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_PARA;
      i++;
      break;
    case 'm':
    case 'M':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_ROD;
      i++;
      break;
    case 'n':
    case 'N':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_PETRI;
      i++;
      break;
    case 'o':
    case 'O':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_BREATH;
      i++;
      break;
    case 'p':
    case 'P':
      if (!CONFIG_MEDIT_ADVANCED) {
        write_to_output(d, "Invalid Choice!\r\nEnter Choice : ");
        return;
	  }
      OLC_MODE(d) = MEDIT_SPELL;
      i++;
      break;
    default:
      medit_disp_stats_menu(d);
      return;
    }
    if (i == 0)
      break;
    else if (i == 1)
      write_to_output(d, "\r\nEnter new value : ");
    else if (i == -1)
      write_to_output(d, "\r\nEnter new text :\r\n] ");
    else
      write_to_output(d, "Oops...\r\n");
    return;

  case OLC_SCRIPT_EDIT:
    if (dg_script_edit_parse(d, arg)) return;
    break;

  case MEDIT_KEYWORD:
    smash_tilde(arg);
    if (GET_ALIAS(OLC_MOB(d)))
      free(GET_ALIAS(OLC_MOB(d)));
    GET_ALIAS(OLC_MOB(d)) = str_udup(arg);
    break;

  case MEDIT_S_DESC:
    smash_tilde(arg);
    if (GET_SDESC(OLC_MOB(d)))
      free(GET_SDESC(OLC_MOB(d)));
    GET_SDESC(OLC_MOB(d)) = str_udup(arg);
    break;

  case MEDIT_L_DESC:
    smash_tilde(arg);
    if (GET_LDESC(OLC_MOB(d)))
      free(GET_LDESC(OLC_MOB(d)));
    if (arg && *arg) {
      char buf[MAX_INPUT_LENGTH];
      snprintf(buf, sizeof(buf), "%s\r\n", arg);
      GET_LDESC(OLC_MOB(d)) = strdup(buf);
    } else
      GET_LDESC(OLC_MOB(d)) = strdup("undefined");

    break;

  case MEDIT_D_DESC:
    /*
     * We should never get here.
     */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached D_DESC case!");
    write_to_output(d, "Oops...\r\n");
    break;

  case MEDIT_NPC_FLAGS:
    if ((i = atoi(arg)) <= 0)
      break;
    else if ( (j = medit_get_mob_flag_by_number(i)) == -1) {
       write_to_output(d, "Invalid choice!\r\n");
       write_to_output(d, "Enter mob flags (0 to quit) :");
       return;
    } else if (j <= NUM_MOB_FLAGS) {
      TOGGLE_BIT_AR(MOB_FLAGS(OLC_MOB(d)), (j));
    }
    medit_disp_mob_flags(d);
    return;

  case MEDIT_AFF_FLAGS:
    if ((i = atoi(arg)) <= 0)
      break;
    else if (i <= NUM_AFF_FLAGS)
      TOGGLE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), i);

    /* Remove unwanted bits right away. */
    REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_CHARM);
    REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_POISON);
    REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_GROUP);
    REMOVE_BIT_AR(AFF_FLAGS(OLC_MOB(d)), AFF_SLEEP);
    medit_disp_aff_flags(d);
    return;

/* Numerical responses. */

  case MEDIT_SEX:
    GET_SEX(OLC_MOB(d)) = LIMIT(i - 1, 0, NUM_GENDERS - 1);
    break;

  case MEDIT_HITROLL:
    GET_HITROLL(OLC_MOB(d)) = LIMIT(i, 0, 50);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_DAMROLL:
    GET_DAMROLL(OLC_MOB(d)) = LIMIT(i, 0, 50);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_NDD:
    GET_NDD(OLC_MOB(d)) = LIMIT(i, 0, 30);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_SDD:
    GET_SDD(OLC_MOB(d)) = LIMIT(i, 0, 127);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_NUM_HP_DICE:
    GET_HIT(OLC_MOB(d)) = LIMIT(i, 0, 30);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_SIZE_HP_DICE:
    GET_MANA(OLC_MOB(d)) = LIMIT(i, 0, 1000);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_ADD_HP:
    GET_MOVE(OLC_MOB(d)) = LIMIT(i, 0, 30000);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_AC:
    GET_AC(OLC_MOB(d)) = LIMIT(i, -200, 200);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_EXP:
    GET_EXP(OLC_MOB(d)) = LIMIT(i, 0, MAX_MOB_EXP);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_GOLD:
    GET_GOLD(OLC_MOB(d)) = LIMIT(i, 0, MAX_MOB_GOLD);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_STR:
    GET_STR(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_INT:
    GET_INT(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_WIS:
    GET_WIS(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_DEX:
    GET_DEX(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_CON:
    GET_CON(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_CHA:
    GET_CHA(OLC_MOB(d)) = LIMIT(i, 11, 25);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_PARA:
    GET_SAVE(OLC_MOB(d), SAVING_PARA) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_ROD:
    GET_SAVE(OLC_MOB(d), SAVING_ROD) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_PETRI:
    GET_SAVE(OLC_MOB(d), SAVING_PETRI) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_BREATH:
    GET_SAVE(OLC_MOB(d), SAVING_BREATH) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_SPELL:
    GET_SAVE(OLC_MOB(d), SAVING_SPELL) = LIMIT(i, 0, 100);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_POS:
    GET_POS(OLC_MOB(d)) = LIMIT(i - 1, 0, NUM_POSITIONS - 1);
    break;

  case MEDIT_DEFAULT_POS:
    GET_DEFAULT_POS(OLC_MOB(d)) = LIMIT(i - 1, 0, NUM_POSITIONS - 1);
    break;

  case MEDIT_ATTACK:
    GET_ATTACK(OLC_MOB(d)) = LIMIT(i, 0, NUM_ATTACK_TYPES - 1);
    break;

  case MEDIT_LEVEL:
    GET_LEVEL(OLC_MOB(d)) = LIMIT(i, 1, LVL_IMPL);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_ALIGNMENT:
    GET_ALIGNMENT(OLC_MOB(d)) = LIMIT(i, -1000, 1000);
    OLC_VAL(d) = TRUE;
    medit_disp_stats_menu(d);
    return;

  case MEDIT_COPY:
    if ((i = real_mobile(atoi(arg))) != NOWHERE) {
      medit_setup_existing(d, i);
    } else
      write_to_output(d, "That mob does not exist.\r\n");
    break;

  case MEDIT_DELETE:
    if (*arg == 'y' || *arg == 'Y') {
      if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))) != NOBODY)
        write_to_output(d, "Mobile deleted.\r\n");
      else
        write_to_output(d, "Couldn't delete the mobile!\r\n");

      cleanup_olc(d, CLEANUP_ALL);
      return;
    } else if (*arg == 'n' || *arg == 'N') {
      medit_disp_menu(d);
      OLC_MODE(d) = MEDIT_MAIN_MENU;
      return;
    } else
      write_to_output(d, "Please answer 'Y' or 'N': ");
    break;

  default:
    /* We should never get here. */
    cleanup_olc(d, CLEANUP_ALL);
    mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached default case!");
    write_to_output(d, "Oops...\r\n");
    break;
  }

/* END OF CASE If we get here, we have probably changed something, and now want
   to return to main menu.  Use OLC_VAL as a 'has changed' flag */

  OLC_VAL(d) = TRUE;
  medit_disp_menu(d);
}
예제 #26
0
파일: forget.c 프로젝트: Firehed/RotK
void do_forget(CHAR_DATA *ch, char *argument)
{
    CHAR_DATA *rch;
    char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH];
    DESCRIPTOR_DATA *d;
    int pos;
    bool found = FALSE;

    if (ch->desc == NULL)
	rch = ch;
    else
	rch = ch->desc->original ? ch->desc->original : ch;

    if (IS_NPC(rch))
	return;

    smash_tilde( argument );

    argument = one_argument(argument,arg);
    
    if (arg[0] == '\0')
    {
	if (rch->pcdata->forget[0] == NULL)
	{
	    send_to_char("You are not forgetting anyone.\n\r",ch);
	    return;
	}
	send_to_char("You are currently forgetting:\n\r",ch);

	for (pos = 0; pos < MAX_FORGET; pos++)
	{
	    if (rch->pcdata->forget[pos] == NULL)
		break;

	    sprintf(buf,"    %s\n\r",rch->pcdata->forget[pos]);
	    send_to_char(buf,ch);
	}
	return;
    }

    for (pos = 0; pos < MAX_FORGET; pos++)
    {
	if (rch->pcdata->forget[pos] == NULL)
	    break;

	if (!str_cmp(arg,rch->pcdata->forget[pos]))
	{
	    send_to_char("You have already forgotten that person.\n\r",ch);
	    return;
	}
    }

    for (d = descriptor_list; d != NULL; d = d->next)
    {
	CHAR_DATA *wch;

 	if (d->connected != CON_PLAYING || !can_see(ch,d->character))
	    continue;
	
	wch = ( d->original != NULL ) ? d->original : d->character;

 	if (!can_see(ch,wch))
	    continue;

	if (!str_cmp(arg,wch->name))
	{
	    found = TRUE;
	    if (wch == ch)
	    {
		send_to_char("You forget yourself for a moment, but it passes.\n\r",ch);
		return;
	    }
	    if (wch->level >= LEVEL_IMMORTAL)
	    {
		send_to_char("That person is very hard to forget.\n\r",ch);
		return;
	    }
	}
    }

    if (!found)
    {
	send_to_char("No one by that name is playing.\n\r",ch);
	return;
    }

    for (pos = 0; pos < MAX_FORGET; pos++)
    {
	if (rch->pcdata->forget[pos] == NULL)
	    break;
     }

     if (pos >= MAX_FORGET)
     {
	send_to_char("Sorry, you have reached the forget limit.\n\r",ch);
	return;
     }
  
     /* make a new forget */
     rch->pcdata->forget[pos]		= str_dup(arg);
     sprintf(buf,"You are now deaf to %s.\n\r",arg);
     send_to_char(buf,ch);
}
예제 #27
0
void mpedit( CHAR_DATA *ch, char *argument)
{
    MPROG_CODE *pMcode;
    char arg[MAX_INPUT_LENGTH];
    char command[MAX_INPUT_LENGTH];
    int cmd;
    AREA_DATA *ad;

    smash_tilde(argument);
    strcpy(arg, argument);
    argument = one_argument( argument, command);

    EDIT_MPCODE(ch, pMcode);

    if (pMcode)
    {
	ad = get_vnum_area( pMcode->vnum );

	if ( ad == NULL ) /* ??? */
	{
		edit_done(ch);
		return;
	}


  if(!IS_IMP(ch))
   {
    if((IS_SET(ad->area_flags, AREA_NOIMM))
    ||  (IS_SET(ad->area_flags, AREA_IMP)))
      {
          send_to_char(
          "\n\r{GIf you need something changed in this {WAREA{G, please note the IMPs!{x\n\r",ch);
          return;
      }
   }

    }

    if (command[0] == '\0')
    {
        mpedit_show(ch, argument);
        return;
    }

    if (!str_cmp(command, "done") )
    {
        edit_done(ch);
        return;
    }

    for (cmd = 0; mpedit_table[cmd].name != NULL; cmd++)
    {
	if (!str_prefix(command, mpedit_table[cmd].name) )
	{
		if ((*mpedit_table[cmd].olc_fun) (ch, argument) && pMcode)
			if ((ad = get_vnum_area(pMcode->vnum)) != NULL)
				SET_BIT(ad->area_flags, AREA_CHANGED);
		return;
	}
    }

    interpret(ch, arg);

    return;
}
예제 #28
0
파일: imm_host.c 프로젝트: jmdjr/sdf-mud
void do_add_imm_host( CHAR_DATA * ch, char *argument )
{
   char type[MAX_INPUT_LENGTH];
   char arg1[MAX_INPUT_LENGTH];
   char arg2[MAX_INPUT_LENGTH];
   char *name;
   IMMORTAL_HOST *temp, *host;

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

   set_char_color( AT_IMMORT, ch );

   if( type[0] == '\0' )
   {
      if( immortal_host_start == NULL )
      {
         send_to_char( "No immortals are protected at this time.\r\n", ch );
         return;
      }
      send_to_char( "Immortal   Host\r\n", ch );
      set_char_color( AT_PLAIN, ch );
      for( temp = immortal_host_start; temp; temp = temp->next )
         ch_printf( ch, "%-8s  %c%s%c\r\n",
                    temp->name, ( temp->prefix ? '*' : ' ' ), temp->host, ( temp->suffix ? '*' : ' ' ) );
      return;
   }

   /*
    * Ok we have a new entry make sure it doesn't contain a ~ 
    */
   if( !str_cmp( type, "save" ) )
   {
      do_write_imm_host(  );
      send_to_char( "Done.\r\n", ch );
      return;
   }

   if( arg2[0] == '\0' || arg1[0] == '\0' )
   {
      send_to_char( "Syntax: immhost add    <name> <host>\r\n", ch );
      send_to_char( "Syntax: immhost delete <name> <host>\r\n", ch );
      send_to_char( "Syntax: immhost save\r\n", ch );
      return;
   }

   if( !str_cmp( type, "delete" ) )
   {
      IMMORTAL_HOST *it = NULL;

      for( temp = immortal_host_start; temp; temp = temp->next )
      {
         if( !str_cmp( arg1, temp->name ) && !str_cmp( arg2, temp->host ) )
         {
            it = temp;
            break;
         }
      }
      if( it == NULL )
      {
         send_to_char( "Didn't find that entry.\r\n", ch );
         return;
      }
      DISPOSE( temp->name );
      DISPOSE( temp->host );
      UNLINK( it, immortal_host_start, immortal_host_end, next, prev );
      DISPOSE( it );
   }
   else if( !str_cmp( type, "add" ) )
   {
      bool prefix = FALSE, suffix = FALSE;
      int i;

      smash_tilde( arg1 );
      smash_tilde( arg2 );
      name = arg2;


      if( arg2[0] == '*' )
      {
         prefix = TRUE;
         name++;
      }

      if( name[strlen( name ) - 1] == '*' )
      {
         suffix = TRUE;
         name[strlen( name ) - 1] = '\0';
      }

      arg1[0] = toupper( arg1[0] );
      for( i = 0; i < ( int )strlen( name ); i++ )
         name[i] = LOWER( name[i] );
      for( temp = immortal_host_start; temp; temp = temp->next )
      {
         if( !str_cmp( temp->name, arg1 ) && !str_cmp( temp->host, name ) )
         {
            send_to_char( "Entry already exists.\r\n", ch );
            return;
         }
      }
      CREATE( host, IMMORTAL_HOST, 1 );
      host->name = str_dup( arg1 );
      host->host = str_dup( name );
      host->prefix = prefix;
      host->suffix = suffix;
      LINK( host, immortal_host_start, immortal_host_end, next, prev );
   }
   else
   {
      send_to_char( "Syntax: immhost add    <name> <host>\r\n", ch );
      send_to_char( "Syntax: immhost delete <name> <host>\r\n", ch );
      send_to_char( "Syntax: immhost save\r\n", ch );
      return;
   }
   send_to_char( "Done.\r\n", ch );
   return;
}
예제 #29
0
파일: dg_olc.c 프로젝트: bigmac12/Mac-s-CWG
void trigedit_parse(struct descriptor_data *d, char *arg)
{
  int i = 0;

  switch (OLC_MODE(d)) {
    case TRIGEDIT_MAIN_MENU:
     switch (tolower(*arg)) {
       case 'q':
         if (OLC_VAL(d)) { /* Anything been changed? */
           if (!GET_TRIG_TYPE(OLC_TRIG(d))) {
             write_to_output(d, "Invalid Trigger Type! Answer a to abort quit!\r\n");
           }
           write_to_output(d, "Do you wish to save your changes? : ");
           OLC_MODE(d) = TRIGEDIT_CONFIRM_SAVESTRING;
         } else
           cleanup_olc(d, CLEANUP_ALL);
           return;
         case '1':
           OLC_MODE(d) = TRIGEDIT_NAME;
           write_to_output(d, "Name: ");
           break;
         case '2':
           OLC_MODE(d) = TRIGEDIT_INTENDED;
           write_to_output(d, "0: Mobiles, 1: Objects, 2: Rooms: ");
           break;
         case '3':
           OLC_MODE(d) = TRIGEDIT_TYPES;
           trigedit_disp_types(d);
           break;
         case '4':
           OLC_MODE(d) = TRIGEDIT_NARG;
           write_to_output(d, "Numeric argument: ");
           break;
         case '5':
           OLC_MODE(d) = TRIGEDIT_ARGUMENT;
           write_to_output(d, "Argument: ");
           break;
         case '6':
           OLC_MODE(d) = TRIGEDIT_COMMANDS;
           write_to_output(d, "Enter trigger commands: (/s saves /h for help)\r\n\r\n");
           d->backstr = NULL;
           if (OLC_STORAGE(d)) {
             write_to_output(d, "%s", OLC_STORAGE(d));
             d->backstr = strdup(OLC_STORAGE(d));
           }
           d->str = &OLC_STORAGE(d);
           d->max_str = MAX_CMD_LENGTH;
           d->mail_to = 0;
           OLC_VAL(d) = 1;

           break;
         default:
           trigedit_disp_menu(d);
           return;
     }
     return;
    
    case TRIGEDIT_CONFIRM_SAVESTRING:
      switch(tolower(*arg)) {
        case 'y':
          trigedit_save(d);
          mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE,
                 "OLC: %s edits trigger %d", GET_NAME(d->character),
                 OLC_NUM(d));
          /* fall through */
        case 'n':
          cleanup_olc(d, CLEANUP_ALL);
          return;
        case 'a': /* abort quitting */
          break;
        default:
          write_to_output(d, "Invalid choice!\r\n");
          write_to_output(d, "Do you wish to save the trigger? : ");
          return;
      }
      break;

    case TRIGEDIT_NAME:
      smash_tilde(arg);
      if (OLC_TRIG(d)->name)
        free(OLC_TRIG(d)->name);
      OLC_TRIG(d)->name = strdup((arg && *arg) ? arg : "undefined");
      OLC_VAL(d)++;
      break;

    case TRIGEDIT_INTENDED:
      if ((atoi(arg)>=MOB_TRIGGER) || (atoi(arg)<=WLD_TRIGGER))
        OLC_TRIG(d)->attach_type = atoi(arg);
      OLC_VAL(d)++;
      break;

    case TRIGEDIT_NARG:
      OLC_TRIG(d)->narg = LIMIT(atoi(arg), 0, 100);
      OLC_VAL(d)++;
      break;

    case TRIGEDIT_ARGUMENT:
      smash_tilde(arg);
      OLC_TRIG(d)->arglist = (*arg?strdup(arg):NULL);
      OLC_VAL(d)++;
      break;

    case TRIGEDIT_TYPES:
      if ((i = atoi(arg)) == 0)
        break;
      else if (!((i < 0) || (i > NUM_TRIG_TYPE_FLAGS)))
        TOGGLE_BIT((GET_TRIG_TYPE(OLC_TRIG(d))), 1 << (i - 1));
      OLC_VAL(d)++;
      trigedit_disp_types(d);
      return;

    case TRIGEDIT_COMMANDS:
      break;

  }

  OLC_MODE(d) = TRIGEDIT_MAIN_MENU;
  trigedit_disp_menu(d);
}
예제 #30
0
파일: comments.c 프로젝트: jmdjr/sdf-mud
void do_comment( CHAR_DATA * ch, char *argument )
{
   char buf[MAX_STRING_LENGTH];
   char arg[MAX_INPUT_LENGTH];
   char arg1[MAX_INPUT_LENGTH];
   NOTE_DATA *pnote;
   CHAR_DATA *victim;
   int vnum;
   int anum;

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

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

   /*
    * Put in to prevent crashing when someone issues a comment command
    * from within the editor. -Narn 
    */
   if( ch->desc->connected == CON_EDITING || ch->desc->connected == CON_NOTE_TO )
   {
      send_to_char( "You can't use the comment command from within the editor.\r\n", ch );
      return;
   }

   switch ( ch->substate )
   {
      default:
         break;
      case SUB_WRITING_NOTE:
         if( !ch->pnote )
         {
            bug( "do_comment: note got lost?", 0 );
            send_to_char( "Your note got lost!\r\n", ch );
            stop_editing( ch );
            return;
         }
         if( ch->dest_buf != ch->pnote )
            bug( "do_comment: sub_writing_note: ch->dest_buf != ch->pnote", 0 );
         STRFREE( ch->pnote->text );
         ch->pnote->text = copy_buffer( ch );
         stop_editing( ch );
         return;
   }

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

   if( !str_cmp( arg, "about" ) )
   {

      victim = get_char_world( ch, argument );
      if( !victim )
      {
         send_to_char( "They're not logged on!\r\n", ch );  /* maybe fix this? */
         return;
      }

      if( IS_NPC( victim ) )
      {
         send_to_char( "No comments about mobs\r\n", ch );
         return;
      }


   }


   if( !str_cmp( arg, "list" ) )
   {
      victim = get_char_world( ch, argument );
      if( !victim )
      {
         send_to_char( "They're not logged on!\r\n", ch );  /* maybe fix this? */
         return;
      }

      if( IS_NPC( victim ) )
      {
         send_to_char( "No comments about mobs\r\n", ch );
         return;
      }

      if( get_trust( victim ) >= get_trust( ch ) )
      {
         send_to_char( "You're not of the right caliber to do this...\r\n", ch );
         return;
      }

      if( !victim->comments )
      {
         send_to_char( "There are no relevant comments.\r\n", ch );
         return;
      }

      vnum = 0;
      for( pnote = victim->comments; pnote; pnote = pnote->next )
      {
         vnum++;
         sprintf( buf, "%2d) %-10s [%s] %s\r\n", vnum, pnote->sender, pnote->date, pnote->subject );
/* Brittany added date to comment list and whois with above change */
         send_to_char( buf, ch );
      }

      /*
       * act( AT_ACTION, "$n glances over the notes.", ch, NULL, NULL, TO_ROOM ); 
       */
      return;
   }

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

      argument = one_argument( argument, arg1 );
      victim = get_char_world( ch, arg1 );
      if( !victim )
      {
         send_to_char( "They're not logged on!\r\n", ch );  /* maybe fix this? */
         return;
      }

      if( IS_NPC( victim ) )
      {
         send_to_char( "No comments about mobs\r\n", ch );
         return;
      }

      if( get_trust( victim ) >= get_trust( ch ) )
      {
         send_to_char( "You're not of the right caliber to do this...\r\n", ch );
         return;
      }

      if( !victim->comments )
      {
         send_to_char( "There are no relevant comments.\r\n", ch );
         return;
      }



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

      vnum = 0;
      for( pnote = victim->comments; pnote; pnote = pnote->next )
      {
         vnum++;
         if( vnum == anum || fAll )
         {
            sprintf( buf, "[%3d] %s: %s\r\n%s\r\nTo: %s\r\n",
                     vnum, pnote->sender, pnote->subject, pnote->date, pnote->to_list );
            send_to_char( buf, ch );
            send_to_char( pnote->text, ch );
            /*
             * act( AT_ACTION, "$n reads a note.", ch, NULL, NULL, TO_ROOM ); 
             */
            return;
         }
      }

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

   if( !str_cmp( arg, "write" ) )
   {
      note_attach( ch );
      ch->substate = SUB_WRITING_NOTE;
      ch->dest_buf = ch->pnote;
      start_editing( ch, ch->pnote->text );
      return;
   }

   if( !str_cmp( arg, "subject" ) )
   {
      note_attach( ch );
      STRFREE( ch->pnote->subject );
      ch->pnote->subject = STRALLOC( argument );
      send_to_char( "Ok.\r\n", ch );
      return;
   }

   if( !str_cmp( arg, "to" ) )
   {
      note_attach( ch );
      STRFREE( ch->pnote->to_list );
      ch->pnote->to_list = STRALLOC( argument );
      send_to_char( "Ok.\r\n", ch );
      return;
   }

   if( !str_cmp( arg, "clear" ) )
   {
      if( ch->pnote )
      {
         STRFREE( ch->pnote->text );
         STRFREE( ch->pnote->subject );
         STRFREE( ch->pnote->to_list );
         STRFREE( ch->pnote->date );
         STRFREE( ch->pnote->sender );
         DISPOSE( ch->pnote );
      }
      ch->pnote = NULL;

      send_to_char( "Ok.\r\n", ch );
      return;
   }

   if( !str_cmp( arg, "show" ) )
   {
      if( !ch->pnote )
      {
         send_to_char( "You have no comment in progress.\r\n", ch );
         return;
      }

      sprintf( buf, "%s: %s\r\nTo: %s\r\n", ch->pnote->sender, ch->pnote->subject, ch->pnote->to_list );
      send_to_char( buf, ch );
      send_to_char( ch->pnote->text, ch );
      return;
   }

   if( !str_cmp( arg, "post" ) )
   {
      char *strtime;

      if( !ch->pnote )
      {
         send_to_char( "You have no comment in progress.\r\n", ch );
         return;
      }

      argument = one_argument( argument, arg1 );
      victim = get_char_world( ch, arg1 );
      if( !victim )
      {
         send_to_char( "They're not logged on!\r\n", ch );  /* maybe fix this? */
         return;
      }

      if( IS_NPC( victim ) )
      {
         send_to_char( "No comments about mobs\r\n", ch );
         return;
      }

      if( get_trust( victim ) > get_trust( ch ) )
      {
         send_to_char( "You're not of the right caliber to do this...\r\n", ch );
         return;
      }

      /*
       * act( AT_ACTION, "$n posts a note.", ch, NULL, NULL, TO_ROOM ); 
       */

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

      pnote = ch->pnote;
      ch->pnote = NULL;


      /*
       * LIFO to make life easier 
       */
      pnote->next = victim->comments;
      if( victim->comments )
         victim->comments->prev = pnote;
      pnote->prev = NULL;
      victim->comments = pnote;

      save_char_obj( victim );


#ifdef NOTDEFD
      fclose( fpReserve );
      sprintf( notefile, "%s/%s", BOARD_DIR, board->note_file );
      if( ( fp = fopen( notefile, "a" ) ) == NULL )
      {
         perror( notefile );
      }
      else
      {
         fprintf( fp, "Sender  %s~\nDate    %s~\nTo      %s~\nSubject %s~\nText\n%s~\n\n",
                  pnote->sender, pnote->date, pnote->to_list, pnote->subject, pnote->text );
         fclose( fp );
      }
      fpReserve = fopen( NULL_FILE, "r" );
#endif

      send_to_char( "Ok.\r\n", ch );
      return;
   }

   if( !str_cmp( arg, "remove" ) )
   {
      argument = one_argument( argument, arg1 );
      victim = get_char_world( ch, arg1 );
      if( !victim )
      {
         send_to_char( "They're not logged on!\r\n", ch );  /* maybe fix this? */
         return;
      }

      if( IS_NPC( victim ) )
      {
         send_to_char( "No comments about mobs\r\n", ch );
         return;
      }

      if( ( get_trust( victim ) >= get_trust( ch ) ) || ( get_trust( ch ) < 58 ) )  /* switch to some LEVEL_ thingie */
      {
         send_to_char( "You're not of the right caliber to do this...\r\n", ch );
         return;
      }

      /*
       * argument = one_argument(argument, arg); 
       */
      if( !is_number( argument ) )
      {
         send_to_char( "Comment remove which number?\r\n", ch );
         return;
      }

      anum = atoi( argument );
      vnum = 0;
      for( pnote = victim->comments; pnote; pnote = pnote->next )
      {
         vnum++;
         if( ( 58 <= get_trust( ch ) ) /* switch to some LEVEL_ thingie */
             && ( vnum == anum ) )
         {
            comment_remove( victim, pnote );
            send_to_char( "Ok.\r\n", ch );
            /*
             * act( AT_ACTION, "$n removes a note.", ch, NULL, NULL, TO_ROOM ); 
             */
            return;
         }
      }

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

   send_to_char( "Type 'help comment' for usage (i hope!).\r\n", ch );
   return;
}