问题标题: 酷町堂:勇者小游戏开源公告

2
1
已解决
刘景程
刘景程
新手光能
新手光能

5.0已经做好了,但是不能发出来(里面有我服务器密码)

所以还是看看4.4吧

(广告)本游戏拥有全酷町堂最高级、最完善的团队、存档以及事件响应系统,速度快,功能多。

我都觉得它很腻害~~

允许复制粘贴,但是请保留原作者信息!

做一个有道德修养的程序员(手动滑稽)

#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<sstream>
using namespace std;
struct p
{
	int s=1000,g=100,f=100,j=1,q=200,dg=0;
	string na;	
}a;
long long mytime;
void print()
{
	string tmp=a.na+",欢迎来到勇者小镇!\n";
	printf(
	"刘景程制作\n"
	);
	cout<<tmp;
	tmp=".\\Tools\\"+a.na+".tim2";
	ifstream fin(tmp.c_str(),ios::in|ios::out);
	int tim2;
	fin>>tim2;
	fin.close();
	long long timn=time(NULL);
	long long h,m,d;
	long long t=timn-tim2;
	mytime=t;
	t=max(0ll,t);
	m=t/60%60;
	h=t/3600%24;
	d=t/86400;
	cout<<"您在勇者小镇生活了"<<m<<"分钟"<<h<<"小时"<<d<<"天\n";
	printf("----------勇者小游戏4.4版----------\n" );
	printf(
	"输入1,药店\n"
	"输入2,武器店\n"
	"输入3,防具店\n" 
	"输入4,彩票店\n"
	"输入5,打怪物\n"
	"输入6,查看状态\n"
	"输入7,升级\n" 
	"输入8,决斗\n"
	"输入9,串门\n" 
	"输入10,排行榜\n"
	"输入11,团队\n"
	"输入12,勋章\n"
	"输入13,注销账号\n"
	"输入14,聊天\n"
	"输入15,设置\n"
	"输入0,退出\n" 
	); 
}
void yao()
{
	int maxn=8;
	loop:
	system("CLS");
	int n,s[11][2]={{0,0},{10,5},{20,9},{75,30},{200,90},{400,180},{1000,400},{2000,700}};
	printf(
	"输入1:创可贴 生命值+10 价格 5\n" 
	"输入2:绷带 生命值+20 价格 9\n" 
	"输入3:神奇小药丸 生命值+75 价格 30\n" 
	"输入4:阿司匹林 生命值+200 价格 90\n" 
	"输入5:灵药 生命值+400 价格 180\n" 
	"输入6:超级灵芝 生命值+1000 价格 400\n" 
	"输入7:起死回生术 生命值+2000 价格 700\n"
	"输入8:一键升满\n"
	"输入0 退出药店\n"
	);
	cin>>n;
	if(n==0)return ;
	if(n>=1&&n<maxn)
	{
		if(a.q<s[n][1])
		{
			cout<<"没钱!\n";
			Sleep(1500);
		}
		else 
		{
			a.q-=s[n][1];
			a.s=a.s+s[n][0];
			if(a.s>a.j*1000)a.s=a.j*1000;
		}
	}
	else if(n>=1)
	{
		double maxx=a.j*1000;
		double dif=maxx-a.s;
		double money=0;
		if(dif<=10)money=dif/1.8;
		else if(dif>10&&dif<=75)money=5.556+(dif-10)/2.1;
		else if(dif>75&&dif<=400)money=36.508+(dif-75)/2.4;
		else if(dif>400&&dif<=1000)money=171.925+(dif-400)/2.7;
		else if(dif>1000)money=394.147+(dif-1200)/2.95;
		a.q-=(int)(money);
		if(a.q<0)
		{
			a.q+=(int)(money);
			cout<<"没钱!";	
			Sleep(2000);
			system("CLS");
			return ;
		}
		a.s=maxx;
		cout<<"已升满。";
		Sleep(2000);
	}
	system("CLS");
}
void wuqi()
{
	loop:
	system("CLS");
	int maxn=8;
	int n,s[11][3]={{0,0},{5,10},{10,20},{20,40},{50,95},{100,175},{200,320},{500,750}};
	printf(
	"输入1:小刀 攻击值+5 价格 10\n"
	"输入2:中刀 攻击值+10 价格 20\n"
	"输入3:大刀 攻击值+20 价格 40\n"
	"输入4:寒冰刃 攻击值+50 价格 95\n"
	"输入5:屠龙刃 攻击值+100 价格 175\n"
	"输入6:倚天屠龙刃 攻击值+200 价格 330\n"
	"输入7:死神之镰 攻击值+500 价格 750\n"
	"输入8:一键升满\n"
	"输入0 退出武器店\n"
	);
	cin>>n;
	if(n==0)return ;
	if(n>maxn||n<1)
	{
		cout<<"输入错误!";
		goto loop;
	}
	if(a.q<s[n][1])
	{
		cout<<"没钱!\n";
		Sleep(1500);
	} 
	else if(n!=maxn)
	{
		a.q-=s[n][1];
		a.g=a.g+s[n][0];
		if(a.g>a.j*100)a.g=a.j*100;
	} 
	else if(n==maxn)
	{
		int maxx=a.j*100;
		int dif=maxx-a.g;
		double money=0;
		if(dif<=20)money=dif*2;
		else if(dif>20&&dif<=100)money=40+(dif-20)*1.8;
		else if(dif>100&&dif<=500)money=184+(dif-100)*1.5;
		else if(dif>500&&dif<=1200)money=859+(dif-500)*1.2;
		else if(dif>1200)money=1699+(dif-1200)*1.05;
		a.q-=(int)(money);
		if(a.q<0)
		{
			a.q+=(int)(money);
			cout<<"没钱!";	
			Sleep(2000);
			system("CLS");
			return ;
		}
		a.g=maxx;
		cout<<"已升满。";
		Sleep(2000);
	}
	system("CLS");
} 
void fangju()
{
	loop:
	system("CLS");
	int maxn=8;
	int n,s[11][3]={{0,0},{5,10},{10,20},{20,35},{50,90},{100,150},{300,500},{700,1100}};
	printf(
	"输入1:防身衣 防御值+5 价格 10\n"
	"输入2:木盾 防御值+10 价格 20\n"
	"输入3:铁盾 防御值+20 价格 35\n"
	"输入4:黄金盾 防御值+50 价格 90\n"
	"输入5:钻石盾 防御值+100 价格 150\n"
	"输入6:铁甲 防御值+300 价格 475\n"
	"输入7:黄金甲 防御值+700 价格1000\n"
	"输入8:一键升满\n"
	"输入0 退出防具店\n"
	);
	cin>>n;
	if(n==0)return ;
	if(n>maxn||n<1)
	{
		cout<<"输入错误!";
		goto loop;
	}
	if(a.q<s[n][1])
	{
		cout<<"没钱!\n";
		Sleep(1500);
	} 
	else if(n!=maxn)
	{
		a.q-=s[n][1];
		a.f=a.f+s[n][0];
		if(a.f>a.j*100)a.f=a.j*100;
	}
	else if(n==maxn)
	{
		int maxx=a.j*100;
		int dif=maxx-a.f;
		double money=0;
		if(dif<=20)money=dif*2;
		else if(dif>20&&dif<=50)money=40+(dif-20)*1.8;
		else if(dif>50&&dif<=700)money=94+(dif-50)*1.5;
		else if(dif>700&&dif<=1500)money=1069+(dif-700)*1.2;
		else if(dif>1500)money=2029+(dif-1500)*1.05;
		a.q-=(int)(money);
		if(a.q<0)
		{
			a.q+=(int)(money);
			cout<<"没钱!";	
			Sleep(2000);
			system("CLS");
			return ;
		}
		a.f=maxx;
		cout<<"已升满。";
		Sleep(2000);
	}
	system("CLS");
}
void caipiao()
{
	system("CLS");
	int maxn;
	maxn=a.q/2.0;
	if(maxn>2000)maxn=2000;
	else if(maxn<0)maxn=50;
	int r=rand()%maxn+maxn;
	int jiage;
	if(r<=500)jiage=7;
	else if(r<=1000)jiage=6;
	else if(r<=2000)jiage=5;
	else jiage=4;
	printf(
	"快买张彩票吧!\n"
	"彩票价格:");
	cout<<jiage;
	printf(
	"元/张\n"
	"彩票号范围:1~"
	);
	cout<<r<<endl;
	cout<<"你只需要输入购买的彩票数目以及每张彩票的号码即可。\n";
	int n;
	cin>>n;
	if(a.q<n*5)
	{
		cout<<"没钱!\n"; 
		Sleep(1500);
		system("CLS");
		return ;
	}
	a.q-=n*5;
	int b[1001];
	int r1=rand()%r+1;
	for(int i=1;i<=n;++i)cin>>b[i];
	for(int i=1;i<=n;++i)
	{
		if(b[i]==r1)
		{
			cout<<"恭喜你中奖了!\n";
			a.q+=r*4+n*5; 
			Sleep(1500);
			system("CLS");
			return ;
		}
	}
	cout<<"啊哦,好像并没有中奖。\n中奖号:"<<r1<<endl; 
	Sleep(1500);
	system("CLS");
} 
int rand2=1,rand3=1;
void daguai()
{
	system("CLS");
	int hh=1;
	p b;
	b.j=a.j;
	b.s=rand()%((b.j*1000)/2)+((b.j*1000)/2);
	b.g=rand()%((b.j*100)/2)+((b.j*100)/2);
	b.f=rand()%((b.j*100)/2)+((b.j*100)/2);
	while(1)
	{
		system("CLS");
		cout<<"这是第"<<hh<<"回合\n1:攻击\n2:逃跑\n";
		cout<<"你的生命值:"<<a.s<<endl<<"怪物的生命值:"<<b.s<<endl;
		hh++;
		if(rand3%7==0)cout<<"没打中!"<<endl;
		int ss;
		cin>>ss;
		if(ss==2)
		{
			if(rand()%2==0)
			{
				cout<<"逃跑成功!\n";
				Sleep(1500);
				system("CLS");
				return ;
			}
			else
			{
				cout<<"逃跑失败!\n";
				Sleep(1500);
				system("CLS");
				ss=1;
			}
		}
		if(ss==1)
		{
			rand2=rand()%7;
			rand3=rand()%7;
			if(rand2!=0)a.s=a.s-(b.g-a.f/4);
			if(rand3!=0)b.s=b.s-(a.g-b.f/4);
			int jq=min((b.g-a.f/4+a.g-b.f/4)/5,(a.g-b.f/4+b.g-a.f/4)/5);
			if(jq<0)jq=0;
			if(rand2!=0)a.q+=jq;
			if(rand3!=0)b.q+=jq;
		}
		if(b.s<=0)
		{
			cout<<"你赢了!\n";
			Sleep(1500);
			system("CLS");
			if(a.s>a.j*1000)a.s=a.j*1000;
			if(a.s<0)
			{
				a.s=0;
				a.j--;
				if(a.j==0)
				{
					a.j=1;
					a.g=100;
					a.f=100;
					a.s=900;
				}
				else
				{
					a.g=a.j*100;
					a.f=a.j*100;
				}
			}
			a.dg++;
			return ;
		}
		else if(a.s<=0)
		{
			cout<<"你输了!\n";
			a.j--;
			if(a.j==0)
			{
				a.j=1;
				a.s=900;
				a.g-=10;
				a.f-=10;
				if(a.g>a.j*100)b.g=b.j*100;
				if(a.f>a.j*100)b.f=b.j*100;
				if(a.g<0)a.g=10;
				if(a.f<0)a.f=10;
				a.q-=300;
				if(a.q<0)a.q=0;
			}
			else
			{
				a.s=a.j*1000;
				if(a.g>a.j*100)a.g=a.j*100;
				if(a.f>a.j*100)a.f=a.j*100;
				a.q-=250;
				if(a.q<0)a.q=0;
			}
			Sleep(1500);
			system("CLS");
			return ;
		}
		if(a.s>a.j*1000)a.s=a.j*1000;
	}
}
void zhuangtai()
{
	system("CLS");
	cout<<"生命值:"<<a.s<<endl<<"攻击值:"<<a.g<<endl<<"防御值:"<<a.f<<endl<<"金币数:"<<a.q<<endl<<"级别:"<<a.j<<endl<<"杀死对手:"<<a.dg<<endl;
	system("pause");
	system("CLS");
}
void shengji()
{
	system("CLS");
	int money;
	if(a.j<=10)money=a.j*50;
	else if(a.j<=50)money=a.j*45;
	else if(a.j<=100)money=a.j*40;
	else if(a.j<=200)money=a.j*35;
	else if(a.j<=500)money=a.j*30;
	else if(a.j<=1000)money=a.j*25;
	else if(a.j<=2000)money=a.j*20;
	else if(a.j<=5000)money=a.j*15;
	else if(a.j<=10000)money=a.j*10;
	else if(a.j<=20000)money=a.j*5;
	else if(a.j<=50000)money=a.j*3;
	else if(a.j<=100000)money=a.j;
	else money=100000;
	stringstream ssm;
	ssm<<money;
	string abcba;
	ssm>>abcba;
	abcba="确认升级?"+abcba+"元"; 
	if(a.q>=money)
	{
		int aa=MessageBox(NULL,abcba.c_str(),"勇者小游戏",MB_YESNO);
		if(aa==IDYES)
		{
			a.q-=money;
			a.j++;
		} 
		else return ;
	}
	else 
	{
		cout<<"没钱!\n";
		Sleep(1500);
		system("CLS");
		return ;
	} 
	cout<<"已升级\n";
	Sleep(1500);
	system("CLS");
}
int random5=1,random6=1;
string names[10001];
void juedou()
{
	system("CLS");
	int hh=1;
	ifstream fin4(".\\Tools\\name.ini",ios::in|ios::out);
	int i=1;
	while(fin4>>names[i])i++;
	cout<<"敌人:\n";
	for(int j=1;j<i;++j)
	{
		cout<<j<<"号:"<<names[j]<<endl;
	}
	int ss;
	cout<<"输入代号:\n";
	cin>>ss;
	if(ss<1||ss>=i)
	{
		cout<<"输入错误!"; 
		return ; 
	}
	string bb=".\\Tools\\"+names[ss]+".yz";
	ifstream fin5(bb.c_str(),ios::in|ios::out);
	string pas;
	int sheng,fang,gong,qian,ji,shadi;
	fin5>>pas>>sheng>>gong>>fang>>ji>>qian>>shadi;
	p b;
	b.s=sheng;
	b.g=gong;
	b.f=fang;
	b.j=ji;
	b.q=qian;
	b.dg=shadi;
	b.na=names[ss];
	ofstream fout4(bb.c_str(),ios::in|ios::out);
	string bbb=".\\Tools\\"+b.na+".tlk";
	while(1)
	{
		system("CLS");
		cout<<"这是第"<<hh<<"回合\n1:攻击\n2:逃跑\n";
		cout<<"你的生命值:"<<a.s<<endl<<"敌人的生命值:"<<b.s<<endl;
		if(random6%7==0)cout<<"没打中!";
		hh++;
		int ss;
		cin>>ss;
		if(ss==2)
		{
			if(rand()%2==0)
			{
				cout<<"逃跑成功!\n";
				ofstream fout4(bb.c_str(),ios::in|ios::out);
				fout4<<pas<<endl<<b.s<<" "<<b.g<<" "<<b.f<<" ";
				fout4<<b.j<<" "<<b.q<<" "<<b.dg<<endl;
				fout4.close();
				ofstream fout5(bbb.c_str(),ios::in|ios::out|ios::app);
				fout5<<3<<" "<<a.na<<endl;
				fout5.close();
				/*bug_is_at_there*/
				Sleep(1500);
				system("CLS");
				return ;
			}
			else
			{
				cout<<"逃跑失败!\n";
				Sleep(1500);
				system("CLS");
				ss=1; 
			}
		}
		if(ss==1)
		{
			random5=rand()%7;
			random6=rand()%7;
			if(random5!=0)
			{
				int jian=(b.g-a.f/4);
				if(jian<0)jian=0;
				a.s=a.s-jian;
			}
			if(random6!=0)
			{
				int jian2=(a.g-b.f/4);
				if(jian2<0)jian2=0;
				b.s=b.s-jian2;
			}
			if(1)
			{
				int ajian=b.g-a.f/4,bjian=a.g-b.f/4;
				if(ajian<0||random6==0)ajian=0;
				if(bjian<0||random5==0)bjian=0;
				int jq=min((ajian+bjian)/5,(bjian+ajian)/5);
				if(jq<0)jq=0;
				a.q+=jq;
				b.q+=jq;
				if(b.s>b.j*1000)b.s=b.j*1000;
				if(a.s>a.j*1000)a.s=a.j*1000;
			}
		}
		if(b.s<=0)
		{
			cout<<"你赢了!\n";
			Sleep(1500);
			system("CLS");
			if(a.s>a.j*1000)a.s=a.j*1000;
			b.j--;
			if(b.j==0)
			{
				b.j=1;
				b.s=900;
				b.q-=300;
				if(b.q<0)b.q=0;
			}
			else
			{
				b.s=b.j*1000;
				b.q-=250;
				if(b.q<0)b.q=0;
			}
			if(a.s<0)
			{
				a.s=0;
				a.j--;
				if(a.j==0)
				{
					a.j=1;
					a.g=100;
					a.f=100;
					a.s=900;
				}
				else
				{
					a.g=a.j*100;
					a.f=a.j*100;
				}
			}
			a.dg++;
			ofstream fout40(bb.c_str(),ios::in|ios::out);
			fout40<<pas<<endl<<b.s<<" "<<b.g<<" "<<b.f<<" ";
			fout40<<b.j<<" "<<b.q<<" "<<b.dg<<endl;
			fout40.close();
			ofstream fout5(bbb.c_str(),ios::in|ios::out|ios::app);
			fout5<<3<<" "<<a.na<<endl;
			fout5.close();
			/*bug_is_at_there*/
			return ;
		}
		else if(a.s<=0)
		{
			cout<<"你输了!\n";
			a.j--;
			if(a.j==0)
			{
				a.j=1;
				a.s=900;
				a.q-=300;
				if(a.q<0)a.q=0;
			}
			else
			{
				a.s=a.j*1000;
				a.g-=10;
				a.f-=10;
				a.q-=250;
				if(a.q<0)a.q=0;
			}
			b.dg++;
			Sleep(1500);
			system("CLS");
			ofstream fout41(bb.c_str(),ios::in|ios::out);
			fout4<<pas<<endl<<b.s<<" "<<b.g<<" "<<b.f<<" ";
			fout4<<b.j<<" "<<b.q<<" "<<b.dg<<endl;
			fout4.close();
			ofstream fout5(bbb.c_str(),ios::in|ios::out|ios::app);
			fout5<<3<<" "<<a.na<<endl;
			fout5.close();
			/*bug_is_at_there*/
			return ;
		}
		if(b.s>b.j*1000)b.s=b.j*1000;
		if(a.s>a.j*1000)a.s=a.j*1000;
	}
} 
void chuanmen()
{
	system("CLS");
	ifstream fin4(".\\Tools\\name.ini",ios::in|ios::out);
	int i=1;
	while(fin4>>names[i])i++;
	cout<<"去哪家?\n";
	for(int j=1;j<i;++j)
	{
		cout<<j<<"号:"<<names[j]<<endl;
	}
	int ss;
	cout<<"输入代号:\n";
	cin>>ss;
	string bb=".\\Tools\\"+names[ss]+".yz";;
	ifstream fin5(bb.c_str(),ios::in|ios::out);
	string pas;
	int sheng,fang,gong,qian,ji,sha;
	fin5>>pas>>sheng>>gong>>fang>>ji>>qian>>sha;
	cout<<"生命值:"<<sheng<<endl;
	cout<<"防御值:"<<fang<<endl;
	cout<<"攻击值:"<<gong<<endl;
	cout<<"级别:"<<ji<<endl;
	cout<<"钱:"<<qian<<endl;
	cout<<"杀死对手:"<<sha<<endl;
	Sleep(2000);
	system("CLS");
}
p r[10001];
int cmp(p a1,p b1)
{
	return (a1.s*0.95+a1.g*1.1+a1.f/2+a1.j*100+a1.q*1.5+a1.dg*5.5)>(b1.s*0.95+b1.g*1.1+b1.f/2+b1.j*100+b1.q*1.5+b1.dg*5.5);
}
void paihangbang()
{
	system("CLS");
	cout<<"*******排行榜*******\n";
	ifstream fin4(".\\Tools\\name.ini",ios::in|ios::out);
	int i=1;
	while(fin4>>names[i])i++;
	for(int j=1;j<i;++j)
	{
		string bb=".\\Tools\\"+names[j]+".yz";
		ifstream fin5(bb.c_str(),ios::in|ios::out);
		string pas;
		int sheng,fang,gong,qian,ji,shadi;
		fin5>>pas>>sheng>>gong>>fang>>ji>>qian>>shadi;
		r[j].s=sheng;
		r[j].g=gong;
		r[j].f=fang;
		r[j].j=ji;
		r[j].q=qian;
		r[j].na=names[j];
		r[j].dg=shadi;
	}
	sort(r+1,r+i,cmp);
	for(int j=1;j<i;++j)
	{
		cout<<"★"<<j<<"★:"<<r[j].na;
		if(r[j].na==a.na)cout<<"(自己)";
		cout<<endl;
	}
	system("pause");
	system("CLS");
}
string tua[10001],tuu[10001],tume[10001],man[10001],man10[10001];
int an;
int tu;
int peo;
int flag10;
int n12;
string man12[10001];
string men[10001];
int mbs;
string invp[10001];
map <string,bool> invite;
void tuandui()
{
	ifstream fin11(".\\Mbs\\tuan.txt",ios::in|ios::out);
	ofstream fout11(".\\Mbs\\tuan.txt",ios::in|ios::out);
	if(!fin11)
	{
		fout11<<0;
		tu=0;
	}
	else fin11>>tu;
	for(int i=1;i<=tu;++i)fin11>>tua[i];
	while(1)
	{
		system("CLS");
		int s2;
		printf(
		"这里是团队主中心\n"
		"输入1 进入团队中心\n"
		"输入2 查找/加入团队\n"
		"输入3 创建团队\n"
		"输入0 退出\n"
		);
		cin>>s2;
		if(s2==0)break;
		else if(s2==1)
		{
			an=0;
			system("CLS");
			for(int i=1;i<=tu;++i)
			{
				string tuan_tmp1=".\\Mbs\\"+tua[i];
				ifstream filn(tuan_tmp1.c_str(),ios::in|ios::out);
				int s3;
				filn>>s3;
				for(int j=1;j<=s3;++j)
				{
					filn>>tuu[j];
					if(tuu[j]==a.na)
					{
						an++;
						cout<<an<<":"<<tua[i]<<endl;
					}
				}
				filn.close();
			}
			if(an==0)
			{
				cout<<"您好像没有加入任何一个团队。\n";
				system("pause");
				system("CLS");
				continue;
			}
			cout<<"去哪个团队中心里?(输序号即可)";
			int number;
			cin>>number;
			if(number<1||number>an)
			{
				cout<<"输入错误!";
				system("PAUSE"); 
				continue; 
			}
			string tmp=".\\Mbs\\"+tua[number];
			ifstream finm(tmp.c_str(),ios::in|ios::out);
			finm>>mbs;
			for(int i=1;i<=mbs;++i)finm>>men[i]; 
			finm.close();
			while(1)
			{
				lop:
				system("CLS");
				cout<<"欢迎来到"<<tua[number]<<"的团队中心!"<<endl;
				printf(
				"输入1:退出该团队\n"
				"输入2:查看团队成员\n"
				);
				if(men[1]==a.na)
				{
					printf(
					"输入3:驱逐成员\n"
					"输入4:邀请新成员\n"
					"输入5:解散团队\n"
					);
				}
				printf("输入0:离开团队中心\n");
				int s3;
				cin>>s3;
				if(s3==0)
				{
					system("CLS");
					break;
				}
				else if(s3==1&&a.na!=men[1])
				{
					if(MessageBox(NULL,"确认退出?","勇者小游戏",MB_YESNO)==IDYES)
					{
						string tuan_tmp2=".\\Mbs\\"+tua[number];
						ifstream fin12(tuan_tmp2.c_str(),ios::in|ios::out);
						fin12>>n12;
						for(int i=1;i<=n12;++i)fin12>>man12[i];
						ofstream fout12(tuan_tmp2.c_str());
						fout12<<n12-1<<endl;
						for(int i=1;i<=n12;++i)
						{
							if(man12[i]!=a.na)fout12<<man12[i];
						}
						MessageBox(NULL,"已退出。","勇者小游戏",MB_OK);
						system("CLS");
						break;
					}
					else
					{
						system("CLS");
						continue;
					}
				}
				else if(s3==1&&a.na==men[1])
				{
					system("CLS");
					cout<<"对不起,您是团主,无法退出!";
					Sleep(1500);
					continue;
				}
				else if(s3==2)
				{
					string tuan_tmp4=".\\Mbs\\"+tua[number];
					ifstream fin21(tuan_tmp4.c_str(),ios::in|ios::out);
					int n21;
					string namesoft;
					fin21>>n21;
					for(int i=1;i<=n21;++i)
					{
						fin21>>namesoft;
						cout<<i<<":"<<namesoft;
						if(namesoft==a.na)cout<<"(自己)";
						cout<<endl; 
					}
					system("PAUSE");
				}
				else if(s3==3&&a.na==men[1])
				{
					for(int i=2;i<=mbs;++i)
					{
						cout<<i-1<<":"<<men[i]<<endl;
					}
					if(mbs==1)
					{
						system("CLS");
						cout<<"没有人可以驱逐。";
						Sleep(1500);
						continue;
					}
					cout<<"驱逐谁?(如不驱逐输入0)";
					int s4;
					cin>>s4;
					s4++; 
					if(s4<=1||s4>mbs)
					{
						if(s4!=1)
						{
							cout<<"输入错误!"; 
							Sleep(1500);
						}
						system("CLS"); 
						goto lop;
					}
					string yuanying;
					cout<<"请输入原因:\n";
					cin>>yuanying;
					int ID=MessageBox(NULL,"真的要驱逐他吗?","勇者小游戏",MB_YESNO);
					if(ID==IDYES)
					{
						ofstream quzhu(tmp.c_str());
						quzhu<<mbs-1<<endl;
						for(int i=1;i<=mbs;++i)
						{
							if(i!=s4)quzhu<<men[i]<<endl;
						}
						string tmpp2=".\\Tools\\"+men[s4]+".tlk";
						ofstream notice_quzhu(tmpp2.c_str(),ios::in|ios::out|ios::app);
						notice_quzhu<<4<<" "<<a.na<<" "<<tua[number]<<" "<<yuanying<<endl;
						MessageBox(NULL,"已驱逐。","勇者小游戏",MB_OK);
					}
					system("CLS");
					break;
				}
				else if(s3==4&&a.na==men[1])
				{
					for(int i=1;i<=mbs;++i)
					{
						invite[men[i]]=1;
					} 
					llp:
					system("CLS");
					int inp=0;
					ifstream fin_n(".\\Tools\\name.ini",ios::in|ios::out); 
					while(fin_n>>invp[++inp])
					{
						if(invite[invp[inp]])inp--;
					}
					if(inp==1)
					{
						system("CLS");
						cout<<"没人可以邀请。";
						system("CLS");
						continue;
					}
					for(int i=1;i<inp;++i)
					{
						cout<<"第"<<i<<"号:"<<invp[i]<<endl;
					}
					cout<<"邀请哪位?请输入序号(如不邀请请输入0)\n";
					int ivp;
					cin>>ivp;
					if(ivp==0)continue;
					if(ivp<1||ivp>inp)
					{
						system("CLS");
						cout<<"输入错误!";
						Sleep(1500);
						goto llp;
					}
					string tmp_inv=".\\Tools\\"+invp[ivp]+".tlk";
					ofstream foutv(tmp_inv.c_str(),ios::in|ios::out|ios::app);
					foutv<<5<<" "<<a.na<<" "<<tua[number]<<endl;
					MessageBox(NULL,"已邀请!","勇者小游戏",MB_OK);
					system("CLS");
					invite.clear();
				}
				else if(s3==5&&a.na==men[1])
				{
					//tua[number] mbs men
					system("CLS");
					int Id=MessageBox(NULL,"你确定吗?该操作无法恢复!","勇者小游戏!",MB_YESNO);
					if(Id==IDYES)
					{
						cout<<"请写出解散原因:";
						string why;
						cin>>why;
						for(int k=2;k<=mbs;++k)
						{
							string Tmp=".\\Tools\\"+men[k]+".tlk";
							ofstream foutj(Tmp.c_str(),ios::in|ios::out|ios::app);
							foutj<<2<<" "<<a.na<<" "<<tua[number]<<" "<<why<<endl;
						}
						ifstream finjj("\\Mbs\\tuan.txt",ios::in|ios::out);
						int mennumbers;
						finjj>>mennumbers;
						ofstream fouj(".\\Mbs\\tuan.txt");
						fouj<<tu-1<<endl;
						for(int s=1;s<=tu;++s)
						{
							if(s!=number)fouj<<tua[s]<<endl;
						}
						string TMP="del .\\Mbs\\"+tua[number]+" /F /Q";
						system("CLS");
						string ttmp=".\\Mbs\\"+tua[number];
						ofstream meiyouyongdedongxi(ttmp.c_str());
						meiyouyongdedongxi.close();
						system(TMP.c_str());
						MessageBox(NULL,"已解散。","勇者小游戏",MB_OK);
						return ;
					}
				}
				else
				{
					cout<<"输入错误!";
					Sleep(1500);
					system("CLS");
				}
			}
		}
		else if(s2==2)
		{
			system("CLS");
			if(tu==0)
			{
				cout<<"暂无团队。。。\n";
				system("PAUSE");
				continue;
			}
			for(int i=1;i<=tu;++i)
			{
				cout<<i<<":"<<tua[i]<<endl;
				string tuan_tmp3=".\\Mbs\\"+tua[i];
				ifstream fii(tuan_tmp3.c_str(),ios::in|ios::out);
				int ps;
				fii>>ps;
				for(int j=1;j<=ps;++j)
				{
					fii>>man[j];
				}
				int money;
				cout<<"人数:"<<ps<<endl;
			}
			if(tu==0)
			{
				cout<<"暂无团队可供加入。。。\n";
				system("PAUSE");
				continue;
			}
			cout<<"加入哪个团队?(输入序号(若不加入输入0即可))"; 
			int num;
			cin>>num;
			if(num==0) ;
			else
			{
				string tuan_tmp5=".\\Mbs\\"+tua[num];
				ifstream fin10(tuan_tmp5.c_str(),ios::in|ios::out);
				fin10>>peo;
				for(int i=1;i<=peo;++i)fin10>>man10[i];
				ofstream fout10(tuan_tmp5.c_str());
				for(int i=1;i<=peo;++i)
				{
					if(man10[i]==a.na)
					{
						flag10=1;
						break;
					}
				}
				if(flag10==1)
				{
					flag10=0;
					fout10<<peo<<endl;
					for(int i=1;i<=peo;++i)fout10<<man10[i]<<endl;
					cout<<"您此前已加入该团队!\n";
					system("pause"); 
				}
				else
				{
					fout10<<peo+1<<endl;
					for(int i=1;i<=peo;++i)fout10<<man10[i]<<endl;
					fout10<<a.na;
					cout<<"加入成功!\n";
					system("pause");
				}
			}
		}
		else if(s2==3)
		{
			int yesno=MessageBox(NULL,"是否创建一个团队?100元","勇者小游戏",MB_YESNO);
			if(yesno==IDYES)
			{
				if(a.q<100)
				{
					cout<<"没钱!\n";
					system("pause");
					system("CLS");
				}
				else
				{
					flag10=0;
					a.q-=100;
					cout<<"团队名称:";
					string tn;
					cin>>tn;
					ifstream filein(".\\Mbs\\tuan.txt",ios::in|ios::out);
					if(!filein)peo=0;
					else filein>>peo;
					for(int i=1;i<=peo;++i)filein>>man10[i];
					for(int i=1;i<=peo;++i)
					{
						if(man10[i]==tn)
						{
							cout<<"重名!\n";
							a.q+=100;
							flag10=1;
							system("pause");
							system("CLS");
							break;
						}
					}
					if(!flag10)
					{
						ofstream fiout(".\\Mbs\\tuan.txt");
						fiout<<peo+1<<endl;
						for(int i=1;i<=peo;++i)fiout<<man10[i]<<endl;
						fiout<<tn<<endl;
						string tuan_tmp6=".\\Mbs\\"+tn;
						ofstream file_out(tuan_tmp6.c_str());
						file_out<<1<<endl<<a.na<<endl;
						MessageBox(NULL,"创建成功!","勇者小游戏",MB_OK);
						system("CLS");
						return ;
					}
					flag10=0;
				}
			}
		}
	}
	system("CLS");
}
void xunzhang()
{
	system("CLS");
	cout<<"您获得了:\n"; 
	if(a.j>=2)cout<<"2级小兵勋章\n";
	if(a.j>=10)cout<<"10级军官勋章\n"; 
	if(a.j>=50)cout<<"50级上将勋章\n";
	if(a.j>=100)cout<<"100级大将勋章\n";
	if(a.j>=200)cout<<"200级军神勋章\n";
	if(a.j>=1000)cout<<"1000级Mars勋章\n";
	if(a.j>=2000)cout<<"2000级宇宙主宰勋章\n";
	if(a.g>=200)cout<<"200攻击力斗士勋章\n";
	if(a.g>=400)cout<<"400攻击力战士勋章\n";
	if(a.g>=800)cout<<"800攻击力战将勋章\n";
	if(a.g>=1200)cout<<"1200攻击力战狼勋章\n";
	if(a.g>=2000)cout<<"2000攻击力战王勋章\n";
	if(a.g>=4000)cout<<"4000攻击力战神勋章\n";
	if(a.f>=200)cout<<"200防御力护卫勋章\n";
	if(a.f>=400)cout<<"400防御力保镖勋章\n";
	if(a.f>=800)cout<<"800防御力神护勋章\n";
	if(a.f>=1200)cout<<"1200防御力钢铁卫兵勋章\n";
	if(a.f>=2000)cout<<"2000防御力镖人勋章\n";
	if(a.f>=3500)cout<<"3500防御力无惧勋章\n";
	if(a.s>=2000)cout<<"2000生命长命勋章\n";
	if(a.s>=4000)cout<<"4000生命仙人勋章\n";
	if(a.s>=9000)cout<<"9000生命天猫勋章\n";
	if(a.s>=12000)cout<<"12000生命铁人勋章\n";
	if(a.s>=20000)cout<<"20000生命铁战士勋章\n";
	if(a.s>=50000)cout<<"50000生命不死者勋章\n";
	if(a.q>=2000)cout<<"2000金币有钱人勋章\n"; 
	if(a.q>=4000)cout<<"4000金币地主勋章\n"; 
	if(a.q>=8000)cout<<"8000金币百万富翁勋章\n"; 
	if(a.q>=12000)cout<<"12000金币千万富翁勋章\n"; 
	if(a.q>=20000)cout<<"20000金币亿万富翁勋章\n"; 
	if(a.q>=40000)cout<<"40000金币富三代勋章\n";
	if(a.q>=100000)cout<<"100000金币聚宝盆勋章\n"; 
	if(a.dg>=10)cout<<"杀死10人小试牛刀勋章\n";
	if(a.dg>=50)cout<<"杀死50人杀手勋章\n";
	if(a.dg>=100)cout<<"杀死100人杀人狂勋章\n";
	if(a.dg>=200)cout<<"杀死200人嗜血狂勋章\n";
	if(a.dg>=500)cout<<"杀死500人侠客勋章\n";
	if(a.dg>=1000)cout<<"杀死1000人小魔王勋章\n";
	if(a.dg>=2000)cout<<"杀死2000人魔王勋章\n";
	if(a.dg>=5000)cout<<"杀死5000人大魔头勋章\n" ;
	if(a.dg>=10000)cout<<"杀死10000人阎王勋章\n";
	if(a.s>=100000&&a.j>=100&&a.g>=10000&&a.f>=10000&&a.dg>=100)cout<<"百级九殿阎罗王勋章\n"; 
	if(a.s>=1000000&&a.j>=1000&&a.g>=100000&&a.f>=100000&&a.dg>=2000)cout<<"千级朱庇特勋章\n"; 
	if(a.s>=1000000&&a.j>=1000&&a.g>=100000&&a.f>=100000&&a.dg>=10000&&a.q>=100000)cout<<"拥有所有勋章勋章收集者称号勋章\n"; 
	if(mytime>=86400)cout<<"注册时间超过1天日升日落勋章\n";
	if(mytime>=604800)cout<<"注册时间超过7天星期勋章\n";
	if(mytime>=2592000)cout<<"注册时间超过30天月圆月缺勋章\n";
	if(mytime>=7776000)cout<<"注册时间超过90天季度勋章\n";
	if(mytime>=31104000)cout<<"注册时间超过一年春夏秋冬勋章\n";
	if(mytime>=62208000)cout<<"注册时间超过两年风雨兼程勋章\n";
	if(mytime>=311040000)cout<<"注册时间超过十年老朋友勋章\n";
	if(mytime>=622080000)cout<<"注册时间超过二十年长老勋章\n";
	if(mytime>=1555200000)cout<<"注册时间超过五十年老勇者勋章\n";
	if(a.j==1&&a.dg<10&&a.f<200&&a.g<200&&a.s<2000&&mytime<86400)
	{
		system("CLS");
		cout<<"你什么勋章都没有获得。\n";
	} 
	system("PAUSE");
	system("CLS");
}
string men2[10001],men3[10001];
void zhuxiao()
{
	system("CLS");
	int id=MessageBox(NULL,"想好了吗?你的信息将不可恢复!","勇者小游戏",MB_YESNO);
	if(id==IDYES)
	{
		cout<<"正在注销中。。。";
		string dele="del .\\Tools\\"+a.na+".yz";
		system(dele.c_str());
		dele="del .\\Tools\\"+a.na+"_time.tim";
		system(dele.c_str());
		dele="del .\\Tools\\"+a.na+"set.ini";
		system(dele.c_str());
		dele="del .\\Tools\\"+a.na+".tim2";
		system(dele.c_str());
		int peon=1;
		ifstream fin60(".\\Tools\\name.ini");
		while(fin60>>men2[peon])
		{
			if(men2[peon]!=a.na)peon++;
		}
		peon--;
		cout<<endl;
		ofstream fout60(".\\Tools\\name.ini");
		for(int i=1;i<=peon;++i)fout60<<men2[i]<<endl; 
		ifstream fin70(".\\Mbs\\tuan.txt",ios::in|ios::out);
		int tuanum;
		fin70>>tuanum;
		for(int i=1;i<=tuanum;++i)
		{
			string tuaname;
			fin70>>tuaname;
			string tmp2020;
			tmp2020=".\\Mbs\\"+tuaname;
			int memnum;
			ifstream fin80(tmp2020.c_str(),ios::in|ios::out);
			fin80>>memnum;
			for(int j=1;j<=memnum;++j)
			{
				fin80>>men3[j];
				if(men3[j]==a.na)
				{
					j--;
					memnum--;
				}
			}
			ofstream fout80(tmp2020.c_str());
			fout80<<memnum<<endl;
			for(int j=1;j<=memnum;++j)
			{
				fout80<<men3[j]<<endl;
			}
		}
		MessageBox(NULL,"已注销。再见!","勇者小游戏",MB_OK);
		exit(0);
	}
}
string speak[100001],namess[100001],speak2[100001];
int spk,talking;
void liaotian()
{
	system("CLS"); 
	if(spk==-1)return ;
	while(1)
	{
		system("CLS");
		cout<<"欢迎来到聊天版块!(尚未开放)\n";
		printf(
		"输入1:一个巨大的聊天室\n"
		"输入2:私聊\n"
		"输入0:离开\n"
		);
		int m;
		cin>>m;
		if(m==0)return ;
		if(m==1)
		{
			system("CLS");
			ifstream fin_e(".\\Tools\\say.ini",ios::in|ios::out);
			ofstream fout_e(".\\Tools\\say.ini",ios::in|ios::out|ios::app);
			while(fin_e)getline(fin_e,speak[++spk]);
			if(spk<=0)cout<<"还木有人发言呢~\n";
			else
			{
				if(spk>talking&&talking!=-1)
				{
					for(int i=spk-talking;i<=spk;++i)cout<<speak[i]<<endl;
				}
				else
				{
					for(int i=1;i<=spk;++i)cout<<speak[i]<<endl;
				}
			}
			cout<<"说几句吧。说好了按Ctrl+Z即可发送!(不想说也得说)\n";
			int spk2=spk;
			while(cin)getline(cin,speak[++spk2]);
			int id=MessageBox(NULL,"确认发送?","勇者小游戏",MB_YESNO);
			if(id==IDYES)
			{
				for(int i=spk+2;i<spk2;++i)if(speak[i]!="\n")fout_e<<a.na<<":"<<speak[i]<<endl;
				a.q+=abs(rand()%10*(spk2-spk-2));
				MessageBox(NULL,"发送成功!","勇者小游戏",MB_OK);
				id=0;
				spk=-1;
				system("CLS");
				return ;
			}
			else
			{
				spk=-1;
				id=0;
				return ;
			}
		}
		else if(m==2)
		{
			ifstream finn(".\\Tools\\name.ini");
			int kk=0;
			while(finn>>namess[++kk])
			{
				//getline(finn,namess[++kk]);
				if(namess[kk]=="\n")
				{
					--kk;
					break;
				}	
			}
			system("CLS");
			--kk;
			for(int i=1;i<=kk;++i)
			{
				cout<<i<<"号聊天对象:"<<namess[i]<<endl;
			}
			cout<<"和谁聊天?(退出请按零)\n";
			int s;
			cin>>s;
			if(s==0)return ;
			string tm=".\\Tools\\"+namess[s]+".tlk";
			ofstream fouut(tm.c_str(),ios::in|ios::out|ios::app);
			system("CLS");
			int spk2=0;
			cout<<"说几句吧。说好了按Ctrl+Z即可发送!(不想说也得说)\n";
			while(cin)getline(cin,speak2[++spk2]);
			int id=MessageBox(NULL,"确认发送?","勇者小游戏",MB_YESNO);
			if(id==IDYES)
			{
				for(int i=2;i<spk2;++i)if(speak2[i]!="\n")fouut<<1<<" "<<a.na<<" "<<speak2[i]<<endl;
				a.q+=abs(rand()%4*(spk2-2));
				MessageBox(NULL,"发送成功!","勇者小游戏",MB_OK);
				id=0;
				system("CLS");
				return ;
			}
			else
			{
				return ;
			}
		}
	}
}
void shezhi()
{
	system("CLS");
	while(1)
	{
		cout<<"这里是设置中心(修改ing)\n";
		cout<<"输入1:更改密码\n";
		cout<<"输入2:更改屏幕颜色\n";
		cout<<"输入3:更改公告选项\n"; 
		cout<<"输入4:更改聊天记录显示数目\n";
		cout<<"输入0:退出\n";
		int shu;
		cin>>shu;
		if(shu==0)break;
		else if(shu==1)
		{
			string lujin=".\\Tools\\"+a.na+".yz";
			ifstream fin30(lujin.c_str(),ios::in|ios::out);
			ofstream fout30(lujin.c_str(),ios::in|ios::out);
			cout<<"请输入新密码:\n";
			string hhh_hhh_new;
			cin>>hhh_hhh_new;
			fout30<<hhh_hhh_new<<endl<<a.s<<" "<<a.g<<" "<<a.f<<" "<<a.j<<" "<<a.q<<" "<<a.dg;
			cout<<"修改成功!请重启该游戏.\n";
			fin30.close();
			fout30.close();
			system("pause");
			exit(0);
		}
		else if(shu==2)
		{
			system("CLS");
			printf(
			"颜色属性由两个十六进制数字指定 -- 第一个为背景,第二个则为前景。每个数字可以为以下任何值之一:\n0 = 黑色       8 = 灰色\n1 = 蓝色       9 = 淡蓝色\n2 = 绿色       A = 淡绿色\n3 = 浅绿色     B = 淡浅绿色\n4 = 红色       C = 淡红色\n5 = 紫色       D = 淡紫色\n6 = 黄色       E = 淡黄色\n7 = 白色       F = 亮白色\n例如: COLOR fc 在亮白色上产生亮红色\n"
			);
			cout<<"请输入前景色颜色代码:\n";
			string qj;
			cin>>qj;
			cout<<"请输入背景色颜色代码:\n";
			string bj;
			cin>>bj;
			string luji=".\\Tools\\"+a.na+"set.ini";
			ofstream fout40(luji.c_str(),ios::in|ios::out);
			fout40<<bj<<" "<<qj;
			string xiug="color "+bj+qj;
			system(xiug.c_str());
			cout<<"修改成功!\n";
			Sleep(2000);
			system("CLS");
			fout40.close();
			break;
		}
		else if(shu==3)
		{
			system("CLS");
			string luj=".\\Tools\\"+a.na+"set.ini";
			ofstream fout2020(luj.c_str(),ios::in|ios::out);
			ifstream fin2020(luj.c_str(),ios::in|ios::out);
			int a20201,b20201,c20201;
			fin2020>>a20201>>b20201>>c20201;
			if(c20201==1)
			{
				int d20201=MessageBox(NULL,"是否关闭公告功能?","勇者小游戏",MB_YESNO);
				if(d20201==IDYES)
				{
					fout2020<<a20201<<" "<<b20201<<endl<<0;
					MessageBox(NULL,"成功!","勇者小游戏",MB_OK);
				}
			}
			else
			{
				int e20201=MessageBox(NULL,"是否开启公告功能?","勇者小游戏",MB_YESNO);
				if(e20201==IDYES)
				{
					fout2020<<a20201<<" "<<b20201<<endl<<1;
					MessageBox(NULL,"成功!","勇者小游戏",MB_OK);
				}
			}
			fin2020.close();
			fout2020.close();
		}
		else if(shu==4)
		{
			system("CLS");
			string tmp_2020=".\\Tools\\"+a.na+"set.ini"; 
			ifstream fin_2020(tmp_2020.c_str(),ios::in|ios::out);
			char aa,bb,cc;
			fin_2020>>aa>>bb>>cc;
			int dd=-1;
			fin_2020>>dd;
			cout<<"您现在的设置是:";
			if(dd==-1)cout<<"最大值\n";
			else cout<<dd<<"条\n"; 
			cout<<"请输入您现在的设置的条数(若选择最大值请输入-1):";
			int de;
			cin>>de;
			ofstream fout_2020(tmp_2020.c_str());
			fout_2020<<aa<<" "<<bb<<endl<<cc<<endl<<de;
			MessageBox(NULL,"更改成功!","勇者小游戏",MB_OK);
			talking=de;
			break;
		}
		else cout<<"输入错误!";
	}
	system("CLS");
}
map<string,int> mpp;
string s3[10001],s4[10001],s5[10001];
int mm;
string names_,nameo2;
string nam[10001];
string n2020[10001],un2020[10001];
string nn2020,nn20;
string messagess;
string tumessages,tunames,whyme,mennames;
string tuanren[10001];
int main(int argc,char* argv[])
{
	//system("@echo off"); 
	SetConsoleTitle("勇者小游戏4.4");
	cout<<"加载中。。。\n"; 
	srand(time(NULL));
	ifstream fiin(".\\to.txt",ios::in|ios::out);
	ofstream fileout(".\\to.txt",ios::in|ios::out);
	int hhhh;
	fiin>>hhhh;
	if(hhhh!=0)
	{
		system("CLS");
		cout<<"请输入验证码或联系liujingcheng2019@hotmail.com要验证码\n";
		string ssss;
		cin>>ssss;
		cout<<"感谢输入!请重启该游戏。\n"; 
		if(ssss=="_54ljc_welcome_2020!")
		{
			fileout<<0;
			system("pause");
			return 0;
		}
		else
		{
			system("pause");
			return 0; 
		}
	}
	system("ping www.baidu.com -n 1>C:\\nEt.txt");
	ifstream finnet("C:\\nEt.txt",ios::in|ios::out);
	string nneett;
	getline(finnet,nneett);
	finnet.close();
	string::size_type position=nneett.find("找不到");
	if(position!=string::npos)
	{
		system("CLS");
		MessageBox(NULL,"请连接网络!","勇者小游戏",MB_OK);
		system("del C:\\nEt.txt");
		return 0;
	}
	system("del C:\\nEt.txt");
	system("CLS");
	loop2:
	string str,str1,pass,aa;
	int number;
	ifstream fin2(".\\Tools\\name.ini",ios::in|ios::out|ios::app);
	ofstream fout2(".\\Tools\\name.ini",ios::in|ios::out|ios::app);
	cout<<"欢迎来到勇者小游戏!\n输入1:登录\n输入2:注册\n";
	cin>>number;
	if(number==1)
	{
		cout<<"你的名字:";
		cin>>str;
		cout<<"你的密码:";
		cin>>str1;
		aa=".\\Tools\\"+str+".yz";
		system("CLS");
		ifstream fin(aa.c_str());
		if(fin)
		{
			a.na=str;
			fin>>pass;
			if(pass==str1)
			{
				fin>>a.s>>a.g>>a.f>>a.j>>a.q>>a.dg;;
			}
			else
			{
				MessageBox(NULL,"密码错误!","勇者小游戏",MB_OK);
				system("pause");
				return 0;
			}
		}
		else
		{
			cout<<"查无此人!\n";
			system("pause");
			system("CLS");
			return 0; 
		}
	}
	else if(number==2)
	{
		loop:
		cout<<"注册名(不能有大写字母和空格):";
		string nameo;
		cin>>nameo;
		ifstream fiin(".\\Tools\\name.ini",ios::in|ios::out);
		int ss2=1;
		while(fiin>>s5[ss2])ss2++;
		if(ss2>=10000)
		{
			MessageBox(NULL,"注册人数超过10000名,无法注册!","勇者小游戏",MB_OK);
			return 0;
		}
		for(int i=1;i<=ss2;++i)
		{
			if(s5[i]==nameo)
			{
				cout<<"有重名!请重新输入。。。\n";
				system("pause");
				system("CLS");
				goto loop;
			}
		}
		for(int i=0;i<nameo.size();++i)
		{
			if((nameo[i]>='A'&&nameo[i]<='Z')||nameo[i]==' ')
			{
				MessageBox(NULL,"出现大写字母或空格,请重新输入!","勇者小游戏",MB_OK);
				system("CLS");
				goto loop;
			}
		}
		cout<<"密码:";
		string passo;
		cin>>passo;
		nameo2=".\\Tools\\"+nameo+".yz";
		ifstream fin20(nameo2.c_str());
		ofstream fout20(nameo2.c_str());
		str=nameo;
		a.na=nameo;
		a.s=1000;
		a.f=100;
		a.q=200;
		a.g=200;
		a.j=1;
		a.dg=0;
		fout20<<passo<<endl<<1000<<" "<<100<<" "<<100<<" "<<1<<" "<<200<<" "<<0<<endl;
		cout<<"注册成功!\n";
		string tmptime=".\\Tools\\"+a.na+".tim2";
		ofstream ftime2(tmptime.c_str());
		ftime2<<time(NULL);
		ftime2.close();
		system("pause");
		system("CLS");
	}
	else 
	{
		system("CLS");
		cout<<"输入错误!";
		Sleep(1500);
		system("CLS");
		goto loop2;
	}
	int m;
	fout2<<str<<endl;
	int i=1;
	while(fin2>>s3[i])i++;
	sort(s3+1,s3+i);
	for(int j=1;j<i;++j)
	{
		if(j==1||s3[j]!=s3[j-1])
		{
			mm++;
			s4[mm]=s3[j];
		} 
	}
	ofstream fout3(".\\Tools\\name.ini");
	for(int i=1;i<=mm;++i)fout3<<s4[i]<<endl;
	string times=".\\Tools\\"+str+"_time.tim";
	long long timenow=time(NULL);
	ifstream fintime(times.c_str(),ios::in|ios::out);
	long long timeover;
	fintime>>timeover;
	ofstream foutime(times.c_str());
	foutime<<timenow<<endl;
	fintime.close();
	foutime.close();
	a.na=str;
	string sttr=".\\Tools\\"+a.na+"set.ini",qj1,bj1;
	ifstream fin401(sttr.c_str(),ios::in|ios::out);
	fin401>>bj1>>qj1;
	string tmp="color "+bj1+qj1;
	system(tmp.c_str());
	if(timenow-timeover>=86400)
	{
		ofstream foutime(times.c_str(),ios::in|ios::out);
		int qq=rand()%10+1; 
		a.q+=qq;
		string qqq="恭喜您获得";
		char qqqqq=qq+'0';
		if(qq<10)qqq=qqq+qqqqq+"元!";
		else qqq=qqq+"10元!";
		MessageBox(NULL,qqq.c_str(),"勇者小游戏",MB_OK);
	}
	a.na=str;
	if(a.s>a.j*1000) a.s=a.j*1000;
	if(a.g>a.j*100) a.g=a.j*100;
	if(a.f>a.j*100) a.f=a.j*100;
	string lujin2=".\\Tools\\"+a.na+"set.ini";
	ifstream fin30(lujin2.c_str(),ios::in|ios::out);
	string qianjin,beijin;
	fin30>>qianjin>>beijin;
	int about_news,talkings;
	fin30>>about_news>>talkings;
	if(!fin30)
	{
		ofstream fout30(lujin2.c_str());
		qianjin="0";
		beijin="7";
		about_news=1;
		talkings=10;
		fout30<<qianjin<<" "<<beijin<<endl<<1;
	}
	string setting_c="color "+qianjin+beijin;
	system(setting_c.c_str());
	talking=talkings;
	if(about_news)
	{
		ifstream news(".\\Tools\\news.ini",ios::in|ios::out);
		int flagn=0;
		news>>flagn;
		if(flagn==0||!news);
		if(flagn==1)
		{
			string newss,longnews;
			while(news>>newss)longnews=longnews+newss+"\n";
			MessageBox(NULL,longnews.c_str(),"勇者小游戏公告",MB_OK);
		}
	}
	fin30.close();
	fin401.close();
	string mtmp=".\\Tools\\"+a.na+".tlk";
	ifstream mesin(mtmp.c_str(),ios::in|ios::out);
	string renmin; 
	while(mesin)
	{
		nmp:
		int tl=0;
		mesin>>tl;
		if(tl==1)
		{
			mesin>>nn2020;
			getline(mesin,nn20);
			//if(mesidx[nn2020[ks]]!=1)messagess[nn2020[ks]]=nn2020[ks]+"对你说:";
			//mesidx[nn2020[ks]]=1;
			//messagess[nn2020[ks]]+=nn20[ks]+"\n";
			messagess=nn2020+"对你说:"+nn20;
			MessageBox(NULL,messagess.c_str(),"勇者小游戏",MB_OK);
		}
		else if(tl==2)
		{
			mesin>>mennames>>tunames>>whyme;
			//cout<<ks2<<" "<<mennames[ks2]<<" "<<tunames[ks2]<<" "<<whyme[ks2]<<endl;
			tumessages="团队"+tunames+"的团主"+mennames+"将该团解散\n理由:"+whyme;
			MessageBox(NULL,tumessages.c_str(),"勇者小游戏",MB_OK);
		}
		else if(tl==3)
		{
			mesin>>renmin;
			mpp[renmin]++;
		}
		else if(tl==4)
		{
			string quzhuzhe,tuanduiming,yuanyin;
			mesin>>quzhuzhe>>tuanduiming>>yuanyin;
			string quzhudemessage="您被"+tuanduiming+"的团主"+quzhuzhe+"驱逐出团。\n原因:"+yuanyin;
			MessageBox(NULL,quzhudemessage.c_str(),"勇者小游戏",MB_OK); 
		}
		else if(tl==5)
		{
			string inv1,inv2;
			mesin>>inv1>>inv2;
			string invtmp=inv1+"邀请你加入团队"+inv2+"\n是否加入?";
			int inv_r=MessageBox(NULL,invtmp.c_str(),"勇者小游戏",MB_YESNO);
			if(inv_r==IDYES)
			{
				string invj=".\\Mbs\\"+inv2;
				ifstream fin_j(invj.c_str(),ios::in|ios::out);
				ofstream fout_j(invj.c_str(),ios::in|ios::out);
				int mbsn=0;
				fin_j>>mbsn;
				for(int i=1;i<=mbsn;++i)
				{
					fin_j>>tuanren[i];
					if(tuanren[i]==a.na)
					{
						MessageBox(NULL,"您此前已加入该团队!","勇者小游戏",MB_OK);
						goto nmp;
					}
				}
				tuanren[mbsn+1]=a.na;
				fout_j<<mbsn+1<<endl;
				for(int i=1;i<=mbsn+1;++i)
				{
					fout_j<<tuanren[i]<<endl;
				}
				MessageBox(NULL,"已加入","勇者小游戏",MB_OK);
			}
		}
	}
	//for(int i=1;i<ks;++i)MessageBox(NULL,messagess[i].c_str(),"勇者小游戏",MB_OK);
	//for(int i=1;i<ks2;++i)MessageBox(NULL,tumessages[i].c_str(),"勇者小游戏",MB_OK);
	map<string,int>::iterator it;
	for(it=mpp.begin();it!=mpp.end();++it)
	{
		stringstream ssz;
		ssz<<it->second;
		string tmptmp;
		ssz>>tmptmp;
		string ttmmpp="您被"+it->first+"攻击了"+tmptmp+"次!";
		MessageBox(NULL,ttmmpp.c_str(),"勇者小游戏",MB_OK);
	}
	mesin.close();
	string mtmp2="erase /S "+mtmp;
	system("@echo off");
	system(mtmp2.c_str());
	system("@echo on");
	string stmp=".\\Tools\\"+a.na+".tim2";
	ifstream fiinn(stmp.c_str(),ios::in|ios::out);
	int ttiimmee;
	if(!fiinn>>ttiimmee)
	{
		ifstream ffiinn(stmp.c_str());
		ofstream foonn(stmp.c_str());
		foonn<<time(NULL);
		fiinn.close();
		ffiinn.close();
		foonn.close();
	}
	fiinn.close();
	system("CLS");
	while(1)
	{
		print();
		cin.clear();
		cin>>m;
		if(!m)
		{
			int at=MessageBox(NULL,"确认退出?","勇者小游戏",MB_YESNO);
			if(at==IDYES)break;
			else
			{
				system("CLS");
				continue ;
			}
			system("CLS");
			continue;
		} 
		if(m==1)
		{
			system("CLS");
			yao();
		}
		else if(m==2)
		{
			system("CLS");
			wuqi();
		} 
		else if(m==3)
		{
			system("CLS");
			fangju();
		}
		else if(m==4)
		{
			system("CLS");
			caipiao();
		}
		else if(m==5)
		{
			system("CLS");
			daguai();
		}
		else if(m==6)
		{
			system("CLS");
			zhuangtai();
		}
		else if(m==7)
		{
			system("CLS");
			shengji();
		}
		else if(m==8)
		{
			system("CLS");
			juedou();
		}
		else if(m==9)
		{
			system("CLS");
			chuanmen();
		}
		else if(m==10)
		{
			system("CLS");
			paihangbang();
		}
		else if(m==11)
		{
			system("CLS");
			tuandui();
		}
		else if(m==12)
		{
			system("CLS");
			xunzhang();
		}
		else if(m==13)
		{
			system("CLS");
			zhuxiao();
		}
		else if(m==14)
		{
			system("CLS");
			cin.clear();
			spk=0;
			liaotian();
		}
		else if(m==15)
		{
			system("CLS");
			cin.clear();
			shezhi();
		}
		else
		{
			cout<<"输入错误!\n";
			Sleep(1500);
			system("CLS");
		}
		system("CLS");
	}
	ShowWindow(FindWindow("ConsoleWindowClass",argv[0]),0);
	if(a.g>a.j*100)a.g=a.s*100;
	if(a.f>a.j*100)a.f=a.s*100;
	if(a.s>a.j*1000)a.s=a.j*1000;
	ofstream fout(aa.c_str());
	fout<<str1<<endl;
	fout<<a.s<<" "<<a.g<<" "<<a.f<<" "<<a.j<<" "<<a.q<<" "<<a.dg<<endl;
	return 0;
}
/*
.tlk  
1聊天
2解散群聊 
*/

 

