def __makeDefencePeriodData(self):
     alertMessage = ''
     blockBtnEnabled = True
     fort = self.fortCtrl.getFort()
     inProcess, inCooldown = fort.getDefenceHourProcessing()
     if self._isFortFrozen():
         conditionPostfix = text_styles.standard(fort.getDefencePeriodStr())
     else:
         conditionPostfix = text_styles.neutral(fort.getDefencePeriodStr())
     blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNENABLED
     descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEPERIODDESCRIPTION
     if inProcess:
         defenceHourChangeDay, nextDefenceHour, _ = fort.events[FORT_EVENT_TYPE.DEFENCE_HOUR_CHANGE]
         timestampStart = time_utils.getTimeTodayForUTC(nextDefenceHour)
         value = '%s - %s' % (BigWorld.wg_getShortTimeFormat(timestampStart), BigWorld.wg_getShortTimeFormat(timestampStart + time_utils.ONE_HOUR))
         msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_INPROGRESS, value=value, date=BigWorld.wg_getShortDateFormat(defenceHourChangeDay))
         alertMessage = text_styles.alert(msgString)
         blockBtnEnabled = False
         blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED
     elif inCooldown:
         msgString = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_RECENTLYSCHEDULED)
         alertMessage = text_styles.alert(msgString)
         blockBtnEnabled = False
         blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_DEFENCEBTNDISABLED
     conditionPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition('defencePeriodTime')))
     blockDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr('defencePeriodTime')))
     if alertMessage:
         alertMessage = icons.alert() + ' ' + alertMessage
     return {'blockBtnEnabled': blockBtnEnabled,
      'blockDescr': blockDescr,
      'blockCondition': conditionPrefix + ' ' + conditionPostfix,
      'alertMessage': alertMessage,
      'blockBtnToolTip': blockBtnToolTip,
      'descriptionTooltip': descriptionTooltip}
示例#2
0
def makeBuildingIndicatorsVO(buildingLevel, progress, hpVal, hpTotalVal, defResVal, maxDefResVal):
    FORMAT_PATTERN = '###'
    if progress == FORT_ALIAS.STATE_FOUNDATION_DEF or progress == FORT_ALIAS.STATE_FOUNDATION:
        hpValueFormatter = text_styles.alert(FORMAT_PATTERN)
    else:
        hpValueFormatter = text_styles.defRes(FORMAT_PATTERN)
    hpTotalFormatted = str(BigWorld.wg_getIntegralFormat(hpTotalVal)) + ' '
    formattedHpTotal = ''.join((text_styles.standard(hpTotalFormatted), icons.nut()))
    defResValueFormatter = text_styles.defRes(FORMAT_PATTERN)
    maxDefDerFormatted = str(BigWorld.wg_getIntegralFormat(maxDefResVal)) + ' '
    formattedDefResTotal = ''.join((text_styles.standard(maxDefDerFormatted), icons.nut()))
    hpProgressLabels = {'currentValue': str(BigWorld.wg_getIntegralFormat(hpVal)),
     'currentValueFormatter': hpValueFormatter,
     'totalValue': formattedHpTotal,
     'separator': '/'}
    storeProgressLabels = {'currentValue': str(BigWorld.wg_getIntegralFormat(defResVal)),
     'currentValueFormatter': defResValueFormatter,
     'totalValue': formattedDefResTotal,
     'separator': '/'}
    result = {'hpLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_HPLBL),
     'defResLabel': i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_INDICATORS_DEFRESLBL),
     'hpCurrentValue': hpVal,
     'hpTotalValue': hpTotalVal,
     'defResCurrentValue': defResVal,
     'defResTotalValue': maxDefResVal,
     'hpProgressLabels': hpProgressLabels,
     'defResProgressLabels': storeProgressLabels}
    return result
示例#3
0
 def _makeRequestTooltip(self, status, date, user = None):
     if status == CLAN_INVITE_STATES.ACCEPTED:
         return text_styles.concatStylesToMultiLine(text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_INVITEACCEPTED)), text_styles.main(date), text_styles.main(''), text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_BYUSER)), text_styles.stats(user))
     if status == CLAN_INVITE_STATES.DECLINED or status == CLAN_INVITE_STATES.DECLINED_RESENT:
         return text_styles.concatStylesToMultiLine(text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_INVITEDECLINED)), text_styles.main(date), text_styles.main(''), text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_BYUSER)), text_styles.stats(user))
     if status == CLAN_INVITE_STATES.ACTIVE or status == CLAN_INVITE_STATES.EXPIRED or status == CLAN_INVITE_STATES.EXPIRED_RESENT:
         return text_styles.concatStylesToMultiLine(text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_INVITESENT)), text_styles.main(date), text_styles.main(''), text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_TOOLTIPS_INVITE_SENDER)), text_styles.stats(user))
 def __createTexts(self):
     self.__textsCreated = True
     return {
         'windowLbl':
         FORTIFICATIONS.PERIODDEFENCEWINDOW_HEADERLBL,
         'headerLbl':
         text_styles.highTitle(FORTIFICATIONS.PERIODDEFENCEWINDOW_READY),
         'peripheryLbl':
         text_styles.neutral(FORTIFICATIONS.PERIODDEFENCEWINDOW_PERIPHERY),
         'peripheryDescr':
         text_styles.standard(
             FORTIFICATIONS.PERIODDEFENCEWINDOW_PERIPHERY_DESCRIPTION),
         'hourDefenceLbl':
         text_styles.neutral(
             FORTIFICATIONS.PERIODDEFENCEWINDOW_HOURDEFENCE),
         'hourDefenceDescr':
         text_styles.standard(
             FORTIFICATIONS.PERIODDEFENCEWINDOW_HOURDEFENCE_DESCRIPTION),
         'holidayLbl':
         text_styles.neutral(FORTIFICATIONS.PERIODDEFENCEWINDOW_HOLIDAY),
         'holidayDescr':
         text_styles.standard(
             FORTIFICATIONS.PERIODDEFENCEWINDOW_HOLIDAY_DESCRIPTION),
         'acceptBtn':
         FORTIFICATIONS.PERIODDEFENCEWINDOW_BTN_ACTIVATE,
         'cancelBtn':
         FORTIFICATIONS.PERIODDEFENCEWINDOW_BTN_NOTNOW
     }
示例#5
0
 def __packStaticHeaderData(self, club):
     profile = self.clubsCtrl.getProfile()
     limits = self.clubsState.getLimits()
     if limits.canDestroyClub(profile, club).success:
         btnDestroyText = _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_DESTROYSTATIC_TEXT)
     elif limits.canLeaveClub(profile, club).success:
         btnDestroyText = _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_EXITSTATIC_TEXT)
     else:
         btnDestroyText = ''
     if club.canParticipateBattles():
         lblStaffedText = ''.join([text_styles.success(CYBERSPORT.STATICFORMATION_STAFFVIEW_LBLSTAFFED_TEXT),
          text_styles.standard(' ('),
          text_styles.main(str(len(club.getMembers()))),
          text_styles.standard('/%d)' % CLUB_LIMITS.MAX_MEMBERS)])
     else:
         lblStaffedText = ''
     return {'lblTitleText': text_styles.highTitle(CYBERSPORT.STATICFORMATION_STAFFVIEW_TITLE_TEXT),
      'lblDescriptionText': text_styles.standard(_ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_DESCRIPTION_OTHER_TEXT, clubName=club.getUserName())),
      'btnRecruitmentText': _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_RECRUITMENTBTN_TEXT, count=len(club.getApplicants(onlyActive=True))),
      'btnRecruitmentTooltip': TOOLTIPS.STATICFORMATIONSTAFFVIEW_RECRUITMENTBTN,
      'btnInviteText': _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_INVITEBTN_TEXT),
      'btnRemoveText': btnDestroyText,
      'cbOpenedText': _ms(CYBERSPORT.STATICFORMATION_STAFFVIEW_RECRUITMENTOPENEDCHKBX_TEXT),
      'lblStaffedText': lblStaffedText,
      'lblStaffedTooltip': TOOLTIPS.STATICFORMATIONSTAFFVIEW_LBLSTAFFED,
      'tableHeader': _packTableHeaders()}
 def _populate(self):
     super(FortIntelligenceClanFilterPopover, self)._populate()
     headerText = text_styles.highTitle(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_HEADER))
     clanLevelText = text_styles.standard(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_CLANLEVEL))
     startHourRangeText = text_styles.standard(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_STARTHOURRANGE))
     self.as_setDescriptionsTextS(headerText, clanLevelText, startHourRangeText)
     defaultButtonText = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_DEFAULTBUTTONTEXT)
     applyButtonText = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_APPLYBUTTONTEXT)
     cancelButtonText = _ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANFILTERPOPOVER_CANCELBUTTONTEXT)
     self.as_setButtonsTextS(defaultButtonText, applyButtonText, cancelButtonText)
     defaultButtonTooltip = TOOLTIPS.FORTIFICATION_FORTINTELLIGENCECLANFILTERPOPOVER_DEFAULT
     applyButtonTooltip = TOOLTIPS.FORTIFICATION_FORTINTELLIGENCECLANFILTERPOPOVER_APPLY
     self.as_setButtonsTooltipsS(defaultButtonTooltip, applyButtonTooltip)
     minClanLevel = FORTIFICATION_ALIASES.CLAN_FILTER_MIN_LEVEL
     maxClanLevel = FORTIFICATION_ALIASES.CLAN_FILTER_MAX_LEVEL
     startDefenseHour = FORTIFICATION_ALIASES.CLAN_FILTER_MIN_HOUR
     startDefenseMin = 0
     cache = self.fortCtrl.getPublicInfoCache()
     if cache:
         minClanLevel, maxClanLevel, startDefenseHour, availability = cache.getDefaultFilterData()
         selectedDate = time.localtime(time_utils.getTimeForLocal(time_utils.getCurrentTimestamp(), max(0, startDefenseHour)))
         startDefenseMin = selectedDate.tm_min
     data = {'minClanLevel': minClanLevel,
      'maxClanLevel': maxClanLevel,
      'startDefenseHour': startDefenseHour,
      'startDefenseMinutes': startDefenseMin,
      'isTwelveHoursFormat': self.app.utilsManager.isTwelveHoursFormat(),
      'isWrongLocalTime': self._isWrongLocalTime(),
      'skipValues': adjustDefenceHoursListToLocal(g_lobbyContext.getServerSettings().getForbiddenFortDefenseHours())}
     defenceStart, _ = self.fortCtrl.getFort().getLocalDefenceHour()
     if defenceStart != NOT_ACTIVATED:
         data['yourOwnClanStartDefenseHour'] = defenceStart
     self.as_setDataS(data)
 def __makeGlobalMapBlock(self, globalMapStats, ratings):
     hasGlobalMap = globalMapStats.hasGlobalMap()
     if hasGlobalMap:
         notActual = ratings.getGlobalMapBattlesFor28Days() <= 0
         stats = [{'local': 'rageLevel10',
           'value': formatField(getter=ratings.getGlobalMapEloRating10, formatter=BigWorld.wg_getIntegralFormat),
           'timeExpired': notActual,
           'tooltip': CLANS.CLANPROFILE_SUMMARYVIEW_TOOLTIP_GMAP_ELO_RAGE_10_BODY},
          {'local': 'rageLevel8',
           'value': formatField(getter=ratings.getGlobalMapEloRating8, formatter=BigWorld.wg_getIntegralFormat),
           'timeExpired': notActual,
           'tooltip': CLANS.CLANPROFILE_SUMMARYVIEW_TOOLTIP_GMAP_ELO_RAGE_8_BODY},
          {'local': 'rageLevel6',
           'value': formatField(getter=ratings.getGlobalMapEloRating6, formatter=BigWorld.wg_getIntegralFormat),
           'timeExpired': notActual,
           'tooltip': CLANS.CLANPROFILE_SUMMARYVIEW_TOOLTIP_GMAP_ELO_RAGE_6_BODY},
          {'local': 'battlesCount',
           'value': formatField(getter=ratings.getGlobalMapBattlesFor28Days, formatter=BigWorld.wg_getIntegralFormat),
           'tooltip': CLANS.CLANPROFILE_SUMMARYVIEW_TOOLTIP_GMAP_BATTLES_COUNT_BODY},
          {'local': 'provinces',
           'value': formatField(getter=globalMapStats.getCurrentProvincesCount, formatter=BigWorld.wg_getIntegralFormat),
           'tooltip': CLANS.CLANPROFILE_SUMMARYVIEW_TOOLTIP_GMAP_PROVINCE_BODY}]
         statsBlock = self.__makeStatsBlock(stats)
         emptyLbl = ''
     else:
         statsBlock = ()
         if isValueAvailable(globalMapStats.hasGlobalMap):
             emptyLbl = text_styles.standard(CLANS.CLANPROFILE_SUMMARYVIEW_BLOCKLBL_EMPTYGLOBALMAP)
         else:
             emptyLbl = '%s %s' % (icons.alert(), text_styles.standard(CLANS.CLANPROFILE_SUMMARYVIEW_NODATA))
     return {'isShowHeader': True,
      'header': text_styles.highTitle(CLANS.CLANPROFILE_MAINWINDOWTAB_GLOBALMAP),
      'statBlocks': statsBlock,
      'emptyLbl': emptyLbl,
      'isActivated': hasGlobalMap}
