Exemple #1
0
 def __getMultiselectionStatus(self):
     if self.__multiselectionMode:
         falloutCfg = self.__falloutCtrl.getConfig()
         messageTemplate = '#fallout:multiselectionSlot/%d' % self.__falloutCtrl.getBattleType(
         )
         if not falloutCfg.hasRequiredVehicles():
             return (False,
                     i18n.makeString(
                         messageTemplate + '/topTierVehicleRequired',
                         level=int2roman(falloutCfg.vehicleLevelRequired)))
         if self.__falloutCtrl.getSelectedVehicles():
             return (
                 True,
                 main(
                     i18n.makeString(
                         FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) +
                 '\n' + standard(
                     i18n.makeString(
                         FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS,
                         level=toRomanRangeString(
                             list(falloutCfg.allowedLevels), 1))))
         if falloutCfg.getAllowedVehicles():
             return (
                 False,
                 main(i18n.makeString(messageTemplate +
                                      '/descriptionTitle')) + '\n' +
                 standard(
                     i18n.makeString(messageTemplate + '/message',
                                     level=toRomanRangeString(
                                         list(falloutCfg.allowedLevels),
                                         1))))
     return (False, '')
Exemple #2
0
 def __updateHeader(self):
     if self.__isFallout:
         vehicleLbl = text_styles.standard(
             i18n.makeString(CYBERSPORT.WINDOW_UNIT_TEAMVEHICLESLBL,
                             levelsRange=toRomanRangeString(
                                 list(self.__falloutCfg.allowedLevels), 1)))
         self.as_setVehiclesTitleS(vehicleLbl)
Exemple #3
0
 def _buildVehicle(self, vehicle):
     result = super(RankedCarouselDataProvider, self)._buildVehicle(vehicle)
     result[
         'hasRankedBonus'] = self.__rankedController.hasVehicleRankedBonus(
             vehicle.intCD)
     state, _ = vehicle.getState()
     suitResult = self.__rankedController.isSuitableVehicle(vehicle)
     if suitResult is not None:
         header, body = ('', '')
         resShortCut = R.strings.ranked_battles.rankedBattlesCarousel.lockedTooltip
         if suitResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL:
             levelStr = toRomanRangeString(suitResult.ctx['levels'])
             levelSubStr = backport.text(resShortCut.vehLvl.levelSubStr(),
                                         levels=levelStr)
             header = backport.text(resShortCut.vehLvl.header())
             body = backport.text(resShortCut.vehLvl.body(),
                                  levelSubStr=levelSubStr)
         elif suitResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_TYPE:
             typeSubStr = text_styles.neutral(
                 suitResult.ctx['forbiddenType'])
             header = backport.text(resShortCut.vehType.header())
             body = backport.text(resShortCut.vehType.body(),
                                  forbiddenType=typeSubStr)
         elif suitResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_CLASS:
             classSubStr = text_styles.neutral(
                 getTypeUserName(suitResult.ctx['forbiddenClass'], False))
             header = backport.text(resShortCut.vehClass.header())
             body = backport.text(resShortCut.vehClass.body(),
                                  forbiddenClass=classSubStr)
         if state == Vehicle.VEHICLE_STATE.UNSUITABLE_TO_QUEUE:
             result['lockedTooltip'] = makeTooltip(header, body)
         result['clickEnabled'] = True
         result['hasRankedBonus'] = False
     return result
Exemple #4
0
def _getXPFactorSlotInfo(unit, eventsCache, slotInfo):
    vehicles = unit.getVehicles()
    levels = unit.getSelectedVehicleLevels()
    isVisibleAdtMsg = False
    additionalMsg = ''
    unitHasXpBonus = True
    unitHasXpPenalty = False
    if vehicles:
        distance = levels[-1] - levels[0]
        unitHasXpBonus = distance in eventsCache.getSquadBonusLevelDistance()
        unitHasXpPenalty = distance in eventsCache.getSquadPenaltyLevelDistance(
        )
        isVisibleAdtMsg = unitHasXpBonus and slotInfo.player and slotInfo.player.isCurrentPlayer(
        ) and not slotInfo.vehicle
        if isVisibleAdtMsg:
            maxDistance = max(eventsCache.getSquadBonusLevelDistance())
            minLevel = max(MIN_VEHICLE_LEVEL, levels[0] - maxDistance)
            maxLevel = min(MAX_VEHICLE_LEVEL, levels[0] + maxDistance)
            rangeString = toRomanRangeString(range(minLevel, maxLevel + 1), 1)
            additionalMsg = i18n.makeString(PLATOON.MEMBERS_CARD_SELECTVEHICLE,
                                            level=rangeString)
    slotNotificationIcon = ''
    if slotInfo.vehicle:
        if unitHasXpPenalty:
            slotNotificationIcon = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_ALERTICON
        elif not unitHasXpBonus:
            slotNotificationIcon = RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICON
    return {
        'isVisibleAdtMsg': isVisibleAdtMsg,
        'additionalMsg': additionalMsg,
        'slotNotificationIcon': slotNotificationIcon
    }
def getMapboxFightBtnTooltipData(result):
    strPath = R.strings.mapbox.headerButtons.fightBtn.tooltip
    strAddPath = R.strings.tooltips.hangar
    restriction = result.restriction
    if restriction == PRE_QUEUE_RESTRICTION.MODE_NOT_AVAILABLE or restriction == UNIT_RESTRICTION.CURFEW:
        header = backport.text(strPath.disabled.header())
        body = backport.text(strPath.disabled.text())
    elif restriction == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL:
        levels = backport.text(strPath.mapboxVehLevel.levelSubStr(),
                               levels=toRomanRangeString(result.ctx['levels']))
        header = backport.text(strPath.mapboxVehLevel.header())
        body = backport.text(strPath.mapboxVehLevel.body(), levelSubStr=levels)
    elif restriction == UNIT_RESTRICTION.COMMANDER_VEHICLE_NOT_SELECTED:
        header = backport.text(strAddPath.startBtn.squadNotReady.header())
        body = backport.text(strAddPath.startBtn.squadNotReady.body())
    elif restriction == UNIT_RESTRICTION.VEHICLE_INVALID_LEVEL:
        header = backport.text(
            strAddPath.tankCarusel.wrongSquadVehicle.header())
        body = backport.text(strAddPath.tankCarusel.wrongSquadVehicle.body())
    elif restriction == UNIT_RESTRICTION.SPG_IS_FULL or restriction == UNIT_RESTRICTION.SPG_IS_FORBIDDEN:
        header = backport.text(
            strAddPath.tankCarusel.wrongSquadSPGVehicle.header())
        body = backport.text(
            strAddPath.tankCarusel.wrongSquadSPGVehicle.body())
    else:
        return ''
    return makeTooltip(header, body)
Exemple #6
0
def packEpicBattleInfoBlock(epicController=None):
    descLvl = text_styles.stats(
        backport.text(
            R.strings.epic_battle.selectorTooltip.epicBattle.bodyVehicleLevel(
            ),
            level=toRomanRangeString(epicController.getValidVehicleLevels())))
    season = epicController.getCurrentSeason()
    cycle = None
    cycleNumber = None
    if season is not None and not season.isSingleCycleSeason():
        hasActiveCycle = season.hasActiveCycle(
            time_utils.getCurrentLocalServerTimestamp())
        if epicController.isEnabled() and hasActiveCycle:
            cycle = season.getCycleInfo()
        else:
            cycle = season.getNextByTimeCycle(
                time_utils.getCurrentLocalServerTimestamp())
    if cycle is not None:
        cycleNumber = cycle.getEpicCycleNumber()
    if cycleNumber:
        titleStr = R.strings.epic_battle.tooltips.common.titleWithCycle()
    else:
        titleStr = R.strings.epic_battle.tooltips.common.title()
    return formatters.packTitleDescBlock(
        title=text_styles.middleTitle(
            backport.text(titleStr, season=int2roman(cycleNumber))),
        desc=text_styles.main(
            backport.text(
                R.strings.epic_battle.selectorTooltip.epicBattle.body(),
                bodyVehicleLevel=descLvl)),
        padding=formatters.packPadding(top=20, left=20, right=20),
        descPadding=formatters.packPadding(right=30))
Exemple #7
0
 def __getMultiselectionInfoVO(self):
     allowedLevels = self.falloutCtrl.getConfig().allowedLevels
     showSlots, message = self.__getMultiselectionStatus()
     result = self.prbEntity.canPlayerDoAction()
     if result.isValid:
         statusString = text_styles.statInfo(
             '#fallout:multiselectionSlot/groupReady')
     else:
         statusString = text_styles.critical(
             '#fallout:multiselectionSlot/groupNotReady')
     return {
         'formattedMessage':
         message,
         'showSlots':
         showSlots,
         'indicatorIsEnabled':
         result.isValid,
         'vehicleTypes':
         text_styles.concatStylesWithSpace(
             text_styles.middleTitle(
                 i18n.makeString(
                     '#fallout:multiselectionSlot/selectionStatus')),
             text_styles.main(
                 i18n.makeString(
                     '#fallout:multiselectionSlot/selectionRequirements',
                     level=toRomanRangeString(allowedLevels, step=1)))),
         'statusSrt':
         statusString
     }
Exemple #8
0
 def _buildVehicle(self, vehicle):
     result = super(MapboxCarouselDataProvider, self)._buildVehicle(vehicle)
     state, _ = vehicle.getState()
     if state == Vehicle.VEHICLE_STATE.UNSUITABLE_TO_QUEUE:
         validationResult = MapboxVehicleValidator.validateForMapbox(
             vehicle)
         if validationResult is not None:
             header, body = ('', '')
             resPath = R.strings.mapbox.mapboxCarousel.lockedTooltip
             if validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL:
                 levelStr = toRomanRangeString(
                     validationResult.ctx['levels'])
                 levelSubStr = backport.text(resPath.vehLvl.levelSubStr(),
                                             levels=levelStr)
                 header = backport.text(resPath.vehLvl.header())
                 body = backport.text(resPath.vehLvl.body(),
                                      levelSubStr=levelSubStr)
             elif validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_TYPE:
                 typeSubStr = text_styles.neutral(
                     validationResult.ctx['forbiddenType'])
                 header = backport.text(resPath.vehType.header())
                 body = backport.text(resPath.vehType.body(),
                                      forbiddenType=typeSubStr)
             elif validationResult.restriction == PRE_QUEUE_RESTRICTION.LIMIT_VEHICLE_CLASS:
                 classSubStr = text_styles.neutral(
                     getTypeUserName(validationResult.ctx['forbiddenClass'],
                                     False))
                 header = backport.text(resPath.vehClass.header())
                 body = backport.text(resPath.vehClass.body(),
                                      forbiddenClass=classSubStr)
             result['lockedTooltip'] = makeTooltip(header, body)
     return result
def _getDisabledFunRandomTooltip(tooltipStr, funRandomCtrl=None):
    availableLevels = funRandomCtrl.getModeSettings().levels
    minLevel, maxLevel = min(availableLevels), max(availableLevels)
    levels = int2roman(
        minLevel) if minLevel == maxLevel else toRomanRangeString(
            availableLevels)
    return backport.text(tooltipStr, levels=levels)
 def _getFalloutVehMinStr(self):
     config = self.falloutCtrl.getConfig()
     allowedLevelsList = list(config.allowedLevels)
     if len(allowedLevelsList) > 1:
         return (CYBERSPORT.WINDOW_UNIT_MESSAGE_FALLOUTMIN_LEVELRANGE, {'level': toRomanRangeString(allowedLevelsList, 1)})
     else:
         return (CYBERSPORT.WINDOW_UNIT_MESSAGE_FALLOUTMIN_REQUIREDLEVEL, {'level': int2roman(config.vehicleLevelRequired)})
Exemple #11
0
 def __getSandboxTooltipData(self, ctx):
     return makeTooltip(
         i18n.makeString(
             MENU.HEADERBUTTONS_FIGHTBTN_TOOLTIP_SANDBOX_INVALID_HEADER),
         i18n.makeString(
             MENU.HEADERBUTTONS_FIGHTBTN_TOOLTIP_SANDBOX_INVALID_LEVEL_BODY,
             levels=toRomanRangeString(ctx['levels'], 1)))
Exemple #12
0
 def __updateMultiselectionData(self):
     falloutCfg = self.__falloutCtrl.getConfig()
     showSlots, msg = self.__getMultiselectionStatus()
     canDo, _ = self.prbDispatcher.canPlayerDoAction()
     data = {
         'multiSelectionIsEnabled':
         self.__multiselectionMode,
         'formattedMessage':
         msg,
         'showSlots':
         showSlots,
         'slots':
         self.__getMultiselectionSlots(),
         'indicatorIsEnabled':
         canDo,
         'vehicleTypes':
         middleTitle(
             i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) +
         ' ' + main(
             i18n.makeString(
                 FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS,
                 level=toRomanRangeString(list(falloutCfg.allowedLevels),
                                          1))),
         'statusSrt':
         statInfo(FALLOUT.MULTISELECTIONSLOT_GROUPREADY)
         if canDo else critical(FALLOUT.MULTISELECTIONSLOT_GROUPNOTREADY)
     }
     self.as_setMultiselectionModeS(data)
 def _getFalloutVehMinStr(self):
     config = getFalloutCtrl().getConfig()
     allowedLevelsList = list(config.allowedLevels)
     if len(allowedLevelsList) > 1:
         return (CYBERSPORT.WINDOW_UNIT_MESSAGE_FALLOUTMIN_LEVELRANGE, {'level': toRomanRangeString(allowedLevelsList, 1)})
     else:
         return (CYBERSPORT.WINDOW_UNIT_MESSAGE_FALLOUTMIN_REQUIREDLEVEL, {'level': int2roman(config.vehicleLevelRequired)})
 def __updateHeader(self):
     allowedLevelsList = list(self.__falloutCtrl.getConfig().allowedLevels)
     allowedLevelsStr = toRomanRangeString(allowedLevelsList, 1)
     vehicleLbl = i18n.makeString(CYBERSPORT.WINDOW_UNIT_TEAMVEHICLESLBL, levelsRange=text_styles.main(allowedLevelsStr))
     tooltipData = {}
     if len(allowedLevelsList) > 1:
         tooltipData = self.__dominationVehicleInfoTooltip(self.__falloutCtrl.getConfig().vehicleLevelRequired, allowedLevelsStr)
     self.as_setVehiclesTitleS(vehicleLbl, tooltipData)
Exemple #15
0
 def constructForVehicle(cls, levels, vehicleIsAvailableForBuy, vehicleIsAvailableForRestore):
     minLvl, maxLvl = levels
     levels = toRomanRangeString(range(minLvl, maxLvl + 1))
     reason = R.strings.ranked_battles.rankedBattlesUnreachableView.vehicleUnavailable()
     if vehicleIsAvailableForBuy:
         reason = R.strings.ranked_battles.rankedBattlesUnreachableView.vehicleAvailableForBuy()
     elif vehicleIsAvailableForRestore:
         reason = R.strings.ranked_battles.rankedBattlesUnreachableView.vehicleAvailableForRestore()
     return cls(alertIcon=backport.image(R.images.gui.maps.icons.library.alertBigIcon()), buttonLabel=backport.text(cls._RES_ROOT.button.moreInfo()), buttonVisible=True, statusText=text_styles.vehicleStatusCriticalText(backport.text(cls._RES_ROOT.unsuitableVehicles(), levels=levels)), shadowFilterVisible=True, tooltip=makeTooltip(body=backport.text(reason, levels=levels)), isSimpleTooltip=True)
Exemple #16
0
 def __fillViewModel(self):
     with self.viewModel.transaction() as vm:
         self.__resetViewModel(vm)
         currentSeason = self.__epicController.getCurrentSeason()
         nextSeason = self.__epicController.getNextSeason()
         season = currentSeason or nextSeason
         currentTime = time_utils.getCurrentLocalServerTimestamp()
         vm.setConditions(
             backport.text(
                 R.strings.mode_selector.mode.epicBattle.condition(),
                 levels=toRomanRangeString(
                     self.__epicController.getValidVehicleLevels())))
         vm.setDescription(
             backport.text(
                 R.strings.mode_selector.mode.epicBattle.description()))
         if season is None:
             return
         if season.hasActiveCycle(currentTime):
             vm.setStatusActive(
                 backport.text(
                     R.strings.mode_selector.mode.epicBattle.seasonActive(),
                     cycle=int2roman(currentSeason.getCycleInfo().
                                     getEpicCycleNumber())))
             self._addReward(ModeSelectorRewardID.CREDITS)
             self._addReward(ModeSelectorRewardID.EXPERIENCE)
             timeLeftStr = ''
             cycleInfo = season.getCycleInfo()
             if cycleInfo is not None:
                 timeLeftStr = time_formatters.getTillTimeByResource(
                     cycleInfo.endDate - currentTime,
                     R.strings.menu.Time.timeLeftShort,
                     removeLeadingZeros=True)
             vm.setTimeLeft(timeLeftStr)
         else:
             cycleInfo = season.getNextByTimeCycle(currentTime)
             if cycleInfo is not None:
                 if cycleInfo.announceOnly:
                     vm.setStatusNotActive(
                         backport.text(R.strings.mode_selector.mode.
                                       epicBattle.cycleSoon(),
                                       cycle=int2roman(
                                           cycleInfo.getEpicCycleNumber())))
                 else:
                     vm.setStatusNotActive(
                         backport.text(R.strings.mode_selector.mode.
                                       epicBattle.cycleNext(),
                                       cycle=int2roman(
                                           cycleInfo.getEpicCycleNumber()),
                                       date=backport.getShortDateFormat(
                                           cycleInfo.startDate)))
                 self.viewModel.setBattlePassState(BattlePassState.NONE)
             else:
                 vm.setStatusNotActive(
                     backport.text(R.strings.mode_selector.mode.epicBattle.
                                   seasonEnd()))
     setBattlePassState(self.viewModel)
     return
Exemple #17
0
 def getRentEpicSeasonLeftStr(self, timeStyle):
     cycles = self.__rentInfo.getRentalPeriodInCycles()
     if not cycles:
         return (None, None, {})
     else:
         timeLeftString = toRomanRangeString(
             [cycle.ordinalNumber for cycle in cycles])
         identifier = RentDurationKeys.CYCLES if len(
             cycles) > 1 else RentDurationKeys.CYCLE
         return (identifier, timeLeftString, {})
 def __getNotAvailableVehiclesTooltip(self):
     path = R.strings.tooltips.mode_selector.unavailable.notVehicles
     availableLevels = self.__funRandomCtrl.getModeSettings().levels
     minLevel, maxLevel = min(availableLevels), max(availableLevels)
     if minLevel == maxLevel:
         levels = int2roman(minLevel)
     else:
         levels = toRomanRangeString(availableLevels)
     vehicleLevels = backport.text(path.level(), levels=levels)
     return backport.text(path.text(), vehicles=vehicleLevels)
 def _getFalloutVehLevelStr(self):
     config = g_eventsCache.getFalloutConfig(self._extra.eventType)
     if len(config.allowedLevels) > 1:
         return ('#cyberSport:window/unit/message/falloutMin', {
             'level': toRomanRangeString(list(config.allowedLevels), 1)
         })
     else:
         return ('#cyberSport:window/unit/message/falloutLevel', {
             'level': int2roman(config.vehicleLevelRequired)
         })
Exemple #20
0
 def __getFalloutFightBtnTooltipData(self, state):
     falloutCtrl = getFalloutCtrl()
     config = falloutCtrl.getConfig()
     if state == PREBATTLE_RESTRICTION.VEHICLE_FALLOUT_ONLY:
         header = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutOnly/header')
         body = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutOnly/body')
     elif state == PREBATTLE_RESTRICTION.FALLOUT_NOT_SELECTED:
         header = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutNotSelected/header'
         )
         body = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutNotSelected/body')
     elif state == PREBATTLE_RESTRICTION.VEHICLE_GROUP_IS_NOT_READY:
         header = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutNotReady/header')
         body = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutNotReady/body')
     elif state == UNIT_RESTRICTION.FALLOUT_NOT_ENOUGH_PLAYERS:
         header = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutNotEnoughPlayer/header'
         )
         body = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutNotEnoughPlayer/body'
         )
     elif state in (UNIT_RESTRICTION.FALLOUT_VEHICLE_LEVEL_REQUIRED,
                    PREBATTLE_RESTRICTION.VEHICLE_GROUP_REQUIRED):
         header = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutVehLevelRequired/header'
         )
         body = i18n.makeString(
             '#menu:headerButtons/fightBtn/tooltip/falloutVehLevelRequired/body',
             level=int2roman(config.vehicleLevelRequired))
     elif state in (UNIT_RESTRICTION.FALLOUT_VEHICLE_MIN,
                    PREBATTLE_RESTRICTION.VEHICLE_GROUP_MIN):
         allowedLevelsList = list(config.allowedLevels)
         if len(allowedLevelsList) > 1:
             header = i18n.makeString(
                 '#menu:headerButtons/fightBtn/tooltip/falloutVehMin/header'
             )
             body = i18n.makeString(
                 '#menu:headerButtons/fightBtn/tooltip/falloutVehMin/body',
                 min=str(config.minVehiclesPerPlayer),
                 level=toRomanRangeString(allowedLevelsList, 1))
         else:
             header = i18n.makeString(
                 '#menu:headerButtons/fightBtn/tooltip/falloutVehLevelRequired/header'
             )
             body = i18n.makeString(
                 '#menu:headerButtons/fightBtn/tooltip/falloutVehLevelRequired/body',
                 level=int2roman(config.vehicleLevelRequired))
     else:
         return None
     return makeTooltip(header, body)
