├── README.md ├── adb ├── AdbWinApi.dll ├── AdbWinUsbApi.dll └── adb.exe ├── bin ├── RunApi.py ├── StartFish.py ├── StartRPG.py └── __pycache__ │ ├── RunApi.cpython-37.pyc │ ├── StageFight.cpython-37.pyc │ ├── StartFish.cpython-37.pyc │ └── StartRPG.cpython-37.pyc ├── cache └── screen.png ├── common ├── AutoAdb.py ├── AutoAdbCheck.py ├── ConfigUtils.py ├── Location.py ├── PathUtils.py ├── Singleton.py ├── Timer.py └── __pycache__ │ ├── AutoAdb.cpython-310.pyc │ ├── AutoAdb.cpython-37.pyc │ ├── AutoAdbCheck.cpython-37.pyc │ ├── ConfigUtils.cpython-37.pyc │ ├── Location.cpython-37.pyc │ ├── PathUtils.cpython-37.pyc │ ├── Singleton.cpython-37.pyc │ └── Timer.cpython-37.pyc ├── config.ini ├── config_temp.ini ├── image └── README │ ├── 1662115841696.png │ ├── 1662115952026.png │ ├── 1662116129572.png │ ├── 1662116247761.png │ └── 1662116269586.png ├── main.py ├── requirements.txt ├── screen.png ├── self_test.ipynb ├── temp.PNG └── temp_images ├── baits ├── 1.PNG ├── 10.PNG ├── 11.PNG ├── 12.PNG ├── 13.PNG ├── 14.PNG ├── 15.PNG ├── 16.PNG ├── 17.png ├── 18.png ├── 19.PNG ├── 2.PNG ├── 20.PNG ├── 3.PNG ├── 4.PNG ├── 5.PNG ├── 6.PNG ├── 7.PNG ├── 8.PNG └── 9.PNG ├── battle ├── fast_fight.PNG └── no_singal.PNG ├── daily ├── fight_1.PNG ├── fight_jb.PNG ├── fight_ly.PNG ├── fight_ro.PNG ├── fitght_hn.PNG ├── home.PNG ├── main_fight.PNG ├── start_fight.PNG └── town.PNG ├── error ├── store.PNG ├── store2.PNG └── story.PNG ├── fish.png ├── move ├── black.PNG └── white.PNG ├── new_fish └── get_new2.PNG ├── old_test ├── haha-green.jpg ├── haha-red.jpg ├── haha.jpg └── ins.jpg ├── re_get_monster ├── 1-bag.PNG ├── 2-tent.PNG ├── 3-use.PNG ├── 4-break_all.PNG └── 5-break.PNG ├── screen_fish.jpg ├── screen_fish_2.jpg ├── start2.PNG └── state ├── state0.PNG ├── state1.PNG ├── state10.PNG ├── state11.PNG ├── state12.PNG ├── state13.PNG ├── state14.PNG ├── state15.PNG ├── state2.PNG ├── state3.PNG ├── state4.PNG ├── state5.PNG ├── state6.PNG ├── state7.PNG ├── state8.PNG └── state9.PNG /README.md: -------------------------------------------------------------------------------- 1 | # Alice's LHCX Auto Fishing Scripts 2 | 3 | **特别注意**:本项目停止更新,但日常维护会继续,新的,更强力的项目位置,点[这里](https://github.com/sixone-Jiang/LHCXAutoFishingPro) 4 | 5 | 灵魂潮汐自动钓鱼脚本, 制作不易, 各位大佬下载前请先点个Star 6 | 7 | 出于需要实时监测的目的,请仔细阅读使用方法!!! 8 | 9 | 计算机小白见**Easy Fast Use**这一节,请务必详细阅读 10 | 11 | **本脚本仅供学习交流使用! 不会在任何途径任何场合收取费用! 请勿用于非法用途! ** 12 | 13 | **本脚本遵守GPL-3.0协议, 请勿从其他任何非官方(Github)途径下载该脚本! ( `д′)** 14 | 15 | 需要注意: 16 | 17 | + 电脑需要安装python运行环境. 18 | + 需要配合安卓模拟器(推荐)使用. 19 | + 这里仅讨论windows平台的使用. 20 | + 默认读者已经有一定的动手能力. 21 | 22 | 功能特点: 23 | 24 | + [ √ ] 连续钓鱼 25 | + [ √ ] 自动选鱼饵(需要在代码中指定,详见main.py) 26 | + [ √ ] 快速处理紫鱼,金鱼(请使用迟缓鱼竿或幸运鱼竿,别的鱼竿也能钓但不保证能上) 27 | + [ √ ] 稳定处理彩鱼 28 | + [ √ ] 自动定位模拟器在主屏幕中位置 29 | + [ √ ] 可以在出n条新鱼后终止代码 30 | + [ × ] 自动处理后宅 31 | + [ √ ] 代码整理 32 | + [ × ] 自动RPG未完全实现 33 | 34 | **更新**: 35 | 36 | * **提醒**,现在需要配置的文件仅有config.ini, 请**仔细**阅读该文件中的一切注释 37 | * 但如果有自选鱼饵的要求,请按照main.py中的注释修改**baits_list** 变量 38 | * 记住终止条件,快速移动鼠标到屏幕左上角 39 | * **测试性功能**: 40 | * 如果您是计算机小白,现今代码有极其简单的方案,请翻到“**Easy Fast Use**”这一节 41 | * 处于一些考虑,作者暂时决定不将该代码封装成为Windows可直接执行的EXE,请使用该代码的小白们具有一定程度的Python知识(能配置Python环境的程度),如果实在不会就向身边的人请假,放心,这不难,也不会花费太多的时间。 42 | * 自动定位模拟器在主屏幕中位置,现在该选项是config.ini中的一个可选项 43 | * 新增在出n条新鱼后终止代码,现在该选项是config.ini中的一个可选项 44 | * 新增 requirements 文档 45 | * 更新了一个已知问题 46 | * 增强了算法效能,但是没有足够量的算法样本 47 | * 修改了代码运行结构,如果当前版本出现异常请使用之前版本 48 | * 新增了miniconda在windows下的安装教程 49 | 50 | ## 使用方法 51 | 52 | 原理是通过ADB对手机屏幕截图, 对比模板图片判断当前游戏情况, 然后通过ADB模拟点击/拖拽等操作. 53 | 54 | 但对于**实时钓鱼**操作,ADB处理延迟至少为0.7s, 这样的延迟会无限空军;因此作者这里引入Pyautogui通过电脑外部点击来实现实时监控 55 | 56 | ### 环境搭建 57 | 58 | #### 安装python 59 | 60 | 前往 [miniconda](https://docs.conda.io/en/latest/miniconda.html) 下载 python 3.7 安装包并安装. 61 | 62 | 安装时注意配置运行环境(path). 63 | 64 | 如何判断python安装成功? 65 | 66 | 打开cmd, 执行`python --version`, 如果正确显示python版本号则说明安装成功 67 | 68 | #### 安装python依赖 69 | 70 | 需要用户手动安装cv2,pyautogui 等. 71 | 72 | pip install opencv-python 73 | pip install pyautogui 74 | 75 | #### 关于ADB和设备 76 | 77 | 本项目已经自带了adb.exe程序. 用户不必再手动下载. 78 | 79 | 许多安卓模拟器也会自带adb程序, 不过其自带的版本往往比较低, 一些功能残缺. 因此程序默认使用自带的adb程序。 80 | 81 | + 需要用户查找当前模拟器的ADB连接端口。然后修改配置文件 `config.ini` 中 `adb_host_port` 配置 82 | + 支持多设备在线时指定某设备连接地址进行操作。但务必配置 `adb_host_port` 83 | 84 | ##### 模拟器使用分享 85 | 86 | 不同的模拟器在ADB的实现细节上不同,游戏的体验上也不同。下表是近期(2020-03)的一些体验。欢迎体验的小伙伴贡献经验。 87 | 88 | | 模拟器 | ADB端口 | 游戏体验 | 备注(CPU等资源占用情况) | 89 | | ------ | ------- | -------- | ---------------------------- | 90 | | 雷电 | 5555 | 3.5 | 占用未注意,掉帧相对严重 | 91 | | 逍遥 | 21503 | 4.5 | 占用相对较低,偶尔会卡死 | 92 | | MUMU | 7555 | 4 | 占用和逍遥接近,声称不会卡死 | 93 | | 夜神 | 62001 | | | 94 | | 蓝叠 | 5555 | | | 95 | | 天天 | 5037 | | | 96 | 97 | > 注:游戏体验是指运行是否流畅,掉帧是否严重等情况。1~5分,分数越高体验相对越好。打分全凭个人感受。 98 | 99 | ## EASY FAST USE 100 | 101 | * 该方法无需做任何配置,前提是你使用了MuMu模拟器(普通版本),并且已经处于钓鱼界面 102 | 103 | 1. 下载本代码,并*解压* 到一个不带中文路径的目录,下面是一个例子,具体路径以你自己配置的为准 104 | 105 | ![1662116269586](https://raw.githubusercontent.com/sixone-Jiang/Picgo/main/img/1662116269586.png) 106 | 107 | 2. 安装miniconda在你的电脑上: 108 | 109 | 前往 [miniconda](https://docs.conda.io/en/latest/miniconda.html) ,选择下面的安装包,这有一篇教学请点击此并仔细阅读([点这里](https://www.quanxiaoha.com/conda/install-miniconde.html)) 110 | 111 | ![image-20220822213925039](https://raw.githubusercontent.com/sixone-Jiang/Picgo/main/img/image-20220822213925039.png) 112 | 113 | 3. 安装好后,您在任意命令行中输入conda init,命令行会输出一些正确反馈 114 | 115 | 4. 使用管理员权限(自行百度)打开命令行(按一次win键,搜索输入“命令提示符”,并点击,以管理员身份运行,并点击”是“) 116 | 117 | ![image-20220902185951544](https://raw.githubusercontent.com/sixone-Jiang/Picgo/main/img/image-20220902185951544.png) 118 | 119 | 5. 切换到本代码的工作目录(百度搜素如何在命令行切换工作目录(也就是你能找main.py文件的路径位置,以之前位置为例应当在命令中输入如下)): 120 | 121 | ![image-20220902190105352](https://raw.githubusercontent.com/sixone-Jiang/Picgo/main/img/image-20220902190105352.png) 122 | 123 | 6. 之后配置环境,输入命令如下(一行一行的输入): 124 | 125 | ```shell 126 | conda create -n lhcx python=3.7 -y 127 | conda activate lhcx 128 | pip install -r requirements.txt 129 | ``` 130 | 131 | 4. 打开灵魂潮汐,并切换到钓鱼界面,执行以下命令: 132 | 133 | ``` 134 | python main.py 135 | ``` 136 | 5. 记住终止条件,快速移动鼠标到屏幕左上角,且模拟器不可以被遮挡 137 | 138 | ## 配置文件 139 | 140 | 第一次下载本项目时,项目根目录有一个 `config_temp.ini` 配置文件。 141 | 142 | 这个文件介绍了该项目可进行的配置项,但项目的运行**不会**使用此配置文件! 143 | 144 | 用户需要将该配置文件拷贝一份并重命名为 `config.ini`,然后自行修改配置。**只有 `config.ini` 文件的配置才会生效。** 145 | 146 | 请仔细阅读配置项说明。 147 | 148 | **(如果您不想深度参与代码构建,则必须设置模拟器分辨率为1280*720,且模拟器初始位置处于默认位置,切勿移动)请自行测量模拟器启动后钓鱼框左上角的位置,确保截取的位置包括鱼的中线在内(如果您不明白,什么是中线,下面有一个截取样例)** 149 | 150 | **样例**: 151 | 152 | 图像很细,仅仅是一个600+ * 3 的图像 153 | 154 | ![haha-green](https://raw.githubusercontent.com/sixone-Jiang/Picgo/main/img/haha-green.jpg) 155 | 156 | **您应当将所测量的参数用于 /bin/StartFish.py类的初始化参数中:** 157 | 158 | 现今代码见修改位置迁移到了config.ini 159 | 160 | 需要填入的参数包括: 161 | 162 | * 自行测量屏幕中钓鱼显示框左边界和上边界位置 163 | 164 | mumu_left = 950(需要自行寻找) 165 | 166 | mumu_top = 605(需要自行寻找) 167 | * 自行找一个屏幕中方便点击的初始点(要位于模拟器内) 168 | 169 | click_x_origin = 1000(需要自行寻找) 170 | 171 | click_y_origin = 1000(需要自行寻找) 172 | 173 | 此外,**如果您有个性化需求,请仔细阅读main.py中的代码注释** 174 | 175 | ## 运行代码 176 | 177 | * 请务必使用带有**管理员权限**的命令行运行代码,在主目录下(工作目录请不要带**中文路径**),运行 178 | 179 | ```shell 180 | conda activate you-env 181 | python main.py 182 | ``` 183 | * 效果展示: 184 | 185 | 见[bilibili](https://www.bilibili.com/video/BV1Qg41167C2/?vd_source=fd58b54cc00f8fdcc9c5eb4422b3eefd),如果失效请搜索个人主页:**ET丨Alice** 186 | * 钓鱼妙法:**建议图鉴哥必看** 187 | 188 | 见[Bwiki](https://wiki.biligame.com/lhcx/%E5%AE%B6%E5%9B%AD%E9%92%93%E9%B1%BC%E6%95%B0%E6%8D%AE%E4%B8%80%E8%A7%88) 189 | * 附上我的钓鱼图鉴 190 | 191 | ![image-20220821131023412](https://raw.githubusercontent.com/sixone-Jiang/Picgo/main/img/image-20220821131023412.png) 192 | 193 | ## 代码逻辑 194 | 195 | * 时间关系,如果您对代码逻辑感兴趣或有更好的看法,整理好您的意见,请发送到这里:[邮箱](skblu_alice@foxmail.com) 196 | 197 | ## 已知问题 198 | 199 | * 当前使用win32ui API (用于屏幕截图)在代码运行10分钟左右概率抛出异常,该异常不属于BUG,使用try捕获后直接抛出执行下一轮可解决,现代码提供了另一种实时方案 200 | * 使用win32gui 定位异常,目前已经解决 201 | * 请保证您的窗口如下所示(不要拖动,拉扯导致窗口大小变化) 202 | 203 | ![image-20220822220250582](https://raw.githubusercontent.com/sixone-Jiang/Picgo/main/img/image-20220822220250582.png) 204 | -------------------------------------------------------------------------------- /adb/AdbWinApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/adb/AdbWinApi.dll -------------------------------------------------------------------------------- /adb/AdbWinUsbApi.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/adb/AdbWinUsbApi.dll -------------------------------------------------------------------------------- /adb/adb.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/adb/adb.exe -------------------------------------------------------------------------------- /bin/RunApi.py: -------------------------------------------------------------------------------- 1 | import imp 2 | from common import PathUtils, ConfigUtils 3 | from common.Location import Location 4 | from bin.StartFish import StartFish 5 | from bin.StartRPG import StartRPG 6 | import time 7 | 8 | 9 | class RunApi: 10 | # 钓鱼 11 | def run_fish(adb, baits_list=[]): 12 | work_dir = PathUtils.get_work_dir() 13 | times = int(ConfigUtils.get('end_times')) 14 | new_fish_stop = int(ConfigUtils.get('new_fish_stop')) 15 | title_name = ConfigUtils.get('title_name') 16 | auto_loc = int(ConfigUtils.get('auto_loc')) 17 | # 自行测量屏幕中钓鱼显示框左边界和上边界位置950-605 18 | mumu_left = ConfigUtils.get('mumu_left') 19 | mumu_top = ConfigUtils.get('mumu_top') 20 | # 自行找一个屏幕中方便点击的初始点(要位于模拟器内) 21 | click_x_origin = ConfigUtils.get('x_origin') 22 | click_y_origin = ConfigUtils.get('y_origin') 23 | 24 | # Auto_loc 25 | if auto_loc == 1: 26 | mumu_loc =StartFish.AuTo_loc(title_name) 27 | mumu_left, mumu_top, click_x_origin, click_y_origin = mumu_loc[0], mumu_loc[1],mumu_loc[2], mumu_loc[3] 28 | print(mumu_loc) 29 | for i in range(times): 30 | print('第{%d}轮钓鱼开始'%i) 31 | adb.click(work_dir + '/temp_images/fish.png') 32 | time.sleep(3) 33 | StartFish.choice_rod_bait(baits_list,work_dir + '/temp_images/baits/', adb=adb) 34 | adb.click(work_dir +'/temp_images/start2.png') 35 | # 等待钓鱼开始 5-10s 36 | time.sleep(5) 37 | now = time.time() 38 | ring_flag = now 39 | 40 | while time.time() - now <60*5: 41 | StartFish.window_capture(filename=work_dir+'/temp_images/screen_fish.jpg',mumu_left=mumu_left,mumu_top=mumu_top) 42 | x, y = StartFish.get_position(image_path=work_dir+'/temp_images/screen_fish.jpg') 43 | ring_flag = StartFish.Stage(x, y, ring_flag, click_x_origin, click_y_origin) 44 | # 判断是否为新鱼 45 | if new_fish_stop > 0: 46 | # 该参数如果异常请自行测定 47 | StartFish.window_capture(filename=work_dir+'/temp_images/screen_fish_2.jpg',mumu_left=mumu_left+500-320,mumu_top=mumu_top+593-204-30, mumu_width=160+40+120, mumu_h=40+60) 48 | if StartFish.is_new_fish(work_dir+'/temp_images/new_fish/', work_dir): 49 | new_fish_stop -= 1 50 | print("已经捕捉到新鱼") 51 | else : 52 | #print("捕捉到的不是新鱼") 53 | pass 54 | if new_fish_stop == 0: 55 | return None 56 | # 若超时计时器超时,则立即进入下一轮钓鱼 57 | if time.time() - ring_flag >9: 58 | break 59 | print('—————————本轮结束————————') 60 | 61 | ending_loc = Location(adb, None, 600, 600) 62 | ending_loc.click() 63 | ending_loc.click() 64 | ending_loc.click() 65 | 66 | # RPG 67 | def run_rpg(adb, RPG_map, rpg_time, times=1000): 68 | work_dir = PathUtils.get_work_dir() 69 | first_fight_flag = True 70 | RPG = StartRPG() 71 | for i in range(times): 72 | time.sleep(0.01) 73 | print('当前是第{%d}轮次'%i) 74 | # 刷怪 75 | RPG.get_new(work_dir, 0.8) 76 | index = 0 77 | open_time = time.time() 78 | if i == 0 and index != -1: 79 | for turn_index in RPG_map: 80 | 81 | print(turn_index) 82 | pre_gray = RPG.get_pre_gray() 83 | pre_gray_1 = RPG.get_pre_gray1() 84 | RPG.save_pre(work_dir+'/temp_images/state/state'+str(index),pre_gray_1) 85 | #time.sleep(1) 86 | RPG.turn_to(turn_index) 87 | if first_fight_flag: 88 | time.sleep(2) 89 | # 检验是否是首次战斗 90 | if first_fight_flag and adb.check(work_dir+'/temp_images/battle/fast_fight.PNG',0.8): 91 | RPG.first_fight(work_dir) 92 | first_fight_flag = False 93 | start = time.time() 94 | 95 | while not RPG.check_is_move(pre_gray): 96 | while time.time() - start > 3: 97 | RPG.turn_to(turn_index) 98 | if RPG.check_is_move(pre_gray): 99 | time.sleep(0.6) 100 | break 101 | time.sleep(0.1) 102 | 103 | #time.sleep(rpg_time[index]) 104 | index += 1 105 | 106 | else: 107 | 108 | while index < 16: 109 | while adb.check(work_dir+'/temp_images/state/state'+str(index)+'.PNG', 0.82): 110 | #if index <= 12: 111 | RPG.turn_to(RPG_map[index], wait=0.1) 112 | #else : 113 | # RPG.turn_to(RPG_map[index], wait=0.8) 114 | index += 1 115 | 116 | 117 | print('本轮共用{%f}'%(time.time()-open_time)) 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /bin/StartFish.py: -------------------------------------------------------------------------------- 1 | import time 2 | import win32gui 3 | import cv2 4 | import pyautogui 5 | import ctypes 6 | from common import ConfigUtils 7 | import os 8 | import time 9 | 10 | # 找mumu窗口 - 该方法在windows7以上电脑会定位不准 11 | def find_window_by_title_outDate(title): 12 | try: 13 | hwnd = win32gui.FindWindow(None, title) 14 | left, top, right, bottom = win32gui.GetWindowRect(hwnd) 15 | return [left, top, right, bottom] 16 | except Exception as ex: 17 | print('Error calling win32gui.FindWindow ' + str(ex)) 18 | return None 19 | 20 | # 获取真实的窗口 POS 21 | def find_window_by_title(title): 22 | hwnd = win32gui.FindWindow(None, title) 23 | try: 24 | f = ctypes.windll.dwmapi.DwmGetWindowAttribute 25 | except WindowsError: 26 | f = None 27 | if f: 28 | rect = ctypes.wintypes.RECT() 29 | f(ctypes.wintypes.HWND(hwnd), ctypes.wintypes.DWORD(9), ctypes.byref(rect), ctypes.sizeof(rect)) 30 | return rect.left, rect.top, rect.right, rect.bottom 31 | 32 | def get_location_with_no_sc(temp_rel_path_list, work_dir, threshold=0.7): 33 | 34 | sp_gray = cv2.imread(work_dir+'/temp_images/screen_fish_2.jpg', cv2.COLOR_BGR2BGRA) 35 | 36 | if temp_rel_path_list: 37 | temp_abs_path = temp_rel_path_list 38 | temp_gray = cv2.imread(temp_abs_path, cv2.COLOR_BGR2BGRA) 39 | 40 | res = cv2.matchTemplate(sp_gray, temp_gray, cv2.TM_CCOEFF_NORMED) 41 | _, max_val, _, max_loc = cv2.minMaxLoc(res) 42 | if max_val < threshold: 43 | return False 44 | 45 | return True 46 | 47 | return False 48 | 49 | class StartFish: 50 | base_rate = 1.0 51 | 52 | def AuTo_loc(title_name): 53 | # 使用自动寻框 54 | if find_window_by_title(title_name): 55 | mumu_loc = find_window_by_title(title_name) 56 | mumu_left = mumu_loc[0] + 310 57 | mumu_top = mumu_loc[1] + 209 58 | click_x_origin = (mumu_loc[2] + mumu_loc[0])/2 59 | click_y_origin = (mumu_loc[3] + mumu_loc[1])/2 60 | else : 61 | while not find_window_by_title(title_name): 62 | mumu_loc = find_window_by_title(title_name) 63 | mumu_left = mumu_loc[0] + 310 64 | mumu_top = mumu_loc[1] + 209 65 | click_x_origin = (mumu_loc[2] + mumu_loc[0])/2 66 | click_y_origin = (mumu_loc[3] + mumu_loc[1])/2 67 | return [mumu_left, mumu_top, click_x_origin, click_y_origin] 68 | 69 | # 选择鱼饵 70 | def choice_rod_bait(baits_list , image_path, adb): 71 | if baits_list: 72 | for bait in baits_list: 73 | if adb.check(image_path+str(2*bait-1)+'.png'): 74 | adb.click(image_path+str(2*bait-1)+'.png') 75 | time.sleep(1) 76 | break 77 | elif adb.check(image_path+str(2*bait)+'.png'): 78 | adb.click(image_path+str(2*bait)+'.png') 79 | time.sleep(1) 80 | break 81 | return True 82 | else : 83 | return False 84 | 85 | # 判断新鱼 86 | def is_new_fish(image_path, work_dir): 87 | fish_list = os.listdir(image_path) 88 | #adb.screen_cap() 89 | if fish_list: 90 | for fish in fish_list: 91 | if get_location_with_no_sc(image_path+fish, work_dir): 92 | return True 93 | return False 94 | else : 95 | return False 96 | 97 | 98 | # 屏幕抓取 99 | def window_capture(filename, mumu_left, mumu_top, mumu_width=650, mumu_h=3): 100 | img = pyautogui.screenshot(region=[mumu_left, mumu_top, mumu_width, mumu_h]) # x,y,w,h 101 | img.save(filename) 102 | # 以下代码存在未处理异常(一般在执行10-40次时出现,但算法效率为0.02秒更快), 暂时替换 103 | ''' 104 | hwnd = 0 # 窗口的编号,0号表示当前活跃窗口 105 | # 根据窗口句柄获取窗口的设备上下文DC(Divice Context) 106 | hwndDC = win32gui.GetWindowDC(hwnd) 107 | # 根据窗口的DC获取mfcDC 108 | mfcDC = win32ui.CreateDCFromHandle(hwndDC) 109 | # mfcDC创建可兼容的DC 110 | saveDC = mfcDC.CreateCompatibleDC() 111 | # 创建bigmap准备保存图片 112 | saveBitMap = win32ui.CreateBitmap() 113 | # 获取监控器信息 114 | #MoniterDev = win32api.EnumDisplayMonitors(None, None) 115 | #w = MoniterDev[0][2][2] 116 | #h = MoniterDev[0][2][3] 117 | # Alice 测量其位置,得知所需取的判别框为650, 3也可按照需求增大或减速,但影响速度 118 | w, h = 650, 3 119 | # print w,h   #图片大小 120 | # 为bitmap开辟空间 121 | saveBitMap.CreateCompatibleBitmap(mfcDC, w, h) 122 | # 高度saveDC,将截图保存到saveBitmap中 123 | saveDC.SelectObject(saveBitMap) 124 | # 截取从左上角(0,0)长宽为(w,h)的图片 125 | # Alice 126 | # (950 605) -> (1600 620) 分辨率 1280x720 127 | # 点击点初始坐标为1000 1000 128 | saveDC.BitBlt((0, 0), (w, h), mfcDC, (mumu_left, mumu_top), win32con.SRCCOPY) 129 | #saveDC.BitBlt((0, 0), (w, h), mfcDC, (0, 0), win32con.SRCCOPY) 130 | saveBitMap.SaveBitmapFile(saveDC, filename) 131 | ''' 132 | 133 | # 区域长160 鱼长30 134 | # 区域:140 - 150 连续 8 个中投6个 135 | # 鱼:> 210 连续 8个中5个 136 | def get_position(image_path, region=160, fish=30): 137 | sp_gray = cv2.imread(image_path,cv2.COLOR_BGR2BGRA) 138 | # Alice 测量其像素长宽,取第一行,该段为理想段,也可根据个人需求增减18:642 139 | conp = sp_gray[1][18:638+4] 140 | red_green_index = -1 141 | white_index = -1 142 | for index in range(0, len(conp), 8): 143 | red_green = 0 144 | white = 0 145 | for k in range(8): 146 | comp = conp[index+k] 147 | if white_index == -1 and comp > 210: 148 | white += 1 149 | if red_green_index == -1 and comp > 139 and comp <150: 150 | red_green += 1 151 | if red_green > 5: 152 | red_green_index = index 153 | if white > 4: 154 | white_index = index 155 | 156 | return red_green_index+region/2+10, white_index+fish/2 157 | def Stage(region, fish, ring_flag, click_x_origin, click_y_origin, duration_rate=base_rate): 158 | #currentMouseX, currentMouseY = pyautogui.position() # 鼠标当前位置 159 | pyautogui.moveTo(click_x_origin, click_y_origin, duration=0.001) 160 | #print(currentMouseX, currentMouseY) 161 | # 长点屏幕 162 | # 可以新增增量算法进行优化 163 | if region < fish: 164 | pyautogui.mouseDown(x=click_x_origin, y=click_y_origin, button='left') 165 | return time.time() 166 | else: 167 | pyautogui.mouseUp(x=click_x_origin, y=click_y_origin, button='left') 168 | #print('向左运动') 169 | return ring_flag 170 | 171 | def Stage_pre(region, fish, ring_flag, click_x_origin, click_y_origin, duration_rate=base_rate): 172 | #currentMouseX, currentMouseY = pyautogui.position() # 鼠标当前位置 173 | pyautogui.moveTo(click_x_origin, click_y_origin, duration=0.001) 174 | #print(currentMouseX, currentMouseY) 175 | # 长点屏幕 176 | # 可以新增增量算法进行优化 177 | if region < fish: 178 | pyautogui.mouseDown(x=click_x_origin, y=click_y_origin, button='left') 179 | return time.time() 180 | else: 181 | pyautogui.mouseUp(x=click_x_origin, y=click_y_origin, button='left') 182 | #print('向左运动') 183 | return ring_flag 184 | ''' 185 | if region < fish -400: 186 | pyautogui.dragTo(100+click_x_origin, click_y_origin, duration=duration_rate*1.4) 187 | print('向右运动') 188 | return time.time() 189 | elif region < fish -300: 190 | 191 | pyautogui.dragTo(100+click_x_origin, click_y_origin, duration=duration_rate*1.05) 192 | print('向右运动') 193 | return time.time() 194 | elif region < fish -200: 195 | pyautogui.dragTo(100+click_x_origin, click_y_origin, duration=duration_rate*0.85) 196 | print('向右运动') 197 | return time.time() 198 | elif region < fish -150: 199 | pyautogui.dragTo(100+click_x_origin, click_y_origin, duration=duration_rate*0.75) 200 | print('向右运动') 201 | return time.time() 202 | elif region < fish: 203 | pyautogui.dragTo(100+click_x_origin, click_y_origin, duration=duration_rate*0.62) 204 | print('向右运动') 205 | return time.time() 206 | else: 207 | print('向左运动') 208 | return ring_flag 209 | ''' 210 | ''' 211 | if region < fish -400: 212 | print('向右运动') 213 | pyautogui.mouseDown(x=click_x_origin, y=click_y_origin, button='left') 214 | time.sleep(duration_rate*1.22) 215 | pyautogui.mouseUp(x=click_x_origin, y=click_y_origin, button='left') 216 | return time.time() 217 | elif region < fish -300: 218 | print('向右运动') 219 | pyautogui.mouseDown(x=click_x_origin, y=click_y_origin, button='left') 220 | time.sleep(duration_rate*1.1) 221 | pyautogui.mouseUp(x=click_x_origin, y=click_y_origin, button='left') 222 | return time.time() 223 | elif region < fish -200: 224 | print('向右运动') 225 | pyautogui.mouseDown(x=click_x_origin, y=click_y_origin, button='left') 226 | time.sleep(duration_rate*0.85) 227 | pyautogui.mouseUp(x=click_x_origin, y=click_y_origin, button='left') 228 | return time.time() 229 | elif region < fish -100: 230 | print('向右运动') 231 | pyautogui.mouseDown(x=click_x_origin, y=click_y_origin, button='left') 232 | time.sleep(duration_rate*0.75) 233 | pyautogui.mouseUp(x=click_x_origin, y=click_y_origin, button='left') 234 | return time.time() 235 | elif region < fish: 236 | print('向右运动') 237 | pyautogui.mouseDown(x=click_x_origin, y=click_y_origin, button='left') 238 | time.sleep(duration_rate*0.62) 239 | pyautogui.mouseUp(x=click_x_origin, y=click_y_origin, button='left') 240 | return time.time() 241 | else: 242 | print('向左运动') 243 | return ring_flag 244 | ''' -------------------------------------------------------------------------------- /bin/StartRPG.py: -------------------------------------------------------------------------------- 1 | import imp 2 | from tabnanny import check 3 | import time 4 | import ctypes 5 | from common.AutoAdb import AutoAdb 6 | import os 7 | from common.Location import Location 8 | import cv2 9 | class StartRPG: 10 | base_rate = 1.0 11 | # 一次自动战斗后等待 12 | # 定位当前位置,使用adb 13 | # 定位4个角位置,使用adb,并计算获取最小判定框 14 | # 左上右下 15 | def __init__(self) -> None: 16 | self.width, self.height = [120, 80] 17 | self.first_left_top = [393, 309] 18 | self.second_left_top = [790, 309] 19 | self.third_left_top = [393, 500] 20 | self.forth_left_top = [790, 500] 21 | self.adb = AutoAdb() 22 | 23 | def click_first(self, wait=1): 24 | loc = Location(self.adb, None, self.first_left_top[0]+self.width/2, self.first_left_top[1]+self.height/2) 25 | loc.click() 26 | time.sleep(wait) 27 | 28 | def click_second(self, wait=1): 29 | loc = Location(self.adb, None, self.second_left_top[0]+self.width/2, self.second_left_top[1]+self.height/2) 30 | loc.click() 31 | time.sleep(wait) 32 | 33 | def click_third(self, wait=1): 34 | loc = Location(self.adb, None, self.third_left_top[0]+self.width/2, self.third_left_top[1]+self.height/2) 35 | loc.click() 36 | time.sleep(wait) 37 | 38 | def click_forth(self, wait=1): 39 | loc = Location(self.adb, None, self.forth_left_top[0]+self.width/2, self.forth_left_top[1]+self.height/2) 40 | loc.click() 41 | time.sleep(wait) 42 | 43 | def first_fight(self, work_dir, wait=0.3): 44 | time.sleep(4) 45 | loc = Location(self.adb, None, 624, 394) 46 | loc.click() 47 | time.sleep(4) 48 | self.adb.click(work_dir+'/temp_images/battle/fast_fight.PNG') 49 | time.sleep(3) 50 | 51 | def get_pre_gray(self): 52 | img = self.adb.get_imread_from_screen() 53 | #56:170,1091: 1244 54 | #0:210, 1000:1280-1 55 | img_crop = img[0:210, 1000:1280-1] 56 | print(img_crop.shape) 57 | return img_crop 58 | 59 | def get_pre_gray1(self): 60 | img = self.adb.get_imread_from_screen() 61 | #56:170,1091: 1244 62 | #0:210, 1000:1280-1 63 | img_crop = img[56:170,1091: 1244] 64 | print(img_crop.shape) 65 | return img_crop 66 | 67 | def save_pre(self, image_path, pre_image): 68 | cv2.imwrite(image_path+'.PNG',pre_image) 69 | 70 | def check_is_move(self,pre_gray, wait=0.1): 71 | if self.adb.compare_pre_with_now(pre_gray): 72 | #time.sleep(wait) 73 | return False 74 | else : 75 | #time.sleep(wait) 76 | return True 77 | 78 | def get_new(self,work_dir, wait=1): 79 | self.adb.click(work_dir+'/temp_images/re_get_monster/1-bag.PNG') 80 | time.sleep(wait) 81 | self.adb.click(work_dir+'/temp_images/re_get_monster/2-tent.PNG') 82 | time.sleep(wait) 83 | self.adb.click(work_dir+'/temp_images/re_get_monster/3-use.PNG') 84 | while not self.adb.check(work_dir+'/temp_images/re_get_monster/4-break_all.PNG'): 85 | time.sleep(0.1) 86 | time.sleep(wait) 87 | self.adb.click(work_dir+'/temp_images/re_get_monster/4-break_all.PNG') 88 | while not self.adb.check(work_dir+'/temp_images/re_get_monster/5-break.PNG'): 89 | time.sleep(0.1) 90 | time.sleep(wait) 91 | self.adb.click(work_dir+'/temp_images/re_get_monster/5-break.PNG') 92 | while not self.adb.check(work_dir+'/temp_images/re_get_monster/1-bag.PNG'): 93 | time.sleep(wait) 94 | 95 | def turn_to(self, index, wait=1): 96 | if index == 1: 97 | self.click_first(wait) 98 | elif index == 2: 99 | self.click_second(wait) 100 | elif index == 3: 101 | self.click_third(wait) 102 | elif index == 4: 103 | self.click_forth(wait) 104 | else : 105 | print("Input ERROR index {%s}" % str(index)) 106 | return None 107 | # self.adb.click 处理刷怪,首次战斗,误入事件 108 | # 1.构建已知图,通关读入配置文件来完成刷图事件(输入运动轨迹) 109 | # 2.判定是否可达(用引线判定) 110 | # check函数 -------------------------------------------------------------------------------- /bin/__pycache__/RunApi.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/bin/__pycache__/RunApi.cpython-37.pyc -------------------------------------------------------------------------------- /bin/__pycache__/StageFight.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/bin/__pycache__/StageFight.cpython-37.pyc -------------------------------------------------------------------------------- /bin/__pycache__/StartFish.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/bin/__pycache__/StartFish.cpython-37.pyc -------------------------------------------------------------------------------- /bin/__pycache__/StartRPG.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/bin/__pycache__/StartRPG.cpython-37.pyc -------------------------------------------------------------------------------- /cache/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/cache/screen.png -------------------------------------------------------------------------------- /common/AutoAdb.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import os 3 | 4 | import cv2 5 | 6 | from common import PathUtils, AutoAdbCheck, ConfigUtils 7 | from common.Location import Location 8 | from common.Timer import Timer 9 | 10 | class AutoAdb: 11 | threshold = 0.82 12 | wait_time = 1 13 | screen_pic_path = PathUtils.get_cache_dir() + '/screen.png' 14 | 15 | def __init__(self, test_device=False): 16 | self.adb_path = PathUtils.get_work_dir() + '/adb/adb.exe' 17 | if test_device: 18 | AutoAdbCheck.test_device() 19 | 20 | def run(self, raw_command): 21 | adb_host_port = ConfigUtils.get('adb_host_port') 22 | command = '%s -s %s %s' % (self.adb_path, adb_host_port, raw_command) 23 | res = os.popen(command) 24 | return res.buffer.read().decode('utf-8').strip() 25 | 26 | def screen_cap(self): 27 | self.run('exec-out screencap -p > ' + self.screen_pic_path) 28 | 29 | def get_location(self, temp_rel_path_list, threshold=threshold): 30 | self.screen_cap() 31 | sp_gray = cv2.imread(self.screen_pic_path, cv2.COLOR_BGR2BGRA) 32 | 33 | if temp_rel_path_list: 34 | temp_abs_path = PathUtils.get_abs_path(temp_rel_path_list) 35 | temp_gray = cv2.imread(temp_abs_path, cv2.COLOR_BGR2BGRA) 36 | 37 | res = cv2.matchTemplate(sp_gray, temp_gray, cv2.TM_CCOEFF_NORMED) 38 | _, max_val, _, max_loc = cv2.minMaxLoc(res) 39 | if max_val < threshold: 40 | return None 41 | 42 | h, w, _ = cv2.imread(temp_abs_path).shape 43 | x = max_loc[0] + w / 2 44 | y = max_loc[1] + h / 2 45 | return Location(self, temp_rel_path_list, x, y) 46 | return None 47 | 48 | def get_imread_from_screen(self): 49 | pre_gray = cv2.imread(self.screen_pic_path, cv2.COLOR_BGR2BGRA) 50 | return pre_gray 51 | 52 | def compare_pre_with_now(self, pre_gray, threshold=threshold): 53 | self.screen_cap() 54 | sp_gray = cv2.imread(self.screen_pic_path, cv2.COLOR_BGR2BGRA) 55 | 56 | res = cv2.matchTemplate(sp_gray, pre_gray, cv2.TM_CCOEFF_NORMED) 57 | _, max_val, _, max_loc = cv2.minMaxLoc(res) 58 | if max_val > threshold: 59 | return True 60 | else : 61 | return False 62 | 63 | def check(self, temp_rel_path_list, threshold=threshold): 64 | loc = self.get_location(temp_rel_path_list, threshold=threshold) 65 | return loc is not None 66 | 67 | def click(self, temp_rel_path, threshold=threshold, wait_time=wait_time): 68 | loc = self.get_location(temp_rel_path, threshold=threshold) 69 | if loc is None: 70 | return False 71 | return loc.click(wait_time) 72 | 73 | def swipe(self, start_x, start_y, end_x, end_y, duration=1500): 74 | self.run('shell input swipe %d %d %d %d %d' % (start_x, start_y, end_x, end_y, duration)) 75 | 76 | def wait(self, temp_rel_path, threshold=threshold, max_wait_time=None, episode=None): 77 | timer = Timer() 78 | none_loc = Location(self, None, None, None) 79 | while True: 80 | duration = timer.get_duration() 81 | print('\r > wait %s ... %ds ' % (temp_rel_path, duration), end='') 82 | 83 | if max_wait_time is not None and 0 < max_wait_time < duration: 84 | print(' ×', flush=True) 85 | return none_loc 86 | 87 | if episode is not None: 88 | try: 89 | res = episode() 90 | if res is not None and not res: 91 | return none_loc 92 | except Exception as e: 93 | print('过程方法执行异常') 94 | print(e) 95 | 96 | loc = self.get_location(temp_rel_path, threshold=threshold) 97 | if loc is not None: 98 | print(' √', flush=True) 99 | return loc 100 | -------------------------------------------------------------------------------- /common/AutoAdbCheck.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | from common import ConfigUtils 4 | 5 | 6 | def test_device(): 7 | from common.AutoAdb import AutoAdb 8 | auto_adb = AutoAdb() 9 | 10 | print('ADB PATH >>>> ' + auto_adb.adb_path) 11 | try: 12 | subprocess.Popen([auto_adb.adb_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 13 | except OSError: 14 | print('ADB 路径错误') 15 | exit(1) 16 | 17 | check_link(auto_adb) 18 | check_size(auto_adb) 19 | check_other(auto_adb) 20 | print() 21 | 22 | 23 | def check_link(auto_adb): 24 | adb_host_port = ConfigUtils.get('adb_host_port') 25 | print('检测设备连接状态 >>> %s ...' % adb_host_port) 26 | 27 | auto_adb.run('connect %s' % adb_host_port) 28 | device_list = get_devices(auto_adb) 29 | if len(device_list) == 0: 30 | print('未检测到设备,请检查ADB地址配置') 31 | exit(1) 32 | 33 | target_device = None 34 | print('\n设备列表:') 35 | for device in device_list: 36 | print(device) 37 | if adb_host_port in device: 38 | target_device = device 39 | 40 | print() 41 | # 设备没找到 42 | if target_device is None: 43 | print('设备列表中没找到目标连接(%s),请检查配置是否正确' % adb_host_port) 44 | exit(1) 45 | # 如果找到了设备,但是离线状态 46 | if 'offline' in target_device: 47 | print('检测到设备离线!!!') 48 | print('由于不同模拟器ADB实现细节不同,请尝试以下办法(没有先后顺序):') 49 | print('· 重启模拟器') 50 | print('· 如果模拟器已经自带了ADB,则可以尝试将脚本中adb文件夹的文件拷贝至模拟器自带ADB目录。注意备份原文件') 51 | print('· 在adb目录下打开cmd,执行 adb kill-server 后再执行 adb start-server,然后执行 adb devices 查看是否解决') 52 | print('· 重启电脑') 53 | print('· 换个模拟器') 54 | exit(1) 55 | # 设备正常 56 | print('设备已连接', end='\n\n') 57 | 58 | 59 | # 获取设备列表 60 | def get_devices(auto_adb): 61 | lines = auto_adb.run('devices').splitlines() 62 | del (lines[0]) # 删除第一个标题行 63 | return lines 64 | 65 | 66 | def check_size(auto_adb): 67 | output = auto_adb.run('shell wm size') 68 | print('屏幕分辨率: ' + output) 69 | if 'Physical size: 1280x720' not in output: 70 | print('请将分辨率设置为 1280x720 (横向 平板模式)') 71 | exit(1) 72 | 73 | 74 | def check_other(auto_adb): 75 | output = auto_adb.run('shell wm density') 76 | print("像素密度: " + output) 77 | output = auto_adb.run('shell getprop ro.product.device') 78 | print("系统类型: " + output) 79 | output = auto_adb.run('shell getprop ro.build.version.release') 80 | print('系统版本: ' + output) 81 | 82 | 83 | if __name__ == '__main__': 84 | test_device() 85 | -------------------------------------------------------------------------------- /common/ConfigUtils.py: -------------------------------------------------------------------------------- 1 | import os 2 | from configparser import ConfigParser 3 | 4 | from common import PathUtils 5 | 6 | from common.Singleton import Singleton 7 | 8 | 9 | # 读取配置文件 10 | def get(key, section='default', fallback=None): 11 | cp = ConfigParserHolder().get() 12 | return cp.get(section, key, fallback=fallback) 13 | 14 | 15 | @Singleton 16 | class ConfigParserHolder: 17 | _cp = None 18 | 19 | def __init__(self): 20 | # 读取配置文件 21 | config_file = PathUtils.get_work_dir() + '/config.ini' 22 | if not os.path.isfile(config_file): 23 | print('配置文件 config.ini 不存在,请将程序根目录的 config_temp.ini 文件拷贝一份并命名为 config.ini。注意要自行调整其中的配置项。') 24 | exit(1) 25 | if not os.access(config_file, os.R_OK): 26 | print('配置文件 config.ini 不可读,请将程序根目录的 config_temp.ini 文件拷贝一份并命名为 config.ini。注意要自行调整其中的配置项。') 27 | exit(1) 28 | 29 | cp = ConfigParser() 30 | cp.read(config_file, encoding='utf-8') 31 | self._cp = cp 32 | 33 | def get(self): 34 | return self._cp 35 | -------------------------------------------------------------------------------- /common/Location.py: -------------------------------------------------------------------------------- 1 | # 记录位置信息的类 2 | import math 3 | import time 4 | 5 | 6 | class Location: 7 | auto_adb = None 8 | temp_rel_path = None 9 | pos_x = None 10 | pos_y = None 11 | remark = None 12 | # 默认等待时间 13 | wait_time = 0.5 14 | 15 | def __init__(self, auto_adb, temp_rel_path, pos_x, pos_y, remark=None): 16 | self.auto_adb = auto_adb 17 | self.temp_rel_path = temp_rel_path 18 | self.pos_x = pos_x 19 | self.pos_y = pos_y 20 | self.remark = remark 21 | 22 | def is_valuable(self): 23 | return self.pos_x is not None and self.pos_y is not None 24 | 25 | def click(self, wait_time=wait_time): 26 | if self.pos_x is None: 27 | return False 28 | 29 | self.auto_adb.run('shell input tap %s %s' % (self.pos_x, self.pos_y)) 30 | #print('click [%d:%d] %s' % (self.pos_x, self.pos_y, self.temp_rel_path)) 31 | #time.sleep(wait_time) 32 | return True 33 | 34 | # 调整打印日志 35 | def __str__(self): 36 | attrs = ", ".join("{}={}".format(k, getattr(self, k)) for k in self.__dict__.keys()) 37 | return "[{}: {}]".format(self.__class__.__name__, attrs) 38 | 39 | # 从众多location中拿到最近的那个 40 | def get_nearest(self, loc_list): 41 | nearest_len = None 42 | nearest_loc = None 43 | for loc in loc_list: 44 | length = math.sqrt((self.pos_x - loc.pos_x) ** 2 + (self.pos_y - loc.pos_y) ** 2) 45 | if nearest_len is None or nearest_len > length: 46 | nearest_len = length 47 | nearest_loc = loc 48 | return nearest_loc 49 | -------------------------------------------------------------------------------- /common/PathUtils.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | 4 | # 获取项目路径 5 | def get_work_dir(): 6 | curr_dir = os.path.dirname(os.path.abspath(__file__)) 7 | return os.path.dirname(curr_dir).replace('\\', '/') 8 | 9 | 10 | # 获取项目的缓存路径 11 | def get_cache_dir(): 12 | cache_dir = get_work_dir() + '/cache' 13 | mkdir_ensure(cache_dir) 14 | return cache_dir 15 | 16 | 17 | # 根据相对路径获取绝对路径 18 | def get_abs_path(*rel_paths): 19 | return os.path.join(get_work_dir(), *rel_paths) 20 | 21 | 22 | # 从指定文件夹获取模板文件列表 23 | def get_temp_rel_path_list(rel_dir): 24 | temp_rel_path_list = [] 25 | image_name_list = os.listdir(get_abs_path(rel_dir)) 26 | for image_name in image_name_list: 27 | if 'example.png' in image_name: 28 | continue 29 | temp_rel_path_list.append(rel_dir + '/' + image_name) 30 | return temp_rel_path_list 31 | 32 | 33 | # 创建文件夹。确保能创建成功 34 | def mkdir_ensure(dir_target): 35 | if os.path.isdir(dir_target): 36 | return False 37 | 38 | if os.path.isfile(dir_target): 39 | os.remove(dir_target) 40 | os.makedirs(dir_target) 41 | return True 42 | 43 | 44 | # 创建文件。确保能创建成功 45 | def touch_ensure(file_target): 46 | if os.path.isfile(file_target): 47 | return False 48 | 49 | if os.path.isdir(file_target): 50 | os.removedirs(file_target) 51 | os.mknod(file_target) 52 | return True 53 | -------------------------------------------------------------------------------- /common/Singleton.py: -------------------------------------------------------------------------------- 1 | # 单例模式的注解 2 | class Singleton(object): 3 | def __init__(self, cls): 4 | self._cls = cls 5 | self._instance = {} 6 | 7 | def __call__(self): 8 | if self._cls not in self._instance: 9 | self._instance[self._cls] = self._cls() 10 | return self._instance[self._cls] 11 | -------------------------------------------------------------------------------- /common/Timer.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | 3 | 4 | class Timer: 5 | start_time = None 6 | 7 | def __init__(self): 8 | self.start_time = datetime.now() 9 | 10 | def get_duration(self): 11 | return (datetime.now() - self.start_time).seconds 12 | -------------------------------------------------------------------------------- /common/__pycache__/AutoAdb.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/common/__pycache__/AutoAdb.cpython-310.pyc -------------------------------------------------------------------------------- /common/__pycache__/AutoAdb.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/common/__pycache__/AutoAdb.cpython-37.pyc -------------------------------------------------------------------------------- /common/__pycache__/AutoAdbCheck.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/common/__pycache__/AutoAdbCheck.cpython-37.pyc -------------------------------------------------------------------------------- /common/__pycache__/ConfigUtils.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/common/__pycache__/ConfigUtils.cpython-37.pyc -------------------------------------------------------------------------------- /common/__pycache__/Location.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/common/__pycache__/Location.cpython-37.pyc -------------------------------------------------------------------------------- /common/__pycache__/PathUtils.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/common/__pycache__/PathUtils.cpython-37.pyc -------------------------------------------------------------------------------- /common/__pycache__/Singleton.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/common/__pycache__/Singleton.cpython-37.pyc -------------------------------------------------------------------------------- /common/__pycache__/Timer.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/common/__pycache__/Timer.cpython-37.pyc -------------------------------------------------------------------------------- /config.ini: -------------------------------------------------------------------------------- 1 | # 该文件不会生效请自行拷贝一份为config.ini 2 | # 配置文件 3 | [default] 4 | 5 | # ADB连接地址和端口号。 6 | # 7 | # 必需配置,程序会寻找此地址的设备,找不到则自动终止。 8 | # 不同模拟器默认端口号不同, MUMU 为7555 9 | adb_host_port = 127.0.0.1:7555 10 | 11 | # 最大结束轮次,默认60 12 | end_times = 60 13 | 14 | # 钓到几条新鱼后停止, 0表示不启用该功能, 1 表示启用该功能,启用该功能算法效能会下降 15 | new_fish_stop = 0 16 | 17 | # 使用自动定位模拟器位置, 0为无效 18 | auto_loc = 1 19 | 20 | # 模拟器窗口的名称,用于自动找窗口, 21 | # 注意,您的模拟器名称可能与我不同,该参数仅在auto_loc=1时生效 22 | title_name = 灵魂潮汐 - MuMu模拟器 23 | 24 | # -----如果没有出错,以下可以不配置 25 | 26 | # 自动定位出错时,请将auto_loc = 0, 然后自行测定以下参数 27 | # 自行测量屏幕中钓鱼显示框左边界和上边界位置 28 | mumu_left = 950 29 | mumu_top = 605 30 | # 自行找一个屏幕中方便点击的初始点(要位于模拟器内) 31 | x_origin = 1000 32 | y_origin = 1000 -------------------------------------------------------------------------------- /config_temp.ini: -------------------------------------------------------------------------------- 1 | # 该文件不会生效请自行拷贝一份为config.ini 2 | # 配置文件 3 | [default] 4 | 5 | # ADB连接地址和端口号。 6 | # 7 | # 必需配置,程序会寻找此地址的设备,找不到则自动终止。 8 | # 不同模拟器默认端口号不同, MUMU 为7555 9 | adb_host_port = 127.0.0.1:7555 10 | 11 | # 最大结束轮次,默认60 12 | end_times = 60 13 | 14 | # 钓到几条新鱼后停止, 0表示不启用该功能, 1 表示启用该功能 15 | new_fish_stop = 0 16 | 17 | # 使用自动定位模拟器位置, 0为无效 18 | auto_loc = 1 19 | 20 | # 模拟器窗口的名称,用于自动找窗口, 21 | # 注意,您的模拟器名称可能与我不同,该参数仅在auto_loc=1时生效 22 | title_name = 灵魂潮汐 - MuMu模拟器 23 | 24 | # -----如果没有出错,以下可以不配置 25 | 26 | # 自动定位出错时,请将auto_loc = 0, 然后自行测定以下参数 27 | # 自行测量屏幕中钓鱼显示框左边界和上边界位置 28 | mumu_left = 950 29 | mumu_top = 605 30 | # 自行找一个屏幕中方便点击的初始点(要位于模拟器内) 31 | x_origin = 1000 32 | y_origin = 1000 -------------------------------------------------------------------------------- /image/README/1662115841696.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/image/README/1662115841696.png -------------------------------------------------------------------------------- /image/README/1662115952026.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/image/README/1662115952026.png -------------------------------------------------------------------------------- /image/README/1662116129572.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/image/README/1662116129572.png -------------------------------------------------------------------------------- /image/README/1662116247761.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/image/README/1662116247761.png -------------------------------------------------------------------------------- /image/README/1662116269586.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/image/README/1662116269586.png -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from common.AutoAdb import AutoAdb 2 | from bin.RunApi import RunApi 3 | 4 | AutoAdb(test_device=True) 5 | adb = AutoAdb() 6 | # 鱼饵选择 7 | # 例如填入 baits_list = [1, 2]将自动钓蚯蚓,蚯蚓掉完后钓骨渣,不填入默认第一个 8 | baits_list = [7] 9 | # 对照表: 10 | # 蚯蚓 骨渣 青虫 白虫 红虫 蟋蟀 肉团 虫蛹 碎肉 虾米 11 | # 1 2 3 4 5 6 7 8 9 10 12 | # 掉落范围: 13 | # 绿色 1-5 蓝色 51-53 紫色 81-83 橙色 111-113, 按顺序递推 14 | # 具体概率见wiki.biligame/lhcx 15 | 16 | RunApi.run_fish(adb, baits_list) 17 | #RunApi.run_rpg(adb,RPG_map=rpg_map, rpg_time=rpg_map2) -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | opencv-python 2 | PyAutoGUI 3 | pywin32 -------------------------------------------------------------------------------- /screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/screen.png -------------------------------------------------------------------------------- /self_test.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 37, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from common.AutoAdb import AutoAdb\n", 10 | "import time\n", 11 | "\n", 12 | "from common import PathUtils\n", 13 | "from common.Location import Location\n", 14 | "from bin.StartFish import StartFish\n", 15 | "# 选择关卡stage\n", 16 | "from common.Timer import Timer" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 38, 22 | "metadata": {}, 23 | "outputs": [ 24 | { 25 | "name": "stdout", 26 | "output_type": "stream", 27 | "text": [ 28 | "ADB PATH >>>> d:/learn/lhcx-rpg/adb/adb.exe\n", 29 | "检测设备连接状态 >>> 127.0.0.1:7555 ...\n", 30 | "\n", 31 | "设备列表:\n", 32 | "127.0.0.1:7555\tdevice\n", 33 | "\n", 34 | "设备已连接\n", 35 | "\n", 36 | "屏幕分辨率: Physical size: 1280x720\n", 37 | "像素密度: Physical density: 240\n", 38 | "系统类型: x86\n", 39 | "系统版本: 6.0.1\n", 40 | "\n" 41 | ] 42 | } 43 | ], 44 | "source": [ 45 | "AutoAdb(test_device=True)\n", 46 | "adb = AutoAdb()" 47 | ] 48 | }, 49 | { 50 | "cell_type": "code", 51 | "execution_count": 39, 52 | "metadata": {}, 53 | "outputs": [], 54 | "source": [ 55 | "adb.screen_cap()" 56 | ] 57 | }, 58 | { 59 | "cell_type": "code", 60 | "execution_count": null, 61 | "metadata": {}, 62 | "outputs": [], 63 | "source": [ 64 | "1091 56, 1244 170" 65 | ] 66 | }, 67 | { 68 | "cell_type": "code", 69 | "execution_count": 45, 70 | "metadata": {}, 71 | "outputs": [ 72 | { 73 | "name": "stdout", 74 | "output_type": "stream", 75 | "text": [ 76 | "True\n", 77 | "True\n", 78 | "False\n", 79 | "False\n", 80 | "False\n", 81 | "False\n", 82 | "False\n", 83 | "False\n", 84 | "False\n", 85 | "False\n", 86 | "False\n", 87 | "False\n", 88 | "False\n", 89 | "False\n", 90 | "False\n", 91 | "False\n", 92 | "False\n", 93 | "False\n", 94 | "False\n", 95 | "False\n", 96 | "False\n", 97 | "False\n", 98 | "False\n", 99 | "False\n", 100 | "False\n", 101 | "False\n", 102 | "False\n", 103 | "False\n", 104 | "False\n", 105 | "False\n", 106 | "False\n", 107 | "True\n" 108 | ] 109 | } 110 | ], 111 | "source": [ 112 | "from turtle import circle\n", 113 | "\n", 114 | "\n", 115 | "for i in range(16):\n", 116 | " print(adb.check('temp_images/state/state'+str(i)+'.PNG', 0.8))\n", 117 | " cir= i+1\n", 118 | " if cir == 15:\n", 119 | " cir = cir % 15\n", 120 | " print(adb.check('temp_images/state/state'+str(cir)+'.PNG', 0.8))" 121 | ] 122 | }, 123 | { 124 | "cell_type": "code", 125 | "execution_count": 15, 126 | "metadata": {}, 127 | "outputs": [ 128 | { 129 | "data": { 130 | "text/plain": [ 131 | "True" 132 | ] 133 | }, 134 | "execution_count": 15, 135 | "metadata": {}, 136 | "output_type": "execute_result" 137 | } 138 | ], 139 | "source": [ 140 | "adb.click('temp_images/daily/main_fight.PNG', 0.65)" 141 | ] 142 | }, 143 | { 144 | "cell_type": "code", 145 | "execution_count": 35, 146 | "metadata": {}, 147 | "outputs": [ 148 | { 149 | "data": { 150 | "text/plain": [ 151 | "True" 152 | ] 153 | }, 154 | "execution_count": 35, 155 | "metadata": {}, 156 | "output_type": "execute_result" 157 | } 158 | ], 159 | "source": [ 160 | "adb.click('temp_images/daily/home.PNG', 0.65)" 161 | ] 162 | }, 163 | { 164 | "cell_type": "code", 165 | "execution_count": 34, 166 | "metadata": {}, 167 | "outputs": [], 168 | "source": [ 169 | "# swipe find home(left)\n", 170 | "adb.swipe(500, 360,1200, 360, duration=800)" 171 | ] 172 | }, 173 | { 174 | "cell_type": "code", 175 | "execution_count": null, 176 | "metadata": {}, 177 | "outputs": [], 178 | "source": [] 179 | }, 180 | { 181 | "cell_type": "code", 182 | "execution_count": 20, 183 | "metadata": {}, 184 | "outputs": [ 185 | { 186 | "data": { 187 | "text/plain": [ 188 | "True" 189 | ] 190 | }, 191 | "execution_count": 20, 192 | "metadata": {}, 193 | "output_type": "execute_result" 194 | } 195 | ], 196 | "source": [ 197 | "loc = Location(adb, None,640, 360)\n", 198 | "loc.click()" 199 | ] 200 | }, 201 | { 202 | "cell_type": "code", 203 | "execution_count": 8, 204 | "metadata": {}, 205 | "outputs": [], 206 | "source": [ 207 | "RPG_map = [[1,2,3],\n", 208 | " [4, 5, 6]]" 209 | ] 210 | }, 211 | { 212 | "cell_type": "code", 213 | "execution_count": 9, 214 | "metadata": {}, 215 | "outputs": [ 216 | { 217 | "name": "stdout", 218 | "output_type": "stream", 219 | "text": [ 220 | "1\n", 221 | "2\n", 222 | "3\n", 223 | "4\n", 224 | "5\n", 225 | "6\n" 226 | ] 227 | } 228 | ], 229 | "source": [ 230 | "for i in RPG_map:\n", 231 | " for k in i:\n", 232 | " print(k)" 233 | ] 234 | }, 235 | { 236 | "cell_type": "code", 237 | "execution_count": 7, 238 | "metadata": {}, 239 | "outputs": [ 240 | { 241 | "data": { 242 | "text/plain": [ 243 | "False" 244 | ] 245 | }, 246 | "execution_count": 7, 247 | "metadata": {}, 248 | "output_type": "execute_result" 249 | } 250 | ], 251 | "source": [ 252 | "adb.check(\"screen.png\")" 253 | ] 254 | }, 255 | { 256 | "cell_type": "code", 257 | "execution_count": 10, 258 | "metadata": {}, 259 | "outputs": [ 260 | { 261 | "data": { 262 | "text/plain": [ 263 | "True" 264 | ] 265 | }, 266 | "execution_count": 10, 267 | "metadata": {}, 268 | "output_type": "execute_result" 269 | } 270 | ], 271 | "source": [ 272 | "adb.click('temp_images/start2.png')" 273 | ] 274 | }, 275 | { 276 | "cell_type": "code", 277 | "execution_count": 3, 278 | "metadata": {}, 279 | "outputs": [], 280 | "source": [ 281 | "work_dir = PathUtils.get_work_dir()\n", 282 | "fishing_image_path = '/temp_images/screen_fish.jpg'" 283 | ] 284 | }, 285 | { 286 | "cell_type": "code", 287 | "execution_count": 5, 288 | "metadata": {}, 289 | "outputs": [ 290 | { 291 | "name": "stdout", 292 | "output_type": "stream", 293 | "text": [ 294 | "1342 799\n", 295 | "向左运动\n", 296 | "1518 806\n", 297 | "向左运动\n", 298 | "1632 825\n", 299 | "向左运动\n", 300 | "1731 832\n", 301 | "向左运动\n", 302 | "1767 842\n", 303 | "向左运动\n", 304 | "1767 842\n", 305 | "向左运动\n", 306 | "1767 842\n", 307 | "向右运动\n", 308 | "1424 982\n", 309 | "向左运动\n", 310 | "1360 1028\n", 311 | "向左运动\n", 312 | "1312 1051\n", 313 | "向左运动\n", 314 | "1286 1064\n", 315 | "向左运动\n", 316 | "1280 1068\n", 317 | "向左运动\n", 318 | "1280 1068\n", 319 | "向左运动\n", 320 | "1280 1068\n", 321 | "向左运动\n", 322 | "1280 1068\n", 323 | "向左运动\n", 324 | "1280 1068\n", 325 | "向左运动\n", 326 | "1280 1068\n", 327 | "向左运动\n", 328 | "1280 1068\n", 329 | "向左运动\n", 330 | "1280 1068\n", 331 | "向左运动\n", 332 | "1280 1068\n", 333 | "向左运动\n", 334 | "1280 1068\n", 335 | "向左运动\n", 336 | "1294 1020\n", 337 | "向左运动\n", 338 | "1315 968\n", 339 | "向左运动\n", 340 | "1321 953\n", 341 | "向左运动\n", 342 | "1321 953\n", 343 | "向左运动\n", 344 | "1321 953\n", 345 | "向左运动\n", 346 | "1321 953\n", 347 | "向左运动\n", 348 | "1321 953\n", 349 | "向左运动\n", 350 | "1321 953\n", 351 | "向左运动\n", 352 | "1321 953\n", 353 | "向左运动\n", 354 | "1321 953\n", 355 | "向左运动\n", 356 | "1321 953\n", 357 | "向左运动\n", 358 | "1321 953\n", 359 | "向左运动\n", 360 | "1321 953\n", 361 | "向左运动\n", 362 | "1321 953\n", 363 | "向左运动\n", 364 | "1321 953\n", 365 | "向左运动\n", 366 | "1321 953\n", 367 | "向左运动\n", 368 | "1321 953\n", 369 | "向左运动\n", 370 | "1321 953\n", 371 | "向左运动\n", 372 | "1321 953\n", 373 | "向左运动\n", 374 | "1321 953\n", 375 | "向左运动\n", 376 | "1321 953\n", 377 | "向左运动\n", 378 | "1321 953\n", 379 | "向左运动\n", 380 | "1321 953\n", 381 | "向左运动\n", 382 | "1321 953\n", 383 | "向左运动\n", 384 | "1321 953\n", 385 | "向左运动\n", 386 | "1321 953\n", 387 | "向左运动\n", 388 | "1321 953\n", 389 | "向左运动\n", 390 | "1321 953\n", 391 | "向左运动\n", 392 | "1321 953\n", 393 | "向左运动\n", 394 | "1321 953\n", 395 | "向左运动\n", 396 | "1321 953\n", 397 | "向左运动\n", 398 | "1321 953\n", 399 | "向左运动\n", 400 | "1321 953\n", 401 | "向左运动\n", 402 | "1321 953\n", 403 | "向左运动\n", 404 | "1321 953\n", 405 | "向左运动\n", 406 | "1321 953\n", 407 | "向左运动\n", 408 | "1321 953\n", 409 | "向左运动\n", 410 | "1321 953\n", 411 | "向左运动\n", 412 | "1321 953\n", 413 | "向左运动\n", 414 | "1321 953\n", 415 | "向左运动\n", 416 | "1321 953\n", 417 | "向左运动\n", 418 | "1321 953\n", 419 | "向左运动\n", 420 | "1321 953\n", 421 | "向左运动\n", 422 | "1321 953\n", 423 | "向左运动\n", 424 | "1321 953\n", 425 | "向左运动\n", 426 | "1321 953\n", 427 | "向左运动\n", 428 | "1321 953\n", 429 | "向左运动\n", 430 | "1321 953\n", 431 | "向左运动\n", 432 | "1321 953\n", 433 | "向左运动\n", 434 | "1321 953\n", 435 | "向左运动\n", 436 | "1321 953\n", 437 | "向左运动\n", 438 | "1321 953\n", 439 | "向左运动\n", 440 | "1321 953\n", 441 | "向左运动\n", 442 | "1321 953\n", 443 | "向左运动\n", 444 | "1321 953\n", 445 | "向左运动\n", 446 | "1321 953\n", 447 | "向左运动\n", 448 | "1321 953\n", 449 | "向左运动\n", 450 | "1321 953\n", 451 | "向左运动\n", 452 | "1321 953\n", 453 | "向左运动\n", 454 | "1321 953\n", 455 | "向左运动\n", 456 | "1321 953\n", 457 | "向左运动\n", 458 | "1321 953\n", 459 | "向左运动\n", 460 | "1321 953\n", 461 | "向右运动\n", 462 | "1321 953\n", 463 | "向左运动\n", 464 | "1321 953\n", 465 | "向左运动\n", 466 | "1321 953\n", 467 | "向右运动\n", 468 | "1321 953\n", 469 | "向左运动\n", 470 | "1321 953\n", 471 | "向左运动\n", 472 | "1321 953\n", 473 | "向左运动\n", 474 | "1321 953\n", 475 | "向右运动\n", 476 | "1321 953\n", 477 | "向右运动\n", 478 | "1321 953\n", 479 | "向左运动\n", 480 | "1321 953\n", 481 | "向左运动\n", 482 | "1321 953\n", 483 | "向左运动\n", 484 | "1321 953\n", 485 | "向左运动\n", 486 | "1321 953\n", 487 | "向左运动\n", 488 | "1321 953\n", 489 | "向左运动\n", 490 | "1321 953\n", 491 | "向左运动\n", 492 | "1321 953\n", 493 | "向左运动\n", 494 | "1321 953\n", 495 | "向左运动\n", 496 | "1321 953\n", 497 | "向左运动\n", 498 | "1321 953\n", 499 | "向左运动\n", 500 | "1321 953\n", 501 | "向左运动\n", 502 | "1321 953\n", 503 | "向左运动\n", 504 | "1321 953\n", 505 | "向左运动\n", 506 | "1321 953\n", 507 | "向左运动\n", 508 | "1321 953\n", 509 | "向右运动\n", 510 | "1321 953\n", 511 | "向左运动\n", 512 | "1321 953\n", 513 | "向左运动\n", 514 | "1321 953\n", 515 | "向右运动\n", 516 | "1321 953\n", 517 | "向左运动\n", 518 | "1321 953\n", 519 | "向右运动\n", 520 | "1320 953\n", 521 | "向右运动\n", 522 | "1318 954\n", 523 | "向左运动\n", 524 | "1317 954\n", 525 | "向左运动\n", 526 | "1317 954\n", 527 | "向左运动\n", 528 | "1317 954\n", 529 | "向左运动\n", 530 | "1317 954\n", 531 | "向右运动\n", 532 | "1317 954\n", 533 | "向左运动\n", 534 | "1317 954\n", 535 | "向左运动\n", 536 | "1317 954\n", 537 | "向左运动\n", 538 | "1317 954\n", 539 | "向左运动\n", 540 | "1317 954\n", 541 | "向左运动\n", 542 | "1315 955\n", 543 | "向左运动\n", 544 | "1315 955\n", 545 | "向左运动\n", 546 | "1315 955\n", 547 | "向左运动\n", 548 | "1315 955\n", 549 | "向右运动\n", 550 | "1315 955\n", 551 | "向右运动\n", 552 | "1315 955\n", 553 | "向右运动\n", 554 | "1315 955\n", 555 | "向右运动\n", 556 | "1315 955\n", 557 | "向右运动\n", 558 | "1315 955\n", 559 | "向右运动\n", 560 | "1315 955\n", 561 | "向左运动\n", 562 | "1315 955\n", 563 | "向左运动\n", 564 | "1315 955\n", 565 | "向左运动\n", 566 | "1315 955\n", 567 | "向右运动\n", 568 | "1315 955\n", 569 | "向右运动\n", 570 | "1261 973\n", 571 | "向左运动\n", 572 | "1261 973\n", 573 | "向左运动\n", 574 | "1261 973\n", 575 | "向左运动\n", 576 | "1261 973\n", 577 | "向右运动\n", 578 | "1261 973\n", 579 | "向左运动\n", 580 | "1261 973\n", 581 | "向左运动\n", 582 | "1261 973\n", 583 | "向右运动\n", 584 | "1261 974\n", 585 | "向左运动\n", 586 | "1261 974\n", 587 | "向左运动\n", 588 | "1261 974\n", 589 | "向左运动\n", 590 | "1261 974\n", 591 | "向左运动\n", 592 | "1261 974\n", 593 | "向左运动\n", 594 | "1261 974\n", 595 | "向左运动\n", 596 | "1261 974\n", 597 | "向左运动\n", 598 | "1261 974\n", 599 | "向左运动\n", 600 | "1261 974\n", 601 | "向左运动\n", 602 | "1261 974\n", 603 | "向左运动\n", 604 | "1261 974\n", 605 | "向左运动\n", 606 | "1261 974\n", 607 | "向左运动\n", 608 | "1261 974\n", 609 | "向左运动\n", 610 | "1261 974\n", 611 | "向左运动\n", 612 | "1261 974\n", 613 | "向右运动\n", 614 | "1261 974\n", 615 | "向左运动\n", 616 | "1261 974\n", 617 | "向左运动\n", 618 | "1261 974\n", 619 | "向左运动\n", 620 | "1261 974\n", 621 | "向左运动\n", 622 | "1261 974\n", 623 | "向左运动\n", 624 | "1261 974\n", 625 | "向右运动\n" 626 | ] 627 | }, 628 | { 629 | "ename": "FailSafeException", 630 | "evalue": "PyAutoGUI fail-safe triggered from mouse moving to a corner of the screen. To disable this fail-safe, set pyautogui.FAILSAFE to False. DISABLING FAIL-SAFE IS NOT RECOMMENDED.", 631 | "output_type": "error", 632 | "traceback": [ 633 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 634 | "\u001b[1;31mFailSafeException\u001b[0m Traceback (most recent call last)", 635 | "\u001b[1;32m~\\AppData\\Local\\Temp\\ipykernel_7204\\1018346970.py\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[0mStartFish\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwindow_capture\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mwork_dir\u001b[0m\u001b[1;33m+\u001b[0m\u001b[0mfishing_image_path\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[0mx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mStartFish\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_position\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mwork_dir\u001b[0m\u001b[1;33m+\u001b[0m\u001b[0mfishing_image_path\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 10\u001b[1;33m \u001b[0mring\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mStartFish\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mStage\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 11\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mring\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[0madb\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mswipe\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m600\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m600\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m800\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m600\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m700\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 636 | "\u001b[1;32md:\\learn\\lhcx\\bin\\StartFish.py\u001b[0m in \u001b[0;36mStage\u001b[1;34m(region, fish, during_time)\u001b[0m\n\u001b[0;32m 64\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 65\u001b[0m \u001b[0mcurrentMouseX\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcurrentMouseY\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpyautogui\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mposition\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m# 鼠标当前位置\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 66\u001b[1;33m \u001b[0mpyautogui\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmoveTo\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1000\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1000\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mduration\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0.001\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 67\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcurrentMouseX\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcurrentMouseY\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 68\u001b[0m \u001b[1;31m# 长点屏幕\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 637 | "\u001b[1;32md:\\anaconda\\envs\\tf27\\lib\\site-packages\\pyautogui\\__init__.py\u001b[0m in \u001b[0;36mwrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 595\u001b[0m \u001b[1;33m@\u001b[0m\u001b[0mfunctools\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwraps\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mwrappedFunction\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 596\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 597\u001b[1;33m \u001b[0mfailSafeCheck\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 598\u001b[0m \u001b[0mreturnVal\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mwrappedFunction\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 599\u001b[0m \u001b[0m_handlePause\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"_pause\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 638 | "\u001b[1;32md:\\anaconda\\envs\\tf27\\lib\\site-packages\\pyautogui\\__init__.py\u001b[0m in \u001b[0;36mfailSafeCheck\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1721\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mFAILSAFE\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0mtuple\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mposition\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mFAILSAFE_POINTS\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1722\u001b[0m raise FailSafeException(\n\u001b[1;32m-> 1723\u001b[1;33m \u001b[1;34m\"PyAutoGUI fail-safe triggered from mouse moving to a corner of the screen. To disable this fail-safe, set pyautogui.FAILSAFE to False. DISABLING FAIL-SAFE IS NOT RECOMMENDED.\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1724\u001b[0m )\n\u001b[0;32m 1725\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", 639 | "\u001b[1;31mFailSafeException\u001b[0m: PyAutoGUI fail-safe triggered from mouse moving to a corner of the screen. To disable this fail-safe, set pyautogui.FAILSAFE to False. DISABLING FAIL-SAFE IS NOT RECOMMENDED." 640 | ] 641 | } 642 | ], 643 | "source": [ 644 | "ending_loc = Location(adb, None, 600, 600)\n", 645 | "for i in range(1):\n", 646 | " adb.click('temp_images/fish.png')\n", 647 | " time.sleep(2)\n", 648 | " adb.click('temp_images/start.png')\n", 649 | " now = time.time()\n", 650 | " while time.time() - now <60*1:\n", 651 | " StartFish.window_capture(work_dir+fishing_image_path)\n", 652 | " x, y = StartFish.get_position(work_dir+fishing_image_path)\n", 653 | " ring = StartFish.Stage(x, y)\n", 654 | " if ring:\n", 655 | " adb.swipe(600, 600, 800, 600, 700)\n", 656 | " ending_loc.click()\n", 657 | " ending_loc.click()" 658 | ] 659 | }, 660 | { 661 | "cell_type": "code", 662 | "execution_count": null, 663 | "metadata": {}, 664 | "outputs": [], 665 | "source": [ 666 | "import win32gui\n", 667 | "# 根据标题查找窗口\n", 668 | "title = '文档'\n", 669 | "hwnd = win32gui.FindWindow(None, title)" 670 | ] 671 | }, 672 | { 673 | "cell_type": "code", 674 | "execution_count": 20, 675 | "metadata": {}, 676 | "outputs": [], 677 | "source": [ 678 | "import win32gui\n", 679 | "def find_window_by_title(title):\n", 680 | " try:\n", 681 | " hwnd = win32gui.FindWindow(None, title)\n", 682 | " left, top, right, bottom = win32gui.GetWindowRect(hwnd)\n", 683 | " return [left, top, right, bottom]\n", 684 | " except Exception as ex:\n", 685 | " print('error calling win32gui.FindWindow ' + str(ex))\n", 686 | " return -1" 687 | ] 688 | }, 689 | { 690 | "cell_type": "code", 691 | "execution_count": 26, 692 | "metadata": {}, 693 | "outputs": [], 694 | "source": [ 695 | "import ctypes\n", 696 | "# 获取真实的窗口 POS\n", 697 | "def get_window_rect(title):\n", 698 | " hwnd = win32gui.FindWindow(None, title)\n", 699 | " try:\n", 700 | " f = ctypes.windll.dwmapi.DwmGetWindowAttribute\n", 701 | " except WindowsError:\n", 702 | " f = None\n", 703 | " if f:\n", 704 | " rect = ctypes.wintypes.RECT()\n", 705 | " f(ctypes.wintypes.HWND(hwnd), ctypes.wintypes.DWORD(9), ctypes.byref(rect), ctypes.sizeof(rect))\n", 706 | " return rect.left, rect.top, rect.right, rect.bottom\n", 707 | "\n", 708 | "\n" 709 | ] 710 | }, 711 | { 712 | "cell_type": "code", 713 | "execution_count": 27, 714 | "metadata": {}, 715 | "outputs": [ 716 | { 717 | "data": { 718 | "text/plain": [ 719 | "(640, 396, 1920, 1205)" 720 | ] 721 | }, 722 | "execution_count": 27, 723 | "metadata": {}, 724 | "output_type": "execute_result" 725 | } 726 | ], 727 | "source": [ 728 | "get_window_rect('灵魂潮汐 - MuMu模拟器')" 729 | ] 730 | }, 731 | { 732 | "cell_type": "code", 733 | "execution_count": 21, 734 | "metadata": {}, 735 | "outputs": [ 736 | { 737 | "data": { 738 | "text/plain": [ 739 | "[427, 264, 1280, 803]" 740 | ] 741 | }, 742 | "execution_count": 21, 743 | "metadata": {}, 744 | "output_type": "execute_result" 745 | } 746 | ], 747 | "source": [ 748 | "find_window_by_title('灵魂潮汐 - MuMu模拟器')" 749 | ] 750 | }, 751 | { 752 | "cell_type": "code", 753 | "execution_count": 24, 754 | "metadata": {}, 755 | "outputs": [ 756 | { 757 | "data": { 758 | "text/plain": [ 759 | "[11, 9, 1070, 683]" 760 | ] 761 | }, 762 | "execution_count": 24, 763 | "metadata": {}, 764 | "output_type": "execute_result" 765 | } 766 | ], 767 | "source": [ 768 | "find_window_by_title('lhcx')" 769 | ] 770 | }, 771 | { 772 | "cell_type": "code", 773 | "execution_count": 6, 774 | "metadata": {}, 775 | "outputs": [], 776 | "source": [ 777 | "left, top, right, bottom = win32gui.GetWindowRect(3148510)" 778 | ] 779 | }, 780 | { 781 | "cell_type": "code", 782 | "execution_count": 17, 783 | "metadata": {}, 784 | "outputs": [ 785 | { 786 | "data": { 787 | "text/plain": [ 788 | "345" 789 | ] 790 | }, 791 | "execution_count": 17, 792 | "metadata": {}, 793 | "output_type": "execute_result" 794 | } 795 | ], 796 | "source": [ 797 | "950 - 6" 798 | ] 799 | }, 800 | { 801 | "cell_type": "code", 802 | "execution_count": 29, 803 | "metadata": {}, 804 | "outputs": [ 805 | { 806 | "data": { 807 | "text/plain": [ 808 | "310" 809 | ] 810 | }, 811 | "execution_count": 29, 812 | "metadata": {}, 813 | "output_type": "execute_result" 814 | } 815 | ], 816 | "source": [ 817 | "import time, threading\n", 818 | "\n", 819 | "# 新线程执行的代码:\n", 820 | "def loop():\n", 821 | " print('thread %s is running...' % threading.current_thread().name)\n", 822 | " n = 0\n", 823 | " while n < 100:\n", 824 | " n = n + 1\n", 825 | " print('thread %s >>> %s' % (threading.current_thread().name, n))\n", 826 | " time.sleep(0.1)\n", 827 | " print('thread %s ended.' % threading.current_thread().name)\n", 828 | "\n", 829 | "def stop():\n", 830 | " time.sleep(4)\n", 831 | "\n", 832 | "print('thread %s is running...' % threading.current_thread().name)\n", 833 | "t = threading.Thread(target=loop, name='LoopThread')\n", 834 | "t.start()\n", 835 | "t.join()\n", 836 | "print('thread %s ended.' % threading.current_thread().name)" 837 | ] 838 | }, 839 | { 840 | "cell_type": "code", 841 | "execution_count": 59, 842 | "metadata": {}, 843 | "outputs": [], 844 | "source": [ 845 | "import cv2\n", 846 | "\n", 847 | "def get_location_with_no_sc(temp_rel_path_list, threshold=0.9):\n", 848 | " #self.screen_cap()\n", 849 | " sp_gray = cv2.imread('temp_images/new_fish/get_new2.png', cv2.COLOR_BGR2BGRA)\n", 850 | "\n", 851 | " if temp_rel_path_list:\n", 852 | " temp_abs_path = temp_rel_path_list\n", 853 | " temp_gray = cv2.imread(temp_abs_path, cv2.COLOR_BGR2BGRA)\n", 854 | "\n", 855 | " res = cv2.matchTemplate(sp_gray, temp_gray, cv2.TM_CCOEFF_NORMED)\n", 856 | " _, max_val, _, max_loc = cv2.minMaxLoc(res)\n", 857 | " if max_val < threshold:\n", 858 | " return False\n", 859 | "\n", 860 | " return True\n", 861 | "\n", 862 | " return False\n" 863 | ] 864 | }, 865 | { 866 | "cell_type": "code", 867 | "execution_count": 60, 868 | "metadata": {}, 869 | "outputs": [ 870 | { 871 | "data": { 872 | "text/plain": [ 873 | "True" 874 | ] 875 | }, 876 | "execution_count": 60, 877 | "metadata": {}, 878 | "output_type": "execute_result" 879 | } 880 | ], 881 | "source": [ 882 | "get_location_with_no_sc('temp_images/new_fish/get_new2.png')" 883 | ] 884 | }, 885 | { 886 | "cell_type": "code", 887 | "execution_count": 10, 888 | "metadata": {}, 889 | "outputs": [ 890 | { 891 | "name": "stdout", 892 | "output_type": "stream", 893 | "text": [ 894 | "1\n" 895 | ] 896 | } 897 | ], 898 | "source": [ 899 | "if [21]:\n", 900 | " print(1)" 901 | ] 902 | }, 903 | { 904 | "cell_type": "code", 905 | "execution_count": 14, 906 | "metadata": {}, 907 | "outputs": [ 908 | { 909 | "name": "stdout", 910 | "output_type": "stream", 911 | "text": [ 912 | "0\n" 913 | ] 914 | } 915 | ], 916 | "source": [ 917 | "if None:\n", 918 | " print(1)\n", 919 | "else :\n", 920 | " print(0)" 921 | ] 922 | }, 923 | { 924 | "cell_type": "code", 925 | "execution_count": 56, 926 | "metadata": {}, 927 | "outputs": [ 928 | { 929 | "data": { 930 | "text/plain": [ 931 | "583" 932 | ] 933 | }, 934 | "execution_count": 56, 935 | "metadata": {}, 936 | "output_type": "execute_result" 937 | } 938 | ], 939 | "source": [ 940 | "950-367" 941 | ] 942 | }, 943 | { 944 | "cell_type": "code", 945 | "execution_count": 57, 946 | "metadata": {}, 947 | "outputs": [ 948 | { 949 | "data": { 950 | "text/plain": [ 951 | "593" 952 | ] 953 | }, 954 | "execution_count": 57, 955 | "metadata": {}, 956 | "output_type": "execute_result" 957 | } 958 | ], 959 | "source": [ 960 | "850-257" 961 | ] 962 | }, 963 | { 964 | "cell_type": "code", 965 | "execution_count": 50, 966 | "metadata": {}, 967 | "outputs": [ 968 | { 969 | "data": { 970 | "text/plain": [ 971 | "723" 972 | ] 973 | }, 974 | "execution_count": 50, 975 | "metadata": {}, 976 | "output_type": "execute_result" 977 | } 978 | ], 979 | "source": [ 980 | "1090-367" 981 | ] 982 | }, 983 | { 984 | "cell_type": "code", 985 | "execution_count": 51, 986 | "metadata": {}, 987 | "outputs": [ 988 | { 989 | "data": { 990 | "text/plain": [ 991 | "633" 992 | ] 993 | }, 994 | "execution_count": 51, 995 | "metadata": {}, 996 | "output_type": "execute_result" 997 | } 998 | ], 999 | "source": [ 1000 | "890-257" 1001 | ] 1002 | }, 1003 | { 1004 | "cell_type": "code", 1005 | "execution_count": 53, 1006 | "metadata": {}, 1007 | "outputs": [ 1008 | { 1009 | "data": { 1010 | "text/plain": [ 1011 | "'d:/learn/lhcx'" 1012 | ] 1013 | }, 1014 | "execution_count": 53, 1015 | "metadata": {}, 1016 | "output_type": "execute_result" 1017 | } 1018 | ], 1019 | "source": [ 1020 | "from common import PathUtils\n", 1021 | "PathUtils.get_work_dir()" 1022 | ] 1023 | }, 1024 | { 1025 | "cell_type": "code", 1026 | "execution_count": null, 1027 | "metadata": {}, 1028 | "outputs": [], 1029 | "source": [ 1030 | "563~723 593 ~633" 1031 | ] 1032 | }, 1033 | { 1034 | "cell_type": "code", 1035 | "execution_count": 54, 1036 | "metadata": {}, 1037 | "outputs": [ 1038 | { 1039 | "data": { 1040 | "text/plain": [ 1041 | "169" 1042 | ] 1043 | }, 1044 | "execution_count": 54, 1045 | "metadata": {}, 1046 | "output_type": "execute_result" 1047 | } 1048 | ], 1049 | "source": [ 1050 | "732-563" 1051 | ] 1052 | }, 1053 | { 1054 | "cell_type": "code", 1055 | "execution_count": 55, 1056 | "metadata": {}, 1057 | "outputs": [ 1058 | { 1059 | "data": { 1060 | "text/plain": [ 1061 | "40" 1062 | ] 1063 | }, 1064 | "execution_count": 55, 1065 | "metadata": {}, 1066 | "output_type": "execute_result" 1067 | } 1068 | ], 1069 | "source": [ 1070 | "633-593" 1071 | ] 1072 | }, 1073 | { 1074 | "cell_type": "code", 1075 | "execution_count": 3, 1076 | "metadata": {}, 1077 | "outputs": [ 1078 | { 1079 | "name": "stdout", 1080 | "output_type": "stream", 1081 | "text": [ 1082 | "{1}\n" 1083 | ] 1084 | } 1085 | ], 1086 | "source": [ 1087 | "print('{%d}' % 1)" 1088 | ] 1089 | }, 1090 | { 1091 | "cell_type": "code", 1092 | "execution_count": null, 1093 | "metadata": {}, 1094 | "outputs": [], 1095 | "source": [] 1096 | } 1097 | ], 1098 | "metadata": { 1099 | "kernelspec": { 1100 | "display_name": "Python 3.7.11 ('tf27')", 1101 | "language": "python", 1102 | "name": "python3" 1103 | }, 1104 | "language_info": { 1105 | "codemirror_mode": { 1106 | "name": "ipython", 1107 | "version": 3 1108 | }, 1109 | "file_extension": ".py", 1110 | "mimetype": "text/x-python", 1111 | "name": "python", 1112 | "nbconvert_exporter": "python", 1113 | "pygments_lexer": "ipython3", 1114 | "version": "3.7.11" 1115 | }, 1116 | "orig_nbformat": 4, 1117 | "vscode": { 1118 | "interpreter": { 1119 | "hash": "ae7395306d7dbc2180fb62a3d0385ca74246dbe138266eed3710cf1307e5c1a6" 1120 | } 1121 | } 1122 | }, 1123 | "nbformat": 4, 1124 | "nbformat_minor": 2 1125 | } 1126 | -------------------------------------------------------------------------------- /temp.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp.PNG -------------------------------------------------------------------------------- /temp_images/baits/1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/1.PNG -------------------------------------------------------------------------------- /temp_images/baits/10.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/10.PNG -------------------------------------------------------------------------------- /temp_images/baits/11.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/11.PNG -------------------------------------------------------------------------------- /temp_images/baits/12.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/12.PNG -------------------------------------------------------------------------------- /temp_images/baits/13.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/13.PNG -------------------------------------------------------------------------------- /temp_images/baits/14.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/14.PNG -------------------------------------------------------------------------------- /temp_images/baits/15.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/15.PNG -------------------------------------------------------------------------------- /temp_images/baits/16.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/16.PNG -------------------------------------------------------------------------------- /temp_images/baits/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/17.png -------------------------------------------------------------------------------- /temp_images/baits/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/18.png -------------------------------------------------------------------------------- /temp_images/baits/19.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/19.PNG -------------------------------------------------------------------------------- /temp_images/baits/2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/2.PNG -------------------------------------------------------------------------------- /temp_images/baits/20.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/20.PNG -------------------------------------------------------------------------------- /temp_images/baits/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/3.PNG -------------------------------------------------------------------------------- /temp_images/baits/4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/4.PNG -------------------------------------------------------------------------------- /temp_images/baits/5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/5.PNG -------------------------------------------------------------------------------- /temp_images/baits/6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/6.PNG -------------------------------------------------------------------------------- /temp_images/baits/7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/7.PNG -------------------------------------------------------------------------------- /temp_images/baits/8.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/8.PNG -------------------------------------------------------------------------------- /temp_images/baits/9.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/baits/9.PNG -------------------------------------------------------------------------------- /temp_images/battle/fast_fight.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/battle/fast_fight.PNG -------------------------------------------------------------------------------- /temp_images/battle/no_singal.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/battle/no_singal.PNG -------------------------------------------------------------------------------- /temp_images/daily/fight_1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/daily/fight_1.PNG -------------------------------------------------------------------------------- /temp_images/daily/fight_jb.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/daily/fight_jb.PNG -------------------------------------------------------------------------------- /temp_images/daily/fight_ly.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/daily/fight_ly.PNG -------------------------------------------------------------------------------- /temp_images/daily/fight_ro.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/daily/fight_ro.PNG -------------------------------------------------------------------------------- /temp_images/daily/fitght_hn.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/daily/fitght_hn.PNG -------------------------------------------------------------------------------- /temp_images/daily/home.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/daily/home.PNG -------------------------------------------------------------------------------- /temp_images/daily/main_fight.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/daily/main_fight.PNG -------------------------------------------------------------------------------- /temp_images/daily/start_fight.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/daily/start_fight.PNG -------------------------------------------------------------------------------- /temp_images/daily/town.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/daily/town.PNG -------------------------------------------------------------------------------- /temp_images/error/store.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/error/store.PNG -------------------------------------------------------------------------------- /temp_images/error/store2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/error/store2.PNG -------------------------------------------------------------------------------- /temp_images/error/story.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/error/story.PNG -------------------------------------------------------------------------------- /temp_images/fish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/fish.png -------------------------------------------------------------------------------- /temp_images/move/black.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/move/black.PNG -------------------------------------------------------------------------------- /temp_images/move/white.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/move/white.PNG -------------------------------------------------------------------------------- /temp_images/new_fish/get_new2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/new_fish/get_new2.PNG -------------------------------------------------------------------------------- /temp_images/old_test/haha-green.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/old_test/haha-green.jpg -------------------------------------------------------------------------------- /temp_images/old_test/haha-red.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/old_test/haha-red.jpg -------------------------------------------------------------------------------- /temp_images/old_test/haha.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/old_test/haha.jpg -------------------------------------------------------------------------------- /temp_images/old_test/ins.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/old_test/ins.jpg -------------------------------------------------------------------------------- /temp_images/re_get_monster/1-bag.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/re_get_monster/1-bag.PNG -------------------------------------------------------------------------------- /temp_images/re_get_monster/2-tent.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/re_get_monster/2-tent.PNG -------------------------------------------------------------------------------- /temp_images/re_get_monster/3-use.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/re_get_monster/3-use.PNG -------------------------------------------------------------------------------- /temp_images/re_get_monster/4-break_all.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/re_get_monster/4-break_all.PNG -------------------------------------------------------------------------------- /temp_images/re_get_monster/5-break.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/re_get_monster/5-break.PNG -------------------------------------------------------------------------------- /temp_images/screen_fish.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/screen_fish.jpg -------------------------------------------------------------------------------- /temp_images/screen_fish_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/screen_fish_2.jpg -------------------------------------------------------------------------------- /temp_images/start2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/start2.PNG -------------------------------------------------------------------------------- /temp_images/state/state0.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state0.PNG -------------------------------------------------------------------------------- /temp_images/state/state1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state1.PNG -------------------------------------------------------------------------------- /temp_images/state/state10.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state10.PNG -------------------------------------------------------------------------------- /temp_images/state/state11.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state11.PNG -------------------------------------------------------------------------------- /temp_images/state/state12.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state12.PNG -------------------------------------------------------------------------------- /temp_images/state/state13.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state13.PNG -------------------------------------------------------------------------------- /temp_images/state/state14.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state14.PNG -------------------------------------------------------------------------------- /temp_images/state/state15.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state15.PNG -------------------------------------------------------------------------------- /temp_images/state/state2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state2.PNG -------------------------------------------------------------------------------- /temp_images/state/state3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state3.PNG -------------------------------------------------------------------------------- /temp_images/state/state4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state4.PNG -------------------------------------------------------------------------------- /temp_images/state/state5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state5.PNG -------------------------------------------------------------------------------- /temp_images/state/state6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state6.PNG -------------------------------------------------------------------------------- /temp_images/state/state7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state7.PNG -------------------------------------------------------------------------------- /temp_images/state/state8.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state8.PNG -------------------------------------------------------------------------------- /temp_images/state/state9.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sixone-Jiang/LHCXAutoFishingScripts/7150bf0b29409beac4bcc335e1d40973779794b3/temp_images/state/state9.PNG --------------------------------------------------------------------------------