示例#8
0
    def createInitVO(self):
        isTypeNotCamouflage = self.__filter.currentType != CUSTOMIZATION_TYPE.CAMOUFLAGE
        groupsUserNames = []
        groupsList = []
        for groupData in self.__groupsMap[self.__filter.currentType]:
            groupsUserNames.append(groupData[1])
            groupsList.append(groupData[0])

        if isTypeNotCamouflage:
            groupsSelectIndex = groupsList.index(self.__filter.currentGroup)
        else:
            groupsSelectIndex = 0
        return {'lblTitle': text_styles.highTitle(CUSTOMIZATION.FILTER_POPOVER_TITLE),
         'lblBonusType': text_styles.standard(CUSTOMIZATION.FILTER_POPOVER_BONUSTYPE_TITLE),
         'lblCustomizationType': text_styles.standard(CUSTOMIZATION.FILTER_POPOVER_GROUPS_TITLE),
         'lblPurchaseType': text_styles.standard(CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_TITLE),
         'btnDefault': CUSTOMIZATION.FILTER_POPOVER_GETDEFAULTSETTINGS,
         'bonusTypeId': FILTER_TYPE.QUALIFIER,
         'bonusType': self.__getBonusTypeVO(),
         'customizationBonusTypeVisible': isTypeNotCamouflage,
         'customizationTypeId': FILTER_TYPE.GROUP,
         'customizationType': groupsUserNames,
         'customizationTypeSelectedIndex': groupsSelectIndex,
         'customizationTypeVisible': isTypeNotCamouflage,
         'bonusTypeDisableTooltip': makeTooltip(CUSTOMIZATION.TOOLTIP_FILTER_GROUPS_DISABLED_HEADER, CUSTOMIZATION.TOOLTIP_FILTER_GROUPS_DISABLED_BODY),
         'refreshTooltip': makeTooltip(TOOLTIPS.CUSTOMIZATION_FILTERPOPOVER_REFRESH_HEADER, TOOLTIPS.CUSTOMIZATION_FILTERPOPOVER_REFRESH_BODY),
         'purchaseTypeId': FILTER_TYPE.PURCHASE_TYPE,
         'purchaseType': self.__getPurchaseTypeVO(),
         'purchaseTypeSelectedIndex': self.__purchaseTypeList.index(self.__filter.purchaseType)}
    def __makeDivisionsData(self, list):
        result = []
        for item in list:
            divisionType = {}
            title = i18n.makeString(item['label'])
            profit = fort_formatters.getDefRes(item['profit'])
            divisionID = item['level']
            divisionType['divisionName'] = highTitle(i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_DIVISIONFULLNAME, divisionType=title))
            divisionType['divisionProfit'] = standard(i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_DIVISIONPROFIT, defResCount=profit))
            minVehLvl, maxVehLvl = item['vehLvls']
            if maxVehLvl == minVehLvl:
                vehicleLevel = i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_VEHICLELEVELSINGLE, level=_getTextLevels(maxVehLvl))
            else:
                vehicleLevel = i18n.makeString(I18N_FORTIFICATIONS.CHOICEDIVISION_VEHICLELEVEL, minLevel=_getTextLevels(minVehLvl), maxLevel=_getTextLevels(maxVehLvl))
            divisionType['vehicleLevel'] = standard(vehicleLevel)
            divisionType['divisionID'] = divisionID
            if divisionID == SORTIE_DIVISION.MIDDLE:
                minCount, maxCount = self.playersRange[0]
            elif divisionID == SORTIE_DIVISION.CHAMPION:
                minCount, maxCount = self.playersRange[1]
            else:
                minCount, maxCount = self.playersRange[2]
            divisionType['playerRange'] = main('{0}-{1}'.format(str(minCount), str(maxCount)))
            result.append(divisionType)

        return result
    def __createInitialVO(self):
        isTypeNotCamouflage = self.__filter.currentType != CUSTOMIZATION_TYPE.CAMOUFLAGE
        groupsUserNames = []
        for _, groupName in self.__groupsMap[self.__filter.currentType]:
            groupsUserNames.append(groupName)

        updateVO = self.__createUpdateVO()
        return {'lblTitle': text_styles.highTitle(VEHICLE_CUSTOMIZATION.FILTER_POPOVER_TITLE),
         'lblBonusType': text_styles.standard(VEHICLE_CUSTOMIZATION.FILTER_POPOVER_BONUSTYPE_TITLE),
         'lblCustomizationType': text_styles.standard(VEHICLE_CUSTOMIZATION.FILTER_POPOVER_GROUPS_TITLE),
         'lblPurchaseType': text_styles.standard(VEHICLE_CUSTOMIZATION.FILTER_POPOVER_WAYSTOBUY_TITLE),
         'btnDefault': VEHICLE_CUSTOMIZATION.FILTER_POPOVER_GETDEFAULTSETTINGS,
         'bonusTypeId': FILTER_TYPE.QUALIFIER,
         'bonusType': _getBonusTypeVO(self.__filter.selectedBonuses),
         'customizationBonusTypeVisible': isTypeNotCamouflage,
         'enableGroupFilter': updateVO['enableGroupFilter'],
         'customizationTypeId': FILTER_TYPE.GROUP,
         'customizationType': groupsUserNames,
         'customizationTypeSelectedIndex': updateVO['groupsSelectIndex'],
         'customizationTypeVisible': isTypeNotCamouflage,
         'bonusTypeDisableTooltip': makeTooltip(VEHICLE_CUSTOMIZATION.TOOLTIP_FILTER_GROUPS_DISABLED_HEADER, VEHICLE_CUSTOMIZATION.TOOLTIP_FILTER_GROUPS_DISABLED_BODY),
         'refreshTooltip': makeTooltip(VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTERPOPOVER_REFRESH_HEADER, VEHICLE_CUSTOMIZATION.CUSTOMIZATION_FILTERPOPOVER_REFRESH_BODY),
         'purchaseTypeId': FILTER_TYPE.PURCHASE_TYPE,
         'purchaseType': _getPurchaseTypeVO(),
         'purchaseTypeSelectedIndex': PURCHASE_TYPE.ALL.index(self.__filter.purchaseType)}
 def __makeTableHeader(self):
     ms = i18n.makeString
     infoIcon = icons.info()
     multiplyExpText = text_styles.standard(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_EXPMULTIPLIER))
     tableExpText = text_styles.standard(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_EXP))
     return (self.__makeSortingButton(ms(MENU.REFERRALMANAGEMENTWINDOW_REFERRALSTABLE_NICK), 146, TEXT_ALIGN.LEFT),
      self.__makeSortingButton(ms(tableExpText + ' ' + infoIcon), 143, TEXT_ALIGN.RIGHT, toolTip=TOOLTIPS.REFERRALMANAGEMENTWINDOW_TABLE_EXPERIENCE),
      self.__makeSortingButton(ms(multiplyExpText + ' ' + infoIcon), 193, TEXT_ALIGN.CENTER, toolTipSpecial='refSysXPMultiplier'),
      self.__makeSortingButton('', 166, TEXT_ALIGN.CENTER))
 def __getSelectedDateText(self):
     if self.fortCtrl.getPermissions().canPlanAttack():
         if self._isFortFrozen():
             selectedDateText = text_styles.error(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_ATTACKIMPOSSIBLE))
         else:
             selectedDateText = text_styles.standard(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_SELECTDATE))
     else:
         selectedDateText = text_styles.standard(_ms(FORTIFICATIONS.FORTINTELLIGENCE_CLANDESCRIPTION_SELECTDATE_CANTATTACK))
     return selectedDateText
 def __playersLabel(self, playerCount, limit):
     if playerCount == 0:
         players = text_styles.standard(str(playerCount))
     else:
         players = text_styles.main(str(playerCount))
     resultCount = ''.join((players, text_styles.standard(' / {0} )'.format(limit))))
     legionariesIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_LEGIONNAIRE, 16, 16, -4, 0)
     leftBrace = text_styles.standard('( ')
     result = leftBrace + legionariesIcon + resultCount
     return result
 def __updateNotActivatedView(self):
     _ms = i18n.makeString
     titleText = text_styles.promoTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_TITLE))
     description = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_DESCRIPTION))
     conditionTitle = text_styles.middleTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONTITLE))
     firstConditionIcon = icons.checkmark()
     secondConditionIcon = icons.checkmark()
     conditionsText = text_styles.middleTitle(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS))
     fortConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_FORTLEVEL))
     defenceConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_DEFENCE))
     attackConditionsText = text_styles.main(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_CONDITIONS_ATTACK))
     firstConditionNotReady = ""
     secondConditionNotReady = ""
     if not self.__checkBaseLevel():
         firstConditionIcon = text_styles.standard("-")
         firstConditionNotReady = text_styles.error(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_ISNOTREADY))
     if not self.__checkPlayerCount():
         secondConditionIcon = text_styles.standard("-")
         secondConditionNotReady = text_styles.error(_ms(FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_ISNOTREADY))
     firstConditionMsg = text_styles.main(
         _ms(
             FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_BASELEVELCONDITION,
             level=fort_formatters.getTextLevel(g_fortCache.defenceConditions.minRegionLevel),
             isNotReady=firstConditionNotReady,
         )
     )
     secondConditionMsg = text_styles.main(
         _ms(
             FORTIFICATIONS.SETTINGSWINDOW_NOTACTIVATED_PLAYERCOUNTCONDITION,
             membersCount=BigWorld.wg_getNiceNumberFormat(g_fortCache.defenceConditions.minClanMembers),
             isNotReady=secondConditionNotReady,
         )
     )
     fortCondition = firstConditionMsg
     secondCondition = secondConditionMsg
     settingsBlockTop = self.__makeSettingsBlockVO(True)
     settingsBlockBottom = self.__makeSettingsBlockVO(False)
     result = {
         "titleText": titleText,
         "description": description,
         "conditionTitle": conditionTitle,
         "firstCondition": fortCondition,
         "secondCondition": secondCondition,
         "conditionsText": conditionsText,
         "fortConditionsText": fortConditionsText,
         "defenceConditionsText": defenceConditionsText,
         "attackConditionsText": attackConditionsText,
         "isBtnEnabled": self.__checkConditions(),
         "btnToolTipData": self.__getButtonToolTip(),
         "firstStatus": firstConditionIcon,
         "secondStatus": secondConditionIcon,
         "settingsBlockTop": settingsBlockTop,
         "settingsBlockBottom": settingsBlockBottom,
     }
     self.as_setDataForNotActivatedS(result)
 def __getBattleInfo(self, startTime, startTimeLeft):
     if startTimeLeft > time_utils.QUARTER_HOUR:
         if time_utils.isTimeNextDay(startTime):
             return text_styles.standard(i18n.makeString(FORTIFICATIONS.FORTINTELLIGENCE_DATE_TOMORROW))
         if time_utils.isTimeThisDay(startTime):
             return text_styles.standard(i18n.makeString(FORTIFICATIONS.FORTINTELLIGENCE_DATE_TODAY))
     else:
         if startTimeLeft > 0:
             return text_styles.standard(i18n.makeString(FORTIFICATIONS.FORTCLANBATTLELIST_RENDERCURRENTTIME_BEFOREBATTLE) + ' ')
         inBattleText = ' ' + i18n.makeString(FORTIFICATIONS.FORTCLANBATTLELIST_RENDERCURRENTTIME_ISBATTLE)
         return text_styles.error(icons.swords() + inBattleText)
     return ''
