Exemple #1
0
    def getInfo(self):
        info = _ms(EVENT_BOARDS.CONDITION_VEHICLE_CHOSEN)
        vehicles = self._event.getLimits().getVehiclesWhiteList()
        allCount = len(vehicles)
        available = 0
        availableVehicle = None
        items = self.itemsCache.items
        for vehCD in vehicles:
            if items.doesVehicleExist(vehCD):
                vehicle = items.getItemByCD(vehCD)
                if vehicle.isInInventory:
                    availableVehicle = vehicle
                    available += 1

        singleVehicle = allCount is 1
        vehicleMissing = available is 0
        if singleVehicle:
            vehicle = availableVehicle or items.getItemByCD(vehicles[0])
            vehicleName = formatVehicleNameWithTypeIcon(vehicle, 'html_templates:lobby/elen/objective')
            result = _ms(EVENT_BOARDS.CONDITION_VEHICLE_SINGLE, vehicle=vehicleName)
            if vehicleMissing:
                result = '{}. {}'.format(result, text_styles.error(_ms(EVENT_BOARDS.CONDITION_VEHICLE_MISSING)))
            else:
                result = '{}. {}'.format(result, _ms(EVENT_BOARDS.CONDITION_VEHICLE_EXIST))
        else:
            myCount = text_styles.error(str(available)) if vehicleMissing else text_styles.neutral(str(available))
            result = '{} {}/{}'.format(info, myCount, allCount)
        return text_styles.main(result)
 def _getUnavailableStatusFields(self, errorMsg):
     """
     Gets status fields data for unavailable mission state.
     Data used in mission card to display its unavailable state.
     """
     if errorMsg == 'requirements':
         isVehAvailable = self.event.vehicleReqs.isAnyVehicleAcceptable(
         ) or len(self.event.vehicleReqs.getSuitableVehicles()) > 0
         if not isVehAvailable:
             statusText = _ms(QUESTS.MISSIONDETAILS_STATUS_WRONGVEHICLE)
         else:
             statusText = _ms(QUESTS.MISSIONDETAILS_STATUS_NOTAVAILABLE)
         notAvailableIcon = icons.makeImageTag(
             RES_ICONS.MAPS_ICONS_LIBRARY_MARKER_BLOCKED, 14, 14, -2, 10)
         statusMsg = text_styles.concatStylesWithSpace(
             notAvailableIcon, text_styles.error(statusText))
         tooltipData = getDisabledRequirementTooltip(self.event)
     else:
         clockIcon = icons.makeImageTag(
             RES_ICONS.MAPS_ICONS_LIBRARY_TIMERICON, 16, 16, -2, 8)
         statusMsg = text_styles.concatStylesWithSpace(
             clockIcon,
             text_styles.error(QUESTS.MISSIONDETAILS_STATUS_NOTAVAILABLE))
         if errorMsg in ('invalid_weekday', 'invalid_time_interval'):
             tooltipData = getInvalidTimeIntervalsTooltip(self.event)
         else:
             tooltipData = self._getMissionDurationTooltipData()
     return {
         'statusLabel': statusMsg,
         'status': EVENT_STATUS.NOT_AVAILABLE,
         'statusTooltipData': tooltipData
     }
 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
Exemple #4
0
 def __getAddBottomLocked(self):
     quest = self.event
     pmCache = self._eventsCache.getPersonalMissions()
     curOperation = pmCache.getAllOperations().get(quest.getOperationID())
     vehType, minLevel, maxLevel = getChainVehTypeAndLevelRestrictions(curOperation, quest.getChainID())
     if quest.getQuestBranch() == PM_BRANCH.REGULAR:
         return text_styles.error(_ms(QUESTS.PERSONALMISSION_STATUS_ADDBOTTOMLOCKED_REGULAR, vehType=vehType, minLevel=minLevel, maxLevel=maxLevel))
     return text_styles.error(_ms(QUESTS.PERSONALMISSION_STATUS_ADDBOTTOMLOCKED_PM2, vehType=vehType, minLevel=minLevel, maxLevel=maxLevel)) if quest.getQuestBranch() == PM_BRANCH.PERSONAL_MISSION_2 else ''
def _formatInviteStatus(invitation):
    if invitation.isAccepted():
        return text_styles.success('#cybersport:InvitesAndRequestsWindow/accepted')
    if invitation.isDeclined():
        return text_styles.error('#cybersport:InvitesAndRequestsWindow/rejected')
    if invitation.isCancelled():
        return text_styles.error('#cybersport:InvitesAndRequestsWindow/cancelled')
    return ''
 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)
Exemple #7
0
def _formatInviteStatus(invitation):
    if invitation.isAccepted():
        return text_styles.success(
            '#cybersport:InvitesAndRequestsWindow/accepted')
    if invitation.isDeclined():
        return text_styles.error(
            '#cybersport:InvitesAndRequestsWindow/rejected')
    if invitation.isCancelled():
        return text_styles.error(
            '#cybersport:InvitesAndRequestsWindow/cancelled')
    return ''
Exemple #8
0
def getOperations(branch, currOperationID):
    _eventsCache = dependency.instance(IEventsCache)
    operations = []
    for oID, o in sorted(_eventsCache.getPersonalMissions().getOperationsForBranch(branch).iteritems(), key=operator.itemgetter(0)):
        state = PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE
        descr = text_styles.stats(PERSONAL_MISSIONS.OPERATIONS_UNLOCKED_DESC)
        title = text_styles.highTitle(o.getShortUserName())
        if o.isDisabled():
            state, _ = getPostponedOperationState(oID)
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        elif not o.isUnlocked():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        elif o.isFullCompleted():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_FULL_STATE
            descr = text_styles.bonusAppliedText(PERSONAL_MISSIONS.OPERATIONS_FULLYCOMPLETED_DESC)
        elif o.isAwardAchieved():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_STATE
            descr = text_styles.bonusAppliedText(PERSONAL_MISSIONS.OPERATIONS_COMPLETED_DESC)
        elif o.isInProgress():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_CURRENT_STATE
            descr = text_styles.neutral(PERSONAL_MISSIONS.OPERATIONS_CURRENT_DESC)
        elif not o.hasRequiredVehicles():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        if state != PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE:
            iconStateSource = RES_ICONS.getPersonalMissionOperationState(state)
        else:
            iconStateSource = None
        freeSheetIcon = ''
        freeSheetCounter = ''
        tokensPawned = o.getTokensPawnedCount()
        if tokensPawned:
            freeSheetIcon = AwardSheetPresenter.getIcon(AwardSheetPresenter.Size.X_16, o.getBranch())
            freeSheetCounter = text_styles.counter('x%d' % tokensPawned)
        if state == PERSONAL_MISSIONS_ALIASES.OPERATION_POSTPONED_STATE:
            tooltipAlias = TOOLTIPS_CONSTANTS.OPERATION_POSTPONED
        else:
            tooltipAlias = TOOLTIPS_CONSTANTS.OPERATION
        operationVO = {'title': title,
         'desc': descr,
         'iconSource': RES_ICONS.getPersonalMissionOperationImage(oID),
         'iconStateSource': iconStateSource,
         'freeSheetIconSource': freeSheetIcon,
         'freeSheetCounter': freeSheetCounter,
         'state': state,
         'isSelected': oID == currOperationID,
         'id': oID,
         'tooltipAlias': tooltipAlias}
        operations.append(operationVO)

    return operations
