#NEWLINE# def build_add_spawn( self , args , player = None ) : #NEWLINE# #INDENT# if ( not args ) : #NEWLINE# #INDENT# return 'Type "help room spawns" to get help using this command.' #NEWLINE# #UNINDENT# exp = ( ( '((for[ ]+)?(?P<obj_type>(item)|(npc))([ ]+(?P<obj_id>\\d+))' + '(([ ]+from)?([ ]+area)([ ]+(?P<area_name>\\w+)))?' ) + '(([ ]+((in)|(into)|(inside)))?([ ]+spawn)?([ ]+(?P<container>\\d+)))?)' ) #NEWLINE# match = re . match ( exp , args , re . I ) #NEWLINE# if match : #NEWLINE# #INDENT# ( obj_type , obj_id , area_name , container ) = match . group ( 'obj_type' , 'obj_id' , 'area_name' , 'container' ) #NEWLINE# area = ( World . get_world ( ) . get_area ( area_name ) or self . area ) #NEWLINE# if ( not area ) : #NEWLINE# #INDENT# return "That area doesn't exist." #NEWLINE# #UNINDENT# obj = getattr ( area , ( obj_type + 's' ) ) . get ( obj_id ) #NEWLINE# if ( not obj ) : #NEWLINE# #INDENT# return ( '%s number %s does not exist.' % ( obj_type , obj_id ) ) #NEWLINE# #UNINDENT# if container : #NEWLINE# #INDENT# if ( container not in self . spawns ) : #NEWLINE# #INDENT# return ( "Spawn %s doesn't exist." % container ) #NEWLINE# #UNINDENT# container_spawn = self . spawns . get ( container ) #NEWLINE# c_obj = container_spawn . spawn_object #NEWLINE# if container_spawn . spawn_object . has_type ( 'container' ) : #NEWLINE# #INDENT# spawn = self . new_spawn ( { #NEWLINE# #INDENT# 'id' : self . get_spawn_id ( ) , #NEWLINE# 'room' : self , #NEWLINE# 'obj' : obj , #NEWLINE# 'spawn_type' : obj_type , #NEWLINE# 'container' : container_spawn , #NEWLINE# #UNINDENT# } ) #NEWLINE# container_spawn . add_nested_spawn ( spawn ) #NEWLINE# return ( 'A room spawn has been added for %s number %s.' % ( obj_type , obj_id ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( 'Room spawn %s is not a container.' % container ) #NEWLINE# #UNINDENT# #UNINDENT# self . new_spawn ( { #NEWLINE# #INDENT# 'id' : self . get_spawn_id ( ) , #NEWLINE# 'room' : self , #NEWLINE# 'obj' : obj , #NEWLINE# 'spawn_type' : obj_type , #NEWLINE# #UNINDENT# } ) #NEWLINE# return ( 'A room spawn has been added for %s number %s.' % ( obj_type , obj_id ) ) #NEWLINE# #UNINDENT# return 'Type "help room spawns" to get help using this command.'