示例#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 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
                    }))
示例#3
0
 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
 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 _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