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))
Esempio n. 2
0
 def __onQuestsUpdated(self, *args):
     quests = g_questsCache.getQuests()
     quest_helpers.updateQuestSettings(quests)
     newQuestsCount = len(quest_helpers.getNewQuests(quests))
     if newQuestsCount:
         if not self.__isHighlighted:
             self.as_highlightControlS()
     else:
         self.as_resetControlS()
     self.__isHighlighted = bool(newQuestsCount)
Esempio n. 3
0
 def __onQuestsUpdated(self, *args):
     quests = g_questsCache.getQuests()
     quest_helpers.updateQuestSettings(quests)
     newQuestsCount = len(quest_helpers.getNewQuests(quests))
     if newQuestsCount:
         if not self.__isHighlighted:
             self.as_highlightControlS()
     else:
         self.as_resetControlS()
     self.__isHighlighted = bool(newQuestsCount)
Esempio n. 4
0
 def __onQuestsUpdated(self, *args):
     quest_helpers.updateQuestSettings(g_questsCache.getQuests())
     self.__invalidateQuestData()
Esempio n. 5
0
 def __onQuestsUpdated(self, *args):
     quest_helpers.updateQuestSettings(g_questsCache.getQuests())
     self.__invalidateQuestData()