 app.post '/action/attack',
 	mustBeAuthed,
 	(request, response) ->
-		lib.game.goAttack.sync null, dbConnection, request.uonline.user.character_id
+		lib.game.goAttack.sync null, request.uonline.tx, request.uonline.user.character_id
 		response.redirect 303, '/game/'
 
 
 app.post '/action/escape',
 	mustBeAuthed,
 	(request, response) ->
-		lib.game.goEscape.sync null, dbConnection, request.uonline.user.character_id
+		lib.game.goEscape.sync null, request.uonline.tx, request.uonline.user.character_id
 		response.redirect 303, '/game/'
 
 



fetchCharacter = ((request, response) ->
	character = lib.game.getCharacter.sync null, dbConnection, request.uonline.user.character_id
	request.uonline.character = character
).asyncMiddleware()


fetchCharacterFromURL = ((request, response) ->
	request.uonline.fetched_character = lib.game.getCharacter.sync null, dbConnection, request.params.name
).asyncMiddleware()




fetchLocation = ((request, response) ->
	try
		location = lib.game.getCharacterLocation.sync null, request.uonline.tx, request.uonline.user.character_id
		#request.uonline.pic = request.uonline.picture  if request.uonline.picture?  # TODO: LOLWHAT
	catch e
		console.error e.stack
		location = lib.game.getInitialLocation.sync null, request.uonline.tx
		lib.game.changeLocation.sync null, request.uonline.tx, request.uonline.user.character_id, location.id
	request.uonline.location = location
	return
).asyncMiddleware()


fetchArea = ((request, response) ->
	area = lib.game.getCharacterArea.sync null, request.uonline.tx, request.uonline.user.character_id
	request.uonline.area = area
	return
).asyncMiddleware()
