Example #1
0
def disconnect_player(player, reason_msg=''):
    if not player.connecting and not player in all_players:
        return
    real_pvp.clear(player.uid)

    player.connecting = False
    player.websocket.close()

    all_players.remove(player)

    if player in readying_players:
        player_index = readying_players.index(player)
        readying_players.pop(player_index)
        readying_players_scores.pop(player_index)
        THIS_READYING_REDIS.remove(player.uid)
    elif use_reconnect:  # 如果是在战斗中掉线 记录对手信息以便重连
        # 判断对手是否也掉线
        if player.opponent.uid in losing_connection_info:
            losing_connection_info.pop(player.opponent.uid)
        # 只是自己掉线
        else:
            losing_connection_info[player.uid] = player.opponent
    # 如果自己掉线  判定对手胜利
    elif reason_msg.startswith('no msg') and player.fight_statue == 1 and player.opponent and player.opponent.connecting:
        player.req_end_fight(lose_connect_end_fight_msg(player))
        print '\n 异常掉线了!!!!!  :****   ({}|--{})'.format(player.core_id, player.uid), datetime.datetime.now()

    print 'disconnect player:**** {}  ({}|--{})'.format(reason_msg, player.core_id, player.uid)
Example #2
0
def disconnect_player(player, reason_msg=''):
    if not player.connecting and not player in all_players:
        return
    real_pvp.clear(player.uid)

    player.connecting = False
    player.websocket.close()

    all_players.remove(player)

    if player in readying_players:
        player_index = readying_players.index(player)
        readying_players.pop(player_index)
        readying_players_scores.pop(player_index)
        THIS_READYING_REDIS.remove(player.uid)
    elif use_reconnect:  # 如果是在战斗中掉线 记录对手信息以便重连
        # 判断对手是否也掉线
        if player.opponent.uid in losing_connection_info:
            losing_connection_info.pop(player.opponent.uid)
        # 只是自己掉线
        else:
            losing_connection_info[player.uid] = player.opponent
    # 如果自己掉线  判定对手胜利
    elif reason_msg.startswith('no msg') and player.fight_statue == 1 and player.opponent and player.opponent.connecting:
        player.req_end_fight(lose_connect_end_fight_msg(player))
        print '\n 异常掉线了!!!!!  :****   ({}|--{})'.format(player.core_id, player.uid), datetime.datetime.now()

    print 'disconnect player:**** {}  ({}|--{})'.format(reason_msg, player.core_id, player.uid)
Example #3
0
def disconnect_player(player, reason_msg=''):
    if not player.connecting and not player in all_players:
        return
    real_pvp.clear(player.uid)

    player.connecting = False
    player.websocket.close()

    all_players.remove(player)

    if player in readying_players:
        player_index = readying_players.index(player)
        readying_players.pop(player_index)
        readying_players_scores.pop(player_index)
        THIS_READYING_REDIS.remove(player.uid)
    elif use_reconnect:  # 如果是在战斗中掉线 记录对手信息以便重连
        # 判断对手是否也掉线
        if player.opponent.uid in losing_connection_info:
            losing_connection_info.pop(player.opponent.uid)
        # 只是自己掉线
        else:
            losing_connection_info[player.uid] = player.opponent
    # 如果自己掉线  判定对手胜利
    elif reason_msg.startswith(
            'no msg'
    ) and player.fight_statue == 1 and player.opponent and player.opponent.connecting:
        player.req_end_fight(lose_connect_end_fight_msg(player))
        print '\n 异常掉线了!!!!!  :****   ({}|--{})'.format(
            player.core_id, player.uid), datetime.datetime.now()

    print 'disconnect player:**** {}  ({}|--{})'.format(
        reason_msg, player.core_id, player.uid)
Example #4
0
def disconnect_player(player, reason_msg=''):
    if not player.connecting and not player in all_players:
        return
    real_pvp.clear(player.uid)

    player.connecting = False
    player.websocket.close()

    all_players.remove(player)

    if player in readying_players:
        player_index = readying_players.index(player)
        readying_players.pop(player_index)
        readying_players_scores.pop(player_index)
        THIS_READYING_REDIS.remove(player.uid)
    elif use_reconnect:  # 如果是在战斗中掉线 记录对手信息以便重连
        # 判断对手是否也掉线
        if player.opponent.uid in losing_connection_info:
            losing_connection_info.pop(player.opponent.uid)
        # 只是自己掉线
        else:
            losing_connection_info[player.uid] = player.opponent
    # 如果自己掉线  判定对手胜利
    elif reason_msg.startswith(
            'no msg'
    ) and player.fight_statue == 1 and player.opponent and player.opponent.connecting:
        player.req_end_fight(lose_connect_end_fight_msg(player))
        print '\n 异常掉线了!!!!!  :****   ({}|--{})'.format(
            player.core_id, player.uid), datetime.datetime.now()

    print 'disconnect player:**** {}  ({}|--{})'.format(
        reason_msg, player.core_id, player.uid)