Exemple #9
0
 def _updateSetaledState(self):
     requestSentVisible = False
     sendRequestBtnVisible = True
     sendRequestBtnEnabled = True
     sendRequestTooltip = None
     reason = self.webCtrl.getLimits().canSendApplication(
         _ClanAdapter(self.__selectedClan)).reason
     if reason == CLIENT_CLAN_RESTRICTIONS.NO_RESTRICTIONS:
         pass
     elif reason == CLIENT_CLAN_RESTRICTIONS.OWN_CLAN:
         sendRequestBtnVisible = False
     elif reason == CLIENT_CLAN_RESTRICTIONS.ALREADY_IN_CLAN:
         sendRequestBtnVisible = False
     elif reason == CLIENT_CLAN_RESTRICTIONS.CLAN_IS_FULL:
         sendRequestBtnEnabled = False
         sendRequestTooltip = makeTooltip(
             CLANS.SEARCH_INFO_BANNED_TOOLTIP_HEADER,
             text_styles.error(_ms(CLANS.SEARCH_INFO_BANNED_TOOLTIP_BODY)))
     elif reason == CLIENT_CLAN_RESTRICTIONS.CLAN_INVITE_ALREADY_RECEIVED:
         sendRequestBtnEnabled = False
         sendRequestTooltip = CLANS.SEARCH_INFO_INVITEALREADYACHIEVED_TOOLTIP
     elif reason == CLIENT_CLAN_RESTRICTIONS.CLAN_APPLICATION_ALREADY_SENT:
         sendRequestBtnEnabled = False
         sendRequestTooltip = CLANS.SEARCH_INFO_REQUESTALREADYSENT_TOOLTIP
     elif reason == CLIENT_CLAN_RESTRICTIONS.SENT_INVITES_LIMIT_REACHED:
         sendRequestBtnEnabled = False
         sendRequestTooltip = CLANS.SEARCH_INFO_REQUESTSLIMITEXCEEDED_TOOLTIP
     elif reason == CLIENT_CLAN_RESTRICTIONS.CLAN_CONSCRIPTION_CLOSED:
         sendRequestBtnEnabled = False
         sendRequestTooltip = CLANS.SEARCH_INFO_REQUESTSARENOTACCEPTED_TOOLTIP
     elif reason == CLIENT_CLAN_RESTRICTIONS.FORBIDDEN_ACCOUNT_TYPE:
         sendRequestBtnEnabled = False
         sendRequestTooltip = makeTooltip(
             CLANS.SEARCH_INFO_FORBIDDENACCOUNTTYPE_TOOLTIP_HEADER,
             text_styles.error(
                 _ms(CLANS.SEARCH_INFO_FORBIDDENACCOUNTTYPE_TOOLTIP_BODY)))
     else:
         sendRequestBtnVisible = False
     self.as_setStateDataS({
         'requestSentVisible':
         requestSentVisible,
         'sendRequestBtnVisible':
         sendRequestBtnVisible,
         'sendRequestBtnEnabled':
         sendRequestBtnEnabled,
         'sendRequestTooltip':
         sendRequestTooltip,
         'alertIconVisible':
         sendRequestBtnVisible and not sendRequestBtnEnabled
     })
     return
def getOperations(currOperationID):
    operations = []
    for oID, o in sorted(events_helpers.getPersonalMissionsCache().
                         getOperations().iteritems(),
                         key=operator.itemgetter(0)):
        state = PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE
        descr = text_styles.stats(PERSONAL_MISSIONS.OPERATIONS_UNLOCKED_DESC)
        title = text_styles.highTitle(o.getShortUserName())
        if not o.isUnlocked():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        elif o.isFullCompleted():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_FULL_STATE
            descr = text_styles.bonusAppliedText(
                PERSONAL_MISSIONS.OPERATIONS_FULLYCOMPLETED_DESC)
        elif o.isAwardAchieved():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_COMPLETE_STATE
            descr = text_styles.bonusAppliedText(
                PERSONAL_MISSIONS.OPERATIONS_COMPLETED_DESC)
        elif o.isInProgress():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_CURRENT_STATE
            descr = text_styles.neutral(
                PERSONAL_MISSIONS.OPERATIONS_CURRENT_DESC)
        elif not o.hasRequiredVehicles():
            state = PERSONAL_MISSIONS_ALIASES.OPERATION_LOCKED_STATE
            descr = text_styles.error(PERSONAL_MISSIONS.OPERATIONS_LOCKED_DESC)
        if state != PERSONAL_MISSIONS_ALIASES.OPERATION_UNLOCKED_STATE:
            iconStateSource = RES_ICONS.getPersonalMissionOperationState(state)
        else:
            iconStateSource = None
        freeSheetIcon = ''
        freeSheetCounter = ''
        tokensPawned = o.getTokensPawnedCount()
        if tokensPawned:
            freeSheetIcon = RES_ICONS.MAPS_ICONS_PERSONALMISSIONS_SHEET_RECEIVED_SMALL
            freeSheetCounter = text_styles.counter('x%d' % tokensPawned)
        operationVO = {
            'title': title,
            'desc': descr,
            'iconSource': RES_ICONS.getPersonalMissionOperationImage(oID),
            'iconStateSource': iconStateSource,
            'freeSheetIconSource': freeSheetIcon,
            'freeSheetCounter': freeSheetCounter,
            'state': state,
            'isSelected': oID == currOperationID,
            'id': oID
        }
        operations.append(operationVO)

    return operations
Exemple #11
0
 def installCustomizationElement(self, idx):
     isContinue = True
     carouselItem = g_customizationController.carousel.items[idx]['object']
     cType = g_customizationController.carousel.currentType
     if carouselItem.isInDossier:
         if g_customizationController.carousel.slots.getInstalledItem(
         ).getNumberOfDaysLeft() > 0 and carouselItem.getIgrType(
         ) != IGR_TYPE.PREMIUM:
             slotItem = g_customizationController.carousel.slots.getSlotItem(
             )
             isContinue = yield DialogsInterface.showDialog(
                 getDialogReplaceElement(slotItem.getName(), cType))
         if carouselItem.numberOfDays is not None and not carouselItem.isReplacedByIGRItem:
             isContinue = yield DialogsInterface.showDialog(
                 self.__getInvoiceItemDialogMeta(
                     'temporary', cType, carouselItem, {
                         'willBeDeleted':
                         text_styles.error(
                             _ms('#dialogs:customization/install_invoice_item/will_be_deleted'
                                 ))
                     }))
         elif carouselItem.numberOfItems is not None:
             if carouselItem.numberOfItems > 1:
                 isContinue = yield DialogsInterface.showDialog(
                     self.__getInvoiceItemDialogMeta(
                         'permanent', cType, carouselItem,
                         {'numberLeft': carouselItem.numberOfItems - 1}))
             else:
                 isContinue = yield DialogsInterface.showDialog(
                     self.__getInvoiceItemDialogMeta(
                         'permanent_last', cType, carouselItem, {}))
     if isContinue:
         g_customizationController.carousel.applyItem(idx)
     return
Exemple #12
0
 def __getResourceToExchangeTxt(self, resToExchange):
     if resToExchange > 0:
         resource = BigWorld.wg_getIntegralFormat(resToExchange)
         resStr = self._getCurrencyFormat()(
             resource) + self._getCurrencyIconStr()
         return text_styles.error(
             self._makeString(I18N_NEEDITEMSTEXT_KEY, {'value': resStr}))
Exemple #13
0
 def _getStatusBlock(self, operation):
     _, postpone = missions_helper.getPostponedOperationState(
         operation.getID())
     return formatters.packBuildUpBlockData([
         formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesWithSpace(
                 icons.markerBlocked(-2),
                 text_styles.error(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE)),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=-5)),
         formatters.
         packAlignedTextBlockData(text=text_styles.concatStylesToSingleLine(
             text_styles.main(
                 TOOLTIPS.PERSONALMISSIONS_OPERATION_FOOTER_DESCR_POSTPONED
             ),
             icons.makeImageTag(RES_ICONS.getPersonalMissionOperationState(
                 PERSONAL_MISSIONS_ALIASES.OPERATION_POSTPONED_STATE),
                                width=24,
                                height=24,
                                vSpace=-9),
             text_styles.vehicleStatusCriticalText(postpone)),
                                  align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                                  padding=formatters.packPadding(bottom=14))
     ])
