Ejemplo n.º 1
0
 def onBoosterActionBtnClick(self, boosterID, questID):
     if self.__isReceivedBoostersTab:
         booster = g_goodiesCache.getBooster(boosterID)
         activeBooster = self.__getActiveBoosterByType(booster.boosterType)
         if activeBooster is not None:
             canActivate = yield DialogsInterface.showDialog(
                 I18nConfirmDialogMeta(
                     BOOSTER_CONSTANTS.BOOSTER_ACTIVATION_CONFORMATION_TEXT_KEY,
                     messageCtx={
                         "newBoosterName": text_styles.middleTitle(booster.description),
                         "curBoosterName": text_styles.middleTitle(activeBooster.description),
                     },
                     focusedID=DIALOG_BUTTON_ID.CLOSE,
                 )
             )
         else:
             canActivate = True
         if canActivate:
             self.__activateBoosterRequest(booster)
     else:
         if questID and questID.isdigit():
             questID = int(questID)
         quest = g_eventsCache.getAllQuests(includePotapovQuests=True).get(questID)
         if quest is not None:
             quests_events.showEventsWindow(quest.getID(), quest.getType())
         elif self.__questsDescriptor and self.__questsDescriptor.getChapter(questID):
             quests_events.showEventsWindow(questID, constants.EVENT_TYPE.TUTORIAL)
     return
Ejemplo n.º 2
0
 def doAction(self, boosterID, questID):
     if questID and questID.isdigit():
         questID = int(questID)
     quest = g_eventsCache.getAllQuests(includePotapovQuests=True).get(questID)
     if quest is not None:
         quests_events.showEventsWindow(quest.getID(), quest.getType())
     elif self.__questsDescriptor and self.__questsDescriptor.getChapter(questID):
         quests_events.showEventsWindow(questID, constants.EVENT_TYPE.TUTORIAL)
     return
Ejemplo n.º 3
0
 def doAction(self, boosterID, questID):
     if questID and questID.isdigit():
         questID = int(questID)
     quest = g_eventsCache.getAllQuests(includePotapovQuests=True).get(questID)
     if quest is not None:
         quests_events.showEventsWindow(quest.getID(), quest.getType())
     elif self.__questsDescriptor and self.__questsDescriptor.getChapter(questID):
         quests_events.showEventsWindow(questID, constants.EVENT_TYPE.TUTORIAL)
     return
Ejemplo n.º 4
0
    def _showAward(self, ctx):
        _, message = ctx
        completedQuests = {}
        allQuests = g_eventsCache.getAllQuests(includePotapovQuests=True, filterFunc=lambda quest: self._isAppropriate(quest))
        completedQuestUniqueIDs = message.data.get('completedQuestIDs', set())
        for uniqueQuestID in completedQuestUniqueIDs:
            questID, ctx = self._getContext(uniqueQuestID, completedQuests, completedQuestUniqueIDs)
            if questID in allQuests:
                quest = allQuests[questID]
                ctx.update(eventsCache=g_eventsCache)
                completedQuests[questID] = (quest, ctx)

        for quest, context in completedQuests.itervalues():
            self._showWindow(quest, context)
Ejemplo n.º 5
0
    def _showAward(self, ctx):
        data = ctx[1].data
        allQuests = g_eventsCache.getAllQuests(includePotapovQuests=True)
        needToShowVehAwardWindow = False
        for qID in data.get('completedQuestIDs', set()):
            if qID in allQuests:
                for tokenID, children in allQuests[qID].getChildren().iteritems():
                    for chID in children:
                        chQuest = allQuests[chID]
                        if chQuest.getType() == EVENT_TYPE.POTAPOV_QUEST:
                            needToShowVehAwardWindow = True
                            break

        if needToShowVehAwardWindow:
            for vehTypeCompDescr in data.get('vehicles') or {}:
                quests_events.showVehicleAward(Vehicle(typeCompDescr=abs(vehTypeCompDescr)))
Ejemplo n.º 6
0
    def _showAward(self, ctx):
        data = ctx[1].data
        allQuests = g_eventsCache.getAllQuests(includePotapovQuests=True)
        needToShowVehAwardWindow = False
        for qID in data.get('completedQuestIDs', set()):
            if qID in allQuests:
                for tokenID, children in allQuests[qID].getChildren().iteritems():
                    for chID in children:
                        chQuest = allQuests[chID]
                        if chQuest.getType() == EVENT_TYPE.POTAPOV_QUEST:
                            needToShowVehAwardWindow = True
                            break

        if needToShowVehAwardWindow:
            for vehTypeCompDescr in data.get('vehicles') or {}:
                quests_events.showVehicleAward(Vehicle(typeCompDescr=abs(vehTypeCompDescr)))
