Exemplo n.º 1
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;
}
Exemplo n.º 2
0
/* 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;
}
Exemplo n.º 3
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;
}
Exemplo n.º 4
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 ;
}
Exemplo n.º 5
0
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;
}
Exemplo n.º 6
0
/* 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;
}
Exemplo n.º 7
0
void gedit( CHAR_DATA *ch, char *argument)
{
    struct group_type *pGroup;
    char arg[MAX_INPUT_LENGTH];
    char command[MAX_INPUT_LENGTH];
    int cmd;

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

    EDIT_GROUP(ch, pGroup);
    if (ch->pcdata->security < 5)
    {
        send_to_char("SKEdit: Insuficiente seguridad para modificar grupo.\n\r",ch);
        edit_done(ch);
        return;
    }

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

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

    if (!str_cmp(command, "save") )
    {
    	save_groups();
    	return;
    }

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

    interpret(ch, arg);
    return;
}
Exemplo n.º 8
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;
}
Exemplo n.º 9
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;
}
Exemplo n.º 10
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;
}
Exemplo n.º 11
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;
}
Exemplo n.º 12
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 ;
}
Exemplo n.º 13
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;
}
Exemplo n.º 14
0
void mpedit( CHAR_DATA *ch, char *argument )
{
    PROG_CODE * pMcode;
    char arg[ MAX_INPUT_LENGTH ];
    char command[ MAX_INPUT_LENGTH ];
    char log_buf[ MAX_STRING_LENGTH ];
    int cmd;
    AREA_DATA *ad;

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

    EDIT_MPCODE( ch, pMcode );

    if ( pMcode )
    {
        ad = pMcode->area;

        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 = pMcode->area ) != NULL )
                {
                    SET_BIT( ad->area_flags, AREA_CHANGED );
                }
                append_file_format_daily( ch, BUILD_LOG_FILE, "-> mpedit %s: %s", pMcode ? pMcode->name: "0", arg );
            }
            return ;
        }
    }

    interpret( ch, arg );

    return ;
}
Exemplo n.º 15
0
static void
mode_edit(int fd, int page, int edit, int argc, char *argv[])
{
	int i;
	u_char data[255];
	u_char *mode_pars;
	struct mode_header
	{
		u_char mdl;	/* Mode data length */
		u_char medium_type;
		u_char dev_spec_par;
		u_char bdl;	/* Block descriptor length */
	};

	struct mode_page_header
	{
		u_char page_code;
		u_char page_length;
	};

	struct mode_header *mh;
	struct mode_page_header *mph;

	char *fmt = mode_lookup(page);
	if (!fmt && verbose) {
		fprintf(stderr,
		"No mode data base entry in \"%s\" for page %d;  binary %s only.\n",
		mode_db, page, (edit ? "edit" : "display"));
	}

	if (edit) {
		if (!fmt) {
			fprintf(stderr, "Sorry: can't edit without a format.\n");
			exit(1);
		}

		if (pagectl != 0 && pagectl != 3) {
			fprintf(stderr,
"It only makes sense to edit page 0 (current) or page 3 (saved values)\n");
			exit(1);
		}

		verbose = 1;

		mode_sense(fd, data, sizeof(data), 1, page);

		mh = (struct mode_header *)data;
		mph = (struct mode_page_header *)
		(((char *)mh) + sizeof(*mh) + mh->bdl);

		mode_pars = (char *)mph + sizeof(*mph);

		edit_init();
		scsireq_buff_decode_visit(mode_pars, mh->mdl,
		fmt, edit_check, 0);

		mode_sense(fd, data, sizeof(data), 0, page);

		edit_rewind();
		scsireq_buff_decode_visit(mode_pars, mh->mdl,
		fmt, edit_defaults, 0);

		edit_rewind();
		scsireq_buff_decode_visit(mode_pars, mh->mdl,
		fmt, edit_report, 0);

		fclose(edit_file);
		if (editit(edit_name) == -1 && errno != ECHILD)
			err(1, "edit %s", edit_name);
		if ((edit_file = fopen(edit_name, "r")) == NULL)
			err(1, "open %s", edit_name);

		edit_rewind();
		scsireq_buff_encode_visit(mode_pars, mh->mdl,
		fmt, edit_get, 0);

		/* Eliminate block descriptors:
		 */
		bcopy((char *)mph, ((char *)mh) + sizeof(*mh),
		sizeof(*mph) + mph->page_length);

		mh->bdl = 0;
		mph = (struct mode_page_header *) (((char *)mh) + sizeof(*mh));
		mode_pars = ((char *)mph) + 2;

#if 0
		/* Turn this on to see what you're sending to the
		 * device:
		 */
		edit_rewind();
		scsireq_buff_decode_visit(mode_pars,
		mh->mdl, fmt, arg_put, 0);
#endif

		edit_done();

		/* Make it permanent if pageselect is three.
		 */

		mph->page_code &= ~0xC0;	/* Clear PS and RESERVED */
		mh->mdl = 0;				/* Reserved for mode select */

		mode_select(fd, (char *)mh,
		sizeof(*mh) + mh->bdl + sizeof(*mph) + mph->page_length,
		(pagectl == 3));

		exit(0);
	}

	mode_sense(fd, data, sizeof(data), pagectl, page);

	/* Skip over the block descriptors.
	 */
	mh = (struct mode_header *)data;
	mph = (struct mode_page_header *)(((char *)mh) + sizeof(*mh) + mh->bdl);
	mode_pars = (char *)mph + sizeof(*mph);

	if (!fmt) {
		for (i = 0; i < mh->mdl; i++) {
			printf("%02x%c",mode_pars[i],
			(((i + 1) % 8) == 0) ? '\n' : ' ');
		}
		putc('\n', stdout);
	} else {
			verbose = 1;
			scsireq_buff_decode_visit(mode_pars,
			mh->mdl, fmt, arg_put, 0);
	}
}