Exemple #14
0
 def __setTotalData(self, *_):
     cart = getTotalPurchaseInfo(self._purchaseItems)
     totalPriceVO = getItemPricesVO(cart.totalPrice)
     state = g_currentVehicle.getViewState()
     shortage = self.itemsCache.items.stats.money.getShortage(
         cart.totalPrice.price)
     inFormationAlert = ''
     if not state.isCustomizationEnabled():
         inFormationAlert = text_styles.concatStylesWithSpace(
             icons.markerBlocked(),
             text_styles.error(
                 VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_FORMATION_ALERT))
     self.as_setTotalDataS({
         'totalLabel':
         text_styles.highTitle(
             _ms(VEHICLE_CUSTOMIZATION.WINDOW_PURCHASE_TOTALCOST,
                 selected=cart.numSelected,
                 total=cart.numApplying)),
         'enoughMoney':
         getItemPricesVO(ItemPrice(shortage, shortage))[0],
         'inFormationAlert':
         inFormationAlert,
         'totalPrice':
         totalPriceVO[0]
     })
Exemple #15
0
 def _populate(self):
     super(SwitchPeripheryWindow, self)._populate()
     self.as_setImageS(
         RES_ICONS.MAPS_ICONS_WINDOWS_SWITCH_PERIPHERY_WINDOW_BG, 0)
     self.as_setWindowTitleS(_ms(DIALOGS.SWITCHPERIPHERYWINDOW_WINDOWTITLE))
     currentServer = connectionManager.serverUserName
     self.as_setTextS(
         _ms(self.__ctx.getHeader()),
         _ms(self.__ctx.getDescription(),
             server=text_styles.error(currentServer)))
     self._updateServersList()
     self.as_setButtonsS(
         [{
             'label': _ms(DIALOGS.SWITCHPERIPHERYWINDOW_BTNSWITCH),
             'btnLinkage': BUTTON_LINKAGES.BUTTON_NORMAL,
             'action': self._SWITCH_BTN_ACTION,
             'isFocused': True,
             'tooltip': ''
         }, {
             'label': _ms(DIALOGS.SWITCHPERIPHERYWINDOW_BTNCANCEL),
             'btnLinkage': BUTTON_LINKAGES.BUTTON_BLACK,
             'action': self._CLOSE_BTN_ACTION,
             'isFocused': False,
             'tooltip': ''
         }], TEXT_ALIGN.RIGHT, self._BTN_WIDTH)
 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 __getRules(self):
     topWinNum = self.rankedController.getRanksChanges(
         isLoser=False).count(1)
     topLoserNum = self.rankedController.getRanksChanges(
         isLoser=True).count(1)
     teamStr = text_styles.bonusAppliedText(
         RANKED_BATTLES.WELCOMESCREEN_POSITIVE_TEAM)
     descr = text_styles.hightlight(
         RANKED_BATTLES.WELCOMESCREEN_POSITIVE_BODY)
     rulePositive = {
         'image': RES_ICONS.getRankedPostBattleTopIcon(topWinNum),
         'description': descr.format(team=teamStr, topNumber=topWinNum)
     }
     if topLoserNum:
         teamStr = text_styles.error(
             RANKED_BATTLES.WELCOMESCREEN_NEGATIVE_TEAM)
         descr = text_styles.hightlight(
             RANKED_BATTLES.WELCOMESCREEN_NEGATIVE_BODY)
         ruleNegative = {
             'image': RES_ICONS.getRankedPostBattleLoseIcon(topLoserNum),
             'description': descr.format(team=teamStr,
                                         topNumber=topLoserNum)
         }
     else:
         ruleNegative = None
     return (rulePositive, ruleNegative)
Exemple #18
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
 def _getBuildingStr(self, order):
     buildingID = self.getBuildingUIDbyID(order.buildingID)
     building = i18n.makeString(FORTIFICATIONS.buildings_buildingname(buildingID))
     hasBuilding = order.hasBuilding
     if not hasBuilding:
         return text_styles.error(building)
     return building
Exemple #20
0
 def __getUnlockedStatusFields(self):
     quest = self.event
     operations = events_helpers.getPersonalMissionsCache().getOperations()
     operationID = quest.getOperationID()
     operation = operations.get(operationID)
     if not operation.isUnlocked():
         prevOperationID = max(operationID - 1, 0)
         prevOperation = operations.get(prevOperationID)
         statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVOPERATION_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVOPERATION_BODY)}
         statusLabel = text_styles.error(icons.markerBlocked() + ' ' + _ms(QUESTS.PERSONALMISSION_STATUS_LOCKEDBYPREVOPERATION, prevCampaign=prevOperation.getShortUserName()))
     else:
         statusTooltipData = {'tooltip': makeTooltip(header=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVMISSIONS_HEADER, body=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYPREVMISSIONS_BODY)}
         statusLabel = text_styles.error(icons.markerBlocked() + ' ' + _ms(QUESTS.PERSONALMISSION_STATUS_LOCKEDBYPREVMISSIONS))
     return {'addBottomStatusText': statusLabel,
      'status': MISSIONS_STATES.NOT_AVAILABLE,
      'bottomStatusTooltipData': statusTooltipData}
 def __getScheduleStr(self):
     if self._isDisabled:
         return text_styles.error(
             backport.text(_R_BATTLE_TYPES.epic.extra.frozen()))
     else:
         currentSeason = self.__epicController.getCurrentSeason()
         if currentSeason:
             if currentSeason.hasActiveCycle(
                     time_utils.getCurrentLocalServerTimestamp()):
                 scheduleStr = None
             else:
                 nextCycle = currentSeason.getNextCycleInfo(
                     time_utils.getCurrentLocalServerTimestamp())
                 if nextCycle is None:
                     nextCycle = currentSeason.getNextByTimeCycle(
                         time_utils.getCurrentLocalServerTimestamp())
                 if nextCycle:
                     nextCycleStartTime = backport.getDateTimeFormat(
                         nextCycle.startDate)
                     scheduleStr = backport.text(
                         _R_BATTLE_TYPES.epic.extra.startsAt(),
                         time=nextCycleStartTime)
                 else:
                     scheduleStr = None
         else:
             nextSeason = self.__epicController.getNextSeason()
             nextCycle = nextSeason.getNextByTimeCycle(
                 time_utils.getCurrentLocalServerTimestamp())
             if nextCycle:
                 startTime = backport.getDateTimeFormat(nextCycle.startDate)
                 scheduleStr = backport.text(
                     _R_BATTLE_TYPES.epic.extra.startsAt(), time=startTime)
             else:
                 scheduleStr = None
         return text_styles.main(scheduleStr) if scheduleStr else None
 def _populate(self):
     super(SwitchPeripheryWindow, self)._populate()
     self._serversDP = ServersDataProvider()
     self._serversDP.setFlashObject(self.as_getServersDPS())
     self.as_setImageS(
         RES_ICONS.MAPS_ICONS_WINDOWS_SWITCH_PERIPHERY_WINDOW_BG, 0)
     self.as_setWindowTitleS(_ms(DIALOGS.SWITCHPERIPHERYWINDOW_WINDOWTITLE))
     currentServer = connectionManager.serverUserName
     self.as_setTextS(
         _ms(self.__ctx.getHeader()),
         _ms(self.__ctx.getDescription(),
             server=text_styles.error(currentServer)))
     self._updateServersList()
     if not constants.IS_CHINA:
         if GUI_SETTINGS.csisRequestRate == REQUEST_RATE.ALWAYS:
             g_preDefinedHosts.startCSISUpdate()
         g_preDefinedHosts.onCsisQueryStart += self.__onServersUpdate
         g_preDefinedHosts.onCsisQueryComplete += self.__onServersUpdate
         g_preDefinedHosts.onPingPerformed += self.__onServersUpdate
     self.as_setButtonsS(
         [{
             'label': _ms(DIALOGS.SWITCHPERIPHERYWINDOW_BTNSWITCH),
             'btnLinkage': BUTTON_LINKAGES.BUTTON_NORMAL,
             'action': self._SWITCH_BTN_ACTION,
             'isFocused': True,
             'tooltip': ''
         }, {
             'label': _ms(DIALOGS.SWITCHPERIPHERYWINDOW_BTNCANCEL),
             'btnLinkage': BUTTON_LINKAGES.BUTTON_BLACK,
             'action': self._CLOSE_BTN_ACTION,
             'isFocused': False,
             'tooltip': ''
         }], TEXT_ALIGN.RIGHT, self._BTN_WIDTH)