示例#16
0
    def __populateSeasonsData(self):
        seasons = []
        pqType = self.__navInfo.selectedPQType
        for seasonID, season in _getQuestsCache().getSeasons().iteritems():
            tiles = []
            for tile in sorted(season.getTiles().values(), key=operator.methodcaller('getID')):
                isCompleted, isUnlocked = tile.isAwardAchieved(), tile.isUnlocked()
                iconID = tile.getIconID()
                if isCompleted:
                    bgImgUp = event_items.getTileNormalUpIconPath(iconID)
                    bgImgOver = event_items.getTileNormalOverIconPath(iconID)
                else:
                    bgImgUp = event_items.getTileGrayUpIconPath(iconID)
                    bgImgOver = event_items.getTileGrayOverIconPath(iconID)
                vehicleBonus = tile.getVehicleBonus()
                if vehicleBonus is not None:
                    vehLevelStr = icons.makeImageTag(Vehicle.getLevelSmallIconPath(vehicleBonus.level), 16, 16, -3, 0)
                    vehTypeStr = icons.makeImageTag(Vehicle.getTypeSmallIconPath(vehicleBonus.type), 16, 16, -3, 0)
                    vehicleBonusLabel = i18n.makeString(QUESTS.PERSONAL_SEASONS_TILELABEL, type=vehTypeStr, level=vehLevelStr, name=vehicleBonus.userName)
                else:
                    vehicleBonusLabel = ''
                tokenIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_QUESTS_TOKEN16, 16, 16, -3, 0)
                if isUnlocked and not isCompleted and pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM:
                    gottenTokensCount, totalTokensCount = tile.getTokensCount()
                    progress = text_styles.standard(i18n.makeString(QUESTS.PERSONAL_SEASONS_TILEPROGRESS, count=text_styles.gold(str(gottenTokensCount)), total=str(totalTokensCount), icon=tokenIcon))
                else:
                    progress = ''
                if tile.isFullCompleted():
                    animation = event_items.getTileAnimationPath(iconID)
                else:
                    animation = None
                if pqType == QUESTS_ALIASES.SEASON_VIEW_TAB_RANDOM:
                    tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_TILE
                else:
                    tooltipType = TOOLTIPS_CONSTANTS.PRIVATE_QUESTS_FALLOUT_TILE
                tiles.append({'id': tile.getID(),
                 'isNew': isUnlocked and quest_settings.isPQTileNew(tile.getID()),
                 'label': text_styles.standard(vehicleBonusLabel),
                 'progress': progress,
                 'isCompleted': isUnlocked and isCompleted,
                 'enabled': isUnlocked,
                 'image': bgImgUp,
                 'imageOver': bgImgOver,
                 'animation': animation,
                 'tooltipType': tooltipType})

            seasons.append({'id': seasonID,
             'title': quests_fmts.getFullSeasonUserName(season),
             'tiles': tiles})

        self.as_setSeasonsDataS({'seasons': seasons})
        return
示例#17
0
 def __addAdditionalBlocks(self, playersCount, legionariesCount):
     headerClanPlayers = {'headerText': text_styles.standard(i18n.makeString(FORTIFICATIONS.FORTBATTLEROOM_LISTHEADER_CLANPLAYERS))}
     emptyRenders = {'emptyRender': True}
     legionariesIcon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_FORTIFICATION_LEGIONNAIRE, 16, 16, -4, 0)
     textResult = legionariesIcon + text_styles.standard(i18n.makeString(FORTIFICATIONS.FORTBATTLEROOM_LISTHEADER_LEGIONARIESPLAYERS))
     headerLegionasriesPlayers = {'headerText': textResult,
      'headerToolTip': TOOLTIPS.FORTIFICATION_BATTLEROOMLEGIONARIES}
     if playersCount > 0:
         self._list.insert(0, headerClanPlayers)
     if playersCount > 0 and legionariesCount > 0:
         self._list.append(emptyRenders)
     if legionariesCount > 0:
         self._list.append(headerLegionasriesPlayers)
 def __makeVacationData(self):
     alertMessage = ""
     blockBtnEnabled = True
     daysBeforeVacation = -1
     fort = self.fortCtrl.getFort()
     isVacationEnabled = fort.isVacationEnabled()
     inProcess, inCooldown = fort.getVacationProcessing()
     _, vacationEnd = fort.getVacationDate()
     blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNENABLED
     descriptionTooltip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONDESCRIPTION
     conditionPostfix = text_styles.standard(
         i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_BLOCKCONDITION_VACATIONNOTPLANNED)
     )
     if inProcess or inCooldown:
         blockBtnEnabled = False
         if fort.isOnVacation():
             blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED
             daysBeforeVacation = -1
         elif time_utils.getTimeDeltaFromNow(vacationEnd) != 0:
             blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLED
         else:
             cooldownEnd = vacationEnd + g_fortCache.vacationCooldownTime
             daysBeforeVacation = time_utils.getTimeDeltaFromNow(cooldownEnd) / time_utils.ONE_DAY + 1
             if daysBeforeVacation == 0:
                 blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDSBLDLESSADAY
                 daysBeforeVacation = -1
             else:
                 blockBtnToolTip = TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_VACATIONBTNDISABLEDNOTPLANNED
                 isVacationEnabled = False
     if isVacationEnabled:
         vacation = fort.getVacationDateTimeStr()
         if not self._isFortFrozen():
             if not fort.isOnVacation():
                 conditionPostfix = text_styles.neutral(vacation)
             else:
                 conditionPostfix = text_styles.success(vacation)
         else:
             conditionPostfix = text_styles.standard(vacation)
     conditionPrefix = text_styles.main(i18n.makeString(FORTIFICATIONS.settingswindow_blockcondition("vacation")))
     blockDescr = text_styles.standard(i18n.makeString(FORTIFICATIONS.settingswindow_blockdescr("vacation")))
     if alertMessage:
         alertMessage = icons.alert() + " " + alertMessage
     return {
         "blockBtnEnabled": blockBtnEnabled,
         "blockDescr": blockDescr,
         "blockCondition": conditionPrefix + " " + conditionPostfix,
         "alertMessage": alertMessage,
         "blockBtnToolTip": blockBtnToolTip,
         "daysBeforeVacation": daysBeforeVacation,
         "descriptionTooltip": descriptionTooltip,
     }
示例#19
0
 def __setData(self, club):
     ladderInfo = club.getLadderInfo()
     seasonDossier = club.getSeasonDossier()
     totalStats = seasonDossier.getTotalStats()
     battlesNumData, winsPercentData, attackDamageEfficiency, defenceDamageEfficiency = _makeStats(totalStats)
     battleCounts = totalStats.getBattlesCount()
     ladderIconSource = getLadderChevron256x256(ladderInfo.getDivision() if battleCounts else None)
     globalStats = seasonDossier.getGlobalStats()
     registeredDate = text_styles.main(BigWorld.wg_getShortDateFormat(club.getCreationTime()))
     registeredText = text_styles.standard(
         _ms(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_REGISTERED, date=registeredDate)
     )
     lastBattleText = _getLastBattleText(battleCounts, globalStats)
     bestTanksText = text_styles.stats(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_BESTTANKS)
     bestMapsText = text_styles.stats(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_BESTMAPS)
     notEnoughTanksText = notEnoughMapsText = text_styles.standard(
         CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOTENOUGHTANKSMAPS
     )
     bestTanks = _getVehiclesList(totalStats)
     bestMaps = _getMapsList(totalStats)
     noAwardsText = text_styles.stats(CYBERSPORT.STATICFORMATIONSUMMARYVIEW_NOAWARDS)
     ribbonSource = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_RIBBON
     self.as_setDataS(
         {
             "clubId": club.getClubDbID(),
             "placeText": _getPositionText(ladderInfo),
             "leagueDivisionText": _getDivisionText(ladderInfo),
             "ladderPtsText": _getLadderPointsText(ladderInfo),
             "bestTanksText": bestTanksText,
             "bestMapsText": bestMapsText,
             "notEnoughTanksText": notEnoughTanksText,
             "notEnoughMapsText": notEnoughMapsText,
             "registeredText": registeredText,
             "lastBattleText": lastBattleText,
             "ladderIconSource": ladderIconSource,
             "noAwardsText": noAwardsText,
             "ribbonSource": ribbonSource,
             "battlesNumData": battlesNumData,
             "winsPercentData": winsPercentData,
             "attackDamageEfficiencyData": attackDamageEfficiency,
             "defenceDamageEfficiencyData": defenceDamageEfficiency,
             "bestTanks": bestTanks,
             "notEnoughTanksTFVisible": not len(bestTanks),
             "bestMaps": bestMaps,
             "notEnoughMapsTFVisible": not len(bestMaps),
             "achievements": _makeAchievements(seasonDossier),
             "bestTanksGroupWidth": BEST_TANKS_GROUP_WIDTH,
             "bestMapsGroupWidth": BEST_MAPS_GROUP_WIDTH,
         }
     )
     return
 def __prepareOrderInfo(self, increment = False, orderCount = 0, orderLevel = 1):
     result = {}
     if self.intBuildingID == FORT_BUILDING_TYPE.MILITARY_BASE:
         if increment:
             building_bonus = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=fort_formatters.getTextLevel(min(self.__baseBuildingLevel + 1, MAX_FORTIFICATION_LEVEL)))
             defresDescr = ''.join((text_styles.neutral(building_bonus + ' '), text_styles.main(i18n.makeString(FORTIFICATIONS.BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING))))
         else:
             building_bonus = i18n.makeString(FORTIFICATIONS.BUILDINGPOPOVER_HEADER_LEVELSLBL, buildLevel=fort_formatters.getTextLevel(self.__baseBuildingLevel))
             defresDescr = ''.join((text_styles.standard(building_bonus + ' '), text_styles.standard(i18n.makeString(FORTIFICATIONS.BUILDINGS_MODERNIZATIONDESCR_BASE_BUILDING))))
     else:
         orderTypeID = self.fortCtrl.getFort().getBuildingOrder(self.intBuildingID)
         _, _, foundedLevel, orderData = self.fortCtrl.getFort().getOrderData(orderTypeID)
         if increment:
             bodyStyle = text_styles.main
             bonusStyle = text_styles.neutral
             foundedLevel += 1
             _, _, _, orderData = self.fortCtrl.getFort().getOrderData(orderTypeID, foundedLevel)
             textPadding = '     '
         else:
             bodyStyle = text_styles.standard
             bonusStyle = text_styles.standard
             textPadding = ''
         if orderTypeID == FORT_ORDER_TYPE.SPECIAL_MISSION:
             awardText = textPadding + i18n.makeString(FORTIFICATIONS.ORDERS_SPECIALMISSION_POSSIBLEAWARD) + ' '
             bonusDescr = i18n.makeString(FORTIFICATIONS.orders_specialmission_possibleaward_description_level(foundedLevel))
             defresDescr = ''.join((bonusStyle(awardText), bodyStyle(bonusDescr)))
         elif orderTypeID in FORT_ORDER_TYPE.CONSUMABLES:
             battleOrder = FortOrder(orderTypeID, level=orderLevel)
             defresDescr = fort_formatters.getBonusText(textPadding, self.__uid, ctx=dict(battleOrder.getParams()), textsStyle=(bonusStyle, bodyStyle))
         else:
             colorStyle = (bonusStyle, bodyStyle)
             bonus = str(abs(orderData.effectValue))
             defresDescr = fort_formatters.getBonusText('%s+%s%%' % (textPadding, bonus), self.__uid, colorStyle)
     result['ordersCount'] = orderCount
     result['description'] = defresDescr
     result['buildingType'] = self.__uid
     result['showAlertIcon'] = False
     isCombatOrderBuilding = self.__uid in [FORTIFICATION_ALIASES.FORT_ARTILLERY_SHOP_BUILDING, FORTIFICATION_ALIASES.FORT_BOMBER_SHOP_BUILDING]
     result['descriptionLink'] = increment and isCombatOrderBuilding
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         order = self.fortCtrl.getFort().getOrder(self._buildingDescr.typeRef.orderType)
         result['iconSource'] = order.icon
         result['iconLevel'] = order.level if not increment else order.level + 1
     if increment and self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         result['infoIconSource'] = RES_ICONS.MAPS_ICONS_LIBRARY_INFORMATIONICON
         toolTipData = {}
         toolTipData['header'] = i18n.makeString(TOOLTIPS.FORTIFICATION_DEFRESICONINFO_HEADER)
         toolTipData['body'] = i18n.makeString(TOOLTIPS.FORTIFICATION_DEFRESICONINFO_BODY, testData='test py var')
         result['infoIconToolTipData'] = toolTipData
     return result
 def _makeInviteStateString(self, item):
     status = item.getStatus()
     if status == CLAN_INVITE_STATES.ACTIVE:
         return text_styles.standard(self.__formatActiveStateString(item))
     if status == CLAN_INVITE_STATES.ACCEPTED:
         return text_styles.success(_ms(CLANS.CLANINVITESWINDOW_STATUS_ACCEPTED))
     if status == CLAN_INVITE_STATES.DECLINED:
         return text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_STATUS_DECLINED))
     if status == CLAN_INVITE_STATES.EXPIRED:
         return text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_STATUS_EXPIRED))
     if status == CLAN_INVITE_STATES.EXPIRED_RESENT or status == CLAN_INVITE_STATES.DECLINED_RESENT:
         return text_styles.standard(_ms(CLANS.CLANINVITESWINDOW_STATUS_SENT))
     if status == CLAN_INVITE_STATES.ERROR:
         return text_styles.error(_ms(CLANS.CLANINVITESWINDOW_STATUS_ERROR))
     return ''
 def _update(self):
     prefix = i18n.makeString(FORTIFICATIONS.FORTTRANSPORTCONFIRMATIONWINDOW_MAXTRANSPORTINGSIZELABEL)
     stdText = text_styles.standard(prefix)
     defResText = fort_formatters.getDefRes(self.getTransportingSize(), True)
     self.as_setMaxTransportingSizeS(stdText + defResText)
     clockIcon = icons.clock()
     time = time_formatters.getTimeDurationStr(self.fortCtrl.getFort().getTransportationLevel().cooldownTime)
     ctx = {'estimatedTime': time}
     estimatedTextString = i18n.makeString(FORTIFICATIONS.FORTTRANSPORTCONFIRMATIONWINDOW_TRANSPORTINGFOOTERTEXT, **ctx)
     estimatedText = text_styles.standard(estimatedTextString)
     self.as_setFooterTextS(clockIcon + estimatedText)
     data = self.__buildData()
     self.as_setDataS(data)
     isFirstTransporting = self._isTutorial()
     self.as_enableForFirstTransportingS(isFirstTransporting)
示例#23
0
    def __createBonusesStr(self, bonuses):
        result = []
        for bnsId, bnsType in bonuses:
            if bnsType in _ARTEFACT_TYPES:
                bnsTypeStr = ""
                if bnsType == _EQUIPMENT:
                    bnsTypeStr = TOOLTIPS.VEHICLE_EQUIPMENTS
                if bnsType == _OPTION_DEVICE:
                    bnsTypeStr = TOOLTIPS.VEHICLE_DEVICES
                result.append(
                    text_styles.main(
                        _ms(
                            TOOLTIPS.VEHICLEPARAMS_BONUS_ARTEFACT_TEMPLATE,
                            name=_ms("#artefacts:%s/name" % bnsId),
                            type=text_styles.standard(bnsTypeStr),
                        )
                    )
                )
            elif bnsType == _SKILL_BONUS_TYPE:
                result.append(
                    text_styles.main(
                        _ms(
                            TOOLTIPS.VEHICLEPARAMS_BONUS_SKILL_TEMPLATE,
                            name=_ms(ITEM_TYPES.tankman_skills(bnsId)),
                            type=text_styles.standard(_ms(TOOLTIPS.VEHICLEPARAMS_SKILL_NAME)),
                        )
                    )
                )
            elif bnsType == _ROLE_BONUS_TYPE:
                result.append(
                    text_styles.main(
                        _ms(
                            "#tooltips:vehicleParams/bonus/role/template",
                            name=_ms("#tooltips:vehicleParams/bonus/tankmanLevel/%s" % bnsId),
                        )
                    )
                )
            elif bnsType == _EXTRA_BONUS_TYPE:
                result.append(
                    text_styles.main(
                        _ms(
                            "#tooltips:vehicleParams/bonus/role/template",
                            name=_ms("#tooltips:vehicleParams/bonus/extra/%s" % bnsId),
                        )
                    )
                )

        return "\n".join(result)
    def __updateData(self):
        fort = self.fortCtrl.getFort()
        extra = self.unitFunctional.getExtra()
        result = []
        activeConsumes = dict(((otID, slotIdx) for slotIdx, (otID, level) in extra.getConsumables().iteritems()))
        for orderTypeID in constants.FORT_ORDER_TYPE.CONSUMABLES:
            orderItem = fort.getOrder(orderTypeID)
            building = fort.getBuilding(orderItem.buildingID)
            isBuildingReady = building is not None
            isSelected = orderTypeID in activeConsumes
            isSelectedInThisSlot = isSelected and activeConsumes[orderTypeID] == self.__slotIdx
            isConsumableEnabled = isSelectedInThisSlot or not isSelected and orderItem.count > 0
            showArsenalIcon = isBuildingReady and not isSelected
            if isSelectedInThisSlot:
                returnBtnLabel = FORTIFICATIONS.ORDERSELECTPOPOVER_RETURNBTNLABEL
            else:
                returnBtnLabel = ''
            orderLevelLabel = text_styles.main(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_ORDERLEVEL, orderLevel=fort_formatters.getTextLevel(orderItem.level)))
            if not isBuildingReady:
                icon = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_REDNOTAVAILABLE, 16, 16, -2, 0)
                description = '%s %s' % (icon, text_styles.error(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_NOTAVAILABLE)))
                orderCountText = ''
            elif not isSelected:
                description = orderLevelLabel
                if orderItem.count:
                    orderCountText = text_styles.standard(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_ORDERCOUNT, orderNumber=text_styles.stats(str(orderItem.count))))
                else:
                    orderCountText = text_styles.standard(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_ORDERCOUNT, orderNumber=text_styles.error(str(orderItem.count))))
            else:
                if isSelectedInThisSlot:
                    description = ''
                else:
                    description = orderLevelLabel
                icon = icons.nut()
                orderCountText = icon + text_styles.success(_ms(FORTIFICATIONS.ORDERSELECTPOPOVER_SELECTED))
            result.append({'orderID': orderTypeID,
             'orderIconSrc': orderItem.icon,
             'headerText': text_styles.middleTitle(_ms(orderItem.userName)),
             'descriptionText': description,
             'orderCountText': orderCountText,
             'isEnabled': isConsumableEnabled,
             'isSelected': isSelectedInThisSlot,
             'showArsenalIcon': showArsenalIcon,
             'returnBtnLabel': returnBtnLabel,
             'orderLevel': orderItem.level})

        self.as_setDataS({'orders': result})
        return
示例#25
0
 def construct(self):
     block = []
     isClanLock = self.vehicle.clanLock or None
     isDisabledInRoaming = self.vehicle.isDisabledInRoaming
     if isClanLock or isDisabledInRoaming:
         return block
     else:
         if self.configuration.node is not None:
             result = self.__getTechTreeVehicleStatus(self.configuration, self.vehicle)
         else:
             result = self.__getVehicleStatus(self.configuration.showCustomStates, self.vehicle)
         if result is not None:
             statusLevel = result['level']
             if statusLevel == Vehicle.VEHICLE_STATE_LEVEL.INFO:
                 headerFormatter = text_styles.statInfo
             elif statusLevel == Vehicle.VEHICLE_STATE_LEVEL.CRITICAL:
                 headerFormatter = text_styles.critical
             elif statusLevel == Vehicle.VEHICLE_STATE_LEVEL.WARNING:
                 headerFormatter = text_styles.warning
             elif statusLevel == Vehicle.VEHICLE_STATE_LEVEL.RENTED:
                 headerFormatter = text_styles.warning
             else:
                 LOG_ERROR('Unknown status type "' + statusLevel + '"!')
                 headerFormatter = text_styles.statInfo
             header = headerFormatter(result['header'])
             text = result['text']
             if text is not None and len(text) > 0:
                 block.append(formatters.packTextBlockData(text=header))
                 block.append(formatters.packTextBlockData(text=text_styles.standard(text)))
             else:
                 block.append(formatters.packAlignedTextBlockData(header, BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER))
         return block
 def __playersLabel(self):
     concat = " / {0}".format(self.__limitFixedPlayers)
     playerCount = len(self.__fixedPlayers)
     formatter = text_styles.neutral
     if playerCount == 0:
         formatter = text_styles.standard
     return "".join((formatter(str(playerCount)), text_styles.standard(concat)))
