Exemplo n.º 1
0
def searchCharacterByName(dynamicId, characterId, nickname):
    '''根据昵称获取角色信息
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param nickname: string 角色的昵称
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result': False, 'message': Lg().g(18)}
    data = dbaccess.getCharecterInfoByNickName(nickname)
    if data:
        return {'result': True, 'message': Lg().g(72), 'data': data}
    return {'result': False, 'message': Lg().g(73), 'data': None}
Exemplo n.º 2
0
def searchCharacterByName(dynamicId,characterId,nickname):
    '''根据昵称获取角色信息
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    @param nickname: string 角色的昵称
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player:
        return {'result':False,'message':Lg().g(18)}
    data = dbaccess.getCharecterInfoByNickName(nickname)
    if data:
        return {'result':True,'message':Lg().g(72),'data':data}
    return {'result':False,'message':Lg().g(73),'data':None}
Exemplo n.º 3
0
def buyItemInMall(dynamicId, characterId, itemTemplateId, count, priceType, buyType, presentName):
    """购买商城中的物品
    @param dynamicId: int 客户端的id
    @param characterId: int 角色的id
    @param itemTemplateId: 物品的模板id
    @param priceType: int 1为钻价格 2为绑定钻价格
    @param butType: int 购买类型 0购买1赠送
    @param presentName: string 赠送角色的名称
    """
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {"result": False, "message": Lg().g(18)}
    tocid = 0  # 送给谁的
    if buyType == 1:
        data = dbaccess.getCharecterInfoByNickName(presentName)
        if not data:
            return {"result": False, "message": Lg().g(188) % presentName}
        else:
            tocid = data.get("id", 0)
    mall_item = Mall().getItemInfoById(itemTemplateId)  # 获取商城物品
    if not mall_item:
        return {"result": False, "message": Lg().g(189)}
    return buyService(player, itemTemplateId, count, mall_item, tocid)
Exemplo n.º 4
0
def buyItemInMall(dynamicId, characterId, itemTemplateId, count, priceType,
                  buyType, presentName):
    '''购买商城中的物品
    @param dynamicId: int 客户端的id
    @param characterId: int 角色的id
    @param itemTemplateId: 物品的模板id
    @param priceType: int 1为钻价格 2为绑定钻价格
    @param butType: int 购买类型 0购买1赠送
    @param presentName: string 赠送角色的名称
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {'result': False, 'message': Lg().g(18)}
    tocid = 0  #送给谁的
    if buyType == 1:
        data = dbaccess.getCharecterInfoByNickName(presentName)
        if not data:
            return {'result': False, 'message': Lg().g(188) % presentName}
        else:
            tocid = data.get('id', 0)
    mall_item = Mall().getItemInfoById(itemTemplateId)  #获取商城物品
    if not mall_item:
        return {'result': False, 'message': Lg().g(189)}
    return buyService(player, itemTemplateId, count, mall_item, tocid)