Exemple #21
0
def _getBalancedSquadInfo(isPlayerCreator, levelsRange, player, unit, vehicle):
    isVisibleAdtMsg = player and player.isCurrentPlayer(
    ) and not isPlayerCreator and not vehicle and unit and bool(
        unit.getVehicles())
    if isVisibleAdtMsg:
        rangeString = toRomanRangeString(levelsRange, 1)
        additionMsg = i18n.makeString(PLATOON.MEMBERS_CARD_SELECTVEHICLE,
                                      level=rangeString)
    else:
        additionMsg = ''
    return {'isVisibleAdtMsg': isVisibleAdtMsg, 'additionalMsg': additionMsg}
 def __packMainBlock(self):
     header = backport.text(R.strings.tooltips.battleTypes.mapbox.header())
     body = makeHtmlString(
         self.__BODY_TEMPLATE_PATH,
         self.__BODY_TEMPLATE_KEY,
         ctx={
             'range':
             toRomanRangeString(self.__mapboxCtrl.getModeSettings().levels)
         })
     return formatters.packTitleDescBlock(
         title=text_styles.middleTitle(header), desc=text_styles.main(body))
 def __getSandboxTooltipData(self, result):
     state = result.restriction
     if state == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL:
         return makeTooltip(
             i18n.makeString(
                 MENU.HEADERBUTTONS_FIGHTBTN_TOOLTIP_SANDBOX_INVALID_HEADER
             ),
             i18n.makeString(
                 MENU.
                 HEADERBUTTONS_FIGHTBTN_TOOLTIP_SANDBOX_INVALID_LEVEL_BODY,
                 levels=toRomanRangeString(result.ctx['levels'], 1)))
     return ''
