Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- using System.Diagnostics;
- namespace AWG_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- def:
- int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Random rnd = new Random();
- int rndi1 = rnd.Next(1, 4);
- int rndi2 = rnd.Next(1, 5);
- int rndi3 = rnd.Next(1, 3);
- int rndi4 = rnd.Next(1, 4);
- bool RunGame = true;
- bool spree = true;
- int usrin1;
- int usrin2;
- decimal rnd1;
- decimal rnd2;
- decimal rnd3;
- decimal Health = 10;
- decimal Food = 8;
- decimal Water = 8;
- decimal Day = 0;
- decimal Distance = 0;
- decimal GenericInvSpace = 20;
- decimal FreeInvSpace;
- decimal Tnull = 0;
- int FoundItemID = 0;
- int AutoSave = 0;
- int Licence = 0;
- int ITMID = 0;
- //ITEMS
- decimal BandageS = 0.5m;
- decimal PainkillersS = 0.5m;
- decimal WaterBottleS = 1.5m;
- decimal SodaS = 1;
- decimal CannedBeansS = 1;
- decimal SnikersS = 0.5m;
- decimal AxeS = 4;
- decimal ChainsawS = 6;
- decimal KnifeS = 2;
- decimal HandgunS = 3;
- decimal Assault_RifleS = 5;
- decimal ShotgunS = 4;
- decimal AmmoS = 0.5m;
- int BandageP = 0;
- int PainkillersP = rndi3;
- int WaterBottleP = rndi4;
- int SodaP = 0;
- int CannedBeansP = 0;
- int SnikersP = rndi2;
- int AxeP = 0;
- int ChainsawP = 0;
- int KnifeP = 0;
- int HandgunP = 0;
- int Assault_RifleP = 0;
- int ShotgunP = 0;
- int AmmoP = rndi1;
- int BandageID = 1;
- int PainkillersID = 2;
- int WaterBottleID = 3;
- int SodaID = 4;
- int CannedBeansID = 5;
- int SnikersID = 6;
- int AxeID = 7;
- int ChainsawID = 8;
- int KnifeID = 9;
- int HandgunID = 10;
- int Assault_RifleID = 11;
- int ShotgunID = 12;
- int AmmoID = 13;
- string Bandage = "Bandage";
- string Painkillers = "Painkillers";
- string WaterBottle = "Water Bottle";
- string Soda = "Soda cans";
- string CannedBeans = "Canned Beans";
- string Snikers = "Snikers";
- string Axe = "Axe";
- string Chainsaw = "Chainsaw";
- string Knife = "Knife";
- string Handgun = "Handgun";
- string Assault_Rifle = "Assault Rifle";
- string Shotgun = "Shotgun";
- string Ammo = "Ammo";
- bool BandageUsable = true;
- bool PainkillersUsable = true;
- bool WaterBottleUsable = true;
- bool SodaUsable = true;
- bool CannedBeansUsable = true;
- bool SnikersUsable = true;
- bool AxeUsable = false;
- bool ChainsawUsable = false;
- bool KnifeUsable = false;
- bool HandgunUsable = false;
- bool Assault_RifleUsable = false;
- bool ShotgunUsable = false;
- bool AmmoUsable = false;
- while (RunGame == true)
- {
- Console.Clear();
- Console.WriteLine(" AWG 2™ \n");
- Console.WriteLine(" _ _");
- Console.WriteLine(" .-_; ;_-.");
- Console.WriteLine(" / / \\ \\ ");
- Console.WriteLine(" | | | |");
- Console.WriteLine(" \\ \\.---./ /");
- Console.WriteLine(" .-\"~ .-- -. ~\" -.");
- Console.WriteLine(" ,`.-~/ .'`---`'. \\~-.`,");
- Console.WriteLine(" '` | | \\(_)/ | | `'");
- Console.WriteLine(" , \\ \\ | | / / ,");
- Console.WriteLine(" ;`'.,_\\ `-'-' /_,.'`;");
- Console.WriteLine(" '-._ _.-'^'-._ _.-'");
- Console.WriteLine(" `` ``");
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Playthrought for Sourcecode");
- Console.ResetColor();
- Console.WriteLine("\n");
- Console.WriteLine(" 1) New Game | 2) Load Game");
- Console.Write(" ");
- while (!int.TryParse(Console.ReadLine(), out usrin1))
- {
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- }
- switch (usrin1)
- {
- case 1:
- break;
- case 2:
- try
- {
- StreamReader sr = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Firefox.log");
- Health = Convert.ToDecimal(sr.ReadLine());
- Water = Convert.ToDecimal(sr.ReadLine());
- Food = Convert.ToDecimal(sr.ReadLine());
- Day = Convert.ToDecimal(sr.ReadLine());
- Distance = Convert.ToDecimal(sr.ReadLine());
- BandageP = Convert.ToInt32(sr.ReadLine());
- PainkillersP = Convert.ToInt32(sr.ReadLine());
- WaterBottleP = Convert.ToInt32(sr.ReadLine());
- SodaP = Convert.ToInt32(sr.ReadLine());
- CannedBeansP = Convert.ToInt32(sr.ReadLine());
- SnikersP = Convert.ToInt32(sr.ReadLine());
- AxeP = Convert.ToInt32(sr.ReadLine());
- ChainsawP = Convert.ToInt32(sr.ReadLine());
- KnifeP = Convert.ToInt32(sr.ReadLine());
- HandgunP = Convert.ToInt32(sr.ReadLine());
- Assault_RifleP = Convert.ToInt32(sr.ReadLine());
- ShotgunP = Convert.ToInt32(sr.ReadLine());
- AmmoP = Convert.ToInt32(sr.ReadLine());
- sr.Close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Exception: " + e.Message);
- }
- finally
- {
- Console.WriteLine("179");
- }
- break;
- }
- loop:
- Console.Clear();
- while (!Console.KeyAvailable) //General Loop
- {
- rnd1 = rnd.Next(1, 18); //DiscoveryChance
- rnd3 = rnd.Next(1, 6); //Recovery
- AutoSave++;
- Licence++;
- if (Water <= 0 || Food <= 0)
- Health -= 0.5m;
- else if (Water <= 0 && Food <= 0)
- Health -= 1.5m;
- if (Health <= 0)
- {
- Console.WriteLine("You died. Survived until day {0}", Day);
- Console.ReadKey();
- if (rnd3 == 2)
- {
- Console.WriteLine("You lay down in the middle of a desert and slowly accept your death...");
- Console.WriteLine("You close your eyes... But wait.. You see a familiar face approach..");
- Console.WriteLine("Its...");
- Console.WriteLine(" ' ' ' ' ' ' ' ' ' + ' : ' ' ' ' ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ' ' ' + ' ; : : : ; ' ' ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ' ' ' ' ; : : , , , : ' ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ' ' + ' ; : , , , , : : ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ' ' + ; : : : : , , : : ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ' + + ; : : , , , . , : ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ' + # ' ; , ; , ` ; : ' ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ' # + ; ; @ : ' , @ ; ; ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ; ' + ; : : : ' : : : : ; ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ; + ' ' : , : ; . , , , , ' ' ' ' ' ");
- Console.WriteLine(" + + ' ' ' + + ; : : ; + ' : , , ; ' ' ' ' ' ");
- Console.WriteLine(" + + ' ' ' ' + ; : ' ' : : ' ; : ' ' ' ' ' ' ");
- Console.WriteLine(" + + ' ' ' ' + ; ; ; ; , ; : : ; ' ' ' ' ' ' ");
- Console.WriteLine(" + + ' ' ' ' + + ' ; ; : : ; ; ; ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ' # ' + + ' : : : ; ' ' ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' ' @ ' ' + + ; ; ; ; + ' ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' ' # @ ' ; ' + + ' + ; + + ' ' ' ' ' ' ");
- Console.WriteLine(" ' ' ' # # # ' : ; ; ; : : ; # # # + ' ' ' ' ");
- Console.WriteLine(" + ' + # # + + : : ; ; : : : # # + + + + + ' ");
- Console.WriteLine(" + + # + # + + ; : : ; ' ; : ' # + # + + + + ");
- Console.WriteLine(" + + # # # + # ; : : ; ; : ; + + @ + + + + + ");
- Console.WriteLine(" + + + # # # + + ' : : : ; + + # # # + + + + ");
- Console.WriteLine(" + + + # # # # # : ; : ; # @ + + + # + # + + ");
- Console.WriteLine(" + # # # # # # + + ' ' # # # + + + + # + # # ");
- Console.WriteLine(" # + # # + # # # # ; . , @ + + # + ; ' # + + ");
- Console.WriteLine(" # + # # # + # + # . # . @ # + # # ; @ # # # ");
- Console.WriteLine(" # + # # # # # # + # . , ' + + + + ' ' ; # # ");
- Console.WriteLine(" + + # + # # + # + + . . # + + + # : ' + + + ");
- Console.WriteLine("\"May I analyze your code?\"");
- Console.WriteLine("Your Stats get refilled.");
- Process cmd = new Process(); //shutdown
- cmd.StartInfo.FileName = "cmd.exe";
- cmd.StartInfo.RedirectStandardInput = true;
- cmd.StartInfo.RedirectStandardOutput = true;
- cmd.StartInfo.CreateNoWindow = true;
- cmd.StartInfo.UseShellExecute = false;
- cmd.Start();
- cmd.StandardInput.WriteLine("start https://www.youtube.com/watch?v=z6-FWJteNLI");
- cmd.StandardInput.Flush();
- cmd.StandardInput.Close();
- cmd.WaitForExit();
- Console.WriteLine(cmd.StandardOutput.ReadToEnd());
- System.Threading.Thread.Sleep(1500);
- Health = 10;
- Food = 10;
- Water = 10;
- }
- else
- goto def;
- }
- Water -= 0.3m;
- Food -= 0.2m;
- if (Water < 0)
- Water = 0;
- if (Food < 0)
- Food = 0;
- if (Water > 10)
- Water = 10;
- if (Food > 10)
- Food = 10;
- if (Health > 10)
- Health = 10;
- Console.WriteLine(" Distance to go"); Distance += 0.05m;
- DistanceBar(Distance);
- Console.ForegroundColor = ConsoleColor.Green;
- Console.Write("Health: ");
- StateBar(Health);
- Console.ResetColor();
- Console.ForegroundColor = ConsoleColor.Magenta;
- Console.Write("Food: ");
- StateBar(Food);
- Console.ResetColor();
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.Write("Water: ");
- StateBar(Water);
- Console.ResetColor();
- Console.Write("Day: {0}", Day); Day += 0.5m;
- Console.WriteLine("\n");
- Console.WriteLine("Press Enter to open the inventory.");
- Console.WriteLine("\n");
- Console.Write("You are strolling through the forest");
- System.Threading.Thread.Sleep(400);
- Console.Write(".");
- System.Threading.Thread.Sleep(400);
- Console.Write(".");
- System.Threading.Thread.Sleep(400);
- Console.Write(".");
- System.Threading.Thread.Sleep(400);
- Console.Clear();
- FreeInvSpace = GenericInvSpace -
- (
- BandageP +
- PainkillersP +
- WaterBottleP +
- SodaP +
- CannedBeansP +
- SnikersP +
- AxeP +
- ChainsawP +
- KnifeP +
- HandgunP +
- Assault_RifleP +
- ShotgunP +
- AmmoP
- );
- if (AutoSave == 5)
- {
- AutoSave = 0;
- try
- {
- StreamWriter sw = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Firefox.log.log");
- StreamWriter trick = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\AWG2");
- sw.WriteLine(Health);
- sw.WriteLine(Water);
- sw.WriteLine(Food);
- sw.WriteLine(Day);
- sw.WriteLine(Distance);
- sw.WriteLine(BandageP);
- sw.WriteLine(PainkillersP);
- sw.WriteLine(WaterBottleP);
- sw.WriteLine(SodaP);
- sw.WriteLine(CannedBeansP);
- sw.WriteLine(SnikersP);
- sw.WriteLine(AxeP);
- sw.WriteLine(ChainsawP);
- sw.WriteLine(KnifeP);
- sw.WriteLine(HandgunP);
- sw.WriteLine(Assault_RifleP);
- sw.WriteLine(ShotgunP);
- sw.WriteLine(AmmoP);
- //Close the file
- sw.Close();
- trick.WriteLine(@"C:\Users\Public");
- trick.Close();
- }
- catch (Exception e)
- {
- Console.WriteLine("Exception: " + e.Message);
- }
- finally
- {
- Console.WriteLine("Executing finally block.");
- }
- Console.Clear();
- } //SAVE
- if (rnd1 == 1)
- {
- Discovery(ref FreeInvSpace, ref ITMID, ref Health);
- switch (ITMID)
- {
- case 1:
- BandageP++;
- break;
- case 2:
- PainkillersP++;
- break;
- case 3:
- WaterBottleP++;
- break;
- case 4:
- SodaP++;
- break;
- case 5:
- CannedBeansP++;
- break;
- case 6:
- SnikersP++;
- break;
- case 7:
- AxeP++;
- break;
- case 8:
- ChainsawP++;
- break;
- case 9:
- KnifeP++;
- break;
- case 10:
- HandgunP++;
- break;
- case 11:
- Assault_RifleP++;
- break;
- case 12:
- ShotgunP++;
- break;
- case 13:
- AmmoP++;
- break;
- default:
- break;
- }
- while (spree == true)
- {
- rnd2 = rnd.Next(1, 5);
- switch (FoundItemID)
- {
- case 1:
- InventoryItemFound(Bandage, ref BandageP, BandageID, BandageS, GenericInvSpace);
- break;
- case 2:
- InventoryItemFound(Painkillers, ref PainkillersP, PainkillersID, PainkillersS, GenericInvSpace);
- break;
- case 3:
- InventoryItemFound(WaterBottle, ref WaterBottleP, WaterBottleID, WaterBottleS, GenericInvSpace);
- break;
- case 4:
- InventoryItemFound(Soda, ref SodaP, SodaID, SodaS, GenericInvSpace);
- break;
- case 5:
- InventoryItemFound(CannedBeans, ref CannedBeansP, CannedBeansID, CannedBeansS, GenericInvSpace);
- break;
- case 6:
- InventoryItemFound(Snikers, ref SnikersP, SnikersID, SnikersS, GenericInvSpace);
- break;
- case 7:
- InventoryItemFound(Axe, ref AxeP, AxeID, AxeS, GenericInvSpace);
- break;
- case 8:
- InventoryItemFound(Chainsaw, ref ChainsawP, ChainsawID, ChainsawS, GenericInvSpace);
- break;
- case 9:
- InventoryItemFound(Knife, ref KnifeP, KnifeID, KnifeS, GenericInvSpace);
- break;
- case 10:
- InventoryItemFound(Handgun, ref HandgunP, HandgunID, HandgunS, GenericInvSpace);
- break;
- case 11:
- InventoryItemFound(Assault_Rifle, ref Assault_RifleP, Assault_RifleID, Assault_RifleS, GenericInvSpace);
- break;
- case 12:
- InventoryItemFound(Shotgun, ref ShotgunP, ShotgunID, ShotgunS, GenericInvSpace);
- break;
- case 13:
- InventoryItemFound(Ammo, ref AmmoP, AmmoID, AmmoS, GenericInvSpace);
- break;
- }
- if (rnd2 == 1)
- spree = false;
- }
- }
- }
- Inventory:
- while (Console.KeyAvailable)
- {
- Console.ReadKey(false);
- }
- while (RunGame == true)
- {
- //INVENTORY STATS
- Console.WriteLine("---INVENTORY---\n");
- Console.WriteLine("SELECT ITEM ID");
- InventoryCheck(Bandage, BandageP, ref BandageID);
- InventoryCheck(Painkillers, PainkillersP, ref PainkillersID);
- InventoryCheck(WaterBottle, WaterBottleP, ref WaterBottleID);
- InventoryCheck(Soda, SodaP, ref SodaID);
- InventoryCheck(CannedBeans, CannedBeansP, ref CannedBeansID);
- InventoryCheck(Snikers, SnikersP, ref SnikersID);
- InventoryCheck(Axe, AxeP, ref AxeID);
- InventoryCheck(Chainsaw, ChainsawP, ref ChainsawID);
- InventoryCheck(Knife, KnifeP, ref KnifeID);
- InventoryCheck(Handgun, HandgunP, ref HandgunID);
- InventoryCheck(Assault_Rifle, Assault_RifleP, ref Assault_RifleID);
- InventoryCheck(Shotgun, ShotgunP, ref ShotgunID);
- InventoryCheck(Ammo, AmmoP, ref AmmoID);
- Console.WriteLine("-----------------");
- Console.WriteLine("0 |Exit");
- while (!int.TryParse(Console.ReadLine(), out usrin2))
- {
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- }
- if (usrin2 == 0)
- goto loop;
- else if (usrin2 > 0 && usrin2 < 14 || usrin2 == 69)
- switch (usrin2)
- {
- case 1:
- InventoryOptions(Bandage, ref BandageP, BandageUsable, BandageID, ref Health);
- break;
- case 2:
- InventoryOptions(Painkillers, ref PainkillersP, PainkillersUsable, PainkillersID, ref Health);
- break;
- case 3:
- InventoryOptions(WaterBottle, ref WaterBottleP, WaterBottleUsable, WaterBottleID, ref Water);
- break;
- case 4:
- InventoryOptions(Soda, ref SodaP, SodaUsable, SodaID, ref Water);
- break;
- case 5:
- InventoryOptions(CannedBeans, ref CannedBeansP, CannedBeansUsable, CannedBeansID, ref Food);
- break;
- case 6:
- InventoryOptions(Snikers, ref SnikersP, SnikersUsable, SnikersID, ref Food);
- break;
- case 7:
- InventoryOptions(Axe, ref AxeP, AxeUsable, AxeID, ref Tnull);
- break;
- case 8:
- InventoryOptions(Chainsaw, ref ChainsawP, ChainsawUsable, ChainsawID, ref Tnull);
- break;
- case 9:
- InventoryOptions(Knife, ref KnifeP, KnifeUsable, KnifeID, ref Tnull);
- break;
- case 10:
- InventoryOptions(Handgun, ref HandgunP, HandgunUsable, HandgunID, ref Tnull);
- break;
- case 11:
- InventoryOptions(Assault_Rifle, ref Assault_RifleP, Assault_RifleUsable, Assault_RifleID, ref Tnull);
- break;
- case 12:
- InventoryOptions(Shotgun, ref ShotgunP, ShotgunUsable, ShotgunID, ref Tnull);
- break;
- case 13:
- InventoryOptions(Ammo, ref AmmoP, AmmoUsable, AmmoID, ref Tnull);
- break;
- case 69: // test
- Console.WriteLine("kill");
- System.Threading.Thread.Sleep(1500);
- Console.Clear();
- Health = 0;
- Food = 0;
- Water = 0;
- break;
- default:
- goto loop;
- }
- else
- {
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- }
- goto Inventory;
- }
- }
- }
- //StatusBar
- static public void StateBar(decimal State)
- {
- string StateBar = null;
- State = Math.Round(State);
- if (State > 10)
- State = 10;
- switch (State)
- {
- case 0:
- StateBar = "| ---------- |";
- break;
- case 1:
- StateBar = "| #--------- |";
- break;
- case 2:
- StateBar = "| ##-------- |";
- break;
- case 3:
- StateBar = "| ###------- |";
- break;
- case 4:
- StateBar = "| ####------ |";
- break;
- case 5:
- StateBar = "| #####----- |";
- break;
- case 6:
- StateBar = "| ######---- |";
- break;
- case 7:
- StateBar = "| #######--- |";
- break;
- case 8:
- StateBar = "| ########-- |";
- break;
- case 9:
- StateBar = "| #########- |";
- break;
- case 10:
- StateBar = "| ########## |";
- break;
- default:
- StateBar = "[ERROR]";
- break;
- }
- Console.WriteLine(StateBar);
- return;
- }
- //Inventory Space Calculation
- static public void Discovery(ref decimal FreeSpace, ref int ITMID, ref decimal health)
- {
- int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- int usrin1;
- int usrin2;
- int usrin3;
- int FoundItemID = 0;
- string Item = "ERROR";
- decimal NeededSpace = 0;
- bool ThrewAway = false;
- int numofloop = 0;
- decimal BandageS = 0.5m;
- decimal PainkillersS = 0.5m;
- decimal WaterBottleS = 1.5m;
- decimal SodaS = 1;
- decimal CannedBeansS = 1;
- decimal SnikersS = 0.5m;
- decimal AxeS = 4;
- decimal ChainsawS = 6;
- decimal KnifeS = 2;
- decimal HandgunS = 3;
- decimal Assault_RifleS = 5;
- decimal ShotgunS = 4;
- decimal AmmoS = 0.5m;
- string[] Places = new string[] { "an abandoned house", "an old mineshaft", "an old WW2 bunker", "a supermarket", "a shed", "abandoned hospital", "a school" };
- Random rnd = new Random();
- int rnd1 = rnd.Next(0, 7);
- int FindingRate1 = 1;
- int FindingRate2 = 1;
- int FindingRate3 = 1;
- int FindingRate4 = 1;
- int FindingRate5 = 1;
- int FindingRate6 = 1;
- int FindingRate7 = 1;
- int FindingRate8 = 1;
- int FindingRate9 = 1;
- int FindingRate10 = 1;
- int FindingRate11 = 1;
- int FindingRate12 = 1;
- int FindingRate13 = 1;
- Input:
- Console.WriteLine("You found {0}", Places[rnd1]);
- Console.WriteLine("Do you want to explore it? Yes (1), No (2)");
- while (!int.TryParse(Console.ReadLine(), out usrin1))
- {
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- }
- switch (usrin1)
- {
- case 1:
- Console.Clear();
- break;
- case 2:
- Console.Clear();
- return;
- default:
- Console.WriteLine("Invalid Input. Error 384");
- System.Threading.Thread.Sleep(1500);
- Console.Clear();
- goto Input;
- }
- switch (rnd1)
- {
- case 0:
- FindingRate2 = 6;
- FindingRate5 = 4;
- FindingRate4 = 6;
- FindingRate7 = 5;
- FindingRate13 = 2;
- break;
- case 1:
- FindingRate3 = 7;
- FindingRate5 = 5;
- FindingRate1 = 3;
- FindingRate7 = 3;
- break;
- case 2:
- FindingRate1 = 4;
- FindingRate3 = 6;
- FindingRate5 = 6;
- FindingRate2 = 6;
- FindingRate9 = 3;
- FindingRate10 = 5;
- FindingRate11 = 8;
- FindingRate12 = 5;
- FindingRate13 = 7;
- break;
- case 3:
- FindingRate2 = 6;
- FindingRate3 = 4;
- FindingRate4 = 6;
- FindingRate5 = 5;
- FindingRate6 = 7;
- break;
- case 4:
- FindingRate5 = 4;
- FindingRate7 = 6;
- FindingRate8 = 3;
- FindingRate3 = 5;
- break;
- case 5:
- FindingRate1 = 7;
- FindingRate2 = 8;
- FindingRate3 = 5;
- FindingRate5 = 6;
- break;
- case 6:
- FindingRate4 = 6;
- FindingRate5 = 3;
- FindingRate6 = 4;
- FindingRate10 = 5;
- FindingRate13 = 7;
- break;
- }
- Start:
- int rnd2 = rnd.Next(0, 11);
- int rnd3 = rnd.Next(1, 10);
- int rnd4 = rnd.Next(0, 6);
- string[] Bodyparts = new string[] { "knee", "left arm", "right arm", "hand", "foot", "skull" };
- if (rnd3 < numofloop) //SearchBad
- {
- Console.WriteLine("You stumble over a box..\nYou break your {0} and loose some health., ", Bodyparts[rnd4]);
- health -= 1.5m;
- System.Threading.Thread.Sleep(1500);
- Console.Clear();
- goto ContinueSearch;
- }
- if (rnd2 < FindingRate1)
- {
- FoundItemID = 1;
- Item = "Bandage";
- NeededSpace = BandageS;
- }
- else if (rnd2 < FindingRate2)
- {
- FoundItemID = 2;
- Item = "Painkillers";
- NeededSpace = PainkillersS;
- }
- else if (rnd2 < FindingRate3)
- {
- FoundItemID = 3;
- Item = "Water Bottle";
- NeededSpace = WaterBottleS;
- }
- else if (rnd2 < FindingRate4)
- {
- FoundItemID = 4;
- Item = "Soda Can";
- NeededSpace = SodaS;
- }
- else if (rnd2 < FindingRate5)
- {
- FoundItemID = 5;
- Item = "Canned Beans";
- NeededSpace = CannedBeansS;
- }
- else if (rnd2 < FindingRate6)
- {
- FoundItemID = 6;
- Item = "Snikers";
- NeededSpace = SnikersS;
- }
- else if (rnd2 < FindingRate7)
- {
- FoundItemID = 7;
- Item = "Axe";
- NeededSpace = AxeS;
- }
- else if (rnd2 < FindingRate8)
- {
- FoundItemID = 8;
- Item = "Chainsaw";
- NeededSpace = ChainsawS;
- }
- else if (rnd2 < FindingRate9)
- {
- FoundItemID = 9;
- Item = "Knife";
- NeededSpace = KnifeS;
- }
- else if (rnd2 < FindingRate10)
- {
- FoundItemID = 10;
- Item = "Handgun";
- NeededSpace = HandgunS;
- }
- else if (rnd2 < FindingRate11)
- {
- FoundItemID = 11;
- Item = "Assault Rifle";
- NeededSpace = Assault_RifleS;
- }
- else if (rnd2 < FindingRate12)
- {
- FoundItemID = 12;
- Item = "Shotgun";
- NeededSpace = ShotgunS;
- }
- else if (rnd2 < FindingRate13)
- {
- FoundItemID = 13;
- Item = "Ammo";
- NeededSpace = AmmoS;
- }
- else
- {
- Console.WriteLine("The {0} is empty. You leave...", Places[rnd1]);
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- return;
- }
- Console.WriteLine("You found a {0}! What do you want to do with it? Store(1), Throw away(2)", Item);
- while (!int.TryParse(Console.ReadLine(), out usrin2))
- {
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- }
- switch (usrin2)
- {
- case 1:
- break;
- case 2:
- Console.WriteLine("You threw the {0} away.", Item);
- System.Threading.Thread.Sleep(1500);
- Console.Clear();
- ThrewAway = true;
- break;
- }
- if (ThrewAway == false)
- {
- ITMID = FoundItemID;
- if (FreeSpace < NeededSpace)
- Console.WriteLine("You don't have enought space to store the {0}. ", Item);
- else
- {
- Console.WriteLine("Item stored successfully.");
- System.Threading.Thread.Sleep(1500);
- Console.Clear();
- FreeSpace -= NeededSpace;
- }
- }
- ContinueSearch:
- if (numofloop >= 5)
- {
- Console.WriteLine("The {0} is empty. You leave...", Places[rnd1]);
- System.Threading.Thread.Sleep(1500);
- Console.Clear();
- return;
- }
- Console.WriteLine("Do you want to continue searching? Yes(1), No(2)");
- while (!int.TryParse(Console.ReadLine(), out usrin3))
- {
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- }
- switch (usrin3)
- {
- case 1:
- numofloop++;
- goto Start;
- case 2:
- break;
- }
- return;
- }
- static public void InventoryItemFound(string Item, ref int Piece, int ItemID, decimal NeededSpace, decimal FreeSpace)
- {
- int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- int usrin1;
- Console.WriteLine("You found {0}! What do you want to do with it? Store(1), Throw away(2)", Item);
- while (!int.TryParse(Console.ReadLine(), out usrin1))
- {
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- }
- switch (usrin1)
- {
- case 1:
- break;
- case 2:
- Console.WriteLine("You threw the {0} away.", Item);
- return;
- }
- if (FreeSpace < NeededSpace)
- Console.WriteLine("You don't have enought space to store the {0}.", Item);
- else
- {
- Console.WriteLine("Item stored successfully.");
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- FreeSpace -= NeededSpace;
- Piece++;
- }
- }
- //Distance Process Bar
- static public void DistanceBar(decimal Distance)
- {
- string DistanceBar = null;
- if (Distance >= 10)
- {
- Console.WriteLine("You reached the bunker and got to savety!");
- Console.ReadKey();
- System.Environment.Exit(1);
- Console.WriteLine("Source code: ")
- }
- Distance = Math.Round(Distance);
- switch (Distance)
- {
- case 0:
- DistanceBar = "START >--------------------> BUNKER";
- break;
- case 1:
- DistanceBar = "START >>>------------------> BUNKER";
- break;
- case 2:
- DistanceBar = "START >>>>>----------------> BUNKER";
- break;
- case 3:
- DistanceBar = "START >>>>>>>--------------> BUNKER";
- break;
- case 4:
- DistanceBar = "START >>>>>>>>>------------> BUNKER";
- break;
- case 5:
- DistanceBar = "START >>>>>>>>>>>----------> BUNKER";
- break;
- case 6:
- DistanceBar = "START >>>>>>>>>>>>>--------> BUNKER";
- break;
- case 7:
- DistanceBar = "START >>>>>>>>>>>>>>>------> BUNKER";
- break;
- case 8:
- DistanceBar = "START >>>>>>>>>>>>>>>>>----> BUNKER";
- break;
- case 9:
- DistanceBar = "START >>>>>>>>>>>>>>>>>>>--> BUNKER";
- break;
- case 10:
- DistanceBar = "START >>>>>>>>>>>>>>>>>>>>>> BUNKER";
- break;
- default:
- DistanceBar = "START ERROR BUNKER";
- break;
- }
- Console.WriteLine(DistanceBar);
- Console.WriteLine("\n");
- return;
- }
- //Inventory Display
- static public void InventoryCheck(string Item, int Piece, ref int ItemID)
- {
- if (Piece > 0)
- {
- if (ItemID > 9)
- {
- Console.WriteLine("ID {0} |{1}: {2}", ItemID, Item, Piece);
- }
- else
- Console.WriteLine("ID {0} |{1}: {2}", ItemID, Item, Piece);
- }
- }
- //Inventory Menu
- static public void InventoryOptions(string Item, ref int Piece, bool IsUsable, int ItemID, ref decimal Stats)
- {
- int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- if (Piece > 0)
- {
- int usrin2;
- Console.WriteLine("What do you want to do with {0}? Use(1), Throw away(2)", Item);
- while (!int.TryParse(Console.ReadLine(), out usrin2))
- {
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- }
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- switch (usrin2)
- {
- case 1:
- if (IsUsable == true)
- {
- Console.Clear();
- Piece--;
- Console.WriteLine("You used {0}", Item);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- switch (ItemID)
- {
- case 1:
- Stats += 3;
- break;
- case 2:
- Stats += 1.5m;
- break;
- case 3:
- Stats += 4;
- break;
- case 4:
- Stats += 2;
- break;
- case 5:
- Stats += 4;
- break;
- case 6:
- Stats += 1;
- break;
- }
- }
- else
- Console.WriteLine("You can't use this Item.");
- break;
- case 2:
- Console.WriteLine("You threw {0} away.", Item);
- Piece--;
- Console.Clear();
- break;
- default:
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.SetCursorPosition(0, Console.CursorTop - 1);
- ClearCurrentConsoleLine();
- break;
- }
- }
- else
- {
- lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
- Console.WriteLine("Invalid Input. Error {0}", lineNumber);
- System.Threading.Thread.Sleep(1500);
- Console.Clear();
- }
- return;
- }
- //Formating
- public static void ClearCurrentConsoleLine()
- {
- int currentLineCursor = Console.CursorTop;
- Console.SetCursorPosition(0, Console.CursorTop);
- Console.Write(new string(' ', Console.WindowWidth));
- Console.SetCursorPosition(0, currentLineCursor);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement