/** * Print out the opening message for the player. */ private void printWelcome() { GeneralDataLibrary.Break(); Console.WriteLine("Welcome to Dynasty!"); Console.WriteLine("You wake up with a headache looking around you seem to be in a tower of sorts."); Console.WriteLine("Type 'help' if you need help."); GeneralDataLibrary.Break(); Console.WriteLine(player.CurrentRoom.getLongDescription()); GeneralDataLibrary.Break(); GeneralDataLibrary.LongLine(); GeneralDataLibrary.Break(); }
// implementations of user commands: /** * Print out some help information. * Here we print some stupid, cryptic message and a list of the * command words. */ private void printHelp(Command command) { if (command.hasSecondWord()) { if (parser.Commands.CommandData.ContainsKey(command.getSecondWord())) { Console.Write(parser.Commands.CommandData[command.getSecondWord()]); GeneralDataLibrary.Break(2); GeneralDataLibrary.LongLine(); } } else { Console.WriteLine("Type: 'help <command>' to show more information on a command."); Console.WriteLine("Your command words are:"); GeneralDataLibrary.Break(); parser.showCommands(); GeneralDataLibrary.Break(); } }
/** * Given a command, process (that is: execute) the command. * If this command ends the game, true is returned, otherwise false is * returned. */ private bool processCommand(Command command) { bool wantToQuit = false; if (command.isUnknown()) { Console.WriteLine(GeneralDataLibrary.I() + "I don't know what you mean..."); Console.WriteLine(GeneralDataLibrary.I() + "Type: 'help' if you need help."); return(false); } string commandWord = command.getCommandWord(); GeneralDataLibrary.Break(); switch (commandWord) { case "help": printHelp(command); break; case "go": triggerCharacterAI(); GeneralDataLibrary.Break(); GeneralDataLibrary.LongLine(); GeneralDataLibrary.Break(); goRoom(command); break; case "quit": wantToQuit = true; break; case "look": lookAround(command); break; case "clear": ClearConsole(command); break; case "take": triggerCharacterAI(); GeneralDataLibrary.Break(); GeneralDataLibrary.LongLine(); GeneralDataLibrary.Break(); takeItem(command); break; case "drop": triggerCharacterAI(); GeneralDataLibrary.Break(); GeneralDataLibrary.LongLine(); GeneralDataLibrary.Break(); dropItem(command); break; case "bag": displayBag(); break; case "use": triggerCharacterAI(); GeneralDataLibrary.Break(); GeneralDataLibrary.LongLine(); GeneralDataLibrary.Break(); useItem(command); break; case "equip": triggerCharacterAI(); GeneralDataLibrary.Break(); GeneralDataLibrary.LongLine(); GeneralDataLibrary.Break(); equipItem(command); break; case "unequip": triggerCharacterAI(); GeneralDataLibrary.Break(); GeneralDataLibrary.LongLine(); GeneralDataLibrary.Break(); unequipItem(command); break; case "attack": triggerCharacterAI(); GeneralDataLibrary.Break(); GeneralDataLibrary.LongLine(); GeneralDataLibrary.Break(); attackEnemy(command); break; } GeneralDataLibrary.Break(); GeneralDataLibrary.LongLine(); GeneralDataLibrary.Break(); return(wantToQuit); }