\r
def is_supported_gametype(gametype):\r
"""Whether a gametype is supported or not"""\r
- supported_game_types = ('duel', 'dm', 'ctf', 'tdm', 'kh',\r
- 'ka', 'ft', 'freezetag', 'nb', 'nexball')\r
+ supported_game_types = ('duel', 'dm', 'ca', 'ctf', 'tdm', 'kh',\r
+ 'ka', 'ft', 'freezetag', 'nb', 'nexball', 'lms')\r
\r
if gametype in supported_game_types:\r
return True\r
\r
def num_real_players(player_events):\r
"""\r
- Returns the number of real players (those who played \r
+ Returns the number of real players (those who played\r
and are on the scoreboard).\r
"""\r
real_players = 0\r
\r
def should_do_elos(game_type_cd):\r
"""True of the game type should process Elos. False otherwise."""\r
- elo_game_types = ('duel', 'dm', 'ctf', 'tdm', 'kh',\r
+ elo_game_types = ('duel', 'dm', 'ca', 'ctf', 'tdm', 'kh',\r
'ka', 'ft', 'freezetag')\r
\r
if game_type_cd in elo_game_types:\r
try:\r
# find one by the name, if it exists\r
gmap = session.query(Map).filter_by(name=name).one()\r
- log.debug("Found map id {0}: {1}".format(gmap.map_id, \r
+ log.debug("Found map id {0}: {1}".format(gmap.map_id,\r
gmap.name))\r
except NoResultFound, e:\r
gmap = Map(name=name)\r
return gmap\r
\r
\r
-def create_game(session=None, start_dt=None, game_type_cd=None, \r
+def create_game(session=None, start_dt=None, game_type_cd=None,\r
server_id=None, map_id=None, winner=None, match_id=None,\r
duration=None):\r
"""\r
\r
log.debug("Error: game with same server and match_id found! Ignoring.")\r
\r
- # if a game under the same server and match_id found, \r
+ # if a game under the same server and match_id found,\r
# this is a duplicate game and can be ignored\r
raise pyramid.httpexceptions.HTTPOk('OK')\r
except NoResultFound, e:\r
session.add(game)\r
session.flush()\r
log.debug("Created game id {0} on server {1}, map {2} at \\r
- {3}".format(game.game_id, \r
+ {3}".format(game.game_id,\r
server_id, map_id, start_dt))\r
\r
return game\r
pgstat.player_id = player.player_id\r
pgstat.nick = events.get('n', 'Anonymous Player')[:128]\r
pgstat.stripped_nick = strip_colors(qfont_decode(pgstat.nick))\r
- pgstat.score = int(events.get('scoreboard-score', 0))\r
+ pgstat.score = int(round(float(events.get('scoreboard-score', 0))))\r
pgstat.alivetime = datetime.timedelta(seconds=int(round(float(events.get('alivetime', 0.0)))))\r
pgstat.rank = int(events.get('rank', None))\r
pgstat.scoreboardpos = int(events.get('scoreboardpos', pgstat.rank))\r
if key == 'scoreboard-fckills': pgstat.carrier_frags = int(value)\r
if key == 'scoreboard-pickups': pgstat.pickups = int(value)\r
if key == 'scoreboard-caps': pgstat.captures = int(value)\r
- if key == 'scoreboard-score': pgstat.score = int(value)\r
+ if key == 'scoreboard-score': pgstat.score = int(round(float(value)))\r
if key == 'scoreboard-deaths': pgstat.deaths = int(value)\r
if key == 'scoreboard-kills': pgstat.kills = int(value)\r
if key == 'scoreboard-suicides': pgstat.suicides = int(value)\r