Exemple #24
0
 def __updateHeader(self):
     allowedLevelsList = list(self.falloutCtrl.getConfig().allowedLevels)
     allowedLevelsStr = toRomanRangeString(allowedLevelsList, 1)
     vehicleLbl = i18n.makeString(
         CYBERSPORT.WINDOW_UNIT_TEAMVEHICLESLBL,
         levelsRange=text_styles.main(allowedLevelsStr))
     tooltipData = {}
     if len(allowedLevelsList) > 1:
         tooltipData = self.__dominationVehicleInfoTooltip(
             self.falloutCtrl.getConfig().vehicleLevelRequired,
             allowedLevelsStr)
     self.as_setVehiclesTitleS(vehicleLbl, tooltipData)
 def __updateTierFilterString(self):
     platoonCtrl = self.__platoonCtrl
     if platoonCtrl.isTankLevelPreferenceEnabled():
         searchFlags, isExpanded = platoonCtrl.getExpandedSearchFlags()
         if not self.__tiersString or searchFlags != self.__searchFlags:
             self.__searchFlags = searchFlags
             self.__tiersString = toRomanRangeString(convertTierFilterToList(searchFlags), 1)
         self.__isExpanded = isExpanded
     else:
         self.__tiersString = ''
         self.__isExpanded = False
     self.__updateViewModel()
