示例#1
0
 def _packMainBlock(self, serverName, timeLimits):
     blocksGap = 20
     blocksList = [formatters.packImageTextBlockData(title=text_styles.main(i18n.makeString(TOOLTIPS.FORTIFICATION_SORTIE_LISTROOM_REGULATION_SERVERLIMIT, server=text_styles.error(serverName))))]
     if timeLimits:
         blocksList.append(formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.FORTIFICATION_SORTIE_LISTROOM_REGULATION_SERVERLIMITTIMEDESCR)))
     mainBlock = [formatters.packBuildUpBlockData(blocksList, blocksGap)]
     return mainBlock
示例#2
0
 def _makePriceBlock(self, price, text, currencyType, neededValue = None, oldPrice = None, percent = 0):
     needFormatted = ''
     oldPriceText = ''
     hasAction = percent != 0
     if currencyType == ICON_TEXT_FRAMES.CREDITS:
         valueFormatted = text_styles.credits(_int(price))
         icon = icons.credits()
         if neededValue is not None:
             needFormatted = text_styles.credits(_int(neededValue))
         if hasAction:
             oldPriceText = text_styles.concatStylesToSingleLine(icons.credits(), text_styles.credits(_int(oldPrice)))
     elif currencyType == ICON_TEXT_FRAMES.GOLD:
         valueFormatted = text_styles.gold(_int(price))
         icon = icons.gold()
         if neededValue is not None:
             needFormatted = text_styles.gold(_int(neededValue))
         if hasAction:
             oldPriceText = text_styles.concatStylesToSingleLine(icons.gold(), text_styles.gold(_int(oldPrice)))
     elif currencyType == ICON_TEXT_FRAMES.XP:
         valueFormatted = text_styles.expText(_int(price))
         icon = icons.xp()
         if neededValue is not None:
             needFormatted = text_styles.expText(_int(neededValue))
     else:
         LOG_ERROR('Unsupported currency type "' + currencyType + '"!')
         return
     neededText = ''
     if neededValue is not None:
         neededText = text_styles.concatStylesToSingleLine(text_styles.main('( '), text_styles.error(TOOLTIPS.VEHICLE_GRAPH_BODY_NOTENOUGH), ' ', needFormatted, ' ', icon, text_styles.main(' )'))
     text = text_styles.concatStylesWithSpace(text_styles.main(text), neededText)
     if hasAction:
         actionText = text_styles.main(_ms(TOOLTIPS.VEHICLE_ACTION_PRC, actionPrc=text_styles.stats(str(percent) + '%'), oldPrice=oldPriceText))
         text = text_styles.concatStylesToMultiLine(text, actionText)
     return formatters.packTextParameterWithIconBlockData(name=text, value=valueFormatted, icon=currencyType, valueWidth=self._valueWidth, padding=formatters.packPadding(left=self.leftPadding, right=20))
示例#3
0
 def _makeLockBlock(self):
     clanLockTime = self.vehicle.clanLock
     if clanLockTime and clanLockTime <= time_utils.getCurrentTimestamp():
         LOG_DEBUG("clan lock time is less than current time: %s" % clanLockTime)
         clanLockTime = None
     isDisabledInRoaming = self.vehicle.isDisabledInRoaming
     if clanLockTime or isDisabledInRoaming:
         headerLock = text_styles.concatStylesToMultiLine(text_styles.warning(_ms(TOOLTIPS.TANKCARUSEL_LOCK_HEADER)))
         if isDisabledInRoaming:
             textLock = text_styles.main(_ms(TOOLTIPS.TANKCARUSEL_LOCK_ROAMING))
         else:
             time = time_utils.getDateTimeFormat(clanLockTime)
             timeStr = text_styles.main(text_styles.concatStylesWithSpace(_ms(TOOLTIPS.TANKCARUSEL_LOCK_TO), time))
             textLock = text_styles.concatStylesToMultiLine(
                 timeStr, text_styles.main(_ms(TOOLTIPS.TANKCARUSEL_LOCK_CLAN))
             )
         lockHeaderBlock = formatters.packTextBlockData(
             headerLock, padding=formatters.packPadding(left=77 + self.leftPadding, top=5)
         )
         lockTextBlock = formatters.packTextBlockData(
             textLock, padding=formatters.packPadding(left=77 + self.leftPadding)
         )
         return formatters.packBuildUpBlockData(
             [lockHeaderBlock, lockTextBlock],
             stretchBg=False,
             linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LOCK_BG_LINKAGE,
             padding=formatters.packPadding(left=-17, top=20, bottom=0),
         )
     else:
         return
         return
示例#4
0
 def construct(self):
     block = []
     paddingTop = 8
     block.append(formatters.packImageTextBlockData(title=text_styles.alert(TOOLTIPS.MODULEFITS_NOT_REMOVABLE_BODY), img=RES_ICONS.MAPS_ICONS_TOOLTIP_COMPLEX_EQUIPMENT, imgPadding=formatters.packPadding(left=2, top=3), txtOffset=20))
     block.append(formatters.packTextBlockData(text=text_styles.main(TOOLTIPS.MODULEFITS_NOT_REMOVABLE_NOTE), padding=formatters.packPadding(top=paddingTop)))
     block.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TOOLTIPS.MODULEFITS_NOT_REMOVABLE_DISMANTLING_PRICE), value=text_styles.gold(g_itemsCache.items.shop.paidRemovalCost), icon=ICON_TEXT_FRAMES.GOLD, valueWidth=60, padding=formatters.packPadding(left=43, top=paddingTop)))
     return block
示例#5
0
 def construct(self):
     block = []
     if self.configuration.crew:
         totalCrewSize = len(self.vehicle.descriptor.type.crewRoles)
         if self.configuration.externalCrewParam and self._roleLevel is not None:
             block.append(
                 formatters.packTextParameterBlockData(
                     name=text_styles.main(_ms(TOOLTIPS.VEHICLE_CREW_AWARD, self._roleLevel)),
                     value=text_styles.stats(str(totalCrewSize)),
                     valueWidth=self._valueWidth,
                     padding=formatters.packPadding(left=-2),
                 )
             )
         elif self.vehicle.isInInventory and not self.configuration.externalCrewParam:
             currentCrewSize = len([x for _, x in self.vehicle.crew if x is not None])
             currentCrewSizeStr = str(currentCrewSize)
             if currentCrewSize < totalCrewSize:
                 currentCrewSizeStr = text_styles.error(currentCrewSizeStr)
             block.append(self._makeStatBlock(currentCrewSizeStr, totalCrewSize, TOOLTIPS.VEHICLE_CREW))
         else:
             block.append(
                 formatters.packTextParameterBlockData(
                     name=text_styles.main(_ms(TOOLTIPS.VEHICLE_CREW)),
                     value=text_styles.stats(str(totalCrewSize)),
                     valueWidth=self._valueWidth,
                     padding=formatters.packPadding(left=-2),
                 )
             )
     lockBlock = self._makeLockBlock()
     if lockBlock is not None:
         block.append(lockBlock)
     return block
示例#6
0
 def __makeTimeOfBattle(self, item, battleItem, currentState):
     result = {}
     if currentState == FORTIFICATION_ALIASES.CLAN_BATTLE_IS_IN_BATTLE:
         icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_BATTLERESULTICON_1, 16, 16, -3, 0)
         formattedText = text_styles.error(i18n.makeString(I18N_FORTIFICATIONS.FORTCLANBATTLELIST_RENDERCURRENTTIME_ISBATTLE))
         result['text'] = icon + ' ' + formattedText
     elif currentState == FORTIFICATION_ALIASES.CLAN_BATTLE_BEGINS:
         battleID = item.getBattleID()
         timer = {}
         htmlFormatter = text_styles.alert('###')
         locale = text_styles.main(i18n.makeString(I18N_FORTIFICATIONS.FORTCLANBATTLELIST_RENDERCURRENTTIME_BEFOREBATTLE))
         result['text'] = locale
         if battleItem:
             startTimeLeft = battleItem.getRoundStartTimeLeft()
         else:
             startTimeLeft = item.getStartTimeLeft()
         timer['useUniqueIdentifier'] = True
         timer['uniqueIdentifier'] = battleID
         timer['deltaTime'] = startTimeLeft
         timer['htmlFormatter'] = htmlFormatter
         timer['timerDefaultValue'] = '00'
         result['timer'] = timer
     else:
         lastBattleTimeUserString = '%s - %s' % (BigWorld.wg_getShortTimeFormat(item.getStartTime()), BigWorld.wg_getShortTimeFormat(item.getFinishTime()))
         result['text'] = text_styles.main(lastBattleTimeUserString)
     return result
 def _populate(self):
     super(FalloutBattleSelectorWindow, self)._populate()
     self.addListener(
         events.HideWindowEvent.HIDE_BATTLE_SESSION_WINDOW,
         self.__handleFalloutWindowHide,
         scope=EVENT_BUS_SCOPE.LOBBY,
     )
     self.startGlobalListening()
     self.__falloutCtrl = getFalloutCtrl()
     self.__falloutCtrl.onSettingsChanged += self.__updateFalloutSettings
     self.as_setInitDataS(
         {
             "windowTitle": FALLOUT.BATTLESELECTORWINDOW_TITLE,
             "headerTitleStr": promoSubTitle(FALLOUT.BATTLESELECTORWINDOW_HEADERTITLESTR),
             "headerDescStr": main(FALLOUT.BATTLESELECTORWINDOW_HEADERDESC),
             "dominationBattleTitleStr": promoSubTitle(FALLOUT.BATTLESELECTORWINDOW_DOMINATION_TITLE),
             "dominationBattleDescStr": main(FALLOUT.BATTLESELECTORWINDOW_DOMINATION_DESCR),
             "dominationBattleBtnStr": FALLOUT.BATTLESELECTORWINDOW_DOMINATIONBATTLEBTNLBL,
             "multiteamTitleStr": promoSubTitle(FALLOUT.BATTLESELECTORWINDOW_MULTITEAM_TITLE),
             "multiteamDescStr": main(FALLOUT.BATTLESELECTORWINDOW_MULTITEAM_DESCR),
             "multiteamBattleBtnStr": FALLOUT.BATTLESELECTORWINDOW_MULTITEAMBATTLEBTNLBL,
             "bgImg": RES_ICONS.MAPS_ICONS_LOBBY_FALLOUTBATTLESELECTORBG,
         }
     )
     if self.prbDispatcher.getFunctionalState().hasLockedState:
         self.as_setBtnStatesS(
             {"dominationBtnEnabled": False, "multiteamBtnEnabled": False, "closeBtnEnabled": False}
         )
    def __updateTileData(self, vehType, questState, selectItemID = -1):
        self._navInfo.changePQFilters(vehType, questState)
        questsByChains = self.__getQuestsByChains(vehType, questState)
        chains = []
        newSelectedItemID = -1
        for _, chainID, quests in questsByChains:
            completedQuestsCount = len(self.__tile.getQuestsInChainByFilter(chainID, lambda q: q.isCompleted()))
            chain = {'name': text_styles.highTitle(self.__getChainUserName(chainID)),
             'progressText': text_styles.main('%d/%d' % (completedQuestsCount, self.__tile.getChainSize())),
             'tasks': [],
             'enabled': True}
            for quest in sorted(quests, key=operator.methodcaller('getID')):
                stateName, stateIcon = self.__getQuestStatusData(quest)
                questID = quest.getID()
                chain['tasks'].append({'name': text_styles.main(quest.getUserName()),
                 'stateName': stateName,
                 'stateIconPath': stateIcon,
                 'arrowIconPath': RES_ICONS.MAPS_ICONS_LIBRARY_ARROWORANGERIGHTICON8X8,
                 'tooltip': TOOLTIPS.PRIVATEQUESTS_TASKLISTITEM_BODY,
                 'id': questID,
                 'enabled': True})
                if questID == selectItemID:
                    newSelectedItemID = questID

            chains.append(chain)

        self.as_updateTileDataS({'statistics': {'label': text_styles.main(_ms(QUESTS.TILECHAINSVIEW_STATISTICSLABEL_TEXT)),
                        'arrowIconPath': RES_ICONS.MAPS_ICONS_LIBRARY_ARROWORANGERIGHTICON8X8,
                        'tooltip': TOOLTIPS.PRIVATEQUESTS_TASKLISTITEM_BODY},
         'chains': chains})
        if selectItemID == -1:
            self.getChainProgress()
        else:
            self.as_updateChainProgressS(self.__makeChainsProgressData())
        self.as_setSelectedTaskS(newSelectedItemID)
 def _populate(self):
     super(FortOrderInfoWindow, self)._populate()
     self.as_setWindowDataS(
         {
             "windowTitle": self.__order.userName,
             "panelTitle": text_styles.middleTitle("#fortifications:fortConsumableOrder/battleParams"),
             "orderDescrTitle": text_styles.middleTitle("#fortifications:fortConsumableOrder/titleDescr"),
             "btnLbl": _ms("#fortifications:Orders/orderPopover/closeButton"),
             "orderDescrBody": text_styles.main(self.__order.getOperationDescription()),
         }
     )
     fmtLvl = text_styles.main(
         _ms(
             "#fortifications:fortConsumableOrder/params/level_lbl",
             level=fort_formatters.getTextLevel(self.__order.level),
         )
     )
     self.as_setDynPropertiesS(
         {
             "orderIcon": self.__order.icon,
             "level": self.__order.level,
             "orderLevel": fmtLvl,
             "orderTitle": self.__order.userName,
             "orderParams": self.__makeParams(),
         }
     )
