This repository has been archived by the owner on Aug 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
141 lines (120 loc) · 2.6 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
Jordi Hoock Castro
*/
#include "system.cpp"
using namespace std;
/*
Variables
*/
string text;
string TempSelected;
bool loggedIN = false;
bool comeFromReg = false;
bool Registered;
bool maintence = false;
string regorlog;
/*
A structure from base of user details.
*/
struct user
{
string username;
string password;
}*player, u;
/*
Principal Programm
*/
int main ()
{
/*
Instancing player structure
*/
player = &u;
if (! maintence)
{
/*
What do you want, register or login?
*/
cout << "\nWelcome to SimpleRPG, your funny and simple roleplay game! \n" << endl;
cout << "Hey guest!, you must login or register in order to be able play! \n" << endl;
cout << "MENU\n1. Use the command '/register' to register\n2. Use the command '/login' to login" << endl;
cout << "\nOPTION: ";
cin >> regorlog;
cout << endl;
/*
Menu, is for register and login the same
*/
if (regorlog == "/register" || regorlog == "/login")
{
cout << "Username: ";
cin >> player->username;
cout << "Password: ";
cin >> player->password;
}
else
{
cout << "What is your intention ;) ";
}
/*
Creating the object with user details, and
debug mode, maintence mode.
*/
core sys(&player->username, &player->password, false, maintence);
core *_system = &sys;
/*
The user want to register
*/
if(regorlog == "/register")
{
if(_system->reg())
{
loggedIN = true;
comeFromReg = true;
}
else
cout << "Sorry, Your name already exists in our database" << endl;
}
/*
Want the user login?, Yes? then check's if the user exists
*/
if(regorlog == "/login")
loggedIN = _system->login();
}
else
{
/*
Uh uh! Maintence is on.
*/
cout << "\nSystem is in maintence, please be patient!\n" << endl;
}
if (loggedIN)
{
if(comeFromReg)
cout << "\nYou hace succesfully registered " << player->username << endl;
else
cout << "\nWelcome " << player->username << " Select your action please" << endl;
cout << "\nOPTIONS: \n";
cout << "\nExit Game: '/exit'\n";
cout << "See stats: '/stats'\n";
cout << "Credits: '/credits'\n" << endl;
cout << "OPTION: ";
core us(&player->username, &player->password, false, maintence);
core *user = &us;
while (cin >> text)
{
if(text == "/stats")
{
if(user->InitStats())
{
cout << "\nStats of user: " << user->userstats[0] << endl;
cout << "Type of player: " << user->userstats[1] << endl;
cout << "Money of player: " << user->userstats[2] << endl;
}
}
if(text == "/exit")
break;
}
}
else if(regorlog != "/register")
cout << "Username is wrong" << endl;
}