def _createSlots(self): array = Array() slot = self._createAmmunitionSlot(0) slot.setIsSelected( cmp_helpers.getCmpConfiguratorMainView().isCamouflageSet()) slot.setIsLocked(self._vehicle.isOutfitLocked) array.addViewModel(slot) return array
def _createSlots(self): array = Array() for idx in range(len(self._getInstalled())): slot = self._createAmmunitionSlot(idx) self._updateAmmunitionSlot(slot, idx) array.addViewModel(slot) return array
def __createBattleRoyalePointsBlock(self, pointsByMode): resultArr = Array() for value in pointsByMode: pointsModel = RewardPointsByPlaceModel() place, points = value[0], value[1] pointsModel.setPlace(place) pointsModel.setPoints(points) resultArr.addViewModel(pointsModel) return resultArr
def _createSlots(self): array = Array() rangeIter = xrange(len(self._getInstalled())) for idx, keyCmd in itertools.izip_longest(rangeIter, self._getKeySettings()): if idx is None: break slot = self._createAmmunitionSlot(idx) if keyCmd is not None: slot.setKeyName(KeyboardSetting(keyCmd).getKeyName()) self._updateAmmunitionSlot(slot, idx) array.addViewModel(slot) return array
def __formatterRewards(self, rewards, addTooltip=False): results = Array() for reward in rewards: model = BonusModel() model.setName(reward.bonusName) model.setIcon(getRewardImage(reward.images['big'])) model.setLabel(getRewardLabel(reward.label)) model.setOverlayType(getRewardOverlayType(reward.overlayType)) if addTooltip: self.__setTooltip(model, reward) else: model.setDescription(reward.userName) results.addViewModel(model) return results
def fillProgressBar(self, viewModel, tooltipData, iconSize=ICON_SIZE.SMALL): bootcampIcons = R.images.gui.maps.icons.bootcamp.rewards progressBarItems = [self._getProgressBarItem([self._getProgressBarIcon(bootcampIcons.bcTank2_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcTank2_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_VEHICLE_SECOND_LEVEL, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_VEHICLE, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCAWARDOPTIONS], 2)], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_1, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_1]), self._getProgressBarItem([], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_2, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_2]), self._getProgressBarItem([self._getProgressBarIcon(bootcampIcons.bcTank3_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcTank3_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_VEHICLE_THIRD_LEVEL, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_VEHICLE, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCAWARDOPTIONS], 4)], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_3, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_3]), self._getProgressBarItem([], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_4, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_4]), self._getProgressBarItem([self._getProgressBarIcon(bootcampIcons.bcGold_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcGold_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_GOLD, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_GOLD, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCGOLD], 6), self._getProgressBarIcon(bootcampIcons.bcPremium_universal_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcPremium_universal_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_AWARD, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_PREMIUM, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCPREMIUMPLUS], 6), self._getProgressBarIcon(bootcampIcons.bcBootcampMedal_48() if iconSize == ICON_SIZE.SMALL else bootcampIcons.bcBootcampMedal_80(), [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_AWARD, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_AWARD, RES_ICONS.MAPS_ICONS_BOOTCAMP_REWARDS_TOOLTIPS_BCACHIEVEMENT], 6)], [BOOTCAMP.TOOLTIP_PROGRESSION_LABEL_LESSON_5, BOOTCAMP.TOOLTIP_PROGRESSION_DESCRIPTION_LESSON_5])] currentLesson = g_bootcamp.getLessonNum() viewModel.setCurrentLesson(currentLesson) viewModel.setTotalLessons(g_bootcamp.getContextIntParameter('lastLessonNum')) lessons = Array() tooltipIndex = 1 for index, lessonRaw in enumerate(progressBarItems): lessonModel = BootcampLessonModel() lessonNumber = index + 1 lessonModel.setLessonNumber(lessonNumber) lessonModel.setCompleted(lessonNumber <= currentLesson) lessonModel.setCurrent(lessonNumber == currentLesson + 1) lessonModel.setTooltipId(tooltipIndex) if self.isLastLesson(lessonNumber): lessonModel.setRewardsTaken(not self.bootcampController.needAwarding()) status = BootcampStatuses.IN_PROGRESS if lessonNumber == currentLesson else (BootcampStatuses.COMPLETED if lessonNumber < currentLesson else None) tooltipData[tooltipIndex] = createTooltipData(isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.BOOTCAMP_LESSON_PROGRESS, specialArgs=lessonRaw['tooltipArgs'] + [status]) tooltipIndex += 1 items = Array() for itemRaw in lessonRaw['rewards']: itemModel = BootcampRewardItemModel() itemModel.setIcon(backport.image(itemRaw['icon'])) itemModel.setTooltipId(tooltipIndex) tooltipData[tooltipIndex] = createTooltipData(isSpecial=True, specialAlias=TOOLTIPS_CONSTANTS.BOOTCAMP_REWARD_PROGRESS, specialArgs=itemRaw['tooltipArgs']) tooltipIndex += 1 items.addViewModel(itemModel) lessonModel.setRewards(items) lessons.addViewModel(lessonModel) lessons.invalidate() viewModel.setLevels(lessons) return
def updateQuestsInfo(self, arenaUniqueID): if self.__currentEpicLevel < self.__maxEpicLevel: return self.__arenaUniqueID = arenaUniqueID battleResultsVO = self.__battleResults.getResultsVO( self.__arenaUniqueID)['quests'] progressionQuests = self.__eventProgression.getActiveQuestsAsDict( ).values() battleResultsVOSorted = [] for br in battleResultsVO: questInfo = br['questInfo'] questID = questInfo['questID'] for epq in progressionQuests: if questID == epq.getID(): battleResultsVOSorted.append((epq.getPriority(), br)) break battleResultsVOSorted.sort(key=lambda q: q[0], reverse=True) with self.viewModel.transaction() as model: questsArray = Array() for _, quest in battleResultsVOSorted: questInfo = quest['questInfo'] questID = questInfo['questID'] if questID in self.__eventProgression.getActiveQuestIDs(): questModel = QuestProgressItemModel() questModel.setId(questID) questModel.setEventType(questInfo['eventType']) questModel.setName(quest['title']) questModel.setDesc(quest['descr']) questModel.setDeltaLabel(self.__getDifference(quest)) questModel.setValue(questInfo['currentProgrVal']) questModel.setMaximum(questInfo['maxProgrVal']) currentQuest = findFirst(lambda q: q.getID() == questID, progressionQuests) questModel.setRewards(', '.join( self.__getRewards(currentQuest))) questsArray.addViewModel(questModel) model.setQuests(questsArray)