示例#10
0
 def _makePriceBlock(self, price, currencySetting, neededValue = None, oldPrice = None, percent = 0):
     needFormatted = ''
     oldPriceText = ''
     hasAction = percent != 0
     settings = getCurrencySetting(currencySetting)
     if settings is None:
         return
     else:
         valueFormatted = settings.textStyle(_int(price))
         icon = settings.icon
         if neededValue is not None:
             needFormatted = settings.textStyle(_int(neededValue))
         if hasAction:
             oldPriceText = text_styles.concatStylesToSingleLine(icon, settings.textStyle(_int(oldPrice)))
         neededText = ''
         if neededValue is not None:
             neededText = text_styles.concatStylesToSingleLine(text_styles.main('('), text_styles.error(TOOLTIPS.VEHICLE_GRAPH_BODY_NOTENOUGH), ' ', needFormatted, ' ', icon, text_styles.main(')'))
         text = text_styles.concatStylesWithSpace(text_styles.main(settings.text), neededText)
         if hasAction:
             actionText = text_styles.main(_ms(TOOLTIPS.VEHICLE_ACTION_PRC, actionPrc=text_styles.stats(str(percent) + '%'), oldPrice=oldPriceText))
             text = text_styles.concatStylesToMultiLine(text, actionText)
             if settings.frame == ICON_TEXT_FRAMES.GOLD:
                 newPrice = (0, price)
             else:
                 newPrice = (price, 0)
             return formatters.packSaleTextParameterBlockData(name=text, saleData={'newPrice': newPrice,
              'valuePadding': -8}, actionStyle='alignTop', padding=formatters.packPadding(left=92))
         return formatters.packTextParameterWithIconBlockData(name=text, value=valueFormatted, icon=settings.frame, valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5))
         return
 def __updateClubData(self):
     resultVO = _IntroViewVO()
     club = self.getClub()
     if self.clubsState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB and club:
         profile = self.clubsCtrl.getProfile()
         limits = self.clubsCtrl.getLimits()
         resultVO.setClubLabel(club.getUserName())
         resultVO.setClubDBbID(club.getClubDbID())
         resultVO.setClubLadderChevron(club)
         resultVO.showAdditionalButton(_ms(CYBERSPORT.WINDOW_INTRO_ADDITIONALBTN_LIST), TOOLTIPS.CYBERSPORT_INTRO_ADDITIONALBTN)
         resultVO.moveToTheUnitByCreateButton()
         resultVO.openClubProfileByChevronClick()
         if club.hasActiveUnit():
             unitInfo = club.getUnitInfo()
             resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_JOINTEAM), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_JOINTEAM)
             if unitInfo.isInBattle():
                 isInBattleIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_SWORDSICON, 16, 16, -3, 0)
                 resultVO.setClubDescription(text_styles.neutral('%s %s' % (isInBattleIcon, _ms(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_TEAMINBATTLE))))
             else:
                 resultVO.setClubDescription(text_styles.neutral(CYBERSPORT.STATICFORMATIONPROFILEWINDOW_STATUSLBL_CLUBISCALLED))
         else:
             canCreateUnit = limits.canCreateUnit(profile, club)
             if canCreateUnit.success:
                 resultVO.setClubDescription(text_styles.neutral(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_ASSEMBLINGTEAM))
                 resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ASSEMBLETEAM), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_ASSEMBLETEAM)
             elif canCreateUnit.reason == CLIENT_CLUB_RESTRICTIONS.NOT_ENOUGH_MEMBERS:
                 if club.getPermissions().isOwner():
                     resultVO.setClubDescription(text_styles.main(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_NOTENOUGHPLAYERS))
                     resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ADDPLAYERS), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_ADDPLAYERS)
                 else:
                     resultVO.setClubDescription(text_styles.error(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_OWNERASSEMBLINGTEAM), isBackVisible=True)
                     resultVO.showCreateButton(_ms('#cybersport:window/intro/create/btn/private/seeStaff'), '#tooltips:cyberSport/intro/createBtn/addPlayers/private')
                 resultVO.needAddPlayers()
             else:
                 resultVO.setClubDescription(text_styles.error(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_NOTENOUGHPERMISSIONS_ASSEMBLINGTEAM), isBackVisible=True)
                 resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ASSEMBLETEAM), '#tooltips:StaticFormationProfileWindow/actionBtn/notEnoughPermissions', enabled=False)
     elif self.clubsState.getStateID() == CLIENT_CLUB_STATE.NO_CLUB:
         resultVO.setNoClubChevron(isApplicationSent=False)
         resultVO.setClubLabel(_ms(CYBERSPORT.WINDOW_INTRO_TEAM_HEADER_STATICTEAMS))
         resultVO.setClubDescription(text_styles.main(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_CREATEORFIND))
         resultVO.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_LOOK), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_LOOK)
     elif self.clubsState.getStateID() == CLIENT_CLUB_STATE.SENT_APP:
         resultVO.setNoClubChevron(isApplicationSent=True)
         resultVO.openClubProfileByChevronClick()
         if club is not None:
             resultVO.setClubLabel(club.getUserName())
             resultVO.setClubLadderChevron(club)
         resultVO.setClubDescription(text_styles.neutral(CYBERSPORT.WINDOW_INTRO_TEAM_DESCRIPTION_WAITINGFORREQUEST))
         resultVO.showCancelButton(_ms(CYBERSPORT.WINDOW_INTRO_CANCEL_BTN_LABEL), TOOLTIPS.CYBERSPORT_INTRO_CANCELBTN)
         resultVO.showAdditionalButton(_ms(CYBERSPORT.WINDOW_INTRO_ADDITIONALBTN_LIST), TOOLTIPS.CYBERSPORT_INTRO_ADDITIONALBTN)
     else:
         resultVO.fillDefault()
         resultVO.acceptNavigationByChevron(False)
     isBattlesAvailable, _ = self.clubsCtrl.getAvailabilityCtrl().getStatus()
     if not isBattlesAvailable:
         resultVO.setClubDescriptionTooltip(TOOLTIPS_CONSTANTS.LADDER_REGULATIONS)
         resultVO.setClubDescription('{0}{1}'.format(icons.alert(), text_styles.main(CYBERSPORT.LADDERREGULATIONS_WARNING)), True)
     self.as_setStaticTeamDataS(resultVO.getData())
     return
 def _populate(self):
     super(ReferralReferralsIntroWindow, self)._populate()
     contentKey = 'referrals' if self.__isNewbie else 'phenix'
     referrerNameFmt = text_styles.warning(self.__referrerName)
     handIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_REFERRAL_REFERRALSMALLHAND, 16, 16, -4, 0)
     self.as_setDataS({'titleTF': text_styles.promoTitle(i18n.makeString(MENU.REFERRALREFERRALSINTROWINDOW_TEXT_BLOCK_TITLE, userName=getattr(BigWorld.player(), 'name', 'Unknown'))),
      'bodyTF': text_styles.main(i18n.makeString(MENU.referralreferralsintrowindow_text_block_body(contentKey), referrerName=referrerNameFmt, handIcon=handIcon)),
      'squadTF': text_styles.main(i18n.makeString(MENU.REFERRALREFERRALSINTROWINDOW_TEXT_BLOCK_SQUAD_TEXT))})
