def __resolveInitialChapter(self, ctx): self._currentChapter = None if ctx.initialChapter is not None: self._currentChapter = ctx.initialChapter return True completed = self._bonuses.getCompleted() fromCache = self._cache.currentChapter() if fromCache is not None and self._settings.findChapterInCache: chapter = self._descriptor.getChapter(fromCache) if self._descriptor.isChapterInitial(chapter, completed): self._currentChapter = fromCache else: self._cache.clearChapterData() LOG_WARNING( "Initial chapter not found in cache or bonuses is invalid", fromCache, chapter.getBonusID() if chapter is not None else None, completed, ) if self._currentChapter is None: self._currentChapter = self._descriptor.getInitialChapterID(completed=completed) if self._currentChapter is None: LOG_ERROR("Initial chapter not found. Tutorial is stopping") self.stop(reason=TUTORIAL_STOP_REASON.CRITICAL_ERROR) return False else: return True
def __resolveInitialChapter(self, ctx): self._currentChapter = None if ctx.initialChapter is not None: self._currentChapter = ctx.initialChapter return True completed = self._bonuses.getCompleted() fromCache = self._cache.currentChapter() if fromCache is not None and self._settings.findChapterInCache: chapter = self._descriptor.getChapter(fromCache) if self._descriptor.isChapterInitial(chapter, completed): self._currentChapter = fromCache else: self._cache.clearChapterData() LOG_WARNING( 'Initial chapter not found in cache or bonuses is invalid', fromCache, chapter.getBonusID() if chapter is not None else None, completed) if self._currentChapter is None: self._currentChapter = self._descriptor.getInitialChapterID( completed=completed) if self._currentChapter is None: LOG_ERROR('Initial chapter not found. Tutorial is stopping') self.stop(reason=TUTORIAL_STOP_REASON.CRITICAL_ERROR) return False return True
def readBonusTriggerSection(xmlCtx, section, chapter, triggerID): return triggers.BonusTrigger(triggerID, chapter.getBonusID())
def __resolveInitialChapter(self, ctx): self._currentChapter = None bonusCompleted = self._bonuses.getCompleted() fromCache = self._cache.currentChapter() if fromCache is not None and self._settings.findChapterInCache: chapter = self._descriptor.getChapter(fromCache) if self._descriptor.isChapterInitial(chapter, bonusCompleted): self._currentChapter = fromCache else: self._cache.clearChapterData() LOG_WARNING('Initial chapter not found in cache or bonuses is invalid', fromCache, chapter.getBonusID() if chapter is not None else None, bonusCompleted) if self._currentChapter is None: self._currentChapter = self._descriptor.getInitialChapterID(completed=bonusCompleted) if self._currentChapter is None: LOG_ERROR('Initial chapter not found. Tutorial is stopping') self.stop() return False else: return True