Esempio n. 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)
     dispatcher = g_prbLoader.getDispatcher()
     if dispatcher is not None:
         dispatcher.doLeaveAction(pre_queue_ctx.LeavePreQueueCtx(flags=FUNCTIONAL_FLAG.BATTLE_TUTORIAL))
     else:
         LOG_WARNING('Prebattle dispatcher is not defined')
     self._cache.setAfterBattle(False).write()
     self._tutorial.refuse()
     return
Esempio n. 2
0
 def triggerEffect(self):
     descriptor = getBattleDescriptor()
     if descriptor is not None and descriptor.areAllBonusesReceived(self._bonuses.getCompleted()):
         self._cache.setPlayerXPLevel(PLAYER_XP_LEVEL.NORMAL)
     self._cache.setAfterBattle(False).write()
     dispatcher = g_prbLoader.getDispatcher()
     if dispatcher is not None:
         dispatcher.doLeaveAction(pre_queue_ctx.LeavePreQueueCtx())
     else:
         LOG_WARNING("Prebattle dispatcher is not defined")
     self._tutorial.refuse()
     return
Esempio n. 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())
Esempio n. 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()
Esempio n. 5
0
 def triggerEffect(self):
     descriptor = getBattleDescriptor()
     if descriptor is not None and descriptor.areAllBonusesReceived(
             self._bonuses.getCompleted()):
         self._cache.setPlayerXPLevel(PLAYER_XP_LEVEL.NORMAL)
     dispatcher = g_prbLoader.getDispatcher()
     if dispatcher is not None:
         self._doLeave(dispatcher)
     else:
         LOG_WARNING('Prebattle dispatcher is not defined')
     self._cache.setAfterBattle(False).write()
     self._tutorial.refuse()
     return
Esempio n. 6
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)))
Esempio n. 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
     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())
Esempio n. 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
Esempio n. 9
0
 def triggerEffect(self):
     descriptor = getBattleDescriptor()
     if descriptor is not None and descriptor.areAllBonusesReceived(
             self._bonuses.getCompleted()):
         self._cache.setPlayerXPLevel(PLAYER_XP_LEVEL.NORMAL)
     dispatcher = g_prbLoader.getDispatcher()
     if dispatcher is not None:
         state = dispatcher.getFunctionalState()
         if state.isInPreQueue(QUEUE_TYPE.TUTORIAL):
             self._doEffect(dispatcher)
         else:
             LOG_DEBUG('Refuse training is called from non-mode.')
     else:
         LOG_WARNING('Prebattle dispatcher is not defined')
     self._cache.setAfterBattle(False).write()
     self._tutorial.refuse()
     return
Esempio n. 10
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()
Esempio n. 11
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()
Esempio n. 12
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
Esempio n. 13
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()