Exemplo n.º 1
0
 def _packTerms(self, data):
     text = makeHtmlText('tooltip_terms_label', ms(self._termsAlias))
     arenaType = data.get('arenaType', 0)
     if arenaType == ARENA_GUI_TYPE.FALLOUT_MULTITEAM:
         text += '\n' + makeHtmlText('tooltip_terms_label',
                                     ms(self._termsAlias + '/gasAttack'))
     return [formatters.packTextBlockData(text)]
def relate(relation, value, label):
    if not isinstance(value, types.StringTypes):
        value = BigWorld.wg_getNiceNumberFormat(value)
    else:
        value = value
    relation = ms('#quests:details/requirementsRelation/{}'.format(relation))
    rlabel = ms('#quests:details/requirements/relation',
                relation=relation,
                value=value)
    return '{}{}'.format(label, rlabel)
 def _getTitle(self):
     if self.__questID:
         quest = self.eventsCache.personalMissions.getQuests()[
             self.__questID]
         return text_styles.highTitle(
             ms(QUESTS.PERSONALMISSION_VEHICLESELECTOR_TITLE,
                vehType=', '.join([
                    ms(MENU.classesShort(vehType))
                    for vehType in quest.getVehicleClasses()
                ]),
                minLevel=quest.getVehMinLevel(),
                maxLevel=quest.getVehMaxLevel()))
Exemplo n.º 4
0
 def format(cls, condition, event, styler):
     style = styler(condition.isAvailable())
     if condition.average:
         titleKey = '#quests:details/requirements/dossierAvgValue'
     else:
         titleKey = '#quests:details/requirements/dossierValue'
     block, record = condition.recordName
     battleMode = cls._dossierBlock2BattleMode(block)
     labelKey = '#quests:details/dossier/{}/{}'.format(battleMode, record)
     label = ms(titleKey, label=ms(labelKey))
     label = relate(condition.relation, condition.relationValue, label)
     return [packText(style(label))]
Exemplo n.º 5
0
def relate(relation, value, label):
    """ Add a relation information to the existing label.
    """
    if type(value) not in types.StringTypes:
        value = BigWorld.wg_getNiceNumberFormat(value)
    else:
        value = value
    relation = ms('#quests:details/requirementsRelation/{}'.format(relation))
    rlabel = ms('#quests:details/requirements/relation',
                relation=relation,
                value=value)
    return '{}{}'.format(label, rlabel)
Exemplo n.º 6
0
 def conclusion(self, group, event, requirements, passed, total):
     """ Format the requirement header.
     """
     if not total:
         return ''
     if group.isAvailable():
         icon = ''
         headerStyle = text_styles.standard
         reasonStyle = text_styles.standard
         header = '#quests:missionDetails/requirements/header/available'
         reason = '#quests:missionDetails/requirements/conclusion/available'
         count = total
     else:
         icon = (icons.makeImageTag(
             RES_ICONS.MAPS_ICONS_LIBRARY_MARKER_BLOCKED,
             width=14,
             height=14,
             vSpace=-1,
             hSpace=-2), )
         headerStyle = text_styles.error
         reasonStyle = text_styles.main
         header = '#quests:missionDetails/requirements/header/unavailable'
         if len(requirements) == 1:
             reason = requirements[0]['text']
         else:
             reason = '#quests:missionDetails/requirements/conclusion/unavailable'
         count = total - passed
     return text_styles.concatStylesWithSpace(
         icon, headerStyle(header), reasonStyle(ms(reason, count=count)))
Exemplo n.º 7
0
 def format(cls, condition, event, styler):
     labelKey = None
     if condition.getClanIds() is None:
         if condition.isNegative():
             labelKey = 'notInAnyClan'
         else:
             labelKey = 'inAnyClan'
     else:
         clanDBID = cls.itemsCache.items.stats.clanDBID
         if not condition.isNegative():
             if clanDBID:
                 if clanDBID in condition.getClanIds():
                     labelKey = 'forCurrentClan'
                 else:
                     labelKey = 'notForCurrentClan'
             else:
                 labelKey = 'inClan'
         elif clanDBID and clanDBID in condition.getClanIds():
             labelKey = 'notForCurrentClan'
     if labelKey is not None:
         label = ms('#quests:details/requirements/{}'.format(labelKey))
         style = styler(condition.isAvailable())
         return [packText(style(label))]
     else:
         return []
Exemplo n.º 8
0
def getStatusStrings(vState,
                     vStateLvl=Vehicle.VEHICLE_STATE_LEVEL.INFO,
                     substitute='',
                     style=None,
                     ctx=None):
    """ Get status string for small and large slots.
    
    :param vState: one of VEHICLE_STATE
    :param vStateLvl: one of VEHICLE_STATE_LEVEL
    :param substitute: is provided, substitutes status string for small slot
                       (since it's too small to hold multiple strings)
    :param style: if provided, forces usage of this style
    :param ctx: keyword arguments for status text
    
    :return: tuple (status for small slot, status for large slot)
    """
    ctx = ctx or {}
    state = MENU.tankcarousel_vehiclestates(vState)
    status = ms(state, **ctx)
    if style is None:
        smallStyle, largeStyle = getStatusCountStyle(vStateLvl)
    else:
        smallStyle = largeStyle = style
    if status:
        return (smallStyle(status), largeStyle(status))
    elif substitute:
        return (text_styles.middleTitle(substitute), status)
    else:
        return (status, status)
Exemplo n.º 9
0
 def pack(self, data):
     items = super(KillItemPacker, self).pack(data)
     reason = data.get('killReason', None)
     if reason is not None and reason >= 0:
         alias = '#battle_results:common/tooltip/kill{0}/description'.format(reason)
         text = makeHtmlText('tooltip_add_info_label', ms(alias))
         items.append(formatters.packTextBlockData(text))
     return items
Exemplo n.º 10
0
 def format(cls, condition, event, styler):
     if condition.isPremiumNeeded():
         labelKey = 'premiumAccount'
     else:
         labelKey = 'notPremiumAccount'
     label = ms('#quests:details/requirements/{}'.format(labelKey))
     style = styler(condition.isAvailable())
     return [packText(style(label))]
Exemplo n.º 11
0
 def _getTitle(self):
     suitableVehiclesCount = self._carousel.getSuitableVehiclesCount()
     totalVehiclesCount = self._carousel.getTotalVehiclesCount()
     if suitableVehiclesCount == 0:
         suitableStyle = text_styles.unavailable
     else:
         suitableStyle = text_styles.highTitle
     count = '{} / {}'.format(suitableStyle(suitableVehiclesCount), text_styles.main(totalVehiclesCount))
     return text_styles.highTitle(ms(QUESTS.MISSIONS_VEHICLESELECTOR_TITLE, count=count))
    def _populate(self):
        super(MissionsTokenPopover, self)._populate()
        mainQuest = self.eventsCache.getQuests()[self._questId]
        children = mainQuest.getChildren()[self._tokenId]

        def filterfunc(quest):
            return quest.getGroupID() == mainQuest.getGroupID() and quest.getID() in children

        quests = self.eventsCache.getQuests(filterfunc)
        for token in mainQuest.accountReqs.getTokens():
            if token.getID() == self._tokenId:
                self._token = token
                break

        result = []
        for quest in sorted(quests.values(), missionsSortFunc, reverse=True):
            header = text_styles.main(quest.getUserName())
            if quest.isCompleted():
                icon = RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_CHECKMARK
                descr = text_styles.bonusAppliedText(QUESTS.MISSIONS_TOKENPOPOVER_QUEST_DESCR_READY)
            elif not quest.isAvailable()[0]:
                icon = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_NOTAVAILABLEICON
                descr = text_styles.error(QUESTS.MISSIONS_TOKENPOPOVER_QUEST_DESCR_NOTAVAILABLE)
            else:
                icon = ''
                descr = text_styles.standard(ms(QUESTS.MISSIONS_TOKENPOPOVER_QUEST_DESCR_DATE, date=BigWorld.wg_getLongDateFormat(quest.getFinishTime())))
            tooltip = makeTooltip(ms(TOOLTIPS.MISSIONS_TOKENPOPOVER_QUEST_HEADER, name=quest.getUserName()), ms(TOOLTIPS.MISSIONS_TOKENPOPOVER_QUEST_BODY))
            result.append({'headerText': header,
             'descrText': descr,
             'imgSrc': icon,
             'questId': quest.getID(),
             'tooltip': tooltip})

        self.as_setListDataProviderS(result)
        if result:
            descrText = ms(QUESTS.MISSIONS_TOKENPOPOVER_DESCR, name=text_styles.neutral(ms(self._token.getUserName())))
        else:
            descrText = ms(QUESTS.MISSIONS_TOKENPOPOVER_DESCR_SHOP, name=text_styles.neutral(ms(self._token.getUserName())))
        self.as_setStaticDataS({'headerText': text_styles.highTitle(ms(QUESTS.MISSIONS_TOKENPOPOVER_HEADER, name=ms(self._token.getUserName()))),
         'descrText': text_styles.main(descrText),
         'imageSrc': self._token.getImage(TOKEN_SIZES.MEDIUM),
         'buyBtnLabel': QUESTS.MISSIONS_TOKENPOPOVER_BUYBTN_LABEL,
         'buyBtnVisible': self._token.isOnSale() or mainQuest.isTokensOnSale()})
