|
@@ -1,12 +1,11 @@
|
|
|
/*
|
|
|
- Space Construct by Beanzilla
|
|
|
-
|
|
|
- Beanzilla@21:4/110 on fsxNet
|
|
|
+ Space Construct v0.3-dev
|
|
|
+ Beanzilla@21:4/110 on FsxNet
|
|
|
+ Beanzilla@637:1/110 on HappyNet
|
|
|
*/
|
|
|
|
|
|
-// Verion 0.1-dev
|
|
|
#define VERSION_MAJOR 0
|
|
|
-#define VERSION_MINOR 2
|
|
|
+#define VERSION_MINOR 3
|
|
|
#ifndef VERSION_TYPE
|
|
|
#define VERSION_TYPE "dev"
|
|
|
#endif
|
|
@@ -284,16 +283,20 @@ int yesNo() {
|
|
|
ch = md_get_answer("YyNn\r");
|
|
|
md_printf("\r\n");
|
|
|
switch(tolower(ch)) {
|
|
|
- case '\r':
|
|
|
case 'y':
|
|
|
done = 1;
|
|
|
break;
|
|
|
+ case '\r':
|
|
|
case 'n':
|
|
|
break;
|
|
|
}
|
|
|
return done;
|
|
|
}
|
|
|
|
|
|
+int randrange(int min, int max){
|
|
|
+ return min + rand() / (RAND_MAX / (max - min + 1) + 1);
|
|
|
+}
|
|
|
+
|
|
|
int locate_player(char first[], char last[]) {
|
|
|
// returns user id for given real name and 0 for no record found
|
|
|
sqlite3 *db;
|
|
@@ -365,10 +368,11 @@ user_inf load_player(int uuid) {
|
|
|
result.shieldsup = sqlite3_column_int(stmt, 12);
|
|
|
result.laston = sqlite3_column_int(stmt, 13);
|
|
|
} else {
|
|
|
- dolog("E: Unable to locate user with id=%d got %s (%d)", uuid, sqlite3_errmsg(db), rc);
|
|
|
+ //dolog("E: Unable to locate user with id=%d got %s (%d)", uuid, sqlite3_errmsg(db), rc);
|
|
|
sqlite3_finalize(stmt);
|
|
|
sqlite3_close(db);
|
|
|
- md_exit(-1);
|
|
|
+ result.uid = 0;
|
|
|
+ return result;
|
|
|
}
|
|
|
sqlite3_finalize(stmt);
|
|
|
sqlite3_close(db);
|
|
@@ -480,6 +484,39 @@ void delete_player(int uuid) {
|
|
|
sqlite3_close(db);
|
|
|
}
|
|
|
|
|
|
+void delete_players() {
|
|
|
+ sqlite3 *db;
|
|
|
+ sqlite3_stmt *stmt;
|
|
|
+ char sqlbuffer[256];
|
|
|
+ int rc = sqlite3_open("spaceconstruct.db3", &db);
|
|
|
+ if(rc) { // Did we do a successful open?
|
|
|
+ dolog("E: failed opening database %s", sqlite3_errmsg(db));
|
|
|
+ sqlite3_close(db);
|
|
|
+ md_exit(-1);
|
|
|
+ }
|
|
|
+ sqlite3_busy_timeout(db, 5000);
|
|
|
+ strcpy(sqlbuffer, "DELETE FROM user;");
|
|
|
+ sqlite3_prepare_v2(db, sqlbuffer, strlen(sqlbuffer) + 1, &stmt, NULL);
|
|
|
+ rc = sqlite3_step(stmt);
|
|
|
+ if (rc != SQLITE_DONE){
|
|
|
+ dolog("E: Delete_players 1/2, Unexpected error got %s (%d)", sqlite3_errmsg(db), rc);
|
|
|
+ sqlite3_finalize(stmt);
|
|
|
+ sqlite3_close(db);
|
|
|
+ md_exit(-1);
|
|
|
+ }
|
|
|
+ strcpy(sqlbuffer, "UPDATE sqlite_sequence SET seq = 0 WHERE name='user';");
|
|
|
+ sqlite3_prepare_v2(db, sqlbuffer, strlen(sqlbuffer) + 1, &stmt, NULL);
|
|
|
+ rc = sqlite3_step(stmt);
|
|
|
+ if (rc != SQLITE_DONE){
|
|
|
+ dolog("E: Delete_players 2/2, Unexpected error got %s (%d)", sqlite3_errmsg(db), rc);
|
|
|
+ sqlite3_finalize(stmt);
|
|
|
+ sqlite3_close(db);
|
|
|
+ md_exit(-1);
|
|
|
+ }
|
|
|
+ sqlite3_finalize(stmt);
|
|
|
+ sqlite3_close(db);
|
|
|
+}
|
|
|
+
|
|
|
int display_all_players() {
|
|
|
sqlite3 *db;
|
|
|
sqlite3_stmt *stmt;
|
|
@@ -499,7 +536,11 @@ int display_all_players() {
|
|
|
md_printf("`bright white` %s (%d)\r\n", sqlite3_column_text(stmt, 1), sqlite3_column_int(stmt, 3));
|
|
|
total += 1;
|
|
|
}
|
|
|
- md_printf("`green`There are a total of `bright green`%d`green` players\r\n", total);
|
|
|
+ if(total > 1) {
|
|
|
+ md_printf("`green`There are a total of `bright green`%d`green` players\r\n", total);
|
|
|
+ } else {
|
|
|
+ md_printf("`green`There are a total of `bright green`%d`green` player\r\n", total);
|
|
|
+ }
|
|
|
sqlite3_finalize(stmt);
|
|
|
sqlite3_close(db);
|
|
|
return total;
|
|
@@ -517,34 +558,37 @@ user_inf build_menu(user_inf my) {
|
|
|
ch = md_get_answer("GgAaSsCcRr\r");
|
|
|
switch(tolower(ch)) {
|
|
|
case 'g':
|
|
|
- if(my.metal >= 4) {
|
|
|
- my.metal -= 4;
|
|
|
+ if(my.metal >= (4 * (my.guns + 1))) {
|
|
|
+ my.metal -= (4 * (my.guns + 1));
|
|
|
my.guns += 1;
|
|
|
+ my.hitpoints += 1;
|
|
|
didUp = 1; // We need to save
|
|
|
md_printf("`bright green`Added a new gun!\r\n`white`");
|
|
|
paws();
|
|
|
} else {
|
|
|
- md_printf("`bright red`You don't have the 4 metal for this!\r\n`white`");
|
|
|
+ md_printf("`bright red`You don't have the %d metal for this!\r\n`white`", (4 * (my.guns + 1)));
|
|
|
paws();
|
|
|
}
|
|
|
break;
|
|
|
case 'a':
|
|
|
- if(my.metal >= 3) {
|
|
|
- my.metal -= 3;
|
|
|
+ if(my.metal >= (3 * (my.armors + 1))) {
|
|
|
+ my.metal -= (3 * (my.armors + 1));
|
|
|
my.armors += 1;
|
|
|
- my.armorpoints += 4;
|
|
|
+ my.hitpoints += 1;
|
|
|
+ my.armorpoints += 8;
|
|
|
didUp = 1; // We need to save
|
|
|
md_printf("`bright green`Added a new armor!\r\n`white`");
|
|
|
paws();
|
|
|
} else {
|
|
|
- md_printf("`bright red`You don't have the 3 metal for this!\r\n`white`");
|
|
|
+ md_printf("`bright red`You don't have the %d metal for this!\r\n`white`", (3 * (my.armors + 1)));
|
|
|
paws();
|
|
|
}
|
|
|
break;
|
|
|
case 's':
|
|
|
- if(my.metal >= 6) {
|
|
|
- my.metal -= 6;
|
|
|
+ if(my.metal >= (6 * (my.shields + 1))) {
|
|
|
+ my.metal -= (6 * (my.shields + 1));
|
|
|
my.shields += 1;
|
|
|
+ my.hitpoints += 1;
|
|
|
if(my.shieldsup == 0) {
|
|
|
my.shieldpoints += 3;
|
|
|
} else {
|
|
@@ -554,7 +598,7 @@ user_inf build_menu(user_inf my) {
|
|
|
md_printf("`bright green`Added a new shield!\r\n`white`");
|
|
|
paws();
|
|
|
} else {
|
|
|
- md_printf("`bright red`You don't have the 6 metal for this!\r\n`white`");
|
|
|
+ md_printf("`bright red`You don't have the %d metal for this!\r\n`white`", (6 * (my.shields + 1)));
|
|
|
paws();
|
|
|
}
|
|
|
break;
|
|
@@ -564,19 +608,19 @@ user_inf build_menu(user_inf my) {
|
|
|
break;
|
|
|
case 'r':
|
|
|
if(my.experience > 25) {
|
|
|
- if(my.metal > 10) {
|
|
|
+ if(my.metal > 25) {
|
|
|
my.experience -= 25;
|
|
|
- my.metal -= 10;
|
|
|
+ my.metal -= 25;
|
|
|
my.fuel += 5;
|
|
|
didUp = 1;
|
|
|
- md_printf("`bright green`Made 5 fuel using 25 experience and 10 metal!\r\n");
|
|
|
+ md_printf("`bright green`Made 5 fuel using 25 experience and 25 metal!\r\n");
|
|
|
paws();
|
|
|
} else {
|
|
|
- md_printf("`bright red`You need 25 experience and 10 metal to make fuel!\r\n");
|
|
|
+ md_printf("`bright red`You need 25 experience and 25 metal to make fuel!\r\n");
|
|
|
paws();
|
|
|
}
|
|
|
} else {
|
|
|
- md_printf("`bright red`You need 25 experience and 10 metal to make fuel!\r\n");
|
|
|
+ md_printf("`bright red`You need 25 experience and 25 metal to make fuel!\r\n");
|
|
|
paws();
|
|
|
}
|
|
|
break;
|
|
@@ -591,7 +635,7 @@ user_inf build_menu(user_inf my) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
+user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg, int asteroid) {
|
|
|
int done = 0;
|
|
|
int playerWon = 0; // Did the player win? (1 = Yes, 2 = No, 3 = Flee)
|
|
|
char ch;
|
|
@@ -599,11 +643,18 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
int temp = 0;
|
|
|
int temp1 = 0;
|
|
|
int temp2 = 0;
|
|
|
+ int temp_hp = targ_hp;
|
|
|
int flee = 0;
|
|
|
int fire = 0;
|
|
|
int regen = 0;
|
|
|
while(!done) {
|
|
|
- md_printf("`bright red`Target ship has %d hitpoints left\r\n", targ_hp);
|
|
|
+ if(asteroid == 0) {
|
|
|
+ md_printf("`bright white`Pirate has %d hitpoints left\r\n", targ_hp);
|
|
|
+ } else if(asteroid == 1) {
|
|
|
+ md_printf("`bright white`Asteroid has %d hitpoints left\r\n", targ_hp);
|
|
|
+ } else if(asteroid == 2) {
|
|
|
+ md_printf("`bright white`Unknown One has %d hitpoints left\r\n", targ_hp);
|
|
|
+ }
|
|
|
// Proccess Shields comming back online
|
|
|
if(my.shieldsup != 0) {
|
|
|
my.shieldsup -= 1;
|
|
@@ -611,7 +662,7 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
// Proccess Crew repairing hull
|
|
|
if(my.hitpoints < (my.guns + my.armors + my.shields + 2)) {
|
|
|
regen = rand() % 100;
|
|
|
- if(regen >= 95) {
|
|
|
+ if(regen >= 90) {
|
|
|
my.hitpoints += 1;
|
|
|
if(my.hitpoints > (my.guns + my.armors + my.shields + 2)) {
|
|
|
my.hitpoints = (my.guns + my.armors + my.shields + 2);
|
|
@@ -623,7 +674,7 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
// Proccess Shield Regeneration
|
|
|
if(my.shieldpoints < (my.shields * 3)) {
|
|
|
regen = rand() % 100;
|
|
|
- if(regen >= 75) {
|
|
|
+ if(regen >= 70) {
|
|
|
my.shieldpoints += (my.shields + 1);
|
|
|
if(my.shieldpoints > (my.shields * 3)) {
|
|
|
my.shieldpoints = (my.shields * 3);
|
|
@@ -631,12 +682,12 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
md_printf("`bright green`Your shields regenerate %d points!\r\n", my.shields);
|
|
|
}
|
|
|
}
|
|
|
- md_printf("`bright yellow`Your ship has %d armor, `bright blue`%d`bright yellow` shields and %d hitpoints left:\r\n", my.armorpoints, my.shieldpoints, my.hitpoints);
|
|
|
+ md_printf("`bright white`Your ship has `bright blue`%d`bright white` shields, %d armor and %d hitpoints left:\r\n", my.shieldpoints, my.armorpoints, my.hitpoints);
|
|
|
} else {
|
|
|
// Shields should still regenerate some
|
|
|
if(my.shieldpoints < (my.shields * 3)) {
|
|
|
regen = rand() % 100;
|
|
|
- if(regen >= 75) {
|
|
|
+ if(regen >= 70) {
|
|
|
my.shieldpoints += 1;
|
|
|
if(my.shieldpoints > (my.shields * 3)) {
|
|
|
my.shieldpoints = (my.shields * 3);
|
|
@@ -644,11 +695,11 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
md_printf("`bright green`Your shields regenerate 1 points!\r\n");
|
|
|
}
|
|
|
}
|
|
|
- md_printf("`bright yellow`Your ship has %d armor, `blue`%d`bright yellow` shields and %d hitpoints left:\r\n", my.armorpoints, my.shieldpoints, my.hitpoints);
|
|
|
+ md_printf("`bright white`Your ship has `blue`%d`bright white` shields, %d armor and %d hitpoints left:\r\n", my.shieldpoints, my.armorpoints, my.hitpoints);
|
|
|
}
|
|
|
// Forming Combat Menu
|
|
|
md_printf("`bright black`(`bright white`A`bright black`)`white`ttack\r\n");
|
|
|
- if(my.armorpoints < (my.armors * 4)) {
|
|
|
+ if(my.armorpoints < (my.armors * 8)) {
|
|
|
md_printf("`bright black`(`bright white`R`bright black`)`white`epair Armor\r\n");
|
|
|
armorRep = 1; // Yes we can repair armor
|
|
|
}
|
|
@@ -659,6 +710,9 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
case '\r':
|
|
|
case 'a':
|
|
|
fire = rand() % 100;
|
|
|
+ if(asteroid == 1) { // Its a rock so allow player to hit it more frequent
|
|
|
+ fire += 15;
|
|
|
+ }
|
|
|
if(fire >= 50) {
|
|
|
targ_hp -= my.guns;
|
|
|
if(targ_hp <= 0) {
|
|
@@ -669,7 +723,7 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
md_printf("`bright red`Target took %d damage!\r\n", my.guns);
|
|
|
}
|
|
|
} else {
|
|
|
- md_printf("`white`Target Missed!\r\n");
|
|
|
+ md_printf("`white`You Missed!\r\n");
|
|
|
}
|
|
|
break;
|
|
|
case 'r':
|
|
@@ -677,8 +731,8 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
if(my.metal > 0) {
|
|
|
my.metal -= 1;
|
|
|
my.armorpoints += 2;
|
|
|
- if(my.armorpoints < (my.armors * 4)) {
|
|
|
- my.armorpoints = (my.armors * 4);
|
|
|
+ if(my.armorpoints < (my.armors * 8)) {
|
|
|
+ my.armorpoints = (my.armors * 8);
|
|
|
}
|
|
|
md_printf("`bright green`Repaired 2 Armor points!\r\n");
|
|
|
} else {
|
|
@@ -690,18 +744,28 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
break;
|
|
|
case 'f':
|
|
|
flee = rand() % 100;
|
|
|
+ if(asteroid == 1) {
|
|
|
+ flee = 100; // Always allow fleeing from asteroid
|
|
|
+ } else if(asteroid == 2) {
|
|
|
+ flee = 0; // Never allow fleeing from Unknown One
|
|
|
+ }
|
|
|
if(flee >= 82) {
|
|
|
playerWon = 3;
|
|
|
done = 1;
|
|
|
md_printf("`bright green`You ran away!\r\n");
|
|
|
} else {
|
|
|
- md_printf("`bright red`Target found us!\r\n");
|
|
|
+ md_printf("`bright red`Target found you!\r\n");
|
|
|
}
|
|
|
break;
|
|
|
} // If Enemy is alive proccess incomming attack
|
|
|
if(targ_hp > 0) {
|
|
|
temp = targ_dmg;
|
|
|
fire = rand() % 100;
|
|
|
+ if(asteroid == 1) { // Yup it doesn't have gunz cuz it's rock.
|
|
|
+ fire = 0;
|
|
|
+ } else if(asteroid == 2) { // This is the Unknown One
|
|
|
+ fire += 5;
|
|
|
+ }
|
|
|
if(fire >= 40) {
|
|
|
// Shields
|
|
|
if(my.shieldsup == 0 && my.shieldpoints != 0) {
|
|
@@ -762,19 +826,24 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
if(playerWon) {
|
|
|
if(playerWon == 1) {
|
|
|
// Player won
|
|
|
- my.experience += (my.guns + my.hitpoints + my.armorpoints + my.shieldpoints);
|
|
|
- my.metal += (my.guns + my.hitpoints);
|
|
|
+ my.experience += (temp_hp + targ_dmg);
|
|
|
+ my.metal += temp_hp;
|
|
|
+ if(asteroid == 1) { // If asteroid reward more experience and metal!
|
|
|
+ my.experience += 2;
|
|
|
+ my.metal += 2;
|
|
|
+ } else if(asteroid == 2) { // If it was the boss!
|
|
|
+ my.experience += 8;
|
|
|
+ my.metal += 8;
|
|
|
+ }
|
|
|
my.fuel -= 2;
|
|
|
if(my.fuel < 0) {
|
|
|
my.fuel = 0;
|
|
|
}
|
|
|
md_printf("`bright green`Congrats on your victory!\r\n`white`");
|
|
|
- update_player(my);
|
|
|
- return my;
|
|
|
} else if(playerWon == 2) {
|
|
|
// Target won
|
|
|
- my.experience -= (targ_hp + my.guns);
|
|
|
- my.metal -= (targ_hp + my.guns);
|
|
|
+ my.experience -= (temp_hp + targ_dmg);
|
|
|
+ my.metal -= temp_hp;
|
|
|
my.fuel -= 3;
|
|
|
if(my.experience < 0) {
|
|
|
my.experience = 0;
|
|
@@ -787,22 +856,56 @@ user_inf combat_menu(user_inf my, int targ_hp, int targ_dmg) {
|
|
|
}
|
|
|
md_printf("`bright red`Sorry for your loss! (We rebuild your ship)\r\n");
|
|
|
my.hitpoints = 4;
|
|
|
- my.armorpoints = 4;
|
|
|
+ my.armorpoints = 8;
|
|
|
my.shieldpoints = 0;
|
|
|
my.shieldsup = 0;
|
|
|
my.armors = 1;
|
|
|
my.shields = 0;
|
|
|
my.guns = 1;
|
|
|
- update_player(my);
|
|
|
- return my;
|
|
|
} else if(playerWon == 3) {
|
|
|
// Chicken!
|
|
|
my.fuel -= 1;
|
|
|
- update_player(my);
|
|
|
- return my;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ update_player(my);
|
|
|
+ return my;
|
|
|
+}
|
|
|
+
|
|
|
+void about_game() {
|
|
|
+ int done = 0;
|
|
|
+ int page = 1;
|
|
|
+ char p[12];
|
|
|
+ char targ[256];
|
|
|
+ while(!done) {
|
|
|
+ switch(page) {
|
|
|
+ case 1:
|
|
|
+ md_clr_scr();
|
|
|
+ md_sendfile("ansis/sc_doc_1.ans", FALSE);
|
|
|
+ paws();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ md_clr_scr();
|
|
|
+ md_sendfile("ansis/sc_doc_2.ans", FALSE);
|
|
|
+ paws();
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ md_clr_scr();
|
|
|
+ md_sendfile("ansis/sc_doc_3.ans", FALSE);
|
|
|
+ paws();
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ md_clr_scr();
|
|
|
+ md_sendfile("ansis/sc_doc_4.ans", FALSE);
|
|
|
+ paws();
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ done = 1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ md_clr_scr();
|
|
|
+ page += 1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void play_game() {
|
|
@@ -810,6 +913,8 @@ void play_game() {
|
|
|
char ch;
|
|
|
char ch1[256];
|
|
|
user_inf myself;
|
|
|
+ user_inf myself2;
|
|
|
+ user_inf testing;
|
|
|
int reset = 0;
|
|
|
int doRefuel = 0;
|
|
|
int pirate_encounter = 0;
|
|
@@ -818,7 +923,11 @@ void play_game() {
|
|
|
int asteroid = 0; // 1 means yes we need to remove damage... completely.
|
|
|
int me = locate_player(mdcontrol.user_firstname, mdcontrol.user_lastname);
|
|
|
if(me != 0) {
|
|
|
- myself = load_player(me);
|
|
|
+ //myself = load_player(me);
|
|
|
+ testing = load_player(me);
|
|
|
+ if(testing.uid != 0) {
|
|
|
+ myself = load_player(me);
|
|
|
+ }
|
|
|
dT age = formDate(compareDate(myself.laston));
|
|
|
// Process player inactivity
|
|
|
if(age.age >= 180) { // 6 Months or 1/2 a Year
|
|
@@ -833,6 +942,9 @@ void play_game() {
|
|
|
if(me != 0) {
|
|
|
md_printf("`bright white`Welcome back `bright green`%s\r\n", myself.nick);
|
|
|
dT age = formDate(compareDate(myself.laston));
|
|
|
+ dolog("%s is now playing (G=%d A=%d S=%d F=%d M=%d AP=%d SP=%d (%d) HP=%d LO=%d or %d days)",
|
|
|
+ myself.nick, myself.guns, myself.armors, myself.shields, myself.fuel, myself.metal, myself.armorpoints,
|
|
|
+ myself.shieldpoints, myself.shieldsup, myself.hitpoints, myself.laston, age.age);
|
|
|
myself.laston = dateStamp();
|
|
|
if(age.day != 0 || age.month != 0 || age.year != 0) {
|
|
|
md_printf("`bright yellow`Haven't seen you for");
|
|
@@ -862,10 +974,16 @@ void play_game() {
|
|
|
md_printf("\r\n");
|
|
|
}
|
|
|
if(doRefuel) {
|
|
|
- myself.fuel += (age.age * 2);
|
|
|
+ if(myself.fuel != 0) {
|
|
|
+ myself.fuel += (age.age * 2);
|
|
|
+ } else {
|
|
|
+ myself.fuel += ((age.age * 2) + 10);
|
|
|
+ md_printf("`bright green`For using all your fuel last time you get bonus fuel today!\r\n");
|
|
|
+ }
|
|
|
md_printf("`bright green`You now have %d fuel\r\n", myself.fuel);
|
|
|
}
|
|
|
update_player(myself);
|
|
|
+ paws();
|
|
|
} else {
|
|
|
md_printf("`bright white`You look new here. (Hit Enter to use your alias)\r\n");
|
|
|
while(done == 0) {
|
|
@@ -888,7 +1006,7 @@ void play_game() {
|
|
|
myself.guns = 1;
|
|
|
myself.armors = 1;
|
|
|
myself.shields = 0;
|
|
|
- myself.armorpoints = 4;
|
|
|
+ myself.armorpoints = 8;
|
|
|
myself.shieldpoints = 0;
|
|
|
myself.hitpoints = 4;
|
|
|
myself.shieldsup = 0;
|
|
@@ -896,23 +1014,25 @@ void play_game() {
|
|
|
update_player(myself);
|
|
|
} else { // Brand new user
|
|
|
char name[256];
|
|
|
+ strcpy(myself2.nick, myself.nick);
|
|
|
strcpy(name, "");
|
|
|
strcat(name, mdcontrol.user_firstname);
|
|
|
strcat(name, " ");
|
|
|
strcat(name, mdcontrol.user_lastname);
|
|
|
- strcpy(myself.real, name);
|
|
|
- myself.experience = 0;
|
|
|
- myself.metal = 0;
|
|
|
- myself.fuel = 10;
|
|
|
- myself.guns = 1;
|
|
|
- myself.armors = 1;
|
|
|
- myself.shields = 0;
|
|
|
- myself.armorpoints = 4;
|
|
|
- myself.shieldpoints = 0;
|
|
|
- myself.hitpoints = 4;
|
|
|
- myself.shieldsup = 0;
|
|
|
- myself.laston = dateStamp();
|
|
|
- create_player(myself);
|
|
|
+ strcpy(myself2.real, name);
|
|
|
+ myself2.experience = 0;
|
|
|
+ myself2.metal = 0;
|
|
|
+ myself2.fuel = 10;
|
|
|
+ myself2.guns = 1;
|
|
|
+ myself2.armors = 1;
|
|
|
+ myself2.shields = 0;
|
|
|
+ myself2.armorpoints = 8;
|
|
|
+ myself2.shieldpoints = 0;
|
|
|
+ myself2.hitpoints = 4;
|
|
|
+ myself2.shieldsup = 0;
|
|
|
+ myself2.laston = dateStamp();
|
|
|
+ create_player(myself2);
|
|
|
+ myself = load_player(locate_player(mdcontrol.user_firstname, mdcontrol.user_lastname));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -923,48 +1043,67 @@ void play_game() {
|
|
|
while(!done) {
|
|
|
md_printf("`bright yellow`You have %d fuel left for today,\r\n", myself.fuel);
|
|
|
if(myself.shieldsup == 0) {
|
|
|
- md_printf("`bright yellow`Your ship has %d armor, `bright blue`%d`bright yellow` shields and %d hitpoints left:\r\n", myself.armorpoints, myself.shieldpoints, myself.hitpoints);
|
|
|
+ md_printf("`bright yellow`Your ship has `bright blue`%d`bright yellow` shields, %d armor and %d hitpoints left:\r\n", myself.shieldpoints, myself.armorpoints, myself.hitpoints);
|
|
|
} else {
|
|
|
md_printf("`bright yellow`Your ship has %d armor, `blue`%d`bright yellow` shields and %d hitpoints left:\r\n", myself.armorpoints, myself.shieldpoints, myself.hitpoints);
|
|
|
}
|
|
|
- if(myself.fuel != 0) {
|
|
|
+ if(myself.armorpoints < (myself.armors * 8)) {
|
|
|
+ md_printf("`bright black`(`bright white`R`bright black`)`white`epair Armor\r\n");
|
|
|
+ }
|
|
|
+ if(myself.shieldpoints < (myself.shields * 3)) {
|
|
|
+ md_printf("`bright black`(`bright white`G`bright black`)`white`enerate Shields\r\n");
|
|
|
+ }
|
|
|
+ if(myself.fuel >= 2) {
|
|
|
md_sendfile("ansis/sc_gameh.ans", FALSE);
|
|
|
- ch = md_get_answer("SsHhBbQqRr\r");
|
|
|
+ ch = md_get_answer("SsHhBbQqRrGgLl\r");
|
|
|
} else {
|
|
|
md_sendfile("ansis/sc_gamel.ans", FALSE);
|
|
|
- ch = md_get_answer("BbQqRr\r");
|
|
|
+ ch = md_get_answer("BbQqRrGgLl\r");
|
|
|
}
|
|
|
md_clr_scr();
|
|
|
switch(tolower(ch)) {
|
|
|
case '\r':
|
|
|
case 's':
|
|
|
- if(myself.fuel != 0) {
|
|
|
+ if(myself.fuel >= 2) {
|
|
|
pirate_encounter = rand() % 100;
|
|
|
if(pirate_encounter >= 75) { // 25% chance to encounter a Pirate
|
|
|
- md_printf("`bright yellow`You encounter a `bright red`Pirate\r\n`white`");
|
|
|
- asteroid = 0;
|
|
|
+ if(myself.experience > 5000) {
|
|
|
+ if(pirate_encounter >= 95) { // 5% chance to encounter unknown one
|
|
|
+ md_printf("`bright yellow`You encounter the `bright red`Unknown One\r\n`white`");
|
|
|
+ asteroid = 2;
|
|
|
+ } else {
|
|
|
+ md_printf("`bright yellow`You encounter a `bright red`Pirate\r\n`white`");
|
|
|
+ asteroid = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
} else { // 75% chance to encounter a Asteroid
|
|
|
md_printf("`bright yellow`You encounter a `bright red`Asteroid\r\n`white`");
|
|
|
asteroid = 1;
|
|
|
}
|
|
|
- if(asteroid == 0) {
|
|
|
- pirate_hp = (myself.hitpoints + 1) + (rand() % 4);
|
|
|
- if(myself.armors >= 2 && myself.shields >= 1) {
|
|
|
- pirate_dmg = (myself.guns + 1);
|
|
|
- } else {
|
|
|
- pirate_dmg = myself.guns;
|
|
|
+ if(asteroid == 0 || asteroid == 2) {
|
|
|
+ pirate_hp = ((myself.hitpoints + 1) + (rand() % 4));
|
|
|
+ if(asteroid == 2) {
|
|
|
+ pirate_hp += 10;
|
|
|
+ }
|
|
|
+ // Increase difficulty based on experience...
|
|
|
+ pirate_dmg = (myself.experience / 500);
|
|
|
+ if(pirate_dmg == 0) { // Always deal damage
|
|
|
+ pirate_dmg = 1;
|
|
|
+ }
|
|
|
+ if(asteroid == 2) { // Increase boss damage
|
|
|
+ pirate_dmg += 2;
|
|
|
}
|
|
|
// Send off to combat menu
|
|
|
- myself = combat_menu(myself, pirate_hp, pirate_dmg);
|
|
|
+ myself = combat_menu(myself, pirate_hp, pirate_dmg, asteroid);
|
|
|
} else {
|
|
|
pirate_hp = (myself.hitpoints + 1) + (rand() % 10);
|
|
|
// Send off to combat menu
|
|
|
- myself = combat_menu(myself, pirate_hp, 0);
|
|
|
+ myself = combat_menu(myself, pirate_hp, 0, asteroid);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 'h':
|
|
|
- md_printf("Hunt\r\n");
|
|
|
+ md_printf("`bright white`Comming v0.4-dev\r\n");
|
|
|
break;
|
|
|
case 'b':
|
|
|
if(myself.metal != 0) {
|
|
@@ -973,21 +1112,21 @@ void play_game() {
|
|
|
//md_sendfile("ansis/sc_build.ans", FALSE);
|
|
|
myself = build_menu(myself);
|
|
|
} else {
|
|
|
- md_printf("`bright white`I am sorry you have no metal go fight a `bright red`Asteroid`bright white` or `bright red`Pirate`bright white`.`white`\r\n");
|
|
|
+ md_printf("`bright white`I am sorry you have no metal go fight.`white`\r\n");
|
|
|
}
|
|
|
break;
|
|
|
case 'q':
|
|
|
done = 1;
|
|
|
break;
|
|
|
case 'r':
|
|
|
- if(myself.armorpoints < (myself.armors * 4)) {
|
|
|
+ if(myself.armorpoints < (myself.armors * 8)) {
|
|
|
if(myself.metal > 0) {
|
|
|
myself.metal -= 1;
|
|
|
- myself.armorpoints += 3;
|
|
|
- if(myself.armorpoints > (myself.armors * 4)) {
|
|
|
- myself.armorpoints = (myself.armors * 4);
|
|
|
+ myself.armorpoints += 4;
|
|
|
+ if(myself.armorpoints > (myself.armors * 8)) {
|
|
|
+ myself.armorpoints = (myself.armors * 8);
|
|
|
}
|
|
|
- md_printf("`bright green`Repaired 3 Armor Points!\r\n`white`");
|
|
|
+ md_printf("`bright green`Repaired 4 Armor Points!\r\n`white`");
|
|
|
} else {
|
|
|
md_printf("`bright red`You need metal inorder to repair!\r\n`white`");
|
|
|
}
|
|
@@ -995,6 +1134,14 @@ void play_game() {
|
|
|
md_printf("`bright yellow`You don't seem to need repairs!\r\n`white`");
|
|
|
}
|
|
|
break;
|
|
|
+ case 'g':
|
|
|
+ if(myself.shieldpoints < (myself.shields * 3)) {
|
|
|
+ myself.shieldpoints = (myself.shields * 3);
|
|
|
+ md_printf("`bright green`Regenerated Shields!\r\n`white`");
|
|
|
+ } else {
|
|
|
+ md_printf("`bright yellow`You don't seem to need to regenerate shields!\r\n`white`");
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1002,6 +1149,12 @@ void play_game() {
|
|
|
void main_menu() {
|
|
|
// Main menu for once things are done being initalized
|
|
|
int done = 0;
|
|
|
+ int done1 = 0; // For Reset Game and for New Day... also for Debug
|
|
|
+ int targ_ply = 1; // Target player to perform op!
|
|
|
+ int targ_max = 0; // Total number of players affected!
|
|
|
+ user_inf targ; // Player Struct
|
|
|
+ dT targ_age; // Date Struct
|
|
|
+ char targ_real[256];
|
|
|
char ch;
|
|
|
// Check Lock
|
|
|
inuse = check_lock();
|
|
@@ -1012,40 +1165,114 @@ void main_menu() {
|
|
|
}
|
|
|
while(!done) {
|
|
|
md_clr_scr();
|
|
|
- md_sendfile("ansis/sc_mainl.ans", TRUE);
|
|
|
- ch = md_get_answer("PpLlVvQq\r");
|
|
|
+ if(mdcontrol.user_seclevel == 99 || mdcontrol.user_seclevel == 255) {
|
|
|
+ md_sendfile("ansis/sc_mainh.ans", TRUE);
|
|
|
+ } else {
|
|
|
+ md_sendfile("ansis/sc_mainl.ans", TRUE);
|
|
|
+ }
|
|
|
+ ch = md_get_answer("PpLlVvQqRrNnSsAa\r");
|
|
|
md_clr_scr();
|
|
|
switch(tolower(ch)){
|
|
|
case 'q':
|
|
|
// Quit
|
|
|
- md_printf("`bright white`Farewell!\r\n");
|
|
|
- // Hmm sleep?
|
|
|
done = 1;
|
|
|
break;
|
|
|
case '\r':
|
|
|
case 'p':
|
|
|
// Play Game (Default if the player just hits enter)
|
|
|
if (inuse == 1) {
|
|
|
- md_printf("`bright red`Game in use!\r\n");
|
|
|
+ md_printf("`bright red`______________\r\n");
|
|
|
+ md_printf("`bright red` Game in use!\r\n");
|
|
|
+ md_printf("`bright red`______________\r\n");
|
|
|
paws();
|
|
|
} else {
|
|
|
//md_printf("`bright white`Play\r\n");
|
|
|
play_game();
|
|
|
}
|
|
|
break;
|
|
|
+ case 'a':
|
|
|
+ about_game();
|
|
|
+ break;
|
|
|
case 'l':
|
|
|
// List Players in the game
|
|
|
- if(display_all_players() == 0) {
|
|
|
- md_printf("`bright red`There are no players!\r\n");
|
|
|
- }
|
|
|
+ display_all_players();
|
|
|
paws();
|
|
|
break;
|
|
|
case 'v':
|
|
|
// Version
|
|
|
md_clr_scr();
|
|
|
- md_printf("`bright yellow`|--------------------------|\r\n");
|
|
|
- md_printf("`bright yellow`| Space Construct v%d.%d-%s |\r\n", VERSION_MAJOR, VERSION_MINOR, VERSION_TYPE);
|
|
|
- md_printf("`bright yellow`|--------------------------|\r\n");
|
|
|
+ md_printf("`bright yellow`_____________________________\r\n");
|
|
|
+ md_printf("`bright yellow` Space Construct v%d.%d-%s\r\n", VERSION_MAJOR, VERSION_MINOR, VERSION_TYPE);
|
|
|
+ md_printf("`bright yellow` By: Beanzilla\r\n");
|
|
|
+ md_printf("`bright yellow` FsxNet 21:4/110\r\n");
|
|
|
+ md_printf("`bright yellow` HappyNet 637:1/110\r\n");
|
|
|
+ md_printf("`bright yellow`_____________________________\r\n");
|
|
|
+ paws();
|
|
|
+ break;
|
|
|
+ case 'r':
|
|
|
+ if(mdcontrol.user_seclevel == 99 || mdcontrol.user_seclevel == 255) {
|
|
|
+ md_printf("`bright red`__ Reset ___\r\n");
|
|
|
+ md_printf("`bright red`DANGER THIS WILL DELETE ALL PLAYERS IN GAME\r\n");
|
|
|
+ if(yesNo() == 0) {
|
|
|
+ md_printf("`bright red`ABORTED!\r\n");
|
|
|
+ paws();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ dolog("%s issued reset", mdcontrol.user_alias);
|
|
|
+ delete_players(); // Delete all players in user table
|
|
|
+ } else {
|
|
|
+ md_printf("`bright red`Not Authorized, Contact System Operator if you feel this was in error!\r\n");
|
|
|
+ }
|
|
|
+ paws();
|
|
|
+ break;
|
|
|
+ case 's':
|
|
|
+ if(mdcontrol.user_seclevel == 99 || mdcontrol.user_seclevel == 255) {
|
|
|
+ md_printf("`bright yellow`__ Show Debug ___\r\n");
|
|
|
+ while(!done1) {
|
|
|
+ targ = load_player(targ_ply);
|
|
|
+ if(targ.uid != 0) {
|
|
|
+ targ_age = formDate(compareDate(targ.laston));
|
|
|
+ md_printf("* %s has %d guns, %d armor, %d shields\r\n", targ.nick, targ.guns, targ.armors, targ.shields);
|
|
|
+ md_printf(" %d armorpoints, %d shieldpoints, %d hitpoints\r\n", targ.armorpoints, targ.shieldpoints, targ.hitpoints);
|
|
|
+ md_printf(" %d laston (raw), %d laston (days), %d shieldsup\r\n", targ.laston, targ_age.age, targ.shieldsup);
|
|
|
+ md_printf(" %d fuel, %d metal, %d experience\r\n\r\n", targ.fuel, targ.metal, targ.experience);
|
|
|
+ } else {
|
|
|
+ done1 = 1;
|
|
|
+ }
|
|
|
+ targ_ply += 1;
|
|
|
+ targ_max += 1;
|
|
|
+ }
|
|
|
+ md_printf("`bright yellow`%d players\r\n", (targ_max - 1));
|
|
|
+ targ_ply = 1;
|
|
|
+ targ_max = 0;
|
|
|
+ done1 = 0;
|
|
|
+ } else {
|
|
|
+ md_printf("`bright yellow`Not Authorized, Contact System Operator if you feel this was in error!\r\n");
|
|
|
+ }
|
|
|
+ paws();
|
|
|
+ break;
|
|
|
+ case 'n':
|
|
|
+ if(mdcontrol.user_seclevel == 99 || mdcontrol.user_seclevel == 255) {
|
|
|
+ md_printf("`bright yellow`__ New Day ___\r\n");
|
|
|
+ dolog("%s issued new day", mdcontrol.user_alias);
|
|
|
+ while(!done1) {
|
|
|
+ targ = load_player(targ_ply);
|
|
|
+ if(targ.uid != 0) {
|
|
|
+ targ.laston -= 1; // Travel back 1 day
|
|
|
+ update_player(targ); // Save
|
|
|
+ } else {
|
|
|
+ done1 = 1;
|
|
|
+ }
|
|
|
+ targ_ply += 1;
|
|
|
+ targ_max += 1;
|
|
|
+ }
|
|
|
+ md_printf("`bright yellow`%d players\r\n", (targ_max - 1));
|
|
|
+ targ_ply = 1;
|
|
|
+ targ_max = 0;
|
|
|
+ done1 = 0;
|
|
|
+ } else {
|
|
|
+ md_printf("`bright yellow`Not Authorized, Contact System Operator if you feel this was in error!\r\n");
|
|
|
+ }
|
|
|
paws();
|
|
|
break;
|
|
|
}
|
|
@@ -1102,4 +1329,4 @@ int main(int argc, char **argv) {
|
|
|
|
|
|
// Goodbye
|
|
|
md_exit(0);
|
|
|
-}
|
|
|
+}
|