Exemple #23
0
 def __getActionButtonStateVO(self):
     stateString = ''
     unitFunctional = self.unitFunctional
     pInfo = unitFunctional.getPlayerInfo()
     isInQueue = unitFunctional.getFlags().isInIdle()
     isEnabled = g_currentVehicle.isReadyToPrebattle() and not isInQueue
     playerReady = pInfo.isReady
     if not g_currentVehicle.isPresent():
         stateString = i18n.makeString('#cybersport:window/unit/message/vehicleNotSelected')
     elif not g_currentVehicle.isReadyToPrebattle():
         stateString = i18n.makeString('#cybersport:window/unit/message/vehicleNotValid')
     elif not playerReady:
         stateString = i18n.makeString(MESSENGER.DIALOGS_SQUAD_MESSAGE_GETREADY)
     elif g_eventsCache.isEventEnabled() and self.__isFallout is not None and self.__isFallout != g_currentVehicle.item.isEvent:
         stateString = error(MENU.CURRENTVEHICLESTATUS_NOTVALIDVEHICLE)
     elif playerReady and not isInQueue:
         stateString = i18n.makeString(MESSENGER.DIALOGS_SQUAD_MESSAGE_GETNOTREADY)
     stateString = TextManager.getText(TEXT_MANAGER_STYLES.MAIN_TEXT if isEnabled else TEXT_MANAGER_STYLES.ERROR_TEXT, stateString)
     if playerReady:
         label = CYBERSPORT.WINDOW_UNIT_NOTREADY
     else:
         label = CYBERSPORT.WINDOW_UNIT_READY
     return {'stateString': stateString,
      'label': label,
      'isEnabled': isEnabled,
      'isReady': playerReady}
Exemple #24
0
    def __createPenaltiesStr(self, penalties):
        result = []
        for tankmanType, value, isOtherVehicle in penalties:
            if not param_formatter.isRelativeParameter(self.__paramName):
                valueStr = str(
                    param_formatter.baseFormatParameter(
                        self.__paramName, value))
                if value > 0:
                    valueStr = '+' + valueStr
                valueStr = text_styles.error(
                    _ms(TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANLEVEL_VALUE,
                        value=valueStr))
            else:
                valueStr = ''
            if isOtherVehicle:
                locKey = TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANDIFFERENTVEHICLE_TEMPLATE
            else:
                locKey = TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANLEVEL_TEMPLATE
            result.append(
                text_styles.main(
                    _ms(locKey,
                        tankmanType=_ms(ITEM_TYPES.tankman_roles(tankmanType)),
                        value=valueStr)))

        return '\n'.join(result)
Exemple #25
0
    def __updateCommonRequirements(self, teamLimits, rosters):
        minTotalLvl, maxTotalLvl = prb_getters.getTotalLevelLimits(teamLimits)
        playersMaxCount = prb_getters.getMaxSizeLimits(teamLimits)[0]
        totalLvl = 0
        playersCount = 0
        for roster, players in rosters.iteritems():
            if roster ^ self.__team == PREBATTLE_ROSTER.ASSIGNED:
                for player in players:
                    if player.isReady():
                        playersCount += 1
                    if player.isVehicleSpecified():
                        totalLvl += player.getVehicle().level

        if minTotalLvl <= totalLvl and totalLvl <= maxTotalLvl:
            teamLevelStr = text_styles.main(str(totalLvl))
        else:
            teamLevelStr = text_styles.error(str(totalLvl))
        self.as_setCommonLimitsS(teamLevelStr, playersMaxCount)
        self.as_setPlayersCountTextS(
            makeHtmlString('html_templates:lobby/prebattle',
                           'specBattlePlayersCount', {
                               'membersCount': playersCount,
                               'maxMembersCount': playersMaxCount
                           }))
        playerTeam = len(
            self._makeAccountsData(rosters[self._getPlayerTeam()
                                           | PREBATTLE_ROSTER.ASSIGNED]))
        playersStyleFunc = text_styles.main if playerTeam < playersMaxCount else text_styles.error
        playersCountStr = playersStyleFunc('%d/%d' %
                                           (playerTeam, playersMaxCount))
        self.as_setTotalPlayersCountS(playersCountStr)
Exemple #26
0
 def __makeBody(self):
     text = text_styles.error(
         i18n.makeString(ALIAS.DEMOUNTBUILDING_GENERALTEXT_BODYINNERTEXT))
     concatTexts = text_styles.standard(
         i18n.makeString(ALIAS.DEMOUNTBUILDING_GENERALTEXT_BODY,
                         bodyInnerText=text))
     return concatTexts
 def fillDefault(self):
     self.__data['ladderIconSource'] = getLadderChevron256x256()
     self.__data['isRequestWaitingTextVisible'] = True
     self.__data['requestWaitingText'] = text_styles.alert('#cybersport:window/intro/unavailableWaiting')
     self.setClubLabel(_ms(CYBERSPORT.WINDOW_INTRO_TEAM_HEADER_STATICTEAMS))
     self.setClubDescription(text_styles.error('#cybersport:window/intro/team/description/unavailable'), isBackVisible=True)
     self.showCreateButton(_ms(CYBERSPORT.WINDOW_INTRO_CREATE_BTN_ASSEMBLETEAM), TOOLTIPS.CYBERSPORT_INTRO_CREATEBTN_ASSEMBLETEAM, enabled=False)
Exemple #28
0
 def _packProgressStateBlock(self):
     currentLevel = self._item.getLatestOpenedProgressionLevel(
         self.__vehicle)
     if currentLevel == -1 and self._progressionLevel == 1:
         currentLevel = 0
     if self._progressionLevel < 1:
         return None
     else:
         if currentLevel >= self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.checkmark(),
                 text_styles.bonusAppliedText(
                     getProgressionItemStatusText(self._progressionLevel)))
         elif currentLevel + 1 == self._progressionLevel:
             desc = text_styles.concatStylesToSingleLine(
                 icons.inProgress(),
                 text_styles.neutral(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.inProgressState())))
         else:
             desc = text_styles.concatStylesToSingleLine(
                 icons.markerBlocked(),
                 text_styles.error(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.title())))
             desc = text_styles.concatStylesToMultiLine(
                 desc,
                 text_styles.main(
                     backport.text(
                         R.strings.vehicle_customization.customization.
                         infotype.progression.notAvailableState.desc())))
         return formatters.packAlignedTextBlockData(
             text=desc, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER)
Exemple #29
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 _getUnavailableStatusFields(self, errorMsg):
     """
     Gets status fields data for unavailable mission state.
     Data used in detailed mission view to display its unavailable state.
     """
     scheduleLabel = ''
     dateLabel = ''
     scheduleTooltip = None
     if errorMsg != 'requirement':
         clockIcon = icons.makeImageTag(
             RES_ICONS.MAPS_ICONS_LIBRARY_TIMERICON, 16, 16, -2, 8)
         timeLeft = self.event.getNearestActivityTimeLeft()
         if timeLeft is not None:
             startTimeLeft = timeLeft[0]
             timeStatusText = text_styles.standard(
                 _ms('#quests:missionDetails/status/notAvailable/%s' %
                     errorMsg,
                     time=self._getTillTimeString(startTimeLeft)))
             dateLabel = text_styles.concatStylesWithSpace(
                 clockIcon,
                 text_styles.error(QUESTS.MISSIONDETAILS_STATUS_WRONGTIME),
                 timeStatusText)
         if errorMsg in ('invalid_weekday', 'invalid_time_interval'):
             scheduleLabel = getScheduleLabel()
             scheduleTooltip = getInvalidTimeIntervalsTooltip(self.event)
     return {
         'status': EVENT_STATUS.NOT_AVAILABLE,
         'dateLabel': dateLabel,
         'scheduleOrResetLabel': scheduleLabel,
         'scheduleTooltip': scheduleTooltip
     }
 def _getBuildingStr(self, order):
     buildingID = self.getBuildingUIDbyID(order.buildingID)
     building = i18n.makeString(FORTIFICATIONS.buildings_buildingname(buildingID))
     hasBuilding = order.hasBuilding
     if not hasBuilding:
         return text_styles.error(building)
     return building
