def __init__(self, dumper):
     super(BCResearchItemsData, self).__init__(dumper)
     lessonNum = g_bootcamp.getLessonNum()
     self.__overrideResearch = lessonNum < g_bootcamp.getContextIntParameter('researchFreeLesson')
     self.__secondVehicleResearch = lessonNum < g_bootcamp.getContextIntParameter('researchSecondVehicleLesson')
     nationData = g_bootcamp.getNationData()
     self.__firstVehicleNode = nationData['vehicle_first']
     self.__secondVehicleNode = nationData['vehicle_second']
     self.__moduleNodeCD = nationData['module']
Beispiel #2
0
 def __setBattleResults(self):
     self.__isResultsSet = self.__isResultsSet or True
     g_appLoader.attachCursor(APP_NAME_SPACE.SF_LOBBY, _CTRL_FLAG.GUI_ENABLED)
     g_bootcampEvents.onResultScreenFinished += self.onResultScreenFinished
     resultType, resultReason, resultTypeStr, resultReasonStr, reusableInfo = g_bootcamp.getBattleResults()
     if not reusableInfo is not None:
         raise AssertionError
         bgImagePath = self.__getBackgroundImagePath(resultType, g_bootcamp.getLessonNum() - 1)
         self.as_resultTypeHandlerS(resultTypeStr, bgImagePath)
         if resultType == BATTLE_RESULT.VICTORY:
             battleResultsExtra = deepcopy(g_bootcamp.getBattleResultsExtra(g_bootcamp.getLessonNum() - 1))
         else:
             battleResultsExtra = {'medals': [],
              'stats': [],
              'unlocks': []}
         battleResultsStats = self.battleResults.getResultsVO(self.__arenaUniqueID)
         showPremium = g_bootcamp.getLessonNum() == g_bootcamp.getContextIntParameter('lastLessonNum') and self.bootcampController.needAwarding()
         battleResultsExtra['showRewards'] = resultType == BATTLE_RESULT.VICTORY and g_bootcamp.getLessonNum() != 1
         if showPremium:
             self.__addPremiumData(battleResultsExtra['medals'])
         battleResultsExtra['stats'] = self.getBattleStatsData(battleResultsStats)
         self.as_setBootcampDataS(battleResultsExtra)
         self.as_setDataS(self.battleResults.getResultsVO(self.__arenaUniqueID))
         self.__hasBonusInMedals = bool(battleResultsExtra.get('unlocks', None))
         xp = reusableInfo.personal.getBaseXPRecords().getRecord('xp')
         credits = reusableInfo.personal.getBaseCreditsRecords().getRecord('credits')
         self.__hasBonusInStats = xp > 0 or credits > 0
     return
Beispiel #3
0
    def setRecord(self, result, reusable):
        teamResult = reusable.getPersonalTeamResult()
        if teamResult != PLAYER_TEAM_RESULT.WIN:
            return
        lessonNum = g_bootcamp.getLessonNum()
        lessonSpecificExtras = g_bootcamp.getBattleResultsExtra(lessonNum - 1)
        for val in lessonSpecificExtras['unlocks']:
            self.addNextComponent(base.DirectStatsItem('', val))

        for val in lessonSpecificExtras['medals']:
            self.addNextComponent(base.DirectStatsItem('', val))

        bootcampController = dependency.instance(IBootcampController)
        lastLessonNum = g_bootcamp.getContextIntParameter('lastLessonNum')
        showPremium = lessonNum == lastLessonNum and bootcampController.needAwarding(
        )
        if showPremium:
            self.addNextComponent(
                base.DirectStatsItem(
                    '', {
                        'id':
                        'premium',
                        'label':
                        makeString(BOOTCAMP.RESULT_AWARD_PREMIUM_LABEL),
                        'description':
                        makeString(BOOTCAMP.RESULT_AWARD_PREMIUM_TEXT),
                        'icon':
                        RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_BCPREMIUM,
                        'iconTooltip':
                        RES_ICONS.
                        MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCPREMIUM
                    }))
Beispiel #4
0
    def getSkillsData(self, callback):
        itemsCache = dependency.instance(IItemsCache)
        tankman = itemsCache.items.getTankman(self.tmanInvID)
        data = tankman.getSkillsToLearn()
        skillSixthSense = None
        skillComouflage = None
        for skills in data:
            for skill in skills['skills']:
                if skill['id'] == 'commander_sixthSense':
                    skillSixthSense = skill
                if skill['id'] == 'camouflage':
                    skillComouflage = skill
                skill['enabled'] = False

        skillsGroupsRemove = list()
        for skills in data:
            if skills['id'] == 'common':
                if skillComouflage is not None:
                    skills['skills'].remove(skillComouflage)
                    skills['skills'].insert(0, skillComouflage)
                if skillSixthSense is not None:
                    skillComouflage['enabled'] = False
                    skills['skills'].insert(0, skillSixthSense)
                scrollCountSkills = g_bootcamp.getContextIntParameter(
                    'scrollCountSkills')
                if len(skills['skills']) > scrollCountSkills:
                    del skills['skills'][scrollCountSkills:]
            skillsGroupsRemove.append(skills)

        for skills in skillsGroupsRemove:
            data.remove(skills)

        callback(data)
        return
