return "pink"
+class PlayerGameAnticheat(object):
+ def __init__(self, player_id=None, game_id=None, key=None,
+ value=None, create_dt=None):
+ self.player_id = player_id
+ self.game_id = game_id
+ self.key = key
+ self.value = value
+ self.create_dt = create_dt
+
+ def __repr__(self):
+ return "<PlayerGameAnticheat(%s, %d)>" % (self.key, self.value)
+
+
def initialize_db(engine=None):
DBSession.configure(bind=engine)
Base.metadata.bind = engine
player_captimes_table = MetaData.tables['player_map_captimes']
summary_stats_table = MetaData.tables['summary_stats']
team_game_stats_table = MetaData.tables['team_game_stats']
+ player_game_anticheats_table = MetaData.tables['player_game_anticheats']
# now map the tables and the objects together
mapper(PlayerAchievement, achievements_table)
mapper(PlayerCaptime, player_captimes_table)
mapper(SummaryStat, summary_stats_table)
mapper(TeamGameStat, team_game_stats_table)
+ mapper(PlayerGameAnticheat, player_game_anticheats_table)
return pgstat\r
\r
\r
+def create_anticheats(session, pgstat, game, player, events):\r
+ """Anticheats handler for all game types"""\r
+\r
+ anticheats = []\r
+\r
+ # all anticheat events are prefixed by "anticheat"\r
+ for (key,value) in events.items():\r
+ if key.startswith("anticheat"):\r
+ try:\r
+ ac = PlayerGameAnticheat(\r
+ player.player_id,\r
+ game.game_id,\r
+ key,\r
+ float(value)\r
+ )\r
+ anticheats.append(ac)\r
+ session.add(ac)\r
+ except Exception as e:\r
+ log.debug("Could not parse value for key %s. Ignoring." % key)\r
+\r
+ return anticheats\r
+\r
+\r
def create_default_team_stat(session, game_type_cd):\r
"""Creates a blanked-out teamstat record for the given game type"""\r
\r
pgstat = create_game_stat(session, game_meta, game, server,\r
gmap, player, events)\r
\r
+ if player.player_id > 1:\r
+ anticheats = create_anticheats(session, pgstat, game, player,\r
+ events)\r
+\r
if should_do_weapon_stats(game_type_cd) and player.player_id > 1:\r
pwstats = create_weapon_stats(session, game_meta, game, player,\r
pgstat, events)\r