void do_mpedit(CHAR_DATA *ch, char *argument) { MPROG_CODE *pMcode; char command[MAX_INPUT_LENGTH]; argument = one_argument(argument, command); if( is_number(command) ) { int vnum = atoi(command); AREA_DATA *ad; if ( (pMcode = get_mprog_index(vnum)) == NULL ) { send_to_char("MPEdit : That vnum does not exist.\n\r",ch); return; } ad = get_vnum_area(vnum); if ( ad == NULL ) { send_to_char( "MPEdit : VNUM no asignado a ningun area.\n\r", 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; } } ch->desc->pEdit = (void *)pMcode; ch->desc->editor = ED_MPCODE; return; } if ( !str_cmp(command, "create") ) { if (argument[0] == '\0') { send_to_char( "Sintaxis : mpedit create [vnum]\n\r", ch ); return; } mpedit_create(ch, argument); return; } send_to_char( "Sintaxis : mpedit [vnum]\n\r", ch ); send_to_char( " mpedit create [vnum]\n\r", ch ); return; }
/* * Lets the mobile to call another MOBprogram withing a MOBprogram. * This is a crude way to implement subroutines/functions. Beware of * nested loops and unwanted triggerings... Stack usage might be a problem. * Characters and objects referred to must be in the same room with the * mobile. * * Syntax: mob call [vnum] [victim|'null'] [object1|'null'] [object2|'null'] * */ void do_mpcall(CHAR_DATA * ch, char *argument) { char arg[MAX_INPUT_LENGTH]; CHAR_DATA *vch; OBJ_DATA *obj1, *obj2; MPROG_CODE *prg; extern void program_flow(sh_int, char *, CHAR_DATA *, CHAR_DATA *, const void *, const void *); argument = one_argument(argument, arg); if (arg[0] == '\0') { bug("MpCall: missing arguments from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0); return; } if ((prg = get_mprog_index(atoi(arg))) == NULL) { bug("MpCall: invalid prog from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0); return; } vch = NULL; obj1 = obj2 = NULL; argument = one_argument(argument, arg); if (arg[0] != '\0') vch = get_char_room(ch, arg); argument = one_argument(argument, arg); if (arg[0] != '\0') obj1 = get_obj_here(ch, arg); argument = one_argument(argument, arg); if (arg[0] != '\0') obj2 = get_obj_here(ch, arg); program_flow(prg->vnum, prg->code, ch, vch, (void *) obj1, (void *) obj2); }
void do_mpedit (CHAR_DATA * ch, char *argument) { MPROG_CODE *pMcode; char command[MAX_INPUT_LENGTH]; argument = one_argument (argument, command); if (is_number (command)) { int vnum = atoi (command); AREA_DATA *ad; if ((pMcode = get_mprog_index (vnum)) == NULL) { send_to_char ("MPEdit : That vnum does not exist.\n\r", ch); return; } ad = get_vnum_area (vnum); if (ad == NULL) { send_to_char ("MPEdit : VNUM no asignado a ningun area.\n\r", ch); return; } if (!IS_BUILDER (ch, ad)) { send_to_char ("MPEdit : Insuficiente seguridad para editar area.\n\r", ch); return; } ch->desc->pEdit = (void *) pMcode; ch->desc->editor = ED_MPCODE; return; } if (!str_cmp (command, "create")) { if (argument[0] == '\0') { send_to_char ("Sintaxis : mpedit create [vnum]\n\r", ch); return; } mpedit_create (ch, argument); return; } send_to_char ("Sintaxis : mpedit [vnum]\n\r", ch); send_to_char (" mpedit create [vnum]\n\r", ch); return; }
void do_mpedit(CHAR_DATA *ch, char *argument) { MPROG_CODE *pMcode; char command[MAX_INPUT_LENGTH]={'\0'}; argument = one_argument(argument, command); if( is_number(command) ) { int vnum = atoi(command); AREA_DATA *ad; if ( (pMcode = get_mprog_index(vnum)) == NULL ) { send_to_char("MPEdit : That vnum does not exist.\n\r",ch); return; } ad = get_vnum_area(vnum); if ( ad == NULL ) { send_to_char( "MPEdit : That vnum has not been assigned to an area.\n\r", ch ); return; } if ( !IS_BUILDER(ch, ad) ) { send_to_char("MPEdit : You do not have access to that area.\n\r", ch ); return; } ch->desc->pEdit = (void *)pMcode; ch->desc->editor = ED_MPCODE; return; } if ( !str_cmp(command, "create") ) { if (IS_NULLSTR(argument)) { send_to_char( "Syntax : mpedit create [vnum]\n\r", ch ); return; } mpedit_create(ch, argument); return; } send_to_char( "Syntax : mpedit [vnum]\n\r", ch ); send_to_char( " mpedit create [vnum]\n\r", ch ); return; }
/* * Displays the source code of a given MOBprogram * * Syntax: mpdump [vnum] */ void do_mpdump(CHAR_DATA * ch, char *argument) { char buf[MAX_INPUT_LENGTH]; MPROG_CODE *mprg; one_argument(argument, buf); if ((mprg = get_mprog_index(atoi(buf))) == NULL) { send_to_char("No such MOBprogram.\n\r", ch); return; } page_to_char(mprg->code, ch); }
void do_mpedit( CHAR_DATA *ch, char *argument ) { PROG_CODE * pMcode; AREA_DATA *ad; char command[ MAX_INPUT_LENGTH ]; argument = one_argument( argument, command ); if ( command[0] == '\0' ) { send_to_char( "MPEdit: Skladnia : mpedit [name]\n\r", ch ); send_to_char( " mpedit create [name]\n\r", ch ); } if ( !str_cmp( command, "create" ) ) { if ( argument[ 0 ] == '\0' ) { send_to_char( "RPEdit: Sk³adnia: mpedit create [name]\n\r", ch ); return ; } mpedit_create( ch, argument ); return ; } if ( ( pMcode = get_mprog_index( command ) ) == NULL ) { print_char( ch, "MPEdit : Mobprog o nazwie '%s' nie istnieje.\n\r", command ); return ; } ad = pMcode->area; if ( ad && !IS_BUILDER( ch, ad ) ) { send_to_char( "MPEdit : Niewystarczaj±ce uprawnienia.\n\r", ch ); return ; } ch->desc->pEdit = ( void * ) pMcode; ch->desc->editor = ED_MPCODE; return ; }
void save_mobprogs( FILE *fp, AREA_DATA *pArea ) { MPROG_CODE *pMprog; int i; fprintf(fp, "#MOBPROGS\n"); for( i = pArea->min_vnum; i <= pArea->max_vnum; i++ ) { if ( (pMprog = get_mprog_index(i) ) !=NULL) { fprintf(fp, "#%d\n", i); fprintf(fp, "%s~\n", fix_string(pMprog->code)); } } fprintf(fp,"#0\n\n"); return; }
void do_mpedit (CHAR_DATA * ch, char *argument) { MPROG_CODE *pMcode; char command[MAX_INPUT_LENGTH]; if (IS_NPC (ch) || ch->pcdata->security < 7) { send_to_char ("MPEdit: Insufficient security to modify code.\n\r", ch); return; } argument = one_argument (argument, command); if (is_number (command)) { if (!(pMcode = get_mprog_index (atoi (command)))) { send_to_char ("MPEdit: That vnum does not exist.\n\r", ch); return; } ch->desc->pEdit = (void *) pMcode; ch->desc->editor = ED_MPCODE; return; } if (!str_cmp (command, "create")) { if (argument[0] == '\0') { send_to_char ("Syntax: edit code create [vnum]\n\r", ch); return; } if (mpedit_create (ch, argument)) ch->desc->editor = ED_MPCODE; } return; }