只有两个python文件,代码很简单。

shell.py:

#coding:utf-8
import subprocess
import math
import os def execute_command(cmd):
print('start executing cmd...')
s = subprocess.Popen(str(cmd), stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
stderrinfo, stdoutinfo = s.communicate()
# print('stderrinfo is -------> %s and stdoutinfo is -------> %s' % (stderrinfo, stdoutinfo))
# print('finish executing cmd....')
return s.returncode def jump(time):
execute_command("adb shell input touchscreen swipe 170 187 170 187 " + str(time)) def screen():
execute_command('adb shell screencap -p /sdcard/jump.png')
execute_command('adb pull /sdcard/jump.png ./jump.png') def calcDistance(x1,x2,y1,y2):
return math.sqrt((x1 - x2) * (x1 - x2) + (y1-y2) * (y1-y2))

gui.py:

#coding:utf-8
import os
from time import sleep from shell import calcDistance, jump, screen try:
# for Python2
import Tkinter as tk ## notice capitalized T in Tkinter
except ImportError:
# for Python3
import tkinter as tk ## notice lowercase 't' in tkinter here
from PIL import Image, ImageTk isFirst=True
preX=0
preY=0 def callBack(event):
global isFirst,preX,preY,label,tk_image
# print(event.x_root, event.y_root)
if isFirst:
preX = event.x_root
preY = event.y_root
isFirst= False
else:
print(event.x_root,preX,event.y_root,preY)
distance = calcDistance(event.x_root,preX,event.y_root,preY) time = (int)(distance / 0.35)
jump(time)
isFirst = True
print("distance:" + str(distance) + ",time:" + str(time))
try:
sleep(1)
except Exception as e:
print(e)
screen()
pil_image = Image.open("./jump.png")
# 获取图像的原始大小
w, h = pil_image.size
# 缩放图像让它保持比例,同时限制在一个矩形框范围内
pil_image_resized = resize(w, h, w_box, h_box, pil_image) # 也可以显示缩放后的图像信息,获取大小
wr, hr = pil_image_resized.size
# convert PIL image object to Tkinter PhotoImage object
# 把PIL图像对象转变为Tkinter的PhotoImage对象
tk_image = ImageTk.PhotoImage(pil_image_resized)
label.configure(image=tk_image,width=w_box, height=h_box)
# label = tk.Label(root, image=tk_image, width=w_box, height=h_box) # padx,pady是图像与窗口边缘的距离
# label.pack(padx=5, pady=5) def resize(w, h, w_box, h_box, pil_image):
'''''
resize a pil_image object so it will fit into
a box of size w_box times h_box, but retain aspect ratio
对一个pil_image对象进行缩放,让它在一个矩形框内,还能保持比例
''' f1 = 1.0 * w_box / w # 1.0 forces float division in Python2
f2 = 1.0 * h_box / h
factor = min([f1, f2])
# print(f1, f2, factor) # test
# use best down-sizing filter
width = int(w * factor)
height = int(h * factor)
return pil_image.resize((width, height), Image.ANTIALIAS) root = tk.Tk()
root.title("跳一跳游戏辅助")
# size of image display box you want
# 期望图像显示的大小 screen()#截屏
pil_image = Image.open("./jump.png")
# 获取图像的原始大小
w, h = pil_image.size
w_box = w/2
h_box = h/2
# 缩放图像让它保持比例,同时限制在一个矩形框范围内
pil_image_resized = resize(w, h, w_box, h_box, pil_image) # 也可以显示缩放后的图像信息,获取大小
wr, hr = pil_image_resized.size
# convert PIL image object to Tkinter PhotoImage object
# 把PIL图像对象转变为Tkinter的PhotoImage对象
tk_image = ImageTk.PhotoImage(pil_image_resized)
# put the image on a widget the size of the specified display box
# Label: 这个小工具,就是个显示框,小窗口,把图像大小显示到指定的显示框
label = tk.Label(root, image=tk_image, width=w_box, height=h_box) # padx,pady是图像与窗口边缘的距离
# label.pack(padx=5, pady=5) label.pack()
label.bind("<Button-1>",callBack) root.mainloop()

代码一看就能懂,请使用python3,有可能需要

pip3 install pillow

电脑需要配置adb环境变量到path中,支持mac linux windows等

运行

python3 gui.py

使用方法:

在电脑上先点击自己的位置,再点击目标位置。

(仅供学习参考,微信目前刷分好像不怎么好使了,很多提交不了分数)

原版在https://github.com/qiyeboy/LuLunZi/blob/master/WxJmp/,只支持windows,本文修改后的代码支持其他平台了。

微信小游戏跳一跳简单手动外挂(基于adb 和 python)的更多相关文章

  1. 用Kotlin破解Android版微信小游戏-跳一跳

    前言 微信又更新了,从更新日志上来看,似乎只是一次不痛不痒的小更新.不过,很快就有人发现,原来微信这次搞了个大动作——在小程序里加入了小游戏.今天也是朋友圈被刷爆的缘故. 看到网上 有人弄了一个破解版 ...

  2. 微信小游戏“跳一跳”,Python“外挂”已上线

    微信又一次不声不响地搞了个大事情: “小游戏”上线了! 于是,在这辞旧迎新的时刻,毫无意外的又火了. 今天有多少人刷了,让我看到你们的双手! 喏,我已经尽力了…… 不过没关系,你们跳的再好,在毫无心理 ...

  3. 微信小程序 跳一跳 外挂 C# winform源码

    昨天微信更新了,出现了一个小游戏“跳一跳”,玩了一下 赶紧还蛮有意思的 但纯粹是拼手感的,玩了好久,终于搞了个135分拿了个第一名,没想到过一会就被朋友刷下去了,最高的也就200来分把,于是就想着要是 ...

  4. 手把手教你玩微信小程序跳一跳

    最近微信小程序火的半边天都红了,虽然不会写,但是至少也可以仿照网上大神开发外挂吧!下面手把手教妹纸们(汉纸们请自觉的眼观耳听)怎么愉快的在微信小游戏中获得高分. 废话不多说,咱们这就发车了!呸!咱们这 ...

  5. 微信小程序跳一跳辅助程序(手动版)

    最近,微信官方推出了demo小程序游戏<跳一跳>,这个游戏操作简单,容易上手,却又不容易获得高分,受到很多人的喜爱(emm...这游戏有毒).自己也尝试了玩了几次,作为一个手残+脑残的资深 ...

  6. 利用python实现微信小程序游戏跳一跳详细教程

    利用python实现微信小程序游戏跳一跳详细教程 1 先安装python 然后再安装pip <a href="http://newmiracle.cn/wp-content/uploa ...

  7. python--微信小程序“跳一跳‘外挂

    参考网站:http://blog.csdn.net/LittleBeautiful/article/details/78955792 0x00:准备工具: Windows 10: 一个安卓真机 pyt ...

  8. Egret白鹭开发微信小游戏程序跳转功能(由一个小游戏跳转到另一个小游戏)

    假设我们要实现的功能是从小游戏A跳转到小游戏B 对于小游戏A: (1)在platform.ts中添加代码如下: /** * 平台数据接口. * 由于每款游戏通常需要发布到多个平台上,所以提取出一个统一 ...

  9. 微信小游戏 Three.js UI 2D text 简单方案

    在微信小游戏中使用 THREE.js 引擎,没有合适的 UI 库可用,只能自己动手.图片啥的都还好,text 不好弄.text 要计算 width 和 height,不然事件响应范围不对. funct ...

随机推荐

  1. GOF提出的23种设计模式是哪些 设计模式有创建形、行为形、结构形三种类别 常用的Javascript中常用设计模式的其中17种 详解设计模式六大原则

    20151218mark 延伸扩展: -设计模式在很多语言PHP.JAVA.C#.C++.JS等都有各自的使用,但原理是相同的,比如JS常用的Javascript设计模式 -详解设计模式六大原则 设计 ...

  2. Java驱动远程连接mongoDB(简明易懂版)

    mongodb默认是不能远程连接的,而且在linux安装完你会发现,它的目录极其简单,连个配置文件都没有. 我的mongodb的版本是3.6,目前最新的.https://www.mongodb.com ...

  3. Centos7.4修改主机名HostName颜色及格式

    一.打开 .bashrc文件 1.位置:~(cd ~)目录下 2.cat .bashrc 原文件内容如下: # .bashrc # User specific aliases and function ...

  4. Gin框架使用详解

    1.什么是Gin Gin是go编写的一个web应用框架. 2.Gin安装 go get github.com/gin-gonic/gin 3.Gin使用示例 package main import ( ...

  5. 谈一谈iOS事件的产生和传递

    谈一谈iOS事件的产生和传递 1.事件的产生 发生触摸事件后,系统会将该事件加入到一个由UIApplication管理的事件队列中. UIApplication会从事件队列中取出最前面的事件,并将事件 ...

  6. 【iCore4 双核心板_uC/OS-II】例程四:软件定时器

    一.实验说明: 一些应用程序执行它们的任务时需要延迟一段特定的时间,因此uC/OS-II为我们提供了一些相应的 延时函数,本例程我们使用软件定时器定时500ms点亮相应的LED实现三色LED循环闪烁. ...

  7. httpie的使用

    安装 brew install httpie 使用 模拟提交表单 http -f POST yhz.me username=nate 显示详细的请求 http -v yhz.me 只显示Header ...

  8. C语言 · 猜算式 · 乘法竖式

    题目:猜算式 你一定还记得小学学习过的乘法计算过程,比如: 273 x   15 ------ 1365 273 ------ 4095 请你观察如下的乘法算式 *** x   *** ------- ...

  9. hdoj:2053

    #include <iostream> #include <string> #include <vector> using namespace std; /* 无穷 ...

  10. DTD约束简介

    DTD约束简介 文档类型声明 文档类型声明就是DOCTYPE,它告诉解析器,XML文档必须遵循DTD定义.同时,他也告诉解析器,到哪里找到文档定义的其余内容.在前边的例子里DOCTYPE很简单: &l ...