Exemplo n.º 13
0
 def format(cls, condition, event, styler):
     style = styler(condition.isAvailable())
     labelKey = '#quests:details/requirements/{}'.format(
         condition.getName())
     result = []
     if condition.isAnyVehicleAcceptable():
         label = ms('{}/all'.format(labelKey))
         result.append(packText(style(label)))
     elif 'types' not in condition.data:
         _, fnations, flevels, fclasses = condition.parseFilters()
         keys, kwargs = [], {}
         if fnations:
             keys.append('nation')
             names = [nations.NAMES[nationId] for nationId in fnations]
             names = [ms('#menu:nations/{}'.format(name)) for name in names]
             kwargs['nation'] = ', '.join(names)
         if fclasses:
             keys.append('type')
             names = [
                 ms('#menu:classes/{}'.format(name)) for name in fclasses
             ]
             kwargs['type'] = ', '.join(names)
         if flevels:
             keys.append('level')
             names = [int2roman(lvl) for lvl in flevels]
             kwargs['level'] = ', '.join(names)
         labelKey = '{}/{}'.format(labelKey, '_'.join(keys))
         if condition.relationValue is None and condition.isNegative():
             labelKey = '{}/not'.format(labelKey)
         label = ms(labelKey, **kwargs)
         label = relate(condition.relation, condition.relationValue, label)
         result.append(packText(style(label)))
     else:
         if condition.isNegative():
             labelKey = '{}/not'.format(labelKey)
         label = ms(labelKey)
         names = [
             vehicle.userName for vehicle in condition.getVehiclesList()
         ]
         result.append(
             packText(style('{}: {}'.format(label, ', '.join(names)))))
     return result
Exemplo n.º 14
0
 def __getTimeLeftText(self, timeLeft, isUsed):
     ms = i18n.makeString
     result = ''
     if timeLeft > 0:
         secondsInDay = 86400
         secondsInHour = 3600
         secondsInMinute = 60
         if timeLeft > secondsInDay:
             timeLeft = int(math.ceil(timeLeft / secondsInDay))
             dimension = ms(VEHICLE_CUSTOMIZATION.TIMELEFT_TEMPORAL_DAYS)
         elif timeLeft > secondsInHour:
             timeLeft = int(math.ceil(timeLeft / secondsInHour))
             dimension = ms(VEHICLE_CUSTOMIZATION.TIMELEFT_TEMPORAL_HOURS)
         else:
             timeLeft = int(math.ceil(timeLeft / secondsInMinute))
             dimension = ms(VEHICLE_CUSTOMIZATION.TIMELEFT_TEMPORAL_MINUTES)
         result = ms(VEHICLE_CUSTOMIZATION.TIMELEFT_TEMPORAL_USED if isUsed else VEHICLE_CUSTOMIZATION.TIMELEFT_TEMPORAL, time=timeLeft, dimension=dimension)
     elif not timeLeft:
         result = ms(VEHICLE_CUSTOMIZATION.TIMELEFT_INFINITY)
     return result