Ejemplo n.º 7
0
    def __getBoosterQuests(self):
        result = defaultdict(list)
        quests = g_eventsCache.getAllQuests(
            lambda q: q.isAvailable()[0] and not q.isCompleted(), includePotapovQuests=True
        )
        for q in quests.itervalues():
            bonuses = q.getBonuses("goodies")
            for b in bonuses:
                boosters = b.getBoosters()
                for booster, count in boosters.iteritems():
                    result[q.getID(), q.getUserName()].append((booster, count))

        for chapter, boosters in events_helpers.getTutorialQuestsBoosters().iteritems():
            result[chapter.getID(), chapter.getTitle()].extend(boosters)

        return result
Ejemplo n.º 8
0
    def _showAward(self, ctx):
        _, message = ctx
        completedQuests = {}
        allQuests = g_eventsCache.getAllQuests(
            includePotapovQuests=True,
            filterFunc=lambda quest: self._isAppropriate(quest))
        completedQuestUniqueIDs = message.data.get('completedQuestIDs', set())
        for uniqueQuestID in completedQuestUniqueIDs:
            questID, ctx = self._getContext(uniqueQuestID, completedQuests,
                                            completedQuestUniqueIDs)
            if questID in allQuests:
                quest = allQuests[questID]
                ctx.update(eventsCache=g_eventsCache)
                completedQuests[questID] = (quest, ctx)

        for quest, context in completedQuests.itervalues():
            self._showWindow(quest, context)
Ejemplo n.º 9
0
def getStatusPotapov():
    qu = None
    seqsone = 0
    tile = 0
    ChainID = -1
    allQuests = g_eventsCache.getAllQuests(includePotapovQuests=True)
    debugs( 'Доступно слотов: %s' %(g_eventsCache.questsProgress.getPotapovQuestsFreeSlots()))
    if g_eventsCache.potapov.hasQuestsForSelect():
        debugs( 'Есть доступные ЛБЗ')
        debugs( 'активные сезоны: %s' %( g_eventsCache.potapov.getSeasons().keys() ))
        
        for season in g_eventsCache.potapov.getSeasons():
            seqsone = seqsone +1
            
            for quest in sorted(g_eventsCache.potapov.getSeasons()[season].getTiles().itervalues(), key=operator.methodcaller('getID')):
                tile = tile +1
                for questID in quest.getInProgressQuests():
                    BigWorld.PQInProgressQuests.append(questID)
                tilesQ = 0
                tilesQ1 = 0
                tilesQ2 = 0
                tilesQ3 = 0
                tilesQ4 = 0
                tilesQ5 = 0
                for i in sorted(quest.getQuests().itervalues()):
                    for questID in sorted(i):
                        qu = g_eventsCache.potapov.getQuests()[questID]
                        if qu.isCompleted():
                            if qu.getChainID() ==1:
                                tilesQ1 = tilesQ1 +1
                            if qu.getChainID() ==2:
                                tilesQ2 = tilesQ1 +1
                            if qu.getChainID() ==3:
                                tilesQ3 = tilesQ1 +1
                            if qu.getChainID() ==4:
                                tilesQ4 = tilesQ1 +1
                            if qu.getChainID() ==5:
                                tilesQ5 = tilesQ1 +1
               
                if tilesQ1 ==16:
                    tilesQ = tilesQ+1
                if tilesQ2 ==16:
                    tilesQ = tilesQ+1
                if tilesQ3 ==16:
                    tilesQ = tilesQ+1
                if tilesQ4 ==16:
                    tilesQ = tilesQ+1
                if tilesQ5 ==16:
                    tilesQ = tilesQ+1
                debugs( '%s сезон, Выполнено заданий в %s серии : %s' %(seqsone,tile,tilesQ1+tilesQ2+tilesQ3+tilesQ4+tilesQ5))
                debugs( '%s сезон, Выполнено классовых цепочек заданий в %s серии: %s' %(seqsone,tile,tilesQ))

                if BigWorld.PQtilesQuestEnded:
                    if tilesQ < 4:
                        for i in sorted(quest.getQuests().itervalues()):
                            for questID in sorted(i):
                                qu = g_eventsCache.potapov.getQuests()[questID]
                                if qu.isUnlocked() and questID:# not in BigWorld.PQInProgressQuests:
                                    if qu.isCompleted():
                                        if not qu.isFullCompleted() or qu.needToGetReward():
                                            BigWorld.PQActivedQuest.append(questID)
                                    else:
                                        BigWorld.PQNewQuest.append(questID)
                    else:
                        debugs( 'текущий сезон завершен, активирована опция игнорирования: ')
                else:
                    for i in sorted(quest.getQuests().itervalues()):
                        for questID in sorted(i):
                            qu = g_eventsCache.potapov.getQuests()[questID]
                            if qu.isUnlocked() and questID not in BigWorld.PQInProgressQuests:
                                if qu.isCompleted(): 
                                    if not qu.isFullCompleted() or qu.needToGetReward():
                                        BigWorld.PQActivedQuest.append(questID)
                                else:
                                    BigWorld.PQNewQuest.append(questID)
    debugs('Активные задачи:%s' %( BigWorld.PQInProgressQuests ))
    debugs('Не законченые задачи:%s' %( BigWorld.PQActivedQuest ))
    debugs('Новые задачи:%s' %( BigWorld.PQNewQuest ))
Ejemplo n.º 10
0
def getStatusPotapov():
    qu = None
    seqsone = 0
    tile = 0
    ChainID = -1
    allQuests = g_eventsCache.getAllQuests(includePotapovQuests=True)
    debugs('Доступно слотов: %s' %
           (g_eventsCache.questsProgress.getPotapovQuestsFreeSlots()))
    if g_eventsCache.potapov.hasQuestsForSelect():
        debugs('Есть доступные ЛБЗ')
        debugs('активные сезоны: %s' %
               (g_eventsCache.potapov.getSeasons().keys()))

        for season in g_eventsCache.potapov.getSeasons():
            seqsone = seqsone + 1

            for quest in sorted(g_eventsCache.potapov.getSeasons()
                                [season].getTiles().itervalues(),
                                key=operator.methodcaller('getID')):
                tile = tile + 1
                for questID in quest.getInProgressQuests():
                    BigWorld.PQInProgressQuests.append(questID)
                tilesQ = 0
                tilesQ1 = 0
                tilesQ2 = 0
                tilesQ3 = 0
                tilesQ4 = 0
                tilesQ5 = 0
                for i in sorted(quest.getQuests().itervalues()):
                    for questID in sorted(i):
                        qu = g_eventsCache.potapov.getQuests()[questID]
                        if qu.isCompleted():
                            if qu.getChainID() == 1:
                                tilesQ1 = tilesQ1 + 1
                            if qu.getChainID() == 2:
                                tilesQ2 = tilesQ1 + 1
                            if qu.getChainID() == 3:
                                tilesQ3 = tilesQ1 + 1
                            if qu.getChainID() == 4:
                                tilesQ4 = tilesQ1 + 1
                            if qu.getChainID() == 5:
                                tilesQ5 = tilesQ1 + 1

                if tilesQ1 == 16:
                    tilesQ = tilesQ + 1
                if tilesQ2 == 16:
                    tilesQ = tilesQ + 1
                if tilesQ3 == 16:
                    tilesQ = tilesQ + 1
                if tilesQ4 == 16:
                    tilesQ = tilesQ + 1
                if tilesQ5 == 16:
                    tilesQ = tilesQ + 1
                debugs('%s сезон, Выполнено заданий в %s серии : %s' %
                       (seqsone, tile,
                        tilesQ1 + tilesQ2 + tilesQ3 + tilesQ4 + tilesQ5))
                debugs(
                    '%s сезон, Выполнено классовых цепочек заданий в %s серии: %s'
                    % (seqsone, tile, tilesQ))

                if BigWorld.PQtilesQuestEnded:
                    if tilesQ < 4:
                        for i in sorted(quest.getQuests().itervalues()):
                            for questID in sorted(i):
                                qu = g_eventsCache.potapov.getQuests()[questID]
                                if qu.isUnlocked(
                                ) and questID:  # not in BigWorld.PQInProgressQuests:
                                    if qu.isCompleted():
                                        if not qu.isFullCompleted(
                                        ) or qu.needToGetReward():
                                            BigWorld.PQActivedQuest.append(
                                                questID)
                                    else:
                                        BigWorld.PQNewQuest.append(questID)
                    else:
                        debugs(
                            'текущий сезон завершен, активирована опция игнорирования: '
                        )
                else:
                    for i in sorted(quest.getQuests().itervalues()):
                        for questID in sorted(i):
                            qu = g_eventsCache.potapov.getQuests()[questID]
                            if qu.isUnlocked(
                            ) and questID not in BigWorld.PQInProgressQuests:
                                if qu.isCompleted():
                                    if not qu.isFullCompleted(
                                    ) or qu.needToGetReward():
                                        BigWorld.PQActivedQuest.append(questID)
                                else:
                                    BigWorld.PQNewQuest.append(questID)
    debugs('Активные задачи:%s' % (BigWorld.PQInProgressQuests))
    debugs('Не законченые задачи:%s' % (BigWorld.PQActivedQuest))
    debugs('Новые задачи:%s' % (BigWorld.PQNewQuest))