Exemple #26
0
 def __getStatus(self):
     if not self.__tradeIn.isEnabled():
         return (backport.text(_RScopeTradeIn.expired()), False, True)
     elif self.__tradeOffVehicle is not None and self.__tradeInVehicle is not None:
         tradeOffVehicles = self.__tradeIn.getTradeOffVehicles(self.__tradeInVehicle.level)
         isValidSelected = self.__tradeOffVehicle.intCD in tradeOffVehicles
         return (backport.text(_RScopeTradeIn.tradeOffPriceText() if isValidSelected else _RScopeTradeIn.invalidTradeOffVehicle()), isValidSelected, isValidSelected)
     elif self.__tradeIn.getTradeOffVehicles() and self.__tradeInVehicle is not None:
         levels = self.__tradeIn.getAllowedVehicleLevels(maxLevel=self.__tradeInVehicle.level)
         romanLevels = text_styles.neutral(toRomanRangeString(sequence=levels, rangeDelimiter=backport.text(R.strings.menu.rangeDelimiter())))
         return (backport.text(_RScopeTradeIn.availableLevels()).format(levels=romanLevels), True, True)
     else:
         return (backport.text(_RScopeTradeIn.notAvailableTradeOffVehicles()), False, True)
Exemple #27
0
 def __getMultiselectionStatus(self):
     config = self.falloutCtrl.getConfig()
     battleType = self.falloutCtrl.getBattleType()
     messageTemplate = '#fallout:multiselectionSlot/{}'.format(battleType)
     if not config.hasRequiredVehicles():
         return (
             False,
             text_styles.critical(
                 i18n.makeString(
                     '{}/topTierVehicleRequired'.format(messageTemplate),
                     level=toRomanRangeString(config.allowedLevels, step=1),
                     requiredLevel=int2roman(config.vehicleLevelRequired))))
     if self.falloutCtrl.getSelectedVehicles():
         return (
             True,
             text_styles.concatStylesToMultiLine(
                 text_styles.middleTitle(
                     i18n.makeString(
                         '#fallout:multiselectionSlot/selectionStatus')),
                 text_styles.main(
                     i18n.makeString(
                         '#fallout:multiselectionSlot/selectionRequirements',
                         level=toRomanRangeString(config.allowedLevels,
                                                  step=1)))))
     if config.getAllowedVehicles():
         return (False,
                 text_styles.concatStylesToMultiLine(
                     text_styles.highTitle(
                         i18n.makeString(
                             '{}/descriptionTitle'.format(messageTemplate),
                             topLevel=int2roman(max(
                                 config.allowedLevels)))),
                     text_styles.main(
                         i18n.makeString(
                             '{}/message'.format(messageTemplate),
                             level=toRomanRangeString(config.allowedLevels,
                                                      step=1)))))
     return (False, '')
