def getChainName(self, chainID): classifier = self.getChainClassifier(chainID).classificationAttr if self.__branch == PM_BRANCH.REGULAR: return PERSONAL_MISSIONS.chainNameByVehicleType(classifier) if self.__branch == PM_BRANCH.PERSONAL_MISSION_2: allianceId = nations.ALLIANCE_IDS[classifier] return PERSONAL_MISSIONS.getAllianceName(allianceId)
def _packBlocks(self, operationID, vehicleType): pmController = dependency.instance(IEventsCache).personalMissions operation = pmController.getOperations()[operationID] chainID, _ = operation.getChainByVehicleType(vehicleType) finalQuest = operation.getFinalQuests()[chainID] bonus = findFirst(lambda q: q.getName() == 'completionTokens', finalQuest.getBonuses('tokens')) formattedBonus = first(CompletionTokensBonusFormatter().format(bonus)) operationTitle = str(operation.getVehicleBonus().userName).replace( ' ', ' ') if finalQuest.isCompleted(): statusText = self.__getObtainedStatus() elif pmController.mayPawnQuest(finalQuest): statusText = self.__getAvailableStatus(finalQuest.getPawnCost()) else: statusText = self.__getNotObtainedStatus() vehIcon = RES_ICONS.vehicleTypeInactiveOutline(vehicleType) blocks = [ formatters.packImageTextBlockData( title=text_styles.highTitle(formattedBonus.userName), desc=text_styles.standard( _ms(PERSONAL_MISSIONS.OPERATIONTITLE_TITLE, title=operationTitle)), img=formattedBonus.getImage(AWARDS_SIZES.BIG), imgPadding=formatters.packPadding(right=20), txtPadding=formatters.packPadding(top=10)), formatters.packBuildUpBlockData( [ formatters.packImageTextBlockData( title=text_styles.main( _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_INFO, vehName=text_styles.neutral(operationTitle))), img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, imgPadding=formatters.packPadding( left=8, right=10, top=2)) ], linkage=BLOCKS_TOOLTIP_TYPES. TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE, padding=formatters.packPadding(top=-7, bottom=-3)) ] if not finalQuest.isCompleted(): blocks.append( formatters.packBuildUpBlockData([ formatters.packTextBlockData(text_styles.middleTitle( PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_HELP_TITLE), padding=formatters. packPadding(bottom=4)), formatters.packImageTextBlockData(title=text_styles.main( _ms(PERSONAL_MISSIONS.TANKMODULETOOLTIPDATA_HELP_BODY, vehType=_ms( PERSONAL_MISSIONS.chainNameByVehicleType( vehicleType)))), img=vehIcon, imgPadding=formatters. packPadding(right=2)) ])) blocks.append( formatters.packAlignedTextBlockData( text=statusText, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)) return blocks
def __updateSideBar(self): chains = [] currChainID = self.getChainID() currentOperation = self.getOperation() currentVehicleType = currentOperation.getChainVehicleClass(currChainID) for vehicleType in VEHICLE_TYPES_ORDER: chainID, quests = currentOperation.getChainByVehicleType( vehicleType) chainState = self.__getChainState(quests) progress = self.__getProgress(quests) if chainState.isCompleted: currentProgress = text_styles.bonusAppliedText( progress['value']) else: currentProgress = text_styles.stats(progress['value']) if currentVehicleType == vehicleType: label = text_styles.tutorial( PERSONAL_MISSIONS.chainNameByVehicleType( currentVehicleType)) elif chainState.questInProgress is not None: label = text_styles.main( chainState.questInProgress.getShortUserName()) elif chainState.isFullCompleted: label = text_styles.bonusAppliedText( PERSONAL_MISSIONS.SIDEBAR_FULLCOMPLETED) elif chainState.isCompleted: label = text_styles.bonusAppliedText( PERSONAL_MISSIONS.SIDEBAR_COMPLETED) else: label = text_styles.main(PERSONAL_MISSIONS.SIDEBAR_NOTSELECTED) progressText = text_styles.main(' / ').join( (currentProgress, text_styles.main(progress['maxValue']))) chains.append({ 'chainID': chainID, 'progressText': progressText, 'label': label, 'tankIcon': Vehicle.getTypeBigIconPath(vehicleType, False), 'progress': progress }) self.as_updateBranchesDataS({'chains': chains}) self.as_setSelectedBranchIndexS(currChainID) return