示例#27
0
def _makeMapVO(idx, mapID, mapInfo):
    label = str(idx + 1) + '.'
    mapName = text_styles.main(getArenaFullName(mapID))
    winsEfficiency = mapInfo.wins / float(mapInfo.battlesCount) * 100
    winsEfficiencyStr = BigWorld.wg_getNiceNumberFormat(winsEfficiency) + '%'
    return {'label': text_styles.standard(label + ' ' + mapName),
     'value': text_styles.stats(winsEfficiencyStr)}
示例#28
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
             need = price - money
             need = need.toNonNegative()
             defPrice = shell.defaultAltPrice or shell.defaultPrice
             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 price.gold > 0:
                 block.append(formatters.packTextBlockData(text=text_styles.standard(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR), padding=formatters.packPadding(left=81 + self.leftPadding)))
                 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 __setDetails(self, unitID, vo, clubExtraData = None):
     if clubExtraData is not None:
         linkage = CYBER_SPORT_ALIASES.COMMNAD_DETAILS_LINKAGE_JOIN_TO_STATIC_AS_LEGIONARY
         icon = None
         name = clubExtraData.clubName
         clubID = clubExtraData.clubDBID
         division = clubExtraData.divisionID
         description = vo['description']
         self.requestClubEmblem64x64(clubID, clubExtraData.getEmblem64x64(), partial(self.__onClubEmblem64x64Received, unitID))
         buttonLabel = CYBERSPORT.WINDOW_UNITLISTVIEW_ENTERBTN_LEGIONARY
         buttonInfo = CYBERSPORT.WINDOW_UNITLISTVIEW_ENTERTEXT_LEGIONARY
         buttonTooltip = TOOLTIPS.CYBERSPORT_UNITLIST_JOINTOSTATICASLEGIONARY
         if self.clubsState.getStateID() == CLIENT_CLUB_STATE.HAS_CLUB and self.clubsState.getClubDbID() == clubID:
             buttonLabel = CYBERSPORT.WINDOW_UNITLISTVIEW_ENTERBTN_MEMBER
             buttonInfo = CYBERSPORT.WINDOW_UNITLISTVIEW_ENTERTEXT_MEMBER
             buttonTooltip = None
         vo.update({'joinBtnLabel': buttonLabel,
          'joinInfo': text_styles.standard(_ms(buttonInfo)),
          'joinBtnTooltip': buttonTooltip,
          'rallyInfo': {'icon': icon,
                        'name': text_styles.highTitle(name),
                        'profileBtnLabel': CYBERSPORT.RALLYINFO_PROFILEBTN_LABEL,
                        'profileBtnTooltip': TOOLTIPS.RALLYINFO_PROFILEBTN,
                        'description': text_styles.main(description),
                        'ladderIcon': getLadderChevron64x64(division),
                        'id': clubID,
                        'showLadder': True}})
         self.as_setDetailsS({'viewLinkage': linkage,
          'data': vo})
     else:
         linkage = CYBER_SPORT_ALIASES.COMMNAD_DETAILS_LINKAGE_JOIN_TO_NONSTATIC
         self.as_setDetailsS({'viewLinkage': linkage,
          'data': vo})
     self.__updateVehicleLabel()
     return
示例#30
0
    def __aggregateBonusesInfo(self, singleBonusData):
        bonusVOs = {}
        for cType in CUSTOMIZATION_TYPE.ALL:
            if not singleBonusData[cType]:
                continue
            bonusVOs[cType] = []
            for cItemData in singleBonusData[cType]:
                if cItemData['isApplied'] and not self.__hasAppliedElements:
                    self.__hasAppliedElements = True
                cItem = cItemData['available']
                cInstalledItem = cItemData['installed']
                bonusDescription = cItem.qualifier.getDescription()
                if cItemData['isApplied']:
                    durationInfo = ''
                    powerFormatter = text_styles.bonusAppliedText
                    titleFormatter = text_styles.bonusAppliedText
                else:
                    powerFormatter = text_styles.stats
                    titleFormatter = text_styles.main
                    if cItem.isInDossier:
                        durationInfo = ' ({0})'.format(_ms('#vehicle_customization:bonusPanel/tooltip/duration/0'))
                    else:
                        durationInfo = ' ({0})'.format(_ms('#vehicle_customization:bonusPanel/tooltip/duration/1', numberOfDaysLeft=cInstalledItem.numberOfDaysLeft))
                power = '+{0}%{1}'.format(cItem.qualifier.getValue(), '*' if bonusDescription is not None else '')
                singleBonus = {'power': powerFormatter(power),
                 'title': '{0}{1}'.format(titleFormatter(cItem.getName()), durationInfo),
                 'isTemporarily': bonusDescription is not None}
                if bonusDescription is not None:
                    singleBonus['description'] = text_styles.standard(bonusDescription)
                bonusVOs[cType].append(singleBonus)

        return bonusVOs
示例#31
0
 def _makeBoosterVO(self, booster):
     isPurchaseEnabled, _ = booster.mayPurchase(self.__balance)
     btnTooltip = makeTooltip(None,
                              _ms(TOOLTIPS.BOOSTER_ACTIVEBTN_DISABLED_BODY)
                              ) if not isPurchaseEnabled else ''
     priceState = self.__getPriceState(isPurchaseEnabled)
     itemPrice = booster.buyPrices.itemPrice
     return {
         'id':
         booster.boosterID,
         'actionBtnEnabled':
         isPurchaseEnabled,
         'actionBtnTooltip':
         btnTooltip,
         'headerText':
         text_styles.middleTitle(booster.fullUserName),
         'descriptionText':
         text_styles.main(booster.description),
         'addDescriptionText':
         booster.getExpiryDateStr(),
         'actionBtnLabel':
         _ms(MENU.BOOSTERSWINDOW_BOOSTERSTABLERENDERER_BUYBTNLABEL),
         'tooltip':
         TOOLTIPS_CONSTANTS.BOOSTERS_SHOP,
         'boosterSlotVO':
         _makeBoosterSlotVO(booster, DEFAULT_SHOP_COUNT),
         'priceText':
         text_styles.standard(MENU.SHOP_TABLE_BUYACTIONOR),
         'creditsPriceState':
         priceState,
         'goldPriceState':
         priceState,
         'actionPriceData':
         self.__getActionVO(booster),
         'actionStyle':
         ACTION_PRICE_CONSTANTS.STATE_ALIGN_TOP,
         'rendererState':
         BOOSTER_CONSTANTS.RENDERER_STATE_SHOP,
         'price': {
             'oldPrice': itemPrice.defPrice.toMoneyTuple(),
             'newPrice': itemPrice.price.toMoneyTuple()
         }
     }
 def __updateStatus(self):
     prefix = i18n.makeString(FORTIFICATIONS.SETTINGSDEFENCEHOURPOPOVER_DEFENCEHOURTITLE)
     prefix = text_styles.highTitle(prefix)
     if self._isFortFrozen():
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_FREEZED)
         icon = RES_ICONS.MAPS_ICONS_LIBRARY_ERRORICON_1
         imageSource = icons.makeImageTag(icon, 16, 16, -4, 0)
         currentStatus = text_styles.error(i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_FREEZED))
         currentStatus = imageSource + ' ' + currentStatus
     elif self.__defencePeriod:
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_ACTIVATED)
         currentStatus = ''.join((icons.checkmark(), text_styles.success(' ' + i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_ACTIVATED))))
     elif self.__checkConditions():
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_CANBEACTIVATED)
         currentStatus = ''.join((icons.alert(), text_styles.alert(' ' + i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_NOTACTIVATED))))
     else:
         toolTip = i18n.makeString(TOOLTIPS.FORTIFICATION_FORTSETTINGSWINDOW_STATUSSTRING_CANNOTBEACTIVATED)
         currentStatus = ''.join((icons.notAvailable(), text_styles.standard(' ' + i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_STATUSMSG_NOTAVAILABLE))))
     self.as_setMainStatusS(prefix, currentStatus, toolTip)
    def _populate(self):
        super(MissionsTokenPopover, self)._populate()
        mainQuest = self.eventsCache.getQuests()[self._questId]
        children = mainQuest.getChildren()[self._tokenId]

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

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

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

        self.as_setListDataProviderS(result)
        if result:
            descrText = ms(QUESTS.MISSIONS_TOKENPOPOVER_DESCR, name=text_styles.neutral(ms(self._token.getUserName())))
        else:
            descrText = ms(QUESTS.MISSIONS_TOKENPOPOVER_DESCR_SHOP, name=text_styles.neutral(ms(self._token.getUserName())))
        self.as_setStaticDataS({'headerText': text_styles.highTitle(ms(QUESTS.MISSIONS_TOKENPOPOVER_HEADER, name=ms(self._token.getUserName()))),
         'descrText': text_styles.main(descrText),
         'imageSrc': self._token.getImage(TOKEN_SIZES.MEDIUM),
         'buyBtnLabel': QUESTS.MISSIONS_TOKENPOPOVER_BUYBTN_LABEL,
         'buyBtnVisible': self._token.isOnSale() or mainQuest.isTokensOnSale()})
 def construct(self):
     block = list()
     if self.configuration.isAwardWindow:
         return block
     else:
         module = self.module
         inventoryVehicles = self.itemsCache.items.getVehicles(
             REQ_CRITERIA.INVENTORY).itervalues()
         totalInstalledVehicles = [
             x.shortUserName
             for x in module.getInstalledVehicles(inventoryVehicles)
         ]
         installedVehicles = totalInstalledVehicles[:
                                                    _MAX_INSTALLED_LIST_LEN]
         canNotBuyBlock = None
         if module.isHidden:
             canNotBuyBlock = [
                 self.__getCannotBuyBlock(module, self.configuration)
             ]
         if canNotBuyBlock is not None:
             block.append(
                 formatters.packBuildUpBlockData(
                     canNotBuyBlock,
                     padding=formatters.packPadding(top=-4,
                                                    bottom=-5,
                                                    right=_DEFAULT_PADDING),
                     gap=4))
         if installedVehicles:
             tooltipText = ', '.join(installedVehicles)
             if len(totalInstalledVehicles) > _MAX_INSTALLED_LIST_LEN:
                 hiddenVehicleCount = len(
                     totalInstalledVehicles) - _MAX_INSTALLED_LIST_LEN
                 hiddenTxt = '%s %s' % (backport.text(
                     R.strings.tooltips.suitableVehicle.hiddenVehicleCount(
                     )), text_styles.stats(hiddenVehicleCount))
                 tooltipText = '%s %s' % (tooltipText, hiddenTxt)
             block.append(
                 formatters.packTitleDescBlock(
                     title=text_styles.middleTitle(
                         backport.text(R.strings.tooltips.deviceFits.
                                       already_installed.header())),
                     desc=text_styles.standard(tooltipText)))
         return block
    def __setQuestTrackingData(self):
        questProgress = self.sessionProvider.shared.questProgress
        selectedQuest = questProgress.getSelectedQuest()
        setting = self.settingsCore.getSetting(QUESTS_PROGRESS.VIEW_TYPE)
        self.__isProgressTrackingEnabled = setting == QuestsProgressViewType.TYPE_STANDARD
        trackingData = []
        personalMissions = self.eventsCache.getPersonalMissions()
        for quest in sorted(questProgress.getInProgressQuests().itervalues(),
                            key=lambda q: q.getQuestBranch()):
            isSelected = quest == selectedQuest
            operation = personalMissions.getOperationsForBranch(
                quest.getQuestBranch())[quest.getOperationID()]
            trackingData.append({
                'eyeBtnVisible':
                self.__isProgressTrackingEnabled and isSelected,
                'selected':
                isSelected,
                'missionName':
                makeString(quest.getShortUserName()),
                'fullMissionName':
                makeString(quest.getUserName()),
                'operationName':
                makeString(operation.getShortUserName()),
                'vehicle':
                QUESTSPROGRESS.getOperationTrackingIcon(operation.getID()),
                'questID':
                quest.getID(),
                'onPause':
                quest.isOnPause
            })

        trackingStatus = ''
        if len(trackingData) > 1:
            trackingStatus = ''.join(
                (icons.makeImageTag(
                    RES_ICONS.MAPS_ICONS_LIBRARY_NOTIFICATIONS_OFF, 16, 16, -2,
                    0), ' ',
                 text_styles.standard(
                     PERSONAL_MISSIONS.QUESTPROGRESSTRACKING_TRACKINGSTATUS)))
        self.as_updateProgressTrackingS({
            'trackingStatus': trackingStatus,
            'trackingData': trackingData
        })
 def _getConditionBlock(self,
                        topValue=0,
                        fromPlaceValue=1,
                        placesCount=0,
                        condition=None,
                        conditionTop=None):
     if topValue > 0:
         strResID = conditionTop
         fromPlace = topValue + 1
     else:
         strResID = condition
         fromPlace = fromPlaceValue
     tillPlace = fromPlace + placesCount - 1
     return formatters.packTextBlockData(
         text_styles.standard(
             self._getConditionStr(strResID=strResID,
                                   topValue=topValue,
                                   fromPlace=fromPlace,
                                   tillPlace=tillPlace)))
 def __makeClanInfo(self):
     enemyClanDBID = g_clanCache.clanDBID
     tID = 'clanInfo%d' % enemyClanDBID
     self.__imageID = yield g_clanCache.getClanEmblemTextureID(enemyClanDBID, True, tID)
     creationDate = BigWorld.wg_getLongDateFormat(self.fortCtrl.getFort().getFortDossier().getGlobalStats().getCreationTime())
     clanTag = g_clanCache.clanTag
     clanTagLocal = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_CLANINFO_CLANTAG, clanTag=clanTag)
     clanTag = text_styles.highTitle(clanTagLocal)
     creationDateLocalize = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_CLANINFO_CREATIONDATE, creationDate=creationDate)
     creationDate = text_styles.neutral(creationDateLocalize)
     buildingsCount = len(self.fortCtrl.getFort().getBuildingsCompleted())
     buildingsCount = text_styles.neutral(buildingsCount)
     buildingsCountLocalize = i18n.makeString(FORTIFICATIONS.SETTINGSWINDOW_CLANINFO_BUILDINGSCOUNT, buildingsCount=str(buildingsCount))
     buildingsCountLocalize = text_styles.standard(buildingsCountLocalize)
     FortSettingsClanInfoVO = {'clanTag': clanTag,
      'clanIcon': self.__imageID,
      'creationDate': creationDate,
      'buildingCount': buildingsCountLocalize}
     self.as_setFortClanInfoS(FortSettingsClanInfoVO)
