Beispiel #1
0
def new_peer(message):
    d = message.data
    t = TableManager().current()

    for md5 in d:
        if t:
            player = t.find_player(md5)
            if player is None:
                t.add_player_by_md5(md5.playerName)
Beispiel #2
0
def new_peer_2(message):
    d = message.data
    t = TableManager().current()

    if t:
        t.number = d.tableNumber
        t.status = d.tableStatus
        logger.info("[__new_peer_2] table number is: %s", t.number)
        if settings.TRAINING_MODE:
            logger.info(
                "[__new_peer_2] http://poker-training.vtr.trendnet.org:3001/game.html?table=%s",
                t.number)
        utils.generate_logs(t.number)

    for pjson in d.players:
        player = t.find_player(pjson.playerName)
        if player:
            player.is_online = pjson.isOnline
        else:
            player = Player(pjson.playerName)
            player.is_online = pjson.isOnline
            logger.info("[__new_peer_2] player name is: %s, is_online: %s",
                        player.md5[:5], player.is_online)