diff --git a/lib/aethyr/core/commands/get.rb b/lib/aethyr/core/commands/get.rb index 16dcf04c178d4e9057c9aa4df85dc68defe44144..acf7b7cc457351496ca9101bb10b6f000e4e9145 100644 --- a/lib/aethyr/core/commands/get.rb +++ b/lib/aethyr/core/commands/get.rb @@ -12,7 +12,7 @@ module Aethyr command = "get" see_also = ["GIVE"] - syntax_formats = ["GET [object]", "GRAB [object'", "TAKE [object]"] + syntax_formats = ["GET [object]", "GRAB [object]", "TAKE [object]"] aliases = ["grab", "take"] content = <<'EOF' Pick up an object and put it in your inventory. @@ -27,7 +27,7 @@ EOF def initialize(player) super(player, ["get", "grab", "take"], help_entries: GetHandler.create_help_entries) end - + def self.object_added(data) super(data, self) end @@ -41,9 +41,9 @@ EOF action({ :object => $2.strip }) end end - + private - + #Gets (or takes) an object and puts it in the player's inventory. def action(event) room = $manager.get_object(@player.container) @@ -111,4 +111,4 @@ EOF end end end -end \ No newline at end of file +end diff --git a/lib/aethyr/core/commands/help.rb b/lib/aethyr/core/commands/help.rb index 441fb5722441aed3efb4515468747de1f09e4fcd..345199785adeaa0ffb36fa5b7582d37d94924b06 100644 --- a/lib/aethyr/core/commands/help.rb +++ b/lib/aethyr/core/commands/help.rb @@ -17,8 +17,10 @@ module Aethyr def player_input(data) super(data) case data[:input] - when /^(help|help topics)$/i - self.player.output("Help topics available: " + player.help_library.topics.join(", "), false) + when /^(help)$/i + self.player.output("\nHelp topics available: " + self.player.help_library.topics.join(", ") + "\n", false) + when /^help (.*)$/i + self.player.output("\n" + self.player.help_library.render_topic($1) + "\n", false) end end end diff --git a/lib/aethyr/core/help/help_entry.rb b/lib/aethyr/core/help/help_entry.rb index bcc78c863a69553826dceae2f121da41f81d2e44..f4ba2b9f6dc919dfae40a4718afc7ae5be1b7a8b 100644 --- a/lib/aethyr/core/help/help_entry.rb +++ b/lib/aethyr/core/help/help_entry.rb @@ -2,7 +2,7 @@ module Aethyr module Core module Help class HelpEntry - attr_reader :topic, :redirect, :content, :see_also, :aliases + attr_reader :topic, :redirect, :content, :see_also, :aliases, :syntax_formats def initialize(topic, redirect: nil, content: nil, see_also: nil, aliases: nil, syntax_formats: nil) #do some validity checking on the arguments diff --git a/lib/aethyr/core/help/help_library.rb b/lib/aethyr/core/help/help_library.rb index 11009a2b79a1c2edfedd2f4cf043852477b173a8..e09f115876b84e64439ab6fa33fa1a563e2ab697 100644 --- a/lib/aethyr/core/help/help_library.rb +++ b/lib/aethyr/core/help/help_library.rb @@ -37,18 +37,18 @@ module Aethyr rendered = redirected_from - rendered += "Aliases: " + entry.aliases.join(", ") + "\n" unless aliases.empty? + rendered += "Aliases: " + entry.aliases.join(", ") + "\n" unless entry.aliases.empty? syntaxes = [] - entry.syntax_formates.each do |syntax| + entry.syntax_formats.each do |syntax| syntaxes.push "Syntax: #{syntax}" end rendered += syntaxes.join("\n") - rendered += "\n" unless syntaxes.empty? && aliases.empty? + rendered += "\n\n" unless syntaxes.empty? && aliases.empty? rendered += entry.content + "\n" - rendered += "See also: " + emtry.see_also.join(", ") + "\n" unless see_also.empty? + rendered += "See also: " + entry.see_also.join(", ") + "\n" unless entry.see_also.empty? return rendered end