Beispiel #5
0
 def __queueDialogShow(self, _):
     ctx = {'backgroundImage': '../maps/login/back_25_without_sparks.png',
      'lessonNumber': g_bootcamp.getLessonNum(),
      'timeout': g_bootcamp.getContextIntParameter('lessonQueueTimeout', 15)}
     queueDialog = self.findViewByAlias(WindowLayer.TOP_WINDOW, VIEW_ALIAS.BOOTCAMP_QUEUE_DIALOG)
     if queueDialog:
         queueDialog.updateSettings(ctx)
         return
     self.loadViewByCtxEvent(LoadViewEvent(SFViewLoadParams(VIEW_ALIAS.BOOTCAMP_QUEUE_DIALOG), ctx=ctx))
 def __doLeaveBootcamp(self):
     if g_bootcamp.getLessonNum() == g_bootcamp.getContextIntParameter('lastLessonNum') - 1:
         exitResult = self.sessionProvider.getExitResult()
         quitBattleKey = self.__getQuitBattleKey(exitResult.playerInfo)
         result = yield DialogsInterface.showDialog(IngameDeserterDialogMeta(quitBattleKey + '/deserter', focusedID=DIALOG_BUTTON_ID.CLOSE))
         if result:
             self.showBootcampExitWindow()
     else:
         self.showBootcampExitWindow()
     self.destroy()
Beispiel #7
0
 def goToVehicleView(self, itemCD):
     LOG_DEBUG('BCResearch.goToVehicleView', itemCD, self.alias)
     itemsCache = dependency.instance(IItemsCache)
     vehicle = itemsCache.items.getItemByCD(int(itemCD))
     if vehicle.isPreviewAllowed():
         shared_events.showVehiclePreview(int(itemCD), self.alias)
     elif vehicle.isInInventory:
         shared_events.selectVehicleInHangar(itemCD)
         if g_bootcamp.getLessonNum() >= g_bootcamp.getContextIntParameter(
                 'researchSecondVehicleLesson'):
             g_bootcampGarage.checkSecondVehicleHintEnabled()
 def as_updateBattleTypeS(self, battleTypeName, battleTypeIcon, isEnabled,
                          tooltip, tooltipType, battleTypeID,
                          eventBgEnabled, eventAnim):
     if g_bootcamp.getLessonNum() == g_bootcamp.getContextIntParameter(
             'randomBattleLesson'
     ) and battleTypeID != PREBATTLE_ACTION_NAME.RANDOM and battleTypeID != PREBATTLE_ACTION_NAME.BOOTCAMP:
         battleTypeName = BOOTCAMP.GAME_MODE
         battleTypeIcon = RES_ICONS.MAPS_ICONS_BOOTCAMP_EMPTYBATTLESELECTORICON
     LobbyHeader.as_updateBattleTypeS(self, battleTypeName, battleTypeIcon,
                                      isEnabled, tooltip, tooltipType,
                                      battleTypeID, False, False)
 def _convert(self, record, reusable):
     teamResult = reusable.getPersonalTeamResult()
     if teamResult != PLAYER_TEAM_RESULT.WIN:
         return False
     bootcampController = dependency.instance(IBootcampController)
     lessonNum = g_bootcamp.getLessonNum()
     lastLessonNum = g_bootcamp.getContextIntParameter('lastLessonNum')
     lessonSpecificExtras = g_bootcamp.getBattleResultsExtra(lessonNum - 1)
     showPremium = lessonNum == lastLessonNum and bootcampController.needAwarding(
     )
     val = bool(lessonSpecificExtras['unlocks']) or showPremium
     return val