Exemple #28
0
 def __getMultiselectionStatus(self):
     if self.__multiselectionMode:
         falloutCfg = self.__falloutCtrl.getConfig()
         messageTemplate = '#fallout:multiselectionSlot/{0}'.format(
             self.__falloutCtrl.getBattleType())
         if not falloutCfg.hasRequiredVehicles():
             levels = list(falloutCfg.allowedLevels)
             return (False,
                     critical(
                         i18n.makeString(
                             messageTemplate + '/topTierVehicleRequired',
                             level=toRomanRangeString(levels, 1),
                             requiredLevel=int2roman(
                                 falloutCfg.vehicleLevelRequired))))
         if self.__falloutCtrl.getSelectedVehicles():
             return (
                 True,
                 middleTitle(
                     i18n.makeString(
                         FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) +
                 '\n' + main(
                     i18n.makeString(
                         FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS,
                         level=toRomanRangeString(
                             list(falloutCfg.allowedLevels), 1))))
         if falloutCfg.getAllowedVehicles():
             levels = list(falloutCfg.allowedLevels)
             topLevel = levels[-1]
             header = highTitle(
                 i18n.makeString(messageTemplate + '/descriptionTitle',
                                 topLevel=int2roman(topLevel)))
             body = main(
                 i18n.makeString(messageTemplate + '/message',
                                 level=toRomanRangeString(levels, 1)))
             return (False, header + '\n' + body)
     return (False, '')
def packEpicBattleInfoBlock(epicController=None):
    descLvl = text_styles.stats(
        backport.text(
            R.strings.epic_battle.selectorTooltip.epicBattle.bodyVehicleLevel(
            ),
            level=toRomanRangeString(epicController.getValidVehicleLevels())))
    return formatters.packTitleDescBlock(
        title=text_styles.middleTitle(
            backport.text(R.strings.epic_battle.tooltips.common.title())),
        desc=text_styles.main(
            backport.text(
                R.strings.epic_battle.selectorTooltip.epicBattle.body(),
                bodyVehicleLevel=descLvl)),
        padding=formatters.packPadding(top=20, left=20, right=20),
        descPadding=formatters.packPadding(right=30))
Exemple #30
0
 def __getMultiselectionStatus(self):
     if self.__multiselectionMode:
         falloutCfg = self.__falloutCtrl.getConfig()
         messageTemplate = '#fallout:multiselectionSlot/%d' % self.__falloutCtrl.getBattleType()
         if not falloutCfg.hasRequiredVehicles():
             return (False, i18n.makeString(messageTemplate + '/topTierVehicleRequired', level=int2roman(falloutCfg.vehicleLevelRequired)))
         if self.__falloutCtrl.getSelectedVehicles():
             return (True, middleTitle(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) + '\n' + main(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS, level=toRomanRangeString(list(falloutCfg.allowedLevels), 1))))
         if falloutCfg.getAllowedVehicles():
             levels = list(falloutCfg.allowedLevels)
             topLevel = levels[-1]
             header = highTitle(i18n.makeString(messageTemplate + '/descriptionTitle', topLevel=int2roman(topLevel)))
             body = main(i18n.makeString(messageTemplate + '/message', level=toRomanRangeString(levels, 1)))
             return (False, header + '\n' + body)
     return (False, '')
 def canSelectVehicle(self, vehicle):
     if not self.isSelected():
         return (False, '')
     cfg = self.getConfig()
     if findFirst(lambda v: v.level == cfg.vehicleLevelRequired,
                  self.getSelectedVehicles()
                  ) is None and vehicle.level != cfg.vehicleLevelRequired:
         return (False,
                 i18n.makeString(
                     FALLOUT.TANKCAROUSELSLOT_SELECTIONBUTTONTOOLTIP,
                     requiredLevel=int2roman(cfg.vehicleLevelRequired),
                     level=toRomanRangeString(
                         list(cfg.allowedLevels -
                              {cfg.vehicleLevelRequired}), 1)))
     return (True, '')
 def __fillModel(self):
     currentSeason = self.__funRandomCtrl.getCurrentSeason()
     hasSeasons = bool(currentSeason is not None
                       or self.__funRandomCtrl.getNextSeason() is not None)
     if not hasSeasons or not self.__funRandomCtrl.isEnabled():
         self.onCardChange()
         return
     else:
         with self.viewModel.transaction() as model:
             model.setTimeLeft(formatSeasonLeftTime(currentSeason))
             model.setIsDisabled(self._isDisabled())
             model.setConditions(
                 backport.text(
                     R.strings.mode_selector.mode.fun_random.condition(),
                     levels=toRomanRangeString(
                         self.__funRandomCtrl.getModeSettings().levels)))
             self.__updateStatus(model)
         return
 def __getRankedFightBtnTooltipData(self, result):
     state = result.restriction
     if state == PRE_QUEUE_RESTRICTION.MODE_DISABLED:
         header = i18n.makeString(
             MENU.HEADERBUTTONS_FIGHTBTN_TOOLTIP_RANKEDDISABLED_HEADER)
         body = i18n.makeString(
             MENU.HEADERBUTTONS_FIGHTBTN_TOOLTIP_RANKEDDISABLED_BODY)
     elif state == PRE_QUEUE_RESTRICTION.LIMIT_LEVEL:
         header = i18n.makeString(
             MENU.
             HEADERBUTTONS_FIGHTBTN_TOOLTIP_RANKEDVEHLEVELREQUIRED_HEADER)
         body = i18n.makeString(
             MENU.
             HEADERBUTTONS_FIGHTBTN_TOOLTIP_RANKEDVEHLEVELREQUIRED_BODY,
             level=toRomanRangeString(result.ctx['levels'], 1))
     else:
         return ''
     return makeTooltip(header, body)
 def carouselSelectionButtonTooltip(self):
     cfg = self.getConfig()
     return i18n.makeString(FALLOUT.TANKCAROUSELSLOT_SELECTIONBUTTONTOOLTIP, requiredLevel=int2roman(cfg.vehicleLevelRequired), level=toRomanRangeString(list(cfg.allowedLevels), 1))
 def _getFalloutVehLevelStr(self):
     config = g_eventsCache.getFalloutConfig(self._extra.eventType)
     if len(config.allowedLevels) > 1:
         return ('#cyberSport:window/unit/message/falloutMin', {'level': toRomanRangeString(list(config.allowedLevels), 1)})
     else:
         return ('#cyberSport:window/unit/message/falloutLevel', {'level': int2roman(config.vehicleLevelRequired)})
