 	mustNotBeAuthed,
 	setInstance('login'),
 	(request, response) ->
-		if lib.user.accessGranted.sync null, dbConnection, request.body.username, request.body.password
-			sessid = lib.user.createSession.sync null, dbConnection, request.body.username
+		if lib.user.accessGranted.sync null, request.uonline.db, request.body.username, request.body.password
+			sessid = lib.user.createSession.sync null, request.uonline.db, request.body.username
 			response.cookie 'sessid', sessid
 			response.redirect 303, '/'
 		else

	id = parseInt(request.params.id, 10)
	if isNaN(id)
		throw new Error '404'
	chars = lib.game.getCharacter.sync null, dbConnection, id
	if not chars?
		throw new Error '404'
	for i of chars



fetchItems = ((request, response) ->
	items = lib.game.getCharacterItems.sync null, request.uonline.db, request.uonline.user.character_id
	request.uonline.equipment = items.filter (x) -> x.equipped
	request.uonline.equipment.shield = request.uonline.equipment.find (x) -> x.type == 'shield'
	request.uonline.equipment.right_hand = request.uonline.equipment.find (x) -> x.type.startsWith 'weapon'
