/* I was assigned this task actually on another mud, armageddon.gargoyle.net * port 4000. and i think it is one of my better pieces of code. so i figured * that I'd put it up on my snippets site.. -Gangien gangien@dod.hpi.net * also.. if you install this you'll have to do cedit type too all of * your immortal commands because the default is mortal. */ to act_wiz.c: /*added this to top of act_wiz.c*/ int type_found( int type, int level ); /*added this to just before wizhelp*/ int type_found( int type, int level ) { int hash; CMDTYPE * cmd; if ( type != 0 && type != 1 && type != 2 && type != 3 && type != 4 && typ e != 5 ) { bug("Invalid type_found type for function"); return FALSE; } for ( hash = 0; hash < 126; hash++ ) for ( cmd = command_hash[hash]; cmd; cmd = cmd->next ) if ( cmd->level >= LEVEL_HERO && cmd->level <= level && cmd->type == type ) return TRUE; return FALSE; } /*changed wizhelp to be this*/ void do_wizhelp( CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; CMDTYPE * cmd; int col, hash; int type; argument = one_argument ( argument, arg ); if ( arg[0] == '\0') type = -1; else if( !str_cmp( arg, "mortal") ) type = 0; else if( !str_cmp( arg, "misc") ) type = 1; else if( !str_cmp( arg, "admin") ) type = 2; else if( !str_cmp( arg, "punish") ) type = 3; else if( !str_cmp( arg, "general")) type = 4; else if( !str_cmp( arg, "build") ) type = 5; else { send_to_char("No such type of command.\n\r", ch); return; } col = 0; set_pager_color( AT_GREY, ch ); if( type == -1 ) for (type = 0; type <=5; type++) { if( type_found( type, get_trust( ch ) ) == TRUE ) ch_printf_color(ch, "\n\r&R%s Commands:&C\n\r", type == 0 ? "Mortal" : type == 1 ? "Misc" : type == 2 ? "Admin" : type == 3 ? "Punish" : type == 4 ? "General" : "Build" ); for ( hash = 0; hash < 126; hash++ ) for ( cmd = command_hash[hash]; cmd; cmd = cmd->next ) if ( cmd->level >= LEVEL_HERO && cmd->level <= get_trust( ch ) && cmd->type == type ) { pager_printf( ch, "%-12s", cmd->name ); if ( ++col % 6 == 0 ) send_to_pager( "\n\r", ch ); } send_to_char( "\n\r", ch); } else { if( type_found( type, get_trust( ch ) ) == TRUE ) ch_printf_color(ch, "\n\r&R%s Commands:&C\n\r", type == 0 ? "Mortal" : type == 1 ? "Misc" : type == 2 ? "Admin" : type == 3 ? "Punish" : type == 4 ? "General" : "Build" ); for ( hash = 0; hash < 126; hash++ ) for ( cmd = command_hash[hash]; cmd; cmd = cmd->next ) if ( cmd->level >= LEVEL_HERO && cmd->level <= get_trust( ch ) && cmd->type == type ) { pager_printf( ch, "%-12s", cmd->name ); if ( ++col % 6 == 0 ) send_to_pager( "\n\r", ch ); } } send_to_pager( "\n\r", ch ); return; } in the function do_cedit { send_to_char( "Syntax: cedit create [code]\n\r", ch ); send_to_char( "Syntax: cedit delete\n\r", ch ); send_to_char( "Syntax: cedit show\n\r", ch ); send_to_char( "Syntax: cedit raise\n\r", ch ); send_to_char( "Syntax: cedit lower\n\r", ch ); send_to_char( "Syntax: cedit list\n\r", ch ); added + send_to_char( "Syntax: cedit type [type]\n\r",ch); send_to_char( "Syntax: cedit [field]\n\r", ch ); added these two lines + send_to_char( "\n\rType being one of:\n\r",ch); + send_to_char( "0=mortal, 1=misc, 2=admin, 3=punish, 4=general 5=build\n\r"ch); send_to_char( "\n\rField being one of:\n\r", ch ); send_to_char( " level position log code flags\n\r", ch ); } return; command = find_command( arg1 ); if ( get_trust(ch) > LEVEL_SUB_IMPLEM && !str_cmp( arg2, "create" ) ) { if ( command ) { send_to_char( "That command already exists!\n\r", ch ); return; } CREATE( command, CMDTYPE, 1 ); command->lag_count = 0; /* FB */ command->name = str_dup( arg1 ); command->level = get_trust(ch); added this line + command->type = 0; else sprintf( arg2, "do_%s", arg1 ); command->do_fun = skill_function( arg2 ); add_command( command ); send_to_char( "Command added.\n\r", ch ); if ( command->do_fun == skill_notfound ) ch_printf( ch, "Code %s not found. Set to no code.\n\r", arg2 ); return; } after if ( command->level > get_trust(ch) ) { send_to_char( "You cannot touch this command.\n\r", ch ); return; } changed if ( arg2[0] == '\0' || !str_cmp( arg2, "show" ) ) { ch_printf( ch, "Command: %s\n\rLevel: %d\n\rPosition: %d\n\rLog: %d\n\rCode: %s\n\rType: %s\n\rFlags: %s\n\r", command->name, command->level, command->position, command->log, skill_name(command->do_fun), command->type == 0 ? "Mortal" : command->type == 1 ? "Misc" : command->type == 2 ? "Admin" : command->type == 3 ? "Punish" : command->type == 4 ? "General" : "Build", flag_string(command->flags, cmd_flags)); if ( command->userec.num_uses ) } after if ( !str_cmp( arg2, "code" ) ) { DO_FUN *fun = skill_function( argument ); if ( fun == skill_notfound ) { send_to_char( "Code not found.\n\r", ch ); return; } command->do_fun = fun; send_to_char( "Done.\n\r", ch ); return; } added if( !str_cmp( arg2, "type" ) ) { int type = atoi( argument ); if ( type != 0 && type != 1 && type != 2 && type != 3 && type != 4 && type != 5) { send_to_char( "Invalid argument.\n\r" ,ch); return; } command->type = type; send_to_char( "Done.\n\r", ch); return; } to tables.c in the function fread_command case 'T': KEY( "Type", command->type, fread_number(fp) ); break; after if ( command->position < 100 ) fprintf( fpout, "Position %d\n", command->position+10 0); else fprintf( fpout, "Position %d\n", command->position); add fprintf( fpout, "Type %d\n", command->type); and in mud.h after sh_int position; add sh_int type;