c++抽卡模拟器(3.4)

#include <windows.h>
#include <bits/stdc++.h>
#include <sys/stat.h>
using namespace std;
void color(int forg, int back) {
	WORD wc = ((back & 0x0F) << 4) + (forg & 0x0F);
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), wc);
	return ;
}
bool first,first_;
char tim[64];
int num=0,kachi=1;
int in,all=0,last_g=0,last_p=0,lg2,lp2;
int glg=6,glgmost=6,glg2;
bool baodi=false,four_bd=false,waiable=true,found,top=false;
int FIVE,FOUR,THREE,HUTAO,YELAN,WAI,CZ;
int read()
{
	found=false;
	int x=0;
	char ch;
	while(1)
	{
		ch=getchar();
		if(ch=='\n')  break;
		else
		{
			if((ch=='-'&&x!=-1)||x==-1)
			{
				x=-1;
				found=true;
				continue;
			}  
			if(ch>='0'&&ch<='9'&&x!=1145&&x!=-1)
			{
				found=true;
				x*=10;
				x+=ch-'0';
				if(x>1000)  x=1145;
				continue; 
			}
			else  x=1145;
			if(ch!=' ')  found=true;
		}
	}
	return x;
}
bool isFileExists_stat(string& name)
{
  	struct stat buffer;   
  	return (stat(name.c_str(), &buffer) == 0); 
}
int getrand(int mn,int mx)
{
    return(rand()%(mx-mn+1))+mn;
}
void movewindow()
{
	int sktime=10,skdis=10;
	RECT rect;
	HWND win = NULL ,oldwin = NULL;
	int X,Y,W,H;
	for(int i=1;i<=10;i++)
	{
		win=GetForegroundWindow();
		if(win!=oldwin)
		{
			GetWindowRect(win,&rect);
			X=rect.left;
			Y=rect.top;
			W=rect.right-X;
			H=rect.bottom-Y;
			oldwin=win;
		}
		MoveWindow(win,X-skdis,Y,W,H,TRUE);
		Sleep(sktime);
		MoveWindow(win,X-skdis,Y-skdis,W,H,TRUE);
		Sleep(sktime);
		MoveWindow(win,X,Y-skdis,W,H,TRUE);
		Sleep(sktime);
		MoveWindow(win,X,Y,W,H,TRUE);
		Sleep(sktime);
	}
	return ;
} 
HWND h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13;
HINSTANCE hInst;
LRESULT CALLBACK WndProc(HWND hwnd,UINT Message,WPARAM wParam,LPARAM lParam){
	switch(Message){
		case WM_CREATE:{
			h1=CreateWindow("button","祈愿1次",WS_CHILD|WS_VISIBLE,
							0,0,158,158,hwnd,(HMENU)1,hInst,NULL);
			h2=CreateWindow("button","祈愿10次",WS_CHILD|WS_VISIBLE,
							158,0,158,158,hwnd,(HMENU)2,hInst,NULL);
			h3=CreateWindow("button","清屏",WS_CHILD|WS_VISIBLE,
							316,0,158,158,hwnd,(HMENU)3,hInst,NULL);
			h4=CreateWindow("button","退出",WS_CHILD|WS_VISIBLE,
							474,0,158,158,hwnd,(HMENU)4,hInst,NULL);
			h5=CreateWindow("button","结算",WS_CHILD|WS_VISIBLE,
							0,158,158,158,hwnd,(HMENU)5,hInst,NULL);
			h6=CreateWindow("button","置顶程序",WS_CHILD|WS_VISIBLE,
							158,158,158,158,hwnd,(HMENU)6,hInst,NULL);
			h7=CreateWindow("button","可能/不可能歪",WS_CHILD|WS_VISIBLE,
							316,158,158,158,hwnd,(HMENU)7,hInst,NULL);
			h8=CreateWindow("button","修改出金率",WS_CHILD|WS_VISIBLE,
							474,158,158,158,hwnd,(HMENU)8,hInst,NULL);
			h9=CreateWindow("button","胡桃池",WS_CHILD|WS_VISIBLE,
							0,316,158,158,hwnd,(HMENU)9,hInst,NULL);
			h10=CreateWindow("button","夜兰池",WS_CHILD|WS_VISIBLE,
							158,316,158,158,hwnd,(HMENU)10,hInst,NULL);
			h11=CreateWindow("button","常驻池",WS_CHILD|WS_VISIBLE,
							316,316,158,158,hwnd,(HMENU)11,hInst,NULL);
			h12=CreateWindow("button","显示已垫抽数",WS_CHILD|WS_VISIBLE,
							474,316,158,158,hwnd,(HMENU)12,hInst,NULL);
			break;
		}
		case WM_COMMAND:{
			switch(wParam){
				case 9:{
					kachi=1; 
					SetConsoleTitle("Hu Tao-胡桃卡池");
					break;
				}
				case 10:{
					kachi=2;
					SetConsoleTitle("Hu Tao-夜兰卡池");
					break;
				}
				case 11:{
					kachi=3;
					SetConsoleTitle("Hu Tao-常驻卡池");
					break;
				}
				case 12:{
					int x;
					if(kachi!=3)  x=last_g;
					else  x=lg2;
					cerr<<"已垫抽数:";
					if(x<=65)  color(2,15);
					if(x>=80)  color(4,15);
					cerr<<x<<"发";
					color(0,15);
					cerr<<"\n";
					break;
				}
				case 8:{
					SetConsoleTitle("Hu Tao-输入中");
					cerr<<"输入基础出金率(千分之多少,打出-负号为修改至正常值。";
					color(15,4);
					cerr<<"会重置已垫数量";
					color(0,15);
					cerr<<"):";
					int inc;
					while(1)
					{
						inc=read();
						if(found==false)  continue;
						if(inc>=0&&inc<=1000)
						{
							if(glgmost!=inc)  last_g=0;
							glg2=glg=glgmost=inc;
							cerr<<"已更新概率\n";
							break;
						}
						if(inc==-1)
						{
							if(glgmost!=6)  last_g=0;
							glg2=glg=glgmost=6;
							cerr<<"已更新概率\n";
							break;
						}
						cerr<<"错误,请重新输入\n";
					}
					if(kachi==1)	SetConsoleTitle("Hu Tao-胡桃卡池");
					else  if(kachi==2)  SetConsoleTitle("Hu Tao-夜兰卡池");
					else  SetConsoleTitle("Hu Tao-常驻卡池");
					break;
				}
				case 7:{
					if(waiable==true)
					{
						waiable=false;
						color(15,3);
						cerr<<"不可能歪";
						color(0,15);
						cerr<<'\n';
					}
					else
					{
						waiable=true;
						color(15,6);
						cerr<<"可能歪";
						color(0,15);
						cerr<<'\n';
					}
					break;
				} 
				case 6:{
					if(top==false)
					{
						top=true;
						cout<<"窗口已置顶\n";
						SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
					}
					else
					{
						top=false;
						cout<<"窗口已取消置顶\n";
						SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
					}
				/*
					if(all==0)
					{
						cerr<<"没有记录可清除\n";
						break;
					}
					baodi=false;
					four_bd=false;
					all=FIVE=HUTAO=YELAN=WAI=FOUR=THREE=last_p=last_g=0;
					glg=glgmost;
					color(15,0);
					cerr<<"已清除记录";
					color(0,15);
					cerr<<'\n';*/
					break;
				}
				case 5:{
					if(all==0)
					{
						cerr<<"你还没有抽过任何东西!\n";
						break; 
					}
					cerr<<"共抽"<<all<<"发,相当于消耗"<<all*160<<"个原石\n";
					if(FIVE>0)
					{
						cerr<<"共抽到"<<FIVE<<"个";
						color(15,6);
						cerr<<"五星";
						color(0,15);
						cerr<<",其中"<<HUTAO<<"个";
						color(2,15);
						cerr<<"胡桃";
						color(0,15);
						cerr<<",";
						cerr<<YELAN<<"个";
						color(1,15);
						cerr<<"夜兰";
						color(0,15);
						cerr<<","<<CZ<<"个";
						color(6,15);
						cerr<<"常驻";
						color(0,15);
						cerr<<",";
						color(4,15);
						cerr<<"歪了";
						color(0,15);
						cerr<<WAI<<"次。\n";
					}
					if(FOUR>0)
					{
						cerr<<"共抽到"<<FOUR<<"个";
						color(15,5);
						cerr<<"四星";
						color(0,15);
					}
					if(THREE>0&&FOUR>0)  cerr<<"和"<<THREE<<"个三星。\n";
					if(THREE>0&&FOUR==0)  cerr<<"共抽到"<<THREE<<"个三星。\n";
					break;
				}
				case 3:{
					system("cls");
					cerr<<" Hu Tao\n";
					SYSTEMTIME sys; 
					GetLocalTime(&sys);
					sprintf(tim,"%4d-%02d-%02d %02d:%02d:%02d",sys.wYear,sys.wMonth,sys.wDay,sys.wHour,sys.wMinute,sys.wSecond); 
					cerr<<tim<<endl;
					break;
				}
				case 4:{
					/*cerr<<"共抽"<<all<<"发,相当于消耗"<<all*160<<"个原石\n";
					if(FIVE>0)  cerr<<"共抽到"<<FIVE<<"个五星,其中"<<HUTAO<<"个胡桃,歪了"<<WAI<<"次。\n";
					if(FOUR>0)  cerr<<"共抽到"<<FOUR<<"个四星";
					if(THREE>0&&FOUR>0)  cerr<<"和"<<THREE<<"个三星。\n";
					if(THREE>0&&FOUR==0)  cerr<<"共抽到"<<THREE<<"个三星。\n";
					system("pause"); */
					system("cls");
					PostQuitMessage( 0 ) ;
					break;
				}
				case 1:{
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值