The do_order bug for EmberMUD Fix Sheet by Rindar (Ron Cole) Fixes by Raven (Laurie Zenner) The Bug: Because of the nature of "next-generation" MUDs that have been built on top of each-other, a number of bugs can appear when new features are added and the old ones are not completely understood. Such bugs now appear in the ORDER command. For instance, having a player character charmed is bad enough, but if the PC's master orders him or her to DELETE.. well, that is just a bit unfair. And.. do you think the originally mobprog designer wanted those programs to be accessible to player characters who could order their charmed MOBs to execute them? We think not. The Check: If your MUD allows PC's to be charmed, charm a test subject and then order them to DELETE, then order them to PASSWORD. If you can order them to do these things, you have the bug. Next, charm a mob. Order them to do any of the mobprog functions. The easiest to test is MPSTAT. If you can get it to MPSTAT another mob, you also have the bug. The Bugfix: You need to replace the do_order command with one that includes checks for specific commands. One such fix has been included with this sheet, and is at the very bottom. Here is how to install it: 1) Make sure you have the function chk_command installed. If not, download the function and install it. 2) Open act_comm.c. 3) Find the function "void do_order" within act_comm.c. 4) Delete it and install the improved function. 5) Recompile. You are done. All done! If you find other bugs within the Order function or you have some other improvements, please feel free to send them along to me. My e-mail address is below. -= Rindar clogar@concentric.net ** Note: This function is provided "as is" and may be used so long as 1) The author's name is kept at the top of the function (if requested) and 2) all other previous licensing aggreements are abided by. The author assumes no responsibility for problems that occur through use or install- ation, including lost wages, bugs, deletions, downtimes, etc... Use at your own risk. All new code is copyrighted by its author. Modified do_order function: /* Order modifications made by Raven (Laurie Zenner) */ void do_order( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char cmd_vi[MAX_INPUT_LENGTH]; CHAR_DATA *victim; CHAR_DATA *och; CHAR_DATA *och_next; bool found; bool fAll; bool fUnto; argument = one_argument( argument, arg ); one_argument(argument,arg2); if ( arg[0] == '\0' || argument[0] == '\0' ) { send_to_char( "Order whom to do what?\n\r", ch ); return; } if ( IS_AFFECTED( ch, AFF_CHARM ) ) { send_to_char( "You feel like taking, not giving, orders.\n\r", ch ); return; } if ( !str_cmp( arg, "all" ) ) { fAll = TRUE; victim = NULL; } else { fAll = FALSE; if ( ( victim = get_char_room( ch, arg ) ) == NULL ) { send_to_char( "They aren't here.\n\r", ch ); return; } if ( victim == ch ) { send_to_char( "Aye aye, right away!\n\r", ch ); return; } if ( !IS_AFFECTED(victim, AFF_CHARM) || victim->master != ch ) { send_to_char( "Do it yourself!\n\r", ch ); return; } } fUnto = FALSE; found = FALSE; for ( och = ch->in_room->people; och != NULL; och = och_next ) { och_next = och->next_in_room; if ( IS_AFFECTED(och, AFF_CHARM) && och->master == ch && ( fAll || och == victim ) ) { found = TRUE; strcpy( cmd_vi, argument ); chk_command( och, cmd_vi ); if (cmd_vi[0] == '\0') act( "$N is unable to comply with your order.", ch, NULL, och, TO_CHAR ); else if ( (!strcmp( cmd_vi, "delete" )) || (!strcmp( cmd_vi, "quit" )) || (!strcmp( cmd_vi, "password" )) || (!strcmp( cmd_vi, "pk" )) ) { act( "I don't think $N appreciated that.", ch, NULL, och, TO_CHAR ); sprintf( buf, "WATCH PLAYER!: %s attempted to make %s %s!", ch->name, och->name, cmd_vi ); log_string( buf ); stop_follower( och ); if (!IS_NPC( och )) fUnto = TRUE; } else if (( (!strcmp( cmd_vi, "advance" )) && (IS_NPC( och )) ) || (!strncmp( cmd_vi, "mp", 2 )) ) { sprintf( buf, "WATCH PLAYER!: %s attempted to make %s %s!", ch->name, och->name, cmd_vi ); log_string( buf ); act( "$N is unable to comply with your order.", ch, NULL, och, TO_CHAR ); } else { if (!IS_NPC( och )) { sprintf( buf, "%s ordered %s to '%s'", ch->name, och->name, argument ); log_string( buf ); } sprintf( buf, "$n orders you to '%s'.", argument ); act( buf, ch, NULL, och, TO_VICT ); act( "$N does $S best to comply to your order.", ch, NULL, och, TO_CHAR ); interpret( och, argument ); } } } if ( !found ) send_to_char( "You have no followers here.\n\r", ch ); if (fUnto) { /* If I feel especially mean spirited one day, I'll check to see * if they tried to changed another's password and, if so, change * their's to some random string. */ send_to_char( "The warders of this land have a perverse delight in poetic justice./n/r", ch ); interpret( ch, argument ); } tail_chain( ); return; } ============================================================================= / ______ _______ ____ _____ ___ __ _ ______ ____ ____ _____ / \ | ____|__ __| _ \ / ____\ / _ \| \ / | ____| / __ \| _ \ / ____\ \ / | |__ | | | |_| | | | |_| | |\/| | |___ | | | | |_| | | / / | ___| | | | ___/| | __| _ | | | | ____| | | | | __/| | ___ \ \ | | | | | | | |___| | | | | | | | |____ | |__| | |\ \| |___| | / / |_| |_| |_| o \_____/|_| |_|_| |_|______|o \____/|_| \_|\_____/ \ \ / ============================================================================ ------------------------------------------------------------------------------ ftp://ftp.game.org/pub/mud FTP.GAME.ORG http://www.game.org/ftpsite/ ------------------------------------------------------------------------------ This file came from FTP.GAME.ORG, the ultimate source for MUD resources. ------------------------------------------------------------------------------