示例#38
0
 def __packBottomPanelBlock(self):
     title = text_styles.standard(VEH_COMPARE.VEHCONF_TOOLTIPS_CAMOINFO)
     img = RES_ICONS.MAPS_ICONS_LIBRARY_INFO
     if self._customCamo is False:
         title = text_styles.neutral(
             VEH_COMPARE.VEHCONF_TOOLTIPS_DEFCAMOINFO)
         img = RES_ICONS.MAPS_ICONS_LIBRARY_INFO_YELLOW
     return formatters.packImageTextBlockData(title=title,
                                              img=img,
                                              imgPadding={
                                                  'left': 25,
                                                  'top': 3
                                              },
                                              txtGap=-4,
                                              txtOffset=65,
                                              padding={
                                                  'top': -1,
                                                  'left': 7
                                              })
示例#39
0
 def _packBlocks(self, *args, **kwargs):
     blocks = super(FemaleTankmanAwardTooltipData,
                    self)._packBlocks(*args, **kwargs)
     _ms = i18n.makeString
     blocks.append(
         formatters.packBuildUpBlockData([
             formatters.packTextBlockData(
                 text_styles.main(
                     _ms(TOOLTIPS.
                         QUESTS_SEASONAWARD_FEMALETANKMAN_DESCRIPTION_PART1)
                 )),
             formatters.packTextBlockData(
                 text_styles.standard(
                     _ms(TOOLTIPS.
                         QUESTS_SEASONAWARD_FEMALETANKMAN_DESCRIPTION_PART2)
                 ))
         ],
                                         gap=11))
     return blocks
示例#40
0
 def __packQuestSlot(self, quest=None):
     ttHeader, ttBody, ttAttention, ttNote = (None, None, None, None)
     if quest is not None:
         tile = _getQuestsCache().getTiles()[quest.getTileID()]
         season = _getQuestsCache().getSeasons()[tile.getSeasonID()]
         isInProgress = True
         ttHeader = quest.getUserName()
         ttBody = quests_fmts.getFullTileUserName(season, tile)
         if quest.needToGetReward():
             icon = icons.makeImageTag(
                 RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16,
                 -3, 0)
             description = text_styles.neutral(
                 i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_GETAWARD,
                                 icon=icon))
             ttAttention = i18n.makeString(
                 TOOLTIPS.PRIVATEQUESTS_SLOT_MISSIONCOMPLETE_ATTENTION)
         else:
             description = text_styles.standard(
                 quests_fmts.getPQFullDescription(quest))
             ttNote = i18n.makeString(
                 TOOLTIPS.PRIVATEQUESTS_SLOT_MISSION_NOTE)
         title = text_styles.middleTitle(
             i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_TITLE,
                             questName=quest.getUserName()))
     else:
         title, isInProgress = '', False
         description = text_styles.disabled(
             i18n.makeString(QUESTS.PERSONAL_SEASONS_SLOTS_NODATA))
         ttHeader = i18n.makeString(
             TOOLTIPS.PRIVATEQUESTS_SLOT_EMPTY_HEADER)
         ttBody = i18n.makeString(TOOLTIPS.PRIVATEQUESTS_SLOT_EMPTY_BODY)
     return {
         'id': quest.getID() if quest else None,
         'title': title,
         'description': description,
         'inProgress': isInProgress,
         'completed': quest and quest.needToGetReward(),
         'ttHeader': ttHeader,
         'ttBody': ttBody,
         'ttNote': ttNote,
         'ttAttention': ttAttention
     }
示例#41
0
 def _packBlocks(self, *args, **kwargs):
     module = vehicles.g_cache.equipments()[args[0]]
     if module is None:
         return
     else:
         items = super(EquipmentsTooltipData, self)._packBlocks()
         leftPadding = 20
         rightPadding = 20
         topPadding = 20
         verticalPadding = 2
         innerBlockLeftPadding = 100
         headerBlockItem = [
             formatters.packBuildUpBlockData(
                 self.__constructHeaderBlock(module, leftPadding,
                                             innerBlockLeftPadding),
                 padding=formatters.packPadding(left=leftPadding,
                                                right=rightPadding,
                                                top=topPadding,
                                                bottom=verticalPadding))
         ]
         cooldownBlock = self.__constructCooldownBlock(
             module, verticalPadding, innerBlockLeftPadding)
         if cooldownBlock is not None:
             headerBlockItem.append(cooldownBlock)
         items.append(formatters.packBuildUpBlockData(headerBlockItem))
         items.append(
             formatters.packBuildUpBlockData(
                 self.__constructDescriptionBlock(module, leftPadding),
                 linkage=BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
                 padding=formatters.packPadding(left=leftPadding,
                                                right=rightPadding,
                                                top=verticalPadding,
                                                bottom=verticalPadding)))
         items.append(
             formatters.packTextBlockData(text=text_styles.standard(
                 backport.text(
                     R.strings.tooltips.battle_royale.artefact.source())),
                                          padding=formatters.packPadding(
                                              left=innerBlockLeftPadding,
                                              top=verticalPadding)))
         return items
示例#42
0
 def _packBlocks(self):
     serverSettings = dependency.instance(ILobbyContext).getServerSettings()
     pPrestigeLevel, pMetaLevel, pFamePts = self.epicMetaGameCtrl.getPlayerLevelInfo(
     )
     maxMetaLevel = self.epicMetaGameCtrl.getMaxPlayerLevel()
     maxPrestigeLevel = serverSettings.epicMetaGame.metaLevel.get(
         'maxPrestigeLevel', None)
     famePtsToProgress = self.epicMetaGameCtrl.getPointsProgessForLevel(
         pMetaLevel)
     percentage = float(pFamePts) / float(
         famePtsToProgress) * 100 if famePtsToProgress > 0 else 100
     block = super(EpicBattlesWidgetTooltip, self)._packBlocks()
     title = TOOLTIPS.EPICBATTLEWIDGET_HEADER
     desc = i18n.makeString(TOOLTIPS.EPICBATTLEWIDGET_DESC,
                            level=pMetaLevel)
     block.append(
         formatters.packTitleDescBlock(title=text_styles.highTitle(title),
                                       desc=text_styles.standard(desc)))
     if pMetaLevel == maxMetaLevel:
         if pPrestigeLevel == maxPrestigeLevel:
             block.append(
                 formatters.packTextBlockData(
                     TOOLTIPS.EPICBATTLEWIDGET_BODY_MAXMETALEVEL_MAXPRESTIGE
                 ))
         else:
             block.append(
                 formatters.packTextBlockData(
                     TOOLTIPS.EPICBATTLEWIDGET_BODY_MAXMETALEVEL_PRESTIGE))
     else:
         data = EpicBattlesWidgetTooltipVO(
             headline=EPIC_BATTLE.EPICBATTLESWIDGETTOOLTIP_FAMEPOINTS,
             description=EPIC_BATTLE.
             EPICBATTLESWIDGETTOOLTIP_FAMEPOINTSDESCRIPTION,
             progressText='{}{}'.format(
                 text_styles.stats(str(pFamePts) + ' / '),
                 str(famePtsToProgress)),
             barPercentage=percentage)._asdict()
         block.append(
             formatters.packBlockDataItem(
                 BLOCKS_TOOLTIP_TYPES.
                 TOOLTIP_META_LEVEL_PROGRESS_BLOCK_LINKAGE, data))
     return block
示例#43
0
def formatPingStatus(csisStatus,
                     isColorBlind,
                     isSelected,
                     pingStatus,
                     pingValue,
                     useBigSize=False):
    """
    
    :param csisStatus:
    :param isColorBlind:
    :param isSelected:
    :param pingStatus:
    :param pingValue:
    :param useBigSize: If True result str has 14 font size, otherwise - 11 font size
    :return:
    """
    if pingStatus == PING_STATUSES.REQUESTED:
        return None
    if csisStatus != HOST_AVAILABILITY.NOT_AVAILABLE and pingStatus != PING_STATUSES.UNDEFINED:
        if pingStatus == PING_STATUSES.LOW:
            formattedPing = text_styles.goodPing(pingValue)
        else:
            formattedPing = text_styles.main(
                pingValue) if isSelected else text_styles.standartPing(
                    pingValue)
    else:
        pingValue = _UNAVAILABLE_DATA_PLACEHOLDER
        pingStatus = PING_STATUSES.UNDEFINED
        formattedPing = text_styles.standard(pingValue)
    colorBlindName = ''
    if isColorBlind and pingStatus == PING_STATUSES.HIGH:
        colorBlindName = '_color_blind'
    pingStatusIcon = formatPingStatusIcon(
        RES_ICONS.maps_icons_pingstatus_stairs_indicator(
            str(pingStatus) + colorBlindName + '.png'))
    if useBigSize:
        return text_styles.concatStylesToSingleLine(text_styles.main(' '),
                                                    formattedPing,
                                                    pingStatusIcon)
    else:
        return text_styles.concatStylesToSingleLine(formattedPing, '',
                                                    pingStatusIcon)
