Пример #1
0
def enterPlace_601(dynamicId, characterId, placeId,force,player):
    '''进入场景'''
    state = 0
    if not player:
        player = PlayerCharacter(characterId,dynamicId = dynamicId)
        player.setlastOnline(datetime.datetime.now())
        pushPlayerGonggaoXinxi(player)
    else:
        player = cPickle.loads(player)
        player.startAllTimer()
        state = 1
    #判断是否满足进入场景的需求
    sceneInfo = dbMap.ALL_MAP_INFO.get(placeId,{})
    levelRequired = sceneInfo['level']
    if player.level.getLevel()<sceneInfo['level']:
        msg = Lg().g(607)%levelRequired
        pushOtherMessage(905, msg, [dynamicId])
        return {'result':False,'message':Lg().g(332)}
    player.baseInfo.setTown( placeId)
    player.baseInfo.setState(0)
    PlayersManager().addPlayer(player)
    defencelog_app.isReward(player.baseInfo.id, player.getDynamicId())
    scene = MapManager().getMapId(placeId)
    scenename = scene.getSceneName()
    chatnoderemote.callRemote('JoinRoom',characterId,placeId,scenename)
    scene.addPlayer(characterId)
    player.quest.setNpcList(scene._npclist)
    scene.pushEnterPlace([dynamicId])
#    if not state:
#        publicnoderemote.callRemote('addPcharacter',characterId,getNodeId())
#    else:
#        publicnoderemote.callRemote('updatePCharacterNodeId',characterId,getNodeId())
    return {'result':True,'message':'','data':{'placeId':placeId}}
Пример #2
0
def tiaozhuan(dynamicId,characterid,csz):
    '''场景间的跳转或者进入副本
    '''
    player = PlayersManager().getPlayerByID(characterid)
    if not player:
        return {'result':False,'message':Lg().g(18)}
    doorinfo = dbMap.ALL_DOOR_INFO.get(csz)#获取传送门的信息
    lastscene = MapManager().getMapId(player.baseInfo.getTown())
    if doorinfo.get('functionType')==1:#跳转场景
        placeId = doorinfo.get('nextmap')
        position = (doorinfo.get('init_x'),doorinfo.get('init_y'))
        player.baseInfo.setTown( placeId)
        player.baseInfo.setState(0)
        PlayersManager().addPlayer(player)
        defencelog_app.isReward(player.baseInfo.id, player.getDynamicId())
        scene = MapManager().getMapId(placeId)
        scenename = scene.getSceneName()
        chatnoderemote.callRemote('JoinRoom',characterid,placeId,scenename)
        scene.addPlayer(characterid)
        player.quest.setNpcList(scene._npclist)
        player.baseInfo.initPosition(position)
        scene.pushEnterPlace([dynamicId])
        result = {'result':True}
    else:
        instanceId = doorinfo.get('famID')
        result = instance_app.enterInstance1(player,dynamicId, characterid, instanceId,0)
    if result.get('result'):
        lastscene.dropPlayer(characterid)
Пример #3
0
def ObtainAllReward_2403(dynamicId, request_proto):
    '''领取所有保卫奖励'''
    argument=ObtainAllReward2403_pb2.ObtainAllRewardRequest()
    argument.ParseFromString(request_proto)
    response=ObtainAllReward2403_pb2.ObtainAllRewardResponse()
    id=argument.id #角色id
    dynamicId = dynamicId
    result,message=defencelog_app.ObtainAllReward(id) #返回执行结果和返回信息
    defencelog_app.isReward(id,dynamicId)#刷新图标
    response.result=result
    response.message=message
    return response.SerializeToString()
Пример #4
0
def ObtainAllReward_2403(dynamicId, request_proto):
    '''领取所有保卫奖励'''
    argument = ObtainAllReward2403_pb2.ObtainAllRewardRequest()
    argument.ParseFromString(request_proto)
    response = ObtainAllReward2403_pb2.ObtainAllRewardResponse()
    id = argument.id  #角色id
    dynamicId = dynamicId
    result, message = defencelog_app.ObtainAllReward(id)  #返回执行结果和返回信息
    defencelog_app.isReward(id, dynamicId)  #刷新图标
    response.result = result
    response.message = message
    return response.SerializeToString()