示例#13
0
 def __setStaticData(self):
     self.as_setStaticDataS({'windowTitle': _ms(MENU.BOOSTERSWINDOW_TITLE),
      'closeBtnLabel': _ms(MENU.BOOSTERSWINDOW_CLOSEBTN_LABEL),
      'noInfoBgSource': RES_ICONS.MAPS_ICONS_BOOSTERS_NOINFOBG,
      'filtersData': {'qualityFiltersLabel': text_styles.main(MENU.BOOSTERSWINDOW_LEVELFILTERS_LABEL),
                      'typeFiltersLabel': text_styles.main(MENU.BOOSTERSWINDOW_TYPEFILTERS_LABEL),
                      'qualityFilters': self.__packFiltersData(self.__packQualityFiltersItems()),
                      'typeFilters': self.__packFiltersData(self.__packTypeFiltersItems())}})
 def __prepareIndicatorData(self, isCanModernization, increment = False, resLeft = 0):
     if increment:
         hpTotalVal = self.nextLevel.levelRef.hp
         hpVal = self.nextLevel.hp
         defResVal = self.__defResVal - self.__cost + resLeft
         maxDefResVal = self.nextLevel.levelRef.storage
     else:
         hpTotalVal = self.__hpTotalVal
         hpVal = self.__hpVal
         defResVal = self.__defResVal
         maxDefResVal = self.__maxDerResVal
     formatter = text_styles.defRes
     if self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION_DEF or self.__progress == FORTIFICATION_ALIASES.STATE_FOUNDATION:
         formatter = text_styles.alert
     if not isCanModernization and increment:
         currentHpLabel = text_styles.main('--')
         currentHpValue = 0
     else:
         currentHpLabel = str(BigWorld.wg_getIntegralFormat(hpVal))
         currentHpValue = hpVal
     FORMAT_PATTERN = '###'
     formattedHpValue = formatter(FORMAT_PATTERN)
     formatter = text_styles.standard
     if increment:
         formatter = text_styles.neutral
     formattedHpTotal = formatter(str(BigWorld.wg_getIntegralFormat(hpTotalVal)))
     formattedHpTotal += ' ' + icons.nut()
     if not isCanModernization and increment:
         currentDefResLabel = text_styles.main('--')
         currentDefResValue = 0
     else:
         currentDefResLabel = str(BigWorld.wg_getIntegralFormat(defResVal))
         currentDefResValue = defResVal
     defResValueFormatter = text_styles.alert(FORMAT_PATTERN) if defResVal > maxDefResVal else text_styles.defRes(FORMAT_PATTERN)
     formattedDefResTotal = formatter(str(BigWorld.wg_getIntegralFormat(maxDefResVal)))
     formattedDefResTotal += ' ' + icons.nut()
     result = {}
     result['hpLabel'] = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL)
     result['defResLabel'] = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL)
     result['hpCurrentValue'] = currentHpValue
     result['hpTotalValue'] = hpTotalVal
     result['defResCurrentValue'] = currentDefResValue
     result['defResTotalValue'] = maxDefResVal
     result['defResTotalValue'] = maxDefResVal
     result['defResCompensationValue'] = max(0, defResVal - maxDefResVal)
     hpProgressLabels = {}
     hpProgressLabels['currentValue'] = currentHpLabel
     hpProgressLabels['currentValueFormatter'] = formattedHpValue
     hpProgressLabels['totalValue'] = formattedHpTotal
     hpProgressLabels['separator'] = '/'
     storeProgressLabels = {}
     storeProgressLabels['currentValue'] = currentDefResLabel
     storeProgressLabels['currentValueFormatter'] = defResValueFormatter
     storeProgressLabels['totalValue'] = formattedDefResTotal
     storeProgressLabels['separator'] = '/'
     result['hpProgressLabels'] = hpProgressLabels
     result['defResProgressLabels'] = storeProgressLabels
     return result
示例#15
0
 def _packHiddenBlock(self):
     subBlocks = []
     if self._hideRented:
         subBlocks.append(formatters.packTextParameterWithIconBlockData(name=text_styles.main(TANK_CAROUSEL_FILTER.INFOTIP_RENT), value='', icon=ICON_TEXT_FRAMES.RENTALS, padding=formatters.packPadding(left=-50, top=-3, bottom=-18), nameOffset=20))
     if self._hideEvent:
         icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_BATTLETYPES_40X40_EVENT, width=22, height=22, vSpace=-8)
         text = text_styles.main(TANK_CAROUSEL_FILTER.INFOTIP_EVENT)
         subBlocks.append(formatters.packTextBlockData(text='{}      {}'.format(icon, text), padding=formatters.packPadding(left=6, top=5, bottom=0)))
     return formatters.packBuildUpBlockData(subBlocks, linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE)
示例#16
0
 def _packBlocks(self, *args, **kwargs):
     items = super(ResearchModulesPackerEx, self)._packBlocks(*args, **kwargs)
     blocksGap = 3
     imgPdg = {'top': 3}
     txtOffset = 75
     items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_ACTIONBUTTONSTITLE)),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_RESEARCHBUTTONDESCRIPTION), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_RESEARCHBUTTON, imgPadding=imgPdg, txtOffset=txtOffset),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_BUYBUTTONDESCRIPTION), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_BUYBUTTON, imgPadding=imgPdg, txtOffset=txtOffset),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_INHANGARDESCRIPTION), img=RES_ICONS.MAPS_ICONS_LIBRARY_COMPLETEDINDICATOR, imgPadding={'top': -3}, txtOffset=txtOffset)], blocksGap))
     return items
示例#17
0
 def _packBlocks(self, *args, **kwargs):
     items = super(ResearchTreePacker, self)._packBlocks(*args, **kwargs)
     imgPdg = {'left': 12,
      'top': 30}
     txtGap = 2
     blocksGap = 12
     items.append(formatters.packBuildUpBlockData([formatters.packImageTextBlockData(title=text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TECHBLOCK_COMMONTECH_TITLE), desc=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TECHBLOCK_COMMONTECH_DESCRIPTION), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_COMMONTANK, imgPadding=imgPdg, txtGap=txtGap, imgAtLeft=False), formatters.packImageTextBlockData(title=text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TECHBLOCK_PREMIUMTECH_TITLE), desc=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TECHBLOCK_PREMIUMTECH_DESCRIPTION), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_PREMTANK, imgPadding=imgPdg, txtGap=txtGap, imgAtLeft=False)], blocksGap, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     imgPdg = {'left': 12,
      'top': 3}
     txtOffset = 34
     txtGap = 0
     blocksGap = 2
     items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_TITLE)),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_LIGHTTANK), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_LIGHTTANK, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_MEDIUMTANK), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_MEDIUMTANK, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_HEAVYTANK), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_HEAVYTANK, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_AT_SPG), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_AT_SPG, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_TYPESBLOCK_SPG), img=RES_ICONS.MAPS_ICONS_VEHICLETYPES_SPG, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset)], blocksGap))
     imgPdg = {'left': 3,
      'top': 2}
     txtOffset = 82
     txtGap = 0
     blocksGap = 8
     items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_BUTTONSBLOCK_TITLE)),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_BUTTONSBLOCK_RESEARCH), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_RESEARCHBUTTON, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_BUTTONSBLOCK_BUY), img=RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_BUYBUTTON, imgPadding=imgPdg, txtGap=txtGap, txtOffset=txtOffset),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_BUTTONSBLOCK_INHANGAR), img=RES_ICONS.MAPS_ICONS_LIBRARY_COMPLETEDINDICATOR, imgPadding={'left': 3,
       'top': -3}, txtGap=txtGap, txtOffset=txtOffset),
      formatters.packImageTextBlockData(title=text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCHTREE_BUTTONSBLOCK_ADDTOCOMPARE), img=RES_ICONS.MAPS_ICONS_LIBRARY_ADD_TO_COMPARE, imgPadding={'left': 11,
       'top': -22}, txtGap=txtGap, txtOffset=txtOffset, txtPadding={'top': -10})], blocksGap))
     return items
示例#18
0
 def getVO(self, club = None, currentState = None, profile = None):
     if club is None or currentState is None or profile is None:
         return
     else:
         _ms = i18n.makeString
         ladderInfo = club.getLadderInfo()
         if ladderInfo.isInLadder():
             ladderLeagueStr = getLeagueString(ladderInfo.getLeague())
             ladderDivStr = getDivisionString(ladderInfo.getDivision())
             ladderInfoStr = text_styles.middleTitle(_ms(CYBERSPORT.WINDOW_STATICRALLYINFO_LADDERINFO, league=ladderLeagueStr, division=ladderDivStr))
         else:
             ladderInfoStr = ''
         dossier = club.getTotalDossier()
         clubTotalStats = dossier.getTotalStats()
         isButtonDisabled = False
         buttonLabel = '#cyberSport:window/staticRallyInfo/joinBtnLabel'
         buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/join'
         buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/join'
         limits = currentState.getLimits()
         canSendApp, appReason = limits.canSendApplication(profile, club)
         if currentState.getStateID() == CLIENT_CLUB_STATE.SENT_APP:
             if currentState.getClubDbID() == club.getClubDbID():
                 buttonLabel = '#cyberSport:window/staticRallyInfo/cancelBtnLabel'
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcess'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcess'
             else:
                 isButtonDisabled = True
                 buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/inProcessOther'
                 buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/inProcessOther'
         elif currentState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/alreadyJoined'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/alreadyJoined'
         elif not canSendApp:
             isButtonDisabled = True
             buttonTooltip = '#tooltips:cyberSport/staticRallyInfo/joinBtn/applicationCooldown'
             buttonInfo = '#cyberSport:window/staticRallyInfo/joinInfo/applicationCooldown'
         return {'battlesCount': self.__getIndicatorData(clubTotalStats.getBattlesCount(), BigWorld.wg_getIntegralFormat, _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_STATSBATTLESCOUNT), RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_BATTLES40X32, TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSBATTLESCOUNT),
          'winsPercent': self.__getIndicatorData(clubTotalStats.getWinsEfficiency(), ProfileUtils.formatFloatPercent, _ms(CYBERSPORT.WINDOW_STATICRALLYINFO_STATICRALLY_STATSWINSPERCENT), RES_ICONS.MAPS_ICONS_LIBRARY_DOSSIER_WINS40X32, TOOLTIPS.CYBERSPORT_STATICRALLYINFO_STATSWINSPERCENT),
          'ladderIcon': getLadderChevron128x128(ladderInfo.getDivision()),
          'ladderInfo': ladderInfoStr,
          'joinInfo': text_styles.main(_ms(buttonInfo)),
          'joinBtnLabel': _ms(buttonLabel),
          'joinBtnTooltip': buttonTooltip,
          'joinBtnDisabled': isButtonDisabled,
          'noAwardsText': CYBERSPORT.WINDOW_STATICRALLYINFO_NOAWARDS,
          'achievements': AchievementsUtils.packAchievementList(clubTotalStats.getTopAchievements(3), dossier.getDossierType(), dumpDossier(dossier), False, False),
          'rallyInfo': {'icon': None,
                        'name': text_styles.highTitle(club.getUserName()),
                        'profileBtnLabel': CYBERSPORT.RALLYINFO_PROFILEBTN_LABEL,
                        'profileBtnTooltip': TOOLTIPS.RALLYINFO_PROFILEBTN,
                        'description': text_styles.main(html.escape(club.getUserShortDescription())),
                        'ladderIcon': None,
                        'id': club.getClubDbID(),
                        'showLadder': False}}