Exemple #32
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
 def __getNoVehicleStatusFields(self):
     addBottomStatusText = text_styles.error(
         icons.markerBlocked() + ' ' +
         _ms(QUESTS.PERSONALMISSION_STATUS_LOCKEDBYVEHICLE))
     bottomStatusTooltipData = {
         'tooltip':
         makeTooltip(
             header=TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYVEHICLE_HEADER,
             body=_ms(TOOLTIPS.PERSONALMISSIONS_STATUS_LOCKEDBYVEHICLE_BODY,
                      vehType=', '.join([
                          _ms(MENU.classesShort(vehType))
                          for vehType in self.event.getVehicleClasses()
                      ]),
                      minLevel=int2roman(self.event.getVehMinLevel()),
                      maxLevel=int2roman(self.event.getVehMaxLevel())))
     }
     if self.event.isInProgress():
         statusData = self._getProgressStatusFields()
         statusData.update(addBottomStatusText=addBottomStatusText)
         statusData.update(bottomStatusTooltipData=bottomStatusTooltipData)
         return statusData
     if self.event.isMainCompleted():
         statusData = self._getCompleteStatusFields()
         statusData.update(addBottomStatusText=addBottomStatusText)
         statusData.update(bottomStatusTooltipData=bottomStatusTooltipData)
         return statusData
     return {
         'addBottomStatusText': addBottomStatusText,
         'status': MISSIONS_STATES.NOT_AVAILABLE,
         'bottomStatusTooltipData': bottomStatusTooltipData
     }
Exemple #34
0
def getEfficiencyVO(currentSeasonEfficiency, currentSeasonEfficiencyDiff):
    delta = ''
    if currentSeasonEfficiencyDiff is not None:
        if currentSeasonEfficiencyDiff > 0:
            delta = text_styles.concatStylesToSingleLine(
                icons.makeImageTag(
                    backport.image(R.images.gui.maps.icons.rankedBattles.
                                   league.delta_plus()), 11, 16, -3),
                text_styles.bonusAppliedText(
                    ranked_formatters.getFloatPercentStrStat(
                        currentSeasonEfficiencyDiff)))
        if currentSeasonEfficiencyDiff < 0:
            delta = text_styles.concatStylesToSingleLine(
                icons.makeImageTag(
                    backport.image(R.images.gui.maps.icons.rankedBattles.
                                   league.delta_minus()), 11, 16, -3),
                text_styles.error(
                    ranked_formatters.getFloatPercentStrStat(
                        currentSeasonEfficiencyDiff)))
    return {
        'icon': 'efficiency',
        'label': '',
        'value':
        ranked_formatters.getFloatPercentStrStat(currentSeasonEfficiency),
        'delta': delta
    }
 def _onRegisterFlashComponent(self, viewPy, alias):
     if len(self._tankman.skills) < 1:
         if self._tankman.roleLevel < 100:
             controlNumber = 0
             question = _ms(DIALOGS.DISMISSTANKMAN_MESSAGE)
         else:
             controlNumber = self._tankman.roleLevel
             question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_MAINMESSAGE,
                            roleLevel=text_styles.warning(
                                str(controlNumber)))
     else:
         lastSkill = self._tankman.skills[-1]
         if lastSkill.isPerk:
             skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISPERK
         else:
             skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISABILLITY
         question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE,
                        skillType=_ms(skillType),
                        skillName=text_styles.neutral(lastSkill.userName),
                        roleLevel=text_styles.warning(str(lastSkill.level)))
         controlNumber = lastSkill.level
     viewPy.setControlNumbers(str(controlNumber))
     viewPy.questionBody = text_styles.main(question)
     viewPy.errorMsg = text_styles.error(
         DIALOGS.PROTECTEDDISMISSTANKMAN_ERRORMESSAGE)
Exemple #36
0
 def __getAvailabilityStr(self):
     _, time, _ = self.epicQueueController.getPrimeTimeStatus()
     timeLeftStr = time_utils.getTillTimeString(time,
                                                EPIC_BATTLE.STATUS_TIMELEFT)
     if not self.epicQueueController.isInPrimeTime():
         availablePrimeTime = self.epicQueueController.hasAnySeason(
         ) and self.epicQueueController.getPrimeTimeStatus()[1] != 0
         if availablePrimeTime:
             return text_styles.main(
                 i18n.makeString(EPIC_BATTLE.TOOLTIP_EPICBATTLE_AVAILABLEIN,
                                 time=timeLeftStr))
         return None
     currPerformanceGroup = self.epicQueueController.getPerformanceGroup()
     if currPerformanceGroup == EPIC_PERF_GROUP.HIGH_RISK:
         attention = text_styles.error(
             MENU.HEADERBUTTONS_BATTLE_MENU_ATTENTION_LOWPERFORMANCE)
         return icons.makeImageTag(
             RES_ICONS.MAPS_ICONS_LIBRARY_MARKER_BLOCKED,
             vSpace=-3) + ' ' + attention
     elif currPerformanceGroup == EPIC_PERF_GROUP.MEDIUM_RISK:
         attention = text_styles.neutral(
             MENU.HEADERBUTTONS_BATTLE_MENU_ATTENTION_REDUCEDPERFORMANCE)
         return icons.makeImageTag(
             RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICON,
             vSpace=-3) + ' ' + attention
     else:
         return None
Exemple #37
0
 def __stateTextStyleFormatter(self, state):
     if self.__restrictionType in self.__WARNING_UNIT_MESSAGES and self._playerInfo.isReady:
         return ' '.join(
             (icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ALERTICON,
                                 vSpace=-3), text_styles.alert(state)))
     if self.__restrictionType not in self.__NOT_CRITICAL_STATES:
         return text_styles.error(state)
     return text_styles.main(state)
 def _getState(self, resToExchange):
     if resToExchange <= 0:
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.EXCHANGE_NOT_NEEED_STATE, text_styles.success(self._makeString(I18N_EXCHANGENONEEDTEXT_KEY)))
     if not self._isEnoughGold(resToExchange):
         goldToExchange = self._getGoldToExchange(resToExchange)
         fmtGold = ''.join((text_styles.gold(backport.getGoldFormat(goldToExchange)), icons.gold()))
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.NOT_ENOUGH_GOLD_STATE, text_styles.error(self._makeString(I18N_GOLDNOTENOUGHTEXT_KEY, {'gold': fmtGold})))
     return (CONFIRM_EXCHANGE_DIALOG_TYPES.NORMAL_STATE, '')
 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
