C++//#pragma GCC optimize("Ofuck")
//#include<bits/stdc++.h>
#include<windows.h>
#include<iostream>
#include<map>
#include<queue>
#include<ctime>
#include<thread>
#include<iomanip>
#define tab VK_TAB
#define space VK_SPACE
#define mouse_l VK_LBUTTON
#define mouse_r VK_RBUTTON
#define mouse_m VK_MBUTTON
#define shift VK_SHIFT
#define control VK_CONTROL
#define soh GetStdHandle(STD_OUTPUT_HANDLE)
#define sih GetStdHandle(STD_INPUT_HANDLE)
#define scta(x) SetConsoleTextAttribute(soh,(x))
#define fgis FOREGROUND_INTENSITY
#define lp key(mouse_l)
#define nukecheck if(nukeflag) continue
using namespace std;
queue<double>q;
double s,maxc,cps,mode;
const string dc="cyan";
const string pc="violet";
bool ac,keyflag=1,changeac,cases[20],nukeflag;
int on=2,pf=-1,cclear,sf=1,spaceclif;
POINT pos;
double clickspeed=10.0;
POINT curpos;
bool key(int i){return GetAsyncKeyState(i)&0x8000;}
void scroll_ing(bool f){//1是上,2是下
if(!key(shift)) return;
if(f) clickspeed*=1.067;
else clickspeed/=1.067;
if(clickspeed>500) clickspeed=500;
if(clickspeed<0.1) clickspeed=0.1;
}
void scroll_check(){//开始检测鼠标滚轮滚动
HHOOK hook=SetWindowsHookEx(WH_MOUSE_LL,[](int nCode,WPARAM wParam,LPARAM lParam){
if(nCode>=0&&wParam==WM_MOUSEWHEEL){
short delta=GET_WHEEL_DELTA_WPARAM(((MSLLHOOKSTRUCT*)lParam)->mouseData);
scroll_ing(delta>0);
}
return CallNextHookEx(0,nCode,wParam,lParam);
},0,0);
MSG msg;
while(GetMessage(&msg,0,0,0)){
TranslateMessage(&msg);
DispatchMessage(&msg);
Sleep(100);
}
UnhookWindowsHookEx(hook);
}
POINT getpos(){//获取鼠标位置
HWND hwnd = GetConsoleWindow();
SetWindowLongPtr(hwnd, GWL_EXSTYLE,
GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_NOACTIVATE);
HWND consoleHWND = GetConsoleWindow();
RECT rect;
POINT ret;
if (GetWindowRect(consoleHWND, &rect)) {
ret.x=rect.left;
ret.y=rect.top;
curpos.x=rect.left;
curpos.y=rect.top;
}
return ret;
}
void print(string s,int sleep=1){
for(int i=0;i<s.size();i++){
cout<<s[i];
Sleep(sleep);
}
return;
}
void move(int x,int y){SetCursorPos(x,y);}
void click_check(){ //点击速度的计算(检测点击
while(1){
Sleep(20);
if(key(mouse_l)||key(mouse_r)||key(mouse_m)){
while((key(mouse_l)||key(mouse_r)||key(mouse_m)));
q.push(clock());
}
}
}
void presskey(int keyCode) { //按下某个按键并松开
keybd_event(keyCode, 0, 0, 0);
keybd_event(keyCode, 0, KEYEVENTF_KEYUP, 0);
}
void go(int col,int line){//光标去到某位置
COORD p;
p.X=col;
p.Y=line;
SetConsoleCursorPosition(soh,p);
}
void color(int front,int behind=0){//调整颜色
//0 = 黑色 2 = 绿色 14 = 淡黄色 15 = 亮白色
WORD wColor=((behind&0x0F)<<4)+(front&0x0F);
scta(wColor);
}
void setcolor(string str){//调整字体颜色
if(str=="lightblue") scta(fgis|1);
if(str=="lightred") scta(fgis|FOREGROUND_RED);
if(str=="violet") scta(fgis | FOREGROUND_RED | FOREGROUND_BLUE);
if(str=="cyan") scta(fgis | FOREGROUND_GREEN | FOREGROUND_BLUE);
if(str=="blue") scta(FOREGROUND_BLUE);
if(str=="red") scta(FOREGROUND_RED);
if(str=="yellow") scta(FOREGROUND_RED | FOREGROUND_BLUE);
else return;
}
namespace std{ //所有常量
const int poss[][5]={{11,45,14},
{60,75,129,127},{130,75,182,127},{183,75,240,127},{241,75,297,127},
{298,75,353,127},{354,75,410,127},{60,140,145,190},{146,140,202,190},
{203,140,258,190},{259,140,314,190},{315,140,370,190},{60,200,123,255},
{124,200,415,255}
};
const int keycol[114]={0,6,15,22,29,36,43,6,17,24,31,38,6,14,58,62,64};
const int keyrow[514]={0,2,2,2,2,2,2,6,6,6,6,6,10,10,6,6,6};
const string printid[114]={"L","tab","q","w","e","t","p","shift","a","s","d","c","ctrl","space"};
const int mouses[514]={mouse_l,mouse_m,mouse_r};
map<string,int>m={
{"tab",VK_TAB},{"q",'Q'},{"w",'W'},{"e",'E'},{"t",'T'},{"p",'P'},
{"a",'A'},{"shift",VK_SHIFT},{"s",'S'},{"d",'D'},{"c",'C'},
{"ctrl",VK_CONTROL},{"space",VK_SPACE}
};
const string mouseimage[50]={
"___________",
"| | | |",
"| | | |",
"| | | |",
"| |_| |",
"| |",
"| CPS |",
"| |",
"|_________|"
};
const string image[][5]={{},
{"_________","| |","| TAB |","|_______|"}, //1
{"_______","| |","| Q |","|_____|"}, //2
{"_______","| |","| W |","|_____|"}, //3
{"_______","| |","| E |","|_____|"}, //4
{"_______","| |","| T |","|_____|"}, //5
{"_______","| |","| P |","|_____|"}, //6
{"___________","| |", //7
"| SHIFT |","|_________|"},
{"_______","| |","| A |","|_____|"}, //8
{"_______","| |","| S |","|_____|"}, //9
{"_______","| |","| D |","|_____|"}, //10
{"_______","| |","| C |","|_____|"}, //11
{"________","| |","| CTRL |","|______|"}, //12
{"_____________________________________", //13
"| |",
"| SPACE |",
"|___________________________________|"},
{" "," "," "," "},{" "," "," ","_"},{" "," "," "," "}
};
const string acimage[]={" Autoclick:Left "," Autoclick:Right ",
" Autoclick:Close ","Autoclick:L-rand","Autoclick:R-rand"};
const string keyboard[]={"",
"____________________________________________",
"| || || || || || |",
"| TAB || Q || W || E || T || P |",
"|_______||_____||_____||_____||_____||_____|",
"_______________________________________",
"| || || || || |",
"| SHIFT || A || S || D || C |",
"|_________||_____||_____||_____||_____|",
"_____________________________________________",
"| || |",
"| CTRL || SPACE |",
"|______||___________________________________|"
};
};
class nuke{
public:
void BOOOOOOOOM(){
system("cls");
for(int i=1;i<=12000;i++){
color(rand(),rand());
printf("%s",(rand()%2?"电脑已爆炸":"BOOOOM"));
for(int j=1;j<=rand()%5;j++) cout<<" ";
}
exit(3211574514);
}
};
void back_keyboard(){ //绘制键盘底板
int sleeptime=10;
color(0,0);
system("cls");
setcolor(dc);
for(int i=1;i<=12;i++){
go(6,i+1);
print(keyboard[i],3);
}
for(int i=5;i<=13;i++){
go(57,i);
print(mouseimage[i-5],7);
}
setcolor(pc);
go(4,1); print("这是一个好东西,按F9调整连点模式,按F10关闭屏幕键盘",sleeptime);
go(4,15); print("连点器使用指南:按Shift+滚动鼠标滚轮 调整点击速度:>",sleeptime);
go(46,7); print("作者:",sleeptime);
go(46,8); print("tttyyygdgz",sleeptime);
go(46,9); print("daniel08",sleeptime);
go(55,2); print("ClickSpeed:10",sleeptime);
go(54,3); print("----------------",sleeptime);
go(55,4); print("Autoclick:Close",sleeptime);
go(61,12); print("0.0",sleeptime);
go(57,14); print("Max-Cps:0",sleeptime);
setcolor(dc);
go(60,15); print("[清除]",sleeptime);
color(13,11);
for(int i=0;i<=16;i++){
go(73,i);
cout<<(i!=8?" ":"←");
Sleep(sleeptime);
}
}
void init(){// 初始化
//步骤1:禁止焦点监测(点击时不获得焦点)
HWND hwnd = GetConsoleWindow();
SetWindowLongPtr(hwnd,GWL_EXSTYLE,
GetWindowLongPtr(hwnd,GWL_EXSTYLE)|WS_EX_NOACTIVATE);
//步骤2:设置窗口大小和位置
SetWindowPos(hwnd,0,0,0,0,0,
SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_FRAMECHANGED);
system("mode con cols=76 lines=17");
CONSOLE_CURSOR_INFO cursor_info={1,0};
SetConsoleCursorInfo(soh,&cursor_info);
HWND hWnd=GetForegroundWindow();
LONG style=GetWindowLong(hWnd,GWL_EXSTYLE);
SetWindowLong(hWnd,GWL_EXSTYLE,style|WS_EX_TOPMOST);
// SetWindowPos(hWnd,HWND_TOPMOST,0,GetSystemMetrics(SM_CYFULLSCREEN)-230,0,0,SWP_NOSIZE);
SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE);
//步骤3:取消快速编辑
DWORD mode;
GetConsoleMode(sih,&mode);
mode&=~ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(sih,mode);
hWnd=GetConsoleWindow();
LONG_PTR exStyle=GetWindowLongPtr(hWnd,GWL_EXSTYLE);
SetWindowLongPtr(hWnd,GWL_EXSTYLE,exStyle|WS_EX_LAYERED);
BYTE alpha=255;
SetLayeredWindowAttributes(hWnd,0,alpha,LWA_ALPHA);
}
bool checkpos(int x1,int y1,int x2,int y2){// 检查鼠标位置
GetCursorPos(&pos);
POINT Winpos=curpos;
int x=pos.x-Winpos.x;
int y=pos.y-Winpos.y;
if(x>=x1&&x<=x2&&y>=y1&&y<=y2){
return 1;
}
return 0;
}
void getpress(){//获得键盘按下情况
memset(cases,0,sizeof cases);
for(int i=1;i<=13;i++){cases[i]=checkpos(poss[i][0],poss[i][1],poss[i][2],poss[i][3]);}
}
void printkey(int row,int col,const string str[]){//行row,列col
go(row,col);
for(int i=0;i<4;i++){
cout<<str[i];
go(row,++col);
}
}
void keyboardchange(){
if(nukeflag==0){
nukeflag=1;
color(0,0);
system("cls");
system("mode con cols=17 lines=17");
setcolor(pc);
go(6,1);cout<<"选择功能";
}
else if(nukeflag==1){
nukeflag=0;
system("mode con cols=76 lines=17");
back_keyboard();
}
}
void Main(){// 次主程序
while(1){
Sleep(20);
getpos();
if(nukeflag){
setcolor(pc);
spaceclif=(checkpos(45,75,135,95)&&key(mouse_l));
go(4,3);setcolor(spaceclif?pc:dc);
cout<<"[空格连点器]";
spaceclif=(checkpos(65,105,110,125)&&key(mouse_l));
go(7,5);setcolor(spaceclif?pc:dc);
cout<<"[键盘]";
}
if((nukeflag?checkpos(15,30,35,305):checkpos(590,30,610,305))){
//if(nukeflag) {nuke a;a.BOOOOOOOOM();}
color(11,13);
if(key(mouse_l)){
while(key(mouse_l));
keyboardchange();
}
}else color(13,11);
for(int i=0;i<=16;i++){
go((nukeflag?1:73),i);
cout<<(i!=8?" ":(nukeflag?"→":"←"));
//Sleep(10);
}
nukecheck;
setcolor(dc);
Sleep(10);//降低侦测速度,试试删除它会发生什么
getpos();//获取鼠标位置
getpress();//获得键盘按下情况
for(int i=1;i<=16;i++){
while(nukeflag);
bool fl=cases[i]&&lp;
setcolor(dc);
//sf意思是有没有在开启屏幕键盘
if(i<=13){
setcolor(fl||key(m[printid[i]])?pc:dc);
}
else (key(mouses[i-14])?color(0,13):setcolor(dc));
printkey(keycol[i],keyrow[i],image[i]);
if(fl&&i<=13){
pf=m.find(printid[i])->second;
}
}
setcolor(pc);
go(41,1);cout<<((!sf)?"打开":"关闭");
cclear=(checkpos(485,270,535,290)&&key(mouse_l));
go(60,15);setcolor(cclear?pc:dc);
cout<<"[清除]";
nukecheck;
while(clock()-q.front()>1511&&!q.empty()) q.pop();
setcolor(pc);go(59,12);
cps=q.size()/1.511;
if(cps<10){printf(" %03.1lf ",cps);}
else if(cps>=10&&cps<100){printf(" %02.1lf ",cps);}
else if(cps>=100&&cps<1000){printf(" %.0lf ",cps);}
else printf(" %.0lf ",cps);
go(57,14);printf("Max-Cps:%.0lf ",maxc);
go(54,4);cout<<acimage[on];
go(54,3);cout<<"----------------";
go(55,2);cout<<"ClickSpeed:"<<clickspeed<<" ";
maxc=max(maxc,cps);
}
}
void click(int fast,int mode){// copyright 点击
int random=rand();
int cd=(mode==0||mode==1)?(fast>>1):(fast?(random%(fast*3/4)+(random%(fast*3/4)<=fast/4?fast/4:0)):0);//非常不错的冷却计算器
DWORD down=((mode==0||mode==3)?MOUSEEVENTF_LEFTDOWN:MOUSEEVENTF_RIGHTDOWN);
DWORD up=((mode==0||mode==3)?MOUSEEVENTF_LEFTUP:MOUSEEVENTF_RIGHTUP);
mouse_event(down,0,0,0,0);
int r=rand()%((cd/3)+1);
Sleep(r%2==0?(cd-r):(cd+r));
mouse_event(up,0,0,0,0);
q.push(clock());
Sleep(r%2?(cd-r):(cd+r));
}
bool f9=0,close;
void runAC(){ //运行连点器 (run auto-clicker)
while(1){
Sleep(50);
if(key(VK_F9)){
while(key(VK_F9));
on=(on+1)%5;
}
if(key(VK_F10)){
while(key(VK_F10));
sf=!sf;
}
ac=0;
while(key(mouse_m)){
double cal=(1.0/clickspeed*1000);
if(on!=2) click(clickspeed==500?0:(int)cal,on);
}
}
}
void softkeyboard(){//软键盘
while(1){
Sleep(50);
if(pf!=-1){
if(sf){
keybd_event(pf,0,0,0);
keybd_event(pf,0,KEYEVENTF_KEYUP,0);
while(key(mouse_l));
pf=-1;
}else pf=-1;
//nuke a;a.BOOOOOOOOM();
}
if(cclear!=0){
while(key(mouse_l));
Sleep(5);
while(q.size())q.pop();
maxc=0;
cclear=0;
}
}
}
nuke NUKE;
void Nuke(){
while(1){
Sleep(100);
if(key(VK_ESCAPE)){
Sleep(3000);
nukeflag=1;
system("cls");
go(1,1);
int time=clock()+3000;
while(key(VK_ESCAPE)){
Sleep(1);
printf("是否启用核弹? (%.3f) \r",(time-clock())/1000.00);
if(time<=clock()){
for(int i=1;i<=12;i++){
setcolor(i%2?pc:dc);
cout<<"是否启用核弹? (0.000) \r"<<(i%2?"\a":"");
Sleep(250);
}
HANDLE hOut=GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(hOut,&csbi);
int w=GetSystemMetrics(SM_CXSCREEN);
int h=GetSystemMetrics(SM_CYSCREEN);
SetConsoleScreenBufferSize(hOut,(COORD){(short)w,(short)h});
SMALL_RECT rect={0,0,(short)(w-1),(short)(h-1)};
SetConsoleWindowInfo(hOut,TRUE,&rect);
NUKE.BOOOOOOOOM();
}
}
back_keyboard();
nukeflag=0;
}
}
}
int32_t main(){
cout<<setprecision(3);
init();
back_keyboard();
thread t1(Main),t2(runAC),t3(scroll_check),t4(click_check),t5(softkeyboard);
thread nUkE(Nuke);
t1.join();t2.join();t3.join();t4.join();t5.join();
nUkE.join();
}