def getCtx(): instance = loader.g_loader.tutorial ctx = None if instance is not None and not instance._tutorialStopped: ctx = OffBattleClientCtx.fetch(instance._cache) else: LOG_DEBUG('Tutorial is not running.') return ctx
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())
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()
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()
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())
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()
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()
def __init__(self, triggerID, setVarID): super(AllBonusesTrigger, self).__init__(triggerID) self._setVarID = setVarID self._battleSnap = OffBattleClientCtx.fetch(self._cache).completed self._statsSnap = self._bonuses.getCompleted()