非注入方式,打开了多少个游戏并且排列好之后,系统模拟一个个点击游戏打开,然后进行会话或者进行技能的释放。
#include<iostream>
#include<Windows.h>
#include<winuser.h>
#include<string>
#include<vector>
#include <fstream>
#include <sstream>
#define _CRT_SECURE_NO_WARNINGS
using namespace std;
ifstream openin;
ofstream openout;
//删除账号记录
void delAccount() {
keybd_event(0x11, 0, 0, 0); //按住ctrl
keybd_event(65, 0, 0, 0); //按住A
Sleep(500);
keybd_event(0x11, 0, KEYEVENTF_KEYUP, 0); //释放V
keybd_event(65, 0, KEYEVENTF_KEYUP, 0); //释放ctrl
keybd_event(0x2E, 0, 0, 0); //按住DEL
keybd_event(0x2E, 0, KEYEVENTF_KEYUP, 0); //释放DEL
}
//按键盘常用的,不要大写
void OnclickKey(char k) {
int r = 0; //定义真实的按键
switch (k) {
case '0':r = 0x60; break; case '1':r = 0x61; break;
case '2':r = 0x62; break; case '3':r = 0x63; break;
case '4':r = 0x64; break; case '5':r = 0x65; break;
case '6':r = 0x66; break; case '7':r = 0x67; break;
case '8':r = 0x68; break; case '9':r = 0x69; break;
case 'a':r = 65; break;
case 'b':r = 66; break;
case 'c':r = 67; break;
case 'd':r = 68; break;
case 'e':r = 69; break;
case 'f':r = 70; break;
case 'g':r = 71; break;
case 'h':r = 72; break;
case 'i':r = 73; break;
case 'j':r = 74; break;
case 'k':r = 75; break;
case 'l':r = 76; break;
case 'm':r = 77; break;
case 'n':r = 78; break;
case 'o':r = 79; break;
case 'p':r = 80; break;
case 'q':r = 81; break;
case 'r':r = 82; break;
case 's':r = 83; break;
case 't':r = 84; break;
case 'u':r = 85; break;
case 'v':r = 86; break;
case 'w':r = 87; break;
case 'x':r = 88; break;
case 'y':r = 89; break;
case 'z':r = 90; break;
default:r = 0; break;
}
if (r > 0) {
keybd_event(r, 0, 0, 0); Sleep(100); keybd_event(r, 0, KEYEVENTF_KEYUP, 0);
}
else {
}
}
int main() {
int login = 0; //1要登录0不要
int body = 0; //1要说话0不要
int pk = 0; //1需要pk0不需要
cout << "说明:账号密码请不要设置大写和特殊字符,只支持英文a-z和数字0-9,同时请不要勾选密码保存" << endl;
cout << "说明:配置设置不要超过32个" << endl;
cout << "说明:账号密码设置不要超过32个" << endl;
cout << "说明:密码请不要设置大写" << endl;
cout << "说明:请确保菜单栏左下角只有系统的开始按钮没有其他任何应用,否则会失效" << endl;
cout << "----------------------------------" << endl <<"请输入想做的事情::" << endl;
cout << "1:登录账号请按1" << endl; //打开游戏并且
cout << "2:直接说话请按2(系统会强制根据脚本进行循环说话)" << endl;
cout << "3:释放技能请按5(F1-F4为控制,F5为主要技能,F5的主要技能请设置套装不要单独放技能)" << endl;
int cinStatus;
cin >> cinStatus;
switch (cinStatus) {
case 1: login = 1; break;
case 2: body = 1; break;
case 3: pk = 1; break;
default:
cout << "您的选择不正确,系统将强制关闭" << endl;
return 0;
break;
}
int config_1 = 3000; //配置1,启动延时
int config_2 = 2000; //配置2,回车延时
int config_3 = 2000; //配置3,粘贴延时
int config_4 = 50; //每一次宽度的移动增加数
int config_5 = 70; //宽度的初始位置
int config_6 = 1050; //高度的初始位置,注意这个是不变的
int config_7 = 500; //自动tab的间距
int config_8 = 10000; //多少秒切换一次说话最小值,目前10秒
int config_9 = 100000; //最大10秒
vector<string>account = {}; //账号
vector<string>password = {};//密码
vector<string>strArray = {}; //说的话
int OpenDebug = 0; //1=调试模式,使用开发系统里面的配置,0为使用当前目录的
string config_ini; //配置文件。完成之后才弄到绝对目录
string account_ini; //配置文件。完成之后才弄到绝对目录
string body_ini;
string game_dir;
config_ini = "config.ini"; //配置文件。完成之后才弄到绝对目录
account_ini = "account.ini"; //配置文件。完成之后才弄到绝对目录
body_ini = "body.ini";
//------------------------------------------->载入配置文件
openin.open(config_ini);//帐号保存
openin >> config_1 >> config_2 >> config_3 >> config_4 >> config_5 >> config_6 >>config_7 >> config_8 >> config_9 >> game_dir;
cout << "读取系统配置设置:" << config_1 << "--" << config_2 << "--" << config_3 << "--" << config_4 << "--" << config_5 << "--" << config_6 <<"--" <<config_7 <<"--" << config_8 << "--" << config_9 <<"--"<<game_dir << endl;
openin.close(); //关闭当前文件
char aa[32];
openin.open(account_ini); //打开用户的配置文件
string openin_data;
while(true){
openin >> aa;
openin_data = aa;
string temp_a_c_s = openin_data.substr(8);
if (strstr(aa, "account:")) {
account.push_back(temp_a_c_s); //push_back string格式好像不行,改用char
}
if (strstr(aa, "accopas:")) {
password.push_back(temp_a_c_s);
}
if (strstr(aa, "QingXinZuithisisendini")) {
cout << "导入账号结束" << endl;
break;
}
}
openin.close(); //关闭当前文件
if (account.size() != password.size()) {
cout << "账号密码数量不匹配" << endl;
return 0;
}
openin.open(body_ini); //打开用户的配置文件
while (true) {
openin >> aa;
string openin_data = aa;
if (strstr(aa, "QingXinZuithisisendini")) {
cout << "导入话术结束" << endl;
break;
}
else {
strArray.push_back(aa);
}
}
openin.close(); //关闭当前文件
//------------------------------------------->载入聊天语句
for (int ac = 0; ac < account.size(); ac++) {
cout << "【载入账号】:" << account[ac] << "【对应密码】:" << password[ac] << endl;
}
for (int ac = 0; ac < strArray.size(); ac++) {
cout << "【载入会话】:" << strArray[ac] << endl;
}
int max_user_account = account.size(); //用户数量
int default_start_width = config_5; //初始值要高一点 1920 -55
int start_height = config_6; //
int start_width = default_start_width;
int sum = 0; //总输出语句
Sleep(config_1); //启动延迟5秒
int temp_account = 0; //记录循环的账号
HWND hWnd = NULL; //粘贴板初始化定义,无需重复定义
char* pData;
HANDLE hHandle; //
//执行登录
if (login == 1) {
temp_account = 0; //登录完成,记得要把temp_account = 0设置初始值
start_width = default_start_width; //重新设置开始的宽度,即菜单选项栏目
for (int tp = 0; tp < account.size(); tp++) {
if (temp_account >= max_user_account) {
temp_account = 0; //归0
start_width = default_start_width; //重新设置开始的宽度,即菜单选项栏目
}
temp_account++; //
//选中游戏框
cout << "移动鼠标到位置高:"<< start_height<<"宽:"<<start_width << endl;
SetCursorPos(start_width, start_height); //移动到对应位置
start_width = (start_width + config_4); //每一栏应该都是50
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); //左键点击
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //左键收回
//使用上档+tab切换到输入账号入口
Sleep(config_2);
keybd_event(0x10, 0, 0, 0); //按住shift
keybd_event(0x9, 0, 0, 0); //按住tab
Sleep(config_2);
keybd_event(0x10, 0, KEYEVENTF_KEYUP, 0); //释放shift
keybd_event(0x9, 0, KEYEVENTF_KEYUP, 0); //释放tab
Sleep(config_2);
//---------------------------------------->复制账号
//先进行清空动作
delAccount();
OpenClipboard(hWnd);//打开剪切板
EmptyClipboard();//清空剪切板
hHandle = GlobalAlloc(GMEM_FIXED, 1000);//分配内存
pData = (char*)GlobalLock(hHandle);//锁定内存,返回申请内存的首地址
strcpy_s(pData, 1000,account[tp].c_str());//或strcpy(pData, "this is a ClipBoard Test."); //str.c_str()
SetClipboardData(CF_TEXT, hHandle);//设置剪切板数据
GlobalUnlock(hHandle);//解除锁定
CloseClipboard();//关闭剪切板
//----------------------------------------> 粘贴账号
keybd_event(0x11, 0, 0, 0); //按住ctrl
keybd_event(86, 0, 0, 0); //按住V
Sleep(config_2);
keybd_event(0x11, 0, KEYEVENTF_KEYUP, 0); //释放V
keybd_event(86, 0, KEYEVENTF_KEYUP, 0); //释放ctrl
Sleep(100);
keybd_event(0xD, 0, 0, 0); //按住回车
keybd_event(0xD, 0, KEYEVENTF_KEYUP, 0); //释放回车
Sleep(500); //输入完账号,要按回车登录
//密码直接输入
for (int t_p = 0; t_p < password[tp].length(); t_p++) {
OnclickKey(password[tp][t_p]); //
}
cout << "登录账号:" << account[tp] << endl;
Sleep(100); //登录
keybd_event(0xD, 0, 0, 0); //按住回车,进入输入状态,不需要释放
keybd_event(0xD, 0, KEYEVENTF_KEYUP, 0);
Sleep(1000); //延迟1秒 进入下一个登录框
//return 0;
}
}
int bodySleepRand = 1000; //默认间隔1秒喊话,考虑可能会被封号
//聊天辅助
if (body == 1) {
temp_account = 0; //登录完成,记得要把temp_account = 0设置初始值
start_width = default_start_width; //重新设置开始的宽度,即菜单选项栏目
while (true) {
for (const std::string& str : strArray) {
if (temp_account >= max_user_account) {
temp_account = 0; //归0
start_width = default_start_width; //重新设置开始的宽度,即菜单选项栏目
}
temp_account++; //
cout << "移动鼠标到位置高:" << start_height << "宽:" << start_width << endl;
//向剪贴板中写入数据
//HWND hWnd = NULL;
OpenClipboard(hWnd);//打开剪切板
/***********************剪贴板开始***********************/
EmptyClipboard();//清空剪切板
hHandle = GlobalAlloc(GMEM_FIXED, 1000);//分配内存
pData = (char*)GlobalLock(hHandle);//锁定内存,返回申请内存的首地址
strcpy_s(pData, 1000, str.c_str());//或strcpy(pData, "this is a ClipBoard Test.");
SetClipboardData(CF_TEXT, hHandle);//设置剪切板数据
GlobalUnlock(hHandle);//解除锁定
CloseClipboard();//关闭剪切板
/***********************剪贴板结束***********************/
//打开对应的窗体
SetCursorPos(start_width, start_height); //移动到对应位置
start_width = (start_width + config_4); //每一栏应该都是50
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); //左键点击
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //左键收回
SetCursorPos(100, 100); //打开了就临时把鼠标移开
/**********************复制内容开始**********************/
//回车108题换:0xD
Sleep(config_2);
keybd_event(0xD, 0, 0, 0); //按住回车,进入输入状态,不需要释放
keybd_event(0xD, 0, KEYEVENTF_KEYUP, 0);
Sleep(config_2);
keybd_event(0x11, 0, 0, 0); //按住ctrl
keybd_event(86, 0, 0, 0); //按住V
Sleep(config_2);
keybd_event(0x11, 0, KEYEVENTF_KEYUP, 0); //释放V
keybd_event(86, 0, KEYEVENTF_KEYUP, 0); //释放ctrl
Sleep(config_2);
keybd_event(0xD, 0, 0, 0); //按住回车
keybd_event(0xD, 0, KEYEVENTF_KEYUP, 0); //释放回车
Sleep(config_2);
//这里第二次时间比较短,主要可能已经打开来了
keybd_event(0x11, 0, 0, 0); //按住ctrl
keybd_event(86, 0, 0, 0); //按住V
Sleep(config_3);
keybd_event(0x11, 0, KEYEVENTF_KEYUP, 0); //释放V
keybd_event(86, 0, KEYEVENTF_KEYUP, 0); //释放ctrl
Sleep(config_3);
keybd_event(0xD, 0, 0, 0); //按住回车
keybd_event(0xD, 0, KEYEVENTF_KEYUP, 0); //释放回车
Sleep(config_2);
sum++;
cout << "当前已经喊话:" << sum << "次" << endl;
bodySleepRand = rand() % config_9 + config_8;
Sleep(bodySleepRand);
}
}
}
//攻击辅助
if (pk == 1) {
temp_account = 0; //登录完成,记得要把temp_account = 0设置初始值
start_width = default_start_width; //重新设置开始的宽度,即菜单选项栏目
int kill = 1; //默认的
int killKeyUpSleep = 0; //每次按下和松开键盘的时间
int killrand = 10;
int killKeyUpSleepDefault = 500; //默认识
while (true) {
for (int tp = 0; tp < account.size(); tp++) {
if (temp_account >= max_user_account) {
temp_account = 0; //归0
start_width = default_start_width; //重新设置开始的宽度,即菜单选项栏目
}
temp_account++; //
//选中游戏框
cout << "移动鼠标到位置高:" << start_height << "宽:" << start_width << endl;
SetCursorPos(start_width, start_height); //移动到对应位置
start_width = (start_width + config_4); //每一栏应该都是50
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); //左键点击
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //左键收回
Sleep(config_2); //进入对应游戏
keybd_event(0x9, 0, 0, 0); //按住tab锁人
keybd_event(0x9, 0, KEYEVENTF_KEYUP, 0); //释放tab
Sleep(500); // tab延迟以下
keybd_event(0x9, 0, 0, 0); //按住tab锁人
keybd_event(0x9, 0, KEYEVENTF_KEYUP, 0); //释放tab
Sleep(500); // tab延迟以下
killrand = rand() % 200 + 10; //获取随机数
killKeyUpSleep = 0; //初始化=0
killKeyUpSleep = (killKeyUpSleepDefault + killrand); //获取实际按键的时间
switch (kill) {
case 1:
keybd_event(0x74, 0, 0, 0); Sleep(killKeyUpSleep); keybd_event(0x74, 0, KEYEVENTF_KEYUP, 0); Sleep(config_7);//按F5 主要技能
keybd_event(0x70, 0, 0, 0); Sleep(killKeyUpSleep); keybd_event(0x70, 0, KEYEVENTF_KEYUP, 0); //按F1
break;
case 2:
keybd_event(0x74, 0, 0, 0); Sleep(killKeyUpSleep); keybd_event(0x74, 0, KEYEVENTF_KEYUP, 0); Sleep(config_7);//按F5 主要技能
keybd_event(0x71, 0, 0, 0); Sleep(killKeyUpSleep); keybd_event(0x71, 0, KEYEVENTF_KEYUP, 0); //按F2
break;
case 3:
keybd_event(0x74, 0, 0, 0); Sleep(killKeyUpSleep); keybd_event(0x74, 0, KEYEVENTF_KEYUP, 0); Sleep(config_7);//按F5 主要技能
keybd_event(0x72, 0, 0, 0); Sleep(killKeyUpSleep); keybd_event(0x72, 0, KEYEVENTF_KEYUP, 0); //按F3
break;
case 4:
keybd_event(0x74, 0, 0, 0); Sleep(killKeyUpSleep); keybd_event(0x74, 0, KEYEVENTF_KEYUP, 0); Sleep(config_7);//按F5 主要技能
keybd_event(0x73, 0, 0, 0); Sleep(killKeyUpSleep); keybd_event(0x73, 0, KEYEVENTF_KEYUP, 0); //按F4
break;
default:
keybd_event(0x74, 0, 0, 0); Sleep(killKeyUpSleep); keybd_event(0x74, 0, KEYEVENTF_KEYUP, 0); //按F5 主要技能
break;
}
kill++;
if (kill > 4) {
kill = 1;
}
Sleep(1000); //延迟2秒下一个
}
}
}
return 0;
}
更多的按键说明:
字母和数字键 数字小键盘的键 功能键 其它键
键 键码 键 键码 键 键码 键 键码
A 65 0 96 F1 112 Backspace 8
B 66 1 97 F2 113 Tab 9
C 67 2 98 F3 114 Clear 12
D 68 3 99 F4 115 Enter 13
E 69 4 100 F5 116 Shift 16
F 70 5 101 F6 117 Control 17
G 71 6 102 F7 118 Alt 18
H 72 7 103 F8 119 Caps Lock 20
I 73 8 104 F9 120 Esc 27
J 74 9 105 F10 121 Spacebar 32
K 75 * 106 F11 122 Page Up 33
L 76 + 107 F12 123 Page Down 34
M 77 Enter 108 -- -- End 35
N 78 - 109 -- -- Home 36
O 79 . 110 -- -- Left Arrow 37
P 80 / 111 -- -- Up Arrow 38
Q 81 -- -- -- -- Right Arrow 39
R 82 -- -- -- -- Down Arrow 40
S 83 -- -- -- -- Insert 45
T 84 -- -- -- -- Delete 46
U 85 -- -- -- -- Help 47
V 86 -- -- -- -- Num Lock 144
W 87
X 88
Y 89
Z 90
0 48
1 49
2 50
3 51
4 52
5 53
6 54
7 55
8 56
9 57
0x1 鼠标左键
0x2 鼠标右键
0x3 CANCEL 键
0x4 鼠标中键
0x8 BACKSPACE 键
0x9 TAB 键
0xC CLEAR 键
0xD ENTER 键
0x10 SHIFT 键
0x11 CTRL 键
0x12 MENU 键
0x13 PAUSE 键
0x14 CAPS LOCK 键
0x1B ESC 键
0x20 SPACEBAR 键
0x21 PAGE UP 键
0x22 PAGE DOWN 键
0x23 END 键
0x24 HOME 键
0x25 LEFT ARROW 键
0x26 UP ARROW 键
0x27 RIGHT ARROW 键
0x28 DOWN ARROW 键
0x29 Select 键
0x2A PRINT SCREEN 键
0x2B EXECUTE 键
0x2C SNAPSHOT 键
0x2D Insert 键
0x2E Delete 键
0x2F HELP 键
0x90 NUM LOCK 键
A 至 Z 键与 A – Z 字母的 ASCII 码相同:
值 描述
65 A 键
66 B 键
67 C 键
68 D 键
69 E 键
70 F 键
71 G 键
72 H 键
73 I 键
74 J 键
75 K 键
76 L 键
77 M 键
78 N 键
79 O 键
80 P 键
81 Q 键
82 R 键
83 S 键
84 T 键
85 U 键
86 V 键
87 W 键
88 X 键
89 Y 键
90 Z 键
0 至 9 键与数字 0 – 9 的 ASCII 码相同:
值 描述
48 0 键
49 1 键
50 2 键
51 3 键
52 4 键
53 5 键
54 6 键
55 7 键
56 8 键
57 9 键
下列常数代表数字键盘上的键:
值 描述
0x60 0 键
0x61 1 键
0x62 2 键
0x63 3 键
0x64 4 键
0x65 5 键
0x66 6 键
0x67 7 键
0x68 8 键
0x69 9 键
0x6A MULTIPLICATION SIGN (*) 键
0x6B PLUS SIGN (+) 键
0x6C ENTER 键
0x6D MINUS SIGN (–) 键
0x6E DECIMAL POINT (.) 键
0x6F DIVISION SIGN (/) 键
下列常数代表功能键:
值 描述
0x70 F1 键
0x71 F2 键
0x72 F3 键
0x73 F4 键
0x74 F5 键
0x75 F6 键
0x76 F7 键
0x77 F8 键
0x78 F9 键
0x79 F10 键
0x7A F11 键
0x7B F12 键
0x7C F13 键
0x7D F14 键
0x7E F15 键
0x7F F16 键
0 None
3 Cancel(Break)
8 Back
9 Tab
13 Return
16 ShiftKey
17 ControlKey
18 Menu
19 Pause
20 Capital(大小写)
27 Escape
32 Space
33 PageUp
34 Next(PageDonw)
35 End
36 Home
37 Left
38 Up
39 Right
40 Down
0-9 48-57
45 Insert
46 Delete
65->90 A->Z
91 LWin
93 Apps
96 105 NumPad0-
106 Multiply *
107 Add+
108
109 Subtract-
110 Decimal .
111 Divide /
112-123 F1-F12
144 NumLock
145 Scroll
173 VolumeMute
174 VolumeDown
175 VolumeUp
186 Oem1 ;
187 Oemplus =
188 Oemcomma ,
189 OemMinus -
190 OemPeriod .
191 OemQuestion /
192 Oemtilde `
219 OemOpenBrackets [
220 Oem5 /
221 Oem6 ]
222 Oem7
关于作者