示例#44
0
def showAcceptClanInviteDialog(clanName, clanAbbrev, callback):
    from gui import DialogsInterface
    DialogsInterface.showDialog(
        I18nConfirmDialogMeta(
            'clanConfirmJoining',
            messageCtx={
                'icon':
                icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICON,
                                   16, 16, -4, 0),
                'clanName':
                text_styles.stats(
                    i18n.makeString(
                        DIALOGS.CLANCONFIRMJOINING_MESSAGE_CLANNAME,
                        clanAbbr=clanAbbrev,
                        clanName=clanName)),
                'clanExit':
                text_styles.standard(
                    i18n.makeString(
                        DIALOGS.CLANCONFIRMJOINING_MESSAGE_CLANEXIT))
            }), callback)
示例#45
0
 def __constructDescr(self, skillLevel):
     block = []
     if skillLevel.longFilterAlert:
         blocks = [
             formatters.packTextBlockData(
                 text_styles.standard(skillLevel.longDescr)),
             formatters.packTextBlockData(
                 text_styles.alert(skillLevel.longFilterAlert))
         ]
         block.append(
             formatters.packBuildUpBlockData(
                 blocks=blocks,
                 layout=BLOCKS_TOOLTIP_TYPES.LAYOUT_VERTICAL))
     else:
         block.append(
             formatters.packTitleDescParameterWithIconBlockData(
                 title=text_styles.middleTitle(
                     backport.text(R.strings.tooltips.equipment.onUse())),
                 desc=text_styles.main(skillLevel.longDescr)))
     return block
示例#46
0
 def _makeBoosterVO(self, qBoosterInfo):
     questID, qUserName, booster, count = qBoosterInfo
     isBtnEnabled = questID is not None
     activateBtnLabel = MENU.BOOSTERSWINDOW_BOOSTERSTABLERENDERER_GOTOQUESTBTNLABEL
     addDescriptionText = ''
     btnTooltip = ''
     if qUserName is not None:
         btnTooltip = makeTooltip(None, _ms(TOOLTIPS.BOOSTER_QUESTLINKBTN_BODY, questName=qUserName))
         addDescriptionText = text_styles.standard(_ms(MENU.BOOSTERSWINDOW_BOOSTERSTABLERENDERER_QUESTFOROPEN, questName=qUserName))
     return {'id': booster.boosterID,
      'questID': str(questID) if questID else None,
      'actionBtnEnabled': isBtnEnabled,
      'actionBtnTooltip': btnTooltip,
      'headerText': text_styles.middleTitle(booster.fullUserName),
      'descriptionText': text_styles.main(booster.description),
      'addDescriptionText': addDescriptionText,
      'actionBtnLabel': _ms(activateBtnLabel),
      'tooltip': TOOLTIPS_CONSTANTS.BOOSTERS_QUESTS,
      'boosterSlotVO': _makeBoosterSlotVO(booster, count),
      'rendererState': BOOSTER_CONSTANTS.RENDERER_STATE_DEFAULT}
 def construct(self):
     module = self.module
     title = module.userName
     desc = R.strings.tooltips.battleBooster.crew() if module.isCrewBooster(
     ) else R.strings.tooltips.battleBooster.optionalDevice()
     overlayPadding = formatters.packPadding(
         top=SLOT_HIGHLIGHT_TYPES.TOOLTIP_BIG_OVERLAY_PADDING_TOP,
         left=SLOT_HIGHLIGHT_TYPES.TOOLTIP_BIG_OVERLAY_PADDING_LEFT)
     headerText = formatters.packTitleDescBlock(
         title=text_styles.highTitle(title),
         desc=text_styles.standard(backport.text(desc)),
         gap=-3,
         padding=formatters.packPadding(top=-6))
     headerImage = formatters.packItemTitleDescBlockData(
         img=backport.image(self._getIcon()),
         imgPadding=formatters.packPadding(top=7),
         overlayPath=backport.image(self._getOverlay()),
         overlayPadding=overlayPadding,
         padding=formatters.packPadding(left=120))
     return [headerText, headerImage]
示例#48
0
def _packTableHeaderItem(tooltip,
                         id_,
                         buttonWidth,
                         label='',
                         icon=None,
                         sortOrder=0,
                         sortType='numeric',
                         inverted=False,
                         enabled=True):
    return {
        'label': text_styles.standard(label) if label else '',
        'buttonWidth': buttonWidth,
        'enabled': enabled,
        'inverted': inverted,
        'sortType': sortType,
        'toolTip': tooltip,
        'sortOrder': sortOrder,
        'id': id_,
        'iconSource': icon
    }
示例#49
0
 def __updateFilterStatuses(self):
     cache = self.fortCtrl.getPublicInfoCache()
     if cache:
         status = ''
         if cache.hasResults():
             if self.__getSelectedFilterType() == FORTIFICATION_ALIASES.CLAN_TYPE_FILTER_STATE_ALL:
                 if cache.getFilterType() == FORT_SCOUTING_DATA_FILTER.FILTER and cache.isFilterApplied():
                     status = FORTIFICATIONS.FORTINTELLIGENCE_FORTINTELFILTER_STATUS_APPLIEDFILTERANDCLAN
                 elif cache.isFilterApplied():
                     status = FORTIFICATIONS.FORTINTELLIGENCE_FORTINTELFILTER_STATUS_APPLIEDFILTER
                 elif cache.ifDefaultQueryResult():
                     status = FORTIFICATIONS.FORTINTELLIGENCE_FORTINTELFILTER_STATUS_ALL
             elif self.__getSelectedFilterType() == FORTIFICATION_ALIASES.CLAN_TYPE_FILTER_STATE_BOOKMARKS:
                 status = FORTIFICATIONS.FORTINTELLIGENCE_FORTINTELFILTER_STATUS_APPLIEDBOOKMARKEDFILTER
             elif self.__getSelectedFilterType() == FORTIFICATION_ALIASES.CLAN_TYPE_FILTER_STATE_LASTSEARCH:
                 status = FORTIFICATIONS.FORTINTELLIGENCE_FORTINTELFILTER_STATUS_APPLIEDLASTFOUNDFILTER
         self.as_setClanAbbrevS(cache.getAbbrevPattern())
         status = text_styles.standard(i18n.makeString(status))
         self.as_setFilterStatusS(status)
         self.__setFilterButtonStatus(not cache.isFilterApplied())
示例#50
0
 def requestMissionData(self, index):
     isObtained = not self._bootcamp.needAwarding()
     vehicleSelector = self.getComponent(QUESTS_ALIASES.MISSIONS_VEHICLE_SELECTOR_ALIAS)
     if vehicleSelector is not None:
         criteria = REQ_CRITERIA.VEHICLE.LEVELS([self._TANK_LEVEL]) | REQ_CRITERIA.IN_OWNERSHIP
         vehicleSelector.setCriteria(criteria, [])
     bTypesData = formatters.packMissionBonusTypeElements([ARENA_BONUS_TYPE.REGULAR])
     bTypes = self._COMMA.join([ iconData.iconLabel for iconData in bTypesData ])
     tooltipBody = makeString(QUESTS.MISSIONDETAILS_CONDITIONS_BATTLEBONUSTYPE_BODY, battleBonusTypes=bTypes)
     missionData = {'title': text_styles.promoSubTitle(backport.text(R.strings.bootcamp.quest.title())),
      'battleConditions': [{'rendererLinkage': MISSIONS_ALIASES.BATTLE_CONDITION,
                            'linkageBig': MISSIONS_ALIASES.ANG_GROUP_BIG_LINKAGE,
                            'isDetailed': True,
                            'data': [{'title': text_styles.promoSubTitle(backport.text(R.strings.bootcamp.quest.name())),
                                      'description': text_styles.highlightText(backport.text(R.strings.bootcamp.quest.condition())),
                                      'state': MISSIONS_ALIASES.NONE,
                                      'icon': backport.image(R.images.gui.maps.icons.quests.battleCondition.c_128.icon_battle_condition_battles_128x128()),
                                      'maxDescLines': self._LINES_IN_DESCR}],
                            'linkage': MISSIONS_ALIASES.ANG_GROUP_DETAILED_LINKAGE}],
      'statusLabel': text_styles.concatStylesWithSpace(icons.inProgress(), text_styles.standard(backport.text(R.strings.quests.missionDetails.missionsComplete(), count=text_styles.stats(self._MISSIONS_DONE), total=text_styles.standard(self._MISSIONS_COUNT)))),
      'awards': [{'label': text_styles.gold(backport.text(R.strings.menu.premium.packet.days3())),
                  'padding': self._AWARD_LABEL_PADDING,
                  'imgSource': backport.image(R.images.gui.maps.icons.quests.bonuses.big.premium_3()),
                  'align': LABEL_ALIGN.RIGHT,
                  'tooltip': TOOLTIPS.AWARDITEM_PREMIUM,
                  'obtainedImage': backport.image(R.images.gui.maps.icons.library.awardObtained()),
                  'isObtained': isObtained,
                  'obtainedImageOffset': self._OBTAINED_IMAGE_OFFSET}, {'label': text_styles.gold(self._GOLD_LABEL),
                  'padding': self._AWARD_LABEL_PADDING,
                  'imgSource': backport.image(R.images.gui.maps.icons.quests.bonuses.big.gold()),
                  'align': LABEL_ALIGN.RIGHT,
                  'tooltip': TOOLTIPS.AWARDITEM_GOLD,
                  'obtainedImage': backport.image(R.images.gui.maps.icons.library.awardObtained()),
                  'isObtained': isObtained,
                  'obtainedImageOffset': self._OBTAINED_IMAGE_OFFSET}],
      'background': 'default',
      'prebattleConditions': [formatters.packMissionPrebattleCondition(text_styles.main(bTypesData[0].iconLabel), ''.join([ iconData.icon for iconData in bTypesData ]), makeTooltip(QUESTS.MISSIONDETAILS_CONDITIONS_BATTLEBONUSTYPE, tooltipBody))],
      'uiDecoration': backport.image(R.images.gui.maps.icons.quests.decorations.default_750x264()),
      'statusTooltipData': {}}
     self.as_setMissionDataS(missionData)
     return
