Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Commands()
- {
- List<string> command = new List<string>();
- command.AddRange(Console.ReadLine().Split(' '));
- Console.WriteLine("\n");
- if (command.Count == 0)
- {
- Console.WriteLine("Please enter a valid command");
- }
- if (command.Count >= 1)
- {
- switch (command[0])
- {
- case "move":
- if(command.Count ==1 )
- {
- Console.WriteLine("Command: Move (direction)");
- }
- if(command.Count == 2)
- {
- if(command[1] == "n" && player.currentLocation.locToNorth != null)
- {
- moveNorth();
- command.Clear();
- }
- else if (command[1] == "s" && player.currentLocation.locToSouth != null)
- {
- moveSouth();
- command.Clear();
- }
- else if (command[1] == "w" && player.currentLocation.locToWest != null)
- {
- moveWest();
- command.Clear();
- }
- else if (command[1] == "e" && player.currentLocation.locToEast != null)
- {
- moveEast();
- command.Clear();
- }
- else
- {
- Console.WriteLine("Invalid direction. The valid directions are: ");
- GetDirections(player.currentLocation);
- }
- }
- break;
- case "attack":
- if (command.Count == 1)
- {
- Console.WriteLine("Invalid target");
- }
- else
- {
- Console.WriteLine("You attack.");
- }
- break;
- case "quaff":
- if (command.Count == 1)
- {
- Console.WriteLine("Which potion?");
- }
- else
- {
- Console.WriteLine("You potion.");
- }
- break;
- case "quit":
- {
- Console.WriteLine("You have quit.");
- Environment.Exit(0);
- break;
- }
- case "stats":
- Console.WriteLine("Health {0}/{1} Gold: {2} XP: {3} level: {4}", player.currentHp, player.maxHp, player.gold, player.xp, player.level);
- break;
- case "inventory":
- Console.WriteLine("Player Inventory\n****************");
- foreach (Item item in player.inventory)
- {
- Console.WriteLine(item.name + "\n");
- }
- break;
- case "quests":
- Console.WriteLine("Player Quests\n*************");
- break;
- case "givexp":
- if (command.Count == 1)
- {
- Console.WriteLine("givexp PLAYER XPVALUE");
- }
- else if (command.Count == 2)
- {
- Console.WriteLine("enter a valid xp ammount");
- }
- else
- {
- player.xp = Int32.Parse(command[2]);
- }
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement