def __sellOne(hwnd, proc): doupi = 0x186aea douzi = 0x186ada hujiao = 0x186acf name = dolScript.getRoleName(proc) print name tabid = dolScript.getTabId(proc) if(tabid != 0): while(dolCall.sell(proc, tabid, [(doupi, 1)])): print 'sell...' time.sleep(0.13) else: print 'no tab!'
def __feather(hwnd, proc): bossid = 0x1800349 logger = TextLogger('FeatherLog.txt') myname = dolScript.getRoleName(proc) print myname def __alert(): logger.log( "断线了,退出脚本") title = "警告" message = "[%s] 断线 !!!".decode('utf-8') message = message % (myname) message = message.encode('utf-8') beep(title, message) class Switcher(): def __init__(self, switchList): self.switchList = switchList self.ptr = 0 def getNext(self): self.ptr += 1 if (self.ptr >= len(self.switchList)): self.ptr = self.ptr % len(self.switchList) return self.switchList[self.ptr] def openBook(): logger.log('start to make feather') dolCall.custom(proc, 3) #f3 放书 time.sleep(2) dll.Key("KeyClick", hwnd, 0x28) # down arrow time.sleep(1) dll.Key("KeyClick", hwnd, 0xD) # enter time.sleep(3) dll.Mouse("LClick", hwnd, 627, 495) time.sleep(1) switch = Switcher([5, 6, 7, 8]) while(True): if(not dolScript.isOnline(proc)): __alert() return while(dolCall.buy(proc, bossid, [-1, -1, (0xFFF, 68)])): logger.log('bought some ducks...') if(not dolScript.isOnline(proc)): __alert() return time.sleep(2) logger.log('use 1*') dolCall.custom(proc, 4) # f4放一星 time.sleep(1) count = 0 while(dolScript.getHPRatio(proc) < 0.7): if(not dolScript.isOnline(proc)): __alert() return logger.log('eat') dolCall.custom(proc, switch.getNext()) #f7 放料理 time.sleep(1) count += 1 if(count > dolScript.getHPMax(proc) / 20): logger.log('no food?') beep('Epic fail', 'No food !!!') openBook() hprecord = [] waitSec = 5 times = 6 interval = waitSec / float(times) print interval for i in range(times): hprecord.append(-1) ptr = 0 while(True): if(not dolScript.isOnline(proc)): __alert() return hp = dolScript.getHP(proc) if(hp < 100): logger.log('hp low during making') #Key("KeyClick", hwnd, 0x1b) # esc dll.Mouse("LClick", hwnd, 878, 539) time.sleep(1) for i in range(times): hprecord[i] = -1 while(dolScript.getHPRatio(proc) < 0.7): logger.log('hp ratio = %.3f' % (dolScript.getHPRatio(proc))) dolCall.custom(proc, switch.getNext()) time.sleep(1) dll.Key("KeyClick", hwnd, 0xD) # enter time.sleep(3) dll.Mouse("LClick", hwnd, 627, 495) time.sleep(1) hprecord[ptr] = hp beforeptr = ptr ptr += 1 ptr = ptr % times print hprecord if(hprecord[beforeptr] == hprecord[ptr]): if(hprecord[beforeptr] < 10): logger.log('no food?') beep('Epic fail', 'No food !!!') logger.log('no materials') time.sleep(2) break time.sleep(interval) while(dolCall.sell(proc, bossid, [(0x186b2f, 30)])): #0x186b2f == 羽毛的id if(not dolScript.isOnline(proc)): __alert() return logger.log('selling feathers') time.sleep(2) time.sleep(2)