static public void GetRandomEvent() { Fancies(); Monster test = new Monster(); Console.WriteLine("\nИгрок:" + $"\nHP: {HP}/{MaxHP} [{HPLine}]"); if (LVL != 15) { Console.WriteLine($"УР {LVL}: {XP}/{MaxXP} [{XPLine}]"); } else { Dialogue($"LVL {LVL}: {XP}/{MaxXP} [{XPLine}] " + $"\nОчки мастерства: {MasteryPoints}", true, ConsoleColor.Yellow); } Console.WriteLine($"Деньги: {Player.Money}"); Console.WriteLine("\nЛес - 1, Задание - 2, Город - 3"); if (towerLoc) { Console.WriteLine("Заброшенная башня - 9"); } Console.WriteLine("Сохранить игру - s, Загрузить игру - l, Достижения - a, Инвентарь - i"); switch (Console.ReadLine()) { case "1": Console.Clear(); int Event = rnd.Next(0, 10); if (Event < 5) { Console.WriteLine("Тут ничего"); } else if (Event == 5) { Money = rnd.Next(0, 10) + 2 * LVL; Player.Money += Money; Dialogue("Ого, сундук" + "\nВы получили " + Money + " монет", true, ConsoleColor.Yellow); } else { Fight.Init(); } break; case "2": Console.Clear(); if (City.currentPlotState == City.QuestState.Accepted) { Console.WriteLine("Доступно сюжетное задание."); switch (questNum) { case 1: Console.WriteLine("Рекомендуемый уровень: 4"); break; case 2: Console.WriteLine("Рекомендуемый уровень: 7"); break; case 3: Console.WriteLine("Рекомендуемый уровень: 8"); break; } Console.WriteLine("Вы хотите начать это задание? Да - 1, Нет - 2"); if (Console.ReadLine() == "1") { PlotQuests.Quest(); } } else { Console.WriteLine("Нет доступных заданий."); } break; case "3": City.GoToCity(); break; case "4": Dungeons.Init(0); Console.Clear(); break; case "9": if (towerLoc) { Tower.Entry(); Console.Clear(); } else { goto default; } break; case "a": AchievementMenu.ShowList(); Console.Clear(); break; case "i": InventoryMenu.ShowMenu(); break; case "l": LoadProgress(false); Console.Clear(); break; case "s": SaveProgress(true); Console.Clear(); break; case "fight poison": test.Type = Monster.MType.Poisonous; goto case "fight"; case "fight explosive": test.Type = Monster.MType.Explosive; goto case "fight"; case "fight thorned": test.Type = Monster.MType.Thorned; goto case "fight"; case "fight fire": test.Type = Monster.MType.Fire; goto case "fight"; case "fight ice": test.Type = Monster.MType.Ice; goto case "fight"; case "fight dark": test.Type = Monster.MType.Dark; goto case "fight"; case "fight light": test.Type = Monster.MType.Luminous; goto case "fight"; case "fight": test.HP = 262260; test.Damage = 0; test.Name = "тестовый монстр-босс"; Fight.Init(new Monster[1] { test }, true); break; case "fight 2": Fight.Init(2); break; case "bring balance": for (int i = 0; i < Passive_Inventory.Length; i++) { if (Passive_Inventory[i].ID == 0) { Passive_Inventory[i] = new Yang_W(); break; } } for (int i = 0; i < Passive_Inventory.Length; i++) { if (Passive_Inventory[i].ID == 0) { Passive_Inventory[1] = new Ying_A(); break; } } break; case "scrooge": Console.Clear(); Player.Money += 1000000; break; case "gototavern": if (questNum == 0) { questNum = 1; } City.GoToTavern(); break; case "lvlup": LvlUp(true); break; case "gearupg": City.GearUpgrade(true); break; case "allthexp": //Дать максимальный уровень. //Кол-во опыта считается так: a*(1 + 2^0 + 2^1 + 2^2 + 2^3 + 2^4 + 2^5 ... + 2^n-3), где a - начальное кол-во опыта, n - необходимый уровень XP = 204800; LvlUp(); break; case "questscomplete": //"Выполнить" квесты Console.Clear(); questNum = 15; break; case "cheatsheet": //Список отладочных команд Console.Clear(); Console.WriteLine("scrooge - +1.000.000 монет\n" + "gototavern - пойти в таверну\n" + "lvlup - повысить уровень\n" + "gearupg - улучшить экипировку\n" + "allthexp - получить двадцатый уровень\n" + "questscomplete - выполнить все квесты (без награды)"); break; default: Console.Clear(); Console.WriteLine("Нет команды."); break; } GetRandomEvent(); }
static public void LoadProgress(bool currentSave) { int ID; int ILVL; if (!currentSave) { SaveFileMenu.isLoading = true; SaveFileHandler(); if (!File.Exists(savename)) { Console.WriteLine("Данный файл не существует. Попробуйте ещё раз."); LoadProgress(false); } } using (StreamReader sr = new StreamReader(savename)) { try { string line; line = sr.ReadLine(); City.cityBank = Convert.ToSingle(line); line = sr.ReadLine(); LVL = Convert.ToByte(line); line = sr.ReadLine(); XP = Convert.ToInt32(line); MaxXP = GetMaxXP(); line = sr.ReadLine(); HP = Convert.ToInt32(line); MaxHP = GetMaxHP(); line = sr.ReadLine(); Money = Convert.ToInt32(line); line = sr.ReadLine(); City.currentPlotState = (City.QuestState)Enum.Parse(typeof(City.QuestState), line); line = sr.ReadLine(); questNum = Convert.ToInt32(line); line = sr.ReadLine(); City.wasInCity = Convert.ToBoolean(line); line = sr.ReadLine(); MasteryPoints = Convert.ToInt32(line); line = sr.ReadLine(); towerLoc = Convert.ToBoolean(line); line = sr.ReadLine(); Tower.mageName = line; line = sr.ReadLine(); Tower.wasIntroduced = Convert.ToBoolean(line); line = sr.ReadLine(); gotAnarchy = Convert.ToBoolean(line); line = sr.ReadLine(); ahShit = Convert.ToBoolean(line); line = sr.ReadLine(); brokeOut = Convert.ToBoolean(line); line = sr.ReadLine(); BHDweller = Convert.ToBoolean(line); #region Inventory Loading (Leave for last) for (int i = 0; i < Inventory.Length + Passive_Inventory.Length; i++) { line = sr.ReadLine(); ID = Convert.ToInt16(line); // This is absolutely f*****g horrible and disgusting, but I have no other clue on how to implement this. ffs! /* * Let me explain why I have to resort to such measures: Even though I could have a list of Items from wich I could pull from in * the previous version of loading/saving the inventory, that would lead to something unpleasant: if you have Ying and have * leveled it up, then each new Ying you get will be leveled up as well. See why this is an issue? * * Basically, all I want to do is make unique examples of Items everytime the player gets one. Which is not ideal anyway. */ Item buffer; switch (ID) { case 0: buffer = new None_Item(); break; case 1: buffer = new Default_A(); break; case 2: buffer = new Ying_A(); break; case 3: buffer = new Default_W(); break; case 4: buffer = new Yang_W(); break; case 5: buffer = new PotionBag(); break; default: buffer = new None_Item(); break; } line = sr.ReadLine(); ILVL = Convert.ToInt16(line); buffer.LVL = ILVL; buffer.Upgrade(); if (i >= Inventory.Length) { Passive_Inventory[i - Inventory.Length] = buffer; } else { Inventory[i] = buffer; } } #endregion } catch { Console.WriteLine("Загружаемый файл, скорее всего, повреждён."); LoadProgress(false); } Console.WriteLine("Файл загружен"); } }