def getStatusStrings(vState, vStateLvl=Vehicle.VEHICLE_STATE_LEVEL.INFO, substitute='', style=None, ctx=None):
    ctx = ctx or {}
    state = MENU.tankcarousel_vehiclestates(vState)
    status = ms(state, **ctx)
    if style is None:
        smallStyle, largeStyle = getStatusCountStyle(vStateLvl)
    else:
        smallStyle = largeStyle = style
    if status:
        return (smallStyle(status), largeStyle(status))
    else:
        return (text_styles.middleTitle(substitute), status) if substitute else (status, status)
Exemplo n.º 16
0
    def getDisplayableData(self):
        refSystem = game_control.g_instance.refSystem
        xpIcon = RES_ICONS.MAPS_ICONS_LIBRARY_NORMALXPICON
        icon = self.app.utilsManager.getHtmlIconText(ImageUrlProperties(xpIcon, 16, 16, -3, 0))
        expNum = self.app.utilsManager.textManager.getText(TextType.CREDITS_TEXT, ms(BigWorld.wg_getNiceNumberFormat(refSystem.getMaxReferralXPPool())))
        titleText = self.app.utilsManager.textManager.getText(TextType.HIGH_TITLE, ms(TOOLTIPS.TOOLTIPREFSYSXPMULTIPLIER_TITLE))
        descriptionText = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, ms(TOOLTIPS.TOOLTIPREFSYSXPMULTIPLIER_DESCRIPTION))
        conditionsText = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, ms(TOOLTIPS.TOOLTIPREFSYSXPMULTIPLIER_CONDITIONS))
        bottomText = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, ms(TOOLTIPS.TOOLTIPREFSYSXPMULTIPLIER_BOTTOM, expNum=expNum + '<nobr>' + icon))
        xpBlocks = []
        for i, (period, bonus) in enumerate(refSystem.getRefPeriods()):
            xpBonus = 'x%s' % BigWorld.wg_getNiceNumberFormat(bonus)
            condition = self.__formatPeriod(period)
            xpBlocks.append({'xpIconSource': RES_ICONS.MAPS_ICONS_LIBRARY_NORMALXPICON,
             'multiplierText': self.app.utilsManager.textManager.getText(TextType.CREDITS_TEXT, xpBonus),
             'descriptionText': self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, condition)})

        return {'titleText': titleText,
         'descriptionText': descriptionText,
         'conditionsText': conditionsText,
         'bottomText': bottomText,
         'xpBlocksVOs': xpBlocks}
Exemplo n.º 17
0
 def pack(self, data):
     items = super(CritsItemPacker, self).pack(data)
     critDamage = data.get('critDamage', None)
     critWound = data.get('critWound', None)
     critDestruction = data.get('critDestruction', None)
     if critDamage is not None and len(critDamage) > 0:
         self.__addResultBlock(items, BATTLE_RESULTS.COMMON_TOOLTIP_CRITS_CRITDAMAGE, critDamage)
     if critDestruction is not None and len(critDestruction) > 0:
         self.__addResultBlock(items, BATTLE_RESULTS.COMMON_TOOLTIP_CRITS_CRITDESTRUCTION, critDestruction)
     if critWound is not None and len(critWound) > 0:
         self.__addResultBlock(items, BATTLE_RESULTS.COMMON_TOOLTIP_CRITS_CRITWOUND, critWound)
     if data['isGarage']:
         text = makeHtmlText('tooltip_add_info_label', ms(BATTLE_RESULTS.FALLOUT_UNIQUEDAMAGE))
         items.append(formatters.packTextBlockData(text))
     return items
