def __packNationalFragmentBlocks(self):
     items = self._items
     self._setNationFlagCornerBg(self.__nationName)
     items.append(
         formatters.
         packImageTextBlockData(title=text_styles.highTitle(
             TOOLTIPS.BLUEPRINT_BLUEPRINTFRAGMENTTOOLTIP_NATIONALFRAGMENT),
                                img=RES_ICONS.getBlueprintFragment(
                                    'medium', self.__nationName),
                                imgPadding=formatters.packPadding(top=3),
                                txtPadding=formatters.packPadding(left=21)))
     self._items = [formatters.packBuildUpBlockData(blocks=items)]
     items = self._items
     nation = i18n.makeString(NATIONS.genetiveCase(self.__nationName))
     descriptionBlock = formatters.packImageTextBlockData(
         desc=text_styles.main(
             i18n.makeString(
                 TOOLTIPS.
                 BLUEPRINT_BLUEPRINTFRAGMENTTOOLTIP_NATIONALDESCRIPTION,
                 nation=nation)),
         img=RES_ICONS.MAPS_ICONS_BLUEPRINTS_PLUS,
         imgPadding=formatters.packPadding(top=0, right=5),
         padding=formatters.packPadding(left=40))
     items.append(
         formatters.packBuildUpBlockData(
             blocks=[descriptionBlock,
                     self.__packCompensationBlock()],
             gap=5,
             linkage=BLOCKS_TOOLTIP_TYPES.
             TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     fragmentsCount = self.context.getUniversalCount(self._fragmentCD)
     items.append(self.__packInStorageBlock(fragmentsCount))
Пример #2
0
    def _getConditionNationsList(self, nationIds):
        result = []
        for idx in nationIds:
            result.append({
                'icon':
                '../maps/icons/filters/nations/%s.png' % nations.NAMES[idx],
                'tooltip':
                i18n.makeString(
                    QUESTS.MISSIONDETAILS_VEHICLE_CONDITIONS_NATIONS_TOOLTIP,
                    nation=i18n.makeString(NATIONS.all(nations.NAMES[idx])))
            })

        return result
Пример #3
0
    def _packBlocks(self, chainID):
        personalMissions = dependency.instance(
            IEventsCache).getPersonalMissions()
        operation = first(
            personalMissions.getOperationsForBranch(
                PM_BRANCH.PERSONAL_MISSION_2).values())
        blocks = [
            formatters.packImageTextBlockData(
                title=text_styles.highTitle(operation.getChainName(chainID)),
                desc=text_styles.standard(
                    operation.getChainDescription(chainID)),
                img=RES_ICONS.getAlliance54x54Icon(chainID),
                imgPadding=formatters.packPadding(top=3, left=-5),
                txtOffset=78)
        ]
        nations = getNationsForChain(operation, chainID)
        nationBlocks = []
        separator = '   '
        for nation in GUI_NATIONS:
            if nation in nations:
                icon = icons.makeImageTag(getNationsFilterAssetPath(nation),
                                          26, 16, -4)
                nationName = text_styles.main(NATIONS.all(nation))
                nationBlocks.append(
                    formatters.packTextBlockData(
                        text_styles.concatStylesToSingleLine(
                            icon, separator, nationName)))

        blocks.append(
            formatters.packBuildUpBlockData(
                nationBlocks,
                linkage=BLOCKS_TOOLTIP_TYPES.
                TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                padding=formatters.packPadding(left=40)))
        allianceID = operation.getAllianceID(chainID)
        blocks.append(
            formatters.packBuildUpBlockData([
                formatters.packTextBlockData(
                    text_styles.middleTitle(
                        PERSONAL_MISSIONS.CHAINTOOLTIPDATA_DESCRIPTION_TITLE),
                    padding=formatters.packPadding(bottom=4)),
                formatters.packTextBlockData(
                    text_styles.main(
                        PERSONAL_MISSIONS.getAllianceChainTooltipDescr(
                            allianceID)),
                    padding=formatters.packPadding(bottom=7))
            ],
                                            padding=formatters.packPadding(
                                                top=-7, bottom=-3)))
        return blocks
Пример #4
0
def _makeNationBlock(header, setting):
    nationsBlock = [
        formatters.packTextBlockData(text=text_styles.middleTitle(header))
    ]
    nations_by_setting = NATIONS_BY_SETTING[setting]
    nations_by_setting = sorted(nations_by_setting,
                                key=lambda nation: GUI_NATIONS.index(nation))
    for nation in nations_by_setting:
        nationsBlock.append(
            formatters.packImageTextBlockData(
                img='../maps/icons/filters/nations/%s.png' % nation,
                title=text_styles.main(NATIONS.all(nation)),
                imgPadding=formatters.packPadding(top=5),
                txtPadding=formatters.packPadding(left=6, top=2),
                padding=formatters.packPadding(left=3, bottom=2)))

    return nationsBlock
 def __convertCrewSkinData(self, crewSkin, tankman):
     cache = tankmen.g_cache.crewSkins()
     LOC_MAP = {}
     if crewSkin.getRoleID() is not None:
         LOC_MAP[CREW_SKIN_PROPERTIES_MASKS.ROLE] = i18n.makeString(ITEM_TYPES.tankman_roles(crewSkin.getRoleID()))
     if crewSkin.getSex() in TANKMAN_SEX.ALL:
         LOC_MAP[CREW_SKIN_PROPERTIES_MASKS.SEX] = backport.text(R.strings.item_types.tankman.gender.dyn(GenderRestrictionsLocales.KEYS[crewSkin.getSex()])())
     if crewSkin.getNation() is not None:
         LOC_MAP[CREW_SKIN_PROPERTIES_MASKS.NATION] = i18n.makeString(NATIONS.all(crewSkin.getNation()))
     validation, validationMask, _ = cache.validateCrewSkin(tankman.descriptor, crewSkin.getID())
     soundValidation = crewSkin.getRoleID() == tankman.role if crewSkin.getRoleID() is not None else True
     if not SoundGroups.g_instance.soundModes.currentNationalPreset[1]:
         soundValidation = False
     restrictionsMessage = backport.text(R.strings.tooltips.crewSkins.restrictions())
     if not validation:
         restrictions = [ loc for key, loc in LOC_MAP.iteritems() if key & validationMask ]
         restrictionsMessage += ' ' + ', '.join(restrictions)
     soundSetID = crewSkin.getSoundSetID()
     soundSetRes = R.strings.crew_skins.feature.sound.dyn(soundSetID)() if soundSetID != NO_CREW_SKIN_SOUND_SET else R.strings.crew_skins.feature.sound.noSound()
     return {'id': crewSkin.getID(),
      'fullName': localizedFullName(crewSkin),
      'description': crewSkin.getDescription(),
      'iconID': getCrewSkinIconSmall(crewSkin.getIconID()),
      'roleIconID': getCrewSkinRolePath(crewSkin.getRoleID()),
      'nationFlagIconID': getCrewSkinNationPath(crewSkin.getNation()),
      'rarity': crewSkin.getRarity(),
      'maxCount': crewSkin.getMaxCount(),
      'freeCount': crewSkin.getFreeCount(),
      'historical': crewSkin.getHistorical(),
      'soundSetID': crewSkin.getSoundSetID(),
      'useCount': len(crewSkin.getTankmenIDs()),
      'isEquip': self.tmanInvID in crewSkin.getTankmenIDs(),
      'isNew': crewSkin.isNew() and not PersonalCase.crewSkinsHAConfig.checkForViewed(crewSkin.getID()),
      'isAvailable': validation,
      'notAvailableMessage': restrictionsMessage,
      'soundSetName': backport.text(soundSetRes),
      'soundSetIsAvailable': soundValidation if crewSkin.getSoundSetID() != NO_CREW_SKIN_SOUND_SET else True}
Пример #6
0
def getNationText(nation):
    return _ms(NATIONS.all(nation))