Example #1
0
def enterGuildBattleField(dynamicId,characterId):
    '''进入行会战副本
    @param dynamicId: int 客户端的动态id
    @param characterId: int 角色的id
    '''
    res = CanDoServer(characterId)
    if not res['result']:
        return res        
    player = PlayersManager().getPlayerByID(characterId)
    if  not player.CheckClient(dynamicId):
        return {'result':False,'message':Lg().g(18)}
    if not player.status.getLifeStatus():
        return {'result':False,'message':Lg().g(97)}
    if player.baseInfo.getState()==1:
        return {'result':False,'message':Lg().g(98)}
    guildId = player.guild.getID()
    if not guildId:
        return {'result':False,'message':Lg().g(79)}
    battleArea = BattleAreaManager().getGuildBattleAreaIdByGuildId(guildId)
    if not battleArea:
        return {'result':False,'message':Lg().g(99)}
    nowSceneId = battleArea.enterGuildBattleField(guildId,characterId)
    if not nowSceneId:
        return {'result':False,'message':Lg().g(100)}
    lastscene = SceneManager_new().getSceneById(player.baseInfo.getLocation())
    lastscene.dropPlayer(player.baseInfo.id)
    player.baseInfo.setState(2)
    data = {'placeId':nowSceneId}
    return {'result':True,'data':data}
    

    
    
        
        
Example #2
0
def playerBackRevive(dynamicId,characterId):
    '''角色回城复活
    @param dynamicId: int 客户端的id
    @param characterId: int 角色的id
    '''
    player = PlayersManager().getPlayerByID(characterId)
    if not player or not player.CheckClient(dynamicId):
        return {'result':False,'message':Lg().g(18)}
    if player.status.getLifeStatus():
        return {'result':False,'message':Lg().g(185)}
#    player.baseInfo.setState(0)
#    data = enterPlace(dynamicId,characterId,1000)
#    if not data.get('result',False):
#        return data
    state = player.baseInfo.getState()
    if state==0:
        lastscene = SceneManager_new().getSceneById(player.baseInfo.getLocation())
        lastscene.dropPlayer(player.baseInfo.id)
    else:
#        id=player.baseInfo.getInstanceid() #副本id
        tag=player.baseInfo.getInstancetag() #副本动态Id
        instance=InstanceManager().getInstanceByIdTag(tag) #获取副本实例
        old=instance._Scenes[player.baseInfo.getLocation()] #获取当前角色所在副本中的场景
        old.dropPlayer(player.baseInfo.id) #从当前场景中移除角色
    
    gotoSence = SceneManager_new().getSceneById(1000)
    if not gotoSence:
        scene = PublicScene(1000)
        SceneManager_new().addScene(scene)
#    else:
#        areaid = gotoSence.getAreaid()
    gotoSence.addPlayer(player)
#    player.baseInfo.setAreaid(areaid)
    player.baseInfo.setPosition(gotoSence.baseInfo.getInitiaPosition())
    player.baseInfo.setLocation(1000)
    player.baseInfo.setState(0)
    player.status.updateLifeStatus(1)
    player.attribute.updateHp(int(player.attribute.getMaxHp()*0.01)+1)
    player.attribute.updateMp(int(player.attribute.getMaxMp()*0.01)+1)
    
    pushEnterPlace(1000,dynamicId)
    player.teamcom.pushTeamMemberInfo()
    return {'result':True,'message':Lg().g(186)}