diff --git a/lib/aethyr/core/input_handlers/generic.rb b/lib/aethyr/core/input_handlers/generic.rb index 43873bceb190ddd3bd9d13a5a6d36e957a686caa..1f7be289396775d5481c8e991a2cd1a975c097a0 100644 --- a/lib/aethyr/core/input_handlers/generic.rb +++ b/lib/aethyr/core/input_handlers/generic.rb @@ -23,28 +23,6 @@ module Aethyr def self.create_help_entries help_entries = [] - command = "health" - see_also = ["STATUS", "HUNGER"] - syntax_formats = ["HEALTH"] - aliases = nil - content = <<'EOF' -Shows you how healthy you are. - -You can be: - at full health - a bit bruised - a little beat up - slightly injured - quite injured - slightly wounded - wounded in several places - heavily wounded - bleeding profusely and in serious pain - nearly dead - dead - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) @@ -193,7 +171,7 @@ EOF def initialize(player) - super(player, ['date', 'feel', 'taste', 'smell', 'sniff', 'lick', 'listen', 'health', 'hunger', 'satiety', 'shut', 'status', 'stat', 'st', 'time', 'typo', 'who', 'write'], help_entries: GenericHandler.create_help_entries) + super(player, ['date', 'feel', 'taste', 'smell', 'sniff', 'lick', 'listen', 'hunger', 'satiety', 'shut', 'status', 'stat', 'st', 'time', 'typo', 'who', 'write'], help_entries: GenericHandler.create_help_entries) end def self.object_added(data) @@ -203,8 +181,6 @@ EOF def player_input(data) super(data) case data[:input] - when /^(health)$/i - $manager.submit_action(Aethyr::Core::Actions::Health::HealthCommand.new(@player, {})) when /^(satiety|hunger)$/i $manager.submit_action(Aethyr::Core::Actions::Satiety::SatietyCommand.new(@player, {})) when /^(st|stat|status)$/i diff --git a/lib/aethyr/core/input_handlers/health.rb b/lib/aethyr/core/input_handlers/health.rb new file mode 100644 index 0000000000000000000000000000000000000000..fc34dd1848b1ad9ba2ef8a8d4bc9e985de181859 --- /dev/null +++ b/lib/aethyr/core/input_handlers/health.rb @@ -0,0 +1,61 @@ +require "aethyr/core/actions/commands/health" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Health + class HealthHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "health" + see_also = ["STATUS", "HUNGER"] + syntax_formats = ["HEALTH"] + aliases = nil + content = <<'EOF' +Shows you how healthy you are. + +You can be: + at full health + a bit bruised + a little beat up + slightly injured + quite injured + slightly wounded + wounded in several places + heavily wounded + bleeding profusely and in serious pain + nearly dead + dead + +EOF + help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) + + return help_entries + end + + + def initialize(player) + super(player, ["health"], help_entries: HealthHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^(health)$/i + $manager.submit_action(Aethyr::Core::Actions::Health::HealthCommand.new(@player, {})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(HealthHandler) + end + end + end +end