#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
#include<ctime>
#include<stdio.h>
#include<time.h>
#define int long long
#define debug() cout<<"come here\n"
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pb push_back
using namespace std;
int qpow(int a,int b,int p)
{
int ret=1;
while(b)
{
if(b&1)ret=(ret*a)%p;
a=(a*a)%p;
b>>=1;
}
return ret;
}
void slowout(string s,int x)
{
for(int i=0;i<s.size();i++)
{
Sleep(x);
cout<<s[i];
}
}
const int MOD=1145141923;
string password;
int speed=50;
string name;
int rar_health[21]={0,10,};
int crafting_rate[21]={0,64000,32000,16000,8000,4000,2000,1000};
string drop[11]={"0","1","2","3","4","5","6","7","8","9","10"};
map<string,int> petal_id,mob_id;
string rarity[21]={"unknown","common","unusual","rare","epic","legendary","mythic","ultra","super","unique"};
int cnt_rar=9;
map<string,int> rarity_id;
vector<int> petal_number[21];
double expp[5001];
int init()
{
ifstream in1("Game_Data.ini");
if (!in1)
{
slowout("You need to have the game data first!Name it Game_Data.ini qwq!\n",speed);
return 1;
}
for(int i=0;i<=cnt_rar;i++)
{
rarity_id[rarity[i]]=i;
}
expp[1]=10;
for(int i=2;i<=5000;i++)
{
if(i<=30)expp[i]=expp[i-1]*1.2;
else if(i<=50) expp[i]=expp[i-1]*1.15;
else expp[i]=expp[i-1]*1.1;
}
petal_number[0][0]=10;
}
int coin,now_exp,step,slot=5,now_lv=1;
int mob_defeted[17];
int petal_get_num[17];
int petal_lost_num[17];
bool flag=0;
double atk;
struct node{
int id;
int rar;
};
node your_petal[21];
int hsh(int x,int y)
{
while(y)
{
x=(131*x+y%10)%MOD;
y/=10;
}
return x;
}
void save(bool cout_flag=1)
{
ofstream out1("Data.ini");
int hash=0,password_hash=0;
for(int i=0;i<password.size();i++)
{
password_hash=hsh(password_hash,password[i]);
}
out1<<name<<' '<<password_hash<<' '<<coin<<' '<<now_exp<<' '<<step<<' '<<slot<<' '<<now_lv<<' '<<atk<<' ';
hash=hsh(hash,coin);
hash=hsh(hash,now_exp);
hash=hsh(hash,step);
hash=hsh(hash,slot);
hash=hsh(hash,now_lv);
hash=hsh(hash,atk);
for(int i=1;i<=slot;i++)
{
out1<<your_petal[i].id<<' '<<your_petal[i].rar<<' ';
hash=hsh(hash,your_petal[i].id);
hash=hsh(hash,your_petal[i].rar);
}
if(cout_flag)slowout("Saving successfully!\n",speed);
for(int i=1;i<=cnt_rar;i++)
{
for(auto pn:petal_number[i])
{
out1<<pn<<' ';
hash=hsh(hash,pn[i][j]);
}
}
for(int i=1;i<=cnt_rar;i++)
{
out1<<mob_defeted[i]<<' ';
hash=hsh(hash,mob_defeted[i]);
}
for(int i=1;i<=cnt_rar;i++)
{
out1<<petal_lost_num[i]<<' ';
hash=hsh(hash,petal_lost_num[i]);
}
for(int i=1;i<=cnt_rar;i++)
{
out1<<petal_get_num[i]<<' ';
hash=hsh(hash,petal_get_num[i]);
}
out1<<hash<<' ';
}
int read_acc()
{
ifstream in1("Data.ini");
if (!in1)
{
slowout("You need to have a saving first!\n",speed);
return 1;
}
slowout("Password:",speed);
cin>>password;
int hash=0,now_password_hash=0,password_hash=0;
for(int i=0;i<password.size();i++)
{
now_password_hash=hsh(now_password_hash,password[i]);
}
flag=1;
in1>>name>>password_hash>>coin>>now_exp>>step>>slot>>now_lv>>atk;
if(now_password_hash!=password_hash)return 2;
hash=hsh(hash,coin);
hash=hsh(hash,now_exp);
hash=hsh(hash,step);
hash=hsh(hash,slot);
hash=hsh(hash,now_lv);
hash=hsh(hash,atk);
for(int i=1;i<=slot;i++)
{
in1>>your_petal[i].id>>your_petal[i].rar;
hash=hsh(hash,your_petal[i].id);
hash=hsh(hash,your_petal[i].rar);
}
for(int i=1;i<=cnt_rar;i++)
{
for(int j=0;j<petal_numbet[i].size();j++)
{
in1>>petal_number[i][j];
hash=hsh(hash,petal_number[i][j]);
}
}
for(int i=1;i<=cnt_rar;i++)
{
in1>>mob_defeted[i];
hash=hsh(hash,mob_defeted[i]);
}
for(int i=1;i<=cnt_rar;i++)
{
in1>>petal_lost_num[i];
hash=hsh(hash,petal_lost_num[i]);
}
for(int i=1;i<=cnt_rar;i++)
{
in1>>petal_get_num[i];
hash=hsh(hash,petal_get_num[i]);
}
int acc_hash=0;
in1>>acc_hash;
if(hash!=acc_hash)return 3;
slowout("Loading...\n",300);
system("cls");
slowout("Read successfully!\n",speed);
return 0;
}
signed main()
{
// ios::sync_with_stdio(0);
// cin.tie(0);
// cout.tie(0);
init();
mt19937 myrng(time(0));
slowout("Loading...\n",300);
slowout("Do you want read ur account?(Y.yes other.no)\n",20);
char loadacc;
loadacc=_getch();
if(loadacc=='Y'||loadacc=='y')
{
int ret=read_acc();
if(ret==2)
{
slowout("Password wrong!\n",speed);
return 0;
}
if(ret==3)
{
slowout("D O N ' T C H A N G E T H E A C C O U N T \n",300);
return 0;
}
}
if(!flag)
{
slowout("This is florr.io!\nWelcome to play\nWhat is ur name\n",20);
cin>>name;
while(1)
{
slowout("Please type your password\n",20);
string str;
cin>>password;
system("cls");
slowout("Please type it again\n",20);
cin>>str;
if(str!=password)
{
slowout("Wrong password!\n",20);
}
else break;
}
system("cls");
slowout("Welcome ",20);
slowout(name,20);
slowout(" to play this game\n",20);
}
else
{
slowout("This is florr.io!\n",20);
slowout("Welcome ",20);
slowout(name,20);
slowout(" to play this game\n",20);
}
char sped;
while(1)
{
slowout("What cout speed will you choose:1.fast 2.medium 3.slow\n",20);
sped=_getch();
if(sped=='1')
{
speed=0;
}
if(sped=='2')
{
speed=10;
}
if(sped=='3')
{
speed=50;
}
slowout("Is this speed ok?(press y to continue)\n",speed);
char xddd;
xddd=_getch();
if(xddd=='y'||xddd=='Y')
{
break;
}
system("pause");
system("cls");
}
bool auto_save_flag=0;
slowout("Do you need auto saving?If yes press Y.\n",speed);
char auto_save_getch=_getch();
if(auto_save_getch=='y'||auto_save_getch=='Y')
{
auto_save_flag=1;
}
system("cls");
if(!flag)
{
slowout("You have 5 common basic\n",speed);
petal_number[1][1]+=5;
petal_get_num[1]+=5;
system("pause");
system("cls");
}
int iiiii=0;
while(1)
{
slowout(name+" what r u going to do now? G.get coins E.equip petals F.world I.check ur coin and lv C.craft S.saving ur account\n",speed);
char c;
c=_getch();
system("cls");
// if(c=='D'||c=='d')
// {
// for(int i=1;i<=7;i++)
// {
// for(int j=1;j<=cnt_rar;j++)
// {
// petal_number[j][i]+=114514;
// }
// }
// coin+=INF;
// now_lv=250;
// atk=1000000;
// }
if(c=='S'||c=='s')
{
save();
}
else if(c=='G'||c=='g')
{
int add_coin=1,add_exp=1;
coin+=add_coin;
now_exp+=add_exp;
step++;
slowout("You keep going...\n",speed);
}
else if(c=='E'||c=='e')
{
for(int i=0;i<petal_number[0].size();i++)
{
bool flag=0;
for(int j=0;j<=cnt_rar;j++)
{
if(petal_number[j][i])
{
slowout("You have ",0);
cout<<petal_number[j][i];
slowout(" "+rarity[j]+" "+petal[i]+"\n",0);
flag=1;
}
}
if(flag)cout<<"\n";
}
slowout("You have ",speed);
cout<<slot;
slowout(" slots\n",speed);
slowout("They r :\n",speed);
for(int i=1;i<=slot;i++)
{
slowout("| "+rarity[your_petal[i].rar]+" "+petal[your_petal[i].id]+" ",min(speed,(int)10));
}
cout<<"|\n";
slowout("What do u want to choose?(use number to choose,like common basic change to first slot=common basic 1,unusual basic to second slot=unusual basic 2,common coin to first slot=common coin 1)\n",min(speed,(int)10));
string r,p;
int num;
cin>>r>>p>>num;
if(petal_number[rarity_id[r]][petal_id[p]]<=0)
{
slowout("You dh any this petal!\n",speed);
system("pause");
system("cls");
continue;
}
if(num>slot||num<1)
{
slowout("Error!\n",speed);
system("pause");
system("cls");
continue;
}
petal_number[rarity_id[r]][petal_id[p]]--;
petal_number[your_petal[num].rar][your_petal[num].id]++;
atk+=rarity_id[r]+petal_atk[petal_id[p]]-your_petal[num].rar-petal_atk[your_petal[num].id];
your_petal[num].rar=rarity_id[r];
your_petal[num].id=petal_id[p];
slowout("Change successfully!\n",speed);
}
else if(c=='I'||c=='i')
{
slowout("You have ",speed);
cout<<coin;
slowout(" coin and ",speed);
cout<<now_exp;
slowout(" exp and ur lv is ",speed);
cout<<now_lv<<'\n';
slowout("You have ",speed);
cout<<slot;
slowout(" slots\n",speed);
slowout("They r :\n",speed);
for(int i=1;i<=slot;i++)
{
slowout("| "+rarity[your_petal[i].rar]+" "+petal[your_petal[i].id]+" ",min(speed,(int)10));
}
cout<<"|\n";
slowout("Your atk is ",speed);
cout<<atk<<'\n';
slowout(" mob defeted petal got petal lost\n",speed);
for(int i=1;i<=cnt_rar;i++)
{
cout<<setw(15)<<mob_defeted[i]<<" ";
cout<<setw(13)<<petal_get_num[i]<<" ";
cout<<setw(14)<<petal_lost_num[i]<<" ("<<rarity[i]<<")\n";
}
}
else if(c=='F'||c=='f')
{
//fighting
}
else if(c=='C'||c=='c')
{
for(int i=0;i<petal_number[0].size();i++)
{
bool flag=0;
for(int j=0;j<=cnt_rar;j++)
{
if(petal_number[j][i]>=5)
{
slowout("You have ",0);
cout<<petal_number[j][i];
slowout(" "+rarity[j]+" "+petal[i]+"\n",0);
flag=1;
}
}
if(flag)cout<<"\n";
}
slowout("What petal will you want craft?(like craft 5 common basic=common basic 5,at least craft 5 petals)\n",speed);
string r,p;
int num;
cin>>r>>p>>num;
if(num<5||petal_number[rarity_id[r]][petal_id[p]]<num)
{
slowout("Error!\n",speed);
}
else
{
int craft_num=0,now_petal_number=num;
while(now_petal_number>=5)
{
int rng=myrng()%100000+1;
if(rng<=crafting_rate[rarity_id[r]])
{
craft_num++;
now_petal_number-=5;
petal_lost_num[rarity_id[r]]+=5;
petal_get_num[rarity_id[r]+1]+=1;
}
else
{
int losttt=myrng()%4+1;
petal_lost_num[rarity_id[r]]+=losttt;
now_petal_number-=losttt;
}
}
slowout("You crafted ",speed);
cout<<craft_num;
slowout(" "+rarity[rarity_id[r]+1]+" "+p+", and you lost ",speed);
cout<<num-now_petal_number;
slowout(" "+r+" "+p+".\n",speed);
petal_number[rarity_id[r]][petal_id[p]]-=num-now_petal_number;
petal_number[rarity_id[r]+1][petal_id[p]]+=craft_num;
}
}
else
{
cout<<"Wrong key!\n";
}
while(now_lv<5000&&now_exp>=expp[now_lv])
{
now_exp-=expp[now_lv];
slowout("Lv up! Now u r ",speed);
now_lv++;
cout<<now_lv;
slowout(" lv now\n",speed);
}
iiiii++;
iiiii%=10;
if(iiiii==0&&auto_save_flag)
{
save();
slowout("(auto saving)\n",speed);
}
system("pause");
system("cls");
}
return 0;
}