Пример #1
0
	def onWarFail(self, warObj, npcObj, w):
		'''战斗失败时
		'''
		customTask.onWarFail(self, warObj, npcObj, w)
		who = getRole(w.id)
		if who:
			firstExamObj = answer.getAnswerFirstExamObj()
			firstExamObj.answerWarFail(who, self)
Пример #2
0
    def goAhead(self, who):
        '''前往
		'''
        if not holidayData.getCurrentHoliday():
            self.doScript(who, None, "TP2013")
            task.removeTask(who, self.id)
            return

        customTask.goAhead(self, who)
Пример #3
0
    def goAhead(self, who):
        '''前往
		'''
        wday = getDatePart()["wday"]
        if wday != 7:
            message.tips(who, "活动时间已过,自动删除任务")
            task.removeTask(who, self.id)
            return

        customTask.goAhead(self, who)
Пример #4
0
    def completeTakeProps(self, who, npcObj, propsList=None):
        '''上交物品成功
		'''
        #物品品质
        needQu = self.fetch("propsQu", 0)
        if needQu and propsList:
            propsQuality = getattr(propsList[0], "quality", 0)
            if propsQuality >= needQu:
                self.propsQuality = propsQuality

        customTask.completeTakeProps(self, who, npcObj, propsList)
Пример #5
0
	def goAhead(self, who):#override
		'''前往
		'''
		firstExamObj = answer.getAnswerFirstExamObj()
		if not firstExamObj.isInAnswerTime():
			message.tips(who, firstExamObj.getText(2326))
			task.removeTask(who, self.id)
			return
		if who.inTeam():
			message.tips(who, firstExamObj.getText(2321, who.id))
			return
		customTask.goAhead(self, who)
Пример #6
0
 def onBorn(self, who, npcObj, **kwargs):
     customTask.onBorn(self, who, npcObj, **kwargs)
     doublePoint = who.doublePoint
     if 0 < doublePoint:
         return
     fdp = who.getFrozenDoublePoint()
     if not fdp:
         return
     dp = min(fdp, 80 - doublePoint, 40)
     who.addDoublePoint(dp, "领取高倍点数", False)
     who.addFrozenDoublePoint(-dp, "领取高倍点数")
     activity.center.centerChange(who, "doublePoint", "frozenDoublePoint")
Пример #7
0
	def abort(self, who):
		'''放弃任务
		'''
		customTask.abort(self, who)
		lv,taskList = self.findTaskGroupList(self.id)
		if lv:
			petCompleteNo = who.taskCtn.fetch("petCom", {})
			comList = petCompleteNo.get(lv, [])
			for no in taskList:
				if no in comList:
					comList.remove(no)
			petCompleteNo[lv] = comList
			who.taskCtn.set("petCom", petCompleteNo)
		task.pett.autoPetTask(who)
Пример #8
0
 def getValueByVarName(self, varName, who):
     if varName == "R":
         if who:
             ring = who.taskCtn.fetch("guildRing") % 10
             return ring if ring else 10
         return 0
     return customTask.getValueByVarName(self, varName, who)
Пример #9
0
 def getValueByVarName(self, varName, who):
     if varName == "R":
         if who:
             ring = who.taskCtn.fetch("schoolRing") % 10
             return 10 if ring == 0 else ring
         return 0
     return customTask.getValueByVarName(self, varName, who)
Пример #10
0
 def getValueByVarName(self, varName, who):
     if varName == "F":
         if who:
             res = 1 - self.fetch("warFail") * 0.1
             return max(0, res)
         return 1
     return customTask.getValueByVarName(self, varName, who)
Пример #11
0
    def isValid(self):
        '''是否有效
		'''
        wday = getDatePart()["wday"]
        if wday != 7:
            return 0

        return customTask.isValid(self)
Пример #12
0
    def transString(self, content, pid=0):
        '''转化字符串
		'''
        holidayId = self.fetch("holidayId")
        holidayName = holidayData.getConfig(holidayId, "节日名称")
        content = content.replace("$holiday", holidayName)

        return customTask.transString(self, content, pid)
Пример #13
0
    def onBorn(self, who, npcObj, **kwargs):  #override
        '''
		'''
        customTask.onBorn(self, who, npcObj, **kwargs)
        #定时
        datePart = getDatePart()
        lEndTime = []
        lEndTime.append(datePart["year"])  #年
        lEndTime.append(datePart["month"])  #月
        lEndTime.append(datePart["day"] + 1)  #日
        lEndTime.append(0)  #时
        lEndTime.append(0)  #分
        lEndTime.append(0)  #秒

        iEndTime = getSecond(*lEndTime)
        leftTime = iEndTime - getSecond()
        self.setTime(leftTime)  # 计时任务
Пример #14
0
 def transString(self, content, pid=0):
     if "$needCnt" in content:
         needCnt = self.getNeedMonsterCnt()
         content = content.replace("$needCnt", str(needCnt))
     if "$hasCnt" in content:
         hasCnt = self.getHasMonsterCnt()
         content = content.replace("$hasCnt", str(hasCnt))
     return customTask.transString(self, content, pid)
