def _packSpecialBlock(self): blocks = [] specials = [] if self._item.isVehicleBound and self._item.mayApply: specials.append( _ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_BOUND_SPECIAL_TEXT)) if self._item.isLimited: purchaseLimit = self.service.getCtx().getPurchaseLimit(self._item) if self._item.buyCount > 0 and (purchaseLimit > 0 or self.appliedCount > 0): specials.append( _ms(VEHICLE_CUSTOMIZATION. CUSTOMIZATION_LIMITED_SPECIAL_RULES_TEXT, avaivable=text_styles.neutral(purchaseLimit))) if not specials: return None else: if len(specials) > 1: specials = ['<li>{}</li>'.format(s) for s in specials] for special in specials: blocks.append( formatters.packTextBlockData( text=text_styles.main(special))) blocks.insert( 0, formatters.packImageTextBlockData( title=text_styles.statusAttention( VEHICLE_CUSTOMIZATION. CUSTOMIZATION_LIMITED_SPECIAL_RULES_TITLE), img=RES_ICONS.MAPS_ICONS_CUSTOMIZATION_STAR, imgPadding=formatters.packPadding(left=-3, top=2))) return formatters.packBuildUpBlockData( blocks, gap=3, padding=formatters.packPadding(bottom=-5))
def __packStatusBlock(self): if self.__blueprintData.filledCount == 0: status = text_styles.warning(TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_EMPTYSTATUS) elif self.__blueprintData.filledCount == self.__blueprintData.totalCount: status = text_styles.statInfo(TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_COMPLETESTATUS) else: status = text_styles.statusAttention(TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_INCOMPLETESTATUS) status = text_styles.alignText(status, 'center') return formatters.packTextBlockData(text=status, padding=formatters.packPadding(top=5, bottom=-3))
def _packBlocks(self, vehicleCD): items = super(BlueprintEmptySlotTooltipData, self)._packBlocks(vehicleCD) self.__vehicle, self.__blueprintData, _ = self.context.getVehicleBlueprintData(vehicleCD) _, _, self.__allianceName = self.context.getFragmentData(vehicleCD) items.extend([self.__packTitleBlock(), self.__packDiscountBlock(), self.__packDescriptionBlock()]) intelRequired, nationRequired = self.context.getFragmentConvertData(self.__vehicle.level) items.append(self._packConversionFormulaBlock(intelRequired, nationRequired, self.__vehicle)) if not self.__blueprintData.canConvert: statusStr = text_styles.critical(TOOLTIPS.BLUEPRINT_BLUEPRINTEMPTYSLOT_STATUSNOTENOUGH) else: statusStr = text_styles.statusAttention(TOOLTIPS.BLUEPRINT_BLUEPRINTEMPTYSLOT_STATUSENOUGH) statusStr = text_styles.alignText(statusStr, 'center') items.append(formatters.packTextBlockData(text=statusStr, padding=formatters.packPadding(top=5, bottom=-3))) return items
def __packStatusBlock(self): if self.__vehicle.isUnlocked: status = text_styles.statInfo( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_UNLOCKEDSTATUS) elif self.__blueprintData.filledCount == 0: status = text_styles.warning( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_EMPTYSTATUS) elif self.__blueprintData.filledCount == self.__blueprintData.totalCount: status = text_styles.statInfo( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_COMPLETESTATUS) else: status = text_styles.statusAttention( TOOLTIPS.BLUEPRINT_VEHICLEBLUEPRINTTOOLTIP_INCOMPLETESTATUS) status = text_styles.alignText(status, 'center') return formatters.packTextBlockData(text=status)
def getCrewComment(skill, crewLevel, role, forOne): if skill.name == 'new': if forOne: tKey = TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_NEWSKILL_FORONE else: tKey = TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_NEWSKILL_FORALL elif forOne: tKey = TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_ONESKILL_FORONE else: tKey = TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_ONESKILL_FORALL return _ms(key=tKey, level=crewLevel, role=_ms(TOOLTIPS.crewRole(role)) if role != '' else None, skillType=_ms( TOOLTIPS.VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_ISPERK if skill.isPerk else TOOLTIPS. VEHICLEPREVIEW_VEHICLEPANEL_INFO_HEADER_CREW_ISABILLITY), skillName=text_styles.statusAttention( _ms(MENU.QUOTE, string=skill.userName)))
def _getBottom(self, state): vehicle = g_currentVehicle.item isObtained = self._marathonEvent.isRewardObtained() if isObtained: statusLabel = text_styles.bonusAppliedText(icons.makeImageTag(self.__iconsData.okIcon, width=32, height=32, vSpace=-10, hSpace=-10) + backport.text(self.__tooltipData.extraStateCompleted)) return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': statusLabel}), padding=formatters.packPadding(bottom=20)) if state == MarathonState.IN_PROGRESS: warning = self._marathonEvent.checkForWarnings(vehicle) if warning == MarathonWarning.WRONG_BATTLE_TYPE: return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': text_styles.critical(backport.text(self.__tooltipData.errorBattleType))}), padding=formatters.packPadding(bottom=20)) if warning == MarathonWarning.WRONG_VEH_TYPE: return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': text_styles.critical(backport.text(self.__tooltipData.errorVehType))}), padding=formatters.packPadding(bottom=20)) currentStep, allStep = self._marathonEvent.getMarathonProgress() if allStep: return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': text_styles.middleTitle(backport.text(self.__tooltipData.extraStateSteps, currentStep=currentStep, allStep=text_styles.main(allStep)))}), padding=formatters.packPadding(bottom=20)) else: discount = self._marathonEvent.getMarathonDiscount() return formatters.packTextBlockData(text=makeHtmlString('html_templates:lobby/textStyle', 'alignText', {'align': 'center', 'message': text_styles.statusAttention(backport.text(self.__tooltipData.extraStateDiscount, discount=discount))}), padding=formatters.packPadding(bottom=20))
def _formatMessage(cls, message): return text_styles.statusAttention(message)