 	options.monsters_list = tmpMonsters
 	options.fight_mode = lib.game.isInFight.sync null, dbConnection, userid
 	options.autoinvolved_fm = lib.game.isAutoinvolved.sync null, dbConnection, userid
-	
+
 	if options.fight_mode
 		options.participants = lib.game.getBattleParticipants.sync null, dbConnection, userid
 		options.our_side = options.participants.find((p) -> p.kind=='user' && p.id==userid).side

'use strict'

config = require "#{__dirname}/config.js"

anyDB = require 'any-db'

dbConnection = anyDB.createPool config.DATABASE_URL, min: 2, max: 20
dbConnection.query 'SELECT version()', [], (error, result) ->

		for value, index in data
			index++
			while logged.indexOf("$#{index}") isnt -1
				logged = logged.replace "$#{index}", chalk.blue(JSON.stringify(value))
		start = Date.now()
		@_query q, data, (error, result) ->
			time = Date.now() - start
			time = switch
				when time < 10 then chalk.green("#{time} ms")
				when time < 20 then chalk.yellow("#{time} ms")
				else chalk.red("#{time} ms")
			console.log "\n#{time}: #{logged}\n"
			# console.log "\n#{time}: t: #{logged}\n"
			cb(error, result)

app = express()
app.enable 'trust proxy'
