public Game() { /* LOADING */ Items.Init(); // Load items data Maps.Init(); // Load map data /*Monsters.Init(); // Load monster data*/ System.Threading.Thread.Sleep(500); // Sleep Console.Clear(); Console.Title = Config.GameName; Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Welcome to {0}", Config.GameName); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(); _p = Player.CreatePlayer(_p); Console.Clear(); Console.Beep(); // BEEP BEEP BEEP Console.Beep(); Console.Beep(); this.Start(Config.Handle.Start); // Loop till exit }
public Inventory(Player p) { this._player = p; }
public Equipment(Player p) { this._player = p; }
public static Config.Handle Handle(Player p, string[] command) { switch (command[0]) // Command Handler { case "move": if (Commands.Move(p, command) == 0) { Console.WriteLine("This way is blocked, try going another way."); return Config.Handle.Suppress; } break; case "use": case "switch": case "pull": // need to add levers and other stuff to pull in the map xml break; case "clear": Commands.Clear(); break; case "take": case "grab": int slot; if (int.TryParse(command[1], out slot)) if (!Commands.Take(p, slot)) if (p.Map.HasChest) Console.WriteLine("Your inventory is full"); else Console.WriteLine("No chests in this room"); break; case "drop": // DROP DA BASS!! break; case "open": if (Commands.Open(p)) return Config.Handle.Suppress; break; case "stats": Commands.Stats(p); break; case "inv": case "inventory": case "showinventory": case "showinv": case "i": Commands.ShowInventory(p); break; case "equipment": Commands.ShowEquipment(p); break; /*case "equip": slot = ReadSlot(); Commands.EquipItem(p, slot); break;*/ case "exit": Console.WriteLine("Are you sure you want to exit? (Y/N)"); if (char.ToUpper(Console.ReadLine()[0]) == 'Y') return Config.Handle.Exit; // Lets exit break; case "look": case "observe": case "examine": Console.WriteLine("YOUR MOM IN A PITA"); // PRINTS LOCATION MASSAGE - MAYBE SOME ROOMS WILL HAVE DEEPER EXAMINE MSG // ADD SPOT SKILL THAT IF YOU HAVE ENOUGH YOU CAN SEE MORE STUFF IN A ROOM break; default: // HELP Commands.Help(); break; } return Config.Handle.Start; // LOOP }
public static bool Take(Player p, int slot) { if (!p.Map.HasChest || p.Inv.Full) return false; Chest chest = p.Map.Chest; Item i = chest.ItemAt(slot); if (i != null) { p.Inv.Give(i); chest.Remove(slot); return true; } return false; }
public static void Stats(Player p) { p.Stats.Print(); }
public static void ShowInventory(Player p) { p.Inv.Print(); }
public static void ShowEquipment(Player p) { p.Equip.Print(); }
/*public static string EquipItem(Player p, int slot) { if (slot == 1212) { Console.WriteLine("This slot is empty."); } Config.ItemType t = (Config.ItemType)Enum.Parse(typeof(Config.ItemType), ); string type = Config.ItemType. return ; }*/ public static bool Open(Player p) { Map map = p.Map; if (map.HasChest) Console.WriteLine(map.Chest.ToString()); return (map.HasChest); }
public static int Move(Player p, string[] cmd) { char where; if (cmd.Length > 1) where = (char)cmd[1].First(); else where = '?'; int mapTo = p.Location; switch (where) { case 'w': mapTo--; break; case 'e': mapTo++; break; case 'n': mapTo -= 10; break; case 's': mapTo += 10; break; default: Console.WriteLine("Type: move n/e/s/w"); return -1; } return (p.ChangeMap(mapTo) == true) ? 1 : 0; }
public static Player CreatePlayer(Player p) { string name = ReadName(); Console.WriteLine(); System.Threading.Thread.Sleep(200); // Sleep Console.WriteLine("Hello {0}, what race were you born into?", name); string race = ReadRace(name); System.Threading.Thread.Sleep(200); // Sleep Console.WriteLine("Hello {0} the {1}, what class are you trained as?", name, race); string _class = ReadClass(name); return new Player(name, race, _class); // Create player }