示例#19
0
    def __showDismissedTankmen(self, criteria):
        tankmen = getRestoreController().getDismissedTankmen()
        tankmenList = list()
        for tankman in tankmen:
            if not criteria(tankman):
                continue
            skillsList = []
            for skill in tankman.skills:
                skillsList.append({'tankmanID': tankman.invID,
                 'id': str(tankman.skills.index(skill)),
                 'name': skill.userName,
                 'desc': skill.description,
                 'icon': skill.icon,
                 'level': skill.level,
                 'active': skill.isEnable and skill.isActive})

            newSkillsCount, lastNewSkillLvl = tankman.newSkillCount
            if newSkillsCount > 0:
                skillsList.append({'buy': True,
                 'buyCount': newSkillsCount - 1,
                 'tankmanID': tankman.invID,
                 'level': lastNewSkillLvl})
            restoreInfo = getTankmenRestoreInfo(tankman)
            actionBtnTooltip = makeTooltip(TOOLTIPS.BARRACKS_TANKMEN_RECOVERYBTN_HEADER, getRecoveryStatusText(restoreInfo))
            tankmanData = _packTankmanData(tankman)
            tankmanData.update({'isRankNameVisible': False,
             'recoveryPeriodText': _makeRecoveryPeriodText(restoreInfo),
             'actionBtnLabel': MENU.BARRACKS_BTNRECOVERY,
             'actionBtnTooltip': actionBtnTooltip,
             'skills': skillsList,
             'isSkillsVisible': True})
            tankmenList.append(tankmanData)

        tankmenCountStr = _ms(MENU.BARRACKS_DISMISSEDTANKMENCOUNT, curValue=len(tankmenList), total=len(tankmen))
        placeCount = getRestoreController().getMaxTankmenBufferLength()
        placeCountStr = _ms(MENU.BARRACKS_RECOVERYCOUNT, total=placeCount, info=icons.info())
        noInfoData = None
        hasNoInfoData = len(tankmenList) == 0
        if hasNoInfoData:
            if len(tankmen) == 0:
                tankmenRestoreConfig = g_itemsCache.items.shop.tankmenRestoreConfig
                freeDays = tankmenRestoreConfig.freeDuration / time_utils.ONE_DAY
                creditsDays = tankmenRestoreConfig.creditsDuration / time_utils.ONE_DAY - freeDays
                noInfoData = {'title': text_styles.highTitle(MENU.BARRACKS_NORECOVERYTANKMEN_TITLE),
                 'message': text_styles.main(_ms(MENU.BARRACKS_NORECOVERYTANKMEN_MESSAGE, price=moneyWithIcon(tankmenRestoreConfig.cost), totalDays=freeDays + creditsDays, freeDays=freeDays, paidDays=creditsDays))}
            else:
                noInfoData = {'message': text_styles.main(MENU.BARRACKS_NOFILTEREDRECOVERYTANKMEN_MESSAGE)}
        placesCountTooltip = makeTooltip(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_HEADER, _ms(TOOLTIPS.BARRACKS_PLACESCOUNT_DISMISS_BODY, placeCount=placeCount))
        self.as_setTankmenS({'tankmenCount': text_styles.playerOnline(tankmenCountStr),
         'placesCount': text_styles.playerOnline(placeCountStr),
         'placesCountTooltip': placesCountTooltip,
         'tankmenData': tankmenList,
         'hasNoInfoData': hasNoInfoData,
         'noInfoData': noInfoData})
        return
示例#20
0
 def __getMultiselectionStatus(self):
     if self.__multiselectionMode:
         falloutCfg = self.__falloutCtrl.getConfig()
         messageTemplate = '#fallout:multiselectionSlot/%d' % self.__falloutCtrl.getBattleType()
         if not falloutCfg.hasRequiredVehicles():
             return (False, i18n.makeString(messageTemplate + '/topTierVehicleRequired', level=int2roman(falloutCfg.vehicleLevelRequired)))
         if self.__falloutCtrl.getSelectedVehicles():
             return (True, main(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) + '\n' + standard(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS, level=toRomanRangeString(list(falloutCfg.allowedLevels), 1))))
         if falloutCfg.getAllowedVehicles():
             return (False, main(i18n.makeString(messageTemplate + '/descriptionTitle')) + '\n' + standard(i18n.makeString(messageTemplate + '/message', level=toRomanRangeString(list(falloutCfg.allowedLevels), 1))))
     return (False, '')
 def _makeVO(self, province):
     result = {'front': '%s %s' % (self.__getFront(province), text_styles.standard(formatField(province.getFrontLevel, formatter=fort_formatters.getTextLevel))),
      'province': self.__getProvinceName(province),
      'map': self.__getMap(province),
      'primeTime': text_styles.main(province.getUserPrimeTime()),
      'days': text_styles.main(BigWorld.wg_getIntegralFormat(self.__getDays(province)))}
     if self.__showTreasuryData:
         result.update({'income': text_styles.gold(BigWorld.wg_getIntegralFormat(self.__getIncome(province))),
          'noIncomeIconVisible': not province.isHqConnected(),
          'noIncomeTooltip': CLANS.GLOBALMAPVIEW_NOINCOME_TOOLTIP})
     return result
示例#22
0
 def __updateTimer(self):
     self.__timerCallback = None
     self.__timerCallback = BigWorld.callback(1, self.__updateTimer)
     textLabel = makeString('#menu:prebattle/timerLabel')
     timeLabel = '%d:%02d' % divmod(self.__createTime, 60)
     result = text_styles.concatStylesWithSpace(text_styles.main(textLabel), timeLabel)
     if self.__provider.needAdditionalInfo():
         result = text_styles.concatStylesToSingleLine(result, text_styles.main('*'))
     self.as_setTimerS(result)
     self.__createTime += 1
     return
示例#23
0
 def getBuildingTooltipBody(self, hpVal, maxHpValue, defResVal, maxDefResValue):
     nutIcon = ' ' + icons.nut()
     labelOne = text_styles.main(i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_STRENGTH))
     labelTwo = text_styles.main(i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_STORE))
     fstLine = labelOne + text_styles.neutral(self.__toFormattedStr(hpVal)) + ' / ' + text_styles.standard(self.__toFormattedStr(maxHpValue)) + nutIcon
     secLine = labelTwo + text_styles.neutral(self.__toFormattedStr(defResVal)) + ' / ' + text_styles.standard(self.__toFormattedStr(maxDefResValue)) + nutIcon
     toolTipData = fstLine + secLine
     defResCompensationValue = defResVal - maxDefResValue
     if defResCompensationValue > 0:
         toolTipData += text_styles.standard(i18n.makeString(FORTIFICATIONS.BUILDINGS_BUILDINGTOOLTIP_COMPENSATION)) + text_styles.neutral(self.__toFormattedStr(defResCompensationValue)) + nutIcon
     return toolTipData
 def _getOrderDescription(self, order):
     if order.isSpecialMission:
         if order.inCooldown:
             award = i18n.makeString(FORTIFICATIONS.ORDERS_SPECIALMISSION_AWARD) + ' '
             serverData = self.__getFortQuestBonusesStr()
             serverData += '\n' + i18n.makeString(FORTIFICATIONS.ORDERS_ORDERPOPOVER_SPECIALMISSION_SHORTDESCR)
             return ''.join((text_styles.neutral(award), text_styles.main(serverData)))
         else:
             return text_styles.main(i18n.makeString(FORTIFICATIONS.ORDERS_ORDERPOPOVER_SPECIALMISSION_DESCRIPTION))
     else:
         return order.description
示例#25
0
def getDialogRemoveElement(itemName, cType):
    deleteStr = text_styles.error(CUSTOMIZATION.DIALOG_REMOVE_ELEMENT_DELETE)
    description = text_styles.main(
        _ms(
            CUSTOMIZATION.DIALOG_REMOVE_ELEMENT_DESCRIPTION,
            elementName="{0} {1}".format(__formatTypeName(cType, 1), text_styles.main(itemName)),
            delete=deleteStr,
        )
    )
    return I18nConfirmDialogMeta(
        "customization/remove_element", messageCtx={"description": description}, focusedID=DIALOG_BUTTON_ID.CLOSE
    )
示例#26
0
 def _populate(self):
     super(FortOrderInfoWindow, self)._populate()
     self.as_setWindowDataS({'windowTitle': self.__order.userName,
      'panelTitle': text_styles.middleTitle('#fortifications:fortConsumableOrder/battleParams'),
      'orderDescrTitle': text_styles.middleTitle('#fortifications:fortConsumableOrder/titleDescr'),
      'btnLbl': _ms('#fortifications:Orders/orderPopover/closeButton'),
      'orderDescrBody': text_styles.main(self.__order.getOperationDescription())})
     fmtLvl = text_styles.main(_ms('#fortifications:fortConsumableOrder/params/level_lbl', level=fort_formatters.getTextLevel(self.__order.level)))
     self.as_setDynPropertiesS({'orderIcon': self.__order.icon,
      'level': self.__order.level,
      'orderLevel': fmtLvl,
      'orderTitle': self.__order.userName,
      'orderParams': self.__makeParams()})