Exemplo n.º 18
0
 def format(cls, condition, event, styler):
     igrTypes = condition.getIgrTypes()
     if IS_CHINA:
         key = 'igr'
     elif igrTypes.issubset({IGR_TYPE.BASE}):
         key = 'igrBasic'
     elif igrTypes.issubset({IGR_TYPE.PREMIUM}):
         key = 'igrPremium'
     else:
         key = 'igr'
     label = ms('#quests:details/requirements/{}'.format(key))
     style = styler(condition.isAvailable())
     return [
         packText(
             makeHtmlString('html_templates:lobby/quests', 'playInIgr',
                            {'label': style(label)}))
     ]
 def __updateSelectedVehicle(self):
     vehicle = g_currentVehicle.item
     suitableVehicles = self.__carousel.getSuitableVehicles()
     if suitableVehicles and vehicle and vehicle.intCD in suitableVehicles:
         selectedVeh = getVehicleDataVO(vehicle)
         selectedVeh.update(
             {'tooltip': TOOLTIPS.MISSIONS_VEHICLE_SELECTOR_LIST})
         status = text_styles.statInfo(
             QUESTS.MISSIONS_VEHICLESELECTOR_STATUS_SELECTED)
     elif suitableVehicles:
         label = QUESTS.MISSIONS_VEHICLESELECTOR_STATUS_SELECT
         style = text_styles.premiumVehicleName
         selectedVeh = {
             'buyTank': True,
             'iconSmall': RES_ICONS.MAPS_ICONS_LIBRARY_EMPTY_SELECTION,
             'smallInfoText': style(label),
             'tooltip': TOOLTIPS.MISSIONS_VEHICLE_SELECTOR_SELECT
         }
         status = ''
     else:
         label = QUESTS.MISSIONS_VEHICLESELECTOR_STATUS_LIST
         style = text_styles.premiumVehicleName
         selectedVeh = {
             'buyTank': True,
             'iconSmall': RES_ICONS.MAPS_ICONS_LIBRARY_EMPTY_SELECTION,
             'smallInfoText': style(label),
             'tooltip': TOOLTIPS.MISSIONS_VEHICLE_SELECTOR_LIST
         }
         status = text_styles.critical(
             QUESTS.MISSIONS_VEHICLESELECTOR_STATUS_NOTAVAILABLE)
     selectedVeh.update(isUseRightBtn=False)
     suitableVehiclesCount = self.__carousel.getSuitableVehiclesCount()
     totalVehiclesCount = self.__carousel.getTotalVehiclesCount()
     if suitableVehiclesCount == 0:
         suitableStyle = text_styles.unavailable
     else:
         suitableStyle = text_styles.highTitle
     count = '{} / {}'.format(suitableStyle(suitableVehiclesCount),
                              text_styles.main(totalVehiclesCount))
     title = text_styles.highTitle(
         ms(QUESTS.MISSIONS_VEHICLESELECTOR_TITLE, count=count))
     self.as_setInitDataS({'title': title, 'statusText': status})
     self.as_showSelectedVehicleS(selectedVeh)
Exemplo n.º 20
0
 def _packTerms(self, data):
     text = makeHtmlText('tooltip_terms_label', ms(self._termsAlias))
     arenaType = data.get('arenaType', 0)
     if arenaType == ARENA_GUI_TYPE.FALLOUT_MULTITEAM:
         text += '\n' + makeHtmlText('tooltip_terms_label', ms(self._termsAlias + '/gasAttack'))
     return [formatters.packTextBlockData(text)]
Exemplo n.º 21
0
 def _packTerms(self, data):
     text = makeHtmlText('tooltip_terms_label', ms(self._termsAlias))
     return [formatters.packTextBlockData(text)]