刘景程在2020-05-31 17:30:39追加了内容

偶偶对了,有几个文件不能少

为了方便,就把打包过的文件放出来吧

记得解压后再玩偶

还有,如果你打不开,要把程序重新编译一遍才行

下载地址(64位的,32位请重新编译):http://my.zp68.com/downfile.php?file_id=114432&file_key=GWRNXxhD


0
已采纳
李泽远
李泽远
高级天翼
高级天翼

怎么做到聊天的?文件操作?网络?

不管怎么说,这是大佬

李泽远在2020-05-31 17:41:41追加了内容

额,怎么和别人聊天?

输入别人的用户名吗?我也不知道别人用户名啊。

李泽远在2020-05-31 17:52:59追加了内容

明白了,谢谢大佬!

我超喜欢这个游戏!

不过聊天区没人说话,大家多发言呀

李泽远在2020-05-31 21:44:32追加了内容

巨佬,什么时候能聊天了把文件发出来给我们学(wán)学(wan)。

期待!

​​​​​​​

0
0
0
丁博扬
丁博扬
中级天翼
中级天翼

大佬不愧是大佬,厉害。

0
赵泰来
赵泰来
高级光能
高级光能

struct users{
    char name[105];int namelen;
    char password[105];int passwordlen;
    long long gold,h,u;
}user[100005];//这是角色定义,看懂么
int usertot,nowuser;
void fileout(){
    freopen("game.txt","w",stdout);
    cout<<usertot<<endl;
    for (int i=1;i<=usertot;i++)cout<<user[i].name<<' '<<user[i].namelen<<' '<<user[i].password<<' '<<user[i].passwordlen<<' '<<user[i].gold<<' '<<user[i].h<<' '<<user[i].u<<endl;
    exit(0);
}//保存

