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)
Example #2
0
 def _packBlocks(self, operationID, classifier):
     _eventsCache = dependency.instance(IEventsCache)
     pmController = _eventsCache.getPersonalMissions()
     operation = pmController.getAllOperations()[operationID]
     chainID, _ = operation.getChainByClassifierAttr(classifier)
     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(
         ' ', ' ')
     isAlliance = classifier in ALLIANCES_TAGS_ORDER
     if finalQuest.isCompleted():
         statusText = self.__getObtainedStatus(isAlliance)
     elif pmController.mayPawnQuest(finalQuest):
         statusText = self.__getAvailableStatus(finalQuest.getPawnCost())
     else:
         statusText = self.__getNotObtainedStatus(isAlliance)
     vehIcon = RES_ICONS.vehicleTypeInactiveOutline(classifier)
     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
                             if not isAlliance else PERSONAL_MISSIONS.
                             TANKMODULETOOLTIPDATA_ALLIANCE_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():
         if isAlliance:
             allianceId = ALLIANCE_IDS[classifier]
             vehType = _ms(PERSONAL_MISSIONS.getAllianceName(allianceId))
         else:
             vehType = _ms(
                 PERSONAL_MISSIONS.chainNameByVehicleType(classifier))
         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
                         if not isAlliance else PERSONAL_MISSIONS.
                         TANKMODULETOOLTIPDATA_ALLIANCE_HELP_BODY,
                         vehType=vehType)),
                                                   img=vehIcon,
                                                   imgPadding=formatters.
                                                   packPadding(top=6,
                                                               left=4),
                                                   txtOffset=34)
             ]))
     blocks.append(
         formatters.packAlignedTextBlockData(
             text=statusText, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
     return blocks