Beispiel #10
0
    def as_updateS(self, data):
        researchFreeLesson = g_bootcamp.getContextIntParameter(
            'researchFreeLesson')
        if g_bootcamp.getLessonNum() >= researchFreeLesson and data[
                'rendererName'] != FITTING_TYPES.GUN_TURRET_FITTING_ITEM_RENDERER:
            nationData = g_bootcampGarage.getNationData()
            optionalDeviceId = nationData['equipment']
            optionalDeviceValue = None
            deviceList = data['availableDevices']
            for device in deviceList:
                if device['id'] == optionalDeviceId:
                    optionalDeviceValue = device

            if optionalDeviceValue is not None:
                deviceList.remove(optionalDeviceValue)
                deviceList.insert(0, optionalDeviceValue)
            scrollCountOptionalDevices = g_bootcamp.getContextIntParameter(
                'scrollCountOptionalDevices')
            del deviceList[scrollCountOptionalDevices:]
        super(BCFittingPopover, self).as_updateS(data)
        return
 def setRecord(self, result, reusable):
     teamResult = reusable.getPersonalTeamResult()
     if teamResult != PLAYER_TEAM_RESULT.WIN:
         return
     bootcampController = dependency.instance(IBootcampController)
     lessonNum = g_bootcamp.getLessonNum()
     lastLessonNum = g_bootcamp.getContextIntParameter('lastLessonNum')
     lessonSpecificExtras = g_bootcamp.getBattleResultsExtra(lessonNum - 1)
     goldPremuimExtras = []
     showPremium = lessonNum == lastLessonNum and bootcampController.needAwarding(
     )
     if showPremium:
         premiumType = g_bootcamp.getPremiumType(lessonNum)
         if premiumType not in _PREMIUM_RESOURCES:
             _logger.error(
                 'Premium type %s is not supported or it is not in the bonuses'
             )
         else:
             goldPremuimExtras.append({
                 'id':
                 premiumType,
                 'label':
                 _PREMIUM_RESOURCES[premiumType]['label'],
                 'description':
                 _PREMIUM_RESOURCES[premiumType]['description'],
                 'icon':
                 _PREMIUM_RESOURCES[premiumType]['icon'],
                 'iconTooltip':
                 _PREMIUM_RESOURCES[premiumType]['iconTooltip']
             })
             goldPremuimExtras.append({
                 'id':
                 'gold',
                 'label':
                 backport.text(R.strings.bootcamp.message.gold.label()),
                 'description':
                 backport.text(
                     R.strings.bootcamp.message.gold.premiumPlus.text()),
                 'icon':
                 backport.image(
                     R.images.gui.maps.icons.bootcamp.rewards.bcGold()),
                 'iconTooltip':
                 backport.image(R.images.gui.maps.icons.bootcamp.rewards.
                                tooltips.bcGold())
             })
     self.addNextComponent(
         base.DirectStatsItem('medals', lessonSpecificExtras['medals']))
     self.addNextComponent(
         base.DirectStatsItem('ribbons', lessonSpecificExtras['ribbons']))
     self.addNextComponent(
         base.DirectStatsItem(
             'unlocks',
             lessonSpecificExtras['unlocks'] + goldPremuimExtras))
    def _buildList(self):
        defaultModules = super(_BootCampLogicProvider, self)._buildList()
        if self._slotType != FITTING_TYPES.OPTIONAL_DEVICE:
            return defaultModules
        else:
            nationData = g_bootcamp.getNationData()
            optionalDeviceId = nationData['equipment']
            optionalDeviceValue = None
            for device in defaultModules:
                if device['id'] == optionalDeviceId:
                    optionalDeviceValue = device

            if optionalDeviceValue is not None:
                defaultModules.remove(optionalDeviceValue)
                defaultModules.insert(0, optionalDeviceValue)
            scrollCountOptionalDevices = g_bootcamp.getContextIntParameter('scrollCountOptionalDevices')
            del defaultModules[scrollCountOptionalDevices:]
            return defaultModules
Beispiel #13
0
 def __showPrevHint(self):
     from bootcamp.Bootcamp import g_bootcamp
     if g_bootcamp.getLessonNum() < g_bootcamp.getContextIntParameter('researchFreeLesson'):
         from bootcamp.BootcampGarage import g_bootcampGarage
         g_bootcampGarage.showPrevHint()
Beispiel #14
0
 def invalidateInventory(self, data):
     super(BCResearch, self).invalidateInventory(data)
     if g_bootcamp.getLessonNum() < g_bootcamp.getContextIntParameter(
             'researchFreeLesson'):
         g_bootcampGarage.showNextHint()
Beispiel #15
0
 def invalidateUnlocks(self, unlocks):
     super(BCResearch, self).invalidateUnlocks(unlocks)
     if g_bootcamp.getLessonNum() < g_bootcamp.getContextIntParameter(
             'researchFreeLesson'):
         g_bootcampGarage.showNextHint()
Beispiel #16
0
 def getContextIntParameter(self, parameter, default=0):
     return g_bootcamp.getContextIntParameter(parameter, default)
Beispiel #17
0
 def _onLoading(self, *args, **kwargs):
     super(BootcampQuestWidgetView, self)._onLoading()
     with self.viewModel.transaction() as tx:
         tx.setCurrent(g_bootcamp.getLessonNum())
         tx.setTotal(g_bootcamp.getContextIntParameter('lastLessonNum'))