def isUser(classify, offset): time.sleep(1) catchScreen.catchScreen(337, 200, 555, 270, "home\\users") time.sleep(2) a = 1 attr = getOffset.getOffsetValue("home\\" + classify) while True: if (a == 1): if (findUser(555, 301, classify, attr, offset)): break elif (a == 2): if (findUser(490, 330, classify, attr, offset)): break elif (a == 3): if (findUser(437, 356, classify, attr, offset)): break elif (a == 4): if (findUser(494, 387, classify, attr, offset)): break elif (a == 5): if (findUser(554, 419, classify, attr, offset)): break elif (a == 6): if (findUser(613, 389, classify, attr, offset)): break elif (a == 7): if (findUser(675, 357, classify, attr, offset)): break elif (a == 8): if (findUser(614, 329, classify, attr, offset)): break a += 1 if (a == 9): a = 1
def isFight(i): if (i % 4 == 1): time.sleep(1) fiter.moveAndClick(88 + random.randint(-10, 10), 42) autopy.key.toggle('8', True, autopy.key.MOD_ALT) autopy.key.toggle('8', False, autopy.key.MOD_ALT) time.sleep(1) fiter.moveAndClick(238 + random.randint(-10, 10), 42) autopy.key.toggle('8', True, autopy.key.MOD_ALT) autopy.key.toggle('8', False, autopy.key.MOD_ALT) time.sleep(1) fiter.moveAndClick(388 + random.randint(-10, 10), 42) autopy.key.toggle('8', True, autopy.key.MOD_ALT) autopy.key.toggle('8', False, autopy.key.MOD_ALT) time.sleep(1) fiter.moveAndClick(538 + random.randint(-10, 10), 42) autopy.key.toggle('8', True, autopy.key.MOD_ALT) autopy.key.toggle('8', False, autopy.key.MOD_ALT) time.sleep(1) fiter.moveAndClick(688 + random.randint(-10, 10), 42) autopy.key.toggle('8', True, autopy.key.MOD_ALT) autopy.key.toggle('8', False, autopy.key.MOD_ALT) time.sleep(1) fiter.moveAndClick(88 + random.randint(-10, 10), 42) time.sleep(1) x = True while True: catchScreen.catchAllScreen() if (isinstance(getOffset.getOffsetValue("zidong"), list)): x = True else: print("over") break
def score(): time.sleep(0.5) catchScreen.catchAllScreen() if(isinstance(getOffset.getOffsetValue("shitu\\score"), list)): fiter.moveAndClick_fast(228, 264) time.sleep(1) fiter.moveAndClick_fast(418, 505) fiter.moveAndClick_fast(418, 505)
def isAuto(): time.sleep(1) autopy.mouse.move(200, 248) # 平滑移动鼠标(上面那个是瞬间的) while True: catchScreen.catchAllScreen() if (isinstance(getOffset.getOffsetValue("new\\auto"), list)): autopy.mouse.click() # 单击 else: break print("动画结束")
def findUser(x, y, classify, attr, offset): a = False time.sleep(1) fiter.moveAndClick(x, y) time.sleep(1) fiter.moveAndClick(175, 328) fiter.moveAndClick(attr[0] + offset, attr[1]) catchScreen.catchAllScreen() if (getOffset.getOffsetValue("home\\users") == "none"): findNPC(classify) a = True return a
def home_mouse(): # autopy.mouse.smooth_move(400, 350) # 平滑移动鼠标(上面那个是瞬间的) autopy.mouse.move(189, 350) # 平滑移动鼠标(上面那个是瞬间的) autopy.mouse.click() # 单击 autopy.mouse.toggle(True) # 按下左键 autopy.mouse.toggle(False) # 松开左键 # 打开地图 time.sleep(1) autopy.key.toggle('2', True, autopy.key.MOD_ALT) autopy.key.toggle('2', False, autopy.key.MOD_ALT) # 点击长安子图 time.sleep(2) autopy.mouse.smooth_move(510, 420) # 平滑移动鼠标(上面那个是瞬间的) autopy.mouse.click() # 单击 # 移动超级管家 time.sleep(2) autopy.mouse.smooth_move(325, 355) # 地图坐标为164,129 autopy.mouse.click() # 单击 # 判断是否走到管家面前 x1 = "" while True: # 截取左上地图坐标 catchScreen.catchScreen(40, 65, 140, 85, "position") position = getInfoFromScreen.getInfomation("position") if (x1 == position): break else: x1 = position # 关闭大地图和小地图 autopy.key.toggle('2', True, autopy.key.MOD_ALT) autopy.key.toggle('2', False, autopy.key.MOD_ALT) autopy.key.toggle('1', True, autopy.key.MOD_ALT) autopy.key.toggle('1', False, autopy.key.MOD_ALT) autopy.key.toggle('5', True, autopy.key.MOD_ALT) autopy.key.toggle('5', False, autopy.key.MOD_ALT) # 计算‘超级管家偏移量’ 再点击超级管家 autopy.mouse.click() # 单击 time.sleep(2) autopy.mouse.smooth_move(225, 300) time.sleep(1) catchScreen.catchAllScreen() attr = getOffset.getOffsetValue("home\\home_start") autopy.mouse.smooth_move(attr[0] + 32, attr[1] + 217) time.sleep(1) autopy.mouse.click() # 单击 time.sleep(1) autopy.mouse.smooth_move(220, 346) time.sleep(1) autopy.mouse.click() # 单击
def homeTaskStart(): autopy.mouse.move(397, 390) # 平滑移动鼠标(上面那个是瞬间的) autopy.mouse.click() # 单击 times = 0 while times < 10: # 移动街坊图标并点击 fiter.moveAndClick(775, 182) # 移动祭坛图标并点击 fiter.moveAndClick(420, 352) # 点击领取任务 fiter.moveAndClick(205, 328) # 打开任务列表 time.sleep(1) if (times == 0): autopy.key.toggle('q', True, autopy.key.MOD_ALT) autopy.key.toggle('q', False, autopy.key.MOD_ALT) else: autopy.key.toggle('q', True, autopy.key.MOD_ALT) autopy.key.toggle('q', False, autopy.key.MOD_ALT) time.sleep(1) autopy.key.toggle('q', True, autopy.key.MOD_ALT) autopy.key.toggle('q', False, autopy.key.MOD_ALT) # 判断任务的类型 catchScreen.catchAllScreen() time.sleep(1) while True: if (isinstance(getOffset.getOffsetValue("home\\xiaoyao"), list)): print("小妖") attr = getOffset.getOffsetValue("home\\xiaoyao") fiter.moveAndClick(attr[0] + 70, attr[1]) isUser("xiaoyao", 70) break elif (isinstance(getOffset.getOffsetValue("home\\yuanding"), list)): print("园丁") attr = getOffset.getOffsetValue("home\\yuanding") fiter.moveAndClick(attr[0] + 65, attr[1]) isUser("yuanding", 65) break elif (isinstance(getOffset.getOffsetValue("home\\gongshuban"), list)): print("公输般") attr = getOffset.getOffsetValue("home\\gongshuban") fiter.moveAndClick(attr[0] - 45, attr[1]) if (findNPC("gongshuban")): print("haha") fiter.moveAndClick(249, 379) fiter.moveAndClick(216, 330) break # 点击回家 fiter.moveAndClick(785, 551) times += 1
def monkeyTaskStart(): autopy.mouse.move(100, 20) # 平滑移动鼠标(上面那个是瞬间的) autopy.mouse.click() # 单击 #(地图大小为120,100) for i in range(1, 60): while True: print("finding...") getScreen.window_capture("D:\\zhaoyq\\screen\\allScreen.png") dealScreenMonkey.dealMonkeyPicture() attr = getOffset.getOffsetValue_Monkey() print(attr) if (isinstance(attr, list)): autopy.mouse.move(attr[0] + 200, attr[1] - 50 + 200) autopy.mouse.click() # 单击 time.sleep(1) catchScreen.catchAllScreen() time.sleep(1) dealScreen.dealScreen("allScreen") if (isinstance(getOffset.getOffsetValue("monkey\\monkey_1"), list)): break else: fiter.isWalking() fiter.moveAndClick(310 + random.randint(0, 10), 343 + random.randint(0, 10)) time.sleep(1) fiter.moveAndClick(228 + random.randint(0, 10), 325 + random.randint(0, 10)) fiter.isFight(i) time.sleep(1) # autopy.key.toggle('c', True, autopy.key.MOD_ALT) # autopy.key.toggle('c', False, autopy.key.MOD_ALT) fiter.moveAndClick(131 + random.randint(0, 10), 240 + random.randint(0, 10)) fiter.isWalking() fiter.moveAndClick(290 + random.randint(0, 10), 365 + random.randint(0, 10))
def newPlayerStart(): autopy.mouse.move(100, 20) # 平滑移动鼠标(上面那个是瞬间的) autopy.mouse.click() # 单击 while True: catchScreen.catchAllScreen() if(isinstance(getOffset.getOffsetValue("new\\begin"), list)): break # 点击第一个任务 npc仙子 attr = getOffset.getOffsetValue("new\\begin") fiter.moveAndClick(attr[0]-20+random.randint(-20,20),attr[1]-10) fiter.isWalking() fiter.moveAndClick(250+random.randint(-10,20),329) time.sleep(1) fiter.isAuto() # 关闭大话精灵对话框 fiter.moveAndClick(652, 165) # 点击第二个任务 npc王二愣 fiter.moveAndClick(40+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(218+random.randint(-10,20), 328) fiter.isAuto # 点击第三个任务 npc猎户 print("任务3") fiter.moveAndClick(80+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(218+random.randint(-10,20), 328) fiter.isAuto() fiter.moveAndClick(655, 165) # 点击第四个任务 npc小黄金兽 print("任务4") fiter.moveAndClick(78+random.randint(-20,20), 240) fiter.isWalking() fiter.moveAndClick(207+random.randint(-10,20), 328) fiter.isFight() fiter.isAuto() # 点击第五个任务 npc猎户 time.sleep(0.5) fiter.moveAndClick(80+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(200+random.randint(-15,15), 328) fiter.isAuto() # 点击第六个任务 npc渔村村子 time.sleep(0.5) fiter.moveAndClick(70+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(200+random.randint(-15,15), 328) fiter.isAuto() # 点击第七个任务 npc王二愣 fiter.moveAndClick(65+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(200+random.randint(-15,15), 328) fiter.isAuto() # 点击第八个任务 npc渔村村长 time.sleep(1) fiter.moveAndClick(88+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(200+random.randint(-20,20), 328) fiter.isAuto() # 点击第九个任务 npc大侠 time.sleep(1) fiter.moveAndClick(60+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(200+random.randint(-15,15), 328) fiter.isAuto() # 点击第十个任务 npc渔村村长 time.sleep(1) fiter.moveAndClick(100+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(200+random.randint(-15,15), 328) fiter.isAuto() # 礼包中心 time.sleep(1) fiter.moveAndClick(229, 368) time.sleep(1) fiter.moveAndClick(229, 368) # 点击第十一个任务 npc服装店老板 time.sleep(1) fiter.moveAndClick(70+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(170+random.randint(0,5), 328) fiter.isAuto() # 点击第十二个任务 npc仙子姐姐 time.sleep(1) fiter.moveAndClick(142+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(185+random.randint(-15,15), 328) fiter.isAuto() time.sleep(1) # 点击第十三个任务 npc王大妈 fiter.moveAndClick(161+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(200+random.randint(-20,20), 328) fiter.isAuto() # 服用摄妖香 fiter.moveAndClick(330, 400) # 点击第十四个任务 npc隐藏的妖怪 time.sleep(1) fiter.moveAndClick(136+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(185+random.randint(-20,20), 328) fiter.isAuto() # 穿装备 time.sleep(1) autopy.key.toggle('e', True, autopy.key.MOD_ALT) autopy.key.toggle('e', False, autopy.key.MOD_ALT) fiter.moveAndClick_fast2(258, 410) fiter.moveAndClick_fast2(308, 410) fiter.moveAndClick_fast2(50, 460) fiter.moveAndClick_fast2(100, 460) fiter.moveAndClick_fast2(150, 460) time.sleep(1) autopy.key.toggle('e', True, autopy.key.MOD_ALT) autopy.key.toggle('e', False, autopy.key.MOD_ALT) # 点击第十六个任务 npc妖怪 time.sleep(1) fiter.moveAndClick(130+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(185+random.randint(-15,15), 328) fiter.isFight() fiter.isAuto() # 点击第十六个任务 npc王二愣 time.sleep(1) fiter.moveAndClick(40+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(185+random.randint(-20,20), 328) fiter.isAuto() # 点击第十七个任务 npc 小小 time.sleep(1) fiter.moveAndClick(50+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(170+random.randint(0,5), 328) fiter.isAuto() fiter.moveAndClick(105+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(195+random.randint(-15,15), 328) fiter.isAuto() # 点击第十八个任务 npc鬼婆婆 time.sleep(1) fiter.moveAndClick(135+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(185+random.randint(-15,15), 344) fiter.isAuto() fiter.moveAndClick(100+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(185+random.randint(-20,20), 328) fiter.isAuto() fiter.moveAndClick(65+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(190+random.randint(-20,20), 344) fiter.isAuto() fiter.moveAndClick(125+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(185+random.randint(-15,15), 328) fiter.isAuto() fiter.moveAndClick(50+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(222+random.randint(-25,25), 344) fiter.isAuto() # 点击第十九个任务 npc道士 time.sleep(1) fiter.moveAndClick(50+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(190+random.randint(-20,20), 328) fiter.isAuto() fiter.moveAndClick(55+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(240+random.randint(-10,20), 344) fiter.isAuto() fiter.moveAndClick(60+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(190+random.randint(-15,15), 328) fiter.isFight() fiter.moveAndClick(190+random.randint(0,50), 328) # 点击第二十个任务 npc仙子姐姐 time.sleep(1) fiter.moveAndClick(60+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(190+random.randint(-20,20), 328) fiter.isAuto() fiter.moveAndClick(80+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(195+random.randint(-20,20), 328) fiter.isAuto() fiter.moveAndClick(100+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(230+random.randint(-20,20), 328) fiter.isAuto() fiter.moveAndClick(95+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(215+random.randint(-20,20), 344) fiter.isAuto() fiter.moveAndClick(115+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(200+random.randint(-15,15), 344) fiter.isAuto() fiter.moveAndClick(55+random.randint(-10,10), 240) fiter.isWalking() autopy.key.toggle('5', True, autopy.key.MOD_ALT) autopy.key.toggle('5', False, autopy.key.MOD_ALT) time.sleep(2) fiter.moveAndClick(200+random.randint(0,50), 328) fiter.moveAndClick(65+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(200+random.randint(-15,15), 328) fiter.isAuto() fiter.moveAndClick(80+random.randint(-10,20), 240) fiter.isWalking() fiter.moveAndClick(222+random.randint(-20,20), 328) fiter.isAuto() fiter.moveAndClick(100+random.randint(0,5), 240) fiter.isWalking() fiter.moveAndClick(222+random.randint(-20,20), 328) fiter.isAuto() fiter.moveAndClick(60+random.randint(0,5), 240) fiter.moveAndClick(230+random.randint(-20,20), 328) # 渔夫考验 test_yufu = 0 while True: if((test_yufu%3) == 0): fiter.moveAndClick(175, 328) elif((test_yufu%3) == 1): fiter.moveAndClick(175, 344) else: fiter.moveAndClick(175, 364) catchScreen.catchAllScreen() if (isinstance(getOffset.getOffsetValue("new\\auto"), list)): break test_yufu+=1 fiter.isAuto() # 点击第二十一个任务 npc袁天罡 fiter.moveAndClick(55+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(185+random.randint(-10,10), 328) fiter.moveAndClick(229, 368) time.sleep(1) fiter.moveAndClick(229, 368) fiter.moveAndClick(490, 400) fiter.isAuto() fiter.moveAndClick(55+random.randint(-10,10), 240) fiter.moveAndClick(185+random.randint(-10,10), 328) autopy.key.toggle('j', True, autopy.key.MOD_ALT) autopy.key.toggle('j', False, autopy.key.MOD_ALT) time.sleep(2) fiter.moveAndClick(338, 376) time.sleep(1) fiter.moveAndClick(338+random.randint(0,50), 376) time.sleep(1) fiter.moveAndClick(185+random.randint(-10,10), 344) fiter.moveAndClick(55+random.randint(-10,10), 240) fiter.moveAndClick(185+random.randint(-10,10), 344) time.sleep(1) autopy.key.toggle('f', True, autopy.key.MOD_ALT) autopy.key.toggle('f', False, autopy.key.MOD_ALT) fiter.moveAndClick(734+random.randint(-10,10), 196) fiter.moveAndClick(579+random.randint(-10,10), 513) # 郭三才 time.sleep(1) fiter.moveAndClick(55+random.randint(-10,10), 240) fiter.isWalking() fiter.moveAndClick(253+random.randint(-10,10), 343) fiter.moveAndClick(77+random.randint(-10,10), 240) fiter.moveAndClick(205+random.randint(-10,10), 358)
def shituTaskStart(): autopy.mouse.move(100, 20) # 平滑移动鼠标(上面那个是瞬间的) autopy.mouse.click() # 单击 # # 地图寻路 东海渔村 # time.sleep(1) # autopy.key.toggle('2', True, autopy.key.MOD_ALT) # autopy.key.toggle('2', False, autopy.key.MOD_ALT) # time.sleep(1) # fiter.moveAndClick_fast(658, 426) # fiter.moveAndClick_fast(290, 430) # fiter.isWalking() # autopy.key.toggle('2', True, autopy.key.MOD_ALT) # autopy.key.toggle('2', False, autopy.key.MOD_ALT) # autopy.key.toggle('1', True, autopy.key.MOD_ALT) # autopy.key.toggle('1', False, autopy.key.MOD_ALT) # autopy.key.toggle('5', True, autopy.key.MOD_ALT) # autopy.key.toggle('5', False, autopy.key.MOD_ALT) # # 计算师徒中介人位置 # getScreen.window_capture("D:\\zhaoyq\\screen\\allScreen.png") # dealScreen.dealShituPicture() # attr = getOffset.getOffsetValue_Shitu() # autopy.mouse.move(attr[0] + 200, attr[1] - 50 + 200) # autopy.mouse.click() # 单击 # fiter.moveAndClick_fast(277, 434) # fiter.moveAndClick_fast(405, 255) # fiter.isWalking() # fiter.isFight() # time.sleep(1) # fiter.moveAndClick_fast(200, 333) # fiter.moveAndClick_fast(445, 237) # fiter.isWalking() # fiter.moveAndClick_fast(200, 328) # fiter.moveAndClick_fast(200, 328) # fiter.moveAndClick_fast(200, 328) # autopy.key.toggle('1', True, autopy.key.MOD_ALT) # autopy.key.toggle('1', False, autopy.key.MOD_ALT) # time.sleep(1) # 循环任务 for i in range(1, 10): time.sleep(0.5) autopy.key.toggle('5', True, autopy.key.MOD_ALT) autopy.key.toggle('5', False, autopy.key.MOD_ALT) time.sleep(0.5) fiter.moveAndClick_fast(400, 315) fiter.moveAndClick_fast(400, 315) time.sleep(1) fiter.moveAndClick_fast(260, 345) time.sleep(1) autopy.key.toggle('q', True, autopy.key.MOD_ALT) autopy.key.toggle('q', False, autopy.key.MOD_ALT) time.sleep(1) # 点击任务名称 catchScreen.catchAllScreen() time.sleep(1) attr = getOffset.getOffsetValue("shitu\\shitu_1") fiter.moveAndClick_fast(attr[0], attr[1] + 20) time.sleep(1) fiter.moveAndClick_fast(410, 255) fiter.isWalking() fiter.isFight() time.sleep(1) fiter.moveAndClick_fast(attr[0], attr[1] + 20) time.sleep(1) fiter.moveAndClick_fast(445, 237) fiter.isWalking() fiter.moveAndClick_fast(200, 328) time.sleep(1) autopy.key.toggle('1', True, autopy.key.MOD_ALT) autopy.key.toggle('1', False, autopy.key.MOD_ALT) time.sleep(0.5) # 判断是否关闭大话精灵 catchScreen.catchAllScreen() time.sleep(1) if (isinstance(getOffset.getOffsetValue_Dahuajingling(), list)): time.sleep(0.5) fiter.moveAndClick_fast2(400, 172) # 判断是否打分 scoreShitu.score() autopy.key.toggle('q', True, autopy.key.MOD_ALT) autopy.key.toggle('q', False, autopy.key.MOD_ALT) time.sleep(0.5) fiter.moveAndClick_fast(200, 328) time.sleep(0.5) fiter.moveAndClick_fast(200, 328)