示例#27
0
 def _packBlocks(self, *args, **kwargs):
     items = super(ResearchModulesPacker, self)._packBlocks(*args, **kwargs)
     blocksGap = 5
     imgPdg = {'left': 15,
      'right': 20}
     txtGap = -4
     items.append(formatters.packBuildUpBlockData([formatters.packTextBlockData(text_styles.middleTitle(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_TYPESTITLE)),
      formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_GUNTITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_GUNDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_GUN, imgPdg, txtGap=txtGap),
      formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_TURRETTITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_TURRETDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_TOWER, imgPdg, txtGap=txtGap),
      formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_ENGINETITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_ENGINEDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_ENGINE, imgPdg, txtGap=txtGap),
      formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_CHASSISTITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_CHASSISDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_CHASSIS, imgPdg, txtGap=txtGap),
      formatters.packImageTextBlockData(text_styles.main(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_RADIOSETTITLE), text_styles.standard(TOOLTIPS.HANGARTUTORIAL_RESEARCH_MODULES_RADIOSETDESCRIPTION), RES_ICONS.MAPS_ICONS_HANGARTUTORIAL_MODULES_RADIO, imgPdg, txtGap=txtGap)], blocksGap, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
     return items
示例#28
0
 def _makeVO(self, item):
     vo = {'players': text_styles.main(str(item.getMembersCount())),
      'creationDate': text_styles.main(formatField(getter=item.getCreationDate, formatter=BigWorld.wg_getShortDateFormat)),
      'rating': text_styles.stats(formatField(getter=item.getPersonalRating, formatter=BigWorld.wg_getIntegralFormat)),
      'arrowIcon': RES_ICONS.MAPS_ICONS_LIBRARY_ARROWORANGERIGHTICON8X8,
      'clanInfo': {'dbID': item.getClanDbID(),
                   'clanAbbrev': formatField(getter=item.getClanAbbrev),
                   'clanName': formatField(getter=item.getClanName),
                   'fullName': formatField(getter=item.getClanFullName),
                   'isActive': item.isClanActive(),
                   'showIcon': True,
                   'iconSource': None}}
     return vo
示例#29
0
 def _populate(self):
     super(CyberSportIntroView, self)._populate()
     self.addListener(CSVehicleSelectEvent.VEHICLE_SELECTED, self.__updateSelectedVehicles)
     self.as_setTextsS({'titleLblText': text_styles.promoTitle(CYBERSPORT.WINDOW_INTRO_TITLE),
      'descrLblText': text_styles.main(CYBERSPORT.WINDOW_INTRO_DESCRIPTION),
      'listRoomTitleLblText': text_styles.promoSubTitle(CYBERSPORT.WINDOW_INTRO_SEARCH_TITLE),
      'listRoomDescrLblText': text_styles.main(CYBERSPORT.WINDOW_INTRO_SEARCH_DESCRIPTION),
      'listRoomBtnLabel': _ms(CYBERSPORT.WINDOW_INTRO_SEARCH_BTN),
      'autoTitleLblText': text_styles.middleTitle(CYBERSPORT.WINDOW_INTRO_AUTO_TITLE),
      'autoDescrLblText': text_styles.main(CYBERSPORT.WINDOW_INTRO_AUTO_DESCRIPTION),
      'vehicleBtnTitleTfText': text_styles.standard(CYBERSPORT.BUTTON_CHOOSEVEHICLES_SELECTED)})
     self.__updateClubData()
     self.__updateAutoSearchVehicle(self.__getSelectedVehicles())
     self.startMyClubListening()
示例#30
0
 def __updateData(self, club):
     seasonFilters = []
     seasonFilters.extend(map(attrgetter('name'), self._seasons))
     achievements = _makeAchievements(club.getTotalDossier(), club)
     self.as_setDataS({'awardsText': text_styles.highTitle(CYBERSPORT.STATICFORMATIONSTATSVIEW_AWARDS),
      'noAwardsText': text_styles.main(CYBERSPORT.STATICFORMATIONSTATSVIEW_NOAWARDS),
      'achievements': achievements,
      'statsGroupWidth': _STATS_GROUP_WIDTH,
      'seasonFilterName': text_styles.main(CYBERSPORT.STATICFORMATIONSTATSVIEW_SEASONFILTER),
      'selectedSeason': 0,
      'seasonFilters': seasonFilters,
      'seasonFilterEnable': len(seasonFilters) > 1,
      'noAwards': len(achievements) < 1})
     self.__setStats(first(self._seasons).dossier.getTotalStats())
 def __getHeaderBlock(self, item, name, level, count, isPlayerLegionary):
     reserveIcon = R.images.gui.maps.icons.reserveTypes.dyn(
         self.__getReserveIconName(name, level))()
     countStr = text_styles.main(
         backport.text(
             R.strings.fortifications.reserves.tooltip.inStorage(),
             count=text_styles.expText(
                 count))) if not isPlayerLegionary else ''
     return formatters.packImageTextBlockData(
         title=text_styles.highTitle(item.shortUserName),
         desc='\n'.join([
             text_styles.neutral(
                 backport.text(
                     R.strings.fortifications.reserves.tooltip.level(),
                     level=int2roman(level))), countStr
         ]),
         img=backport.image(reserveIcon),
         imgPadding=formatters.packPadding(left=5, right=10),
         imgAtLeft=True,
         txtAlign='left',
         linkage=BLOCKS_TOOLTIP_TYPES.TOOLTIP_IMAGETEXT_BLOCK_LINKAGE,
         padding=formatters.packPadding(top=6),
         blockWidth=500)
示例#32
0
 def __packSpecialTypeBlock(self):
     string = ''
     addComma = lambda str: ('{0}, '.format(str) if str else str)
     if self._specials['premium']:
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_PREMIUM)
     if self._specials['elite']:
         string = addComma(string)
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_ELITE)
     if self._specials['favorite']:
         string = addComma(string)
         string += _ms(TANK_CAROUSEL_FILTER.INFOTIP_ONLY_FAVORITE)
     if self._specials['bonus']:
         icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_MULTYXP)
         xpRate = text_styles.stats('x{0}'.format(
             g_itemsCache.items.shop.dailyXPFactor))
         string = addComma(string)
         string += '{0}{1}'.format(icon, xpRate)
     if self._specials['igr']:
         string = addComma(string)
         string += icons.premiumIgrSmall()
     return formatters.packTextBlockData(text=text_styles.main(string),
                                         padding=formatters.packPadding(
                                             top=-5, bottom=5, left=15))
示例#33
0
 def _showDummyByFilterName(self, filterName):
     inviteText = _ms(CLANS.CLANINVITESWINDOW_DUMMY_NOINVITES_TEXT,
                      invite=text_styles.main(
                          CLANS.CLANINVITESWINDOW_DUMMY_NOINVITES_INVITE))
     if filterName == CLANS_ALIASES.INVITE_WINDOW_FILTER_ALL:
         self._showDummy(CLANS.CLANINVITESWINDOW_DUMMY_NOINVITES_TITLE,
                         inviteText)
     if filterName == CLANS_ALIASES.INVITE_WINDOW_FILTER_ACTUAL:
         self._showDummy(
             CLANS.CLANINVITESWINDOW_DUMMY_NOINVITESACTUAL_TITLE,
             inviteText)
     elif filterName == CLANS_ALIASES.INVITE_WINDOW_FILTER_EXPIRED:
         self._showDummy(
             CLANS.CLANINVITESWINDOW_DUMMY_NOINVITESEXPIRED_TITLE,
             inviteText)
     elif filterName == CLANS_ALIASES.INVITE_WINDOW_FILTER_PROCESSED:
         self._showDummy(
             CLANS.CLANINVITESWINDOW_DUMMY_NOINVITESPROCESSED_TITLE,
             inviteText)
     else:
         LOG_DEBUG('Unexpected behaviour: no dummy for filter', filterName)
         self._showDummy(CLANS.CLANINVITESWINDOW_DUMMY_NOINVITES_TITLE,
                         inviteText)
示例#34
0
 def _setDummyData(self,
                   header,
                   body,
                   icon=None,
                   btnVisible=False,
                   btnLabel='',
                   btnTooltip=''):
     self.as_setDummyS({
         'iconSource':
         icon,
         'htmlText':
         str().join(
             (text_styles.middleTitle(header),
              clans_fmts.getHtmlLineDivider(3), text_styles.main(body))),
         'alignCenter':
         False,
         'btnVisible':
         btnVisible,
         'btnLabel':
         btnLabel,
         'btnTooltip':
         btnTooltip
     })
示例#35
0
 def _packBlocks(self, *args):
     items = []
     progressionData = self.__mapboxCtrl.getProgressionData()
     if progressionData is not None and self.__mapboxCtrl.isActive(
     ) and self.__mapboxCtrl.isInPrimeTime():
         items.append(self.__packHeaderBlock())
         items.append(
             formatters.packTextBlockData(text_styles.main(
                 backport.text(R.strings.mapbox.questFlag.description(),
                               highlightedText=text_styles.stats(
                                   backport.text(R.strings.mapbox.questFlag.
                                                 highlightedText())))),
                                          padding=formatters.packPadding(
                                              left=18, right=10)))
         items.append(
             formatters.packBuildUpBlockData(
                 self.__packTotalProgressionBlock(progressionData),
                 linkage=BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE))
         items.append(self.__packMapsProgressionBlock(progressionData))
     else:
         items.append(self.__packFrozenBlock())
     return items
示例#36
0
 def _packBlocks(self, *args, **kwargs):
     items = super(RankedUnavailableTooltip,
                   self)._packBlocks(*args, **kwargs)
     tooltipData = R.strings.tooltips.battleTypes.ranked
     header = backport.text(tooltipData.header())
     body = backport.text(tooltipData.body())
     nextSeason = self.rankedController.getNextSeason()
     if self.rankedController.isFrozen(
     ) and self.rankedController.getCurrentSeason() is not None:
         additionalInfo = backport.text(tooltipData.body.frozen())
     elif nextSeason is not None:
         date = backport.getShortDateFormat(
             time_utils.makeLocalServerTime(nextSeason.getStartDate()))
         additionalInfo = backport.text(tooltipData.body.coming(),
                                        date=date)
     else:
         additionalInfo = backport.text(tooltipData.body.disabled())
     body = '%s\n\n%s' % (body, additionalInfo)
     items.append(
         formatters.packImageTextBlockData(
             title=text_styles.middleTitle(header),
             desc=text_styles.main(body)))
     return items
