/* * Recoded by Belial for speed and efficiency. * added in more functionality to reduce spam * and make it more "User Friendly" * This makes it so that you can type: * clone mob 40*fido * and it makes 40 fidos. Same with objects. * * Report any bugs to chancedj@peaknet.net * * INSTRUCTIONS FOR INSTALLING: * remove old do_clone and put this in it's place :). * */ void do_clone(CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; char rest[MAX_INPUT_LENGTH]; int number, i; argument = one_argument(argument,arg); number = mult_argument(argument,rest); if (arg[0] == '\0') { send_to_char("Clone what?\n\r",ch); return; } if ((number < 1) || (number > 64 )) { send_to_char( "Number must be between 1 and 64.\n\r", ch ); return; } if (!str_prefix(arg,"object")) { OBJ_DATA *obj, *obj_clone; char buf[MAX_STRING_LENGTH]; obj = get_obj_here(ch,rest); if (obj == NULL) { send_to_char("You don't see that here.\n\r",ch); return; } if (!obj_check(ch,obj)) { send_to_char("Your powers are not great enough for such a task.\n\r",ch); return; } for (i = 1 ; i <= number ; i++) { obj_clone = create_object(obj->pIndexData,0); clone_object(obj,obj_clone); if (obj->carried_by != NULL) obj_to_char(obj_clone,ch); else obj_to_room(obj_clone,ch->in_room); recursive_clone(ch,obj,obj_clone); } sprintf( buf, "$n has created $p[%d].", number ); act(buf,ch,obj_clone,NULL,TO_ROOM); sprintf( buf, "You clone $p[%d].", number ); act( buf,ch,obj_clone,NULL,TO_CHAR); sprintf( buf, "$N clones $p[%d].", number ); wiznet(buf,ch,obj_clone,WIZ_LOAD,WIZ_SECURE,get_trust(ch)); return; } else if (!str_prefix(arg,"mobile") || !str_prefix(arg,"character")) { OBJ_DATA *obj, *new_obj; CHAR_DATA *mob, *mob_clone; char buf[MAX_STRING_LENGTH]; mob = get_char_room(ch,rest); if (mob == NULL) { send_to_char("You don't see that here.\n\r",ch); return; } if (!IS_NPC(mob)) { send_to_char("You can only clone mobiles.\n\r",ch); return; } if ((mob->level > 20 && !IS_TRUSTED(ch,GOD)) || (mob->level > 10 && !IS_TRUSTED(ch,IMMORTAL)) || (mob->level > 5 && !IS_TRUSTED(ch,DEMI)) || (mob->level > 0 && !IS_TRUSTED(ch,ANGEL)) || !IS_TRUSTED(ch,AVATAR)) { send_to_char("Your powers are not great enough for such a task.\n\r",ch); return; } for (i = 1 ; i <= number ; i++ ) { mob_clone = create_mobile(mob->pIndexData); clone_mobile(mob,mob_clone); for (obj = mob->carrying; obj != NULL; obj = obj->next_content) { if (obj_check(ch,obj)) { new_obj = create_object(obj->pIndexData,0); clone_object(obj,new_obj); recursive_clone(ch,obj,new_obj); obj_to_char(new_obj,mob_clone); new_obj->wear_loc = obj->wear_loc; } } char_to_room(mob_clone,ch->in_room); } sprintf( buf, "$n has created $N[%d].", number ); act(buf,ch,NULL,mob_clone,TO_ROOM); sprintf( buf, "You clone $N[%d].", number ); act(buf,ch,NULL,mob_clone,TO_CHAR); sprintf(buf,"$N clones %s[%d].",mob_clone->short_descr,number); wiznet(buf,ch,NULL,WIZ_LOAD,WIZ_SECURE,get_trust(ch)); return; } else /* find both */ { send_to_char("Syntax: clone mob .\n\r" " clone obj .\n\r",ch); return; } }