def bangpai_task(): # catchScreen.catchScreen2(805, 205, 915, 240, "fight") while(True): time.sleep(2) fiter.moveAndClick(906 + random.randint(0, 5), 240 + random.randint(0, 5)) time.sleep(2) catchScreen.catchScreen(40, 65, 1100, 800, "test") time.sleep(1) #attr1 = getOffset.getOffsetValue_my("bangpai2") attr2 = getOffset.getOffsetValue_my("bangpai2") for num in range(0,10): time.sleep(1) if(False): print("挑战帮主") break elif(isinstance(attr2,list)): print("交付药材") time.sleep(1) fiter.moveAndClick(attr2[0] + 20 + random.randint(0, 5), attr2[1] + 60 + random.randint(0, 5)) break elif (isinstance(getOffset.getOffsetValue_my("bangpai3"), list)): print("药店购买") time.sleep(1) fiter.moveAndClick(802 + random.randint(0, 5), 625 + random.randint(0, 5)) break elif (isinstance(getOffset.getOffsetValue_my("bangpai4"), list)): print("宣读公告") time.sleep(1) fiter.moveAndClick(854 + random.randint(0, 5), 683 + random.randint(0, 5)) break
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 xuncha(): # 判断是否是巡视的鬼 while True: print("是否巡视鬼") time.sleep(1) catchScreen.catchScreen(10, 220, 190, 260, "smallGhost\\1") time.sleep(1) if (getInfoFromScreen.getInfomation("smallGhost\\1").find("捉") == -1): print("巡查") time.sleep(1) catchScreen.catchScreen(40, 65, 140, 85, "position1") time.sleep(1) dealScreen.dealScreen("position1") time.sleep(1) print(getInfoFromScreen.getInfomation("position1")) if (getInfoFromScreen.getInfomation("position1").find("地府") != -1 or getInfoFromScreen.getInfomation("position1").find("岫") != -1): print("巡查在地府") while True: getScreen.window_capture( "D:\\zhaoyq\\screen\\allScreen.png") dealScreen.dealPicture_NPC("smallGhost") attr44 = getOffset.getOffsetValue_NPC( "smallGhost", "zhongkui") if (isinstance(attr44, list)): fiter.moveAndClick( attr44[0] + random.randint(10, 20) + 200 + 10, attr44[1] + random.randint(0, 10) + 200 - 50) break else: print("巡查在长安") while True: getScreen.window_capture( "D:\\zhaoyq\\screen\\allScreen.png") dealScreen.dealPicture_NPC("smallGhost") attr45 = getOffset.getOffsetValue_NPC( "smallGhost", "zhongkui2") if (isinstance(attr45, list)): fiter.moveAndClick( attr45[0] + random.randint(10, 20) + 200 - 20, attr45[1] + random.randint(0, 10) + 200 - 50) break while True: catchScreen.catchAllScreen() attr_start = getOffset.getOffsetValue_smallGhostStart() if (isinstance(attr_start, list)): fiter.moveAndClick(attr_start[0] + random.randint(-20, 20), attr_start[1]) fiter.moveAndClick(222 + random.randint(0, 5), 333 + random.randint(0, 10)) break time.sleep(1) else: print("普通捉拿") break
def isFighting(): time.sleep(1) x1 = "" while True: # 截取左上地图坐标 catchScreen.catchScreen(40, 65, 140, 85, "position1") position = getInfoFromScreen.getInfomation_nodeal("position") position1 = getInfoFromScreen.getInfomation_nodeal("position1") if (position == position1): break
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 isWalking(): time.sleep(2) a = 0 # 判断是否走到NPC面前 while True: # 截取左上地图坐标 time.sleep(2) if (a % 2) == 0: catchScreen.catchScreen(30, 65, 140, 85, "position") else: catchScreen.catchScreen(30, 65, 140, 85, "position0") degree = dealScreen.similarPicture("position", "position0") if (degree == 0): break a += 1 print("走路结束")
def testx(): while(True): time.sleep(5) catchScreen.catchScreen(40, 65, 1100, 585, "test") time.sleep(1) attr_start = getOffset.getOffsetValue_smallGhostStart() time.sleep(1) if(isinstance(attr_start,list)): # 点击确认 print("一轮结束") time.sleep(2) fiter.moveAndClick(605+random.randint(0,5),490+random.randint(0,5)) time.sleep(5) fiter.moveAndClick(852+random.randint(0,5),464+random.randint(0,5)) time.sleep(2) fiter.moveAndClick(906 + random.randint(0, 5), 240 + random.randint(0, 5)) time.sleep(1) fiter.moveAndClick(906 + random.randint(0, 5), 240 + random.randint(0, 5))
def findNPC(classify): time.sleep(1) # 判断是否走到NPC面前 x1 = "" while True: # 截取左上地图坐标 catchScreen.catchScreen(40, 65, 140, 85, "position") position = getInfoFromScreen.getInfomation_nodeal("position") if (x1 == position): break else: x1 = position # 点击 if (classify == "xiaoyao"): fiter.moveAndClick(202, 328) fiter.isFighting() elif (classify == "yuanding"): fiter.moveAndClick(210, 346) elif (classify == "gongshuban"): return True
def smallGhostStart(): autopy.mouse.move(100, 20) # 平滑移动鼠标(上面那个是瞬间的) autopy.mouse.click() # 单击 for i in range(1, 240): time.sleep(0.5) autopy.key.toggle('5', True, autopy.key.MOD_ALT) autopy.key.toggle('5', False, autopy.key.MOD_ALT) fiter.moveAndClick(388 + random.randint(0, 10), 336) catchScreen.catchAllScreen() time.sleep(1) attr = getOffset.getOffsetValue_smallGhostMove() if (attr == "none"): print("不需要移动") getScreen.window_capture("D:\\zhaoyq\\screen\\allScreen.png") dealScreen.dealPicture_NPC("smallGhost") attr2 = getOffset.getOffsetValue_NPC("smallGhost", "zhongkui2") if (attr2 == "none"): global x global y print("在地府") fiter.moveAndClick2(350 + random.randint(0, 10), 350) fiter.isWalking() autopy.key.toggle('5', True, autopy.key.MOD_ALT) autopy.key.toggle('5', False, autopy.key.MOD_ALT) time.sleep(0.5) fiter.moveAndClick(388 + random.randint(0, 10), 336) time.sleep(0.5) getScreen.window_capture("D:\\zhaoyq\\screen\\allScreen.png") dealScreen.dealPicture_NPC("smallGhost") attr3 = getOffset.getOffsetValue_NPC("smallGhost", "zhongkui") while True: if (attr3 == "none"): getScreen.window_capture( "D:\\zhaoyq\\screen\\allScreen.png") dealScreen.dealPicture_NPC("smallGhost") attr33 = getOffset.getOffsetValue_NPC( "smallGhost", "zhongkui") if (isinstance(attr33, list)): x = attr33[0] + random.randint(0, 5) + 200 - 20 y = attr33[1] + random.randint(-10, 10) + 200 - 50 fiter.moveAndClick(x, y) break else: x = attr3[0] + random.randint(0, 5) + 200 y = attr3[1] + random.randint(-10, 10) + 200 - 50 + 10 break fiter.moveAndClick(x, y) while True: print("是否点击钟馗成功") time.sleep(0.5) catchScreen.catchAllScreen() attr_start = getOffset.getOffsetValue_smallGhostStart() if (attr_start == "none"): getScreen.window_capture( "D:\\zhaoyq\\screen\\allScreen.png") time.sleep(0.5) dealScreen.dealPicture_NPC("smallGhost") time.sleep(0.5) attr335 = getOffset.getOffsetValue_NPC( "smallGhost", "zhongkui") x1 = attr335[0] + random.randint(0, 5) + 200 - 20 y1 = attr335[1] + random.randint(-10, 10) + 200 - 50 fiter.moveAndClick(x1, y1) time.sleep(1) else: break time.sleep(0.5) else: print("不在地府") x = attr2[0] + random.randint(0, 5) + 200 y = attr2[1] + random.randint(-10, 10) + 200 - 50 + 10 fiter.moveAndClick( attr2[0] + random.randint(0, 5) + 200, attr2[1] + random.randint(-10, 10) + 200 - 50 + 10) time.sleep(1) else: print("需要移动") if (attr[0] > 500): autopy.mouse.move(350 + random.randint(-10, 10), 370) else: autopy.mouse.move(attr[0] + random.randint(-10, 10), attr[1]) autopy.mouse.click(autopy.mouse.RIGHT_BUTTON) fiter.isWalking() time.sleep(0.5) autopy.key.toggle('5', True, autopy.key.MOD_ALT) autopy.key.toggle('5', False, autopy.key.MOD_ALT) fiter.moveAndClick(388 + random.randint(0, 10), 336) time.sleep(0.5) fiter.moveAndClick(460 + random.randint(0, 5), 460 + random.randint(-10, 10)) time.sleep(0.5) while True: print("是否点击开始任务") catchScreen.catchAllScreen() time.sleep(1) attr_start = getOffset.getOffsetValue_smallGhostStart() if (isinstance(attr_start, list)): fiter.moveAndClick(attr_start[0] + random.randint(-20, 20), attr_start[1]) break else: catchScreen.catchScreen(40, 65, 140, 85, "position1") time.sleep(1) dealScreen.dealScreen("position1") time.sleep(1) if (getInfoFromScreen.getInfomation("position1").find("地府") != -1 or getInfoFromScreen.getInfomation("position1").find("岫") != -1): print("在地府") getScreen.window_capture( "D:\\zhaoyq\\screen\\allScreen.png") dealScreen.dealPicture_NPC("smallGhost") time.sleep(1) attr333 = getOffset.getOffsetValue_NPC( "smallGhost", "zhongkui") if (isinstance(attr333, list)): x = attr333[0] + random.randint(0, 5) + 200 y = attr333[1] + random.randint(-10, 10) + 200 - 50 fiter.moveAndClick(x, y) else: print("在长安") getScreen.window_capture( "D:\\zhaoyq\\screen\\allScreen.png") dealScreen.dealPicture_NPC("smallGhost") time.sleep(1) attr444 = getOffset.getOffsetValue_NPC( "smallGhost", "zhongkui2") if (isinstance(attr444, list)): x = attr444[0] + random.randint(0, 5) + 200 - 20 y = attr444[1] + random.randint(-10, 10) + 200 - 50 fiter.moveAndClick(x, y) time.sleep(1) time.sleep(1) fiter.moveAndClick(222 + random.randint(0, 5), 333 + random.randint(0, 10)) time.sleep(1) xuncha() fiter.moveAndClick_fast2(222, 222) time.sleep(1) fiter.moveAndClick(39 + random.randint(0, 10), 254) fiter.isWalking() fiter.moveAndClick(205 + random.randint(-10, 10), 357) fiter.isFight(i) # 判断是否关闭大话精灵 catchScreen.catchAllScreen() time.sleep(1) if (isinstance(getOffset.getOffsetValue_Dahuajingling(), list)): time.sleep(0.5) fiter.moveAndClick_fast2(400, 172) # 关闭物品栏 catchScreen.catchAllScreen() time.sleep(1) if (isinstance(getOffset.getOffsetValue_Wupinlan(), list)): time.sleep(0.5) fiter.moveAndClick_fast2(190 + random.randint(-10, 10), 121) # 领取礼盒 catchScreen.catchAllScreen() time.sleep(1) if (isinstance(getOffset.getOffsetValue_Box(), list)): print("领取礼盒") time.sleep(0.5) attr5 = getOffset.getOffsetValue_Box() if (attr5[0] > 900): time.sleep(1) else: fiter.moveAndClick(attr5[0] + random.randint(-10, 10) + 50, attr5[1] + 50 + random.randint(0, 5)) time.sleep(40) # 返回 time.sleep(1) print("点击回程") catchScreen.catchAllScreen() time.sleep(1) if (isinstance(getOffset.taskRight(), list)): time.sleep(0.5) attr6 = getOffset.taskRight() fiter.moveAndClick(attr6[0] + random.randint(0, 10) + 30, attr6[1] - 60 + random.randint(0, 10)) else: fiter.moveAndClick(800 + random.randint(0, 10), 530 + random.randint(0, 10)) time.sleep(1) i += 1
# attr = getOffset.getOffsetValue("shitu\\shitu_1") # autopy.mouse.smooth_move(attr[0],attr[1]+20) # attr = getOffset.getOffsetValue_Wupinlan() # print(attr) # attr2 = getOffset.getOffsetValue("home\\xiaoyao_2") time.sleep(1) # catchScreen.catchScreenTest(10, 60, 100, 100) # dealScreen.dealScreen("allScreen") # dealScreen.dealScreen("home\\xiaoyao_user") # attr = getOffset.getOffsetValue("zidong") # print(attr) # fiter.moveAndClick(attr[0]-20,attr[1]-10) catchScreen.catchScreen(40, 65, 140, 85, "position1") dealScreen.dealScreen("position1") autopy.mouse.move(222, 333) # autopy.mouse.click() # 单击u # # autopy.mouse.move(100, 20) # 平滑移动鼠标(上面那个是瞬间的) # autopy.mouse.click() # 单击 # 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)