def __getBackportTooltipData(self, event): tooltipId = event.getArgument('tooltipId') if tooltipId is None: return elif tooltipId in self.__tooltipData: return self.__tooltipData[tooltipId] vehicleCD = event.getArgument('vehicleCD') if vehicleCD is None: return elif tooltipId == BlueprintScreenTooltips.TOOLTIP_BLUEPRINT: return createTooltipData( isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.BLUEPRINT_INFO, specialArgs=(int(vehicleCD), True)) elif tooltipId == BlueprintScreenTooltips.TOOLTIP_BLUEPRINT_CONVERT_COUNT: return createTooltipData( isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.BLUEPRINT_CONVERT_INFO, specialArgs=[vehicleCD]) else: return createTooltipData( isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.SENIORITY_AWARD_VEHICLE, specialArgs=(vehicleCD, 100, None, None, None, None, True, True) ) if tooltipId == SeniorityAwardsVehicleRendererModel.TOOLTIP_VEHICLE_REWARD else None
def asyncGetToolTip(self, bonus, callback=None): yield lambda callback: callback(True) result = [] bonusTokens = bonus.getTokens() for tID in bonusTokens.iterkeys(): if tID.startswith(OFFER_TOKEN_PREFIX): offers = self.__offersProvider.getAvailableOffersByToken(tID) if not offers: continue _, vehicles, hasRent, _ = _getOffersTokenStateData(offers) if hasRent: uiVehs = [] for vIntCD in vehicles: uiVehs.append( _getVehicleUIData( self.__itemsCache.items.getItemByCD(vIntCD))) result.append( createTooltipData(isSpecial=True, specialAlias=VEH_FOR_CHOOSE_ID, specialArgs={'vehicles': uiVehs})) continue purchase = yield self.__purchaseCache.requestPurchaseByID( self.__productID) tokenData = purchase.getTokenData(tID) result.append( createTooltipData( makeTooltip(tokenData.title, tokenData.description))) callback(result)
def __convertCompensationTooltip(cls, bonusComp, vehicle, tooltipData): specialArgs = { 'labelBefore': '', 'iconAfter': backport.image(R.images.gui.maps.icons.quests.bonuses.big.gold()), 'labelAfter': bonusComp.getIconLabel(), 'bonusName': bonusComp.getName() } uiData = _getVehicleUIData(vehicle) formattedTypeName = uiData['vehicleType'] isElite = vehicle.isElite uiData['vehicleType'] = '{}_elite'.format( formattedTypeName) if isElite else formattedTypeName specialArgs.update(uiData) vehicleName = getNationLessName(vehicle.name) vehIcon = R.images.gui.maps.shop.vehicles.c_180x135.dyn(vehicleName)() if vehIcon < 1: vehicleName = vehicleName.replace('-', '_') vehIcon = R.images.gui.maps.shop.vehicles.c_180x135.dyn( vehicleName)() specialArgs['iconBefore'] = backport.image( vehIcon) if vehIcon > 0 else '' return createTooltipData(tooltip=tooltipData.tooltip, specialAlias=VEH_COMP_R_ID, specialArgs=specialArgs)
def __convertCompensationTooltip(cls, bonusComp, vehicle, tooltipData): specialArgs = { 'iconBefore': backport.image( R.images.gui.maps.shop.vehicles.c_180x135.dyn( getIconResourceName(getNationLessName(vehicle.name)))()), 'labelBefore': '', 'iconAfter': backport.image(R.images.gui.maps.icons.quests.bonuses.big.gold()), 'labelAfter': bonusComp.getIconLabel(), 'bonusName': bonusComp.getName(), 'vehicleName': vehicle.shortUserName, 'vehicleType': formatEliteVehicle(vehicle.isElite, vehicle.type), 'isElite': vehicle.isElite, 'vehicleLvl': int2roman(vehicle.level) } return createTooltipData(tooltip=tooltipData.tooltip, specialAlias=VEH_COMP_R_ID, specialArgs=specialArgs)
def getEmptyTooltip(cls, vehicle, slotID, intCD): return createTooltipData( isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.OPT_DEVICE_EMPTY_SLOT, specialArgs=[ TOOLTIPS.HANGAR_AMMO_PANEL_DEVICE_EMPTY, slotID, vehicle ])
def getSlotSpecTooltipData(event, tooltipId): isClickable = event.getArgument('isClickable') isDyn = event.getArgument('isDyn') spec = event.getArgument('spec') return createTooltipData(isSpecial=True, specialAlias=tooltipId, specialArgs=[spec, isDyn, isClickable])
def __getTooltipData(self, ttId, fragmentCD): return createTooltipData( isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.BLUEPRINT_FRAGMENT_INFO, specialArgs=[ fragmentCD ]) if ttId == BlueprintScreenTooltips.TOOLTIP_BLUEPRINT else None
def __getTooltipData(intCD, tooltip, level): return createTooltipData(isSpecial=True, specialAlias=tooltip, specialArgs=CustomizationTooltipContext( itemCD=intCD, level=level, showOnlyProgressBlock=True))
def __getRankedPointToolTipData(cls, *_): return createTooltipData( makeTooltip( header=backport.text( R.strings.tooltips.rankedBattleView.scorePoint.header()), body=backport.text( R.strings.tooltips.rankedBattleView.scorePoint.body())))
def _getToolTip(cls, bonus): tooltipData = backport.createTooltipData( tooltip=None, isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.ADDITIONAL_AWARDS, specialArgs=cls._getShortBonusesData(bonus.getValue())) return [tooltipData]
def getTooltipData(cls, vehicle, slotID, intCD): item = cls._itemsCache.items.getItemByCD(intCD) return createTooltipData(tooltip=makeTooltip( item.userName, attention=VEH_COMPARE.VEHCONF_TOOLTIPS_DEVICENOTAFFECTEDTTC )) if item.name in cmp_helpers.NOT_AFFECTED_EQUIPMENTS else super( CmpConsumableToolitpBuilder, cls).getTooltipData( vehicle, slotID, intCD)
def __getTooltipData(self, event): tooltipType = event.getArgument('tooltipType') tooltipAlias = self.__TOOLTIPS_MAPPING.get(tooltipType) if tooltipAlias: reserveId = event.getArgument('id') return backport.createTooltipData(isSpecial=True, specialAlias=tooltipAlias, specialArgs=(reserveId, ))
def __getAchievementTooltipParameters(self, event): achievementName = event.getArgument('achievementName') if achievementName is None: SoftException('There is no achievement info in tooltip arguments') return createTooltipData( isSpecial=True, specialAlias=TooltipConstantsModel.ACHIEVEMENT_TOOLTIP, specialArgs=[0, achievementName, False, [], 0, 0])
def __getComplexToolTipData(cls, _, complexToken, *args): webCache = cls._eventsCache.prefetcher userName = i18n.makeString(webCache.getTokenInfo(complexToken.styleID)) tooltip = makeTooltip( i18n.makeString(TOOLTIPS.QUESTS_BONUSES_TOKEN_HEADER, userName=userName), i18n.makeString(TOOLTIPS.QUESTS_BONUSES_TOKEN_BODY)) return createTooltipData(tooltip)
def _getToolTip(cls, bonus): tooltipData = [] for group in bonus.getTankmenGroups().itervalues(): tooltipData.append( createTooltipData( makeTooltip(TOOLTIPS.getAwardHeader(bonus.getName()), cls._getLabel(group)))) return tooltipData
def _packTooltip(cls, bonus, vehicle, vehInfo): result = super(_MultiAwardVehiclesBonusUIPacker, cls)._packTooltip(bonus, vehicle, vehInfo) tmanRoleLevel = bonus.getTmanRoleLevel(vehInfo) result.specialArgs.extend([tmanRoleLevel > 0, False]) return createTooltipData( isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.EXTENDED_AWARD_VEHICLE, specialArgs=result.specialArgs)
def _getToolTip(cls, bonus): result = [] toys = bonus.getValue() for toyId, count in toys.iteritems(): tooltipData = backport.createTooltipData(tooltip='', specialArgs=(toyId, count)) result.append(tooltipData) return result
def createToolTip(self, event): tooltipId = event.getArgument('tooltipId') if not tooltipId: return super(MarathonRewardWindowView, self).createToolTip(event) bonus = self.__bonusCache.get(tooltipId) if bonus: window = BackportTooltipWindow(createTooltipData(tooltip=bonus.tooltip, isSpecial=bonus.isSpecial, specialAlias=bonus.specialAlias, specialArgs=bonus.specialArgs), self.getParentWindow()) window.load() return window return super(MarathonRewardWindowView, self).createToolTip(event)
def __getQuestsTooltipParameters(self, _): completedQuestIDs = self.__data[BRSections.PERSONAL][ BRSections.REWARDS]['completedQuests'].keys() return createTooltipData(isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS. BATTLE_ROYALE_COMPLETED_QUESTS_INFO, specialArgs=[ HANGAR_HEADER_QUESTS.QUEST_TYPE_COMMON, completedQuestIDs ])
def __getQuestsTooltipParameters(self, event): completedQuestIDs = self._data.get('personal', {}).get('rewards', {}).get( 'completedQuests', {}).keys() return createTooltipData(isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS. EVENT_PROGRESSION_COMPLETED_QUESTS_INFO, specialArgs=[ HANGAR_HEADER_QUESTS.QUEST_TYPE_COMMON, completedQuestIDs ])
def __getBackportTooltipData(self, event): tooltipId = event.getArgument('tooltipId') if tooltipId is None: return elif tooltipId in self.__tooltipsData: return self.__tooltipsData[tooltipId] elif tooltipId == BlueprintScreenTooltips.TOOLTIP_BLUEPRINT: vehicleCD = event.getArgument('vehicleCD') return createTooltipData( isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.BLUEPRINT_INFO, specialArgs=(vehicleCD, True)) elif tooltipId == BlueprintScreenTooltips.TOOLTIP_BLUEPRINT_CONVERT_COUNT: vehicleCD = event.getArgument('vehicleCD') return createTooltipData( isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.BLUEPRINT_CONVERT_INFO, specialArgs=[vehicleCD]) else: return
def fillProgressBar(self, viewModel, tooltipData, iconSize=ICON_SIZE.SMALL): bootcampIcons = R.images.gui.maps.icons.bootcamp.rewards progressBarItems = [self._getProgressBarItem([self._getProgressBarIcon(bootcampIcons.bcTank2_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcTank2_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_VEHICLE_SECOND_LEVEL, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_VEHICLE, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCAWARDOPTIONS], 2)], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_1, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_1]), self._getProgressBarItem([], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_2, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_2]), self._getProgressBarItem([self._getProgressBarIcon(bootcampIcons.bcTank3_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcTank3_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_VEHICLE_THIRD_LEVEL, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_VEHICLE, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCAWARDOPTIONS], 4)], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_3, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_3]), self._getProgressBarItem([], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_4, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_4]), self._getProgressBarItem([self._getProgressBarIcon(bootcampIcons.bcGold_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcGold_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_GOLD, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_GOLD, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCGOLD], 6), self._getProgressBarIcon(bootcampIcons.bcPremium_universal_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcPremium_universal_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_AWARD, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_PREMIUM, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCPREMIUMPLUS], 6), self._getProgressBarIcon(bootcampIcons.bcBootcampMedal_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcBootcampMedal_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_AWARD, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_AWARD, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCACHIEVEMENT], 6)], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_5, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_5])] currentLesson = g_bootcamp.getLessonNum() viewModel.setCurrentLesson(currentLesson) viewModel.setTotalLessons(g_bootcamp.getContextIntParameter('lastLessonNum')) lessons = Array() tooltipIndex = 1 for index, lessonRaw in enumerate(progressBarItems): lessonModel = BootcampLessonModel() lessonNumber = index + 1 lessonModel.setLessonNumber(lessonNumber) lessonModel.setCompleted(lessonNumber <= currentLesson) lessonModel.setCurrent(lessonNumber == currentLesson + 1) lessonModel.setTooltipId(tooltipIndex) if self.isLastLesson(lessonNumber): lessonModel.setRewardsTaken(not self.bootcampController.needAwarding()) status = BootcampStatuses.IN_PROGRESS if lessonNumber == currentLesson else (BootcampStatuses.COMPLETED if lessonNumber < currentLesson else None) tooltipData[tooltipIndex] = createTooltipData(isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.BOOTCAMP_LESSON_PROGRESS, specialArgs=lessonRaw['tooltipArgs'] + [status]) tooltipIndex += 1 items = Array() for itemRaw in lessonRaw['rewards']: itemModel = BootcampRewardItemModel() itemModel.setIcon(backport.image(itemRaw['icon'])) itemModel.setTooltipId(tooltipIndex) tooltipData[tooltipIndex] = createTooltipData(isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.BOOTCAMP_REWARD_PROGRESS, specialArgs=itemRaw['tooltipArgs']) tooltipIndex += 1 items.addViewModel(itemModel) lessonModel.setRewards(items) lessons.addViewModel(lessonModel) lessons.invalidate() viewModel.setLevels(lessons) return
def _getToolTip(cls, bonus): tooltipData = [] for group in bonus.getTankmenGroups().itervalues(): if group['skills']: key = 'with_skills' else: key = 'no_skills' label = '#quests:bonuses/item/tankmen/%s' % key tooltipData.append( createTooltipData( makeTooltip(TOOLTIPS.getAwardHeader(bonus.getName()), i18n.makeString(label, **group)))) return tooltipData
def createToolTip(self, event): if event.contentID == R.views.common.tooltip_window.backport_tooltip_content.BackportTooltipContent(): tooltipId = event.getArgument('tooltipId') if tooltipId == TOOLTIPS_CONSTANTS.ACTION_PRICE: itemPrice = self._getItemPrice() args = (ACTION_TOOLTIPS_TYPE.ITEM, self._item.intCD, list(itemPrice.price), list(itemPrice.defPrice), self.isBuying) window = BackportTooltipWindow(createTooltipData(isSpecial=True, specialAlias=tooltipId, specialArgs=args), self.getParentWindow()) window.load() return window return super(DialogBuySellItemBaseView, self).createToolTip(event)
def createToolTip(self, event): if event.contentID == R.views.common.tooltip_window.backport_tooltip_content.BackportTooltipContent( ): tooltipId = event.getArgument('tooltipId') if tooltipId is None: return if tooltipId in self.__SPECIAL_TOOLTIPS.values(): tooltipData = createTooltipData(isSpecial=True, specialAlias=tooltipId) window = BackportTooltipWindow(tooltipData, self.getParentWindow()) window.load() return window return
def createToolTip(self, event): if event.contentID == R.views.common.tooltip_window.backport_tooltip_content.BackportTooltipContent( ): tooltipId = event.getArgument('tooltipId') fragmentCD = int(event.getArgument('fragmentCD')) args = [fragmentCD] if tooltipId in (TOOLTIPS_CONSTANTS.BLUEPRINT_FRAGMENT_INFO, TOOLTIPS_CONSTANTS.BLUEPRINT_INFO): window = BackportTooltipWindow( createTooltipData(isSpecial=True, specialAlias=tooltipId, specialArgs=args), self.getParentWindow()) window.load() return window return super(TechTreeIntroView, self).createToolTip(event)
def _getToolTip(cls, bonus): bonusTokens = bonus.getTokens() tooltipPackers = cls.__getTooltipsPackers() result = [] for tokenID, _ in bonusTokens.iteritems(): complexToken = parseComplexToken(tokenID) tokenType = cls.__getTokenBonusType(tokenID, complexToken) tooltipPacker = tooltipPackers.get(tokenType) if tooltipPacker is None: _logger.warning( 'There is not a tooltip creator for a token bonus') return result tooltip = tooltipPacker(complexToken) result.append(createTooltipData(tooltip)) return result
def createToolTip(self, event): if event.contentID == R.views.common.tooltip_window.backport_tooltip_content.BackportTooltipContent( ): tooltipId = event.getArgument('tooltipId') args = [] if tooltipId == TOOLTIPS_CONSTANTS.AWARD_DEMOUNT_KIT: args = [DEMOUNT_KIT_ID] if tooltipId in (TOOLTIPS_CONSTANTS.GOLD_ALTERNATIVE_INFO, TOOLTIPS_CONSTANTS.GOLD_ALTERNATIVE_STATS, TOOLTIPS_CONSTANTS.AWARD_DEMOUNT_KIT): window = BackportTooltipWindow( createTooltipData(isSpecial=True, specialAlias=tooltipId, specialArgs=args), self.getParentWindow()) window.load() return window return super(DemountOpDevDialog, self).createToolTip(event)
def createToolTip(self, event): if event.contentID == R.views.common.tooltip_window.backport_tooltip_content.BackportTooltipContent( ): tooltipId = event.getArgument('tooltipId') specialArgs = None if tooltipId == TOOLTIPS_CONSTANTS.ACTION_PRICE: specialArgs = (ACTION_TOOLTIPS_TYPE.ITEM, self._item.intCD, self.__convertMoneyToTuple(self._price.price), self.__convertMoneyToTuple( self._price.defPrice), bool(self.viewModel.getDiscount())) elif tooltipId == TOOLTIPS_CONSTANTS.NOT_ENOUGH_MONEY: specialArgs = (self._shortage, self._currency) if specialArgs is not None: tooltipData = createTooltipData(isSpecial=True, specialAlias=tooltipId, specialArgs=specialArgs) window = BackportTooltipWindow(tooltipData, self.getParentWindow()) window.load() return window return super(ItemPriceDialog, self).createToolTip(event)
def __getVariadicDiscountsTooltipData(cls, *_): return createTooltipData()