Exemple #40
0
def getDialogReplaceElements(elementGroups):
    elementsCount = sum([ len(x) for x in elementGroups ])
    if elementsCount > 1:
        deleteStr = text_styles.error(VEHICLE_CUSTOMIZATION.DIALOG_REMOVE_ELEMENTS_DELETE)
        description = text_styles.main(_ms(VEHICLE_CUSTOMIZATION.DIALOG_REPLACE_ELEMENTS_DESCRIPTION, elementsName=__formatReplaceElements(elementGroups), delete=deleteStr))
        return I18nConfirmDialogMeta('customization/replace_elements', messageCtx={'description': description}, focusedID=DIALOG_BUTTON_ID.CLOSE)
    for elements, cType in zip(elementGroups, CUSTOMIZATION_TYPE.ALL):
        if elements:
            return getDialogReplaceElement(elements[0], cType)
 def __getResourceToExchangeTxt(self, resToExchange):
     """
     :param resToExchange: <int> resource for exchange
     :return: <str> formatted needed resource to exchange text
     """
     if resToExchange > 0:
         resource = BigWorld.wg_getIntegralFormat(resToExchange)
         resStr = self._getCurrencyFormat()(resource) + self._getCurrencyIconStr()
         return text_styles.error(self._makeString(I18N_NEEDITEMSTEXT_KEY, {"value": resStr}))
     return ""
 def __updateHeaderMessage(self):
     message = ''
     isDefHourEnabled = self.fortCtrl.getFort().isDefenceHourEnabled()
     if self._isFortFrozen():
         message = i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_HEADER_FORTFROZEN)
         message = text_styles.error(message)
     elif isDefHourEnabled:
         periodStr = self.fortCtrl.getFort().getDefencePeriodStr()
         message = i18n.makeString(FORTIFICATIONS.FORTMAINVIEW_HEADER_DEFENCEPERIOD, period=periodStr)
         message = text_styles.stats(message)
     self.as_setHeaderMessageS(message, self._isWrongLocalTime() and isDefHourEnabled)
 def __checkMoney(self):
     changeRoleCost = self.__items.shop.changeRoleCost
     formattedPrice = BigWorld.wg_getIntegralFormat(changeRoleCost)
     actualGold = self.__items.stats.gold
     enoughGold = actualGold - changeRoleCost >= 0
     if enoughGold:
         priceString = text_styles.gold(formattedPrice)
     else:
         priceString = text_styles.error(formattedPrice)
     priceString += icons.gold()
     self.as_setPriceS(priceString, enoughGold)
 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 ''
 def __getBattleInfo(self, startTime, startTimeLeft):
     if startTimeLeft > time_utils.QUARTER_HOUR:
         if time_utils.isTimeNextDay(startTime):
             return self.app.utilsManager.textManager.getText(i18n.makeString(FORTIFICATIONS.FORTINTELLIGENCE_DATE_TOMORROW), TEXT_MANAGER_STYLES.STANDARD_TEXT)
         if time_utils.isTimeThisDay(startTime):
             return self.app.utilsManager.textManager.getText(i18n.makeString(FORTIFICATIONS.FORTINTELLIGENCE_DATE_TODAY), TEXT_MANAGER_STYLES.STANDARD_TEXT)
     else:
         if startTimeLeft > 0:
             return self.app.utilsManager.textManager.getText(TEXT_MANAGER_STYLES.STANDARD_TEXT, i18n.makeString(FORTIFICATIONS.FORTCLANBATTLELIST_RENDERCURRENTTIME_BEFOREBATTLE) + ' ')
         inBattleText = ' ' + i18n.makeString(FORTIFICATIONS.FORTCLANBATTLELIST_RENDERCURRENTTIME_ISBATTLE)
         return text_styles.error(icons.swords() + inBattleText)
     return ''
Exemple #46
0
def getDialogReplaceElements(elements):
    replaceElementCount = 0
    for replaceElements in elements:
        replaceElementCount += len(replaceElements)

    if replaceElementCount > 1:
        deleteStr = text_styles.error(CUSTOMIZATION.DIALOG_REMOVE_ELEMENTS_DELETE)
        description = text_styles.main(_ms(CUSTOMIZATION.DIALOG_REPLACE_ELEMENTS_DESCRIPTION, elementsName=__formatReplaceElements(elements), delete=deleteStr))
        return I18nConfirmDialogMeta('customization/replace_elements', messageCtx={'description': description}, focusedID=DIALOG_BUTTON_ID.CLOSE)
    for type in (CUSTOMIZATION_TYPE.CAMOUFLAGE, CUSTOMIZATION_TYPE.EMBLEM, CUSTOMIZATION_TYPE.INSCRIPTION):
        if elements[type]:
            return getDialogReplaceElement(elements[type][0], type)
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
    )
 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 __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
Exemple #50
0
    def __createPenaltiesStr(self, penalties):
        result = []
        for tankmanType, value, isOtherVehicle in penalties:
            if not param_formatter.isRelativeParameter(self.__paramName):
                valueStr = str(param_formatter.baseFormatParameter(self.__paramName, value))
                if value > 0:
                    valueStr = '+' + valueStr
                valueStr = text_styles.error(_ms(TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANLEVEL_VALUE, value=valueStr))
            else:
                valueStr = ''
            if isOtherVehicle:
                locKey = TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANDIFFERENTVEHICLE_TEMPLATE
            else:
                locKey = TOOLTIPS.VEHICLEPARAMS_PENALTY_TANKMANLEVEL_TEMPLATE
            result.append(text_styles.main(_ms(locKey, tankmanType=_ms(ITEM_TYPES.tankman_roles(tankmanType)), value=valueStr)))

        return '\n'.join(result)
 def _onRegisterFlashComponent(self, viewPy, alias):
     if len(self._tankman.skills) < 1:
         if self._tankman.roleLevel < 100:
             controlNumber = 0
             question = _ms(DIALOGS.DISMISSTANKMAN_MESSAGE)
         else:
             controlNumber = self._tankman.roleLevel
             question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_MAINMESSAGE, roleLevel=text_styles.warning(str(controlNumber)))
     else:
         lastSkill = self._tankman.skills[-1]
         if lastSkill.isPerk:
             skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISPERK
         else:
             skillType = DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE_ISABILLITY
         question = _ms(DIALOGS.PROTECTEDDISMISSTANKMAN_ADDITIONALMESSAGE, skillType=_ms(skillType), skillName=text_styles.neutral(lastSkill.userName), roleLevel=text_styles.warning(str(lastSkill.level)))
         controlNumber = lastSkill.level
     viewPy.setControlNumbers(str(controlNumber))
     viewPy.questionBody = text_styles.main(question)
     viewPy.errorMsg = text_styles.error(DIALOGS.PROTECTEDDISMISSTANKMAN_ERRORMESSAGE)
 def requestBuildingInfo(self, uid):
     infoData = {}
     id = self.getBuildingIDbyUID(uid)
     self.__markAsVisited(id)
     buildingStatus = self.__getBuildingStatus(id)
     infoData['buildingName'] = text_styles.highTitle(i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid)))
     infoData['buildingID'] = uid
     infoData['longDescr'] = text_styles.standard(i18n.makeString(FORTIFICATIONS.buildingsprocess_longdescr(uid)))
     buttonLbl = FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBL
     if buildingStatus == self.BUILDING_STATUS.BUILT:
         buttonLbl = text_styles.standard(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_BUTTONLBLBUILT))
     infoData['buttonLabel'] = i18n.makeString(buttonLbl)
     infoData['orderInfo'] = self.__makeOrderInfoData(uid)
     isVisibleBtn = True
     isEnableBtn = True
     statusMsg = ''
     statusIconTooltip = None
     if buildingStatus == self.BUILDING_STATUS.BUILT:
         statusMsg = ''.join((icons.checkmark(), text_styles.success(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_STATUSMSG_BUILT))))
         isEnableBtn = False
         isVisibleBtn = False
         statusIconTooltip = self.__makeStatusTooltip(True)
         buttonTooltip = self.__makeButtonTooltip(self.BUILDING_STATUS.BUILT, None)
     elif buildingStatus == self.BUILDING_STATUS.NOT_AVAILABLE:
         isEnableBtn = False
         isVisibleBtn = True
         statusMsg = text_styles.error(i18n.makeString(FORTIFICATIONS.BUILDINGSPROCESS_BUILDINGINFO_STATUSMESSAGE))
         imageSource = icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_REDNOTAVAILABLE, 12, 12, 0, 0)
         statusMsg = imageSource + ' ' + statusMsg
         statusIconTooltip = self.__makeStatusTooltip(False)
         buttonTooltip = self.__makeButtonTooltip(self.BUILDING_STATUS.NOT_AVAILABLE, None)
     else:
         buttonTooltip = self.__makeButtonTooltip(self.BUILDING_STATUS.AVAILABLE, i18n.makeString(FORTIFICATIONS.buildings_buildingname(uid)))
     infoData['isVisibleBtn'] = isVisibleBtn
     infoData['isEnableBtn'] = isEnableBtn
     infoData['statusMsg'] = statusMsg
     infoData['statusIconTooltip'] = statusIconTooltip
     infoData['buttonTooltip'] = buttonTooltip
     buildingIcon = FortViewHelper.getPopoverIconSource(uid, FORT_BATTLE_DIVISIONS.ABSOLUTE.maxFortLevel)
     infoData['buildingIcon'] = buildingIcon
     self.as_responseBuildingInfoS(infoData)
     return
 def __getState(self, resToExchange):
     """
     Gets state and reason for exchange possibility
     :param resToExchange: <int> resource for exchange
     :return: <tuple(state:<int>, reason<str>)>
     """
     if resToExchange <= 0:
         return (
             CONFIRM_EXCHANGE_DIALOG_TYPES.EXCHANGE_NOT_NEEED_STATE,
             text_styles.success(self._makeString(I18N_EXCHANGENONEEDTEXT_KEY)),
         )
     elif not self.__isEnoughGold(resToExchange):
         goldToExchange = self.__getGoldToExchange(resToExchange)
         fmtGold = "".join((text_styles.gold(BigWorld.wg_getGoldFormat(goldToExchange)), icons.gold()))
         return (
             CONFIRM_EXCHANGE_DIALOG_TYPES.NOT_ENOUGH_GOLD_STATE,
             text_styles.error(self._makeString(I18N_GOLDNOTENOUGHTEXT_KEY, {"gold": fmtGold})),
         )
     else:
         return (CONFIRM_EXCHANGE_DIALOG_TYPES.NORMAL_STATE, "")
    def __updateCommonRequirements(self, teamLimits, rosters):
        minTotalLvl, maxTotalLvl = prb_getters.getTotalLevelLimits(teamLimits)
        playersMaxCount = prb_getters.getMaxSizeLimits(teamLimits)[0]
        totalLvl = 0
        playersCount = 0
        for roster, players in rosters.iteritems():
            if roster ^ self.__team == PREBATTLE_ROSTER.ASSIGNED:
                for player in players:
                    if player.isReady():
                        playersCount += 1
                    if player.isVehicleSpecified():
                        totalLvl += player.getVehicle().level

        if minTotalLvl <= totalLvl and totalLvl <= maxTotalLvl:
            teamLevelStr = text_styles.main(str(totalLvl))
        else:
            teamLevelStr = text_styles.error(str(totalLvl))
        self.as_setCommonLimitsS(teamLevelStr, playersMaxCount)
        self.as_setPlayersCountTextS(makeHtmlString('html_templates:lobby/prebattle', 'specBattlePlayersCount', {'membersCount': playersCount,
         'maxMembersCount': playersMaxCount}))
        playerTeam = len(self._makeAccountsData(rosters[self._getPlayerTeam() | PREBATTLE_ROSTER.ASSIGNED]))
        playersStyleFunc = text_styles.main if playerTeam < playersMaxCount else text_styles.error
        playersCountStr = playersStyleFunc('%d/%d' % (playerTeam, playersMaxCount))
        self.as_setTotalPlayersCountS(playersCountStr)