Exemple #36
0
def _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app = None, levelsRange = None, checkForVehicles = True):
    isPlayerCreator = pInfo.isCreator()
    isPlayerInSlot = pInfo.isInSlot
    slots = []
    userGetter = storage_getter('users')().getUser
    colorGetter = g_settings.getColorScheme('rosters').getColors
    vehicleGetter = g_itemsCache.items.getItemByCD
    canTakeSlot = not pInfo.isLegionary()
    if app:
        isPlayerSpeaking = app.voiceChatManager.isPlayerSpeaking
    else:
        isPlayerSpeaking = lambda dbID: False
    if unit.isSquad():
        falloutBattleType = unit.getExtra().eventType
        isFallout = falloutBattleType != FALLOUT_BATTLE_TYPE.UNDEFINED
        falloutCfg = g_eventsCache.getFalloutConfig(falloutBattleType)
    else:
        falloutBattleType = FALLOUT_BATTLE_TYPE.UNDEFINED
        isFallout = False
        falloutCfg = None
    if unit is None:
        makeVO = makePlayerVO
    elif unit.isFortBattle():
        makeVO = makeClanBattlePlayerVO
    elif unit.isSortie():
        makeVO = makeSortiePlayerVO
    elif unit.isClub():
        makeVO = makeStaticFormationPlayerVO
    else:
        makeVO = makePlayerVO
    for slotInfo in slotsIter:
        index = slotInfo.index
        slotState = slotInfo.state
        player = slotInfo.player
        vehicle = slotInfo.vehicle
        canAssign, vehicles = pInfo.canAssignToSlot(index)
        vehCount = len(vehicles)
        slotLevel = 0
        vehicleVO = None
        slotPlayerUI = None
        if player is not None:
            dbID = player.dbID
            slotPlayerUI = makeVO(player, userGetter(dbID), colorGetter, isPlayerSpeaking(dbID))
            isCurrentPlayer = player.isCurrentPlayer()
            if vehicle:
                if 'vehLevel' in vehicle:
                    slotLevel = vehicle['vehLevel']
                if 'vehTypeCompDescr' in vehicle:
                    vehicleVO = makeVehicleVO(vehicleGetter(vehicle['vehTypeCompDescr']), levelsRange, isCurrentPlayer=isCurrentPlayer)
        if unit is not None and unit.isClub():
            slotLabel = makeStaticSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles, pInfo.isLegionary(), unit.isRated())
        else:
            isRequired = falloutBattleType == FALLOUT_BATTLE_TYPE.MULTITEAM
            slotLabel = makeSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles, isRequired=isRequired)
        if unit.isSquad():
            playerStatus = getSquadPlayerStatus(slotState, player)
        else:
            playerStatus = getPlayerStatus(slotState, player)
        if unit is not None:
            restrictions = makeUnitRosterVO(unit, pInfo, index=index, isSortie=unit.isSortie(), levelsRange=levelsRange)['conditions']
        else:
            restrictions = []
        slot = {'rallyIdx': unitIdx,
         'isCommanderState': isPlayerCreator,
         'isCurrentUserInSlot': isPlayerInSlot,
         'playerStatus': playerStatus,
         'isClosed': slotState.isClosed,
         'isFreezed': unitState.isFreezed(),
         'slotLabel': slotLabel,
         'player': slotPlayerUI,
         'canBeTaken': canAssign and canTakeSlot,
         'compatibleVehiclesCount': vehCount,
         'selectedVehicle': vehicleVO,
         'selectedVehicleLevel': 1 if slotState.isClosed else slotLevel,
         'restrictions': restrictions,
         'isFallout': isFallout}
        if isFallout:
            vehiclesNotify = [None, None, None]
            selectedVehicles = [None, None, None]
            if player is not None:
                dbID = player.dbID
                isCurrentPlayer = player.isCurrentPlayer()
                if isCurrentPlayer:
                    if falloutBattleType == FALLOUT_BATTLE_TYPE.MULTITEAM:
                        vehiclesNotify[0] = [i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFYMULTITEAM)]
                    else:
                        vehiclesNotify[0] = [i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFY, level=text_styles.main(int2roman(falloutCfg.vehicleLevelRequired)))]
                    if len(falloutCfg.allowedLevels) > 1:
                        statusTemplate = i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFYRANGE, level=text_styles.main(toRomanRangeString(list(falloutCfg.allowedLevels), 1)))
                    else:
                        statusTemplate = i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFYMULTITEAM)
                    for slotIdx in range(1, falloutCfg.minVehiclesPerPlayer):
                        vehiclesNotify[slotIdx] = statusTemplate

                for idx, (vInvID, vehIntCD) in enumerate(unit.getExtra().accountVehicles.get(dbID, ())):
                    selectedVehicles[idx] = makeVehicleVO(vehicleGetter(vehIntCD), falloutCfg.allowedLevels, isCurrentPlayer=isCurrentPlayer)

            slot['vehiclesNotify'] = vehiclesNotify
            slot['selectedVehicle'] = selectedVehicles
        slots.append(slot)

    return slots
Exemple #37
0
 def __updateHeader(self):
     if self.__isFallout:
         vehicleLbl = text_styles.standard(i18n.makeString(CYBERSPORT.WINDOW_UNIT_TEAMVEHICLESLBL, levelsRange=toRomanRangeString(list(self.__falloutCfg.allowedLevels), 1)))
         self.as_setVehiclesTitleS(vehicleLbl)
 def getDescription(self):
     localeStr = i18n.makeString(self.MAIN_TEXT_KEY + self._typeID)
     return text_styles.main(localeStr % toRomanRangeString(list(self._lvls), 1))
 def getHeader(self):
     localeStr = i18n.makeString(self.HEADER_KEY + self._typeID)
     return text_styles.highTitle(localeStr % toRomanRangeString(list(self._lvls), 1))
 def __getMultiselectionStatus(self):
     config = self._falloutCtrl.getConfig()
     battleType = self._falloutCtrl.getBattleType()
     messageTemplate = '#fallout:multiselectionSlot/{}'.format(battleType)
     if not config.hasRequiredVehicles():
         return (False, text_styles.critical(i18n.makeString('{}/topTierVehicleRequired'.format(messageTemplate), level=toRomanRangeString(config.allowedLevels, step=1), requiredLevel=int2roman(config.vehicleLevelRequired))))
     if self._falloutCtrl.getSelectedVehicles():
         return (True, text_styles.concatStylesToMultiLine(text_styles.middleTitle(i18n.makeString('#fallout:multiselectionSlot/selectionStatus')), text_styles.main(i18n.makeString('#fallout:multiselectionSlot/selectionRequirements', level=toRomanRangeString(config.allowedLevels, step=1)))))
     if config.getAllowedVehicles():
         return (False, text_styles.concatStylesToMultiLine(text_styles.highTitle(i18n.makeString('{}/descriptionTitle'.format(messageTemplate), topLevel=int2roman(max(config.allowedLevels)))), text_styles.main(i18n.makeString('{}/message'.format(messageTemplate), level=toRomanRangeString(config.allowedLevels, step=1)))))
     return (False, '')
 def __getMultiselectionInfoVO(self):
     allowedLevels = self._falloutCtrl.getConfig().allowedLevels
     showSlots, message = self.__getMultiselectionStatus()
     canDoAction, _ = self.prbDispatcher.canPlayerDoAction()
     if canDoAction:
         statusString = text_styles.statInfo('#fallout:multiselectionSlot/groupReady')
     else:
         statusString = text_styles.critical('#fallout:multiselectionSlot/groupNotReady')
     return {'formattedMessage': message,
      'showSlots': showSlots,
      'indicatorIsEnabled': canDoAction,
      'vehicleTypes': text_styles.concatStylesWithSpace(text_styles.middleTitle(i18n.makeString('#fallout:multiselectionSlot/selectionStatus')), text_styles.main(i18n.makeString('#fallout:multiselectionSlot/selectionRequirements', level=toRomanRangeString(allowedLevels, step=1)))),
      'statusSrt': statusString}
 def _getFalloutVehMinStr(self):
     if self._extra is None:
         return
     else:
         config = g_eventsCache.getFalloutConfig(self._extra.eventType)
         allowedLevelsList = list(config.allowedLevels)
         if len(allowedLevelsList) > 1:
             return (CYBERSPORT.WINDOW_UNIT_MESSAGE_FALLOUTMIN_LEVELRANGE, {'level': toRomanRangeString(allowedLevelsList, 1)})
         return (CYBERSPORT.WINDOW_UNIT_MESSAGE_FALLOUTMIN_REQUIREDLEVEL, {'level': int2roman(config.vehicleLevelRequired)})
         return