示例#37
0
    def __setInitialSlotsData(self, iSlotsData):
        if not self.__processingPurchase:
            self.__animationStarted = False
        self.__initialSlotsData = iSlotsData
        oldBonusData = self.__bonusData
        self.__bonusData = {}
        for qTypeName in QUALIFIER_TYPE_NAMES.iterkeys():
            self.__bonusData[qTypeName] = {'bonusName': text_styles.main(_ms('#vehicle_customization:bonusName/{0}'.format(qTypeName))),
             'bonusIcon': getBonusIcon42x42(qTypeName),
             'bonusTotalCount': 0,
             CUSTOMIZATION_TYPE.CAMOUFLAGE: [],
             CUSTOMIZATION_TYPE.EMBLEM: [],
             CUSTOMIZATION_TYPE.INSCRIPTION: [],
             'oldBonusTotalCount': 0,
             'bonusAppliedCount': 0,
             'oldBonusAppliedCount': 0,
             'bonusTotalDescriptionCount': 0,
             'bonusAppliedDescriptionCount': 0}
            if oldBonusData:
                self.__bonusData[qTypeName]['oldBonusTotalCount'] = oldBonusData[qTypeName]['bonusTotalCount']

        forEachSlotIn(iSlotsData, iSlotsData, self.__getInitialBonusData)
        self.__saveInitialTooltipData()
示例#38
0
 def __makeMainVO(self):
     result = {}
     extra = self.unitFunctional.getExtra()
     (_, _, arenaTypeID), _ = self.__currentBuilding
     unitPermissions = self.unitFunctional.getPermissions()
     activeConsumes = extra.getConsumables()
     result['mapID'] = arenaTypeID
     arenaType = ArenaType.g_cache.get(arenaTypeID)
     canUseEquipments = self.__battle.itemData.canUseEquipments
     if arenaType is not None:
         mapName = text_styles.main(arenaType.name)
     else:
         mapName = ''
     infoIcon = icons.info()
     result['headerDescr'] = text_styles.standard(i18n.makeString(FORTIFICATIONS.FORTCLANBATTLEROOM_HEADER_MAPTITLE, mapName=mapName) + ' ' + infoIcon)
     result['isOrdersBgVisible'] = bool(not unitPermissions.canChangeConsumables() and len(activeConsumes) and not canUseEquipments)
     result['mineClanName'] = g_clanCache.clanTag
     _, enemyClanAbbev, _ = self.__battle.getOpponentClanInfo()
     result['enemyClanName'] = '[%s]' % enemyClanAbbev
     if not canUseEquipments and unitPermissions.canChangeConsumables():
         result['ordersDisabledMessage'] = icons.alert() + ' ' + text_styles.alert(i18n.makeString(FORTIFICATIONS.FORTCLANBATTLEROOM_HEADER_ORDERSDISABLED))
         result['ordersDisabledTooltip'] = TOOLTIPS.FORTIFICATION_FORTCLANBATTLEROOM_ORDERSDISABLED_DIVISIONMISMATCH
     self.as_setBattleRoomDataS(result)
示例#39
0
 def _getHeader(self, count, vehicleName, description):
     if self.__battleRoyaleController.isBattleRoyaleMode():
         questHeader = backport.text(R.strings.epic_battle.questsTooltip.
                                     epicBattle.steelhunter.header())
         img = backport.image(R.images.gui.maps.icons.quests.
                              epic_steelhunter_quests_infotip())
         desc = getQuestsDescriptionForHangarFlag()
     else:
         questHeader = backport.text(
             R.strings.tooltips.hangar.header.quests.header(), count=count)
         img = backport.image(
             R.images.gui.maps.icons.quests.questTooltipHeader())
         desc = text_styles.main(
             backport.text(description, vehicle=vehicleName))
     isNYEventEnabled = self._nyController.isEnabled()
     return formatters.packImageTextBlockData(
         title=text_styles.highTitle(questHeader),
         img=backport.image(
             R.images.gui.maps.icons.quests.nyQuestTooltipHeader())
         if isNYEventEnabled else img,
         txtPadding=formatters.packPadding(top=20),
         txtOffset=20,
         desc=desc)
 def _packBlocks(self, *args, **kwargs):
     items = super(LeagueTooltipData, self)._packBlocks()
     resShortCut = R.strings.ranked_battles.rankedBattleMainView.leaguesView
     webSeasonInfo = self.__rankedController.getClientSeasonInfo()
     isYearLBEnabled = self.__rankedController.isYearLBEnabled()
     yearLBsize = self.__rankedController.getYearLBSize()
     if webSeasonInfo.league != UNDEFINED_LEAGUE_ID and webSeasonInfo.position is not None:
         title = backport.text(
             resShortCut.dyn('league{}'.format(webSeasonInfo.league))())
         description = backport.text(resShortCut.descr(), count=yearLBsize)
         if webSeasonInfo.isTop:
             description = backport.text(resShortCut.topDescr(),
                                         count=yearLBsize)
         if not isYearLBEnabled:
             description = backport.text(
                 resShortCut.yearLeaderboardDisabled())
     else:
         title = backport.text(resShortCut.unavailableTitle())
         description = backport.text(resShortCut.unavailableDescr())
     items.append(
         formatters.packTitleDescBlock(title=text_styles.highTitle(title),
                                       desc=text_styles.main(description)))
     return items
 def __packIntelFragmentBlocks(self):
     self._items.append(
         formatters.packImageTextBlockData(
             title=text_styles.highTitle(
                 TOOLTIPS.BLUEPRINT_BLUEPRINTFRAGMENTTOOLTIP_INTELFRAGMENT),
             img=RES_ICONS.getBlueprintFragment('medium', 'intelligence'),
             imgPadding=formatters.packPadding(top=3),
             txtPadding=formatters.packPadding(left=21)))
     descriptionBlock = formatters.packImageTextBlockData(
         desc=text_styles.main(
             TOOLTIPS.BLUEPRINT_BLUEPRINTFRAGMENTTOOLTIP_INTELDESCRIPTION),
         img=RES_ICONS.MAPS_ICONS_BLUEPRINTS_PLUS,
         imgPadding=formatters.packPadding(top=0, right=5),
         padding=formatters.packPadding(left=40))
     self._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._items.append(self.__packInStorageBlock(fragmentsCount))
 def _getOptainHeaderData(self, vehicle):
     from helpers import int2roman
     levelStr = text_styles.concatStylesWithSpace(
         text_styles.stats(int2roman(vehicle.level)),
         text_styles.main(
             i18n.makeString(DIALOGS.VEHICLESELLDIALOG_VEHICLE_LEVEL)))
     if vehicle.isElite:
         description = TOOLTIPS.tankcaruseltooltip_vehicletype_elite(
             vehicle.type)
     else:
         description = DIALOGS.vehicleselldialog_vehicletype(vehicle.type)
     return {
         'userName': vehicle.userName,
         'levelStr': levelStr,
         'description': description,
         'intCD': vehicle.intCD,
         'icon': vehicle.icon,
         'level': vehicle.level,
         'isElite': vehicle.isElite,
         'isPremium': vehicle.isPremium,
         'type': vehicle.type,
         'nationID': self.nationID
     }
示例#43
0
 def __packNoInfo(self):
     if self.__tabsContainer.currentTab.getTotalCount() > 0:
         return {
             'title':
             text_styles.middleTitle(
                 MENU.BOOSTERSWINDOW_BOOSTERSTABLE_NOINFO_NOTFOUND_TITLE),
             'message':
             text_styles.main(
                 MENU.BOOSTERSWINDOW_BOOSTERSTABLE_NOINFO_NOTFOUND_MESSAGE),
             'returnBtnLabel':
             _ms(MENU.BOOSTERSWINDOW_RETURNBTN_LABEL)
         }
     else:
         return {
             'title':
             '',
             'returnBtnLabel':
             '',
             'message':
             text_styles.alignStandartText(
                 MENU.BOOSTERSWINDOW_BOOSTERSTABLE_NOINFO_EMPTY_MESSAGE,
                 TEXT_ALIGN.CENTER)
         }
示例#44
0
 def _packBlocks(self, badgeID):
     blocks = super(BadgeTooltipData, self)._packBlocks()
     badge = self.__itemsCache.items.getBadges()[badgeID]
     tooltipData = [
         formatters.packTextBlockData(
             text_styles.highTitle(badge.getUserName())),
         formatters.packImageBlockData(badge.getHugeIcon(),
                                       BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                                       padding=formatters.packPadding(
                                           top=-5, bottom=11))
     ]
     if g_currentVehicle.isPresent():
         vehicle = g_currentVehicle.item
         tooltipData.append(
             formatters.packBadgeInfoBlockData(
                 badge.getThumbnailIcon(), vehicle.iconContour,
                 text_styles.bonusPreviewText(getPlayerName()),
                 text_styles.bonusPreviewText(vehicle.shortUserName)))
     blocks.append(formatters.packBuildUpBlockData(tooltipData))
     blocks.append(
         formatters.packTextBlockData(
             text_styles.main(TOOLTIPS.PERSONALMISSIONS_BADGE_DESCR)))
     return blocks
示例#45
0
 def __getQuestStatusData(self, quest):
     if not quest.isUnlocked():
         return (text_styles.standard(
             _ms(QUESTS.TILECHAINSVIEW_TASKTYPE_UNAVAILABLE_TEXT)),
                 RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_NOTAVAILABLEICON)
     elif quest.needToGetReward():
         return (text_styles.alert(
             _ms(QUESTS.TILECHAINSVIEW_TASKTYPE_AWARDNOTRECEIVED_TEXT)),
                 RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICON)
     elif quest.isInProgress():
         return (text_styles.neutral(
             _ms(QUESTS.TILECHAINSVIEW_TASKTYPE_INPROGRESS_TEXT)),
                 RES_ICONS.MAPS_ICONS_LIBRARY_INPROGRESSICON)
     elif quest.isFullCompleted():
         return (text_styles.statInfo(
             _ms(QUESTS.TILECHAINSVIEW_TASKTYPE_FULLCOMPLETED_TEXT)),
                 RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_CHECKMARK)
     elif quest.isMainCompleted():
         return (text_styles.statInfo(
             _ms(QUESTS.TILECHAINSVIEW_TASKTYPE_COMPLETED_TEXT)),
                 RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_CHECKMARK)
     else:
         return (text_styles.main(''), None)