Exemplo n.º 22
0
 def __addResultBlock(self, items, title, text):
     htmlTitle = makeHtmlText('tooltip_block_title_label', ms(title))
     items.append(formatters.packResultBlockData(htmlTitle, text))
Exemplo n.º 23
0
 def getDisplayableData(self, buildingUID, isMine):
     ms = i18n.makeString
     fort = self.fortCtrl.getFort()
     battleID = getBattleID()
     battle = fort.getBattle(battleID)
     buildingTypeID = self.getBuildingIDbyUID(buildingUID)
     if battle.isDefence():
         isAttack = not isMine
     else:
         isAttack = isMine
     if isAttack:
         buildingsList = battle.getAttackerBuildList()
         buildingsFullList = battle.getAttackerFullBuildList()
     else:
         buildingsList = battle.getDefenderBuildList()
         buildingsFullList = battle.getDefenderFullBuildList()
     buildingFullData = findFirst(lambda x: x[0] == buildingTypeID, buildingsFullList)
     _, status, buildingLevel, hpVal, defResVal = buildingFullData
     isReadyForBattle = status == constants.FORT_BUILDING_STATUS.READY_FOR_BATTLE
     buildingData = None
     resCount, arenaTypeID = (None, None)
     if isReadyForBattle:
         buildingData = findFirst(lambda x: x[0] == buildingTypeID, buildingsList)
         _, resCount, arenaTypeID = buildingData
     _, status, buildingLevel, hpVal, defResVal = buildingFullData
     progress = self._getProgress(buildingTypeID, buildingLevel)
     normLevel = max(buildingLevel, 1)
     buildingLevelData = fortified_regions.g_cache.buildings[buildingTypeID].levels[normLevel]
     hpTotalVal = buildingLevelData.hp
     maxDefResVal = buildingLevelData.storage
     buildingName = self.app.utilsManager.textManager.getText(TextType.HIGH_TITLE, ms(FORT.buildings_buildingname(buildingUID)))
     currentMapTxt = None
     buildingLevelTxt = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, ms(FORT.FORTMAINVIEW_HEADER_LEVELSLBL, buildLevel=str(fort_formatters.getTextLevel(buildingLevel))))
     descrActionTxt = None
     statusTxt = None
     statusLevel = None
     indicatorsModel = None
     infoMessage = None
     if status == constants.FORT_BUILDING_STATUS.LOW_LEVEL:
         minBuildingLevel = fortified_regions.g_cache.defenceConditions.minRegionLevel
         minLevel = fort_formatters.getTextLevel(1)
         maxLevel = fort_formatters.getTextLevel(minBuildingLevel - 1)
         infoMessage = ms(FORT.TOOLTIPBUILDINGINFO_LOWLEVELMESSAGE, minLevel=minLevel, maxLevel=maxLevel)
     else:
         indicatorsModel = makeBuildingIndicatorsVO(buildingLevel, progress, hpVal, hpTotalVal, defResVal, maxDefResVal)
         if isReadyForBattle:
             lootedBuildings = battle.getLootedBuildList()
             battleStatus = self.BATTLE_STATUSES.NO_BATTLE
             if (buildingData, isAttack) in lootedBuildings:
                 battleStatus = self.BATTLE_STATUSES.LOST
                 if battle.isDefence() and isAttack or not battle.isDefence() and not isAttack:
                     battleStatus = self.BATTLE_STATUSES.WON
             arenaType = ArenaType.g_cache.get(arenaTypeID)
             prefix = self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, ms(FORT.TOOLTIPBUILDINGINFO_MEP_MAPPREFIX))
             mapName = self.app.utilsManager.textManager.getText(TextType.NEUTRAL_TEXT, arenaType.name)
             currentMapTxt = prefix + mapName
             statusLevel = battleStatus.level
             statusTxt = ms(battleStatus.msg)
             defResStatusTxt = self.app.utilsManager.textManager.concatStyles(((battleStatus.color, '%s %s' % (battleStatus.prefix, BigWorld.wg_getIntegralFormat(resCount))), (TextIcons.NUT_ICON,)))
             descrActionTxt = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, ms(FORT.TOOLTIPBUILDINGINFO_DESCRACTION))
             descrActionTxt = descrActionTxt % {'value': defResStatusTxt}
         else:
             minResCount = hpTotalVal * 0.2
             minResStatusTxt = self.app.utilsManager.textManager.concatStyles(((TextType.NEUTRAL_TEXT, BigWorld.wg_getIntegralFormat(minResCount)), (TextIcons.NUT_ICON,)))
             infoMessage = self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, ms(FORT.TOOLTIPBUILDINGINFO_DESTROYEDMESSAGE))
             infoMessage = infoMessage % {'value': minResStatusTxt}
     result = {'buildingUID': buildingUID,
      'buildingName': buildingName,
      'currentMap': currentMapTxt,
      'buildingLevel': buildingLevelTxt,
      'descrAction': descrActionTxt,
      'statusMsg': statusTxt,
      'statusLevel': statusLevel,
      'indicatorModel': indicatorsModel,
      'isAvailable': isReadyForBattle,
      'infoMessage': infoMessage}
     return result
