Exemple #1
0
def differenceMapMove(characterId, targetScene):
    nowPosition = CacheContorl.characterData['character'][characterId][
        'Position']
    isAffiliation = MapHandle.judgeSceneIsAffiliation(nowPosition, targetScene)
    nowTruePosition = MapHandle.getScenePathForTrue(nowPosition)
    if isAffiliation == '0':
        nowTrueAffiliation = MapHandle.judgeSceneIsAffiliation(
            nowTruePosition, targetScene)
        if nowTrueAffiliation == '0':
            nowTrueMap = MapHandle.getMapForPath(nowTruePosition)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                nowTrueMap, nowPosition)
            return identicalMapMove(characterId, nowTrueMap, nowMapSceneId,
                                    '0')
        elif nowTrueAffiliation == '1':
            nowMap = MapHandle.getMapForPath(targetScene)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                nowMap, nowPosition)
            return identicalMapMove(characterId, nowMap, nowMapSceneId, '0')
    elif isAffiliation == '1':
        nowMap = MapHandle.getMapForPath(nowPosition)
        nowTargetMapSceneId = MapHandle.getMapSceneIdForScenePath(
            nowMap, targetScene)
        return identicalMapMove(characterId, nowMap, '0', nowTargetMapSceneId)
    else:
        nowTrueMap = MapHandle.getMapForPath(nowTruePosition)
        if nowTrueMap == []:
            nowTargetMapSceneId = MapHandle.getMapSceneIdForScenePath(
                [], targetScene)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                [], nowTruePosition)
            return identicalMapMove(characterId, [], nowMapSceneId,
                                    nowTargetMapSceneId)
        else:
            relationMapList = MapHandle.getRelationMapListForScenePath(
                nowTruePosition)
            nowSceneRealMap = relationMapList[-1]
            commonMap = MapHandle.getCommonMapForScenePath(
                nowTruePosition, targetScene)
            realMapInMap = MapHandle.getMapForPath(nowSceneRealMap)
            targetMapSceneId = MapHandle.getMapSceneIdForScenePath(
                commonMap, targetScene)
            if nowSceneRealMap == commonMap:
                nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                    commonMap, nowTruePosition)
            elif realMapInMap == commonMap:
                nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
                    commonMap, nowSceneRealMap)
            identicalMapMove(characterId, commonMap, nowMapSceneId,
                             targetMapSceneId)
Exemple #2
0
def characterMove(characterId, targetScene):
    characterId = str(characterId)
    nowPosition = CacheContorl.characterData['character'][characterId][
        'Position']
    sceneHierarchy = MapHandle.judgeSceneAffiliation(nowPosition, targetScene)
    if sceneHierarchy == '0':
        mapPath = MapHandle.getCommonMapForScenePath(nowPosition, targetScene)
        nowMapSceneId = MapHandle.getMapSceneIdForScenePath(
            mapPath, nowPosition)
        targetMapSceneId = MapHandle.getMapSceneIdForScenePath(
            mapPath, targetScene)
        moveEnd = identicalMapMove(characterId, mapPath, nowMapSceneId,
                                   targetMapSceneId)
    else:
        moveEnd = differenceMapMove(characterId, targetScene)
    return moveEnd
Exemple #3
0
def characterMove(characterId:str,targetScene:list) -> 'MoveEnd:str_Null,str_End,list':
    '''
    通用角色移动控制
    Keyword arguments:
    characterId -- 角色id
    targetScene -- 寻路目标场景(在地图系统下的绝对坐标)
    '''
    nowPosition = CacheContorl.characterData['character'][characterId].Position
    sceneHierarchy = MapHandle.judgeSceneAffiliation(nowPosition,targetScene)
    if sceneHierarchy == 'common':
        mapPath = MapHandle.getCommonMapForScenePath(nowPosition,targetScene)
        nowMapSceneId = MapHandle.getMapSceneIdForScenePath(mapPath,nowPosition)
        targetMapSceneId = MapHandle.getMapSceneIdForScenePath(mapPath,targetScene)
        moveEnd = identicalMapMove(characterId,mapPath,nowMapSceneId,targetMapSceneId)
    else:
        moveEnd = differenceMapMove(characterId,targetScene)
    return moveEnd
Exemple #4
0
def differenceMapMove(characterId:str,targetScene:list) -> 'MoveEnd:str_Null,str_End,list':
    '''
    角色跨地图层级移动
    Keyword arguments:
    characterId -- 角色id
    targetScene -- 寻路目标场景(在地图系统下的绝对坐标)
    '''
    nowPosition = CacheContorl.characterData['character'][characterId].Position
    isAffiliation = MapHandle.judgeSceneIsAffiliation(nowPosition,targetScene)
    nowTruePosition = MapHandle.getScenePathForTrue(nowPosition)
    mapDoorData = MapHandle.getMapDoorDataForScenePath(MapHandle.getMapSystemPathStrForList(nowTruePosition))
    doorScene = '0'
    nowTrueMap = MapHandle.getMapForPath(nowTruePosition)
    nowTrueMapMapSystemStr = MapHandle.getMapSystemPathStrForList(nowTrueMap)
    if isAffiliation == 'subordinate':
        nowTrueAffiliation = MapHandle.judgeSceneIsAffiliation(nowTruePosition,targetScene)
        if nowTrueAffiliation == 'subordinate':
            if mapDoorData != {}:
                doorScene = mapDoorData[nowTrueMapMapSystemStr]['Door']
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(nowTrueMap,nowPosition)
            return identicalMapMove(characterId,nowTrueMap,nowMapSceneId,doorScene)
        elif nowTrueAffiliation == 'superior':
            nowMap = MapHandle.getMapForPath(targetScene)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath(nowMap,nowPosition)
            return identicalMapMove(characterId,nowMap,nowMapSceneId,doorScene)
    else:
        if nowTrueMap == []:
            nowTargetMapSceneId = MapHandle.getMapSceneIdForScenePath([],targetScene)
            nowMapSceneId = MapHandle.getMapSceneIdForScenePath([],nowTruePosition)
            return identicalMapMove(characterId,[],nowMapSceneId,nowTargetMapSceneId)
        else:
            relationMapList = MapHandle.getRelationMapListForScenePath(nowTruePosition)
            nowSceneRealMap = relationMapList[-1]
            commonMap = MapHandle.getCommonMapForScenePath(nowTruePosition,targetScene)
            realMapInMap = MapHandle.getMapForPath(nowSceneRealMap)
            targetMapSceneId = MapHandle.getMapSceneIdForScenePath(commonMap,targetScene)
            if nowSceneRealMap == commonMap:
                nowMapSceneId = MapHandle.getMapSceneIdForScenePath(commonMap,nowTruePosition)
            elif realMapInMap == commonMap:
                nowMapSceneId = MapHandle.getMapSceneIdForScenePath(commonMap,nowSceneRealMap)
            else:
                nowMapSceneId =MapHandle.getMapSceneIdForScenePath(nowTrueMap,nowTruePosition)
                targetMapSceneId = '0'
            return identicalMapMove(characterId,commonMap,nowMapSceneId,targetMapSceneId)