How to use. Net to play WeChat and. Net to play WeChat

Source: Internet
Author: User

Teach you how to use. Net to play a hop, and use. Net to play a letter hop

All the code developed at present has been uploaded to GitHub. Welcome to Star

Https://github.com/GiantLiu/AutoJump

Currently, programs are divided into "fully automated version" and "semi-automated version"

Fully automated version

WeChat. AutoJump. Publish app

When the phone is connected, start the hop

Click Start game. Run this program. You can achieve automatic jump.

Semi-automatic version

WeChat. AutoJump. WinApp

In this version, you need to left-click the bottom of the blacklist and right-click the center of the target.

Then the program automatically jumps to the corresponding location.

 

Program Principle
1. Click the cell phone to the "jump" applet interface. After clicking "Start game ",
2. Use the Adb tool to obtain the current mobile phone and download it to the local device.
3.1. For semi-automatic version, you need to use the left and right mouse keys to click the start and target positions.
Then, the program automatically calculates the distance to beat and the time to click the screen.
3.2. If it is a fully automated version, the program will automatically calculate the location of the little black and the center of the target,
Then, the distance and the time when the screen is clicked are automatically calculated.

4. Use the Adb tool to send a click screen power-saving command to the mobile phone to complete a beating.

Currently, the program only supports Android devices, and IOS devices only write interfaces, which are not implemented yet.
Steps:

  • Enable USB debugging for Android phones, set developer options, and debug USB
  • Connect your computer to your mobile phone using USB cables.adb devicesYou can find the device id

  • Go to the jump game page and click Start game.
    Run the automatic/semi-automatic version program to start the game

  •  

Key code implementations
1. Using adb to get the screen of the mobile phone is actually sending related commands to the mobile phone

The first command is to save the screen in png format to the SD card of the mobile phone.
The second command is to download the image in the SD card of the mobile phone to the corresponding directory of the local hard disk.
The third command is to delete the phone
The fourth command is to send the screen pressing command from X: 100, Y: 100 to the X200, Y: 200 position, where the time is 500 milliseconds.

adb shell screencap -p /sdcard/1.pngadb pull /sdcard/1.png D:/Download/adb shell rm /sdcard/1.pngadb shell input swipe 100 100 200 200 500

Here is the. net sending command code

Public string AdbCommand (string arg) {using (Process process = new Process () {var adbDirectoryPath = Path. combine (AppDomain. currentDomain. baseDirectory, "AndoridAdb"); var adbPath = Path. combine (adbDirectoryPath, "adb.exe"); process. startInfo. fileName = adbPath; process. startInfo. arguments = arg; process. startInfo. useShellExecute = false; process. startInfo. redirectStandardInput = true; // redirect standard input process. startInfo. redirectStandardOutput = true; // rewrite standard output process. startInfo. redirectStandardError = true; // redirect error output process. startInfo. createNoWindow = true; process. start (); var result = process. standardOutput. readToEnd (); process. waitForExit (); process. close (); return result ;}}View Code

2. If the version is semi-automated, You need to click the bottom of the black guy with the left mouse button, and then right-click the middle of the point target.
Right click. The program automatically calculates the distance and time between two points. Then, let's take a step. There is no technical problem.

3. If it is a fully automated version, the first step is to get the screen. Analyze the location of a black man
Here I am. EmguCV is used (called by. net of OpenCV ).
We can use OpenCV template matching. MatchTemplate Method
Template. Find a screen and use PS to buckle the black man. Save it as an image.
MatchTemplate will find the matching highest point. Then the coordinates are given, so that we can calculate the central position of the little black man.

Var tempGrayPath = Path. combine (AppDomain. currentDomain. baseDirectory, "Template", "Current.png"); var tempGrayImg = new Image <Rgb, byte> (tempGrayPath); var match = img. matchTemplate (tempGrayImg, TemplateMatchingType. ccorrNormed); double min = 0, max = 0; Point maxp = new Point (0, 0); // Point minp = new Point (0, 0) that best matches ); cvInvoke. minMaxLoc (match, ref min, ref max, ref minp, ref maxp); Console. writeLine (min + "" + max); CvInvoke. rectangle (img, new Rectangle (maxp, new Size (tempGrayImg. width, tempGrayImg. height), new MCvScalar (0, 0,255), 3); var startPoint = new Point (); startPoint. X = maxp. X + (int) (tempGrayImg. width/2.0); startPoint. Y = maxp. Y + tempGrayImg. height-2; CvInvoke. rectangle (img, new Rectangle (startPoint, new Size (1, 1), new MCvScalar (0, 0, 0), 3 );View Code


4. Target Location Calculation,
This is also the most complex part of the program,
My implementation steps are as follows:
1: first crop the image to only retain the valid 1/3 analysis area in the middle.
2: Check whether the black man is on the left or right of the screen. Then the target will be in the opposite area. In this way, we can cut down the image in the target area.

//// Crop the search area. /// the original image is smaller than 1/3, and var newImgStart = imgHeightSplit; var newImgEnd = maxp. Y + tempGrayImg. height; var newImgHeight = newImgEnd-newImgStart; Rectangle rect = new Rectangle (0, newImgStart, img. width, newImgHeight); CvInvoke. cvSetImageROI (sourceImg, rect); var newImg = new Image <Rgb, byte> (sourceImg. width, newImgHeight); CvInvoke. cvCopy (sourceImg, newImg, IntPtr. zero); //// check whether the black man is on the left or right of the program. /// if it is on the left, the target point is on the right of the image. bool targetInLeft = true; if (maxp. X <strong) targetInLeft = false; Rectangle halfRect; if (targetInLeft) halfRect = new Rectangle (0, 0, imgWidthCenter, newImgHeight); else halfRect = new Rectangle (imgWidthCenter, 0, imgWidthCenter, newImgHeight); CvInvoke. cvSetImageROI (newImg, halfRect); var halfImg = new Image <Rgb, byte> (imgWidthCenter, newImgHeight); CvInvoke. cvCopy (newImg, halfImg, IntPtr. zero );View Code

 

5. Then, we can use pixel analysis to find the target vertex.
The principle is: Compare the first vertex with the last vertex to see the change size.
If the variation size exceeds one value. It is regarded as the target position (the hop background is gradient)
Here is the square point. A vertex is a vertex. When the target is a circle
The Y axes of several pixels on the top are the same. Then we need to find several identical ones. Calculates the intermediate position as a vertex.

Point topPoint = new Point (); for (int I = 0; I

 

Related points are found. Calculating the distance between a black man and the target is not difficult.
The next step is to send the hop command.

 



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.