Exemplo n.º 24
0
 def getDisplayableData(self, type, id, nationId, timeLeft, isPermanent = None, value = None, isUsed = False, boundVehicle = None, boundToCurrentVehicle = False):
     ms = i18n.makeString
     item = self._context.buildItem(nationId, id, type)
     headerText = ''
     typeText = ''
     descriptionText = ''
     allow = None
     deny = None
     usageStr = None
     allowStr = None
     denyStr = None
     footerStr = ''
     footerList = []
     if timeLeft >= 0:
         timeLeftText = self.__getTimeLeftText(timeLeft, isUsed)
         timeLeftText = self.__getText(TextType.MAIN_TEXT, timeLeftText)
     else:
         timeLeftText = ''
     if isPermanent and value > 1:
         footerList.append(ms(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_STORED, quantity=value))
     if type == CUSTOMIZATION_ITEM_TYPE.CAMOUFLAGE:
         headerText = item['description'] + '/label'
         allow = item['allow']
         deny = item['deny']
         typeText = ms(VEHICLE_CUSTOMIZATION.CAMOUFLAGE) + ' ' + ms(CAMOUFLAGES_KIND_TEXTS[item['kind']])
         descriptionText = self.__getText(TextType.STANDARD_TEXT, ms(item['description'] + '/description'))
     elif type == CUSTOMIZATION_ITEM_TYPE.EMBLEM:
         groupName, _, _, _, emblemName, _, _, allow, deny = item
         groups, _, _ = vehicles.g_cache.playerEmblems()
         _, group, _, _, _, _ = groups.get(groupName)
         headerText = emblemName
         typeText = ms(VEHICLE_CUSTOMIZATION.EMBLEM) + ' ' + ms(group)
         descriptionText = ''
     elif type == CUSTOMIZATION_ITEM_TYPE.INSCRIPTION:
         groupName, _, _, _, inscriptionName, _, _, allow, deny = item
         groups = vehicles.g_cache.customization(nationId).get('inscriptionGroups', {})
         _, group, _, _, _ = groups.get(groupName)
         headerText = inscriptionName
         typeText = ms(VEHICLE_CUSTOMIZATION.INSCRIPTION) + ' ' + ms(group)
         descriptionText = ''
     allow = self._processVehiclesList(allow)
     deny = self._processVehiclesList(deny)
     if boundVehicle is None and allow and len(allow) > 0:
         allowStr = ms(TOOLTIPS.CUSTOMIZATION_QUESTAWARD_EXACTVEHICLE, vehicle=', '.join(allow))
     if boundVehicle is None and deny and len(deny) > 0:
         denyStr = ms(TOOLTIPS.CUSTOMIZATION_QUESTAWARD_DENYVEHICLE, vehicle=', '.join(deny))
     if boundToCurrentVehicle:
         usageStr = self.__getText(TextType.STATS_TEXT, ms(TOOLTIPS.CUSTOMIZATION_QUESTAWARD_CURRENTVEHICLE))
     elif boundVehicle:
         vehicle = vehicles.getVehicleType(int(boundVehicle))
         usageStr = self.__getText(TextType.STATS_TEXT, ms(TOOLTIPS.CUSTOMIZATION_QUESTAWARD_EXACTVEHICLE, vehicle=vehicle.shortUserString))
     elif type != CUSTOMIZATION_ITEM_TYPE.EMBLEM and not allowStr:
         usageStr = self.__getText(TextType.STATS_TEXT, ms(CAMOUFLAGES_NATIONS_TEXTS[nationId]))
     if usageStr:
         footerList.append(usageStr)
     if allowStr:
         footerList.append(allowStr)
     if denyStr:
         footerList.append(denyStr)
     if len(footerList):
         footerStr = self.__getText(TextType.STATS_TEXT, '\n'.join(footerList))
     return {'header': self.__getText(TextType.HIGH_TITLE, ms(headerText)),
      'kind': self.__getText(TextType.MAIN_TEXT, typeText),
      'description': descriptionText,
      'timeLeft': timeLeftText,
      'vehicleType': footerStr}