示例#46
0
    def _packWayToBuyBlock(self, data):
        subBlocks = [formatters.packTextBlockData(text=text_styles.middleTitle(_ms('#vehicle_customization:customization/tooltip/wayToBuy/title')), padding={'bottom': 6})]
        for buyItem in data['buyItems']:
            buyItemDesc = text_styles.main(buyItem['desc'])
            if buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_MISSION:
                subBlocks.append(formatters.packImageTextBlockData(desc=buyItemDesc, img=RES_ICONS.MAPS_ICONS_LIBRARY_QUEST_ICON, imgPadding={'left': 53,
                 'top': 3}, txtGap=-4, txtOffset=73))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_FOREVER:
                if buyItem['isSale']:
                    subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (0, buyItem['value'])}, padding={'left': 0}))
                else:
                    price = text_styles.concatStylesWithSpace(text_styles.gold(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.gold())
                    subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_TEMP:
                if buyItem['isSale']:
                    subBlocks.append(formatters.packSaleTextParameterBlockData(name=buyItemDesc, saleData={'newPrice': (buyItem['value'], 0)}, padding={'left': 0}))
                else:
                    price = text_styles.concatStylesWithSpace(text_styles.credits(BigWorld.wg_getIntegralFormat(long(buyItem['value']))), icons.credits())
                    subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=price, valueWidth=70))
            elif buyItem['type'] == BUY_ITEM_TYPE.WAYS_TO_BUY_IGR:
                subBlocks.append(formatters.packTextParameterBlockData(name=buyItemDesc, value=icons.premiumIgrSmall(), padding={'left': 0}))

        return formatters.packBuildUpBlockData(subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE, {'left': 3})
 def __generateData(self):
     data = {'buildingType': self._buildingUID}
     assignedLbl = i18n.makeString(FORT.BUILDINGPOPOVER_ASSIGNPLAYERS)
     garrisonLabel = text_styles.main(
         i18n.makeString(FORT.BUILDINGPOPOVER_GARRISONLABEL))
     oldBuilding = self.getBuildingUIDbyID(
         self.fortCtrl.getFort().getAssignedBuildingID(
             BigWorld.player().databaseID))
     isAssigned = self._buildingUID == oldBuilding
     data['isTutorial'] = self.__isTutorial
     data['assignLbl'] = assignedLbl
     data['garrisonLbl'] = garrisonLabel
     data['isAssigned'] = isAssigned
     data['canUpgradeBuilding'] = self.fortCtrl.getPermissions(
     ).canUpgradeBuilding()
     data['canAddOrder'] = self.fortCtrl.getPermissions().canAddOrder()
     data['playerCount'] = self.__assignedPlayerCount
     data['maxPlayerCount'] = self.__maxPlayerCount
     data['buildingHeader'] = self.__prepareHeaderData()
     data['buildingIndicators'] = self.__prepareIndicatorData()
     data['defresInfo'] = self.__prepareDefResInfo()
     data['actionData'] = self.__prepareActionData()
     self.as_setDataS(data)
 def __getDisabledStatusBlock(self):
     nationID = nations.INDICES.get(self.__nationName)
     align = BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER
     if helper.isAllCollectionPurchased(nationID):
         block = formatters.packAlignedTextBlockData(
             text=text_styles.middleTitle(
                 backport.text(R.strings.tooltips.collectibleVehicleTooltip.
                               status.purchased())),
             align=align)
     else:
         maxUnlockedLevel = self.__itemsCache.items.stats.getMaxResearchedLevelByNations(
         ).get(nationID, MIN_VEHICLE_LEVEL)
         vehicleLevels = getCache()['collectorVehiclesLevelsByNations'].get(
             nationID, set())
         if not vehicleLevels:
             raise SoftException(
                 'There are not collectible vehicles in the nation tree of {}'
                 .format(self.__nationName))
         if min(vehicleLevels) <= maxUnlockedLevel:
             header = R.strings.tooltips.collectibleVehicleTooltip.status.purchaseAvailable(
             )
             text = R.strings.tooltips.collectibleVehicleTooltip.status.condition(
             )
             styleGetter = text_styles.middleTitle
         else:
             header = R.strings.tooltips.collectibleVehicleTooltip.status.purchaseUnavailable(
             )
             text = R.strings.tooltips.collectibleVehicleTooltip.status.condition(
             )
             styleGetter = text_styles.statusAttention
         block = formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesToMultiLine(
                 styleGetter(backport.text(header)),
                 text_styles.main(backport.text(text))),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
     return formatters.packBuildUpBlockData(
         blocks=[block], padding=formatters.packPadding(top=5))
示例#49
0
    def __buildList(self):
        modulesList = []
        typeId = GUI_ITEM_TYPE_INDICES[self._slotType]
        data = g_itemsCache.items.getItems(
            typeId, REQ_CRITERIA.VEHICLE.SUITABLE([self._vehicle],
                                                  [typeId])).values()
        data.sort(reverse=True)
        currXp = g_itemsCache.items.stats.vehiclesXPs.get(
            self._vehicle.intCD, 0)
        stats = {
            'money': g_itemsCache.items.stats.money,
            'exchangeRate': g_itemsCache.items.shop.exchangeRate,
            'currXP': currXp,
            'totalXP': currXp + g_itemsCache.items.stats.freeXP
        }
        for idx, module in enumerate(data):
            isInstalled = module.isInstalled(self._vehicle, self._slotIndex)
            if isInstalled:
                self._selectedIdx = idx
            moduleData = self._buildModuleData(module, isInstalled, stats)
            if self._slotType == 'optionalDevice':
                moduleData['slotIndex'] = self._slotIndex
                moduleData['removable'] = module.isRemovable
                moduleData['desc'] = text_styles.main(module.getShortInfo())
                moduleData['name'] = text_styles.stats(module.userName)
            else:
                values, names = self.__buildParams(module)
                moduleData['level'] = module.level
                moduleData['paramValues'] = values
                moduleData['paramNames'] = names
                moduleData['name'] = text_styles.middleTitle(module.userName)
            if self._slotType == 'vehicleGun':
                if module.isClipGun(self._vehicle.descriptor):
                    moduleData[EXTRA_MODULE_INFO] = CLIP_ICON_PATH
            modulesList.append(moduleData)

        return modulesList
    def __makePeripheryData(self):
        fort = self.fortCtrl.getFort()
        optionsList = g_preDefinedHosts.getSimpleHostsList(
            g_preDefinedHosts.hostsWithRoaming())
        servername = None
        for key, name, csisStatus, peripheryID in optionsList:
            if fort.peripheryID == peripheryID:
                servername = name

        if servername is None:
            servername = connectionManager.serverUserName
        _, inCooldown = fort.getPeripheryProcessing()
        timestamp, _, _ = fort.events.get(FORT_EVENT_TYPE.PERIPHERY_COOLDOWN,
                                          (0, 0, 0))
        buttonEnabled = not inCooldown
        buttonToolTip = self.__makePeripheryBtnToolTip(
            buttonEnabled,
            time_utils.getTimeDeltaFromNow(
                time_utils.makeLocalServerTime(timestamp)))
        descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_PERIPHERYDESCRIPTION
        if self._isFortFrozen():
            peripheryName = text_styles.standard(str(servername))
        else:
            peripheryName = text_styles.neutral(str(servername))
        return {
            'peripheryTitle':
            text_styles.main(
                i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_PEREPHERYTITLE)),
            'peripheryName':
            peripheryName,
            'buttonEnabled':
            buttonEnabled,
            'buttonToolTip':
            buttonToolTip,
            'descriptionTooltip':
            descriptionTooltip
        }
示例#51
0
 def construct(self):
     block = []
     shell = self.shell
     configuration = self.configuration
     buyPrice = configuration.buyPrice
     sellPrice = configuration.sellPrice
     if buyPrice and sellPrice:
         LOG_ERROR('You are not allowed to use buyPrice and sellPrice at the same time')
         return
     else:
         need = ZERO_MONEY
         if buyPrice:
             money = g_itemsCache.items.stats.money
             price = shell.altPrice or shell.buyPrice
             need = price - money
             need = need.toNonNegative()
             defPrice = shell.defaultAltPrice or shell.defaultPrice
             addCreditPrice = price.credits > 0
             if price.isAllSet() and not g_itemsCache.items.shop.isEnabledBuyingGoldShellsForCredits:
                 addCreditPrice = False
             addGoldPrice = price.gold > 0
             addDelimeter = addCreditPrice and addGoldPrice
             if addCreditPrice:
                 block.append(makePriceBlock(price.credits, CURRENCY_SETTINGS.BUY_CREDITS_PRICE, need.credits if need.credits > 0 else None, defPrice.credits if defPrice.credits > 0 else None, percent=shell.actionPrc, valueWidth=self._valueWidth))
             if addDelimeter:
                 block.append(formatters.packTextBlockData(text=text_styles.standard(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR), padding=formatters.packPadding(left=81 + self.leftPadding)))
             if addGoldPrice:
                 block.append(makePriceBlock(price.gold, CURRENCY_SETTINGS.BUY_GOLD_PRICE, need.gold if need.gold > 0 else None, defPrice.gold if defPrice.gold > 0 else None, percent=shell.actionPrc, valueWidth=self._valueWidth))
         if sellPrice:
             block.append(makePriceBlock(shell.sellPrice.credits, CURRENCY_SETTINGS.SELL_PRICE, oldPrice=shell.defaultSellPrice.credits, percent=shell.sellActionPrc, valueWidth=self._valueWidth))
         inventoryCount = shell.inventoryCount
         if inventoryCount:
             block.append(formatters.packTextParameterBlockData(name=text_styles.main(TOOLTIPS.VEHICLE_INVENTORYCOUNT), value=text_styles.stats(inventoryCount), valueWidth=self._valueWidth, padding=formatters.packPadding(left=-5)))
         notEnoughMoney = need > ZERO_MONEY
         hasAction = shell.actionPrc > 0 or shell.sellActionPrc > 0
         return (block, notEnoughMoney or hasAction)
    def __packCrewInfoData(self):
        crewData = []
        for idx, tankman in g_currentPreviewVehicle.item.crew:
            role = tankman.descriptor.role
            crewData.append({
                'icon':
                getBonusIcon42x42(role),
                'name':
                text_styles.middleTitle(ITEM_TYPES.tankman_roles(role)),
                'tooltip':
                TOOLTIPS_CONSTANTS.VEHICLE_PREVIEW_CREW_MEMBER,
                'role':
                role
            })

        return {
            'listDesc':
            text_styles.main(
                VEHICLE_PREVIEW.INFOPANEL_TAB_CREWINFO_LISTDESC_TEXT),
            'crewList':
            crewData,
            'showNationFlag':
            False
        }
