コード例 #1
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
コード例 #2
0
 def _doActivate(self):
     from bootcamp.Bootcamp import g_bootcamp
     from bootcamp.BootcampGarage import g_bootcampGarage
     from gui.battle_results.context import RequestResultsContext
     from bootcamp.BattleResultTransition import BattleResultTransition
     from gui.shared.personality import ServicesLocator
     sessionProvider = dependency.instance(IBattleSessionProvider)
     battleResultProvider = dependency.instance(IBattleResultsService)
     battleCtx = sessionProvider.getCtx()
     g_bootcampGarage.init(g_bootcamp.getLessonNum(), None)
     if g_bootcamp.transitionFlash is not None:
         g_bootcamp.transitionFlash.close()
     g_bootcamp.transitionFlash = BattleResultTransition()
     g_bootcamp.transitionFlash.active(True)
     yield ServicesLocator.itemsCache.update(CACHE_SYNC_REASON.SHOW_GUI)
     resultType = g_bootcamp.getBattleResults().type
     if resultType == BOOTCAMP_BATTLE_RESULT_MESSAGE.FAILURE:
         g_bootcampEvents.onResultScreenFinished()
         g_bootcamp.transitionFlash.active(False)
         g_bootcamp.transitionFlash.close()
         g_bootcamp.transitionFlash = None
         return
     else:
         if battleCtx.lastArenaUniqueID:
             yield battleResultProvider.requestResults(
                 RequestResultsContext(battleCtx.lastArenaUniqueID))
             battleCtx.lastArenaUniqueID = None
         return
コード例 #3
0
ファイル: in_garage.py プロジェクト: kusaku/wot_scripts
def weave(weaver, stateInGarage):
    """ Activates all pointcuts which must be always active in bootcamp hangar.
    :param weaver: AOP weaver to use for scoping
    :param stateInGarage: instance of class bootcamp.states.StateInGarage
    """
    weaver.weave(pointcut=_PointcutBrowserControllerDisable)
    weaver.weave(pointcut=_PointcutPrbDisableEntitySelect)
    weaver.weave(pointcut=_PointcutPrbInvitationText)
    weaver.weave(pointcut=_PointcutPrbDisableAcceptButton)
    weaver.weave(pointcut=_PointcutSysMessagesClient, avoid=True)
    weaver.weave(pointcut=_PointcutSysMessagesServer, avoid=True)
    weaver.weave(pointcut=_PointcutUnreadMessages)
    weaver.weave(pointcut=_PointcutFriendRequest, avoid=True)
    weaver.weave(pointcut=_PointcutShowModuleInfo, avoid=True)
    from bootcamp.Bootcamp import g_bootcamp
    if not g_bootcamp.isResearchFreeLesson():
        weaver.weave(pointcut=_PointcutNoFittingPopover, avoid=True)
        weaver.weave(pointcut=_PointcutDisableModuleClickSound)
    if g_bootcamp.getLessonNum() == _SET_OPTIONAL_DEVICE_LESSON_NUM:
        weaver.weave(pointcut=_PointcutOnOptionalDeviceSelectPopoverDestroy)
        weaver.weave(pointcut=_PointcutOnOptionalDeviceSelectPopoverSetModule)
    weaver.weave(pointcut=_PointcutOnOptionalDeviceSelectPopoverGetTabData())
    weaver.weave(pointcut=_PointcutOnOptionalDeviceSelectPopoverGetInitialTabIndex())
    weaver.weave(pointcut=_PointcutOverrideAOGASMessageTimeout)
    if getClientLanguage() == 'ko':
        weaver.weave(pointcut=_PointcutOverrideKoreaParentalControl)
    weaver.weave(pointcut=_PointcutDisableRankedBattleEvents)
    weaver.weave(pointcut=_PointcutDisableNewYearEventAvailability)
    weaver.weave(pointcut=_PointcutDisableNewYearEvent)
    weaver.weave(pointcut=_PointcutDisableNewYearStateUpdating)
コード例 #4
0
 def _populate(self):
     super(BCQuestsWindow, self)._populate()
     bonuses = g_bootcamp.getBonuses()['battle'][g_bootcamp.getLessonNum()]
     bonuses['premium_text'] = self.getPremiumTimeString(
         bonuses.get('premium', 0) * 3600)
     self.as_setDataS(bonuses)
     g_bootcampGarage.runViewAlias('hangar')
コード例 #5
0
ファイル: bootcamp.py プロジェクト: kusaku/wot_scripts
    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
                    }))
