Skip to content

Commit

Permalink
Fix(zhuogui):Fix zhuogui
Browse files Browse the repository at this point in the history
  • Loading branch information
linrong committed Mar 7, 2019
1 parent 76f0829 commit 71effb6
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 23 deletions.
2 changes: 1 addition & 1 deletion image.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def match_sub_image(self, startx,starty,cv_img ,imgfile):
#使用matchTemplate对原始灰度图像和图像模板进行匹配
res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED)
#设定阈值
threshold = 0.7
threshold = 0.6
#res大于70%
loc = np.where( res >= threshold)
locs = zip(*loc[::-1])# 列表
Expand Down
Binary file added image/zhuogui/buman5ren.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified image/zhuogui/duiwu1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/zhuogui/jxzhuogui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/zhuogui/richanghuidong.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/zhuogui/zhuoguiwancheng.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image/zhuogui/zidongpipei.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 109 additions & 22 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
isZhuaGui = True
matcher=1


#校验密码
def CheckPwd():
return True
Expand All @@ -32,15 +33,14 @@ def CheckPwd():
# 自动任务
def oneKeyDo(param):
global frame
if frame.oneKeyAutoDo.LabelText =='一键自动任务':
if frame.oneKeyAutoDo.LabelText =='一键师门任务':
frame.oneKeyAutoDo.LabelText='停止一键自动任务'
# 检查口令
if(CheckPwd() != True):
return False
win32api.MessageBox(0,u'待开发')
return True
# if(CheckPwd() != True):
# return False

else:
frame.oneKeyAutoDo.LabelText='一键自动任务'
win32api.MessageBox(0,u'操作不允许')


#宝图线程
Expand All @@ -63,11 +63,15 @@ def baotu():
rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/activity.png')
do(rect,'打开活动页面')
time.sleep(1)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/richanghuidong.png')
do(rect,'选择日常活动')
time.sleep(2)
# 点击宝图
rect1=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/activity_baotu.png')
rect1[0]=rect1[0]+315
rect1[0]=rect1[0]+280
do(rect1,'点击宝图')
time.sleep(5)
time.sleep(10)
#接受宝图
rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/activity_baotu_start.png')
do(rect,'接受宝图')
Expand Down Expand Up @@ -165,15 +169,15 @@ def zhuagui():

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/chungjiangduiwu.png')
do(rect,'创建队伍')
time.sleep(1)
time.sleep(2)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/duiwuxuanze.png')
do(rect,'队伍选择')
time.sleep(1)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuoguirenwu.png')
do(rect,'选择捉鬼任务')
time.sleep(1)
time.sleep(5)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuoguiqueding.png')
do(rect,'确定捉鬼任务')
Expand All @@ -197,10 +201,28 @@ def zhuagui():
do(rect,'打开活动页面')
time.sleep(1)

rect1=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/richanghuidong.png')
do(rect1,'选择日常活动')
time.sleep(1)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuogui.png')
rect[0]=rect[0]+315
do(rect,'点击捉鬼活动')
time.sleep(5)
if rect:
rect[0]=rect[0]+280
do(rect,'点击捉鬼活动')
time.sleep(5)
else:
autopy.mouse.smooth_move(rect1[0]+200,rect1[1])
time.sleep(1)
while True:
win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL,0,0,-200)
rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuogui.png')
if rect:
break

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuogui.png')
rect[0]=rect[0]+280
do(rect,'点击捉鬼活动')
time.sleep(5)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/lingquzhuogui.png')
do(rect,'领取捉鬼任务')
Expand All @@ -212,20 +234,85 @@ def zhuagui():
do(rect,'点击捉鬼任务2')
time.sleep(1)

count=0
while(True):
rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhandou.png')
if rect:
count=0
time.sleep(10)
AddToList('正在捉鬼战斗')
else:
count+=1
time.sleep(10)
# 两分钟没有则完成宝图
if count>6:
do(rect,'完成一次捉鬼任务')
count=0
break
rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuoguiwancheng.png')
if rect:
rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/jxzhuogui.png')
do(rect,'继续捉鬼')
time.sleep(3)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/lingquzhuogui.png')
do(rect,'领取捉鬼任务')
time.sleep(2)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/buman5ren.png')
if rect:
do(rect,'队伍不满五人')
time.sleep(2)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/jxzhuogui.png')
do(rect,'确定不满5人')
time.sleep(3)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zidongpipei.png')
do(rect,'点击自动匹配')
time.sleep(1)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/guangbi.png')
do(rect,'关闭任务界面')
time.sleep(1)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/activity.png')
do(rect,'打开活动页面')
time.sleep(1)

rect1=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/richanghuidong.png')
do(rect1,'选择日常活动')
time.sleep(1)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuogui.png')
if rect:
rect[0]=rect[0]+280
do(rect,'点击捉鬼活动')
time.sleep(5)
else:
autopy.mouse.smooth_move(rect1[0]+200,rect1[1])
time.sleep(1)
while True:
win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL,0,0,-200)
rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuogui.png')
if rect:
break

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuogui.png')
rect[0]=rect[0]+280
do(rect,'点击捉鬼活动')
time.sleep(5)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/lingquzhuogui.png')
do(rect,'领取捉鬼任务')
time.sleep(2)

rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuoguirenwu1.png')
do(rect,'点击捉鬼任务1')
time.sleep(1)
do(rect,'点击捉鬼任务2')
time.sleep(1)
else:
rect=matcher.match_sub_image(startx,starty,window_capture_all(),'./image/zhuogui/zhuoguirenwu1.png')
do(rect,'点击捉鬼任务1')
time.sleep(1)
do(rect,'点击捉鬼任务2')
time.sleep(1)
else:
pass



class Frame(wx.Frame):
Expand All @@ -241,7 +328,7 @@ def __init__(self, parent=None, id=wx.ID_ANY,title=u"梦幻手游辅助v"+ver,po
self.tripText2 = wx.StaticText(panel,wx.ID_ANY,label=u'--------------------------------------操作--------------------------------------------',pos=(0, 35))
self.tripText2.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL))

self.oneKeyAutoDo = wx.Button(panel,wx.ID_ANY,label=u"一键自动任务",pos=(10,55),size=(110,35))
self.oneKeyAutoDo = wx.Button(panel,wx.ID_ANY,label=u"一键师门任务",pos=(10,55),size=(110,35))
self.autoZhuaGui = wx.Button(panel,wx.ID_ANY,label=u"自动带队抓鬼",pos=(140,55),size=(110,35))
self.autoDaTu = wx.Button(panel,wx.ID_ANY,label=u"自动宝图",pos=(10,100),size=(110,35))
# 控件事件
Expand Down
Binary file modified test1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 71effb6

Please sign in to comment.