예제 #1
0
    def __invalidateQuestData(self):
        quests = self._getQuests()
        tasks, subtasks = self.__makeGroups(quests)
        result = []
        for q in self.__applyFilters(tasks):
            if q.isStrategic():
                qSubtasks = self.__applySort(subtasks[q.getGroupID()])
                result.append(quest_helpers.packQuest(q, quests, linkDown=False if len(qSubtasks) == 0 else True))
                for idx, subtask in enumerate(qSubtasks):
                    linkDown = idx != len(qSubtasks) - 1
                    result.append(quest_helpers.packQuest(subtask, quests, linkDown=linkDown, linkUp=True))

            else:
                result.append(quest_helpers.packQuest(q, quests))

        self.as_setQuestsDataS(result, len(tasks))
예제 #2
0
    def __parseQuestsProgress(self, questsProgress):

        def sortFunc(a, b):
            if a.isCompleted() and not b.isCompleted():
                return -1
            if not a.isCompleted() and b.isCompleted():
                return 1
            if a.isCompleted() and b.isCompleted():
                if a.isStrategic():
                    return -1
                if b.isStrategic():
                    return 1
                aPrevProg = questsProgress[a.getID()][1]
                bPrevProg = questsProgress[b.getID()][1]
                res = a.getBonusCount() - aPrevProg.get('bonusCount', 0) - (b.getBonusCount() - bPrevProg.get('bonusCount', 0))
                if not res:
                    return res
                if a.isSubtask():
                    return 1
                if b.isSubtask():
                    return -1
            return cmp(a.getID(), b.getID())

        from gui.Scaleform.daapi.view.lobby.quests import quest_helpers
        quests = g_questsCache.getQuests()
        result = []
        for qID, qProgress in questsProgress.iteritems():
            if qID in quests:
                pGroupBy, pPrev, pCur = qProgress
                progress = {pGroupBy: pCur}
                if max(pCur.itervalues()) == 0:
                    continue
                result.append(event_items.Quest(qID, quests[qID]._data, progress))

        return map(lambda q: quest_helpers.packQuest(q, quests, noProgressTooltip=True), sorted(result, sortFunc))
예제 #3
0
    def __invalidateQuestData(self):
        quests = self._getQuests()
        tasks, subtasks = self.__makeGroups(quests)
        result = []
        for q in self.__applyFilters(tasks):
            if q.isStrategic():
                qSubtasks = self.__applySort(subtasks[q.getGroupID()])
                result.append(
                    quest_helpers.packQuest(
                        q,
                        quests,
                        linkDown=False if len(qSubtasks) == 0 else True))
                for idx, subtask in enumerate(qSubtasks):
                    linkDown = idx != len(qSubtasks) - 1
                    result.append(
                        quest_helpers.packQuest(subtask,
                                                quests,
                                                linkDown=linkDown,
                                                linkUp=True))

            else:
                result.append(quest_helpers.packQuest(q, quests))

        self.as_setQuestsDataS(result, len(tasks))