def getTextIndex(text): textStyleList = RichText.setRichTextPrint(text, 'standard') textIndex = 0 stylewidth = 0 barlist = TextLoading.getTextData(TextLoading.barListId,'barlist') styleNameList = GameConfig.getFontDataList() + TextLoading.getTextData(TextLoading.barListId,'barlist') for i in range(0, len(styleNameList)): styleTextHead = '<' + styleNameList[i] + '>' styleTextTail = '</' + styleNameList[i] + '>' if styleTextHead in text: if styleNameList[i] in TextLoading.getTextData(TextLoading.barListId,'barlist'): text = text.replace(styleTextHead, '') text = text.replace(styleTextTail, '') else: text = text.replace(styleTextHead, '') text = text.replace(styleTextTail, '') else: pass count = len(text) for i in range(0,count): if textStyleList[i] in barlist: textwidth = TextLoading.getTextData(TextLoading.barListId,textStyleList[i])['width'] textIndex = textIndex + int(textwidth) else: textIndex = textIndex + get_width(ord(text[i])) return textIndex + stylewidth
def seeMovePathPanel(): inputS = [] sceneId = CacheContorl.playObject['object']['0']['Position'] mapId = MapHandle.getMapIdForScene(sceneId) mapData = CacheContorl.mapData['MapData'][mapId] movePathInfo = TextLoading.getTextData(TextLoading.messageId, '27') EraPrint.p(movePathInfo) EraPrint.p('\n') pathEdge = mapData['PathEdge'] mapSceneId = str(MapHandle.getMapSceneIdForSceneId(mapId, sceneId)) scenePath = pathEdge[mapSceneId] scenePathList = ValueHandle.dictKeysToList(scenePath) try: scenePathList.remove(mapSceneId) except ValueError: pass if len(scenePathList) > 0: sceneCmd = [] for scene in scenePathList: loadSceneData = MapHandle.getSceneDataForMap(mapId, scene) sceneName = loadSceneData['SceneName'] sceneCmd.append(sceneName) yrn = CmdButtonQueue.optionstr(cmdList=None, cmdListData=sceneCmd, cmdColumn=4, askfor=False, cmdSize='center') inputS = inputS + yrn else: errorMoveText = TextLoading.getTextData(TextLoading.messageId, '28') EraPrint.p(errorMoveText) EraPrint.pline() return {'inputS': inputS, 'scenePathList': scenePathList}
def getGoldText(playerId): goldData = CacheContorl.playObject['object'][playerId]['Gold'] goldData = str(goldData) moneyText = TextLoading.getTextData(TextLoading.stageWordId, '66') goldText = TextLoading.getTextData(TextLoading.stageWordId, '67') goldText = goldText + goldData + moneyText return goldText
def detailedSetting_func1(): flowRetun = CreatorPlayerPanel.detailedSetting1Panel() playerSex = CacheContorl.playObject['object']['0']['Sex'] sexList = TextLoading.getTextData(TextLoading.roleId, 'Sex') if flowRetun == 0: PyCmd.clr_cmd() detailedSetting_func2() elif flowRetun == 1: if playerSex == sexList[0]: CacheContorl.featuresList['Age'] = featuresList["Age"][0] elif playerSex == sexList[1]: CacheContorl.featuresList['Age'] = featuresList["Age"][1] else: CacheContorl.featuresList['Age'] = featuresList["Age"][2] PyCmd.clr_cmd() CacheContorl.temporaryObject[ 'Features'] = CacheContorl.featuresList.copy() playerAgeTemName = AttrCalculation.getAgeTemList()[1] playerAge = AttrCalculation.getAge(playerAgeTemName) playerTem = TextLoading.getTextData(TextLoading.temId, 'TemList')[playerSex] playerHeigt = AttrCalculation.getHeight(playerTem, playerAge) playerWeight = AttrCalculation.getWeight('Ordinary', playerHeigt['NowHeight']) playerMeasurements = AttrCalculation.getMeasurements( playerTem, playerHeigt['NowHeight'], 'Ordinary') CacheContorl.temporaryObject['Age'] = playerAge CacheContorl.temporaryObject['Height'] = playerHeigt CacheContorl.temporaryObject['Weight'] = playerWeight CacheContorl.temporaryObject['Measurements'] = playerMeasurements detailedSetting_func2()
def askLoadSavePanel(): EraPrint.p('\n') cmdList = TextLoading.getTextData(TextLoading.cmdId, "loadSaveAsk") messageText = TextLoading.getTextData(TextLoading.messageId, '23') EraPrint.pline() EraPrint.p(messageText) EraPrint.p('\n') yrn = CmdButtonQueue.optionint(None, 1, askfor=False, cmdListData=cmdList) return yrn
def confirmationRemoveSavePanel(): EraPrint.p('\n') cmdList = TextLoading.getTextData(TextLoading.cmdId, "confirmationRemoveSave") messageText = TextLoading.getTextData(TextLoading.messageId, '25') EraPrint.pline() EraPrint.p(messageText) EraPrint.p('\n') yrn = CmdButtonQueue.optionint(None, 1, askfor=False, cmdListData=cmdList) return yrn
def seeScenePanel(): sceneData = CacheContorl.sceneData.copy() titleText = TextLoading.getTextData(TextLoading.stageWordId, '75') EraPrint.plt(titleText) timeText = GameTime.getDateText() EraPrint.p(timeText) EraPrint.p(' ') sceneId = CacheContorl.playObject['object']['0']['Position'] sceneName = sceneData['SceneData'][sceneId]['SceneName'] sceneInfoHead = TextLoading.getTextData(TextLoading.stageWordId, '76') sceneInfo = sceneInfoHead + sceneName EraPrint.p(sceneInfo) EraPrint.plittleline()
def getHpAndMpText(playerId): playerId = str(playerId) playerData = CacheContorl.playObject['object'][playerId] playerHitPoint = playerData['HitPoint'] playerMaxHitPoint = playerData['HitPointMax'] hitPointText = TextLoading.getTextData(TextLoading.stageWordId, '8') hpText = hitPointText + '(' + str(playerHitPoint) + '/' + str( playerMaxHitPoint) + ')' playerManaPoint = playerData['ManaPoint'] playerMaxManaPoint = playerData['ManaPointMax'] manaPointText = TextLoading.getTextData(TextLoading.stageWordId, '9') mpText = manaPointText + '(' + str(playerManaPoint) + '/' + str( playerMaxManaPoint) + ')' return hpText + ' ' + mpText
def startInputNamePanel(): EraPrint.pline() EraPrint.pl(TextLoading.getTextData(TextLoading.messageId, '3')) inputState = 0 while inputState == 0: playerName = GameInit.askfor_str() EraPrint.pl(playerName) if TextHandle.getTextIndex(playerName) > 10: EraPrint.pl( TextLoading.getTextData(TextLoading.errorId, 'inputNameTooLongError')) else: inputState = 1 CacheContorl.temporaryObject['Name'] = playerName
def acknowledgmentAttributeAns(inputList): playerId = CacheContorl.playObject['objectId'] yrn = GameInit.askfor_All(inputList) showAttrHandleData = TextLoading.getTextData(TextLoading.cmdId,'seeAttrPanelHandle') PyCmd.clr_cmd() if yrn in panelList: PanelStateHandle.panelStateChange(yrn) acknowledgmentAttribute_func() elif yrn == '0': GameTime.initTime() AttrCalculation.setAttrOver(playerId) CharacterHandle.initCharacterList() SeePlayerAttrPanel.initShowAttrPanelList() playerPosition = CacheContorl.playObject['object'][playerId]['Position'] MapHandle.playerMoveScene('0', playerPosition, playerId) import script.Flow.Main as mainframe mainframe.mainFrame_func() elif yrn == '1': CacheContorl.wframeMouse['wFrameRePrint'] = 1 EraPrint.pnextscreen() SeePlayerAttrPanel.initShowAttrPanelList() import Design.StartFlow as mainflow mainflow.main_func() elif yrn in showAttrHandleData: index = showAttrHandleData.index(yrn) index = str(index) CacheContorl.panelState['AttrShowHandlePanel'] = index acknowledgmentAttribute_func()
def seePlayerListPanel(maxPage): titleText = TextLoading.getTextData(TextLoading.stageWordId, '74') EraPrint.plt(titleText) inputS = [] pageId = int(CacheContorl.panelState['SeePlayerListPanel']) pageShow = int(GameConfig.playerlist_show) maxPage = int(maxPage) playerMax = CharacterHandle.getCharacterIndexMax() if pageId == maxPage: showPageStart = pageShow * (pageId) showPageOver = showPageStart + (playerMax - showPageStart) else: showPageOver = pageShow * pageId showPageStart = showPageOver - pageShow for i in range(showPageStart, showPageOver + 1): playerId = str(i) cmdId = i - showPageStart cmdIdText = CmdButtonQueue.idIndex(cmdId) cmdText = AttrText.getPlayerAbbreviationsInfo(playerId) cmdIdTextIndex = TextHandle.getTextIndex(cmdIdText) windowWidth = int(GameConfig.text_width) textWidth = windowWidth - cmdIdTextIndex cmdText = TextHandle.align(cmdText, 'center', textWidth=textWidth) cmdText = cmdIdText + ' ' + cmdText cmdId = str(cmdId) EraPrint.plittleline() PyCmd.pcmd(cmdText, cmdId, None) inputS.append(cmdId) EraPrint.p('\n') pageText = '(' + str(pageId) + '/' + str(maxPage) + ')' EraPrint.printPageLine(sample='-', string=pageText) EraPrint.p('\n') return inputS
def getHeight(temName,age,Features): temData = templateData['HeightTem'][temName] initialHeight = random.uniform(temData[0],temData[1]) age = int(age) expectHeightFix = 0 figuresData = TextLoading.getTextData(TextLoading.roleId,'Features')['Figure'] if Features['Figure'] == figuresData[0]: expectHeightFix = 50 elif Features['Figure'] == figuresData[1]: expectHeightFix = -50 if temName == 'Man' or 'Asexual': expectAge = random.randint(18,22) expectHeight = initialHeight / 0.2949 else: expectAge = random.randint(13,17) expectHeight = initialHeight / 0.3109 expectHeight = expectHeight + expectHeightFix developmentAge = random.randint(4,6) growthHeightData = getGrowthHeight(age,expectHeight,developmentAge,expectAge) growthHeight = growthHeightData['GrowthHeight'] nowHeight = growthHeightData['NowHeight'] if age > expectAge: nowHeight = expectHeight else: nowHeight = 365 * growthHeight * age + nowHeight return {"NowHeight":nowHeight,"GrowthHeight":growthHeight,"ExpectAge":expectAge,"DevelopmentAge":developmentAge,"ExpectHeight":expectHeight}
def detailedSetting2Panel(): EraPrint.p('\n') EraPrint.pline() EraPrint.pl(TextLoading.getTextData(TextLoading.messageId, '11')) yrn = CmdButtonQueue.optionstr(CmdButtonQueue.detailedsetting2, 5, 'center', True) return yrn
def inputSexPanel(): playerId = CacheContorl.playObject['objectId'] sexId = CacheContorl.playObject['object'][playerId]['Sex'] EraPrint.pline() EraPrint.pl(TextLoading.getTextData(TextLoading.messageId, '8')[sexId]) yrn = CmdButtonQueue.optionint(CmdButtonQueue.currencymenu, 1) EraPrint.p('\n') return yrn
def removeSave(saveId): savePath = getSavefilePath(saveId) if os.path.isfile(savePath): os.remove(savePath) else: errorText = TextLoading.getTextData(TextLoading.errorId, 'notSaveError') EraPrint.pl(errorText)
def attributeGenerationBranchPanel(): playerId = CacheContorl.playObject['objectId'] AttrCalculation.setAttrDefault(playerId) PyCmd.clr_cmd() EraPrint.pline() EraPrint.pl(TextLoading.getTextData(TextLoading.messageId, '9')) yrn = CmdButtonQueue.optionint(CmdButtonQueue.currencymenu, 1) return yrn
def seeMapPanel(): inputS = [] titleText = TextLoading.getTextData(TextLoading.stageWordId, '78') EraPrint.plt(titleText) sceneId = CacheContorl.playObject['object']['0']['Position'] mapId = MapHandle.getMapIdForScene(sceneId) inputS = inputS + MapHandle.printMap(mapId) return inputS
def seeAttrOnEveryTime_func(oldPanel,tooOldFlow = None): objectId = CacheContorl.playObject['objectId'] if oldPanel == 'InScenePanel': sceneId = CacheContorl.playObject['object']['0']['Position'] objectIdList = MapHandle.getScenePlayerIdList(sceneId) else: objectIdList = ValueHandle.dictKeysToList(CacheContorl.playObject['object']) objectIdIndex = objectIdList.index(objectId) inputS = [] seeAttrList = seeAttrInEveryTime_func() inputS = inputS + seeAttrList askSeeAttr = SeePlayerAttrPanel.askForSeeAttr() inputS = inputS + askSeeAttr yrn = GameInit.askfor_All(inputS) PyCmd.clr_cmd() showAttrHandleData = TextLoading.getTextData(TextLoading.cmdId, 'seeAttrPanelHandle') objectMax = objectIdList[len(objectIdList) - 1] if yrn in showAttrHandleData: index = showAttrHandleData.index(yrn) index = str(index) CacheContorl.panelState['AttrShowHandlePanel'] = index seeAttrOnEveryTime_func(oldPanel,tooOldFlow) elif yrn in panelList: PanelStateHandle.panelStateChange(yrn) seeAttrOnEveryTime_func(oldPanel,tooOldFlow) elif yrn == '0': if objectIdIndex == 0: CacheContorl.playObject['objectId'] = objectMax seeAttrOnEveryTime_func(oldPanel,tooOldFlow) else: playerId = objectIdList[objectIdIndex - 1] CacheContorl.playObject['objectId'] = playerId seeAttrOnEveryTime_func(oldPanel,tooOldFlow) elif yrn == '1': if oldPanel == 'MainFramePanel': import Flow.Main as mainframe SeePlayerAttrPanel.initShowAttrPanelList() CacheContorl.playObject['objectId'] = '0' mainframe.mainFrame_func() elif oldPanel == 'SeePlayerListPanel': SeePlayerAttrPanel.initShowAttrPanelList() import Flow.SeePlayerList as seeplayerlist seeplayerlist.seePlayerList_func(tooOldFlow) elif oldPanel == 'InScenePanel': SeePlayerAttrPanel.initShowAttrPanelList() import Flow.InScene as inscene CacheContorl.playObject['objectId'] = '0' inscene.getInScene_func() elif yrn == '2': if objectId == objectMax: objectId = objectIdList[0] CacheContorl.playObject['objectId'] = objectId seeAttrOnEveryTime_func(oldPanel,tooOldFlow) else: objectId = objectIdList[objectIdIndex + 1] CacheContorl.playObject['objectId'] = objectId seeAttrOnEveryTime_func(oldPanel,tooOldFlow) pass
def getSexItemText(sexItemList): headid = sexItemList["Head"] eyeid = sexItemList["Eye"] earid = sexItemList["Ear"] mouthid = sexItemList["Mouth"] finesseid = sexItemList["Finesse"] fingerid = sexItemList["Finger"] chestid = sexItemList["Chest"] privatesid = sexItemList["Privates"] anusid = sexItemList["Anus"] otherid = sexItemList["Other"] sexItemData = equipmentData["SexItem"] headText = sexItemData["Head"][headid] eyeText = sexItemData["Eye"][eyeid] earText = sexItemData["Ear"][earid] mouthText = sexItemData["Mouth"][mouthid] finesseText = sexItemData["Finesse"][finesseid] fingerText = sexItemData["Finger"][fingerid] chestText = sexItemData["Chest"][chestid] privatesText = sexItemData["Privates"][privatesid] anusText = sexItemData["Anus"][anusid] otherText = sexItemData["Other"][otherid] headText = TextLoading.getTextData(TextLoading.stageWordId, "49") + headText eyeText = TextLoading.getTextData(TextLoading.stageWordId, "50") + eyeText earText = TextLoading.getTextData(TextLoading.stageWordId, "51") + earText mouthText = TextLoading.getTextData(TextLoading.stageWordId, "52") + mouthText finesseText = TextLoading.getTextData(TextLoading.stageWordId, "53") + finesseText fingerText = TextLoading.getTextData(TextLoading.stageWordId, "54") + fingerText chestText = TextLoading.getTextData(TextLoading.stageWordId, "55") + chestText privatesText = TextLoading.getTextData(TextLoading.stageWordId, "56") + privatesText anusText = TextLoading.getTextData(TextLoading.stageWordId, "57") + anusText otherText = TextLoading.getTextData(TextLoading.stageWordId, "58") + otherText sexItemTextList = [ headText, eyeText, earText, mouthText, finesseText, fingerText, chestText, privatesText, anusText, otherText ] return sexItemTextList
def inputNickNamePanel(): playerId = CacheContorl.playObject['objectId'] CacheContorl.playObject['object'][ playerId] = CacheContorl.temporaryObject.copy() EraPrint.pline() EraPrint.pl(TextLoading.getTextData(TextLoading.messageId, '6')) yrn = CmdButtonQueue.optionint(CmdButtonQueue.inputnickname, 1) EraPrint.p('\n') return yrn
def printHpAndMpBar(playerId): playerData = AttrHandle.getAttrData(playerId) playerHitPoint = playerData['HitPoint'] playerMaxHitPoint = playerData['HitPointMax'] hitPointText = TextLoading.getTextData(TextLoading.stageWordId, '8') hitPointBar = ProportionalBar.getProportionalBar(hitPointText, playerMaxHitPoint, playerHitPoint, 'hpbar') playerManaPoint = playerData['ManaPoint'] playerMaxManaPoint = playerData['ManaPointMax'] manaPointText = TextLoading.getTextData(TextLoading.stageWordId, '9') manaPointBar = ProportionalBar.getProportionalBar(manaPointText, playerMaxManaPoint, playerManaPoint, 'mpbar') hpmpBarList = [hitPointBar, manaPointBar] EraPrint.p('\n') EraPrint.plist(hpmpBarList, 2, 'center') EraPrint.p('\n')
def seeObjectInfoPanel(): objectInfo = TextLoading.getTextData(TextLoading.stageWordId, '77') EraPrint.p(objectInfo) objectId = CacheContorl.playObject['objectId'] objectData = CacheContorl.playObject['object'][objectId] objectName = objectData['Name'] EraPrint.p(objectName) EraPrint.p(' ') intimateInfo = TextLoading.getTextData(TextLoading.stageWordId, '16') gracesInfo = TextLoading.getTextData(TextLoading.stageWordId, '17') objectIntimate = objectData['Intimate'] objectGraces = objectData['Graces'] objectIntimateText = intimateInfo + objectIntimate objectGracesText = gracesInfo + objectGraces EraPrint.p(objectIntimateText) EraPrint.p(' ') EraPrint.p(objectGracesText) EraPrint.plittleline()
def loadSave(filename): filepath = getSavefilePath(filename) data = {} try: with open(filepath, 'rb') as f: data = pickle.load(f) except FileNotFoundError: EraPrint.p(TextLoading.getTextData(TextLoading.errorId, 'notSaveError')) return data
def inputSelfNamePanel(): playerId = CacheContorl.playObject['objectId'] PyCmd.clr_cmd() CacheContorl.playObject['object'][ playerId] = CacheContorl.temporaryObject.copy() EraPrint.pline() EraPrint.pl(TextLoading.getTextData(TextLoading.messageId, '14')) yrn = CmdButtonQueue.optionint(CmdButtonQueue.inputselfname, 1) EraPrint.p('\n') return yrn
def detailedSetting_func2(): ansList = TextLoading.getTextData(TextLoading.cmdId, 'detailedSetting2') flowReturn = CreatorPlayerPanel.detailedSetting2Panel() if flowReturn == ansList[len(ansList) - 1]: PyCmd.clr_cmd() detailedSetting_func3() else: PyCmd.clr_cmd() AttrCalculation.setAnimalCache(flowReturn) detailedSetting_func3()
def inputNamePanel(): playerId = CacheContorl.playObject['objectId'] CacheContorl.playObject['object'][ playerId] = CacheContorl.temporaryObject.copy() AttrCalculation.setDefaultCache() EraPrint.p('\n') EraPrint.pline() EraPrint.pl(TextLoading.getTextData(TextLoading.messageId, '4')) yrn = CmdButtonQueue.optionint(CmdButtonQueue.currencymenu, 1) EraPrint.p('\n') return yrn
def getPlayerAbbreviationsInfo(playerId): playerData = CacheContorl.playObject['object'][playerId] playerIdInfo = TextLoading.getTextData(TextLoading.stageWordId, '0') playerIdText = playerIdInfo + playerId playerName = playerData['Name'] playerSex = playerData['Sex'] playerSexInfo = TextLoading.getTextData(TextLoading.stageWordId, '2') playerSexText = playerSexInfo + playerSex playerAge = playerData['Age'] playerAgeInfo = TextLoading.getTextData(TextLoading.stageWordId, '3') playerAgeText = playerAgeInfo + str(playerAge) playerHpAndMpText = AttrPrint.getHpAndMpText(playerId) playerIntimate = playerData['Intimate'] playerIntimateInfo = TextLoading.getTextData(TextLoading.stageWordId, '16') playerIntimateText = playerIntimateInfo + playerIntimate playerGraces = playerData['Graces'] playerGracesInfo = TextLoading.getTextData(TextLoading.stageWordId, '17') playerGracesText = playerGracesInfo + playerGraces abbreviationsInfo = playerIdText + ' ' + playerName + ' ' + playerSexText + ' ' + playerAgeText + ' ' + playerHpAndMpText + ' ' + playerIntimateText + ' ' + playerGracesText return abbreviationsInfo
def mainFramePanel(): cmdList = [] playerId = CacheContorl.playObject['objectId'] playerData = AttrHandle.getAttrData(playerId) titleText = TextLoading.getTextData(TextLoading.stageWordId, '64') EraPrint.plt(titleText) dateText = GameTime.getDateText() EraPrint.p(dateText) EraPrint.p(' ') weekDateText = GameTime.getWeekDayText() EraPrint.p(weekDateText) EraPrint.p(' ') playerName = playerData['Name'] PyCmd.pcmd(playerName, playerName, None) cmdList.append(playerName) EraPrint.p(' ') goldText = AttrText.getGoldText(playerId) EraPrint.p(goldText) EraPrint.p('\n') AttrPrint.printHpAndMpBar(playerId) mainMenuText = TextLoading.getTextData(TextLoading.stageWordId, '68') EraPrint.sontitleprint(mainMenuText) EraPrint.p('\n') askForMainMenu = CmdButtonQueue.optionint(CmdButtonQueue.mainmenu, 4, 'left', askfor=False, cmdSize='center') cmdList = cmdList + askForMainMenu systemMenuText = TextLoading.getTextData(TextLoading.stageWordId, '69') EraPrint.sontitleprint(systemMenuText) EraPrint.p('\n') systemMenuStartId = len(askForMainMenu) askForSystemMenu = CmdButtonQueue.optionint(CmdButtonQueue.systemmenu, 4, 'left', askfor=False, cmdSize='center', startId=systemMenuStartId) cmdList = cmdList + askForSystemMenu return cmdList
def p(string, style='standard'): barlist = TextLoading.getTextData(TextLoading.barListId, 'barlist') styleList = RichText.setRichTextPrint(string, style) global last_char if len(string) > 0: last_char = string[-1:] string = RichText.removeRichCache(string) for i in range(0, len(string)): if styleList[i] in barlist: styledata = TextLoading.getTextData(TextLoading.barListId, styleList[i]) truebar = styledata['truebar'] nullbar = styledata['nullbar'] if string[i] == '0': pimage(nullbar, 'bar') elif string[i] == '1': pimage(truebar, 'bar') else: IoInit.print(string[i], styleList[i]) else: IoInit.print(string[i], styleList[i])
def askfor_All(list,print_order=False): while True: order = order_deal('str', print_order) if order in list: IoInit.print(order + '\n') return order elif order == '': continue else: IoInit.print(order + '\n') IoInit.print(TextLoading.getTextData(TextLoading.errorId, 'noInputListError') + '\n') continue