Esempio n. 1
0
def reset_overcome_time_1509(data, player):
    request = pvp_rank_pb2.ResetPvpOvercomeTime()
    request.ParseFromString(data)
    response = CommonResponse()

    if player.base_info.is_firstday_from_register(const.OPEN_FEATURE_GGZJ):
        response.result = False
        response.result_no = 150901
        return response.SerializeToString()

    response.result = player.pvp.reset_overcome()
    return response.SerializeToString()
Esempio n. 2
0
def nickname_create_5(request_proto, player):
    argument = CreatePlayerRequest()
    argument.ParseFromString(request_proto)
    nickname = argument.nickname
    response = CommonResponse()

    # match = re.search(u'[\uD800-\uDBFF][\uDC00-\uDFFF]', nickname)
    match = re.search(u'^[a-zA-Z0-9\u4e00-\u9fa5]+$', nickname)
    if not match:
        response.result = False
        response.result_no = 868
        logger.info('not support emoji')
        return response.SerializeToString()

    if trie_tree.check.replace_bad_word(nickname) != nickname:
        response.result = False
        response.result_no = 869
        return response.SerializeToString()

    # 判断昵称是否重复
    nickname_obj = tb_character_info.getObj('nickname')
    result = nickname_obj.hsetnx(nickname, player.base_info.id)
    print 'is new player:', result
    if not result:
        response.result = False
        response.result_no = 870
        return response.SerializeToString()

    print type(nickname), '===============222'
    player.base_info.base_name = nickname
    player.base_info.save_data()

    # 加入聊天
    remote_gate.login_chat_remote(player.dynamic_id, player.base_info.id,
                                  player.guild.g_id, nickname,
                                  player.base_info.gag)

    tlog_action.log('CreateNickname', player, nickname)

    response.result = True
    return response.SerializeToString()
Esempio n. 3
0
def nickname_create_5(request_proto, player):
    argument = CreatePlayerRequest()
    argument.ParseFromString(request_proto)
    nickname = argument.nickname
    response = CommonResponse()

    match = re.search(u'[\uD800-\uDBFF][\uDC00-\uDFFF]', nickname)
    if match:
        response.result = False
        response.result_no = 1
        logger.info('not support emoji')
        return response.SerializeToString()

    if trie_tree.check.replace_bad_word(nickname) != nickname:
        response.result = False
        response.result_no = 1
        return response.SerializeToString()

    # 判断昵称是否重复
    sql_result = util.GetOneRecordInfo('tb_character_info',
                                       dict(nickname=nickname))
    if sql_result:
        response.result = False
        response.result_no = 1
        return response.SerializeToString()

    character_obj = tb_character_info.getObj(player.base_info.id)
    if not character_obj:
        response.result_no = 2
        return response.SerializeToString()
    character_obj.update('nickname', nickname)

    # 加入聊天
    remote_gate.login_chat_remote(player.dynamic_id,
                                  player.base_info.id,
                                  player.guild.g_id,
                                  nickname)

    response.result = True
    return response.SerializeToString()
Esempio n. 4
0
def share_2102(pro_data, player):
    """分享hjqy, 广播协议号2112
    """
    response = CommonResponse()
    result = remote_gate['world'].share_hjqy_remote(player.base_info.id)
    friend_ids = player.friends.friends
    boss_info = remote_gate['world'].get_boss_info_remote(player.base_info.id)
    for fid in friend_ids:
        send_mail(conf_id=512,
                  receive_id=fid,
                  nickname=player.base_info.base_name,
                  boss_id=boss_info.get('stage_id'))

    #remote_gate.push_object_remote(2112, '', friend_ids)
    response.result = result
    return response.SerializeToString()