예제 #1
0
def _getItemTooltip(name):
    header = i18n.makeString(TOOLTIPS.getAwardHeader(name))
    body = i18n.makeString(TOOLTIPS.getAwardBody(name))
    if header or body:
        return makeTooltip(header or None, body or None)
    else:
        return ''
def packMoneyAndXpBlocks(tooltipBlocks, btnType, valueBlocks, alternativeData=None, hideActionBlock=False):
    titleBlocks = list()
    alternativeData = alternativeData or {}
    titleBlocks.append(packTitleDescBlock(text_styles.highTitle(TOOLTIPS.getHeaderBtnTitle(alternativeData.get('title') or btnType)), None, padding=packPadding(bottom=15)))
    tooltipBlocks.append(packBuildUpBlockData(titleBlocks))
    if valueBlocks is not None:
        tooltipBlocks.append(packBuildUpBlockData(valueBlocks, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
    decsBlocks = list()
    descLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE
    if btnType == CURRENCIES_CONSTANTS.CRYSTAL:
        descLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILD_BLOCK_VIOLET_BIG_LINKAGE
        padding = packPadding(bottom=8)
        decsBlocks.append(packTextBlockData(text_styles.middleTitle(backport.text(R.strings.tooltips.header.buttons.crystal.descriptionTitle())), padding=padding))
        descVehicle = text_styles.vehicleStatusInfoText(backport.text(R.strings.tooltips.header.buttons.crystal.descriptionVehicle()))
        decsBlocks.append(packTextBlockData(text_styles.main(backport.text(R.strings.tooltips.header.buttons.crystal.description0(), vehicle=descVehicle)), padding=padding))
        decsBlocks.append(packTextBlockData(text_styles.main(backport.text(R.strings.tooltips.header.buttons.crystal.description1())), padding=packPadding(bottom=20)))
    elif btnType == CURRENCIES_CONSTANTS.BRCOIN:
        decsBlocks.append(packTextBlockData(text_styles.main(TOOLTIPS.getHeaderBtnDesc(alternativeData.get('btnDesc') or btnType)), padding=packPadding(bottom=-8)))
    else:
        decsBlocks.append(packTextBlockData(text_styles.main(TOOLTIPS.getHeaderBtnDesc(alternativeData.get('btnDesc') or btnType)), padding=packPadding(bottom=15)))
    tooltipBlocks.append(packBuildUpBlockData(decsBlocks, linkage=descLinkage))
    if not hideActionBlock:
        if btnType != CURRENCIES_CONSTANTS.CRYSTAL:
            actionBlocks = list()
            actionBlocks.append(packAlignedTextBlockData(text=text_styles.standard(TOOLTIPS.getHeaderBtnClickDesc(alternativeData.get('btnClickDesc') or btnType)), align=alternativeData.get('btnClickDescAlign') or BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
            tooltipBlocks.append(packBuildUpBlockData(actionBlocks))
    return tooltipBlocks
예제 #3
0
 def _getTooltip(cls, tooltipID):
     header = i18n.makeString(TOOLTIPS.getAwardHeader(tooltipID))
     body = i18n.makeString(TOOLTIPS.getAwardBody(tooltipID))
     if header or body:
         return makeTooltip(header or None, body or None)
     else:
         return ''
예제 #4
0
def packMoneyAndXpBlocks(tooltipBlocks, btnType, valueBlocks):
    titleBlocks = list()
    titleBlocks.append(
        packTitleDescBlock(text_styles.highTitle(
            TOOLTIPS.getHeaderBtnTitle(btnType)),
                           None,
                           padding=packPadding(bottom=15)))
    tooltipBlocks.append(packBuildUpBlockData(titleBlocks))
    if valueBlocks is not None:
        tooltipBlocks.append(
            packBuildUpBlockData(valueBlocks,
                                 linkage=BLOCKS_TOOLTIP_TYPES.
                                 TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
    if btnType != CURRENCIES_CONSTANTS.GOLD:
        decsBlocks = list()
        decsBlocks.append(
            packTextBlockData(text_styles.main(
                TOOLTIPS.getHeaderBtnDesc(btnType)),
                              padding=packPadding(bottom=15)))
        tooltipBlocks.append(packBuildUpBlockData(decsBlocks))
    actionBlocks = list()
    actionBlocks.append(
        packAlignedTextBlockData(text=text_styles.standard(
            TOOLTIPS.getHeaderBtnClickDesc(btnType)),
                                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
    tooltipBlocks.append(packBuildUpBlockData(actionBlocks))
    return tooltipBlocks
예제 #5
0
    def _getTableHeaderData(self):
        result = [{
            'tooltip':
            makeTooltip(TOOLTIPS.ELEN_SUMMARY_TABLE_PLATOON_HEADER,
                        TOOLTIPS.ELEN_SUMMARY_TABLE_PLATOON_BODY),
            'icon':
            RES_ICONS.MAPS_ICONS_EVENTBOARDS_TABLEICONS_PLATOON
        }]
        params = self.__getSortedParams()
        for p in params:
            result.append({
                'tooltip':
                makeTooltip(TOOLTIPS.elen_summary_table_all_header(p),
                            TOOLTIPS.elen_summary_table_all_body(p)),
                'icon':
                self._TableIconByParameter[p]
            })

        result.append({
            'tooltip':
            makeTooltip(TOOLTIPS.ELEN_SUMMARY_TABLE_FRAGS_HEADER,
                        TOOLTIPS.ELEN_SUMMARY_TABLE_FRAGS_BODY),
            'icon':
            RES_ICONS.MAPS_ICONS_EVENTBOARDS_TABLEICONS_VEHICLE
        })
        return {
            'dateTooltip':
            makeTooltip(TOOLTIPS.ELEN_SUMMARY_TABLE_DATE_HEADER),
            'technicsTooltip':
            makeTooltip(TOOLTIPS.ELEN_SUMMARY_TABLE_VEHICLES_HEADER),
            'resultTooltip':
            makeTooltip(TOOLTIPS.ELEN_SUMMARY_TABLE_RESULT_HEADER),
            'columns':
            result
        }
예제 #6
0
 def __getTransportingBuildTooltipData(self, building):
     state = None
     headerArgs = {}
     bodyArgs = {}
     if building is not None:
         buildingName = building.userName
         if building.isInCooldown():
             state = 'cooldown'
             timeStr = time_formatters.getTimeDurationStr(building.getEstimatedCooldown())
             headerArgs = {'buildingName': buildingName}
             bodyArgs = {'time': timeStr}
         elif not building.hasStorageToExport():
             state = 'emptyStorage'
             headerArgs = {'buildingName': buildingName}
         elif not building.hasSpaceToImport() and self.isOnNextTransportingStep():
             state = 'notEmptySpace'
             headerArgs = {'buildingName': buildingName}
         elif not building.isReady():
             state = 'foundation'
     else:
         state = 'foundation'
     if state == 'foundation':
         headerArgs = {'buildingName': i18n.makeString(FORTIFICATIONS.BUILDINGS_TROWELLABEL)}
     if state is not None:
         header = TOOLTIPS.fortification_transporting(state + '/header')
         body = TOOLTIPS.fortification_transporting(state + '/body')
         return [i18n.makeString(header, **headerArgs), i18n.makeString(body, **bodyArgs)]
     else:
         return
         return
예제 #7
0
 def getExperienceBlock(self):
     event = self._event
     eventType = self._event.getType()
     method = event.getMethod()
     op = event.getObjectiveParameter()
     opName = EVENT_BOARDS.summary_param_all(method, op)
     opValue = self._excelItem.getP1()
     rank = self._excelItem.getRank()
     battles = self._excelItem.getP3()
     battleIcon = self._iconByType[op]
     groupPos = self.__getRibbon()
     positionTooltip = makeTooltip(
         TOOLTIPS.elen_summary_rank(groupPos) if groupPos else TOOLTIPS.
         ELEN_SUMMARY_RANK_NORANK)
     battleTooltip = makeTooltip(
         TOOLTIPS.ELEN_SUMMARY_BATTLES_HEADER,
         TOOLTIPS.elen_summary_battles_all_body(eventType))
     experienceTooltip = makeTooltip(
         TOOLTIPS.elen_excel_objparam_all_all_header(method, op),
         TOOLTIPS.elen_excel_objparam_all_all_body(method, op))
     return {
         'experienceValue': str(opValue),
         'experience': opName,
         'position': _ms(EVENT_BOARDS.SUMMARY_POSITION, position=str(rank)),
         'battleValue': str(battles),
         'battle': _ms(EVENT_BOARDS.SUMMARY_BATTLES),
         'experienceIcon': battleIcon,
         'ribbon': groupPos,
         'battleIcon':
         RES_ICONS.MAPS_ICONS_EVENTBOARDS_POPUPICONS_BATTLE_POPUP,
         'experienceTooltip': experienceTooltip,
         'positionTooltip': positionTooltip,
         'battleTooltip': battleTooltip
     }
 def __getTransportingBuildTooltipData(self, building):
     state = None
     headerArgs = {}
     bodyArgs = {}
     if building is not None:
         buildingName = building.userName
         if building.isInCooldown():
             state = 'cooldown'
             timeStr = time_formatters.getTimeDurationStr(building.getEstimatedCooldown())
             headerArgs = {'buildingName': buildingName}
             bodyArgs = {'time': timeStr}
         elif not building.hasStorageToExport():
             state = 'emptyStorage'
             headerArgs = {'buildingName': buildingName}
         elif not building.hasSpaceToImport() and self.isOnNextTransportingStep():
             state = 'notEmptySpace'
             headerArgs = {'buildingName': buildingName}
         elif not building.isReady():
             state = 'foundation'
     else:
         state = 'foundation'
     if state == 'foundation':
         headerArgs = {'buildingName': i18n.makeString(FORTIFICATIONS.BUILDINGS_TROWELLABEL)}
     if state is not None:
         header = TOOLTIPS.fortification_transporting(state + '/header')
         body = TOOLTIPS.fortification_transporting(state + '/body')
         return [i18n.makeString(header, **headerArgs), i18n.makeString(body, **bodyArgs)]
     else:
         return
         return
예제 #9
0
 def getEpicAwardVOs(self, withDescription=False):
     itemInfo = self.__getCommonAwardsVOs(iconSize='big')
     itemInfo.update(_EPIC_AWARD_STATIC_VO_ENTRIES)
     if withDescription:
         itemInfo['title'] = i18n.makeString(
             TOOLTIPS.getAwardHeader(self._name))
         itemInfo['description'] = i18n.makeString(
             TOOLTIPS.getAwardBody(self._name))
     return [itemInfo]
예제 #10
0
 def getTooltip(self):
     """ Get award's tooltip for award carousel.
     """
     header = i18n.makeString(TOOLTIPS.getAwardHeader(self._name))
     body = i18n.makeString(TOOLTIPS.getAwardBody(self._name))
     if header or body:
         return makeTooltip(header or None, body or None)
     else:
         return ''
예제 #11
0
 def buildItem(self, season):
     seasonImage = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_SEASON_SUMMER
     if season == SeasonType.WINTER:
         seasonImage = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_SEASON_WINTER
     elif season == SeasonType.DESERT:
         seasonImage = RES_ICONS.MAPS_ICONS_CUSTOMIZATION_SEASON_DESERT
     elif season == SeasonType.EVENT:
         pass
     return {'seasonImage': seasonImage,
      'header': TOOLTIPS.seasonHeader(SEASONS_CONSTANTS.SEASONS[season]),
      'body': TOOLTIPS.seasonBody(SEASONS_CONSTANTS.SEASONS[season])}
예제 #12
0
 def _getStatisticsBlock(self):
     event = self._event
     method = event.getMethod()
     op = event.getObjectiveParameter()
     order = list(filter(lambda t: op not in t, self._ParameterOrder))
     info = self._excelItem.getInfo()
     param1 = order[0][0]
     statistic1 = EVENT_BOARDS.summary_param_all(method, param1)
     statistic1Value = str(_getParameterValue(param1, info))
     statistic1Icon = _ICON_BY_PARAMETER[param1]
     param2 = order[1][0]
     statistic2 = EVENT_BOARDS.summary_param_all(method, param2)
     statistic2Value = str(_getParameterValue(param2, info))
     statistic2Icon = _ICON_BY_PARAMETER[param2]
     return {
         'statistic1Value':
         statistic1Value,
         'statistic1':
         statistic1,
         'statistic1Icon':
         statistic1Icon,
         'statistic1Tooltip':
         makeTooltip(
             TOOLTIPS.elen_summary_param_all_all_header(method, param1),
             TOOLTIPS.elen_summary_param_all_all_body(method, param1)),
         'statistic2Value':
         statistic2Value,
         'statistic2':
         statistic2,
         'statistic2Icon':
         statistic2Icon,
         'statistic2Tooltip':
         makeTooltip(
             TOOLTIPS.elen_summary_param_all_all_header(method, param2),
             TOOLTIPS.elen_summary_param_all_all_body(method, param2)),
         'statistic3Value':
         str(info.getBlockedDamage()),
         'statistic3':
         EVENT_BOARDS.SUMMARY_DAMAGEBLOCKED,
         'statistic3Icon':
         RES_ICONS.MAPS_ICONS_EVENTBOARDS_POPUPICONS_BLOCKED_DMG_POPUP,
         'statistic3Tooltip':
         makeTooltip(TOOLTIPS.ELEN_SUMMARY_ADDPARAM_DAMAGEBLOCKED_HEADER,
                     TOOLTIPS.ELEN_SUMMARY_ADDPARAM_DAMAGEBLOCKED_BODY),
         'statistic4Value':
         str(info.getFrags()),
         'statistic4':
         _ms(EVENT_BOARDS.SUMMARY_DESTROYEDVEHICLES),
         'statistic4Icon':
         RES_ICONS.MAPS_ICONS_EVENTBOARDS_POPUPICONS_VEHICLE_POPUP,
         'statistic4Tooltip':
         makeTooltip(TOOLTIPS.ELEN_SUMMARY_ADDPARAM_FRAGS_HEADER,
                     TOOLTIPS.ELEN_SUMMARY_ADDPARAM_FRAGS_BODY)
     }
예제 #13
0
def makeTableHeaderVO(method, objective, eventType):
    if objective == _op.WINS:
        icons = (RES_ICONS.getEventBoardIcon('win_quantity'),
                 RES_ICONS.getEventBoardIcon('battle_exp_average'),
                 RES_ICONS.getEventBoardIcon('battle_quantity'))
    else:
        try:
            icons = [
                (RES_ICONS.getEventBoardIcon(icon) if '%s' not in icon else
                 RES_ICONS.getEventBoardIcon(icon %
                                             _OBJECTIVE_STRINGS[objective]))
                for icon in _METHOD_ICON_NAMES[method]
            ]
        except KeyError:
            LOG_ERROR('WGELEN: Wrong method/objective: %s/%s!' %
                      (method, objective))
            return None

    return {
        'columns': [{
            'tooltip':
            makeTooltip(
                TOOLTIPS.elen_excel_objparam_all_all_header(method, objective),
                TOOLTIPS.elen_excel_objparam_all_all_body(method, objective)),
            'icon':
            icons[0]
        }, {
            'tooltip':
            makeTooltip(
                TOOLTIPS.elen_excel_addparam_all_all_header(method, objective),
                TOOLTIPS.elen_excel_addparam_all_all_body(method, objective)),
            'icon':
            icons[1]
        }, {
            'tooltip':
            makeTooltip(
                TOOLTIPS.ELEN_EXCEL_INFOPARAM_WINS_HEADER,
                TOOLTIPS.elen_excel_infoparam_wins_all_body(eventType)),
            'icon':
            icons[2]
        }],
        'positionTooltip':
        makeTooltip(TOOLTIPS.ELEN_EXCEL_POSITION_HEADER,
                    TOOLTIPS.ELEN_EXCEL_POSITION_BODY),
        'playerTooltip':
        makeTooltip(TOOLTIPS.ELEN_EXCEL_PLAYER_HEADER,
                    TOOLTIPS.ELEN_EXCEL_PLAYER_BODY)
    }
 def getCommonData(self, callback):
     items = self.itemsCache.items
     tankman = items.getTankman(self.tmanInvID)
     changeRoleCost = items.shop.changeRoleCost
     defaultChangeRoleCost = items.shop.defaults.changeRoleCost
     if changeRoleCost != defaultChangeRoleCost and not self.bootcamp.isInBootcamp():
         discount = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'changeRoleCost', True, Money(gold=changeRoleCost), Money(gold=defaultChangeRoleCost))
     else:
         discount = None
     rate = items.shop.freeXPToTManXPRate
     if rate:
         toNextPrcLeft = roundByModulo(tankman.getNextLevelXpCost(), rate)
         enoughFreeXPForTeaching = items.stats.freeXP - max(1, toNextPrcLeft / rate) >= 0
     else:
         enoughFreeXPForTeaching = False
     nativeVehicle = items.getItemByCD(tankman.vehicleNativeDescr.type.compactDescr)
     currentVehicle = None
     if tankman.isInTank:
         currentVehicle = items.getItemByCD(tankman.vehicleDescr.type.compactDescr)
     isLocked, reason = self.__getTankmanLockMessage(currentVehicle)
     td = tankman.descriptor
     changeRoleEnabled = tankmen.tankmenGroupCanChangeRole(td.nationID, td.gid, td.isPremium)
     if changeRoleEnabled:
         tooltipChangeRole = makeTooltip(TOOLTIPS.CREW_ROLECHANGE_HEADER, TOOLTIPS.CREW_ROLECHANGE_TEXT)
     else:
         roleStr = i18n.makeString(TOOLTIPS.crewRole(td.role))
         tooltipChangeRole = makeTooltip(TOOLTIPS.CREW_ROLECHANGEFORBID_HEADER, i18n.makeString(TOOLTIPS.CREW_ROLECHANGEFORBID_TEXT, role=roleStr))
     showDocumentTab = not td.getRestrictions().isPassportReplacementForbidden()
     bonuses = tankman.realRoleLevel[1]
     modifiers = []
     if bonuses[0]:
         modifiers.append({'id': 'fromCommander',
          'val': bonuses[0]})
     if bonuses[1]:
         modifiers.append({'id': 'fromSkills',
          'val': bonuses[1]})
     if bonuses[2] or bonuses[3]:
         modifiers.append({'id': 'fromEquipment',
          'val': bonuses[2] + bonuses[3]})
     if bonuses[4]:
         modifiers.append({'id': 'penalty',
          'val': bonuses[4]})
     tankmanData = packTankman(tankman)
     repackTankmanWithSkinData(tankman, tankmanData)
     callback({'tankman': tankmanData,
      'currentVehicle': packVehicle(currentVehicle) if currentVehicle is not None else None,
      'nativeVehicle': packVehicle(nativeVehicle),
      'isOpsLocked': isLocked,
      'lockMessage': reason,
      'modifiers': modifiers,
      'enoughFreeXPForTeaching': enoughFreeXPForTeaching,
      'tabsData': self.getTabsButtons(showDocumentTab),
      'tooltipDismiss': TOOLTIPS.BARRACKS_TANKMEN_DISMISS,
      'tooltipUnload': TOOLTIPS.BARRACKS_TANKMEN_UNLOAD,
      'dismissEnabled': True,
      'unloadEnabled': True,
      'changeRoleEnabled': changeRoleEnabled,
      'tooltipChangeRole': tooltipChangeRole,
      'actionChangeRole': discount})
     return
예제 #15
0
 def construct(self):
     module = self.module
     block = []
     title = module.userName
     imgPaddingLeft = 27
     desc = ''
     if module.itemTypeName in VEHICLE_COMPONENT_TYPE_NAMES:
         desc = text_styles.stats(_ms(TOOLTIPS.level(str(
             module.level)))) + ' ' + _ms(TOOLTIPS.VEHICLE_LEVEL)
         imgPaddingLeft = 22
     block.append(
         formatters.packImageTextBlockData(
             title=text_styles.highTitle(title),
             desc=text_styles.standard(desc),
             img=module.icon,
             imgPadding=formatters.packPadding(left=imgPaddingLeft),
             txtGap=-3,
             txtOffset=130 - self.leftPadding,
             padding=formatters.packPadding(top=-6)))
     if module.itemTypeID == GUI_ITEM_TYPE.GUN:
         vehicle = self.configuration.vehicle
         vDescr = vehicle.descriptor if vehicle is not None else None
         if module.isClipGun(vDescr):
             block.append(
                 formatters.packImageTextBlockData(
                     title=text_styles.standard(
                         MENU.MODULEINFO_CLIPGUNLABEL),
                     desc='',
                     img=RES_ICONS.MAPS_ICONS_MODULES_MAGAZINEGUNICON,
                     imgPadding=formatters.packPadding(top=3),
                     padding=formatters.packPadding(left=108, top=9)))
     return block
예제 #16
0
    def __getItemTabsData(self):
        tabsData = []
        pluses = []
        if self.__ctx.modeId == CustomizationModes.STYLED:
            return (tabsData, pluses)
        visibleTabs = self.getVisibleTabs()
        outfit = self.__ctx.mode.currentOutfit
        for tabId in visibleTabs:
            slotType = CustomizationTabs.SLOT_TYPES[tabId]
            itemTypeName = GUI_ITEM_TYPE_NAMES[slotType]
            slotsCount, filledSlotsCount = checkSlotsFilling(outfit, slotType)
            showPlus = filledSlotsCount < slotsCount
            tabsData.append({
                'label':
                _ms(ITEM_TYPES.customizationPlural(itemTypeName)),
                'icon':
                RES_ICONS.getCustomizationIcon(itemTypeName),
                'tooltip':
                makeTooltip(ITEM_TYPES.customizationPlural(itemTypeName),
                            TOOLTIPS.customizationItemTab(itemTypeName)),
                'id':
                tabId
            })
            pluses.append(showPlus)

        return (tabsData, pluses)
예제 #17
0
 def getTooltip(self):
     """ Get award's tooltip for award carousel.
     """
     if len(self._value) > 1:
         nameFormat = '{}/several'.format(self._name)
         header = i18n.makeString(TOOLTIPS.getAwardHeader(nameFormat))
         body = self.__getAllQuestNames()
     else:
         nameFormat = '{}/one'.format(self._name)
         header = i18n.makeString(TOOLTIPS.getAwardHeader(nameFormat))
         body = i18n.makeString(TOOLTIPS.getAwardBody(nameFormat), name=self.__getFirstQuestName())
     if header or body:
         return makeTooltip(header or None, body or None)
     else:
         return ''
         return None
예제 #18
0
 def construct(self):
     module = self.module
     block = []
     title = module.userName
     imgPaddingLeft = 27
     imgPaddingTop = 0
     txtOffset = 130 - self.leftPadding
     desc = ''
     if module.itemTypeName in VEHICLE_COMPONENT_TYPE_NAMES:
         desc = text_styles.concatStylesWithSpace(text_styles.stats(_ms(TOOLTIPS.level(str(module.level)))), text_styles.standard(_ms(TOOLTIPS.VEHICLE_LEVEL)))
         imgPaddingLeft = 22
     elif module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS:
         imgPaddingLeft = 7
         imgPaddingTop = 5
         txtOffset = 90 - self.leftPadding
         moduleParams = params_helper.getParameters(module)
         weightUnits = text_styles.standard(TOOLTIPS.PARAMETER_WEIGHTUNITS)
         paramName = ModuleTooltipBlockConstructor.WEIGHT_MODULE_PARAM
         paramValue = params_formatters.formatParameter(paramName, moduleParams[paramName]) if paramName in moduleParams else None
         if paramValue is not None:
             desc = text_styles.main(TOOLTIPS.PARAMETER_WEIGHT) + text_styles.credits(paramValue) + weightUnits
     else:
         desc = text_styles.standard(desc)
     overlayPath, overlayPadding, blockPadding = self.__getOverlayData()
     block.append(formatters.packItemTitleDescBlockData(title=text_styles.highTitle(title), desc=desc, img=module.icon, imgPadding=formatters.packPadding(left=imgPaddingLeft, top=imgPaddingTop), txtGap=-3, txtOffset=txtOffset, padding=blockPadding, overlayPath=overlayPath, overlayPadding=overlayPadding))
     if module.itemTypeID == GUI_ITEM_TYPE.GUN:
         vehicle = self.configuration.vehicle
         vDescr = vehicle.descriptor if vehicle is not None else None
         if module.isClipGun(vDescr):
             block.append(formatters.packImageTextBlockData(title=text_styles.standard(MENU.MODULEINFO_CLIPGUNLABEL), desc='', img=RES_ICONS.MAPS_ICONS_MODULES_MAGAZINEGUNICON, imgPadding=formatters.packPadding(top=3), padding=formatters.packPadding(left=108, top=9)))
     elif module.itemTypeID == GUI_ITEM_TYPE.CHASSIS:
         if module.isHydraulicChassis():
             block.append(formatters.packImageTextBlockData(title=text_styles.standard(MENU.MODULEINFO_HYDRAULICCHASSISLABEL), desc='', img=RES_ICONS.MAPS_ICONS_MODULES_HYDRAULICCHASSISICON, imgPadding=formatters.packPadding(top=3), padding=formatters.packPadding(left=108, top=9)))
     return block
예제 #19
0
 def __makeEfficiencyHeaderTooltip(cls, key, value):
     if value > 0:
         header = TOOLTIPS.battleresults_efficiencyheader(key)
         body = BigWorld.wg_getIntegralFormat(value)
         return makeTooltip(header, body)
     else:
         return None
예제 #20
0
 def _packBlocks(self, paramName):
     extendedData = self.context.getComparator().getExtendedData(paramName)
     self.__paramName = extendedData.name
     title = text_styles.highTitle(MENU.tank_params(paramName))
     if param_formatter.isRelativeParameter(paramName):
         value = param_formatter.colorizedFormatParameter(extendedData, self.context.formatters)
         title += ' ' + text_styles.warning(_ms(TOOLTIPS.VEHICLEPARAMS_TITLE_VALUETEMPLATE, value=value))
     else:
         title += ' ' + text_styles.middleTitle(MEASURE_UNITS.get(paramName, ''))
     desc = _ms(TOOLTIPS.tank_params_desc(paramName))
     possibleBonuses = sorted(extendedData.possibleBonuses, _bonusCmp)
     if possibleBonuses is not None and len(possibleBonuses) > 0:
         desc += ' ' + _ms(TOOLTIPS.VEHICLEPARAMS_POSSIBLEBONUSES_DESC)
         desc += '\n' + self.__createBonusesStr(possibleBonuses)
     blocks = [formatters.packTitleDescBlock(title, text_styles.main(desc))]
     bonuses = sorted(extendedData.bonuses, _bonusCmp)
     if bonuses is not None and len(bonuses) > 0:
         blocks.append(formatters.packTitleDescBlock(text_styles.middleTitle(TOOLTIPS.VEHICLEPARAMS_BONUSES_TITLE), text_styles.main(self.__createBonusesStr(bonuses))))
     penalties = extendedData.penalties
     actualPenalties, nullPenaltyTypes = self.__getNumNotNullPenaltyTankman(penalties)
     penaltiesLen = len(penalties)
     numNotNullPenaltyTankman = len(actualPenalties)
     if numNotNullPenaltyTankman > 0:
         blocks.append(formatters.packTitleDescBlock(text_styles.critical(TOOLTIPS.VEHICLEPARAMS_PENALTIES_TITLE), text_styles.main(self.__createPenaltiesStr(actualPenalties))))
     if penaltiesLen > numNotNullPenaltyTankman:
         blocks.append(formatters.packImageTextBlockData(self.__createTankmanIsOutStr(nullPenaltyTypes), img=RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, imgPadding=formatters.packPadding(top=2, left=3, right=6)))
     return blocks
예제 #21
0
 def __getItemTabsData(self):
     data = []
     pluses = []
     for tabIdx in self.__ctx.visibleTabs:
         itemTypeID = TABS_SLOT_TYPE_MAPPING[tabIdx]
         typeName = GUI_ITEM_TYPE_NAMES[itemTypeID]
         slotsCount, filledSlotsCount = self.__ctx.checkSlotsFilling(
             itemTypeID, self.__ctx.currentSeason)
         showPlus = filledSlotsCount < slotsCount
         data.append({
             'label':
             _ms(ITEM_TYPES.customizationPlural(typeName)),
             'icon':
             RES_ICONS.getCustomizationIcon(typeName)
             if itemTypeID != GUI_ITEM_TYPE.STYLE else RES_ICONS.
             MAPS_ICONS_CUSTOMIZATION_PROPERTY_SHEET_IDLE_ICON_FULL_TANK,
             'tooltip':
             makeTooltip(
                 ITEM_TYPES.customizationPlural(typeName),
                 TOOLTIPS.customizationItemTab(typeName)
                 if itemTypeID != GUI_ITEM_TYPE.STYLE else
                 CUSTOMIZATION.DEFAULTSTYLE_LABEL),
             'id':
             tabIdx
         })
         pluses.append(showPlus)
     return data, pluses
예제 #22
0
 def __makeEfficiencyHeaderTooltip(cls, key, value):
     if value > 0:
         header = TOOLTIPS.battleresults_efficiencyheader(key)
         body = cls.__formatter(value)
         return makeTooltip(header, body)
     else:
         return None
def getItemTitle(rawItem, item, forBox=False):
    if item is not None:
        title = item.userName
        if forBox:
            tooltipKey = TOOLTIPS.getItemBoxTooltip(item.itemTypeName)
            if tooltipKey:
                title = _ms(tooltipKey, value=item.userName)
                title = title.replace(_DOUBLE_OPEN_QUOTES,
                                      _OPEN_QUOTES).replace(
                                          _DOUBLE_CLOSE_QUOTES, _CLOSE_QUOTES)
    elif rawItem.type == ItemPackType.CUSTOM_SLOT:
        title = _ms(key=TOOLTIPS.AWARDITEM_SLOTS_HEADER)
    elif rawItem.type == ItemPackType.CUSTOM_GOLD:
        title = _ms(key=QUESTS.BONUSES_GOLD_DESCRIPTION, value=rawItem.count)
    elif rawItem.type == ItemPackType.CUSTOM_CREDITS:
        title = _ms(key=QUESTS.BONUSES_CREDITS_DESCRIPTION,
                    value=rawItem.count)
    elif rawItem.type == ItemPackType.CUSTOM_CRYSTAL:
        title = _ms(key=QUESTS.BONUSES_CRYSTAL_DESCRIPTION,
                    value=rawItem.count)
    elif rawItem.type == ItemPackType.CUSTOM_PREMIUM:
        title = _ms(TOOLTIPS.PREMIUM_DAYS_HEADER, rawItem.count)
    elif rawItem.type in ItemPackTypeGroup.CREW:
        title = _ms(TOOLTIPS.CREW_HEADER)
    else:
        title = rawItem.title or ''
    return title
예제 #24
0
def formatRecoveryLeftValue(secondsLeft):
    closestUnit = findFirst(lambda (k, v): v < secondsLeft, _TIME_FORMAT_UNITS)
    if closestUnit is not None:
        name, factor = closestUnit
        timeLeft = int(math.ceil(float(secondsLeft) / factor))
        return makeString(TOOLTIPS.template_all_short(name), value=timeLeft)
    else:
        return makeString(TOOLTIPS.TEMPLATE_TIME_LESSTHENMINUTE)
 def getTooltip(self):
     eventType = self._event.getType()
     limits = self._event.getLimits()
     if eventType == _et.NATION:
         nationsList = limits.getNations()
         full = set(NationNames) == set(nationsList)
         nations = ', \n'.join([
             getNationText(value) for value in GUI_NATIONS
             if value in nationsList
         ])
         result = TOOLTIPS.elen_task_eventtype_full(
             eventType) if full else _ms(
                 TOOLTIPS.elen_task_eventtype_notfull(eventType),
                 nations=nations)
     elif eventType == _et.CLASS:
         typeList = limits.getVehiclesClasses()
         full = set(VEHICLE_CLASS_NAME.ALL()) == set(typeList)
         types = ', \n'.join([vehicleTypeText(value) for value in typeList])
         result = TOOLTIPS.elen_task_eventtype_full(
             eventType) if full else _ms(
                 TOOLTIPS.elen_task_eventtype_notfull(eventType),
                 classes=types)
     elif eventType == _et.LEVEL:
         levelList = limits.getVehiclesLevels()
         full = set(LEVELS_RANGE) == set(limits.getVehiclesLevels())
         levels = ', '.join([int2roman(value) for value in levelList])
         result = TOOLTIPS.elen_task_eventtype_full(
             eventType) if full else _ms(
                 TOOLTIPS.elen_task_eventtype_notfull(eventType),
                 levels=levels)
     else:
         result = _ms(TOOLTIPS.elen_task_eventtype_notfull(eventType))
     return makeTooltip(body=result)
예제 #26
0
 def construct(self):
     block = []
     headerBlocks = []
     if self.vehicle.isElite:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(
             self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_ELITE_VEHICLE_BG_LINKAGE
     else:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_normal(
             self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_NORMAL_VEHICLE_BG_LINKAGE
     nameStr = text_styles.highTitle(self.vehicle.userName)
     typeStr = text_styles.main(vehicleType)
     levelStr = text_styles.concatStylesWithSpace(
         text_styles.stats(int2roman(self.vehicle.level)),
         text_styles.standard(_ms(TOOLTIPS.VEHICLE_LEVEL)))
     icon = getTypeBigIconPath(self.vehicle.type, self.vehicle.isElite)
     headerBlocks.append(
         formatters.packImageTextBlockData(
             title=nameStr,
             desc=text_styles.concatStylesToMultiLine(
                 levelStr + ' ' + typeStr, ''),
             img=icon,
             imgPadding=formatters.packPadding(left=10, top=-15),
             txtGap=-2,
             txtOffset=99,
             padding=formatters.packPadding(
                 top=15, bottom=-15 if self.vehicle.isFavorite else -21)))
     if self.vehicle.isFavorite:
         headerBlocks.append(
             formatters.packImageTextBlockData(
                 title=text_styles.neutral(TOOLTIPS.VEHICLE_FAVORITE),
                 img=RES_ICONS.MAPS_ICONS_TOOLTIP_MAIN_TYPE,
                 imgPadding=formatters.packPadding(top=-15),
                 imgAtLeft=False,
                 txtPadding=formatters.packPadding(left=10),
                 txtAlign=BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT,
                 padding=formatters.packPadding(top=-28, bottom=-27)))
     block.append(
         formatters.packBuildUpBlockData(
             headerBlocks,
             stretchBg=False,
             linkage=bgLinkage,
             padding=formatters.packPadding(left=-self.leftPadding)))
     return block
def getItemTitle(rawItem, item, forBox=False, additionalInfo=False):
    if item is not None:
        title = item.userName
        if forBox and item.itemTypeName != '':
            tooltipKey = TOOLTIPS.getItemBoxTooltip(item.itemTypeName)
            if tooltipKey:
                title = _ms(tooltipKey,
                            group=item.userType,
                            value=item.userName)
                title = title.replace(_DOUBLE_OPEN_QUOTES,
                                      _OPEN_QUOTES).replace(
                                          _DOUBLE_CLOSE_QUOTES, _CLOSE_QUOTES)
    elif rawItem.type == ItemPackType.CUSTOM_SLOT:
        title = _ms(key=TOOLTIPS.AWARDITEM_SLOTS_HEADER)
    elif rawItem.type == ItemPackType.CUSTOM_GOLD:
        title = _ms(key=QUESTS.BONUSES_GOLD_DESCRIPTION, value=rawItem.count)
    elif rawItem.type == ItemPackType.CUSTOM_CREDITS:
        title = backport.text(R.strings.quests.bonuses.credits.description(),
                              value=backport.getIntegralFormat(rawItem.count))
    elif rawItem.type == ItemPackType.CUSTOM_CRYSTAL:
        title = _ms(key=QUESTS.BONUSES_CRYSTAL_DESCRIPTION,
                    value=backport.getIntegralFormat(rawItem.count))
    elif rawItem.type in (ItemPackType.CUSTOM_EVENT_COIN,
                          ItemPackType.CUSTOM_EVENT_COIN_EXTERNAL):
        title = _ms(key=QUESTS.BONUSES_EVENTCOIN_DESCRIPTION,
                    value=rawItem.count)
    elif rawItem.type == ItemPackType.CUSTOM_SUPPLY_POINT:
        title = _ms(EPIC_BATTLE.EPICBATTLEITEM_SUPPLYPOINTS_HEADER)
    elif rawItem.type == ItemPackType.CUSTOM_REWARD_POINT:
        title = _ms(EPIC_BATTLE.EPICBATTLEITEM_REWARDPOINTS_HEADER)
    elif rawItem.type == ItemPackType.CUSTOM_PREMIUM:
        title = backport.text(R.strings.tooltips.premium.days.header(),
                              rawItem.count)
    elif rawItem.type == ItemPackType.CUSTOM_PREMIUM_PLUS:
        title = backport.text(R.strings.tooltips.premiumPlus.days.header(),
                              rawItem.count)
    elif rawItem.type == ItemPackType.CUSTOM_REFERRAL_CREW:
        vehicle = g_currentPreviewVehicle.item
        title = _ms(TOOLTIPS.CUSTOMCREW_REFERRAL_HEADER,
                    vehicle=vehicle.userName)
    elif rawItem.type in ItemPackTypeGroup.CREW:
        if additionalInfo:
            title = _ms(TOOLTIPS.CREW_BODY,
                        value={
                            ItemPackType.CREW_50: CrewTypes.SKILL_50,
                            ItemPackType.CREW_75: CrewTypes.SKILL_75,
                            ItemPackType.CREW_100: CrewTypes.SKILL_100,
                            ItemPackType.CUSTOM_CREW_100: CrewTypes.SKILL_100
                        }.get(rawItem.type))
        else:
            title = _ms(TOOLTIPS.CREW_HEADER)
    elif rawItem.type == ItemPackType.CUSTOM_EVENT_PROGRESSION_REWARD_POINT:
        title = backport.text(R.strings.tooltips.vehiclePreview.buyingPanel.
                              eventProgression.price.header())
    else:
        title = rawItem.title or ''
    return title
예제 #28
0
 def getAutoDescription(self, useBigIco=False, forNormalCard=False):
     if self._marathonEvent is None:
         return ''
     values = {'level': formatVehicleLevel(i18n.makeString(TOOLTIPS.level(8)))}
     name = self.discount.getParamName()
     if name == 'set_MarathonAnnounce':
         return i18n.makeString(self._marathonEvent.data.quests.autoSetAnnounce, **values)
     else:
         return i18n.makeString(self._marathonEvent.data.quests.autoSetProgress, **values) if name == 'set_MarathonInProgress' else i18n.makeString(self._marathonEvent.data.quests.autoSetFinished, **values)
예제 #29
0
 def construct(self):
     block = []
     headerBlocks = []
     if self.vehicle.isElite:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_ELITE_VEHICLE_BG_LINKAGE
     else:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_normal(self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_NORMAL_VEHICLE_BG_LINKAGE
     nameStr = text_styles.highTitle(self.vehicle.userName)
     typeStr = text_styles.main(vehicleType)
     levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(self.vehicle.level)), text_styles.standard(_ms(TOOLTIPS.VEHICLE_LEVEL)))
     icon = '../maps/icons/vehicleTypes/big/' + self.vehicle.type + ('_elite.png' if self.vehicle.isElite else '.png')
     headerBlocks.append(formatters.packImageTextBlockData(title=nameStr, desc=text_styles.concatStylesToMultiLine(levelStr + ' ' + typeStr, ''), img=icon, imgPadding=formatters.packPadding(left=10, top=-15), txtGap=-2, txtOffset=99, padding=formatters.packPadding(top=15, bottom=-15 if self.vehicle.isFavorite else -21)))
     if self.vehicle.isFavorite:
         headerBlocks.append(formatters.packImageTextBlockData(title=text_styles.neutral(TOOLTIPS.VEHICLE_FAVORITE), img=RES_ICONS.MAPS_ICONS_TOOLTIP_MAIN_TYPE, imgPadding=formatters.packPadding(top=-15), imgAtLeft=False, txtPadding=formatters.packPadding(left=10), txtAlign=BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT, padding=formatters.packPadding(top=-28, bottom=-27)))
     block.append(formatters.packBuildUpBlockData(headerBlocks, stretchBg=False, linkage=bgLinkage, padding=formatters.packPadding(left=-self.leftPadding)))
     return block
예제 #30
0
def formatRecoveryLeftValue(secondsLeft):
    closestUnit = findFirst(lambda (k, v): v < secondsLeft, _TIME_FORMAT_UNITS)
    if closestUnit is not None:
        name, factor = closestUnit
        timeLeft = int(math.ceil(float(secondsLeft) / factor))
        return makeString(TOOLTIPS.template_all_short(name), value=timeLeft)
    else:
        return makeString(TOOLTIPS.TEMPLATE_TIME_LESSTHENMINUTE)
        return
예제 #31
0
    def _getToolTip(cls, bonus):
        tooltipData = []
        for group in bonus.getTankmenGroups().itervalues():
            tooltipData.append(
                createTooltipData(
                    makeTooltip(TOOLTIPS.getAwardHeader(bonus.getName()),
                                cls._getLabel(group))))

        return tooltipData
예제 #32
0
 def __packTitleBlock(self):
     return formatters.packImageTextBlockData(
         title=text_styles.highTitle(
             TOOLTIPS.skillTooltipHeader(self.__skillType)),
         desc=text_styles.standard(
             TOOLTIPS.skillTooltipDescr(self.__skillType)),
         img=getSkillBigIconPath(self.__skillType),
         imgPadding={
             'left': 0,
             'top': 3
         },
         txtGap=-4,
         txtOffset=60,
         padding={
             'top': -1,
             'left': 7,
             'bottom': 10
         })
    def __getItemTabsData(self):
        data = []
        for tabIdx in self.__getVisibleTabs():
            itemTypeID = TABS_ITEM_MAPPING[tabIdx]
            typeName = GUI_ITEM_TYPE_NAMES[itemTypeID]
            data.append({'label': _ms(ITEM_TYPES.customizationPlural(typeName)),
             'tooltip': makeTooltip(ITEM_TYPES.customizationPlural(typeName), TOOLTIPS.customizationItemTab(typeName)),
             'id': tabIdx})

        return data
예제 #34
0
 def _packBlocks(self, paramName):
     blocks = super(BaseVehicleAdvancedParametersTooltipData, self)._packBlocks(paramName)
     title = text_styles.highTitle(MENU.tank_params(paramName))
     title += text_styles.middleTitle(param_formatter.MEASURE_UNITS.get(paramName, ''))
     desc = text_styles.main(_ms(TOOLTIPS.tank_params_desc(paramName)))
     if isRelativeParameter(paramName):
         blocks.append(formatters.packTitleDescBlock(title, desc))
     else:
         blocks.append(formatters.packImageTextBlockData(title, desc, img=param_formatter.getParameterBigIconPath(paramName), imgPadding=formatters.packPadding(top=10, left=1), txtPadding=formatters.packPadding(left=10)))
     return blocks
예제 #35
0
 def construct(self):
     block = []
     if self.vehicle.isElite:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_ELITE_VEHICLE_FAVORITE_BG_LINKAGE if self.vehicle.isFavorite else BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_ELITE_VEHICLE_BG_LINKAGE
     else:
         vehicleType = TOOLTIPS.tankcaruseltooltip_vehicletype_normal(self.vehicle.type)
         bgLinkage = BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_NORMAL_VEHICLE_FAVORITE_BG_LINKAGE if self.vehicle.isFavorite else BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_NORMAL_VEHICLE_BG_LINKAGE
     nameStr = text_styles.highTitle(self.vehicle.userName)
     typeStr = text_styles.main(vehicleType)
     levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(self.vehicle.level)), text_styles.standard(_ms(TOOLTIPS.VEHICLE_LEVEL)))
     icon = '../maps/icons/vehicleTypes/big/' + self.vehicle.type + ('_elite.png' if self.vehicle.isElite else '.png')
     imgOffset = 4
     textOffset = 82
     if self.vehicle.type == 'heavyTank':
         imgOffset = 11
         textOffset = 99
     iconBlock = formatters.packImageTextBlockData(title=nameStr, desc=text_styles.concatStylesToMultiLine(typeStr, levelStr), img=icon, imgPadding={'left': imgOffset,
      'top': -15}, txtGap=-2, txtOffset=textOffset, padding=formatters.packPadding(top=15, bottom=-15))
     block.append(formatters.packBuildUpBlockData([iconBlock], stretchBg=False, linkage=bgLinkage, padding=formatters.packPadding(left=-19 + self.leftPadding, top=-1)))
     return block
예제 #36
0
 def construct(self):
     module = self.module
     block = []
     title = module.userName
     imgPaddingLeft = 27
     desc = ''
     if module.itemTypeName in VEHICLE_COMPONENT_TYPE_NAMES:
         desc = text_styles.stats(_ms(TOOLTIPS.level(str(module.level)))) + ' ' + _ms(TOOLTIPS.VEHICLE_LEVEL)
         imgPaddingLeft = 22
     block.append(formatters.packImageTextBlockData(title=text_styles.highTitle(title), desc=text_styles.standard(desc), img=module.icon, imgPadding=formatters.packPadding(left=imgPaddingLeft), txtGap=-3, txtOffset=130 - self.leftPadding, padding=formatters.packPadding(top=-6, right=self.rightPadding)))
     if module.itemTypeID == GUI_ITEM_TYPE.GUN:
         vehicle = self.configuration.vehicle
         vDescr = vehicle.descriptor if vehicle is not None else None
         if module.isClipGun(vDescr):
             block.append(formatters.packImageTextBlockData(title=text_styles.standard(MENU.MODULEINFO_CLIPGUNLABEL), desc='', img=RES_ICONS.MAPS_ICONS_MODULES_MAGAZINEGUNICON, imgPadding=formatters.packPadding(top=3), padding=formatters.packPadding(left=108, top=9)))
     return block
예제 #37
0
def makeContactStatusDescription(isOnline, tags, clientInfo = None):
    name, description = ('', '')
    if isOnline:
        if clientInfo:
            gameHost = clientInfo.gameHost
            arenaLabel = clientInfo.arenaLabel
        else:
            gameHost, arenaLabel = ('', '')
        if gameHost:
            item = g_preDefinedHosts.byUrl(gameHost)
            name = item.shortName or item.name
        if USER_TAG.PRESENCE_DND in tags:
            key = None
            if arenaLabel:
                key = TOOLTIPS.contact_status_inbattle(arenaLabel)
            if not key:
                key = TOOLTIPS.CONTACT_STATUS_INBATTLE_UNKNOWN
            description = i18n.makeString(key)
        else:
            description = i18n.makeString(TOOLTIPS.CONTACT_STATUS_ONLINE)
        if name:
            description = '{0}, {1}'.format(description, name)
    return description
예제 #38
0
    def _populate(self):
        super(VehicleSellDialog, self)._populate()
        g_clientUpdateManager.addCallbacks({'stats.gold': self.onSetGoldHndlr})
        g_itemsCache.onSyncCompleted += self.__shopResyncHandler
        items = g_itemsCache.items
        vehicle = items.getVehicle(self.vehInvID)
        sellPrice = vehicle.sellPrice
        sellForGold = sellPrice.gold > 0
        priceTextColor = CURRENCIES_CONSTANTS.GOLD_COLOR if sellForGold else CURRENCIES_CONSTANTS.CREDITS_COLOR
        priceTextValue = _ms(DIALOGS.VEHICLESELLDIALOG_PRICE_SIGN_ADD) + _ms(BigWorld.wg_getIntegralFormat(sellPrice.gold if sellForGold else sellPrice.credits))
        currencyIcon = CURRENCIES_CONSTANTS.GOLD if sellForGold else CURRENCIES_CONSTANTS.CREDITS
        invVehs = items.getVehicles(REQ_CRITERIA.INVENTORY)
        if vehicle.isPremium or vehicle.level >= 3:
            self.as_visibleControlBlockS(True)
            self.__initCtrlQuestion()
        else:
            self.as_visibleControlBlockS(False)
        modules = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle]) | REQ_CRITERIA.INVENTORY).values()
        shells = items.getItems(criteria=REQ_CRITERIA.VEHICLE.SUITABLE([vehicle], [GUI_ITEM_TYPE.SHELL]) | REQ_CRITERIA.INVENTORY).values()
        otherVehsShells = set()
        for invVeh in invVehs.itervalues():
            if invVeh.invID != self.vehInvID:
                for shot in invVeh.descriptor.gun['shots']:
                    otherVehsShells.add(shot['shell']['compactDescr'])

        vehicleAction = None
        if sellPrice != vehicle.defaultSellPrice:
            vehicleAction = packItemActionTooltipData(vehicle, False)
        if vehicle.isElite:
            description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(vehicle.type)
        else:
            description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type)
        levelStr = text_styles.concatStylesWithSpace(text_styles.stats(int2roman(vehicle.level)), text_styles.main(_ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL)))
        restoreController = getRestoreController()
        tankmenGoingToBuffer, deletedTankmen = restoreController.getTankmenDeletedBySelling(vehicle)
        deletedCount = len(deletedTankmen)
        if deletedCount > 0:
            recoveryBufferFull = True
            deletedStr = formatDeletedTankmanStr(deletedTankmen[0])
            maxCount = restoreController.getMaxTankmenBufferLength()
            currCount = len(restoreController.getDismissedTankmen())
            if deletedCount == 1:
                crewTooltip = text_styles.concatStylesToMultiLine(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_BODY, maxVal=maxCount, curVal=currCount, sourceName=tankmenGoingToBuffer[-1].fullUserName, targetInfo=deletedStr)))
            else:
                crewTooltip = text_styles.concatStylesToMultiLine(text_styles.middleTitle(_ms(TOOLTIPS.VEHICLESELLDIALOG_CREW_ALERTICON_RECOVERY_HEADER)), text_styles.main(_ms(TOOLTIPS.DISMISSTANKMANDIALOG_BUFFERISFULLMULTIPLE_BODY, deletedStr=deletedStr, extraCount=deletedCount - 1, maxCount=maxCount, currCount=currCount)))
        else:
            crewTooltip = None
            recoveryBufferFull = False
        barracksDropDownData = [{'label': _ms(MENU.BARRACKS_BTNUNLOAD)}, {'label': _ms(MENU.BARRACKS_BTNDISSMISS)}]
        sellVehicleData = {'intCD': vehicle.intCD,
         'userName': vehicle.userName,
         'icon': vehicle.icon,
         'level': vehicle.level,
         'isElite': vehicle.isElite,
         'isPremium': vehicle.isPremium,
         'type': vehicle.type,
         'nationID': vehicle.nationID,
         'sellPrice': sellPrice,
         'priceTextValue': priceTextValue,
         'priceTextColor': priceTextColor,
         'currencyIcon': currencyIcon,
         'action': vehicleAction,
         'hasCrew': vehicle.hasCrew,
         'isRented': vehicle.isRented,
         'description': description,
         'levelStr': levelStr,
         'priceLabel': _ms(DIALOGS.VEHICLESELLDIALOG_VEHICLE_EMPTYSELLPRICE),
         'crewLabel': _ms(DIALOGS.VEHICLESELLDIALOG_CREW_LABEL),
         'crewTooltip': crewTooltip,
         'barracksDropDownData': barracksDropDownData,
         'crewRecoveryBufferFull': recoveryBufferFull}
        onVehicleOptionalDevices = []
        for o in vehicle.optDevices:
            if o is not None:
                action = None
                if o.sellPrice != o.defaultSellPrice:
                    action = packItemActionTooltipData(o, False)
                data = {'intCD': o.intCD,
                 'isRemovable': o.isRemovable,
                 'userName': o.userName,
                 'sellPrice': o.sellPrice,
                 'toInventory': True,
                 'action': action}
                onVehicleOptionalDevices.append(data)

        onVehicleoShells = []
        for shell in vehicle.shells:
            if shell is not None:
                action = None
                if shell.sellPrice != shell.defaultSellPrice:
                    action = packItemActionTooltipData(shell, False)
                data = {'intCD': shell.intCD,
                 'count': shell.count,
                 'sellPrice': shell.sellPrice,
                 'userName': shell.userName,
                 'kind': shell.type,
                 'toInventory': shell in otherVehsShells or shell.isPremium,
                 'action': action}
                onVehicleoShells.append(data)

        onVehicleEquipments = []
        for equipmnent in vehicle.eqs:
            if equipmnent is not None:
                action = None
                if equipmnent.sellPrice != equipmnent.defaultSellPrice:
                    action = packItemActionTooltipData(equipmnent, False)
                data = {'intCD': equipmnent.intCD,
                 'userName': equipmnent.userName,
                 'sellPrice': equipmnent.sellPrice,
                 'toInventory': True,
                 'action': action}
                onVehicleEquipments.append(data)

        inInventoryModules = []
        for m in modules:
            inInventoryModules.append({'intCD': m.intCD,
             'inventoryCount': m.inventoryCount,
             'toInventory': True,
             'sellPrice': m.sellPrice})

        inInventoryShells = []
        for s in shells:
            action = None
            if s.sellPrice != s.defaultSellPrice:
                action = packItemActionTooltipData(s, False)
            inInventoryShells.append({'intCD': s.intCD,
             'count': s.inventoryCount,
             'sellPrice': s.sellPrice,
             'userName': s.userName,
             'kind': s.type,
             'toInventory': s in otherVehsShells or s.isPremium,
             'action': action})

        removePrice = items.shop.paidRemovalCost
        removePrices = Money(gold=removePrice)
        defRemovePrice = Money(gold=items.shop.defaults.paidRemovalCost)
        removeAction = None
        if removePrices != defRemovePrice:
            removeAction = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'paidRemovalCost', True, removePrices, defRemovePrice)
        settings = self.getDialogSettings()
        isSlidingComponentOpened = settings['isOpened']
        self.as_setDataS({'accountGold': items.stats.gold,
         'sellVehicleVO': sellVehicleData,
         'optionalDevicesOnVehicle': onVehicleOptionalDevices,
         'shellsOnVehicle': onVehicleoShells,
         'equipmentsOnVehicle': onVehicleEquipments,
         'modulesInInventory': inInventoryModules,
         'shellsInInventory': inInventoryShells,
         'removeActionPrice': removeAction,
         'removePrice': removePrice,
         'isSlidingComponentOpened': isSlidingComponentOpened})
        return
예제 #39
0
def _getBattleQuestsTooltip(state, **ctx):
    return makeTooltip(TOOLTIPS.battleQuestsTooltipHeader(state), _ms(TOOLTIPS.battleQuestsTooltipBody(state), **ctx))
예제 #40
0
def _getPersonalQuestsTooltip(state, **ctx):
    return makeTooltip(_ms(TOOLTIPS.personalQuestsTooltipHeader(state), **ctx), _ms(TOOLTIPS.personalQuestsTooltipBody(state), **ctx))