Beispiel #1
0
    def setUp(self):
        char_initialize(1, 1, 1, 'a')
        self.char_id = 1
        self.session = crypto.encrypt('1:1:{0}'.format(1))

        char_initialize(2, 1, 2, 'b')
        self.other_char_id = 2
Beispiel #2
0
    def setUp(self):
        char_initialize(1, 1, 1, 'a')
        self.char_id = 1
        self.session = crypto.encrypt('1:1:{0}'.format(self.char_id))

        item = Item(self.char_id)
        eid = item.equip_add(1)
        self.equip_id = eid

        gems = [(1, 10), (2, 1)]
        item.gem_add(gems)
Beispiel #3
0
    def setUp(self):
        char_initialize(1, 1, 1, 'a')
        self.char_id = 1
        self.session = crypto.encrypt('1:1:{0}'.format(self.char_id))

        item = Item(self.char_id)
        eid = item.equip_add(1)
        self.equip_id = eid

        gems = [(1, 10), (2, 1)]
        item.gem_add(gems)
Beispiel #4
0
def character_initialize(request):
    account_id = int(request.POST['account_id'])
    server_id = server.id
    char_id=  int(request.POST['char_id'])
    name = request.POST['name']

    ret = 0
    try:
        char_initialize(account_id, server_id, char_id, name)
    except:
        import traceback
        traceback.print_exc()
        ret = 1

    return HttpResponse(json.dumps({'ret': ret}), content_type='application/json')
Beispiel #5
0
def character_initialize(request):
    account_id = int(request.POST['account_id'])
    server_id = server.id
    char_id=  int(request.POST['char_id'])
    name = request.POST['name']

    ret = 0
    try:
        char_initialize(account_id, server_id, char_id, name)
    except:
        import traceback
        traceback.print_exc()
        ret = 1

    return {'ret': ret}
Beispiel #6
0
def character_initialize(request):
    account_id = int(request.POST['account_id'])
    server_id = int(request.POST['server_id'])
    char_id=  int(request.POST['char_id'])
    name = request.POST['name']

    ret = 0
    try:
        char_initialize(account_id, server_id, char_id, name)
    except:
        import traceback
        traceback.print_exc()
        ret = 1

    return HttpResponse(json.dumps({'ret': ret}), content_type='application/json')
Beispiel #7
0
    def setUp(self):
        char = char_initialize(1, 1, 1, "a")
        self.char_id = 1
        self.session = crypto.encrypt("1:1:{0}".format(self.char_id))

        id_range = save_hero(self.char_id, 1).id_range
        self.hero_id = id_range[0]
Beispiel #8
0
    def setUp(self):
        char = char_initialize(1, 1, 1, 'a')
        self.char_id = 1
        self.session = crypto.encrypt('1:1:{0}'.format(self.char_id))

        id_range = save_hero(self.char_id, 1).id_range
        self.hero_id = id_range[0]
Beispiel #9
0
def create_character(request):
    req = request._proto

    data = {
        'account_id': request._account_id,
        'server_id': server.id,
        'name': req.name
    }

    res = api_character_create(data)
    if res['ret'] != 0:
        raise SanguoException(
            res['ret'],
            0,
            'Character Create',
            'api_character_create, ret = {0}'.format(res['ret'])
        )

    char_id = res['data']['char_id']
    try:
        char_initialize(request._account_id, server.id, char_id, req.name)
    except Exception as e:
        data = {
            'char_id': char_id,
        }
        api_character_failure(data)
        raise e

    login_signal.send(
        sender=None,
        char_id=char_id,
        real_login=True,
    )

    request._char_id = char_id

    game_session = request._game_session
    game_session.char_id = char_id

    new_session = crypto.encrypt(session_dumps(game_session))

    Player(char_id).set_login_id(game_session.login_id)

    response = CreateCharacterResponse()
    response.ret = 0
    return pack_msg(response, new_session)
Beispiel #10
0
def create_character(request):
    req = request._proto

    data = {
        'account_id': request._account_id,
        'server_id': server.id,
        'name': req.name
    }

    res = api_character_create(data)
    if res['ret'] != 0:
        raise SanguoException(
            res['ret'], 0, 'Character Create',
            'api_character_create, ret = {0}'.format(res['ret']))

    char_id = res['data']['char_id']
    try:
        char_initialize(request._account_id, server.id, char_id, req.name)
    except Exception as e:
        data = {
            'char_id': char_id,
        }
        api_character_failure(data)
        raise e

    login_signal.send(
        sender=None,
        char_id=char_id,
        real_login=True,
    )

    request._char_id = char_id

    game_session = request._game_session
    game_session.char_id = char_id

    new_session = crypto.encrypt(session_dumps(game_session))

    Player(char_id).set_login_id(game_session.login_id)

    response = CreateCharacterResponse()
    response.ret = 0
    return pack_msg(response, new_session)
Beispiel #11
0
    def setUp(self):
        char_initialize(1, 1, 1, "a")
        self.char_id = 1
        self.session = crypto.encrypt("1:1:{0}".format(self.char_id))

        self.panel = HeroPanel(self.char_id)
Beispiel #12
0
 def setUp(self):
     char_initialize(1, 1, 1, 'a')
     self.char_id = 1
     self.session = crypto.encrypt('1:1:{0}'.format(self.char_id))
Beispiel #13
0
 def setUp(self):
     char_initialize(1, 1, 1, 'a')
     self.char_id = 1
     self.session = crypto.encrypt('1:1:{0}'.format(self.char_id))
     self.item = Item(self.char_id)
     self.equip_id = self.item.equip_add(1)
Beispiel #14
0
 def setUp(self):
     char_initialize(1, 1, 1, 'a')
     self.char_id = 1
     self.session = crypto.encrypt('1:1:{0}'.format(self.char_id))
Beispiel #15
0
 def setUp(self):
     char_initialize(1, 1, 1, 'a')
     self.char_id = 1
     self.session = crypto.encrypt('1:1:{0}'.format(self.char_id))
     self.item = Item(self.char_id)
     self.equip_id = self.item.equip_add(1)