+ wins = False\r
+\r
+ # gametype-specific stuff is handled here. if passed to us, we store it\r
+ for (key,value) in events.items():\r
+ if key == 'wins': wins = True\r
+ if key == 't': pgstat.team = int(value)\r
+\r
+ if key == 'scoreboard-drops': pgstat.drops = int(value)\r
+ if key == 'scoreboard-returns': pgstat.returns = int(value)\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(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
+ if key == 'scoreboard-objectives': pgstat.collects = int(value)\r
+ if key == 'scoreboard-captured': pgstat.captures = int(value)\r
+ if key == 'scoreboard-released': pgstat.drops = int(value)\r
+ if key == 'scoreboard-fastest':\r
+ pgstat.fastest = datetime.timedelta(seconds=float(value)/100)\r
+ if key == 'scoreboard-takes': pgstat.pickups = int(value)\r
+ if key == 'scoreboard-ticks': pgstat.drops = int(value)\r
+ if key == 'scoreboard-revivals': pgstat.revivals = int(value)\r
+ if key == 'scoreboard-bctime':\r
+ pgstat.time = datetime.timedelta(seconds=int(value))\r
+ if key == 'scoreboard-bckills': pgstat.carrier_frags = int(value)\r
+ if key == 'scoreboard-losses': pgstat.drops = int(value)\r
+ if key == 'scoreboard-pushes': pgstat.pushes = int(value)\r
+ if key == 'scoreboard-destroyed': pgstat.destroys = int(value)\r
+ if key == 'scoreboard-kckills': pgstat.carrier_frags = int(value)\r
+ if key == 'scoreboard-lives': pgstat.lives = int(value)\r
+ if key == 'scoreboard-goals': pgstat.captures = int(value)\r
+ if key == 'scoreboard-faults': pgstat.drops = int(value)\r
+ if key == 'scoreboard-laps': pgstat.laps = int(value)\r
+\r
+ if key == 'avglatency': pgstat.avg_latency = float(value)\r
+ if key == 'scoreboard-captime':\r
+ pgstat.fastest = datetime.timedelta(seconds=float(value)/100)\r
+ if game.game_type_cd == 'ctf':\r
+ update_fastest_cap(session, player.player_id, game.game_id,\r
+ gmap.map_id, pgstat.fastest)\r
+\r
+ # there is no "winning team" field, so we have to derive it\r
+ if wins and pgstat.team is not None and game.winner is None:\r