以上是保存代码

0
曹博扬
曹博扬
初级天翼
初级天翼

very good

我想问问你学到哪了???

0
0
刘欣然
刘欣然
高级光能
高级光能

发的东东别人都可以看得到嘛

注册账号后关闭程序可以再次用那个号进入嘛

0
0
王子逸
王子逸
新手天翼
新手天翼

这时间...

王子逸在2020-05-31 17:05:07追加了内容

注册之后,登录也查无此人 聊天也没人

0
赵逸凡
赵逸凡
初级启示者
初级启示者

膜拜第八阶段考试比我高50分的巨佬。。。(虽然您上次摸鱼了)

建议用file等操作导入某浏览器,并且自动进入一网址(实时聊天区),然后实现了玩家的实时交流(异 想 天 开 )

0
李素妍
李素妍
新手天翼
新手天翼

是你,是你,真的是你

是你,是你,永远是你

让我看到让我遇到你

0
潘晨皓
潘晨皓
高级天翼
高级天翼

666!

膜拜大佬!   QWQ

0
0
0
0
0
0
岳成浩
岳成浩
资深守护
资深守护

游戏超好玩!

666

可惜不能聊天。

0
0
0
沈峻宇
沈峻宇
资深天翼
资深天翼

大佬,你的游戏我认可,希望开发好友关注界面,增加互动,游戏更有趣哦!

0
王子逸
王子逸
新手天翼
新手天翼

我提一个建议:你能不能添加一个任务系统。。。这样游戏会更好玩

ps:用函数做

我要回答