示例#53
0
 def _populate(self):
     super(VehicleStylePreview, self)._populate()
     g_currentPreviewVehicle.selectVehicle(self.__vehicleCD)
     self.__selectedVehicleEntityId = g_currentPreviewVehicle.vehicleEntityID
     if not g_currentPreviewVehicle.isPresent() or self.__style is None:
         event_dispatcher.showHangar()
     self.__hangarSpace.onSpaceCreate += self.__onHangarCreateOrRefresh
     self.addListener(CameraRelatedEvents.VEHICLE_LOADING,
                      self.__onVehicleLoading, EVENT_BUS_SCOPE.DEFAULT)
     self.__heroTanksControl.setInteractive(False)
     self.as_setDataS({
         'closeBtnLabel':
         backport.text(R.strings.vehicle_preview.header.closeBtn.label()),
         'backBtnLabel':
         backport.text(R.strings.vehicle_preview.header.backBtn.label()),
         'backBtnDescrLabel':
         self.__backBtnDescrLabel,
         'showCloseBtn':
         _SHOW_CLOSE_BTN,
         'showBackButton':
         _SHOW_BACK_BTN
     })
     self.as_setAdditionalInfoS({
         'objectSubtitle':
         text_styles.main(
             backport.text(getGroupFullNameResourceID(
                 self.__style.groupID))),
         'objectTitle':
         self.__style.userName,
         'descriptionTitle':
         backport.text(
             R.strings.tooltips.vehiclePreview.historicalReference.title()),
         'descriptionText':
         self.__styleDescr
     })
     return
 def __makeData(self):
     ms = i18n.makeString
     invitedPlayers = len(self.refSystem.getReferrals())
     data = {
         'windowTitle':
         ms(MENU.REFERRALMANAGEMENTWINDOW_TITLE),
         'infoHeaderText':
         ms(MENU.REFERRALMANAGEMENTWINDOW_INFOHEADER_HAVENOTTANK)
         if not self.refSystem.isTotallyCompleted() else ms(
             MENU.REFERRALMANAGEMENTWINDOW_INFOHEADER_HAVETANK),
         'descriptionText':
         ms(MENU.REFERRALMANAGEMENTWINDOW_DESCRIPTION),
         'invitedPlayersText':
         ms(MENU.REFERRALMANAGEMENTWINDOW_INVITEDPLAYERS,
            playersNumber=invitedPlayers),
         'invitesManagementLinkText':
         text_styles.main(
             ms(MENU.REFERRALMANAGEMENTWINDOW_INVITEMANAGEMENTLINK)),
         'closeBtnLabel':
         ms(MENU.REFERRALMANAGEMENTWINDOW_CLOSEBTNLABEL),
         'tableHeader':
         self.__makeTableHeader()
     }
     self.as_setDataS(data)
示例#55
0
 def __buildStatusBlock(self):
     if self.__isForCurrentVehicleRank():
         achievedCount = self.item.getSerialID()
         vehicleName = self.item.getVehicle().userName
         achievedStr = text_styles.middleTitle(achievedCount)
         descr = text_styles.main(
             _ms(TOOLTIPS.BATTLETYPES_RANKED_VEHRANK_ACHIEVEDCOUNT,
                 vehName=vehicleName))
         descr = descr + achievedStr
         return formatters.packCounterTextBlockData(
             achievedCount, descr, padding=formatters.packPadding(left=3))
     if self.item.isAcquired():
         status = text_styles.statInfo(
             TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_RECEIVED)
     elif self.item.isLost():
         status = text_styles.statusAlert(
             TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_LOST)
     else:
         status = text_styles.warning(
             TOOLTIPS.BATTLETYPES_RANKED_RANK_STATUS_NOTEARNED)
     return formatters.packAlignedTextBlockData(
         status,
         BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
         padding=formatters.packPadding(top=-4))
示例#56
0
 def _updateDetailedInfo(self):
     clanID = self.__selectedClan.getClanDbID()
     clanName = formatField(self.__selectedClan.getClanFullName)
     rating = formatField(getter=self.__selectedClan.getPersonalRating,
                          formatter=BigWorld.wg_getIntegralFormat)
     battlesCount = formatField(getter=self.__selectedClan.getBattlesCount,
                                formatter=BigWorld.wg_getIntegralFormat)
     wins = formatField(getter=self.__selectedClan.getBattleXpAvg,
                        formatter=lambda value: BigWorld.
                        wg_getNiceNumberFormat(value) + '%')
     avgExp = formatField(
         getter=self.__selectedClan.getBattlesPerformanceAvg,
         formatter=BigWorld.wg_getIntegralFormat)
     stats = [
         _packItemData(battlesCount, CLANS.SEARCH_INFO_STATS_BATTLES,
                       CLANS.SEARCH_INFO_STATS_BATTLES_TOOLTIP,
                       'avgBattlesCount40x32.png'),
         _packItemData(wins, CLANS.SEARCH_INFO_STATS_WINS,
                       CLANS.SEARCH_INFO_STATS_WINS_TOOLTIP,
                       'avgWins40x32.png'),
         _packItemData(avgExp, CLANS.SEARCH_INFO_STATS_AVGEXP,
                       CLANS.SEARCH_INFO_STATS_AVGEXP_TOOLTIP,
                       'avgExp40x32.png')
     ]
     self.as_setDataS({
         'clanId':
         clanID,
         'clanName':
         clanName,
         'ratingTitle':
         text_styles.main(CLANS.SEARCH_INFO_RATINGTITLE),
         'rating':
         text_styles.promoTitle(rating),
         'stats':
         stats
     })
示例#57
0
 def __makeVO(self, data):
     creditsDiff = '+ %s' % BigWorld.wg_getNiceNumberFormat(
         data.creditsDiff)
     xpDiff = '+ %s' % BigWorld.wg_getNiceNumberFormat(data.xpDiff)
     premStr = text_styles.neutral(BATTLE_RESULTS.GETPREMIUMPOPOVER_PREM)
     awardStr = text_styles.neutral(BATTLE_RESULTS.GETPREMIUMPOPOVER_AWARD)
     descriptionText = _ms(BATTLE_RESULTS.GETPREMIUMPOPOVER_DESCRIPTIONTEXT,
                           prem=premStr,
                           award=awardStr)
     result = {
         'arenaUniqueID': data.arenaUniqueID,
         'headerTF': {
             'htmlText':
             text_styles.highTitle(
                 BATTLE_RESULTS.GETPREMIUMPOPOVER_HEADERTEXT)
         },
         'creditsTF': {
             'htmlText': text_styles.promoTitle(creditsDiff)
         },
         'creditsIcon': {
             'source': RES_ICONS.MAPS_ICONS_LIBRARY_CREDITSICONBIG_1
         },
         'xpTF': {
             'htmlText': text_styles.promoTitle(xpDiff)
         },
         'xpIcon': {
             'source': RES_ICONS.MAPS_ICONS_LIBRARY_XPICONBIG_1
         },
         'descriptionTF': {
             'htmlText': text_styles.main(descriptionText)
         },
         'actionBtn': {
             'label': BATTLE_RESULTS.GETPREMIUMPOPOVER_ACTIONBTN_LABEL
         }
     }
     return result
示例#58
0
 def __initParameters(cls, vehCD, vehicle, showWarning):
     """
     Generates some constant data for vehicle
     :return: vo as dict
     """
     return {
         'id':
         vehCD,
         'nation':
         vehicle.nationID,
         'image':
         vehicle.icon,
         'label':
         text_styles.main(vehicle.shortUserName),
         'level':
         vehicle.level,
         'premium':
         vehicle.isPremium,
         'tankType':
         vehicle.type,
         'isAttention':
         showWarning,
         'index':
         -1,
         'isInHangar':
         False,
         'moduleType':
         cls._getModuleType(
             VEH_COMPARE.VEHICLECOMPAREVIEW_MODULETYPE_BASIC),
         'crewLevelIndx':
         -1,
         'elite':
         vehicle.isElite,
         'params': [],
         'crewLevels': []
     }
 def __getHeaderTab(self, cycleID, status, points, cycle=None):
     result = ''
     titleFormatter = text_styles.main
     if status == CYCLE_STATUS.CURRENT or status == _FINAL_CURRENT_TAB:
         result = text_styles.stats(
             RANKED_BATTLES.RANKEDBATTLEHEADER_POINTS_CURRENT)
         titleFormatter = text_styles.neutral
     elif not status == CYCLE_STATUS.FUTURE:
         result = text_styles.main(
             _ms(RANKED_BATTLES.RANKEDBATTLEHEADER_POINTS + status,
                 points=points))
     if status == FINAL_TAB:
         titleStr = RANKED_BATTLES.RANKEDBATTLEHEADER_FINAL
     else:
         titleStr = _ms(RANKED_BATTLES.RANKEDBATTLEHEADER_CYCLE,
                        cycle=cycle.ordinalNumber)
     title = titleFormatter(titleStr)
     return {
         'title': title,
         'id': str(cycleID),
         'tooltip': self.__makeHeaderTooltip(status, cycle, points),
         'status': status,
         'result': result
     }
示例#60
0
 def construct(self):
     block = list()
     module = self.module
     inventoryVehicles = self.itemsCache.items.getVehicles(
         REQ_CRITERIA.INVENTORY).itervalues()
     totalInstalledVehicles = map(
         lambda x: x.shortUserName,
         module.getInstalledVehicles(inventoryVehicles))
     installedVehicles = totalInstalledVehicles[:_MAX_INSTALLED_LIST_LEN]
     if installedVehicles:
         tooltipText = ', '.join(installedVehicles)
         if len(totalInstalledVehicles) > _MAX_INSTALLED_LIST_LEN:
             hiddenVehicleCount = len(
                 totalInstalledVehicles) - _MAX_INSTALLED_LIST_LEN
             hiddenTxt = '%s %s' % (text_styles.main(
                 TOOLTIPS.SUITABLEVEHICLE_HIDDENVEHICLECOUNT),
                                    text_styles.stats(hiddenVehicleCount))
             tooltipText = '%s\n%s' % (tooltipText, hiddenTxt)
         block.append(
             formatters.packTitleDescBlock(
                 title=text_styles.middleTitle(
                     TOOLTIPS.DEVICEFITS_ALREADY_INSTALLED_HEADER),
                 desc=text_styles.standard(tooltipText)))
     return block