def _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app = None, levelsRange = None, checkForVehicles = True):
    isPlayerCreator = pInfo.isCreator()
    isPlayerInSlot = pInfo.isInSlot
    slots = []
    userGetter = storage_getter('users')().getUser
    colorGetter = g_settings.getColorScheme('rosters').getColors
    vehicleGetter = g_itemsCache.items.getItemByCD
    canTakeSlot = not pInfo.isLegionary()
    bwPlugin = proto_getter(PROTO_TYPE.BW_CHAT2)(None)
    isPlayerSpeaking = bwPlugin.voipController.isPlayerSpeaking
    falloutCtrl = getFalloutCtrl()
    isFallout = falloutCtrl.isEnabled()
    if isFallout:
        falloutBattleType = falloutCtrl.getBattleType()
        falloutCfg = falloutCtrl.getConfig()
    else:
        falloutBattleType = QUEUE_TYPE.UNKNOWN
        falloutCfg = None
    if unit is None:
        makeVO = makePlayerVO
    elif unit.isFortBattle():
        makeVO = makeClanBattlePlayerVO
    elif unit.isSortie():
        makeVO = makeSortiePlayerVO
    elif unit.isClub():
        makeVO = makeStaticFormationPlayerVO
    else:
        makeVO = makePlayerVO
    rosterSlots = {}
    isDefaultSlot = False
    if unit is not None:
        roster = unit.getRoster()
        rosterSlots = roster.slots
        isDefaultSlot = roster.isDefaultSlot
    for slotInfo in slotsIter:
        index = slotInfo.index
        slotState = slotInfo.state
        player = slotInfo.player
        vehicle = slotInfo.vehicle
        canAssign, vehicles = pInfo.canAssignToSlot(index)
        vehCount = len(vehicles)
        slotLevel = 0
        vehicleVO = None
        slotPlayerUI = None
        if player is not None:
            dbID = player.dbID
            slotPlayerUI = makeVO(player, userGetter(dbID), colorGetter, isPlayerSpeaking(dbID))
            isCurrentPlayer = player.isCurrentPlayer()
            if vehicle:
                slotLevel = vehicle.vehLevel
                if vehicle.vehTypeCompDescr:
                    vehicleVO = makeVehicleVO(vehicleGetter(vehicle.vehTypeCompDescr), levelsRange, isCurrentPlayer=isCurrentPlayer)
        if unit is not None and unit.isClub():
            slotLabel = makeStaticSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles, pInfo.isLegionary(), unit.isRated())
        else:
            isRequired = falloutBattleType == QUEUE_TYPE.FALLOUT_MULTITEAM
            slotLabel = makeSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles, isRequired=isRequired)
        if unit.isPrebattlesSquad():
            playerStatus = getSquadPlayerStatus(slotState, player)
        else:
            playerStatus = getPlayerStatus(slotState, player)
        if unit is not None:
            restrictions = makeUnitRosterConditions(rosterSlots, isDefaultSlot, index=index, isSortie=unit.isSortie(), levelsRange=levelsRange)
        else:
            restrictions = []
        slot = {'rallyIdx': unitIdx,
         'isCommanderState': isPlayerCreator,
         'isCurrentUserInSlot': isPlayerInSlot,
         'playerStatus': playerStatus,
         'isClosed': slotState.isClosed,
         'isFreezed': unitState.isFreezed(),
         'slotLabel': slotLabel,
         'player': slotPlayerUI,
         'canBeTaken': canAssign and canTakeSlot,
         'compatibleVehiclesCount': vehCount,
         'selectedVehicle': vehicleVO,
         'selectedVehicleLevel': 1 if slotState.isClosed else slotLevel,
         'restrictions': restrictions,
         'isFallout': isFallout}
        if unit.isSquad():
            if g_eventsCache.isBalancedSquadEnabled():
                isVisibleAdtMsg = player and player.isCurrentPlayer() and not isPlayerCreator and not vehicle and unit and bool(unit.getMemberVehicles(unit.getCommanderDBID()))
                if isVisibleAdtMsg:
                    rangeString = toRomanRangeString(levelsRange, 1)
                    additionMsg = text_styles.main(i18n.makeString(MESSENGER.DIALOGS_SIMPLESQUAD_VEHICLELEVEL, level=rangeString))
                else:
                    additionMsg = ''
                slot.update({'isVisibleAdtMsg': isVisibleAdtMsg,
                 'additionalMsg': additionMsg})
            elif g_eventsCache.isSquadXpFactorsEnabled():
                vehicles = unit.getVehicles()
                levels = unit.getSelectedVehicleLevels()
                isVisibleAdtMsg = False
                additionalMsg = ''
                unitHasXpBonus = True
                unitHasXpPenalty = False
                if vehicles:
                    distance = levels[-1] - levels[0]
                    unitHasXpBonus = distance in g_eventsCache.getSquadBonusLevelDistance()
                    unitHasXpPenalty = distance in g_eventsCache.getSquadPenaltyLevelDistance()
                    isVisibleAdtMsg = unitHasXpBonus and player and player.isCurrentPlayer() and not vehicle
                    if isVisibleAdtMsg:
                        maxDistance = max(g_eventsCache.getSquadBonusLevelDistance())
                        minLevel = max(MIN_VEHICLE_LEVEL, levels[0] - maxDistance)
                        maxLevel = min(MAX_VEHICLE_LEVEL, levels[0] + maxDistance)
                        rangeString = toRomanRangeString(range(minLevel, maxLevel + 1), 1)
                        additionalMsg = text_styles.main(i18n.makeString(MESSENGER.DIALOGS_SIMPLESQUAD_VEHICLELEVEL, level=rangeString))
                slotNotificationIcon = ''
                slotNotificationIconTooltip = ''
                if vehicle:
                    if unitHasXpPenalty:
                        slotNotificationIcon = RES_ICONS.MAPS_ICONS_LIBRARY_CYBERSPORT_ALERTICON
                        slotNotificationIconTooltip = makeTooltip(TOOLTIPS.SQUADWINDOW_SIMPLESLOTNOTIFICATION_ALERT_HEADER, TOOLTIPS.SQUADWINDOW_SIMPLESLOTNOTIFICATION_ALERT_BODY, None, TOOLTIPS.SQUADWINDOW_SIMPLESLOTNOTIFICATION_ALERT_ALERT)
                    elif not unitHasXpBonus:
                        slotNotificationIcon = RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICON
                        slotNotificationIconTooltip = makeTooltip(TOOLTIPS.SQUADWINDOW_SIMPLESLOTNOTIFICATION_INFO_HEADER, TOOLTIPS.SQUADWINDOW_SIMPLESLOTNOTIFICATION_INFO_BODY)
                slot.update({'isVisibleAdtMsg': isVisibleAdtMsg,
                 'additionalMsg': additionalMsg,
                 'slotNotificationIconTooltip': slotNotificationIconTooltip,
                 'slotNotificationIcon': slotNotificationIcon})
        if unit.isEvent():
            isVisibleAdtMsg = player and player.isCurrentPlayer() and not vehicle
            additionMsg = ''
            if isVisibleAdtMsg:
                vehiclesNames = [ veh.userName for veh in g_eventsCache.getEventVehicles() ]
                additionMsg = text_styles.main(i18n.makeString(MESSENGER.DIALOGS_EVENTSQUAD_VEHICLE, vehName=', '.join(vehiclesNames)))
            slot.update({'isVisibleAdtMsg': isVisibleAdtMsg,
             'additionalMsg': additionMsg})
        if isFallout:
            vehiclesNotify = [None, None, None]
            selectedVehicles = [None, None, None]
            if player is not None:
                dbID = player.dbID
                isCurrentPlayer = player.isCurrentPlayer()
                if isCurrentPlayer:
                    statusTemplate = None
                    if falloutBattleType == QUEUE_TYPE.FALLOUT_MULTITEAM:
                        minVehiclesPerPlayer = falloutCfg.minVehiclesPerPlayer
                        if len(falloutCtrl.getSelectedVehicles()) < minVehiclesPerPlayer:
                            statusTemplate = i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFYMULTITEAM)
                    elif falloutCtrl.mustSelectRequiredVehicle():
                        statusTemplate = i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFY, level=text_styles.main(int2roman(falloutCfg.vehicleLevelRequired)))
                    else:
                        statusTemplate = i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFYRANGE, level=text_styles.main(toRomanRangeString(list(falloutCfg.allowedLevels), 1)))
                    if statusTemplate is not None:
                        for slotIdx in range(falloutCfg.minVehiclesPerPlayer):
                            vehiclesNotify[slotIdx] = statusTemplate

                for idx, vehicle in enumerate(unit.getVehicles().get(dbID, ())):
                    selectedVehicles[idx] = makeVehicleVO(vehicleGetter(vehicle.vehTypeCompDescr), falloutCfg.allowedLevels, isCurrentPlayer=isCurrentPlayer)

            slot['vehiclesNotify'] = vehiclesNotify
            slot['selectedVehicle'] = selectedVehicles
        slots.append(slot)

    return slots
