Beispiel #1
0
 def triggerEffect(self):
     descriptor = _getBattleDescriptor()
     if descriptor is not None and descriptor.areAllBonusesReceived(
             self._bonuses.getCompleted()):
         self._cache.setPlayerXPLevel(PLAYER_XP_LEVEL.NORMAL).write()
     self._tutorial.refuse()
     return
Beispiel #2
0
    def invoke(self, content, _):
        result = []
        descriptor = _getBattleDescriptor()
        if descriptor is None:
            return
        completed = self._bonuses.getCompleted()
        for chapter in descriptor:
            if chapter.hasBonus():
                result.append({'values': chapter.getBonus().getValues(),
                 'received': chapter.isBonusReceived(completed)})

        content['bonuses'] = result
        content['timeNoteValue'] = content['timeNoteValue'].format(i18n.makeString('#battle_tutorial:labels/minutes', minutes=str(TUTORIAL_AVG_SESSION_TIME)))
Beispiel #3
0
 def invoke(self, content, varID):
     received = self.getVar(varID, default=0)
     localCtx = OffBattleClientCtx.fetch(self._cache)
     self._lastHistoryID = localCtx.arenaUniqueID
     descriptor = _getBattleDescriptor()
     if descriptor is None:
         return
     content.update(localCtx._asdict())
     resultKey, finishKey = getTrainingResultKeys(descriptor.areAllBonusesReceived(localCtx.completed), localCtx)
     content['resultKey'] = resultKey
     content['finishKey'] = finishKey
     content['chapters'] = _getChaptersResults(descriptor, localCtx, received)
     content['areAllBonusesReceived'] = descriptor.areAllBonusesReceived(self._bonuses.getCompleted())
Beispiel #4
0
    def triggerEffect(self):
        localCtx = OffBattleClientCtx.fetch(self._cache)
        inBattle = localCtx.completed
        inStats = self._bonuses.getCompleted()
        descriptor = _getBattleDescriptor()
        if descriptor is None:
            return
        for chapter in descriptor:
            if chapter.hasBonus() and chapter.isBonusReceived(inBattle) and not chapter.isBonusReceived(inStats):
                self.__requesters.append(OffbattleBonusesRequester(self._bonuses.getCompleted(), chapter=chapter))

        for requester in self.__requesters:
            requester.request()
Beispiel #5
0
 def invoke(self, content, varID):
     localCtx = OffBattleClientCtx.fetch(self._cache)
     descriptor = _getBattleDescriptor()
     if descriptor is None:
         return
     if self._isHistory:
         received = self.__getReceivedBonusesInHistory(descriptor, localCtx)
     else:
         received = self.getVar(varID, default=0)
     content['finished'] = descriptor.areAllBonusesReceived(localCtx.completed)
     content['areAllBonusesReceived'] = descriptor.areAllBonusesReceived(self._bonuses.getCompleted())
     content['arenaUniqueID'] = localCtx.arenaUniqueID
     content['isHistory'] = self._isHistory
     self.__addTotalResult(localCtx, content)
     self.__addChaptersProcess(descriptor, localCtx, received, content)
     if content['areAllBonusesReceived']:
         self._cache.setPlayerXPLevel(PLAYER_XP_LEVEL.NORMAL)
     self._cache.setAfterBattle(False).write()
Beispiel #6
0
    def triggerEffect(self):
        localCtx = OffBattleClientCtx.fetch(self._cache)
        inBattle = localCtx.completed
        inStats = self._bonuses.getCompleted()
        descriptor = _getBattleDescriptor()
        if descriptor is None:
            return
        else:
            for chapter in descriptor:
                if chapter.hasBonus() and chapter.isBonusReceived(
                        inBattle) and not chapter.isBonusReceived(inStats):
                    self.__requesters.append(
                        OffbattleBonusesRequester(self._bonuses.getCompleted(),
                                                  chapter=chapter))

            for requester in self.__requesters:
                requester.request()

            return
Beispiel #7
0
 def invoke(self, content, varID):
     received = self.getVar(varID, default=0)
     localCtx = OffBattleClientCtx.fetch(self._cache)
     self._lastHistoryID = localCtx.arenaUniqueID
     descriptor = _getBattleDescriptor()
     if descriptor is None:
         return
     else:
         content.update(localCtx._asdict())
         resultKey, finishKey = getTrainingResultKeys(
             descriptor.areAllBonusesReceived(localCtx.completed), localCtx)
         content['resultKey'] = resultKey
         content['finishKey'] = finishKey
         content['chapters'] = _getChaptersResults(descriptor, localCtx,
                                                   received)
         content[
             'areAllBonusesReceived'] = descriptor.areAllBonusesReceived(
                 self._bonuses.getCompleted())
         return
Beispiel #8
0
    def invoke(self, content, _):
        result = []
        descriptor = _getBattleDescriptor()
        if descriptor is None:
            return
        else:
            completed = self._bonuses.getCompleted()
            for chapter in descriptor:
                if chapter.hasBonus():
                    result.append({
                        'values':
                        chapter.getBonus().getValues(),
                        'received':
                        chapter.isBonusReceived(completed)
                    })

            content['bonuses'] = result
            content['timeNoteValue'] = content['timeNoteValue'].format(
                i18n.makeString('#battle_tutorial:labels/minutes',
                                minutes=str(TUTORIAL_AVG_SESSION_TIME)))
            return
Beispiel #9
0
 def invoke(self, content, varID):
     localCtx = OffBattleClientCtx.fetch(self._cache)
     descriptor = _getBattleDescriptor()
     if descriptor is None:
         return
     else:
         if self._isHistory:
             received = self.__getReceivedBonusesInHistory(
                 descriptor, localCtx)
         else:
             received = self.getVar(varID, default=0)
         content['finished'] = descriptor.areAllBonusesReceived(
             localCtx.completed)
         content[
             'areAllBonusesReceived'] = descriptor.areAllBonusesReceived(
                 self._bonuses.getCompleted())
         content['arenaUniqueID'] = localCtx.arenaUniqueID
         content['isHistory'] = self._isHistory
         self.__addTotalResult(localCtx, content)
         self.__addChaptersProcess(descriptor, localCtx, received, content)
         if content['areAllBonusesReceived']:
             self._cache.setPlayerXPLevel(PLAYER_XP_LEVEL.NORMAL)
         self._cache.setAfterBattle(False).write()
         return
Beispiel #10
0
 def triggerEffect(self):
     descriptor = _getBattleDescriptor()
     if descriptor is not None and descriptor.areAllBonusesReceived(self._bonuses.getCompleted()):
         self._cache.setPlayerXPLevel(PLAYER_XP_LEVEL.NORMAL).write()
     self._tutorial.refuse()
     return