def _updateDailyQuestModel(self, model, fullUpdate=False): _logger.debug('DailyQuestsView::_updateDailyQuestModel') isEnabled = isDailyQuestsEnable() quests = sorted(self.eventsCache.getDailyQuests().values(), key=dailyQuestsSortFunc) newBonusQuests = settings.getNewCommonEvents( [q for q in quests if q.isBonus()]) self._updateRerollEnabledFlag(model) with model.dailyQuests.transaction() as tx: tx.setIsEnabled(isEnabled) if not isEnabled: return if not fullUpdate and not needToUpdateQuestsInModel( quests + newBonusQuests, tx.getQuests()): return self.__updateQuestsInModel(tx.getQuests(), quests) self.__updateMissionVisitedArray(tx.getMissionsCompletedVisited(), quests) tx.setBonusMissionVisited(not newBonusQuests) if self.__festivityController.isEnabled(): if not AccountSettings.getUIFlag(NY_DAILY_QUESTS_VISITED): tx.setPlayNYQuestLootboxAnimation(True) AccountSettings.setUIFlag(NY_DAILY_QUESTS_VISITED, True) if not AccountSettings.getUIFlag( NY_BONUS_DAILY_QUEST_VISITED ) and not tx.getBonusMissionVisited(): tx.setPlayNYBonusQuestLootboxAnimation(True) AccountSettings.setUIFlag(NY_DAILY_QUESTS_VISITED, True) AccountSettings.setUIFlag(NY_BONUS_DAILY_QUEST_VISITED, True)
def showRewardVideo(self): videoShownKey = self.__getRewardShownMarkKey( MARATHON_VIDEO_WAS_SHOWN_PREFIX) if self.isRewardObtained( ) and self._data.doesShowRewardVideo and not AccountSettings.getUIFlag( videoShownKey): showMarathonReward(self._data.vehicleID, videoShownKey)
def showRewardScreen(self): if not self.doesShowRewardScreen(): return if self.__state in MARATHON_STATE.DISABLED_STATE: return if self.isRewardObtained() and not AccountSettings.getUIFlag(self.__getRewardShownMarkKey(MARATHON_REWARD_WAS_SHOWN_PREFIX)): showBrowserOverlayView(self._getUrl() + self.marathonCompleteUrlAdd, alias=VIEW_ALIAS.BROWSER_OVERLAY, callbackOnLoad=partial(self.__setScreenWasShown, MARATHON_REWARD_WAS_SHOWN_PREFIX))
def markPreviousYearTabVisited(self, yearName, uiFlagKey): yearNum = YEARS_INFO.convertYearToNum(yearName) isMaxLevel = self._itemsCache.items.festivity.getMaxLevel( ) == new_year.CONSTS.MAX_ATMOSPHERE_LVL isCurrentYearSelected = yearNum == YEARS_INFO.CURRENT_YEAR if isMaxLevel and not isCurrentYearSelected: oldCollectionsVisited = AccountSettings.getUIFlag(uiFlagKey) oldCollectionsVisited[yearNum] = True AccountSettings.setUIFlag(uiFlagKey, oldCollectionsVisited)
def isUnseenCelebrityQuestsAvailable(celebrityController=None): visitedQuestsMask = AccountSettings.getUIFlag(NY_CELEBRITY_QUESTS_VISITED_MASK) visitedQuestsMask |= celebrityController.completedQuestsMask for dayNum in (CelebrityQuestTokenParts.getDayNum(qId) for qId in celebrityController.questGroups): dayNumMask = 1 << dayNum - 1 if visitedQuestsMask & dayNumMask == 0: return True return False
def __isShowBubbleOnTabForYears(self, years, uiFlagKey): isMaxLevel = self._itemsCache.items.festivity.getMaxLevel( ) == new_year.CONSTS.MAX_ATMOSPHERE_LVL if not isMaxLevel: return False oldCollectionsByYearVisited = AccountSettings.getUIFlag(uiFlagKey) for year in years: beg, end = YEARS_INFO.getCollectionDistributionsRangeForYear(year) isCollectionCompleted = self.isCollectionCompleted(range(beg, end)) if not isCollectionCompleted and not oldCollectionsByYearVisited[ year]: return True return False
def _onLoading(self, *args, **kwargs): _logger.info('DailyQuestsView::_onLoading') self.catchGiftEventHub(autoSub=False) with self.viewModel.transaction() as tx: if not AccountSettings.getUIFlag( NY_DAILY_QUESTS_VISITED ) and self.__festivityController.isEnabled(): self._updateLootboxesIntro(tx) self._updateQuestsTitles(tx) self._updateModel(tx) self._updateCountDowns(tx) tx.setPremMissionsTabDiscovered( settings.getDQSettings().premMissionsTabDiscovered) tx.setIsBattlePassActive(self.battlePassController.isActive()) tx.setIsGiftSystemDisabled(self.isGiftEventDisabled()) tx.setIsNewYearAvailable(self.__nyController.isEnabled())
def _onLoading(self, *args, **kwargs): level = NewYearAtmospherePresenter.getLevel() leftLevel = level if level != new_year.CONSTS.MAX_ATMOSPHERE_LVL else level - 1 currentPoints, nextPoints = NewYearAtmospherePresenter.getLevelProgress() lastState = AccountSettings.getUIFlag(NY_LAST_SEEN_LEVEL_INFO) delta = lastState['points'] if lastState['level'] == leftLevel else 0 fillBonusFormula(self.viewModel.bonusFormula) with self.viewModel.transaction() as tx: tx.setCurrentLevel(formatRomanNumber(leftLevel)) tx.setNextLevel(formatRomanNumber(leftLevel + 1)) tx.setCurrentPoints(currentPoints) tx.setNextPoints(nextPoints) tx.setDeltaFromPoints(delta) self.__createMultipliersTable(tx, level) AccountSettings.setUIFlag(NY_LAST_SEEN_LEVEL_INFO, {'level': leftLevel, 'points': currentPoints})
def shouldBeHidden(self, aliasId): return not AccountSettings.getUIFlag( self._VISITED_SETTING.format(aliasId)) and not self.checkRule( self._config.getRuleIdForAlias(aliasId))