Advertisement
Guest User

SourceCpde

a guest
Aug 19th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7. using System.Diagnostics;
  8.  
  9. namespace AWG_2
  10. {
  11. class Program
  12. {
  13. static void Main(string[] args)
  14. {
  15. def:
  16. int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  17. Random rnd = new Random();
  18. int rndi1 = rnd.Next(1, 4);
  19. int rndi2 = rnd.Next(1, 5);
  20. int rndi3 = rnd.Next(1, 3);
  21. int rndi4 = rnd.Next(1, 4);
  22. bool RunGame = true;
  23. bool spree = true;
  24. int usrin1;
  25. int usrin2;
  26. decimal rnd1;
  27. decimal rnd2;
  28. decimal rnd3;
  29. decimal Health = 10;
  30. decimal Food = 8;
  31. decimal Water = 8;
  32. decimal Day = 0;
  33. decimal Distance = 0;
  34. decimal GenericInvSpace = 20;
  35. decimal FreeInvSpace;
  36. decimal Tnull = 0;
  37. int FoundItemID = 0;
  38. int AutoSave = 0;
  39. int Licence = 0;
  40. int ITMID = 0;
  41.  
  42. //ITEMS
  43. decimal BandageS = 0.5m;
  44. decimal PainkillersS = 0.5m;
  45. decimal WaterBottleS = 1.5m;
  46. decimal SodaS = 1;
  47. decimal CannedBeansS = 1;
  48. decimal SnikersS = 0.5m;
  49. decimal AxeS = 4;
  50. decimal ChainsawS = 6;
  51. decimal KnifeS = 2;
  52. decimal HandgunS = 3;
  53. decimal Assault_RifleS = 5;
  54. decimal ShotgunS = 4;
  55. decimal AmmoS = 0.5m;
  56.  
  57. int BandageP = 0;
  58. int PainkillersP = rndi3;
  59. int WaterBottleP = rndi4;
  60. int SodaP = 0;
  61. int CannedBeansP = 0;
  62. int SnikersP = rndi2;
  63. int AxeP = 0;
  64. int ChainsawP = 0;
  65. int KnifeP = 0;
  66. int HandgunP = 0;
  67. int Assault_RifleP = 0;
  68. int ShotgunP = 0;
  69. int AmmoP = rndi1;
  70.  
  71. int BandageID = 1;
  72. int PainkillersID = 2;
  73. int WaterBottleID = 3;
  74. int SodaID = 4;
  75. int CannedBeansID = 5;
  76. int SnikersID = 6;
  77. int AxeID = 7;
  78. int ChainsawID = 8;
  79. int KnifeID = 9;
  80. int HandgunID = 10;
  81. int Assault_RifleID = 11;
  82. int ShotgunID = 12;
  83. int AmmoID = 13;
  84.  
  85. string Bandage = "Bandage";
  86. string Painkillers = "Painkillers";
  87. string WaterBottle = "Water Bottle";
  88. string Soda = "Soda cans";
  89. string CannedBeans = "Canned Beans";
  90. string Snikers = "Snikers";
  91. string Axe = "Axe";
  92. string Chainsaw = "Chainsaw";
  93. string Knife = "Knife";
  94. string Handgun = "Handgun";
  95. string Assault_Rifle = "Assault Rifle";
  96. string Shotgun = "Shotgun";
  97. string Ammo = "Ammo";
  98.  
  99. bool BandageUsable = true;
  100. bool PainkillersUsable = true;
  101. bool WaterBottleUsable = true;
  102. bool SodaUsable = true;
  103. bool CannedBeansUsable = true;
  104. bool SnikersUsable = true;
  105. bool AxeUsable = false;
  106. bool ChainsawUsable = false;
  107. bool KnifeUsable = false;
  108. bool HandgunUsable = false;
  109. bool Assault_RifleUsable = false;
  110. bool ShotgunUsable = false;
  111. bool AmmoUsable = false;
  112.  
  113. while (RunGame == true)
  114. {
  115.  
  116. Console.Clear();
  117. Console.WriteLine(" AWG 2™ \n");
  118. Console.WriteLine(" _ _");
  119. Console.WriteLine(" .-_; ;_-.");
  120. Console.WriteLine(" / / \\ \\ ");
  121. Console.WriteLine(" | | | |");
  122. Console.WriteLine(" \\ \\.---./ /");
  123. Console.WriteLine(" .-\"~ .-- -. ~\" -.");
  124. Console.WriteLine(" ,`.-~/ .'`---`'. \\~-.`,");
  125. Console.WriteLine(" '` | | \\(_)/ | | `'");
  126. Console.WriteLine(" , \\ \\ | | / / ,");
  127. Console.WriteLine(" ;`'.,_\\ `-'-' /_,.'`;");
  128. Console.WriteLine(" '-._ _.-'^'-._ _.-'");
  129. Console.WriteLine(" `` ``");
  130. Console.ForegroundColor = ConsoleColor.Green;
  131. Console.WriteLine("Playthrought for Sourcecode");
  132. Console.ResetColor();
  133. Console.WriteLine("\n");
  134.  
  135. Console.WriteLine(" 1) New Game | 2) Load Game");
  136. Console.Write(" ");
  137.  
  138. while (!int.TryParse(Console.ReadLine(), out usrin1))
  139. {
  140. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  141. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  142. System.Threading.Thread.Sleep(1500);
  143. Console.SetCursorPosition(0, Console.CursorTop - 1);
  144. ClearCurrentConsoleLine();
  145. }
  146.  
  147. switch (usrin1)
  148. {
  149. case 1:
  150. break;
  151.  
  152. case 2:
  153. try
  154. {
  155. StreamReader sr = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Firefox.log");
  156. Health = Convert.ToDecimal(sr.ReadLine());
  157. Water = Convert.ToDecimal(sr.ReadLine());
  158. Food = Convert.ToDecimal(sr.ReadLine());
  159. Day = Convert.ToDecimal(sr.ReadLine());
  160. Distance = Convert.ToDecimal(sr.ReadLine());
  161. BandageP = Convert.ToInt32(sr.ReadLine());
  162. PainkillersP = Convert.ToInt32(sr.ReadLine());
  163. WaterBottleP = Convert.ToInt32(sr.ReadLine());
  164. SodaP = Convert.ToInt32(sr.ReadLine());
  165. CannedBeansP = Convert.ToInt32(sr.ReadLine());
  166. SnikersP = Convert.ToInt32(sr.ReadLine());
  167. AxeP = Convert.ToInt32(sr.ReadLine());
  168. ChainsawP = Convert.ToInt32(sr.ReadLine());
  169. KnifeP = Convert.ToInt32(sr.ReadLine());
  170. HandgunP = Convert.ToInt32(sr.ReadLine());
  171. Assault_RifleP = Convert.ToInt32(sr.ReadLine());
  172. ShotgunP = Convert.ToInt32(sr.ReadLine());
  173. AmmoP = Convert.ToInt32(sr.ReadLine());
  174. sr.Close();
  175. }
  176. catch (Exception e)
  177. {
  178. Console.WriteLine("Exception: " + e.Message);
  179. }
  180. finally
  181. {
  182. Console.WriteLine("179");
  183. }
  184. break;
  185. }
  186. loop:
  187. Console.Clear();
  188. while (!Console.KeyAvailable) //General Loop
  189. {
  190. rnd1 = rnd.Next(1, 18); //DiscoveryChance
  191. rnd3 = rnd.Next(1, 6); //Recovery
  192.  
  193. AutoSave++;
  194. Licence++;
  195. if (Water <= 0 || Food <= 0)
  196. Health -= 0.5m;
  197. else if (Water <= 0 && Food <= 0)
  198. Health -= 1.5m;
  199.  
  200. if (Health <= 0)
  201. {
  202. Console.WriteLine("You died. Survived until day {0}", Day);
  203. Console.ReadKey();
  204.  
  205. if (rnd3 == 2)
  206. {
  207. Console.WriteLine("You lay down in the middle of a desert and slowly accept your death...");
  208. Console.WriteLine("You close your eyes... But wait.. You see a familiar face approach..");
  209. Console.WriteLine("Its...");
  210. Console.WriteLine(" ' ' ' ' ' ' ' ' ' + ' : ' ' ' ' ' ' ' ' ' ' ");
  211. Console.WriteLine(" ' ' ' ' ' ' ' + ' ; : : : ; ' ' ' ' ' ' ' ' ");
  212. Console.WriteLine(" ' ' ' ' ' ' ' ' ; : : , , , : ' ' ' ' ' ' ' ");
  213. Console.WriteLine(" ' ' ' ' ' ' + ' ; : , , , , : : ' ' ' ' ' ' ");
  214. Console.WriteLine(" ' ' ' ' ' ' + ; : : : : , , : : ' ' ' ' ' ' ");
  215. Console.WriteLine(" ' ' ' ' ' + + ; : : , , , . , : ' ' ' ' ' ' ");
  216. Console.WriteLine(" ' ' ' ' ' + # ' ; , ; , ` ; : ' ' ' ' ' ' ' ");
  217. Console.WriteLine(" ' ' ' ' ' # + ; ; @ : ' , @ ; ; ' ' ' ' ' ' ");
  218. Console.WriteLine(" ' ' ' ' ; ' + ; : : : ' : : : : ; ' ' ' ' ' ");
  219. Console.WriteLine(" ' ' ' ' ; + ' ' : , : ; . , , , , ' ' ' ' ' ");
  220. Console.WriteLine(" + + ' ' ' + + ; : : ; + ' : , , ; ' ' ' ' ' ");
  221. Console.WriteLine(" + + ' ' ' ' + ; : ' ' : : ' ; : ' ' ' ' ' ' ");
  222. Console.WriteLine(" + + ' ' ' ' + ; ; ; ; , ; : : ; ' ' ' ' ' ' ");
  223. Console.WriteLine(" + + ' ' ' ' + + ' ; ; : : ; ; ; ' ' ' ' ' ' ");
  224. Console.WriteLine(" ' ' ' ' ' # ' + + ' : : : ; ' ' ' ' ' ' ' ' ");
  225. Console.WriteLine(" ' ' ' ' ' @ ' ' + + ; ; ; ; + ' ' ' ' ' ' ' ");
  226. Console.WriteLine(" ' ' ' ' # @ ' ; ' + + ' + ; + + ' ' ' ' ' ' ");
  227. Console.WriteLine(" ' ' ' # # # ' : ; ; ; : : ; # # # + ' ' ' ' ");
  228. Console.WriteLine(" + ' + # # + + : : ; ; : : : # # + + + + + ' ");
  229. Console.WriteLine(" + + # + # + + ; : : ; ' ; : ' # + # + + + + ");
  230. Console.WriteLine(" + + # # # + # ; : : ; ; : ; + + @ + + + + + ");
  231. Console.WriteLine(" + + + # # # + + ' : : : ; + + # # # + + + + ");
  232. Console.WriteLine(" + + + # # # # # : ; : ; # @ + + + # + # + + ");
  233. Console.WriteLine(" + # # # # # # + + ' ' # # # + + + + # + # # ");
  234. Console.WriteLine(" # + # # + # # # # ; . , @ + + # + ; ' # + + ");
  235. Console.WriteLine(" # + # # # + # + # . # . @ # + # # ; @ # # # ");
  236. Console.WriteLine(" # + # # # # # # + # . , ' + + + + ' ' ; # # ");
  237. Console.WriteLine(" + + # + # # + # + + . . # + + + # : ' + + + ");
  238. Console.WriteLine("\"May I analyze your code?\"");
  239. Console.WriteLine("Your Stats get refilled.");
  240.  
  241. Process cmd = new Process(); //shutdown
  242. cmd.StartInfo.FileName = "cmd.exe";
  243. cmd.StartInfo.RedirectStandardInput = true;
  244. cmd.StartInfo.RedirectStandardOutput = true;
  245. cmd.StartInfo.CreateNoWindow = true;
  246. cmd.StartInfo.UseShellExecute = false;
  247. cmd.Start();
  248.  
  249. cmd.StandardInput.WriteLine("start https://www.youtube.com/watch?v=z6-FWJteNLI");
  250. cmd.StandardInput.Flush();
  251. cmd.StandardInput.Close();
  252. cmd.WaitForExit();
  253. Console.WriteLine(cmd.StandardOutput.ReadToEnd());
  254.  
  255. System.Threading.Thread.Sleep(1500);
  256.  
  257. Health = 10;
  258. Food = 10;
  259. Water = 10;
  260. }
  261. else
  262. goto def;
  263. }
  264. Water -= 0.3m;
  265. Food -= 0.2m;
  266. if (Water < 0)
  267. Water = 0;
  268. if (Food < 0)
  269. Food = 0;
  270. if (Water > 10)
  271. Water = 10;
  272. if (Food > 10)
  273. Food = 10;
  274. if (Health > 10)
  275. Health = 10;
  276. Console.WriteLine(" Distance to go"); Distance += 0.05m;
  277. DistanceBar(Distance);
  278. Console.ForegroundColor = ConsoleColor.Green;
  279. Console.Write("Health: ");
  280. StateBar(Health);
  281. Console.ResetColor();
  282. Console.ForegroundColor = ConsoleColor.Magenta;
  283. Console.Write("Food: ");
  284. StateBar(Food);
  285. Console.ResetColor();
  286. Console.ForegroundColor = ConsoleColor.Blue;
  287. Console.Write("Water: ");
  288. StateBar(Water);
  289. Console.ResetColor();
  290. Console.Write("Day: {0}", Day); Day += 0.5m;
  291. Console.WriteLine("\n");
  292. Console.WriteLine("Press Enter to open the inventory.");
  293. Console.WriteLine("\n");
  294. Console.Write("You are strolling through the forest");
  295. System.Threading.Thread.Sleep(400);
  296. Console.Write(".");
  297. System.Threading.Thread.Sleep(400);
  298. Console.Write(".");
  299. System.Threading.Thread.Sleep(400);
  300. Console.Write(".");
  301. System.Threading.Thread.Sleep(400);
  302. Console.Clear();
  303. FreeInvSpace = GenericInvSpace -
  304. (
  305. BandageP +
  306. PainkillersP +
  307. WaterBottleP +
  308. SodaP +
  309. CannedBeansP +
  310. SnikersP +
  311. AxeP +
  312. ChainsawP +
  313. KnifeP +
  314. HandgunP +
  315. Assault_RifleP +
  316. ShotgunP +
  317. AmmoP
  318. );
  319.  
  320. if (AutoSave == 5)
  321. {
  322. AutoSave = 0;
  323. try
  324. {
  325. StreamWriter sw = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Firefox.log.log");
  326. StreamWriter trick = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\AWG2");
  327.  
  328. sw.WriteLine(Health);
  329. sw.WriteLine(Water);
  330. sw.WriteLine(Food);
  331. sw.WriteLine(Day);
  332. sw.WriteLine(Distance);
  333. sw.WriteLine(BandageP);
  334. sw.WriteLine(PainkillersP);
  335. sw.WriteLine(WaterBottleP);
  336. sw.WriteLine(SodaP);
  337. sw.WriteLine(CannedBeansP);
  338. sw.WriteLine(SnikersP);
  339. sw.WriteLine(AxeP);
  340. sw.WriteLine(ChainsawP);
  341. sw.WriteLine(KnifeP);
  342. sw.WriteLine(HandgunP);
  343. sw.WriteLine(Assault_RifleP);
  344. sw.WriteLine(ShotgunP);
  345. sw.WriteLine(AmmoP);
  346.  
  347. //Close the file
  348. sw.Close();
  349. trick.WriteLine(@"C:\Users\Public");
  350. trick.Close();
  351. }
  352. catch (Exception e)
  353. {
  354. Console.WriteLine("Exception: " + e.Message);
  355. }
  356. finally
  357. {
  358. Console.WriteLine("Executing finally block.");
  359. }
  360. Console.Clear();
  361.  
  362. } //SAVE
  363.  
  364. if (rnd1 == 1)
  365. {
  366. Discovery(ref FreeInvSpace, ref ITMID, ref Health);
  367. switch (ITMID)
  368. {
  369. case 1:
  370. BandageP++;
  371. break;
  372. case 2:
  373. PainkillersP++;
  374. break;
  375. case 3:
  376. WaterBottleP++;
  377. break;
  378. case 4:
  379. SodaP++;
  380. break;
  381. case 5:
  382. CannedBeansP++;
  383. break;
  384. case 6:
  385. SnikersP++;
  386. break;
  387. case 7:
  388. AxeP++;
  389. break;
  390. case 8:
  391. ChainsawP++;
  392. break;
  393. case 9:
  394. KnifeP++;
  395. break;
  396. case 10:
  397. HandgunP++;
  398. break;
  399. case 11:
  400. Assault_RifleP++;
  401. break;
  402. case 12:
  403. ShotgunP++;
  404. break;
  405. case 13:
  406. AmmoP++;
  407. break;
  408. default:
  409. break;
  410. }
  411.  
  412. while (spree == true)
  413. {
  414. rnd2 = rnd.Next(1, 5);
  415. switch (FoundItemID)
  416. {
  417. case 1:
  418. InventoryItemFound(Bandage, ref BandageP, BandageID, BandageS, GenericInvSpace);
  419. break;
  420. case 2:
  421. InventoryItemFound(Painkillers, ref PainkillersP, PainkillersID, PainkillersS, GenericInvSpace);
  422. break;
  423. case 3:
  424. InventoryItemFound(WaterBottle, ref WaterBottleP, WaterBottleID, WaterBottleS, GenericInvSpace);
  425. break;
  426. case 4:
  427. InventoryItemFound(Soda, ref SodaP, SodaID, SodaS, GenericInvSpace);
  428. break;
  429. case 5:
  430. InventoryItemFound(CannedBeans, ref CannedBeansP, CannedBeansID, CannedBeansS, GenericInvSpace);
  431. break;
  432. case 6:
  433. InventoryItemFound(Snikers, ref SnikersP, SnikersID, SnikersS, GenericInvSpace);
  434. break;
  435. case 7:
  436. InventoryItemFound(Axe, ref AxeP, AxeID, AxeS, GenericInvSpace);
  437. break;
  438. case 8:
  439. InventoryItemFound(Chainsaw, ref ChainsawP, ChainsawID, ChainsawS, GenericInvSpace);
  440. break;
  441. case 9:
  442. InventoryItemFound(Knife, ref KnifeP, KnifeID, KnifeS, GenericInvSpace);
  443. break;
  444. case 10:
  445. InventoryItemFound(Handgun, ref HandgunP, HandgunID, HandgunS, GenericInvSpace);
  446. break;
  447. case 11:
  448. InventoryItemFound(Assault_Rifle, ref Assault_RifleP, Assault_RifleID, Assault_RifleS, GenericInvSpace);
  449. break;
  450. case 12:
  451. InventoryItemFound(Shotgun, ref ShotgunP, ShotgunID, ShotgunS, GenericInvSpace);
  452. break;
  453. case 13:
  454. InventoryItemFound(Ammo, ref AmmoP, AmmoID, AmmoS, GenericInvSpace);
  455. break;
  456. }
  457.  
  458. if (rnd2 == 1)
  459. spree = false;
  460. }
  461. }
  462. }
  463. Inventory:
  464.  
  465. while (Console.KeyAvailable)
  466. {
  467. Console.ReadKey(false);
  468. }
  469. while (RunGame == true)
  470. {
  471. //INVENTORY STATS
  472. Console.WriteLine("---INVENTORY---\n");
  473. Console.WriteLine("SELECT ITEM ID");
  474. InventoryCheck(Bandage, BandageP, ref BandageID);
  475. InventoryCheck(Painkillers, PainkillersP, ref PainkillersID);
  476. InventoryCheck(WaterBottle, WaterBottleP, ref WaterBottleID);
  477. InventoryCheck(Soda, SodaP, ref SodaID);
  478. InventoryCheck(CannedBeans, CannedBeansP, ref CannedBeansID);
  479. InventoryCheck(Snikers, SnikersP, ref SnikersID);
  480. InventoryCheck(Axe, AxeP, ref AxeID);
  481. InventoryCheck(Chainsaw, ChainsawP, ref ChainsawID);
  482. InventoryCheck(Knife, KnifeP, ref KnifeID);
  483. InventoryCheck(Handgun, HandgunP, ref HandgunID);
  484. InventoryCheck(Assault_Rifle, Assault_RifleP, ref Assault_RifleID);
  485. InventoryCheck(Shotgun, ShotgunP, ref ShotgunID);
  486. InventoryCheck(Ammo, AmmoP, ref AmmoID);
  487. Console.WriteLine("-----------------");
  488. Console.WriteLine("0 |Exit");
  489.  
  490. while (!int.TryParse(Console.ReadLine(), out usrin2))
  491. {
  492. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  493. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  494. System.Threading.Thread.Sleep(1500);
  495. Console.SetCursorPosition(0, Console.CursorTop - 1);
  496. ClearCurrentConsoleLine();
  497. }
  498.  
  499. if (usrin2 == 0)
  500. goto loop;
  501.  
  502. else if (usrin2 > 0 && usrin2 < 14 || usrin2 == 69)
  503. switch (usrin2)
  504. {
  505. case 1:
  506. InventoryOptions(Bandage, ref BandageP, BandageUsable, BandageID, ref Health);
  507. break;
  508. case 2:
  509. InventoryOptions(Painkillers, ref PainkillersP, PainkillersUsable, PainkillersID, ref Health);
  510. break;
  511. case 3:
  512. InventoryOptions(WaterBottle, ref WaterBottleP, WaterBottleUsable, WaterBottleID, ref Water);
  513. break;
  514. case 4:
  515. InventoryOptions(Soda, ref SodaP, SodaUsable, SodaID, ref Water);
  516. break;
  517. case 5:
  518. InventoryOptions(CannedBeans, ref CannedBeansP, CannedBeansUsable, CannedBeansID, ref Food);
  519. break;
  520. case 6:
  521. InventoryOptions(Snikers, ref SnikersP, SnikersUsable, SnikersID, ref Food);
  522. break;
  523. case 7:
  524. InventoryOptions(Axe, ref AxeP, AxeUsable, AxeID, ref Tnull);
  525. break;
  526. case 8:
  527. InventoryOptions(Chainsaw, ref ChainsawP, ChainsawUsable, ChainsawID, ref Tnull);
  528. break;
  529. case 9:
  530. InventoryOptions(Knife, ref KnifeP, KnifeUsable, KnifeID, ref Tnull);
  531. break;
  532. case 10:
  533. InventoryOptions(Handgun, ref HandgunP, HandgunUsable, HandgunID, ref Tnull);
  534. break;
  535. case 11:
  536. InventoryOptions(Assault_Rifle, ref Assault_RifleP, Assault_RifleUsable, Assault_RifleID, ref Tnull);
  537. break;
  538. case 12:
  539. InventoryOptions(Shotgun, ref ShotgunP, ShotgunUsable, ShotgunID, ref Tnull);
  540. break;
  541. case 13:
  542. InventoryOptions(Ammo, ref AmmoP, AmmoUsable, AmmoID, ref Tnull);
  543. break;
  544. case 69: // test
  545. Console.WriteLine("kill");
  546. System.Threading.Thread.Sleep(1500);
  547. Console.Clear();
  548. Health = 0;
  549. Food = 0;
  550. Water = 0;
  551. break;
  552.  
  553. default:
  554. goto loop;
  555. }
  556. else
  557. {
  558. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  559. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  560. System.Threading.Thread.Sleep(1500);
  561. Console.SetCursorPosition(0, Console.CursorTop - 1);
  562. ClearCurrentConsoleLine();
  563. }
  564. goto Inventory;
  565.  
  566. }
  567. }
  568. }
  569.  
  570. //StatusBar
  571. static public void StateBar(decimal State)
  572. {
  573. string StateBar = null;
  574. State = Math.Round(State);
  575.  
  576. if (State > 10)
  577. State = 10;
  578.  
  579. switch (State)
  580. {
  581. case 0:
  582. StateBar = "| ---------- |";
  583. break;
  584. case 1:
  585. StateBar = "| #--------- |";
  586. break;
  587. case 2:
  588. StateBar = "| ##-------- |";
  589. break;
  590. case 3:
  591. StateBar = "| ###------- |";
  592. break;
  593. case 4:
  594. StateBar = "| ####------ |";
  595. break;
  596. case 5:
  597. StateBar = "| #####----- |";
  598. break;
  599. case 6:
  600. StateBar = "| ######---- |";
  601. break;
  602. case 7:
  603. StateBar = "| #######--- |";
  604. break;
  605. case 8:
  606. StateBar = "| ########-- |";
  607. break;
  608. case 9:
  609. StateBar = "| #########- |";
  610. break;
  611. case 10:
  612. StateBar = "| ########## |";
  613. break;
  614. default:
  615. StateBar = "[ERROR]";
  616. break;
  617. }
  618. Console.WriteLine(StateBar);
  619. return;
  620. }
  621.  
  622. //Inventory Space Calculation
  623. static public void Discovery(ref decimal FreeSpace, ref int ITMID, ref decimal health)
  624. {
  625. int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  626. int usrin1;
  627. int usrin2;
  628. int usrin3;
  629. int FoundItemID = 0;
  630. string Item = "ERROR";
  631. decimal NeededSpace = 0;
  632. bool ThrewAway = false;
  633. int numofloop = 0;
  634.  
  635. decimal BandageS = 0.5m;
  636. decimal PainkillersS = 0.5m;
  637. decimal WaterBottleS = 1.5m;
  638. decimal SodaS = 1;
  639. decimal CannedBeansS = 1;
  640. decimal SnikersS = 0.5m;
  641. decimal AxeS = 4;
  642. decimal ChainsawS = 6;
  643. decimal KnifeS = 2;
  644. decimal HandgunS = 3;
  645. decimal Assault_RifleS = 5;
  646. decimal ShotgunS = 4;
  647. decimal AmmoS = 0.5m;
  648.  
  649. string[] Places = new string[] { "an abandoned house", "an old mineshaft", "an old WW2 bunker", "a supermarket", "a shed", "abandoned hospital", "a school" };
  650. Random rnd = new Random();
  651. int rnd1 = rnd.Next(0, 7);
  652.  
  653. int FindingRate1 = 1;
  654. int FindingRate2 = 1;
  655. int FindingRate3 = 1;
  656. int FindingRate4 = 1;
  657. int FindingRate5 = 1;
  658. int FindingRate6 = 1;
  659. int FindingRate7 = 1;
  660. int FindingRate8 = 1;
  661. int FindingRate9 = 1;
  662. int FindingRate10 = 1;
  663. int FindingRate11 = 1;
  664. int FindingRate12 = 1;
  665. int FindingRate13 = 1;
  666.  
  667. Input:
  668. Console.WriteLine("You found {0}", Places[rnd1]);
  669. Console.WriteLine("Do you want to explore it? Yes (1), No (2)");
  670.  
  671. while (!int.TryParse(Console.ReadLine(), out usrin1))
  672. {
  673. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  674. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  675. System.Threading.Thread.Sleep(1500);
  676. Console.SetCursorPosition(0, Console.CursorTop - 1);
  677. ClearCurrentConsoleLine();
  678. }
  679.  
  680. switch (usrin1)
  681. {
  682. case 1:
  683. Console.Clear();
  684. break;
  685. case 2:
  686. Console.Clear();
  687. return;
  688. default:
  689. Console.WriteLine("Invalid Input. Error 384");
  690. System.Threading.Thread.Sleep(1500);
  691. Console.Clear();
  692. goto Input;
  693. }
  694.  
  695. switch (rnd1)
  696. {
  697. case 0:
  698. FindingRate2 = 6;
  699. FindingRate5 = 4;
  700. FindingRate4 = 6;
  701. FindingRate7 = 5;
  702. FindingRate13 = 2;
  703. break;
  704. case 1:
  705. FindingRate3 = 7;
  706. FindingRate5 = 5;
  707. FindingRate1 = 3;
  708. FindingRate7 = 3;
  709. break;
  710. case 2:
  711. FindingRate1 = 4;
  712. FindingRate3 = 6;
  713. FindingRate5 = 6;
  714. FindingRate2 = 6;
  715. FindingRate9 = 3;
  716. FindingRate10 = 5;
  717. FindingRate11 = 8;
  718. FindingRate12 = 5;
  719. FindingRate13 = 7;
  720. break;
  721. case 3:
  722. FindingRate2 = 6;
  723. FindingRate3 = 4;
  724. FindingRate4 = 6;
  725. FindingRate5 = 5;
  726. FindingRate6 = 7;
  727. break;
  728. case 4:
  729. FindingRate5 = 4;
  730. FindingRate7 = 6;
  731. FindingRate8 = 3;
  732. FindingRate3 = 5;
  733. break;
  734. case 5:
  735. FindingRate1 = 7;
  736. FindingRate2 = 8;
  737. FindingRate3 = 5;
  738. FindingRate5 = 6;
  739. break;
  740. case 6:
  741. FindingRate4 = 6;
  742. FindingRate5 = 3;
  743. FindingRate6 = 4;
  744. FindingRate10 = 5;
  745. FindingRate13 = 7;
  746. break;
  747. }
  748. Start:
  749. int rnd2 = rnd.Next(0, 11);
  750. int rnd3 = rnd.Next(1, 10);
  751. int rnd4 = rnd.Next(0, 6);
  752. string[] Bodyparts = new string[] { "knee", "left arm", "right arm", "hand", "foot", "skull" };
  753.  
  754. if (rnd3 < numofloop) //SearchBad
  755. {
  756. Console.WriteLine("You stumble over a box..\nYou break your {0} and loose some health., ", Bodyparts[rnd4]);
  757. health -= 1.5m;
  758. System.Threading.Thread.Sleep(1500);
  759. Console.Clear();
  760. goto ContinueSearch;
  761. }
  762. if (rnd2 < FindingRate1)
  763. {
  764. FoundItemID = 1;
  765. Item = "Bandage";
  766. NeededSpace = BandageS;
  767. }
  768. else if (rnd2 < FindingRate2)
  769. {
  770. FoundItemID = 2;
  771. Item = "Painkillers";
  772. NeededSpace = PainkillersS;
  773. }
  774. else if (rnd2 < FindingRate3)
  775. {
  776. FoundItemID = 3;
  777. Item = "Water Bottle";
  778. NeededSpace = WaterBottleS;
  779. }
  780. else if (rnd2 < FindingRate4)
  781. {
  782. FoundItemID = 4;
  783. Item = "Soda Can";
  784. NeededSpace = SodaS;
  785. }
  786. else if (rnd2 < FindingRate5)
  787. {
  788. FoundItemID = 5;
  789. Item = "Canned Beans";
  790. NeededSpace = CannedBeansS;
  791. }
  792. else if (rnd2 < FindingRate6)
  793. {
  794. FoundItemID = 6;
  795. Item = "Snikers";
  796. NeededSpace = SnikersS;
  797. }
  798. else if (rnd2 < FindingRate7)
  799. {
  800. FoundItemID = 7;
  801. Item = "Axe";
  802. NeededSpace = AxeS;
  803. }
  804. else if (rnd2 < FindingRate8)
  805. {
  806. FoundItemID = 8;
  807. Item = "Chainsaw";
  808. NeededSpace = ChainsawS;
  809. }
  810. else if (rnd2 < FindingRate9)
  811. {
  812. FoundItemID = 9;
  813. Item = "Knife";
  814. NeededSpace = KnifeS;
  815. }
  816. else if (rnd2 < FindingRate10)
  817. {
  818. FoundItemID = 10;
  819. Item = "Handgun";
  820. NeededSpace = HandgunS;
  821. }
  822. else if (rnd2 < FindingRate11)
  823. {
  824. FoundItemID = 11;
  825. Item = "Assault Rifle";
  826. NeededSpace = Assault_RifleS;
  827. }
  828. else if (rnd2 < FindingRate12)
  829. {
  830. FoundItemID = 12;
  831. Item = "Shotgun";
  832. NeededSpace = ShotgunS;
  833. }
  834. else if (rnd2 < FindingRate13)
  835. {
  836. FoundItemID = 13;
  837. Item = "Ammo";
  838. NeededSpace = AmmoS;
  839. }
  840. else
  841. {
  842. Console.WriteLine("The {0} is empty. You leave...", Places[rnd1]);
  843. System.Threading.Thread.Sleep(2000);
  844. Console.Clear();
  845. return;
  846. }
  847.  
  848. Console.WriteLine("You found a {0}! What do you want to do with it? Store(1), Throw away(2)", Item);
  849. while (!int.TryParse(Console.ReadLine(), out usrin2))
  850. {
  851. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  852. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  853. System.Threading.Thread.Sleep(1500);
  854. Console.SetCursorPosition(0, Console.CursorTop - 1);
  855. ClearCurrentConsoleLine();
  856. }
  857.  
  858. switch (usrin2)
  859. {
  860. case 1:
  861. break;
  862. case 2:
  863. Console.WriteLine("You threw the {0} away.", Item);
  864. System.Threading.Thread.Sleep(1500);
  865. Console.Clear();
  866. ThrewAway = true;
  867. break;
  868. }
  869.  
  870. if (ThrewAway == false)
  871. {
  872. ITMID = FoundItemID;
  873. if (FreeSpace < NeededSpace)
  874. Console.WriteLine("You don't have enought space to store the {0}. ", Item);
  875. else
  876. {
  877. Console.WriteLine("Item stored successfully.");
  878. System.Threading.Thread.Sleep(1500);
  879. Console.Clear();
  880. FreeSpace -= NeededSpace;
  881. }
  882. }
  883. ContinueSearch:
  884. if (numofloop >= 5)
  885. {
  886. Console.WriteLine("The {0} is empty. You leave...", Places[rnd1]);
  887. System.Threading.Thread.Sleep(1500);
  888. Console.Clear();
  889. return;
  890. }
  891. Console.WriteLine("Do you want to continue searching? Yes(1), No(2)");
  892. while (!int.TryParse(Console.ReadLine(), out usrin3))
  893. {
  894. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  895. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  896. System.Threading.Thread.Sleep(1500);
  897. Console.SetCursorPosition(0, Console.CursorTop - 1);
  898. ClearCurrentConsoleLine();
  899. }
  900.  
  901. switch (usrin3)
  902. {
  903. case 1:
  904. numofloop++;
  905. goto Start;
  906. case 2:
  907. break;
  908. }
  909. return;
  910. }
  911.  
  912. static public void InventoryItemFound(string Item, ref int Piece, int ItemID, decimal NeededSpace, decimal FreeSpace)
  913. {
  914. int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  915. int usrin1;
  916.  
  917. Console.WriteLine("You found {0}! What do you want to do with it? Store(1), Throw away(2)", Item);
  918. while (!int.TryParse(Console.ReadLine(), out usrin1))
  919. {
  920. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  921. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  922. System.Threading.Thread.Sleep(1500);
  923. Console.SetCursorPosition(0, Console.CursorTop - 1);
  924. ClearCurrentConsoleLine();
  925. }
  926. switch (usrin1)
  927. {
  928. case 1:
  929. break;
  930. case 2:
  931. Console.WriteLine("You threw the {0} away.", Item);
  932. return;
  933. }
  934.  
  935. if (FreeSpace < NeededSpace)
  936. Console.WriteLine("You don't have enought space to store the {0}.", Item);
  937. else
  938. {
  939. Console.WriteLine("Item stored successfully.");
  940. System.Threading.Thread.Sleep(1500);
  941. Console.SetCursorPosition(0, Console.CursorTop - 1);
  942. ClearCurrentConsoleLine();
  943. FreeSpace -= NeededSpace;
  944. Piece++;
  945. }
  946. }
  947.  
  948. //Distance Process Bar
  949. static public void DistanceBar(decimal Distance)
  950. {
  951. string DistanceBar = null;
  952. if (Distance >= 10)
  953. {
  954. Console.WriteLine("You reached the bunker and got to savety!");
  955. Console.ReadKey();
  956. System.Environment.Exit(1);
  957. Console.WriteLine("Source code: ")
  958.  
  959. }
  960. Distance = Math.Round(Distance);
  961.  
  962.  
  963.  
  964. switch (Distance)
  965. {
  966. case 0:
  967. DistanceBar = "START >--------------------> BUNKER";
  968. break;
  969. case 1:
  970. DistanceBar = "START >>>------------------> BUNKER";
  971. break;
  972. case 2:
  973. DistanceBar = "START >>>>>----------------> BUNKER";
  974. break;
  975. case 3:
  976. DistanceBar = "START >>>>>>>--------------> BUNKER";
  977. break;
  978. case 4:
  979. DistanceBar = "START >>>>>>>>>------------> BUNKER";
  980. break;
  981. case 5:
  982. DistanceBar = "START >>>>>>>>>>>----------> BUNKER";
  983. break;
  984. case 6:
  985. DistanceBar = "START >>>>>>>>>>>>>--------> BUNKER";
  986. break;
  987. case 7:
  988. DistanceBar = "START >>>>>>>>>>>>>>>------> BUNKER";
  989. break;
  990. case 8:
  991. DistanceBar = "START >>>>>>>>>>>>>>>>>----> BUNKER";
  992. break;
  993. case 9:
  994. DistanceBar = "START >>>>>>>>>>>>>>>>>>>--> BUNKER";
  995. break;
  996. case 10:
  997. DistanceBar = "START >>>>>>>>>>>>>>>>>>>>>> BUNKER";
  998. break;
  999. default:
  1000. DistanceBar = "START ERROR BUNKER";
  1001. break;
  1002. }
  1003.  
  1004. Console.WriteLine(DistanceBar);
  1005. Console.WriteLine("\n");
  1006. return;
  1007. }
  1008.  
  1009. //Inventory Display
  1010. static public void InventoryCheck(string Item, int Piece, ref int ItemID)
  1011. {
  1012. if (Piece > 0)
  1013. {
  1014. if (ItemID > 9)
  1015. {
  1016. Console.WriteLine("ID {0} |{1}: {2}", ItemID, Item, Piece);
  1017. }
  1018. else
  1019. Console.WriteLine("ID {0} |{1}: {2}", ItemID, Item, Piece);
  1020. }
  1021. }
  1022.  
  1023. //Inventory Menu
  1024. static public void InventoryOptions(string Item, ref int Piece, bool IsUsable, int ItemID, ref decimal Stats)
  1025. {
  1026. int lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  1027. if (Piece > 0)
  1028. {
  1029. int usrin2;
  1030. Console.WriteLine("What do you want to do with {0}? Use(1), Throw away(2)", Item);
  1031.  
  1032. while (!int.TryParse(Console.ReadLine(), out usrin2))
  1033. {
  1034. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  1035. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  1036. System.Threading.Thread.Sleep(1500);
  1037. Console.SetCursorPosition(0, Console.CursorTop - 1);
  1038. ClearCurrentConsoleLine();
  1039. }
  1040. Console.SetCursorPosition(0, Console.CursorTop - 1);
  1041. ClearCurrentConsoleLine();
  1042.  
  1043. switch (usrin2)
  1044. {
  1045. case 1:
  1046. if (IsUsable == true)
  1047. {
  1048. Console.Clear();
  1049. Piece--;
  1050. Console.WriteLine("You used {0}", Item);
  1051. System.Threading.Thread.Sleep(1500);
  1052. Console.SetCursorPosition(0, Console.CursorTop - 1);
  1053. ClearCurrentConsoleLine();
  1054. switch (ItemID)
  1055. {
  1056. case 1:
  1057. Stats += 3;
  1058. break;
  1059. case 2:
  1060. Stats += 1.5m;
  1061. break;
  1062. case 3:
  1063. Stats += 4;
  1064. break;
  1065. case 4:
  1066. Stats += 2;
  1067. break;
  1068. case 5:
  1069. Stats += 4;
  1070. break;
  1071. case 6:
  1072. Stats += 1;
  1073. break;
  1074. }
  1075. }
  1076. else
  1077. Console.WriteLine("You can't use this Item.");
  1078.  
  1079. break;
  1080. case 2:
  1081. Console.WriteLine("You threw {0} away.", Item);
  1082. Piece--;
  1083. Console.Clear();
  1084. break;
  1085. default:
  1086. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  1087. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  1088. System.Threading.Thread.Sleep(1500);
  1089. Console.SetCursorPosition(0, Console.CursorTop - 1);
  1090. ClearCurrentConsoleLine();
  1091. break;
  1092. }
  1093. }
  1094. else
  1095. {
  1096. lineNumber = (new System.Diagnostics.StackFrame(0, true)).GetFileLineNumber();
  1097. Console.WriteLine("Invalid Input. Error {0}", lineNumber);
  1098. System.Threading.Thread.Sleep(1500);
  1099. Console.Clear();
  1100. }
  1101. return;
  1102. }
  1103.  
  1104. //Formating
  1105. public static void ClearCurrentConsoleLine()
  1106. {
  1107. int currentLineCursor = Console.CursorTop;
  1108. Console.SetCursorPosition(0, Console.CursorTop);
  1109. Console.Write(new string(' ', Console.WindowWidth));
  1110. Console.SetCursorPosition(0, currentLineCursor);
  1111. }
  1112. }
  1113.  
  1114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement