def setUp(self): import sys remove = [m for m in sys.modules.keys() if 'shinymud' in m] for r in remove: del sys.modules[r] from shinymud.lib.world import World self.world = World(':memory:') from shinymud.lib.setup import initialize_database initialize_database()
def setup_stub_world(): world = World() from shinymud.lib.setup import initialize_database initialize_database() return world
from shinymud.lib.world import World # Initialize the World world = World() from shinymud.lib.setup import initialize_database from shinymud.models.area import Area from shinymud.data.config import * from shinymud.lib.connection_handlers import con_handlers import traceback import datetime initialize_database() world.db.delete( 'from game_item where (owner is null or owner=\'None\') and container is null' ) # load the entities in the world from the database # This should probably happen inside the world itself... for area in world.db.select("* from area"): world.area_add(Area.create(area)) for area in world.areas.values(): area.load() world.default_location = world.get_location(DEFAULT_LOCATION[0], DEFAULT_LOCATION[1]) # Start up all of our connection handlers for port, conn_handler in CONNECTIONS: handler_class = getattr(con_handlers, conn_handler) handler_obj = handler_class(port, HOST, world) handler_obj.start()
from shinymud.lib.world import World # Initialize the World world = World() from shinymud.lib.setup import initialize_database from shinymud.models.area import Area from shinymud.data.config import * from shinymud.lib.connection_handlers import con_handlers import traceback import datetime initialize_database() world.db.delete('from game_item where (owner is null or owner=\'None\') and container is null') # load the entities in the world from the database # This should probably happen inside the world itself... for area in world.db.select("* from area"): world.area_add(Area.create(area)) for area in world.areas.values(): area.load() world.default_location = world.get_location(DEFAULT_LOCATION[0], DEFAULT_LOCATION[1]) # Start up all of our connection handlers for port, conn_handler in CONNECTIONS: handler_class = getattr(con_handlers, conn_handler) handler_obj = handler_class(port, HOST, world) handler_obj.start() world.log.info('Started the connection handlers. Now listening for Players.')