#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <dirent.h>
#include "mud.h"

void db_scatter( CHAR_DATA *ch, long min, long max  );

void do_scatterdballs( CHAR_DATA *ch, char *argument )
{
echo_to_all( AT_RED, "The Black Star Dragonballs have been realeased in COU, Have FUN!\n\r", ECHOTAR_ALL );
db_scatter( ch, 205, 367 );
return;
}

void db_scatter( CHAR_DATA *ch, long min, long max  )
{
        ROOM_INDEX_DATA *target_room_one, *target_room_two, 
					*target_room_three, *target_room_four, 
					*target_room_five, *target_room_six, 
					*target_room_seven;

        OBJ_DATA *obj1, *obj2, *obj3, *obj4, *obj5, *obj6, *obj7;

	if ( ( target_room_one = get_room_index( number_range( min, max ) ) ) == NULL )
       target_room_one = get_room_index( 6000 );
	if ( ( target_room_two = get_room_index( number_range( min, max) ) ) == NULL  )
       target_room_two = get_room_index( 6000 );
	if ( ( target_room_three = get_room_index( number_range( min, max) ) ) == NULL )
       target_room_three = get_room_index( 6000 );
	if ( ( target_room_four = get_room_index( number_range( min, max) ) ) == NULL )
       target_room_four = get_room_index( 6000 );
	if ( ( target_room_five = get_room_index( number_range( min, max) ) ) == NULL )
       target_room_five = get_room_index( 6000 );
	if ( ( target_room_six = get_room_index( number_range( min, max) ) ) == NULL )
       target_room_six = get_room_index( 6000 );
	if ( ( target_room_seven = get_room_index( number_range( min, max) ) ) == NULL )
       target_room_seven = get_room_index( 6000 );

        if ( ( obj1 = get_obj_world( ch, "Black Star Dragonball One" ) ) == NULL )
        return;
        if ( ( obj2 = get_obj_world( ch, "Black Star Dragonball Two" ) ) == NULL )
        return;
        if ( ( obj3 = get_obj_world( ch, "Black Star Dragonball Three" ) ) == NULL )
        return;
        if ( ( obj4 = get_obj_world( ch, "Black Star Dragonball Four" ) ) == NULL )
        return;
        if ( ( obj5 = get_obj_world( ch, "Black Star Dragonball Five" ) ) == NULL )
        return;
        if ( ( obj6 = get_obj_world( ch, "Black Star Dragonball Six" ) ) == NULL )
        return;
        if ( ( obj7 = get_obj_world( ch, "Black Star Dragonball Seven" ) ) == NULL )
        return;

       obj_from_room( obj1 );
	obj_from_room( obj2 );
	obj_from_room( obj3 );
	obj_from_room( obj4 );
	obj_from_room( obj5 );
	obj_from_room( obj6 );
	obj_from_room( obj7 );

	obj_to_room( obj1, target_room_one );
	obj_to_room( obj2, target_room_two );
	obj_to_room( obj3, target_room_three );
	obj_to_room( obj4, target_room_four );
	obj_to_room( obj5, target_room_five );
	obj_to_room( obj6, target_room_six );
	obj_to_room( obj7, target_room_seven );

	return;
}
