gurba-0.40/
gurba-0.40/bin/
gurba-0.40/lib/
gurba-0.40/lib/cmds/guild/fighter/
gurba-0.40/lib/cmds/monster/
gurba-0.40/lib/cmds/race/catfolk/
gurba-0.40/lib/cmds/race/dwarf/
gurba-0.40/lib/cmds/verb/
gurba-0.40/lib/daemons/data/
gurba-0.40/lib/data/boards/
gurba-0.40/lib/data/messages/
gurba-0.40/lib/data/players/
gurba-0.40/lib/design/
gurba-0.40/lib/domains/gurba/
gurba-0.40/lib/domains/gurba/guilds/fighter/
gurba-0.40/lib/domains/gurba/monsters/
gurba-0.40/lib/domains/gurba/objects/armor/
gurba-0.40/lib/domains/gurba/objects/clothing/
gurba-0.40/lib/domains/gurba/objects/weapons/
gurba-0.40/lib/domains/gurba/vendors/
gurba-0.40/lib/kernel/cmds/admin/
gurba-0.40/lib/kernel/daemons/
gurba-0.40/lib/kernel/include/
gurba-0.40/lib/kernel/lib/
gurba-0.40/lib/kernel/net/
gurba-0.40/lib/kernel/sys/
gurba-0.40/lib/logs/
gurba-0.40/lib/pub/
gurba-0.40/lib/std/modules/languages/
gurba-0.40/lib/std/races/
gurba-0.40/lib/std/races/monsters/
gurba-0.40/lib/wiz/fudge/
gurba-0.40/lib/wiz/spud/
gurba-0.40/src/host/beos/
gurba-0.40/src/host/pc/res/
gurba-0.40/src/kfun/
gurba-0.40/src/lpc/
gurba-0.40/src/parser/
gurba-0.40/tmp/
#include <type.h>

inherit OBJECT;

static object *inventory;

void create( void ) {
  inventory = ({ });
}

int is_container( void ) {
  return( 1 );
}

void object_arrived( object obj ) {

}

void object_removed( object obj ) {

}

int receive_object( object obj ) {
  if( !inventory )
    inventory = ({ obj });
  else
    inventory += ({ obj });

  object_arrived( obj );
  return 1;
}

int remove_object( object obj ) {
  if( !inventory ) 
    return 0;
  else 
    inventory -= ({ obj });
  object_removed( obj );
  return 1;
}

object *query_inventory( void ) {

  return( inventory );
}

object find_object_num( string name, int num ) {
  int i,j;
  string *ids;
	for( i = 0; i < sizeof( inventory ); i ++ ) {
		ids = inventory[i]->query_ids();
		if( ids != 0 ) {
			for( j = 0; j < sizeof( ids ); j ++ ) {
				if( lowercase( ids[j] ) == lowercase( name ) ) {
					num--;
					if( num == 0 ) 
						return( inventory[i] );
				}
			}
		}
	}
  return( 0 );
}

object find_object( string name ) {
	return( find_object_num( name, 1 ) );
}

object find_adj_object_num( string adj, string name, int num ) {
  int i,j,k;
  string *ids;
  string *adjs;
  for( i = 0; i < sizeof( inventory ); i ++ ) {
    ids = inventory[i]->query_ids();
		if( ids != 0 ) {
			for( j = 0; j < sizeof( ids ); j ++ ) {
				if( lowercase( ids[j] ) == lowercase( name ) ) {
					if( inventory[i]->is_adj( adj ) == 1 ) {
						num--;
						if( num == 0 )
							return( inventory[i] );
					}
				}
			}
		}
	}
  return( 0 );
}

object find_adj_object( string adj, string name ) {
	return( find_adj_object_num( adj, name, 1 ) );
}

object find_adjs_object_num( string *adj, string name, int num ) {
  int i,j,k;
	string *ids;
	string *adjs;
	for( i = 0; i < sizeof( inventory ); i ++ ) {
		ids = inventory[i]->query_ids();
		if( ids != 0 ) {
			for( j = 0; j < sizeof( ids ); j ++ ) {
				if( lowercase( ids[j] ) == lowercase( name ) ) {
					int nFound;
					nFound = 1;
					for( k = 0; k < sizeof( adj ); k++ ) {
						if( inventory[i]->is_adj( adj[k] ) == 0 )
							nFound = 0;
					}
					if( nFound ) {
						num--;
						if( num == 0 )
							return( inventory[i] );
					}
				}
			}
		}
	}
	return( 0 );
}

object find_adjs_object( string *adj, string name ) {
	return( find_adjs_object_num( adj, name, 1 ) );
}

void set_objects( mapping obs ) {
  object ob;
  string *filename;
  string name;
  int i;
  int num;

  filename = map_indices( obs );
  for( i = 0; i < sizeof( filename ); i++ ) {
    if( strstr( filename[i], "#" ) != -1 ) {
      name = filename[i][0..strstr( filename[i], "#" )-1];
    } else {
      name = filename[i];
    }
    if( typeof( obs[filename[i]] ) == T_ARRAY ) {    

      ob = clone_object( name );
      ob->move( object_name( this_object() ) );
      ob->setup();
      ob->mudlib_setup( obs[filename[i]] );
    } else {
      num = obs[filename[i]];
      while( num > 0 ) {
        ob = clone_object( name );
        ob->move( object_name( this_object() ) );
        ob->setup();
        num--;
      }
    }
  }
}