Пример #15
0
 def validDoEventScript(self, who, npcObj, key):
     if key in ("点击", "回复"):
         if not who.isSingle():
             if self.parentId == task.map.TASK_MAP_PARENT_ID:
                 self.doScript(who, npcObj, "D1003")
             else:
                 self.doScript(who, npcObj, "D2006")
             return 0
     return customTask.validDoEventScript(self, who, npcObj, key)
Пример #16
0
    def transIdxByGroup(self, idx):
        if idx != 9001:
            return customTask.transIdxByGroup(self, idx)

        npcIdx = self.fetch("npcIdx", 0)
        lst = list(self.getGroupInfo(idx))
        if npcIdx:
            lst.remove(npcIdx)
        return lst[rand(len(lst))]
Пример #17
0
    def isValid(self):
        '''是否有效
		'''
        actObj = activity.triones.getActivity()
        if actObj:
            if actObj.inNormalTime():
                return 1
            else:
                return 0
        return customTask.isValid(self)
Пример #18
0
    def getBranchCondition(self, who, npcObj, branchIdx, flag):
        if flag == "lv":
            lst = [info["条件"] for info in self.getBranchInfo(branchIdx)]
            lst.sort(reverse=True)
            for lv in lst:
                if who.level >= lv:
                    return lv

        return customTask.getBranchCondition(self, who, npcObj, branchIdx,
                                             flag)
Пример #19
0
    def isValid(self):
        '''是否有效
		'''
        holidayId = holidayData.getCurrentHoliday()
        if not holidayId or not self.fetch("holidayId"):
            return 0
        if holidayId != self.fetch("holidayId"):
            self.set("holidayId", holidayId)

        return customTask.isValid(self)
Пример #20
0
	def isValid(self):
		'''是否有效
		'''
		firstExamObj = answer.getAnswerFirstExamObj()
		if firstExamObj:
			if firstExamObj.isInAnswerTime():
				return 1
			else:
				return 0
		return customTask.isValid(self)
Пример #21
0
    def transString(self, content, pid=0):
        who = None
        if pid:
            who = getRole(pid)

        if who:
            if "$BOSS" in content:
                content = content.replace("$BOSS", self.getBossDesc(who))

        return customTask.transString(self, content, pid)
Пример #22
0
    def transString(self, content, pid=0):
        '''转化字符串
		'''
        who = None
        if pid:
            who = getRole(pid)
        if who:
            guildObj = who.getGuildObj()
            if "$union" in content:
                content = content.replace("$union", guildObj.name)
        return customTask.transString(self, content)
Пример #23
0
    def transString(self, content, pid=0):  #override
        '''转化字符串
		'''
        if "$monsterList" in content or "$allScene" in content:
            actObj = activity.triones.getActivity()
            if actObj:
                if "$monsterList" in content:
                    lKillMonster = []
                    lTemp = []
                    who = None
                    if pid:
                        who = getRole(pid)
                    if who:
                        lKillMonster = who.day.fetch("trionesKill", [])
                    #未战胜显示#C04
                    #已战胜显示#C05
                    for monsterIdx in xrange(1001, 1008):
                        info = actObj.getNpcInfo(monsterIdx)
                        if monsterIdx in lKillMonster:
                            lTemp.append("#C0{}{}#n".format(
                                5, info.get("名称", "")))
                        else:
                            lTemp.append("#C0{}{}#n".format(
                                4, info.get("名称", "")))

                    content = content.replace("$monsterList", "、".join(lTemp))

                if "$allScene" in content:
                    lTemp = []
                    lAllScene = actObj.getGroupInfo(9001)
                    for iSceneId in lAllScene:
                        sceneObj = scene.getScene(iSceneId)
                        if sceneObj:
                            lTemp.append("#C08{}#n".format(sceneObj.name))

                    content = content.replace("$allScene", "、".join(lTemp))

        return customTask.transString(self, content, pid)
Пример #24
0
 def onBorn(self, who, npcObj, **kwargs):
     customTask.onBorn(self, who, npcObj, **kwargs)
     dayRing = who.day.fetch("schoolRing")
     if dayRing > 0:
         who.taskCtn.set("schoolRing", dayRing % 10)
Пример #25
0
 def onBorn(self, who, npcObj, **kwargs):
     customTask.onBorn(self, who, npcObj, **kwargs)
     self.autoGoAhead(who)
Пример #26
0
 def abort(self, who):
     customTask.abort(self, who)
     who.taskCtn.delete("schoolRing")
Пример #27
0
 def transNpcInfo(self, npcIdx, info, who=None):
     if "$name" in info["名称"]:
         info["名称"] = self.createRandName()
     if "$pos" in info["位置"]:
         info["位置"] = self.createRandPos()
     return customTask.transNpcInfo(self, npcIdx, info, who)
Пример #28
0
	def __init__(self, _id):
		customTask.__init__(self, _id)
		self.iExamNo = self.id%20000
Пример #29
0
	def getNpcByIdx(self, npcIdx):
		if npcIdx in xrange(1001,1021):
			return self.getTargetNpc()
		return customTask.getNpcByIdx(self, npcIdx)
Пример #30
0
    def onBorn(self, who, npcObj, **kwargs):
        '''出生时初始化,只在给予任务时执行一次
		'''
        holidayId = holidayData.getCurrentHoliday()
        self.set("holidayId", holidayId)
        customTask.onBorn(self, who, npcObj, **kwargs)