Example #1
0
def handle_get_char_list_req():
    print(sys._getframe().f_code.co_name)

    req = msg_packet_data_pb2.get_char_list_req()
    req.auth_token = VARS['auth_token']

    return msg.pack(msg_type_data_pb2.t_get_char_list_req, req)
Example #2
0
def handle_sign_in_req():
    print(sys._getframe().f_code.co_name)

    req = msg_packet_data_pb2.sign_in_req()
    req.plat_type = msg_enum_pb2.plat_none
    req.user_id = VARS['user_id']
    req.passwd = VARS['passwd']

    return msg.pack(msg_type_data_pb2.t_sign_in_req, req)
Example #3
0
def handle_create_character_req():
    print(sys._getframe().f_code.co_name)

    req = msg_packet_data_pb2.create_character_req()
    req.auth_token = VARS['auth_token']
    req.char_mid = VARS['char_mid']
    req.char_name = VARS['char_name']

    return msg.pack(msg_type_data_pb2.t_create_character_req, req)
def handle_sign_in(req_msg_body):
    req = msg_packet_data_pb2.sign_in_req()
    req.ParseFromString(req_msg_body)

    ack = msg_packet_data_pb2.sign_in_ack()
    ack.err_code = msg_error_pb2.err_server_unknown
    ack.auth_token = AESCrypto.generate_auth_token(req.user_id, [])

    # do something with db here
    #j = yield from asyncio.futures.wrap_future(g.THREAD_POOL.submit(b, 1))

    ack.err_code = msg_error_pb2.err_none

    return msg.pack(msg_type_data_pb2.t_sign_in_ack, ack)
def handle_get_char_list(req_msg_body):
    req = msg_packet_data_pb2.get_char_list_req()
    req.ParseFromString(req_msg_body)

    ack = msg_packet_data_pb2.get_char_list_ack()
    ack.err_code = msg_error_pb2.err_server_unknown
    ack.auth_token = ''

    # do something with db here
    j = yield from asyncio.futures.wrap_future(g.THREAD_POOL.submit(b, 1))

    ack.err_code = msg_error_pb2.err_none

    return msg.pack(msg_type_data_pb2.t_sign_in_ack, ack)
def handle_sign_up(req_msg_body):
    req = msg_packet_data_pb2.sign_up_req()
    req.ParseFromString(req_msg_body)

    ack = msg_packet_data_pb2.sign_up_ack()
    ack.err_code = msg_error_pb2.err_server_unknown
    ack.auth_token = ''

    print(1)
    yield from wrap_future(g.THREAD_POOL.submit(put_user, req))
    print(2)

    ack.err_code = msg_error_pb2.err_none
    ack.auth_token = AESCrypto.generate_auth_token(req.user_id, [])

    return msg.pack(msg_type_data_pb2.t_sign_up_ack, ack)
def handle_create_character(req_msg_body):
    req = msg_packet_data_pb2.create_character_req()
    req.ParseFromString(req_msg_body)

    ack = msg_packet_data_pb2.create_character_ack()
    ack.err_code = msg_error_pb2.err_server_unknown
    ack.auth_token = ''

    user_id = AESCrypto.get_user_id(req.auth_token)

    print(1)
    char_names = yield from wrap_future(g.THREAD_POOL.submit(put_character, req, user_id))
    print(2)

    ack.err_code = msg_error_pb2.err_none
    ack.auth_token = AESCrypto.generate_auth_token(user_id, char_names)

    return msg.pack(msg_type_data_pb2.t_sign_up_ack, ack)
Example #8
0
def handle_enter_town_req():
    print(sys._getframe().f_code.co_name)

    req = msg_packet_play_pb2.enter_town_req()

    return msg.pack(msg_type_play_pb2.t_enter_town_req, req)