コード例 #6
0
 def log(self, action, loglevel=LogLevels.INFO, **params):
     if 'timeSpent' in params:
         params['timeSpent'] = int(params['timeSpent'])
     params['lesson_id'] = g_bootcamp.getLessonNum()
     params['is_newbie'] = g_bootcamp.isNewbie()
     return super(BootcampLogger, self).log(action=action,
                                            loglevel=loglevel,
                                            **params)
コード例 #7
0
ファイル: bootcamp.py プロジェクト: kusaku/wot_scripts
 def _convert(self, record, reusable):
     teamResult = reusable.getPersonalTeamResult()
     if teamResult != PLAYER_TEAM_RESULT.WIN:
         return False
     lessonNum = g_bootcamp.getLessonNum()
     lessonSpecificExtras = g_bootcamp.getBattleResultsExtra(lessonNum - 1)
     val = bool(lessonSpecificExtras['unlocks'])
     return val
コード例 #8
0
 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']
コード例 #9
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))
コード例 #10
0
 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()
コード例 #11
0
 def _populate(self):
     super(BCQuestsView, self)._populate()
     bonuses = g_bootcamp.getBonuses()['battle'][g_bootcamp.getLessonNum()]
     timeKey, time = getTimeLeftInfo(bonuses.get('premium', 0) * 3600)
     voData = {'premiumText': time + ' ' + makeString('#menu:header/account/premium/%s' % timeKey),
      'goldText': str(bonuses['gold']),
      'showRewards': bonuses['showRewards'],
      'premiumIcon': RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_BCPREMIUM3D,
      'goldIcon': RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_BCGOLD}
     self.as_setDataS(voData)
コード例 #12
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()
コード例 #13
0
 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)
コード例 #14
0
 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
コード例 #15
0
 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))
コード例 #16
0
 def onMessageRemoved(self):
     from bootcamp.BootcampGarage import g_bootcampGarage
     g_bootcampGarage.resumeLesson()
     if self.__removedCallback is not None and not self.__isButtonClicked:
         from bootcamp.Bootcamp import g_bootcamp
         if g_bootcamp.getLessonNum() == 1:
             g_bootcamp.changeNation(g_bootcamp.nation,
                                     self.__removedCallback)
         else:
             self.__removedCallback()
             self.__removedCallback = None
     self.destroy()
     return
コード例 #17
0
    def getResearchItemsData(self, vehCD, rootChanged):
        LOG_DEBUG('BCResearch.getResearchItemsData', g_bootcamp.getLessonNum())
        dumpData = super(BCResearch, self).getResearchItemsData(vehCD, rootChanged)
        nodes = dumpData.get('nodes', [])
        for node in nodes:
            if 'vehCompareRootData' in node:
                node['vehCompareRootData']['modeAvailable'] = False
            if 'vehCompareTreeNodeData' in node:
                node['vehCompareTreeNodeData']['modeAvailable'] = False
            node['showVehicleBtnVisible'] = False
            node['showVehicleBtnEnabled'] = False

        dumpData['global']['hasNationTree'] = False
        return dumpData
コード例 #18
0
 def _onBattleLoadingFinish(self):
     super(BCBattlePageMeta, self)._onBattleLoadingFinish()
     battleSettings = getBattleSettings(g_bootcamp.getLessonNum())
     visiblePanels, hiddenPanels = battleSettings.visiblePanels, battleSettings.hiddenPanels
     periodCtrl = self.sessionProvider.shared.arenaPeriod
     inCountdown = periodCtrl.getPeriod() in (ARENA_PERIOD.WAITING, ARENA_PERIOD.PREBATTLE)
     if inCountdown and BATTLE_VIEW_ALIASES.PLAYERS_PANEL in visiblePanels:
         self.__hideOnCountdownPanels.add(BATTLE_VIEW_ALIASES.PLAYERS_PANEL)
     self._setComponentsVisibility(visible=set(visiblePanels).difference(self.__hideOnCountdownPanels), hidden=set(hiddenPanels).union(self.__hideOnCountdownPanels))
     uselessConsumable = HINT_NAMES[HINT_TYPE.HINT_USELESS_CONSUMABLE]
     if uselessConsumable in battleSettings.hints:
         errorMessages = self.getComponent(BATTLE_VIEW_ALIASES.VEHICLE_ERROR_MESSAGES)
         if errorMessages is not None:
             errorMessages.ignoreKeys = CONSUMABLE_ERROR_MESSAGES
     return
