def doTask(self, msg): if self.status is TaskStatus.END: return None if self.status is TaskStatus.STARTING: self.status = TaskStatus.LOCK return self.__initTask() self.__load(msg) self.__matchineDo(msg) if self.taskIsOver and self.status is not TaskStatus.END: self.__selfRest() return self.__initTask() if self.status is TaskStatus.LOCK or self.status is TaskStatus.END: return None if self.npcId.get("id") is not None and self.npcId['isGet'] is True \ and self.taskGood.get('name') is None: flows = ["task sm " + self.npcId.get('id')] self.status = TaskStatus.LOCK return flows if self.taskGood.get('name') is not None \ and self.currentLoop != -1 \ and self.taskGood.get('isBuy') is False \ and self.giveUp.get('begin') is False: if self.taskGood.get( 'id') is not None and self.taskGood.get('isBuy') is False: self.status = TaskStatus.LOCK self.taskGood['buyying'] = True logger.info("Buyying ="+str(self.currentLoop)+ \ "||"+str(self.goodsLoopList[self.currentLoop])) return ["buy 1 "+self.taskGood.get('id')+" from " \ +self.goodsLoopList[self.currentLoop].get('id')] currentSearch = self.goodsLoopList[self.currentLoop] if currentSearch.get('done') is False: self.status = TaskStatus.LOCK return utils.getFlows(currentSearch.get('name')) elif currentSearch.get('id') != "" and currentSearch.get( 'isList') is False: self.status = TaskStatus.LOCK self.goodsLoopList[self.currentLoop]['isList'] = True return ['list ' + currentSearch.get('id')] if self.taskGood.get('isBuy') is True and self.pushNpc.get('id') is None \ and self.pushNpc.get('getting') is True: self.status = TaskStatus.LOCK return utils.getFlows(self.flows) if self.pushNpc.get('id') is not None and self.pushNpc.get('isGet') is True \ and self.giveUp.get('begin') is False: self.status = TaskStatus.LOCK self.taskIsPush = True return [ 'task sm ' + self.pushNpc.get('id') + ' give ' + self.taskGood.get('id') ] if self.giveUp.get('begin') is True and self.giveUp.get('move') is False \ and self.giveUp.get('do') is False: self.status = TaskStatus.LOCK return utils.getFlows(self.flows) if self.giveUp.get('do') is True and self.pushNpc.get( "id") is not None: self.status = TaskStatus.LOCK return ['task sm ' + self.pushNpc.get('id') + ' giveup']
def __init__(self,name,status,dupName): self.name = name self.status = status self.dupName = dupName self.commonIndex = 0 self.commonIsBegin = False self.figthIsStart = False self.commonList = utils.getFlows(self.dupName) self.fightMathine = FightMathine(name) self.sellMathine = SellMatchine(name) self.isSell = False self.room = ""
def doTask(self, msg): self.__load(msg) if self.status is (TaskStatus.LOCK or TaskStatus.END or TaskStatus.OVER): return None if self.status is TaskStatus.STARTING: self.status = TaskStatus.LOCK return utils.getFlows(self.__getInitFlows()) if self.status is TaskStatus.DOING: if self.skillList: skill = self.skillList.pop() self.status = TaskStatus.LOCK return ["xue " + skill + " from " + self.master.get('id')] else: self.status = TaskStatus.OVER
def open(self): self.isOpen = True if self.__isStart is False: self.__isStart = True return utils.getFlows("杂货铺")
def __initTask(self): return utils.getFlows(self.flows)