def map2MoveNext(): global img_gray img_gray = picture.get_image_gray() dnf_function.charct_to_pic(img_gray, chart_img, './img/common_p1.jpg') img_gray = picture.get_image_gray() dnf_function.charct_to_pic(img_gray, chart_img, './img/map2_d_2.jpg', 50, 200)
def map4MoveNext(): global img_gray img_gray = picture.get_image_gray() dnf_function.charct_to_pic(img_gray, chart_img, './img/common_p1.jpg', 100, 100) img_gray = picture.get_image_gray() dnf_function.charct_to_pic(img_gray, chart_img, './img/map4_d_1.jpg', 100, 100)
def map1MoveNext(): global img_gray img_gray = picture.get_image_gray() # ../temp_screen/pointA.jpg dnf_function.charct_to_pic(img_gray, chart_img, './img/common_p1.jpg', 0, 0, valueb=0.9) img_gray = picture.get_image_gray() dnf_function.charct_to_pic(img_gray, chart_img, './img/map1_d_2.jpg', -100, 100)
def chart_is_hidden(): global img_gray global hidden_count # 确保可以发现人物 lv = picture.match_multiple(img_gray, '../map1/img/pointA.jpg', 0.6) if lv == False: if hidden_count < 3: dm.keyDownChar('left') time.sleep(300 / 1000) dm.keyUpChar('left') elif hidden_count < 6: dm.keyDownChar('right') time.sleep(300 / 1000) dm.keyUpChar('right') elif hidden_count < 9: dm.keyDownChar('up') time.sleep(300 / 1000) dm.keyUpChar('up') elif hidden_count < 12: dm.keyDownChar('down') time.sleep(300 / 1000) dm.keyUpChar('down') img_gray = picture.get_image_gray() hidden_count += 1 chart_is_hidden() else: hidden_count = 0
def map6MoveNext(): global img_gray img_gray = picture.get_image_gray() dnf_function.charct_to_pic(img_gray, chart_img, './img/map6_d_1.jpg', 100, 100) # map1MoveNext()
def map5MoveNext(): global img_gray img_gray = picture.get_image_gray() dnf_function.charct_to_pic(img_gray, chart_img, './img/common_p1.jpg', 0, -300, valueb=0.8) img_gray = picture.get_image_gray() dnf_function.charct_to_pic(img_gray, chart_img, './img/map5_d_2.jpg', 0, -300, valueb=0.8) img_gray = picture.get_image_gray() dnf_function.charct_to_pic(img_gray, chart_img, './img/map5_d_3.jpg')
def pick(): print('拾取物品') # 确保可以寻找人物 chart_is_hidden() global img_gray global isClear isClear = True img_gray = picture.get_image_gray(region=(0, 0, 800 * 2.5, 500 * 2.5)) # 捡魔法装备 # 魔法装备 # pickF('../map1/img/pick1.jpg',True) # 金币 pickF('../map1/img/pick2.jpg', False) # 银质硬币 pickF('../map1/img/pick3.jpg', False) # 团队的感恩 pickF('../map1/img/pick4.jpg', False) # # 金刚石 # pickF('../map1/img/pick5.jpg',True) # # 紫玛瑙 # pickF('../map1/img/pick6.jpg',True) # 赫仑的印章 pickF('../map1/img/pick7.jpg', True) # 魔刹石 pickF('../map1/img/pick8.jpg', True) # 钻石 pickF('../map1/img/pick9.jpg', True) # 拼图碎片 pickF('../map1/img/pick10.jpg', False) # # 生锈的铁片 # pickF('../map1/img/pick11.jpg',True) # # 硬化剂 # pickF('../map1/img/pick12.jpg',True) # 达人mp # pickF('../map1/img/pick13.jpg',True) # 派对邀请函 pickF('../map1/img/pick14.jpg', True) # 结晶 pickF('../map1/img/pick15.jpg', True) # 绿色的勋章 # pickF('../map1/img/pick16.jpg',True) # 紫色格子 # pickF('../map1/img/pick18.jpg',True,valueb=0.7,offsetX=0) pickF('../map1/img/pick19.jpg', True, valueb=0.8, offsetX=0) if isClear == False: pick() else: # dm.keyDownChar('down') # dm.keyDownChar('right') # time.sleep(1500/1000) # dm.keyUpChar('down') # dm.keyUpChar('right') return True
def pickF(target, keyPress=False, offsetX=50, valueb=0.8): global img_gray global isClear pick1 = charct_to_pic(img_gray, '../map1/img/pointA.jpg', target, offsetX, offsetY=200, valuea=0.6, valueb=valueb) if pick1 != False: isClear = False if keyPress == True: dm.keyPressChar('x') time.sleep(300 / 1000) img_gray = picture.get_image_gray(region=(0, 0, 800 * 2.5, 500 * 2.5))
def updateImgGray(): global img_gray img_gray=picture.get_image_gray()
sys.path.append('../../module/') import cv2 import numpy as np import pyautogui import picture import reg import mouse import time import win32com.client dm = win32com.client.Dispatch('dm.dmsoft') dm.Reg(reg.getRegCode(),"") import moveNext import dnf_function img_gray=picture.get_image_gray() # 搜索图1(城镇状态) # 进入地下城选择页面 # 获取当前位置 # 获取入口位置(地图直接进入) # 移动至入口 def firstEnter(): global img_gray #搜索图2(地下城选择页面) # 搜索要刷的地下城 #鼠标移动到该位置 #点击进入 pick_map=mouse.findImgAndClick(img_gray=img_gray, target='./img/b.jpg', value=0.8,
dm.keyDownChar('up') time.sleep(300 / 1000) dm.keyUpChar('up') elif hidden_count < 12: dm.keyDownChar('down') time.sleep(300 / 1000) dm.keyUpChar('down') img_gray = picture.get_image_gray() hidden_count += 1 chart_is_hidden() else: hidden_count = 0 # 拾取地图物品 img_gray = picture.get_image_gray(region=(0, 0, 800 * 2.5, 500 * 2.5)) isClear = True def pick(): print('拾取物品') # 确保可以寻找人物 chart_is_hidden() global img_gray global isClear isClear = True img_gray = picture.get_image_gray(region=(0, 0, 800 * 2.5, 500 * 2.5)) # 捡魔法装备 # 魔法装备