Exemple #55
0
 def installCustomizationElement(self, idx):
     isContinue = True
     carouselItem = g_customizationController.carousel.items[idx]['object']
     cType = g_customizationController.carousel.currentType
     if carouselItem.isInDossier:
         if g_customizationController.carousel.slots.getInstalledItem().getNumberOfDaysLeft() > 0 and carouselItem.getIgrType() != IGR_TYPE.PREMIUM:
             slotItem = g_customizationController.carousel.slots.getSlotItem()
             isContinue = yield DialogsInterface.showDialog(getDialogReplaceElement(slotItem.getName(), cType))
         if carouselItem.numberOfDays is not None and not carouselItem.isReplacedByIGRItem:
             isContinue = yield DialogsInterface.showDialog(self.__getInvoiceItemDialogMeta('temporary', cType, carouselItem, {'willBeDeleted': text_styles.error(_ms('#dialogs:customization/install_invoice_item/will_be_deleted'))}))
         elif carouselItem.numberOfItems is not None:
             if carouselItem.numberOfItems > 1:
                 isContinue = yield DialogsInterface.showDialog(self.__getInvoiceItemDialogMeta('permanent', cType, carouselItem, {'numberLeft': carouselItem.numberOfItems - 1}))
             else:
                 isContinue = yield DialogsInterface.showDialog(self.__getInvoiceItemDialogMeta('permanent_last', cType, carouselItem, {}))
     if isContinue:
         g_customizationController.carousel.applyItem(idx)
     return
