| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package cz.davza.studentadventure.commands;
- import cz.davza.studentadventure.annotations.CommandKeyword;
- import cz.davza.studentadventure.base.CommandBase;
- import cz.davza.studentadventure.objects.CommandResult;
- import cz.davza.studentadventure.objects.GameData;
- /**
- * Displays the full command reference for the game.
- *
- * <p>Usage: {@code help}</p>
- *
- * <p>Prints a static list of every command keyword and a short description of
- * what it does. Available in all rooms. No parameters are required.</p>
- */
- @CommandKeyword("help")
- public class HelpCommand extends CommandBase {
- /**
- * {@inheritDoc}
- * Returns the full command reference as a formatted string.
- */
- @Override
- public CommandResult Execute(GameData context) {
- return CommandResult.success(printHelp());
- }
- /**
- * Builds and returns the command reference text.
- *
- * @return a multi-line string listing all available commands and their usage
- */
- private String printHelp() {
- return """
- === COMMANDS ===
- walk <exit> - Move to another room
- pickup <item> <n> - Pick up n of an item
- drop <slot> - Drop item from inventory slot
- interact <item> - Interact with an item
- study <hours> - Study for n hours
- sleep - Sleep (bedroom and classroom only)
- steal - Steal money (study room only)
- buy <item> - Buy an item (shop only)
- consume <slot> - Consume an item from inventory
- takeexam - Take the final exam (exam room only)
- inventory - Show your inventory
- stats - Show your stats
- time - Show current game time
- describe - Describe the current scene
- quit - Give up
- studentId - Tells you your student ID (computer only)
- availablecommands - Tells you your currently available commands
- """;
- }
- }
|