コード例 #19
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
コード例 #20
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()
コード例 #21
0
 def invalidateInventory(self, data):
     super(BCResearch, self).invalidateInventory(data)
     if g_bootcamp.getLessonNum() < g_bootcamp.getContextIntParameter(
             'researchFreeLesson'):
         g_bootcampGarage.showNextHint()
コード例 #22
0
 def invalidateUnlocks(self, unlocks):
     super(BCResearch, self).invalidateUnlocks(unlocks)
     if g_bootcamp.getLessonNum() < g_bootcamp.getContextIntParameter(
             'researchFreeLesson'):
         g_bootcampGarage.showNextHint()
コード例 #23
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'))
コード例 #24
0
 def data(self):
     return self._data[g_bootcamp.getLessonNum()]
コード例 #25
0
 def enqueueBootcamp(self):
     if g_bootcamp.isRunning():
         BigWorld.player().enqueueBootcamp(g_bootcamp.getLessonNum())
コード例 #26
0
 def getLessonNum(self):
     return g_bootcamp.getLessonNum()
コード例 #27
0
 def onClientReady(self):
     if not (self.isPlaying or self.isRecording):
         return
     elif self.isRecording and BigWorld.player(
     ).arena.guiType == constants.ARENA_GUI_TYPE.TUTORIAL:
         self.stop(None, True)
         return
     else:
         self.__replayCtrl.playerVehicleID = BigWorld.player(
         ).playerVehicleID
         self.__replayCtrl.onClientReady()
         if self.isPlaying:
             AreaDestructibles.g_destructiblesManager.onAfterReplayTimeWarp(
             )
             if isPlayerAvatar():
                 BigWorld.player(
                 ).onVehicleEnterWorld += self.__onVehicleEnterWorld
         if self.isRecording:
             player = BigWorld.player()
             arena = player.arena
             arenaName = arena.arenaType.geometry
             i = arenaName.find('/')
             if i != -1:
                 arenaName = arenaName[i + 1:]
             now = datetime.datetime.now()
             now = '%02d.%02d.%04d %02d:%02d:%02d' % (
                 now.day, now.month, now.year, now.hour, now.minute,
                 now.second)
             vehicleName = BigWorld.entities[
                 player.playerVehicleID].typeDescriptor.name
             vehicleName = vehicleName.replace(':', '-')
             vehicles = self.__getArenaVehiclesInfo()
             gameplayID = player.arenaTypeID >> 16
             clientVersionFromXml = getFullClientVersion()
             clientVersionFromExe = BigWorld.wg_getProductVersion()
             arenaInfo = {
                 'dateTime': now,
                 'playerName': player.name,
                 'playerID': self.__playerDatabaseID,
                 'playerVehicle': vehicleName,
                 'mapName': arenaName,
                 'mapDisplayName': arena.arenaType.name,
                 'gameplayID': ArenaType.getGameplayName(gameplayID)
                 or gameplayID,
                 'vehicles': vehicles,
                 'battleType': arena.bonusType,
                 'clientVersionFromExe': clientVersionFromExe,
                 'clientVersionFromXml': clientVersionFromXml,
                 'serverName': self.connectionMgr.serverUserName,
                 'regionCode': constants.AUTH_REALM,
                 'serverSettings': self.__serverSettings,
                 'hasMods': self.__replayCtrl.hasMods
             }
             if BigWorld.player(
             ).arena.guiType == constants.ARENA_GUI_TYPE.BOOTCAMP:
                 from bootcamp.Bootcamp import g_bootcamp
                 arenaInfo['lessonId'] = g_bootcamp.getLessonNum()
                 arenaInfo['bootcampCtx'] = g_bootcamp.serializeContext()
             self.__replayCtrl.recMapName = arenaName
             self.__replayCtrl.recPlayerVehicleName = vehicleName
             self.__replayCtrl.setArenaInfoStr(json.dumps(arenaInfo))
         else:
             self.__showInfoMessages()
             if self.replayTimeout > 0:
                 LOG_DEBUG('replayTimeout set for %.2f' %
                           float(self.replayTimeout))
                 BigWorld.callback(float(self.replayTimeout), BigWorld.quit)
         return
コード例 #28
0
 def _convert(self, record, reusable):
     teamResult = reusable.getPersonalTeamResult()
     lessonNum = g_bootcamp.getLessonNum() - 1
     value = _BG_FOLDER_PATH + _BG_IMAGE_FORMATS[teamResult].format(
         lessonNum)
     return value