def refresh_sightings(client): """ Refresh the list of player sightings. """ for p in client.online_players: if _is_bot(p): continue s = Sighting.get(player=p) if not s: s = Sighting(dict(player=p, time=0, count=0)) s.add() s.count += 1 s.time = time() stats = SingleStat.get(ref='mod_online.count') stats.data = str(int(stats.data) + 1) commit_and_close()
def setup(client): client.mod_online_lock = allocate_lock() client.online_players = [] if not SingleStat.get(ref='mod_online.count'): SingleStat(dict(ref='mod_online.count', data='0')).add() commit_and_close()