Esempio n. 1
0
 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 setDefaultTab(self, tabIdx):
     dq = settings.getDQSettings()
     if tabIdx is None:
         tabIdx = dq.lastVisitedDQTabIdx if dq.lastVisitedDQTabIdx is not None else DEFAULT_DAILY_TAB
     if tabIdx == DailyTabs.QUESTS and not isDailyQuestsEnable():
         tabIdx = DailyTabs.PREMIUM_MISSIONS
     elif tabIdx == DailyTabs.PREMIUM_MISSIONS and not isPremiumQuestsEnable():
         tabIdx = DailyTabs.QUESTS
     _logger.debug('PremiumMissionsView:setDefaultTab: tabIdx=%s', tabIdx)
     self.__setCurrentTab(tabIdx, self.viewModel)
     return
 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)
 def __shouldHide(self):
     return not isDailyQuestsEnable() or self.promoController.isTeaserOpen(
     ) or not (self._isRandomBattleSelected() or self._isMapboxSelected())