public void ShowStatistics() { Console.Clear(); Util.Write("Helmet: "); Helmet.Info(); Util.Write("Armor: "); Armor.Info(); Util.Write("Legs: "); Legs.Info(); Util.Write("Boots: "); Boots.Info(); Util.Write("Weapon: "); Weapon.Info(); Util.Write("\nExperience", ConsoleColor.DarkRed); Util.Write(": "); Util.Write(Experience + " ", ConsoleColor.DarkRed); Util.Write("/ "); Util.WriteLine(ExperienceToLevel(level) + "", ConsoleColor.DarkRed); Util.Write("Level", ConsoleColor.DarkRed); Util.Write(": "); Util.WriteLine(Level + "\n", ConsoleColor.DarkRed); Util.Write("Gold", ConsoleColor.DarkYellow); Util.Write(": "); Util.WriteLine(Gold + "\n", ConsoleColor.DarkYellow); Util.Write("Health", ConsoleColor.Red); Util.Write(": "); Util.Write(Health + "", ConsoleColor.Red); Util.Write(" / "); Util.WriteLine(MaxHealth + "", ConsoleColor.Red); Util.Write("Damage", ConsoleColor.Magenta); Util.Write(": "); Util.Write(Damage.Item1 + "", ConsoleColor.Magenta); Util.Write(" - "); Util.WriteLine(Damage.Item2 + "", ConsoleColor.Magenta); Util.Write("Defense", ConsoleColor.DarkMagenta); Util.Write(": "); Util.WriteLine(Defense + "\n", ConsoleColor.DarkMagenta); Util.Write("Ability points", ConsoleColor.Cyan); Util.Write(": "); Util.Write(Ap + "", ConsoleColor.Cyan); Util.Write(" / "); Util.WriteLine((Level * ApPerLevel) + "\n", ConsoleColor.Cyan); Console.ReadKey(); }
public void EquipItem(Type type) { Item item = null; if (type == Helmet.GetType()) { item = Helmet; } else if (type == Armor.GetType()) { item = Armor; } else if (type == Legs.GetType()) { item = Legs; } else if (type == Boots.GetType()) { item = Boots; } else if (type == Weapon.GetType()) { item = Weapon; } else { return; } int site = 0; int maxSite = (ItemStash.Count - 1) / 7; while (true) { List <Item> items = itemStash.Where(x => x.GetType() == type).OrderByDescending(x => x.Level).ToList(); maxSite = (items.Count - 1) / 7; if (site > maxSite) { site = maxSite; } if (items.Count == 0) { Util.Write("\nYou don't have any "); Util.Write(type.Name.ToString() + " ", ConsoleColor.DarkGray); Util.Write("in your stash"); } Console.Clear(); Util.Write("Level", ConsoleColor.DarkRed); Util.Write(": "); Util.WriteLine(Level + "", ConsoleColor.DarkRed); Util.Write(type.Name.ToString() + ": "); item.Info(false); Util.Write("\n\nItem ", ConsoleColor.DarkGray); Util.WriteLine("stash: " + (site + 1) + " / " + (maxSite + 1)); for (int i = 0; i < 7; ++i) { if (items.Count <= i + (site * 7)) { break; } Util.Write((i + 1) + " "); items[i + (site * 7)].Info(); } if (site > 0) { Util.WriteLine("8. Previous site"); } if (site < maxSite) { Util.WriteLine("9. Next site"); } Util.WriteLine("\n0. Exit"); int decision = Util.NumpadKeyToInt(Console.ReadKey()); if (decision == 0) { break; } else if (site > 0 && decision == 8) { site -= 1; } else if (site < maxSite && decision == 9) { site += 1; } else if (decision > 0 && decision < 8) { if (decision + (site * 7) < items.Count + 1) { if (level >= items[decision - 1 + (site * 7)].Level) { itemStash.Remove(items[decision - 1 + (site * 7)]); if (!item.IsBase) { itemStash.Add(item); } item = items[decision - 1 + (site * 7)]; Console.Clear(); Util.Write("You've equiped "); Util.WriteLine(item.Name, ConsoleColor.DarkGray); Console.ReadKey(); } else { Console.Clear(); Util.Write("Your "); Util.Write("level ", ConsoleColor.DarkRed); Util.WriteLine("is too low"); Console.ReadKey(); } } } if (item is Helmet helmet) { Helmet = helmet; } else if (item is Armor armor) { Armor = armor; } else if (item is Legs legs) { Legs = legs; } else if (item is Boots boots) { Boots = boots; } else if (item is Weapon weapon) { Weapon = weapon; } CalculateStats(); } }