Exemple #56
0
    def __setCarouselData(self, blData):
        itemVOs = []
        for item in blData['items']:
            enable = True
            if item['installedInSlot']:
                label = text_styles.main(CUSTOMIZATION.CAROUSEL_ITEMLABEL_APPLIED)
            elif item['isInDossier']:
                label = text_styles.main(CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
            elif item['object'].getIgrType() != IGR_TYPE.NONE:
                if item['object'].getIgrType() == getIGRCtrl().getRoomType():
                    label = text_styles.main(CUSTOMIZATION.CAROUSEL_ITEMLABEL_PURCHASED)
                else:
                    label = icons.premiumIgrSmall()
                    enable = False
            else:
                if item['priceIsGold']:
                    priceFormatter = text_styles.gold
                    priceIcon = icons.gold()
                else:
                    priceFormatter = text_styles.credits
                    priceIcon = icons.credits()
                label = priceFormatter('{0}{1}'.format(item['price'], priceIcon))
            data = {'id': item['id'],
             'icon': item['object'].getTexturePath(),
             'bonusType': item['object'].qualifier.getIcon16x16(),
             'bonusPower': text_styles.stats('+{0}%{1}'.format(item['object'].qualifier.getValue(), '*' if item['object'].qualifier.getDescription() is not None else '')),
             'label': label,
             'installed': item['appliedToCurrentSlot'],
             'btnSelect': self.__getLabelOfSelectBtn(item),
             'btnShoot': VEHICLE_CUSTOMIZATION.CUSTOMIZATIONITEMCAROUSEL_RENDERER_SHOOT,
             'btnTooltip': item['buttonTooltip'],
             'btnSelectEnable': enable,
             'doubleclickEnable': enable,
             'btnShootEnable': True}
            cType = g_customizationController.carousel.currentType
            if isSale(cType, item['duration']) and not item['isInDossier'] and not item['installedInSlot']:
                isGold = item['priceIsGold']
                data['salePrice'] = getSalePriceString(isGold, item['price'])
            itemVOs.append(data)

        carouselLength = len(itemVOs)
        self.as_setCarouselDataS({'rendererList': itemVOs,
         'rendererWidth': blData['rendererWidth'],
         'filterCounter': '{0}{1}'.format(text_styles.stats(carouselLength) if carouselLength > 0 else text_styles.error(carouselLength), text_styles.main(_ms(VEHICLE_CUSTOMIZATION.CAROUSEL_FILTER_COUNTER, all=blData['unfilteredLength']))),
         'messageVisible': carouselLength == 0,
         'counterVisible': True,
         'goToIndex': blData['goToIndex'],
         'selectedIndex': blData['selectedIndex']})
        return
 def __makeData(self):
     baseBuildingMaxLevel = MAX_LEVEL.MAX_BASE_LEVEL_SECOND_ITERATION if self.__isFortBattleAvailable else MAX_LEVEL.MAX_BASE_LEVEL_FIRST_ITERATION
     result = {}
     cndBody = ''
     limits = self.fortCtrl.getLimits()
     canUpgrade, upgradeRestriction = limits.canUpgrade(self.intBuildingID)
     LOG_DEBUG(upgradeRestriction)
     cndPostfix = ''
     isCanModernization = canUpgrade
     conditionIcon = icons.checkmark()
     canUpgradeByDefPeriod = True
     isBaseBuilding = self.__uid == FORTIFICATION_ALIASES.FORT_BASE_BUILDING
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         cndBody = i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_GENERALCONDITION, level=fort_formatters.getTextLevel(self.__buildingLevel + 1))
         if canUpgrade:
             isCanModernization = True
         else:
             isCanModernization = False
         if self.__buildingLevel == MAX_LEVEL.MAX_BUILD_LEVEL:
             if self.__isFortBattleAvailable:
                 cndBody = i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_DEFENCEPERIODANDBASEBUILDING, level=fort_formatters.getTextLevel(self.__buildingLevel + 1))
                 if not self.__defencePeriod or self.__baseBuildingLevel < MAX_LEVEL.MAX_BASE_LEVEL_SECOND_ITERATION:
                     cndPostfix = text_styles.error(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
                     isCanModernization = False
                     canUpgradeByDefPeriod = False
                     conditionIcon = text_styles.standard('-')
             elif self.__buildingLevel == self.__baseBuildingLevel:
                 cndPostfix = text_styles.error(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
         elif self.__buildingLevel == self.__baseBuildingLevel:
             cndPostfix = text_styles.error(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
             isCanModernization = False
     elif self.__buildingLevel == baseBuildingMaxLevel:
         cndBody = i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_BASEBUILDINGFIVELEVEL)
         if not self.__defencePeriod and self.__isFortBattleAvailable:
             cndPostfix = text_styles.error(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_NOTFULFILLED))
             isCanModernization = False
             canUpgradeByDefPeriod = False
             conditionIcon = text_styles.standard('-')
         elif not self.__isFortBattleAvailable:
             isCanModernization = False
             canUpgradeByDefPeriod = False
             cndBody = text_styles.alert(i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_FORTMAXLEVEL))
             conditionIcon = ''
     prefixBody = text_styles.main(cndBody)
     result['condition'] = prefixBody + cndPostfix
     result['costUpgrade'] = text_styles.defRes(i18n.makeString(FORTIFICATIONS.MODERNIZATION_MODERNIZATIONINFO_COUNTCOST))
     result['intBuildingID'] = self.intBuildingID
     if not canUpgrade and upgradeRestriction != FORT_RESTRICTION.BUILDING_NOT_ENOUGH_RESOURCE:
         conditionIcon = text_styles.standard('-')
     if self._buildingDescr.storage < self.__cost:
         costMsg = text_styles.error(BigWorld.wg_getIntegralFormat(self.__cost))
         constIcon = icons.nut()
         costMsg = costMsg + ' ' + constIcon
     else:
         costMsg = fort_formatters.getDefRes(self.__cost, True)
     result['costValue'] = costMsg
     if cndBody != '':
         result['conditionIcon'] = conditionIcon
     result['canUpgrade'] = isCanModernization
     if not isCanModernization:
         btnToolTip = {}
         if not canUpgradeByDefPeriod and self.__isFortBattleAvailable:
             btnToolTip['header'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_NOTACTIVATEDDEFPERIOD_HEADER)
             btnToolTip['body'] = i18n.makeString(i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_NOTACTIVATEDDEFPERIOD_BODY))
         else:
             btnToolTip['header'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_APPLYBUTTON_HEADER)
             if not self.__isFortBattleAvailable and isBaseBuilding and self.__buildingLevel == baseBuildingMaxLevel:
                 btnToolTip['header'] = i18n.makeString('#tooltips:fortification/popOver/upgradeFoundationBtn_Disabled/header')
                 btnToolTip['body'] = i18n.makeString(FORTIFICATIONS.MODERNIZATION_CONDITIONS_FORTMAXLEVEL)
             elif upgradeRestriction == FORT_RESTRICTION.BUILDING_NOT_ENOUGH_RESOURCE_AND_LOW_LEVEL:
                 btnToolTip['body'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_APPLYBUTTON_LOWLEVELANDRESOURCE, baseLevel=fort_formatters.getTextLevel(self.__baseBuildingLevel + 1))
             elif upgradeRestriction == FORT_RESTRICTION.BUILDING_FORT_LEVEL_TOO_LOW:
                 btnToolTip['body'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_APPLYBUTTON_LOWBASELEVEL, baseLevel=fort_formatters.getTextLevel(self.__baseBuildingLevel + 1))
             elif upgradeRestriction == FORT_RESTRICTION.BUILDING_NOT_ENOUGH_RESOURCE:
                 btnToolTip['body'] = i18n.makeString(TOOLTIPS.FORTIFICATION_MODERNIZATION_APPLYBUTTON_NETENOUGHRESOURCE)
         result['btnToolTip'] = btnToolTip
     fort = self.fortCtrl.getFort()
     newCount = 0
     resLeft = 0
     orderCount = 0
     if self.__uid != FORTIFICATION_ALIASES.FORT_BASE_BUILDING:
         order = fort.getOrder(self._buildingDescr.typeRef.orderType)
         orderCount = order.count
         newCount, resLeft = fort.recalculateOrder(order.orderID, order.count, order.level, order.level + 1)
     inProcess, _ = fort.getDefenceHourProcessing()
     isDefenceOn = fort.isDefenceHourEnabled() or inProcess
     before = {}
     before['buildingType'] = self.__uid
     before['buildingLevel'] = self.__buildingLevel
     before['buildingIcon'] = FortViewHelper.getMapIconSource(self.__uid, self.__buildingLevel, isDefenceOn=isDefenceOn)
     before['buildingIndicators'] = self.__prepareIndicatorData(isCanModernization, False)
     before['defResInfo'] = self.__prepareOrderInfo(False, orderCount, self.__buildingLevel)
     before['titleText'] = text_styles.middleTitle(i18n.makeString(FORTIFICATIONS.MODERNIZATION_MODERNIZATIONINFO_BEFORELABEL))
     result['beforeUpgradeData'] = before
     after = {}
     after['buildingType'] = self.__uid
     after['buildingLevel'] = self.__buildingLevel + 1
     after['buildingIcon'] = FortViewHelper.getMapIconSource(self.__uid, self.__buildingLevel + 1)
     after['buildingIndicators'] = self.__prepareIndicatorData(isCanModernization, True, resLeft)
     after['defResInfo'] = self.__prepareOrderInfo(True, newCount, self.__buildingLevel + 1)
     after['titleText'] = text_styles.middleTitle(i18n.makeString(FORTIFICATIONS.MODERNIZATION_MODERNIZATIONINFO_AFTERLABEL))
     result['afterUpgradeData'] = after
     return result
 def _populate(self):
     super(SwitchPeripheryWindow, self)._populate()
     self._serversDP = ServersDataProvider()
     self._serversDP.setFlashObject(self.as_getServersDPS())
     self.as_setImageS(RES_ICONS.MAPS_ICONS_WINDOWS_SWITCH_PERIPHERY_WINDOW_BG, 0)
     self.as_setWindowTitleS(_ms(DIALOGS.SWITCHPERIPHERYWINDOW_WINDOWTITLE))
     currentServer = connectionManager.serverUserName
     self.as_setTextS(_ms(self.__ctx.getHeader()), _ms(self.__ctx.getDescription(), server=text_styles.error(currentServer)))
     self._updateServersList()
     if not constants.IS_CHINA:
         if GUI_SETTINGS.csisRequestRate == REQUEST_RATE.ALWAYS:
             g_preDefinedHosts.startCSISUpdate()
         g_preDefinedHosts.onCsisQueryStart += self.__onServersUpdate
         g_preDefinedHosts.onCsisQueryComplete += self.__onServersUpdate
         g_preDefinedHosts.onPingPerformed += self.__onServersUpdate
     self.as_setButtonsS([{'label': _ms(DIALOGS.SWITCHPERIPHERYWINDOW_BTNSWITCH),
       'btnLinkage': BUTTON_LINKAGES.BUTTON_NORMAL,
       'action': self._SWITCH_BTN_ACTION,
       'isFocused': True,
       'tooltip': ''}, {'label': _ms(DIALOGS.SWITCHPERIPHERYWINDOW_BTNCANCEL),
       'btnLinkage': BUTTON_LINKAGES.BUTTON_BLACK,
       'action': self._CLOSE_BTN_ACTION,
       'isFocused': False,
       'tooltip': ''}], TEXT_ALIGN.RIGHT, self._BTN_WIDTH)
Exemple #59
0
def _packTimeLimitsBlock(block, limits):
    textOffset = 30
    for limit in limits:
        text = i18n.makeString(TOOLTIPS.FORTIFICATION_SORTIE_LISTROOM_REGULATION_TIMELIMITFORMAT, startTime=limit.startTime, endTime=limit.endTime)
        block.append(formatters.packImageTextBlockData(title=text_styles.error(text), txtOffset=textOffset))