Esempio n. 1
0
 def getNowAwards(self):
     curLevel = self._getBPCurrentLevel()
     bonuses = []
     if self.hasBattlePass():
         bonuses.extend(
             self._battlePassController.getPackedAwardsInterval(
                 1, curLevel, awardType=BattlePassConsts.REWARD_PAID))
         if not isCurrentBattlePassStateBase():
             _, paidBonuses = self._battlePassController.getSplitFinalAwards(
             )
             bonuses.extend(paidBonuses)
     return BattlePassAwardsManager.sortBonuses(bonuses)
Esempio n. 2
0
 def __updateBuyButtonState(self):
     sellAnyLevelsUnlocked = self.__battlePassController.isSellAnyLevelsUnlocked(
     )
     disableBuyButton = not sellAnyLevelsUnlocked and self.__battlePassController.getBoughtLevels(
     ) > 0
     showBubble = sellAnyLevelsUnlocked and not self.__isBuyButtonHintShown(
     ) and isCurrentBattlePassStateBase()
     isVisible = isCurrentBattlePassStateBase(
     ) or not self.__battlePassController.isBought()
     sellAnyLevelsUnlockTimeLeft = ''
     if disableBuyButton:
         sellAnyLevelsUnlockTimeLeft = getFormattedTimeLeft(
             self.__battlePassController.getSellAnyLevelsUnlockTimeLeft())
     with self.viewModel.transaction() as model:
         model.setIsFinalOfferTime(isSeasonEndingSoon())
         model.setSeasonTimeLeft(
             getFormattedTimeLeft(
                 self.__battlePassController.getSeasonTimeLeft()))
         model.setSellAnyLevelsUnlockTimeLeft(sellAnyLevelsUnlockTimeLeft)
         model.setShowBuyButtonBubble(showBubble)
         model.setIsVisibleBuyButton(isVisible)
 def __buyBattlePass(cls, seasonID, callback):
     result = yield BuyBattlePass(seasonID).request()
     if cls.__battlePassController.getCurrentLevel(
     ) != 0 or not isCurrentBattlePassStateBase():
         callback(result.success)
         return
     else:
         if result.userMsg is not None:
             SystemMessages.pushMessage(result.userMsg,
                                        type=result.sysMsgType,
                                        messageData=result.auxData)
         callback(result.success)
         return
 def handleGetShopBannerParams(self, _):
     isBase = isCurrentBattlePassStateBase()
     isActive = not self.__battlePassCtrl.isPaused(
     ) and self.__battlePassCtrl.isVisible()
     canBuyBP = not self.__battlePassCtrl.isBought()
     canBuyLevels = self.__battlePassCtrl.getBoughtLevels(
     ) == 0 or self.__battlePassCtrl.isSellAnyLevelsUnlocked()
     isVisible = isActive and (canBuyBP or isBase and canBuyLevels)
     data = {
         'isVisible': isVisible,
         'isSeasonLeftSoon': isSeasonEndingSoon()
     }
     return data
Esempio n. 5
0
 def getFutureAwards(self):
     bonuses = []
     if self.hasBattlePass():
         fromLevel = self._getBPCurrentLevel() + self.getLevelsCount()
         bonuses.extend(
             self._battlePassController.getPackedAwardsInterval(
                 fromLevel + 1,
                 self._battlePassController.getMaxLevel(),
                 awardType=BattlePassConsts.REWARD_PAID))
         if isCurrentBattlePassStateBase():
             _, paidBonuses = self._battlePassController.getSplitFinalAwards(
             )
             bonuses.extend(paidBonuses)
     return BattlePassAwardsManager.sortBonuses(bonuses)
Esempio n. 6
0
 def _initialize(self, data, *args, **kwargs):
     super(BattlePassVehicleAwardView, self)._initialize(*args, **kwargs)
     self.viewModel.setVehicleLevelPoints(data.get('vehiclePoints', 0))
     self.viewModel.setBattlePassPointsAward(data.get('bonusPoints', 0))
     vehicle = self.__itemsCache.items.getItemByCD(data.get('vehTypeCompDescr', 0))
     self.viewModel.setIsPremiumVehicle(vehicle.isPremium)
     self.viewModel.setIsEliteVehicle(vehicle.isElite)
     self.viewModel.setVehicleLevel(vehicle.level)
     self.viewModel.setVehicleName(vehicle.userName)
     self.viewModel.setVehicleNation(vehicle.nationName)
     self.viewModel.setVehicleType(vehicle.type)
     self.viewModel.setIsPostProgression(not isCurrentBattlePassStateBase())
     techName = vehicle.name.split(':')
     self.viewModel.setTechName(techName[1])
     switchHangarOverlaySoundFilter(on=True)
     SoundGroups.g_instance.playSound2D(BattlePassSounds.TANK_POINTS_CAP)
Esempio n. 7
0
 def __updateDetailRewards(self):
     if not isCurrentBattlePassStateBase():
         curLevel = self.__battlePassController.getMaxLevel()
     else:
         curLevel = self.__battlePassController.getCurrentLevel()
     if self.__selectedPackage.hasBattlePass():
         fromLevel = 0
         toLevel = curLevel
     else:
         fromLevel = curLevel
         toLevel = curLevel + self.__selectedPackage.getLevelsCount()
     with self.viewModel.rewards.transaction() as tx:
         tx.nowRewards.clearItems()
         tx.futureRewards.clearItems()
         tx.setFromLevel(fromLevel + 1)
         tx.setToLevel(toLevel)
         tx.setStatePackage(self.__getTypePackage(self.__selectedPackage))
     packBonusModelAndTooltipData(self.__selectedPackage.getNowAwards(),
                                  self.viewModel.rewards.nowRewards,
                                  self.__tooltipItems)
     packBonusModelAndTooltipData(self.__selectedPackage.getFutureAwards(),
                                  self.viewModel.rewards.futureRewards,
                                  self.__tooltipItems)
Esempio n. 8
0
 def _getBPCurrentLevel(self):
     return self._battlePassController.getMaxLevel(
     ) if not isCurrentBattlePassStateBase(
     ) else self._battlePassController.getCurrentLevel()
Esempio n. 9
0
 def isVisible(self):
     return isCurrentBattlePassStateBase()
Esempio n. 10
0
 def isVisible(self):
     isAvaibleToBuy = not self._battlePassController.isSellAnyLevelsUnlocked(
     )
     return (isAvaibleToBuy
             or self.isBought()) and isCurrentBattlePassStateBase()