最近微信上流行了一个小游戏,叫跳一跳。
进去看排行榜,会发现很多朋友圈的好友都在玩,也包括自己的男神或者女神,… 既然现实里暂时无法得到,那么先在游戏里扳回一局吧。

本文引用的代码与工具为别人所写,并非本人。
这里是展示拿到了这些代码,怎么和手机连接,打开游戏,然后实现最终刷分的目的的细节。

代码作者的指导页以及源码页:
1. https://zhuanlan.zhihu.com/p/32452473
2. https://github.com/wangshub/wechat_jump_game
3. https://wangshub.github.io/2017/12/29/教你用Python来玩微信跳一跳/

准备工作部分:
1. 保证本地有Python支持
2. 下载源码作者的github代码,ZIP包就挺好。

————————

首先,去下一个刷机精灵的PC版本。
地址:http://www.shuame.com/shuame-pc.html

安装好了以后,将手机和PC连接。
然后用PC版本的刷机精灵和手机连接:

上图,是成功的样子。

连接过程中,手机屏幕可能会收到类似【adb shell】的访问许可,… 选择通过即可。
手机,开发者模式,必须开启。

用ADB做一个截图,看看效果:

PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master\Tools\adb> .\adb.exe shell screencap -p /sdcard/2018010201.png
PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master\Tools\adb>
PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master\Tools\adb> .\adb.exe pull /sdcard/2018010201.png .
1097 KB/s (3403567 bytes in 3.028s)
PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master\Tools\adb>

看看效果:

上面的1.png,是作者的图,后面的2018010201.png是我刚刚截的图。

然后,进入游戏【跳一跳】按照上面的方法截图。

然后回到源码根目录。
正式开始前,还需要装一些python的模块:

PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master> pip install numpy
Collecting numpy
  Downloading numpy-1.13.3-cp36-none-win_amd64.whl (13.1MB)
    100% |████████████████████████████████| 13.1MB 30kB/s
Installing collected packages: numpy
Successfully installed numpy-1.13.3
PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master>

PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master> pip install matplotlib
Collecting matplotlib
  Downloading matplotlib-2.1.1-cp36-cp36m-win_amd64.whl (8.7MB)
    100% |████████████████████████████████| 8.7MB 41kB/s
Collecting six>=1.10 (from matplotlib)
  Downloading six-1.11.0-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 62kB/s
Requirement already satisfied: pytz in c:\program files\python36\lib\site-packages (from matplotlib)
Collecting python-dateutil>=2.0 (from matplotlib)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 24kB/s
Collecting cycler>=0.10 (from matplotlib)
  Downloading cycler-0.10.0-py2.py3-none-any.whl
Requirement already satisfied: numpy>=1.7.1 in c:\program files\python36\lib\site-packages (from matplotlib)
Installing collected packages: six, pyparsing, python-dateutil, cycler, matplotlib
Successfully installed cycler-0.10.0 matplotlib-2.1.1 pyparsing-2.2.0 python-dateutil-2.6.1 six-1.11.0
PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master>

如果不装,你会遇到这样的问题:

PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master> python.exe .\wechat_jump.py
Traceback (most recent call last):
  File ".\wechat_jump.py", line 3, in 
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master>

PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master> python.exe .\wechat_jump.py
Traceback (most recent call last):
  File ".\wechat_jump.py", line 4, in 
    import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master>

PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master> python.exe .\wechat_jump.py
Traceback (most recent call last):
  File ".\wechat_jump.py", line 9, in 
    import cv2
ModuleNotFoundError: No module named 'cv2'
PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master>

或者:pip install -r .\requirements.txt

最后,运行作者代码中的程序就可以看到自动在跳了:

PS D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master> python.exe .\wechat_jump_auto.py
Load config file from D:\搜狗高速下载\wechat_jump_game-master\wechat_jump_game-master/config/1920x1080/config.json
如果你的脚本无法工作,上报issue时请copy如下信息:
**********
Screen: Physical size: 1080x1920
Density: Physical density: 420
DeviceType: ONEPLUS A3000
OS: win32
Python: 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)]
**********
采用方式2获取截图
scan_start_y:  690
1514875883 338 1109 788.5 849
adb shell input swipe 540.0 1584 540.0 1584 724
scan_start_y:  790
1514875886 412 1066 724.0 881
adb shell input swipe 540.0 1584 540.0 1584 504
scan_start_y:  790
1514875889 404 1071 715.0 886
adb shell input swipe 540.0 1584 540.0 1584 503
scan_start_y:  690
1514875892 825 1126 304.0 826
adb shell input swipe 540.0 1584 540.0 1584 836
scan_start_y:  690
1514875897 778 1101 325.0 838
adb shell input swipe 540.0 1584 540.0 1584 729
scan_start_y:  740
1514875900 767 1095 339.5 851
adb shell input swipe 540.0 1584 540.0 1584 685
scan_start_y:  740
1514875903 372 1098 762.0 859
adb shell input swipe 540.0 1584 540.0 1584 636
scan_start_y:  740
1514875906 399 1074 723.0 882
adb shell input swipe 540.0 1584 540.0 1584 524
scan_start_y:  690
1514875910 801 1116 324.0 837
adb shell input swipe 540.0 1584 540.0 1584 769

————————————————————————
Done。

2
说点什么

avatar
2 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Adamhuan Recent comment authors

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

  Subscribe  
提醒
隐藏
变装