Exemplo n.º 25
0
 def __addResultBlock(self, items, title, text):
     htmlTitle = makeHtmlText('tooltip_block_title_label', ms(title))
     items.append(formatters.packResultBlockData(htmlTitle, text))
Exemplo n.º 26
0
 def format(cls, condition, event, styler):
     relation, value = condition.relation, condition.relationValue
     label = ms('#quests:details/requirements/globalRating')
     label = relate(relation, value, label)
     style = styler(condition.isAvailable())
     return [packText(style(label))]
Exemplo n.º 27
0
 def __makeMainText(self, value):
     localMsg = ms(value)
     return self.app.utilsManager.textManager.getText(TextType.MAIN_TEXT, localMsg)
Exemplo n.º 28
0
 def __makeConditions(self):
     txt = ms(TOOLTIPS.TOOLTIPREFSYSAWARDS_INFOBODY_CONDITIONS, top=game_control.g_instance.refSystem.getPosByXPinTeam())
     return self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, txt)
Exemplo n.º 29
0
 def __makeStandardText(self, value):
     localMsg = ms(value)
     return self.app.utilsManager.textManager.getText(TextType.STANDARD_TEXT, localMsg)
Exemplo n.º 30
0
 def _packTerms(self, data):
     text = makeHtmlText('tooltip_terms_label', ms(self._termsAlias))
     return [formatters.packTextBlockData(text)]
Exemplo n.º 31
0
 def format(cls, condition, event, styler):
     style = styler(condition.isAvailable())
     key = '#quests:details/requirements/vehicle/%s' % (
         'receivedMultXp' if condition.getValue() else 'notReceivedMultXp')
     label = ms(key, mult=cls.itemsCache.items.shop.dailyXPFactor)
     return [packText(style(label))]
Exemplo n.º 32
0
 def __makeTitle(self):
     localMsg = ms(TOOLTIPS.TOOLTIPREFSYSDESCRIPTION_HEADER_TITLETF)
     return self.app.utilsManager.textManager.getText(TextType.HIGH_TITLE, localMsg)
Exemplo n.º 33
0
 def __formatPeriod(self, period):
     if period <= 24:
         return ms(TOOLTIPS.TOOLTIPREFSYSXPMULTIPLIER_CONDITIONS_HOURS, hoursNum=period)
     if period <= 8760:
         return ms(TOOLTIPS.TOOLTIPREFSYSXPMULTIPLIER_CONDITIONS_DAYS, daysNum=period / 24)
     return ms(TOOLTIPS.TOOLTIPREFSYSXPMULTIPLIER_CONDITIONS_OTHER)