Simple color-based action-style plug-ins of tianlong Babu

Source: Internet
Author: User
First, I declare that this article focuses on recording the process of writing such a thing. Because the system has been restored, the address of the accessed technical materials has been lost and cannot be posted to share with you. However, I will attach the source code to the end,CodeI have also made more detailed comments. To operate API Convenient, the code is C ++ ,ProgramThere is no technical content in itself, and most of the content is also from the Internet. In this article, I will not explain the technical aspects too much. Just look at the Code directly for friends who care about keyboard and mouse simulation.
The reason is that a buddy seduce me to play the tianlong Babu game, 3 He started playing tianlong Babu a month ago, and now the role name has appeared on the ranking list, and several of his colleagues are playing. This is undoubtedly a good environment and cannot help but be tempted. After learning about the game, I usually get a helper tool to reduce the workload. When I was playing the conquer journey, I made a simple addition of blood and blue, cast helper skills, and pick up things, I haven't done it before. I want to try it this time. The simplest automatic blame is based on the color, which can be achieved by pressing the key genie. The click-and-click wizard can locate similar images on the Screen Based on the specified image. For image search, it has not been clear how to implement it. In the next article, the wavelet transform is used, I didn't understand it either, Khan. If you do not need images, you can determine the color based on the characteristics of the monster. The feature color is the color only available for monsters on the screen. With this color, we can search for the color of the screen coordinate to compare it with this color. If it is similar enough, we can think of it as a monster, and we can find the coordinates of the monster, the subsequent things will be simple, Attack You can.
Next, we need to refine this general idea. First, we need to search for screen coordinates, and we cannot search for coordinates one by one row by one, 1280*800 How long does it take to scan the resolution. It seems that scanning cannot be performed one by one, so there is a step or span. This is a problem. If you miss the coordinate that is the same as the feature color of the monster, this is missing. For the determination of similar colors, use RGB Comparison is not as useful Hue The latter uses the color, gray, and saturation to represent the color. They are all green. Whether it is dark green or light green, their colors differ little, that is H The value is almost the same, so it is much more convenient for us to use this to judge that the coordinates are not on the monster body. After all, we do not have only one point in the monster feature color, and generally there will be a similar color. In this way, you can ignore 3D The effect of light on color in the game.
The Color comparison scheme is determined. Next, consider the strange scanning method. Focusing on roles, it is best to scan around gradually, so that you can find the strange closest to yourself. In this case, I think twice about it. Generally, games have small maps. On small maps, there are expressions of roles and peripheral monsters. No matter what monsters are, they are the same signs, in addition, there are more monsters to be seen than on the screen, and the small map range is very small, and pixel-by-pixel scanning is also very fast. Therefore, we consider using small maps to find monsters, this involves the conversion of two coordinate systems. One coordinate point is a map role sign, and the other is the center of the screen. It is good to convert the two coordinates, and the retrieval speed will be much faster. It turns out that it is unrealistic to look for blame through a small map, because the coordinate conversion can only come up with a general conversion proportional relationship, which is not accurate, in more cases, you can point to the monster and not to the monster. So we had to scan the monster feature color in the center of the screen and gradually open the span to find the blame. After testing, the effect is acceptable.
The next step is to simulate the mouse and keyboard. The simplest thing to do is to simulate the mouse and keyboard. Mouse_event () And Keyboard_event () Combined Setcursorpos () This is what we did in the past. It wasn't long before it was written. Let's test it, OK And can be used. Returning home in the evening, opening the game, a test, dummies, Setcursorpos can also be used. The mouse is placed on the monster as scheduled, but the mouse_event () is invalid. This is a big blow. Currently, games are plug-ins, which usually block some API functions. As a result, I started to search for information, because C ++ was rarely used and many things were unknown. I checked how the game intercepted the API, checked the injection, how to counter NP, and how to hook the API, I also read windows core programming chapter 19th and Chapter 22nd about DLL and injection, and checked other methods of simulating the mouse and keyboard. Soon A week has passed and it's time to go home for the New Year. API hook Part, one article will be taken out separatelyArticleA simple introduction Vs2005 Examples that can be compiled and run ( PS It takes a lot of time to find a running and clear example on the Internet ).
Years later, I came back quietly and continued to think about it. Now, I have used it. Sendinput () This underlying API , And Winio The driver-level simulation is implemented, but it never works in the game. NP Can be encapsulated into the kernel API Because Winio With a pattern, you can also be NP Closed. Can I write only the mouse driver? No. I started to think about a problem with my thinking path. Since Mouse_event () If it is blocked, why not Setcursorpos () Too? Download, install, and write a simple script to enter the game. After a try, you can click the wizard again. Powered off again 7 Or, you can open the folders of these two programs to find the fast-powered 7 We should have used our own driver-level simulation. Sys File, but the Shortcut Folder contains Winio. dll And VxD File, no corresponding Sys File, DLL The file size is also more than 10 times larger than that downloaded by me. K Is this rewritten by the key wizard? DLL ? Change to the Shortcut Folder Winio Of DLL And VxD It is found that the program can be compiled and run as usual, and the game still does not work. Is it because the Alibaba Cloud security of the key-click genie protects its processes from being injected? At this point, I think we should check whether my program has been injected by the tianlong Babu protection program to intercept the calls of my program. API . As a result, I got an ice blade from the Internet, and the results were shocked. The process of the program was clean, except for being injected by security guards and lingers. This is strange.
Yesterday, I got several mouse and keyboard simulation tools under my anger. Some of them are OK, and some are invalid. At last, a small software with a keyboard, mouse, and keyboard record caught my attention. The software was very small and it was a separate one. EXE And a configuration file with coordinate values and operations Wm_lbuttondown Is this message used? Postmessage () Yes? After trying it out, I am even more confused. While pondering and trying on him, I suddenly found a small detail. During the replay of my mouse button operation, the pressing and popping actions were very clear (the mouse in the game will change as you press the mouse ), A small hand is checked, and my program will not see any action at all, because there is no time interval between the press and the bounce. Add a time interval, Sleep Now 0.1 Second, a try, day, It's okay. If there is something worth reading in my article, it may be here, if you encounter the same problem, you may wish to try it by pressing the button and adding a delay in the middle of the pop-up. This seemingly small, very technical operation really took me most of the time. Program Creation is sometimes so interesting. Speaking of this, there is nothing to say, the program is not complete, there is only a general basic function, there are a few places to temporarily use a simple imperfect indecent solution to be replaced. In addition, if the screen is not strange or the screen is out of the search range, you can first search for a small map to move to the vicinity of the monster and then search for a large map.
The learning and practice of color-based action-style plug-ins can be reached. There are more important and more meaningful things to do, and finally the code is attached, hoping to help you.
Source code: http://files.cnblogs.com/pcant/tlbb.rar

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.