示例#51
0
def makeSortieVO(unitFunctional, unitIdx=None, app=None):
    fullData = unitFunctional.getUnitFullData(unitIdx=unitIdx)
    if fullData is None:
        return
    else:
        unit, unitState, unitStats, pInfo, slotsIter = fullData
        division = getDivisionNameByType(unit.getRosterTypeID())
        divisionTypeStr = i18n.makeString(
            FORTIFICATIONS.sortie_division_name(division))
        divisionStr = i18n.makeString(FORTIFICATIONS.SORTIE_ROOM_DIVISION)
        divisionLbl = ''.join((text_styles.standard(divisionStr),
                               text_styles.main(divisionTypeStr)))
        isPlayerCreator = pInfo.isCreator()
        canDoAction, restriction = unitFunctional.validateLevels(
            stats=unitStats)
        sumLevelsStr = makeTotalLevelLabel(unitStats, restriction)
        return {
            'isCommander':
            isPlayerCreator,
            'isFreezed':
            unitState.isLocked(),
            'hasRestrictions':
            unit.isRosterSet(ignored=settings.CREATOR_ROSTER_SLOT_INDEXES),
            'statusLbl':
            makeUnitStateLabel(unitState),
            'statusValue':
            unitState.isOpened(),
            'sumLevelsInt':
            unitStats.curTotalLevel,
            'sumLevels':
            sumLevelsStr,
            'sumLevelsError':
            canDoAction,
            'slots':
            _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app,
                          unitFunctional.getRosterSettings().getLevelsRange()),
            'description':
            unitFunctional.getCensoredComment(unitIdx=unitIdx),
            'divisionLbl':
            divisionLbl
        }
 def _packBlocks(self, *args, **kwargs):
     blocks = [
         formatters.packImageTextBlockData(
             title=text_styles.highTitle(
                 PERSONAL_MISSIONS.TANKWOMANTOOLTIPDATA_TITLE),
             desc=text_styles.standard(
                 PERSONAL_MISSIONS.TANKWOMANTOOLTIPDATA_SUBTITLE),
             img=RES_ICONS.MAPS_ICONS_QUESTS_BONUSES_BIG_TANKWOMAN),
         formatters.packBuildUpBlockData(
             [
                 formatters.packTextBlockData(
                     text_styles.middleTitle(
                         PERSONAL_MISSIONS.TANKWOMANTOOLTIPDATA_DESC_TITLE),
                     padding=formatters.packPadding(bottom=4)),
                 formatters.packTextBlockData(
                     text_styles.main(
                         PERSONAL_MISSIONS.TANKWOMANTOOLTIPDATA_DESC_BODY),
                     padding=formatters.packPadding(bottom=7))
             ],
             linkage=BLOCKS_TOOLTIP_TYPES.
             TOOLTIP_BUILDUP_BLOCK_WHITE_BG_LINKAGE,
             padding=formatters.packPadding(top=-7, bottom=-3)),
         formatters.packBuildUpBlockData([
             formatters.packTextBlockData(text_styles.middleTitle(
                 PERSONAL_MISSIONS.TANKWOMANTOOLTIPDATA_ADVANTAGES_TITLE),
                                          padding=formatters.packPadding(
                                              bottom=20)),
             self.__makeImageBlock(
                 RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_MAIN_100,
                 PERSONAL_MISSIONS.TANKWOMANTOOLTIPDATA_ADVANTAGES_NATION,
                 4, 16, 10),
             self.__makeImageBlock(
                 '../maps/icons/tankmen/skills/big/new_skill.png',
                 PERSONAL_MISSIONS.TANKWOMANTOOLTIPDATA_ADVANTAGES_NEWPERK),
             self.__makeImageBlock(
                 '../maps/icons/tankmen/skills/big/brotherhood.png',
                 PERSONAL_MISSIONS.
                 TANKWOMANTOOLTIPDATA_ADVANTAGES_BROTHERHOOD)
         ])
     ]
     return blocks
示例#53
0
 def setProxy(self, proxy, clanDossier):
     proxy.showWaiting()
     provinces = yield clanDossier.requestProvinces()
     showTreasury = clanDossier.isMyClan() and self.clanCtrl.getLimits(
     ).canSeeTreasury(clanDossier).success
     hasProvinces = len(provinces) > 0
     if self.isDisposed():
         return
     headers = self._prepareHeaders(showTreasury, hasProvinces)
     if showTreasury:
         listItemRendererLinkage = CLANS_ALIASES.CLAN_PROFILE_SELF_PROVINCE_RENDERER
     else:
         listItemRendererLinkage = CLANS_ALIASES.CLAN_PROFILE_PROVINCE_RENDERER
     data = {
         'rendererLinkage':
         listItemRendererLinkage,
         'headers':
         headers,
         'isListVisible':
         hasProvinces,
         'noDataText':
         text_styles.highTitle(_ms(CLANS.GLOBALMAPVIEW_NOPROVINCE)),
         'isNoDataTextVisible':
         not hasProvinces
     }
     if hasProvinces:
         data['defaultSortField'] = _SORT_IDS.PROVINCE
         data['defaultSortDirection'] = 'ascending'
     self.as_setDataS(data)
     self.__provincesDP = _ClanProfileProvinceDataProvider(showTreasury)
     self.__provincesDP.setFlashObject(self.as_getDPS())
     self.__provincesDP.buildList(provinces)
     self.as_setAdditionalTextS(
         hasProvinces and showTreasury,
         text_styles.standard(
             _ms(CLANS.GLOBALMAPVIEW_TOTALINCOME,
                 icon=icons.gold(),
                 value=text_styles.gold(
                     backport.getIntegralFormat(
                         self.__provincesDP.getCommonRevenue())))))
     proxy.hideWaiting()
 def _getUnavailableStatusFields(self, errorMsg):
     result = {'status': MISSIONS_STATES.NOT_AVAILABLE}
     if errorMsg != 'requirement':
         timeLeft = self.event.getNearestActivityTimeLeft()
         if timeLeft is not None:
             clockIcon = icons.makeImageTag(
                 RES_ICONS.MAPS_ICONS_LIBRARY_TIMERICON, 16, 16, -2, 8)
             startTimeLeft = timeLeft[0]
             timeStatusText = text_styles.standard(
                 _ms('#quests:missionDetails/status/notAvailable/%s' %
                     errorMsg,
                     time=self._getTillTimeString(startTimeLeft)))
             result['dateLabel'] = text_styles.concatStylesWithSpace(
                 clockIcon,
                 text_styles.error(QUESTS.MISSIONDETAILS_STATUS_WRONGTIME),
                 timeStatusText)
         if errorMsg in ('invalid_weekday', 'invalid_time_interval'):
             result['scheduleOrResetLabel'] = getScheduleLabel()
             result['scheduleTooltip'] = getInvalidTimeIntervalsTooltip(
                 self.event)
     return result
示例#55
0
 def _getDescriptionBlock(division, isLocked, isCompleted):
     descTitle = text_styles.middleTitle(
         backport.text(
             R.strings.ranked_battles.division.tooltip.desc.title()))
     descKey = 'current'
     if isLocked:
         descKey = 'locked'
     elif isCompleted:
         descKey = 'completed'
     if division.isQualification():
         descKey += 'Qual'
     elif division.isFinal():
         descKey += 'Final'
     descText = text_styles.standard(
         backport.text(
             R.strings.ranked_battles.division.tooltip.desc.dyn(
                 descKey).text()))
     return formatters.packImageTextBlockData(
         title=descTitle,
         desc=descText,
         txtPadding=formatters.packPadding(left=10))
示例#56
0
def getPersonalBonusLimitDailyTooltip(bonusCount, bonusLimit,
                                      maxCompleteCount):
    """
    Gets complex tooltip data about bonus limits
    bonusCount - mission's complete count
    bonusLimit - server definition, means that player several times can complete mission and get bonus per day
    """
    totalLabel = text_styles.standard(
        _ms(TOOLTIPS.QUESTS_COMPLETE_PROGRESSDAILY_DAILYCOUNT,
            totalCount=text_styles.neutral(maxCompleteCount),
            dailyCount=text_styles.neutral(max(bonusLimit - bonusCount, 0))))
    header = _ms(TOOLTIPS.QUESTS_COMPLETE_PROGRESSDAILY_HEADER)
    body = _ms(TOOLTIPS.QUESTS_COMPLETE_PERSONAL_PROGRESSDAILY_BODY,
               count=text_styles.neutral(bonusCount),
               totalCount=totalLabel,
               dailyTotalCount=text_styles.neutral(bonusLimit))
    return {
        'tooltip': makeTooltip(header=header, body=body),
        'isSpecial': False,
        'args': []
    }
def packTokenProgress(tokenId,
                      questId,
                      title,
                      image,
                      gotCount,
                      needCount,
                      isBigSize=False):
    if gotCount == needCount:
        tokensGot = text_styles.bonusAppliedText(gotCount)
    else:
        tokensGot = text_styles.stats(gotCount)
    tokensNeed = text_styles.standard(needCount)
    counterText = text_styles.disabled('{} / {}'.format(tokensGot, tokensNeed))
    return {
        'tokenId': tokenId,
        'questId': questId,
        'titleText': title,
        'isNormalSize': not isBigSize,
        'imgSrc': image,
        'countText': counterText
    }
示例#58
0
    def _packBonusBlock(self, customizationTypeData, title):
        subBlocks = [
            formatters.packTextBlockData(text=text_styles.middleTitle(
                _ms(title)),
                                         padding={'bottom': 2})
        ]
        for bonus in customizationTypeData:
            bonusPartDescription = text_styles.main(bonus['title'])
            if bonus['isTemporarily']:
                bonusPartDescription += '\n' + text_styles.standard(
                    '*' + bonus['description'])
            subBlocks.append(
                formatters.packTextParameterBlockData(
                    name=bonusPartDescription,
                    value=bonus['power'],
                    padding={'bottom': 8},
                    valueWidth=45))

        return formatters.packBuildUpBlockData(
            subBlocks, 0, BLOCKS_TOOLTIP_TYPES.TOOLTIP_BUILDUP_BLOCK_LINKAGE,
            {'left': 3})
示例#59
0
 def construct(self):
     shell = self.shell
     block = list()
     block.append(
         formatters.packImageTextBlockData(
             title=text_styles.highTitle(shell.userName),
             desc=text_styles.standard('#item_types:shell/kinds/' +
                                       shell.type),
             img=shell.icon,
             imgPadding=formatters.packPadding(left=7),
             txtGap=-4,
             txtOffset=100 - self.leftPadding))
     if self._params['isBasic']:
         block.append(
             formatters.packAlignedTextBlockData(
                 text=text_styles.neutral(TOOLTIPS.SHELL_BASIC),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_RIGHT,
                 padding=formatters.packPadding(right=self.rightPadding,
                                                top=-25,
                                                bottom=4)))
     return block
示例#60
0
    def __getBoosterPrice(self, booster):
        block = []
        money = self.itemsCache.items.stats.money
        showDelimiter = False
        leftPadding = 92
        for itemPrice in booster.buyPrices:
            currency = itemPrice.getCurrency()
            value = itemPrice.price.getSignValue(currency)
            defValue = itemPrice.defPrice.getSignValue(currency)
            needValue = value - money.getSignValue(currency)
            actionPercent = itemPrice.getActionPrc()
            if currency == Currency.GOLD and actionPercent > 0:
                leftActionPadding = 101 + self.leftPadding
            else:
                leftActionPadding = 81 + self.leftPadding
            if showDelimiter:
                block.append(formatters.packTextBlockData(text=text_styles.standard(TOOLTIPS.VEHICLE_TEXTDELIMITER_OR), padding=formatters.packPadding(left=leftActionPadding)))
            block.append(makePriceBlock(value, CURRENCY_SETTINGS.getBuySetting(currency), needValue if needValue > 0 else None, defValue if defValue > 0 else None, actionPercent, leftPadding=leftPadding))
            showDelimiter = True

        return block