Exemple #44
0
 def __getFightBtnTooltipData(self, state):
     falloutCtrl = getFalloutCtrl()
     config = falloutCtrl.getConfig()
     if state == PREBATTLE_RESTRICTION.VEHICLE_FALLOUT_ONLY:
         header = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutOnly/header')
         body = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutOnly/body')
     elif state == PREBATTLE_RESTRICTION.FALLOUT_NOT_SELECTED:
         header = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutNotSelected/header')
         body = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutNotSelected/body')
     elif state == PREBATTLE_RESTRICTION.VEHICLE_GROUP_IS_NOT_READY:
         header = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutNotReady/header')
         body = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutNotReady/body')
     elif state == UNIT_RESTRICTION.FALLOUT_NOT_ENOUGH_PLAYERS:
         header = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutNotEnoughPlayer/header')
         body = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutNotEnoughPlayer/body')
     elif state in (UNIT_RESTRICTION.FALLOUT_VEHICLE_LEVEL_REQUIRED, PREBATTLE_RESTRICTION.VEHICLE_GROUP_REQUIRED):
         header = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutVehLevelRequired/header')
         body = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutVehLevelRequired/body', level=int2roman(config.vehicleLevelRequired))
     elif state in (UNIT_RESTRICTION.FALLOUT_VEHICLE_MIN, PREBATTLE_RESTRICTION.VEHICLE_GROUP_MIN):
         allowedLevelsList = list(config.allowedLevels)
         if len(allowedLevelsList) > 1:
             header = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutVehMin/header')
             body = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutVehMin/body', min=str(config.minVehiclesPerPlayer), level=toRomanRangeString(allowedLevelsList, 1))
         else:
             header = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutVehLevelRequired/header')
             body = i18n.makeString('#menu:headerButtons/fightBtn/tooltip/falloutVehLevelRequired/body', level=int2roman(config.vehicleLevelRequired))
     else:
         return None
     return {makeTooltip(header, body)}
Exemple #45
0
 def __updateMultiselectionData(self):
     falloutCfg = self.__falloutCtrl.getConfig()
     showSlots, msg = self.__getMultiselectionStatus()
     canDo, _ = self.prbDispatcher.canPlayerDoAction()
     data = {'multiSelectionIsEnabled': self.__multiselectionMode,
      'formattedMessage': msg,
      'showSlots': showSlots,
      'slots': self.__getMultiselectionSlots(),
      'indicatorIsEnabled': canDo,
      'vehicleTypes': middleTitle(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONSTATUS)) + ' ' + main(i18n.makeString(FALLOUT.MULTISELECTIONSLOT_SELECTIONREQUIREMENTS, level=toRomanRangeString(list(falloutCfg.allowedLevels), 1))),
      'statusSrt': statInfo(FALLOUT.MULTISELECTIONSLOT_GROUPREADY) if canDo else critical(FALLOUT.MULTISELECTIONSLOT_GROUPNOTREADY)}
     self.as_setMultiselectionModeS(data)
 def _getFalloutVehMinStr(self):
     config = g_eventsCache.getFalloutConfig(self._extra.eventType)
     return ('#cyberSport:window/unit/message/falloutMin', {'min': str(config.minVehiclesPerPlayer),
       'level': toRomanRangeString(list(config.allowedLevels), 1)})
Exemple #47
0
 def canSelectVehicle(self, vehicle):
     if not self.isSelected():
         return (False, '')
     cfg = self.getConfig()
     if findFirst(lambda v: v.level == cfg.vehicleLevelRequired, self.getSelectedVehicles()) is None and vehicle.level != cfg.vehicleLevelRequired:
         return (False, i18n.makeString(FALLOUT.TANKCAROUSELSLOT_SELECTIONBUTTONTOOLTIP, requiredLevel=int2roman(cfg.vehicleLevelRequired), level=toRomanRangeString(list(cfg.allowedLevels - {cfg.vehicleLevelRequired}), 1)))
     return (True, '')