def _onLoading(self, intCD, *args, **kwargs): with self.viewModel.transaction() as model: vehicle = self.__itemsCache.items.getItemByCD(intCD) isSpecial = self.__battlePassController.isSpecialVehicle(intCD) currentPoints, limitPoints = self.__battlePassController.getVehicleProgression(intCD) pointsReward = self.__battlePassController.getVehicleCapBonus(intCD) gameMode = getSupportedCurrentArenaBonusType() commonPerBattlePoints = {points.label:(points.winPoint, points.losePoint) for points in self.__battlePassController.getPerBattlePoints(gameMode=gameMode)} items = model.rewardPoints.getItems() for points in self.__battlePassController.getPerBattlePoints(vehCompDesc=intCD, gameMode=gameMode): isHighlighted = True if points.label in commonPerBattlePoints: commonWinPoint, commonLosePoint = commonPerBattlePoints[points.label] isHighlighted = commonWinPoint < points.winPoint or commonLosePoint < points.losePoint item = RewardPointsModel() item.setTopCount(points.label) item.setPointsWin(points.winPoint) item.setPointsLose(points.losePoint) item.setIsSpecial(isHighlighted) items.addViewModel(item) model.setVehicleName(vehicle.shortUserName) model.setVehicleLevel(vehicle.level) model.setVehicleType(vehicle.type) model.setIsSpecialVehicle(isSpecial) model.setPointsCurrent(currentPoints) model.setPointsTotal(limitPoints) model.setPointsReward(pointsReward) model.setIsElite(vehicle.isFullyElite) dispatcher = g_prbLoader.getDispatcher() if dispatcher: queueType = dispatcher.getEntity().getQueueType() model.setBattleType(getPreQueueName(queueType, True))
def _onLoading(self, *args, **kwargs): super(BattlePassInProgressTooltipView, self)._onLoading(*args, **kwargs) prbDispatcher = g_prbLoader.getDispatcher() if prbDispatcher is None: return else: battleType = self.__battleType or prbDispatcher.getEntity( ).getQueueType() with self.getViewModel().transaction() as model: if self.__battleRoyaleController.isBattleRoyaleMode(): self.__updateBattleRoyalePoints(model) else: items = model.rewardPoints.getItems() arenaBonusType = getSupportedCurrentArenaBonusType( battleType) for points in self.__battlePass.getPerBattlePoints( gameMode=arenaBonusType): item = RewardPointsModel() item.setTopCount(points.label) item.setPointsWin(points.winPoint) item.setPointsLose(points.losePoint) items.addViewModel(item) curLevel = self.__battlePass.getCurrentLevel() chapterID = self.__battlePass.getCurrentChapterID() curPoints, limitPoints = self.__battlePass.getLevelProgression( chapterID) isBattlePassPurchased = self.__battlePass.isBought( chapterID=chapterID) model.setLevel(curLevel) model.setChapter(chapterID) model.setCurrentPoints(curPoints) model.setMaxPoints(limitPoints) model.setIsBattlePassPurchased(isBattlePassPurchased) model.setBattleType(getPreQueueName(battleType).lower()) model.setNotChosenRewardCount( self.__battlePass.getNotChosenRewardCount()) model.setExpireTime( self.__battlePass.getChapterRemainingTime(chapterID)) model.setIsExtra(self.__battlePass.isExtraChapter(chapterID)) model.setFinalReward( self.__battlePass.getRewardType(chapterID).value) timeTillEnd = '' if isSeasonEndingSoon() and not isBattlePassPurchased: timeTillEnd = getFormattedTimeLeft( self.__battlePass.getSeasonTimeLeft()) model.setTimeTillEnd(timeTillEnd) self.__getAwards(chapterID, model.rewardsCommon, curLevel, BattlePassConsts.REWARD_FREE) self.__getAwards(chapterID, model.rewardsElite, curLevel, BattlePassConsts.REWARD_PAID) return
def _onLoading(self, *args, **kwargs): super(VehiclePointsTooltipView, self)._onLoaded(*args, **kwargs) with self.viewModel.transaction() as model: vehicle = self.__itemsCache.items.getItemByCD(self.__intCD) isSpecial = self.__battlePassController.isSpecialVehicle( self.__intCD) currentPoints, limitPoints = self.__battlePassController.getVehicleProgression( self.__intCD) pointsReward = self.__battlePassController.getVehicleCapBonus( self.__intCD) commonPerBattlePoints = { points.label: (points.winPoint, points.losePoint) for points in self.__battlePassController.getPerBattlePoints() } items = model.rewardPoints.getItems() for points in self.__battlePassController.getPerBattlePoints( self.__intCD): isHighlighted = True if points.label in commonPerBattlePoints: commonWinPoint, commonLosePoint = commonPerBattlePoints[ points.label] isHighlighted = commonWinPoint != points.winPoint or commonLosePoint != points.losePoint item = RewardPointsModel() item.setTopCount(points.label) item.setPointsWin(points.winPoint) item.setPointsLose(points.losePoint) item.setIsSpecial(isHighlighted) items.addViewModel(item) model.setVehicleName(vehicle.shortUserName) model.setVehicleLevel(vehicle.level) model.setVehicleType(vehicle.type) model.setIsSpecialVehicle(isSpecial) model.setPointsCurrent(currentPoints) model.setPointsTotal(limitPoints) model.setPointsReward(pointsReward) model.setIsElite(vehicle.isFullyElite)
def _onLoading(self, *args, **kwargs): super(BattlePassInProgressTooltipView, self)._onLoading(*args, **kwargs) with self.getViewModel().transaction() as model: items = model.rewardPoints.getItems() for points in self.__battlePassController.getPerBattlePoints(): item = RewardPointsModel() item.setTopCount(points.label) item.setPointsWin(points.winPoint) item.setPointsLose(points.losePoint) items.addViewModel(item) curLevel = self.__battlePassController.getCurrentLevel() curPoints, limitPoints = self.__battlePassController.getLevelProgression( ) isPostProgression = self.__battlePassController.getState( ) == BattlePassState.POST model.setLevel(curLevel) model.setCurrentPoints(curPoints) model.setMaxPoints(limitPoints) model.setIsBattlePassPurchased( self.__battlePassController.isBought()) model.setIsPostProgression(isPostProgression) model.setCanPlay( self.__battlePassController.canPlayerParticipate()) timeTillEnd = '' if isSeasonEndingSoon( ) and not self.__battlePassController.isBought(): timeTillEnd = getFormattedTimeLeft( self.__battlePassController.getSeasonTimeLeft()) model.setTimeTillEnd(timeTillEnd) if isPostProgression: self.__getAwards(model.rewardsCommon, curLevel, BattlePassConsts.REWARD_POST) else: self.__getAwards(model.rewardsCommon, curLevel, BattlePassConsts.REWARD_FREE) self.__getAwards(model.rewardsElite, curLevel, BattlePassConsts.REWARD_PAID)
def __setPointsInfo(self, model): model.rewardPoints.clearItems() model.vehiclesList.clearItems() specialVehicles = self.__battlePassController.getSpecialVehicles() rewardPoints = model.rewardPoints.getItems() for points in self.__battlePassController.getPerBattlePoints(): item = RewardPointsModel() item.setTopCount(points.label) item.setPointsWin(points.winPoint) item.setPointsLose(points.losePoint) rewardPoints.addViewModel(item) vehiclesList = model.vehiclesList.getItems() for intCD in specialVehicles: vehicle = self.__itemsCache.items.getItemByCD(intCD) pointsDiff = self.__battlePassController.getPointsDiffForVehicle( intCD) if vehicle is None or pointsDiff.textID == 0: _logger.warning('No vehicle or points data found for CD: %s', str(intCD)) continue item = VehicleItemModel() item.setVehicleType(vehicle.type) item.setVehicleLevel(vehicle.level) item.setVehicleName(vehicle.userName) item.setVehicleBonus(pointsDiff.bonus) item.setVehicleTop(pointsDiff.top) item.setTextResource(backport.text(pointsDiff.textID)) vehiclesList.addViewModel(item) rewardPoints.invalidate() vehiclesList.invalidate() return