Exemplo n.º 1
0
def deleteRole(dynamicId,userId,characterId,password):
    '''删除角色
    @param userId: int 用户id
    @param characterId: 角色的id 
    @param password: string 用户的密码
    '''
    user=UsersManager().getUserByID(userId)
    if dynamicId != user.getDynamicId():
        return {'result':False,'message':Lg().g(18)}
    if user is None:
        return {'result':False,'message':Lg().g(18)}
    res = dbaccess.checkUserPassword(userId, password)
    if not res:
        return {'result':False,'message':Lg().g(150)}
    data = user.deleteCharacter(characterId)
    return data
Exemplo n.º 2
0
def deleteRole(dynamicId, userId, characterId, password):
    '''删除角色
    @param userId: int 用户id
    @param characterId: 角色的id 
    @param password: string 用户的密码
    '''
    user = UsersManager().getUserByID(userId)
    if dynamicId != user.getDynamicId():
        return {'result': False, 'message': Lg().g(18)}
    if user is None:
        return {'result': False, 'message': Lg().g(18)}
    res = dbaccess.checkUserPassword(userId, password)
    if not res:
        return {'result': False, 'message': Lg().g(150)}
    data = user.deleteCharacter(characterId)
    return data
Exemplo n.º 3
0
def roleLogin(dynamicId,userId,characterId):
    '''角色登陆
    @param userId: int 用户id
    @param characterId: 角色的id 
    '''
    user=UsersManager().getUserByID(userId)
    if dynamicId != user.getDynamicId():
        return {'result':False,'message':Lg().g(18)}
    if not user:
        return {'result':False,'message':Lg().g(18)}
    user.dropAllCharacter()
    PlayersManager().dropPlayerByID(characterId)
    player = PlayerCharacter(characterId,dynamicId=dynamicId)
    PlayersManager().addPlayer(player)
    if not player.status.getLifeStatus():
        player.status.updateLifeStatus( 1)
        player.attribute.updateHp(int(player.attribute.getMaxHp()*0.01)+1)
        player.attribute.updateMp(int(player.attribute.getMaxMp()*0.01)+1)
    data = {}
    data['placeId'] = player.baseInfo.getTown()
#    player.quest.pushPlayerQuestProcessList()
    user.updateLastCharacter(characterId)
    return {'result':True,'message':Lg().g(25),'data':data}
Exemplo n.º 4
0
def roleLogin(dynamicId, userId, characterId):
    '''角色登陆
    @param userId: int 用户id
    @param characterId: 角色的id 
    '''
    user = UsersManager().getUserByID(userId)
    if dynamicId != user.getDynamicId():
        return {'result': False, 'message': Lg().g(18)}
    if not user:
        return {'result': False, 'message': Lg().g(18)}
    user.dropAllCharacter()
    PlayersManager().dropPlayerByID(characterId)
    player = PlayerCharacter(characterId, dynamicId=dynamicId)
    PlayersManager().addPlayer(player)
    if not player.status.getLifeStatus():
        player.status.updateLifeStatus(1)
        player.attribute.updateHp(int(player.attribute.getMaxHp() * 0.01) + 1)
        player.attribute.updateMp(int(player.attribute.getMaxMp() * 0.01) + 1)
    data = {}
    data['placeId'] = player.baseInfo.getTown()
    #    player.quest.pushPlayerQuestProcessList()
    user.updateLastCharacter(characterId)
    return {'result': True, 'message': Lg().g(25), 'data': data}