diff --git a/lib/aethyr/core/input_handlers/close.rb b/lib/aethyr/core/input_handlers/close.rb index 49790b39bf016bd6549deca7ac2acdb980f1f0cf..db4c5d184c6cf80cbed07089c3d59cf8e46df22e 100644 --- a/lib/aethyr/core/input_handlers/close.rb +++ b/lib/aethyr/core/input_handlers/close.rb @@ -36,7 +36,7 @@ EOF end def initialize(player) - super(player, ["close"], help_entries: CloseHandler.create_help_entries) + super(player, ["close", "shut"], help_entries: CloseHandler.create_help_entries) end def self.object_added(data) diff --git a/lib/aethyr/core/input_handlers/date.rb b/lib/aethyr/core/input_handlers/date.rb new file mode 100644 index 0000000000000000000000000000000000000000..5656b572d845a723c0fc04422911a2e730ec0629 --- /dev/null +++ b/lib/aethyr/core/input_handlers/date.rb @@ -0,0 +1,50 @@ +require "aethyr/core/actions/commands/date" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Date + class DateHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "date" + see_also = nil + syntax_formats = ["DATE"] + aliases = nil + content = <<'EOF' +Date + +Shows the current date in Aethyr. + +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, ["date"], help_entries: DateHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^date$/i + $manager.submit_action(Aethyr::Core::Actions::Date::DateCommand.new(@player, {})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(DateHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/feel.rb b/lib/aethyr/core/input_handlers/feel.rb new file mode 100644 index 0000000000000000000000000000000000000000..848220a65d9eb56943e65a9fc1dc6d16ca2a3af1 --- /dev/null +++ b/lib/aethyr/core/input_handlers/feel.rb @@ -0,0 +1,48 @@ +require "aethyr/core/actions/commands/feel" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Feel + class FeelHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "feel" + see_also = nil + syntax_formats = ["FEEL [target]"] + aliases = nil + content = <<'EOF' +Feel the specified target. + +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, ['feel'], help_entries: FeelHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^(feel)(\s+(.+))?$/i + $manager.submit_action(Aethyr::Core::Actions::Feel::FeelCommand.new(@player, { :target => $3})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(FeelHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/fill.rb b/lib/aethyr/core/input_handlers/fill.rb new file mode 100644 index 0000000000000000000000000000000000000000..c160125c8ce13d0e2bce551bd6f1756b3c2b24b3 --- /dev/null +++ b/lib/aethyr/core/input_handlers/fill.rb @@ -0,0 +1,48 @@ +require "aethyr/core/actions/commands/fill" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Fill + class FillHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "fill" + see_also = nil + syntax_formats = ["FILL [container] FROM [source]"] + aliases = nil + content = <<'EOF' +Fill a container from a source + +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, ["fill"], help_entries: FillHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^fill\s+(\w+)\s+from\s+(\w+)$/i + $manager.submit_action(Aethyr::Core::Actions::Fill::FillCommand.new(@player, { :object => $1, :from => $2})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(FillHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/generic.rb b/lib/aethyr/core/input_handlers/generic.rb deleted file mode 100644 index 1f7be289396775d5481c8e991a2cd1a975c097a0..0000000000000000000000000000000000000000 --- a/lib/aethyr/core/input_handlers/generic.rb +++ /dev/null @@ -1,230 +0,0 @@ -require "aethyr/core/actions/commands/feel" -require "aethyr/core/actions/commands/listen" -require "aethyr/core/actions/commands/smell" -require "aethyr/core/actions/commands/taste" -require "aethyr/core/actions/commands/write" -require "aethyr/core/actions/commands/who" -require "aethyr/core/actions/commands/date" -require "aethyr/core/actions/commands/time" -require "aethyr/core/actions/commands/fill" -require "aethyr/core/actions/commands/status" -require "aethyr/core/actions/commands/satiety" -require "aethyr/core/actions/commands/health" -require 'aethyr/core/issues' -require "aethyr/core/registry" -require "aethyr/core/input_handlers/command_handler" - -module Aethyr - module Core - module Commands - module Generic - class GenericHandler < Aethyr::Extend::CommandHandler - - def self.create_help_entries - help_entries = [] - - - - - command = "satiety" - see_also = ["STAT", "HEALTH"] - syntax_formats = ["HUNGER", "SATIETY"] - aliases = nil - content = <<'EOF' -Shows you how hungry you are. - -You can be: - completely stuffed - full and happy - full and happy - satisfied - not hungry - slightly hungry - slightly hungry - peckish - hungry - very hungry - famished - starving - literally dying of hunger - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) - - - - command = "status" - see_also = ["INVENTORY", "HUNGER", "HEALTH"] - syntax_formats = ["STATUS", "STAT", "ST"] - aliases = nil - content = <<'EOF' -Shows your current health, hunger/satiety, and position. - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) - - - - command = "fill" - see_also = nil - syntax_formats = ["FILL [container] FROM [source]"] - aliases = nil - content = <<'EOF' -Fill a container from a source - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) - - - - command = "date_time" - see_also = nil - syntax_formats = ["DATE"] - aliases = nil - content = <<'EOF' -Date and Time - - TIME - -Shows the current date and time in Aethyr. Not completely done yet, but it is a first step. - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) - - - - command = "who" - see_also = nil - syntax_formats = ["WHO"] - aliases = nil - content = <<'EOF' -This will list everyone else who is currently in Aethyr and where they happen to be at the moment. - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) - - - - - - - command = "write" - see_also = nil - syntax_formats = ["WRITE [target]"] - aliases = nil - content = <<'EOF' -Write something on the specified target. - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) - - - - command = "taste" - see_also = nil - syntax_formats = ["TASTE [target]"] - aliases = nil - content = <<'EOF' -Taste the specified target. - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) - - - - command = "smell" - see_also = nil - syntax_formats = ["SMELL [target]"] - aliases = nil - content = <<'EOF' -Smell the specified target. - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) - - - - command = "listen" - see_also = nil - syntax_formats = ["LISTEN [target]"] - aliases = nil - content = <<'EOF' -Listen to the specified target. - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) - - - - command = "feel" - see_also = nil - syntax_formats = ["FEEL [target]"] - aliases = nil - content = <<'EOF' -Feel the specified target. - -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, ['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) - super(data, self) - end - - def player_input(data) - super(data) - case data[:input] - when /^(satiety|hunger)$/i - $manager.submit_action(Aethyr::Core::Actions::Satiety::SatietyCommand.new(@player, {})) - when /^(st|stat|status)$/i - $manager.submit_action(Aethyr::Core::Actions::Status::StatusCommand.new(@player, {})) - when /^write\s+(.*)/i - $manager.submit_action(Aethyr::Core::Actions::Write::WriteCommand.new(@player, { :target => $1.strip})) - when /^(listen)(\s+(.+))?$/i - $manager.submit_action(Aethyr::Core::Actions::Listen::ListenCommand.new(@player, { :target => $3})) - when /^(smell|sniff)(\s+(.+))?$/i - $manager.submit_action(Aethyr::Core::Actions::Smell::SmellCommand.new(@player, { :target => $3})) - when /^(taste|lick)(\s+(.+))?$/i - $manager.submit_action(Aethyr::Core::Actions::Taste::TasteCommand.new(@player, { :target => $3})) - when /^(feel)(\s+(.+))?$/i - $manager.submit_action(Aethyr::Core::Actions::Feel::FeelCommand.new(@player, { :target => $3})) - when /^fill\s+(\w+)\s+from\s+(\w+)$/i - $manager.submit_action(Aethyr::Core::Actions::Fill::FillCommand.new(@player, { :object => $1, :from => $2})) - when /^who$/i - $manager.submit_action(Aethyr::Core::Actions::Who::WhoCommand.new(@player, {})) - when /^time$/i - $manager.submit_action(Aethyr::Core::Actions::Time::TimeCommand.new(@player, {})) - when /^date$/i - $manager.submit_action(Aethyr::Core::Actions::Date::DateCommand.new(@player, {})) - end - end - - private - #Display health. - - - - - - - - - - - - - - end - - Aethyr::Extend::HandlerRegistry.register_handler(GenericHandler) - end - end - end -end diff --git a/lib/aethyr/core/input_handlers/listen.rb b/lib/aethyr/core/input_handlers/listen.rb new file mode 100644 index 0000000000000000000000000000000000000000..cc204ec72a19e5fa881da7265d74274ac8d2d5ea --- /dev/null +++ b/lib/aethyr/core/input_handlers/listen.rb @@ -0,0 +1,48 @@ +require "aethyr/core/actions/commands/listen" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Listen + class ListenHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "listen" + see_also = nil + syntax_formats = ["LISTEN [target]"] + aliases = nil + content = <<'EOF' +Listen to the specified target. + +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, ["listen"], help_entries: ListenHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^(listen)(\s+(.+))?$/i + $manager.submit_action(Aethyr::Core::Actions::Listen::ListenCommand.new(@player, { :target => $3})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(ListenHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/satiety.rb b/lib/aethyr/core/input_handlers/satiety.rb new file mode 100644 index 0000000000000000000000000000000000000000..d65b2c9ed27306b7360754d6f30107b7170e1fad --- /dev/null +++ b/lib/aethyr/core/input_handlers/satiety.rb @@ -0,0 +1,64 @@ + +require "aethyr/core/actions/commands/satiety" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Satiety + class SatietyHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "satiety" + see_also = ["STAT", "HEALTH"] + syntax_formats = ["HUNGER", "SATIETY"] + aliases = ["hunger"] + content = <<'EOF' +Shows you how hungry you are. + +You can be: + completely stuffed + full and happy + full and happy + satisfied + not hungry + slightly hungry + slightly hungry + peckish + hungry + very hungry + famished + starving + literally dying of hunger + +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, ["hunger", "satiety"], help_entries: SatietyHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^(satiety|hunger)$/i + $manager.submit_action(Aethyr::Core::Actions::Satiety::SatietyCommand.new(@player, {})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(SatietyHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/smell.rb b/lib/aethyr/core/input_handlers/smell.rb new file mode 100644 index 0000000000000000000000000000000000000000..029961d286726a50db66f1bdc6132dd00adad77e --- /dev/null +++ b/lib/aethyr/core/input_handlers/smell.rb @@ -0,0 +1,48 @@ +require "aethyr/core/actions/commands/smell" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Smell + class SmellHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "smell" + see_also = nil + syntax_formats = ["SMELL [target]"] + aliases = ["sniff"] + content = <<'EOF' +Smell the specified target. + +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, ["smell", "sniff"], help_entries: SmellHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^(smell|sniff)(\s+(.+))?$/i + $manager.submit_action(Aethyr::Core::Actions::Smell::SmellCommand.new(@player, { :target => $3})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(SmellHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/status.rb b/lib/aethyr/core/input_handlers/status.rb new file mode 100644 index 0000000000000000000000000000000000000000..5ec4ba541ade38f4b30f64bcfc435688fe47fda6 --- /dev/null +++ b/lib/aethyr/core/input_handlers/status.rb @@ -0,0 +1,48 @@ +require "aethyr/core/actions/commands/status" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Status + class StatusHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "status" + see_also = ["INVENTORY", "HUNGER", "HEALTH"] + syntax_formats = ["STATUS", "STAT", "ST"] + aliases = nil + content = <<'EOF' +Shows your current health, hunger/satiety, and position. + +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, ["st", "stat", "status"], help_entries: StatusHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^(st|stat|status)$/i + $manager.submit_action(Aethyr::Core::Actions::Status::StatusCommand.new(@player, {})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(StatusHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/taste.rb b/lib/aethyr/core/input_handlers/taste.rb new file mode 100644 index 0000000000000000000000000000000000000000..f02037cb2bc2a24456bf3363bfbbe7414b512cf6 --- /dev/null +++ b/lib/aethyr/core/input_handlers/taste.rb @@ -0,0 +1,48 @@ +require "aethyr/core/actions/commands/taste" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Taste + class TasteHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "taste" + see_also = nil + syntax_formats = ["TASTE [target]"] + aliases = ["lick"] + content = <<'EOF' +Taste the specified target. + +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, ["lick", "taste"], help_entries: TasteHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^(taste|lick)(\s+(.+))?$/i + $manager.submit_action(Aethyr::Core::Actions::Taste::TasteCommand.new(@player, { :target => $3})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(TasteHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/time.rb b/lib/aethyr/core/input_handlers/time.rb new file mode 100644 index 0000000000000000000000000000000000000000..a64ef741b886145a533c4e2e5c1c761c9546fbed --- /dev/null +++ b/lib/aethyr/core/input_handlers/time.rb @@ -0,0 +1,50 @@ +require "aethyr/core/actions/commands/time" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Time + class TimeHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "time" + see_also = nil + syntax_formats = ["TIME"] + aliases = nil + content = <<'EOF' +Time + +Shows the current time in Aethyr. + +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, ["time"], help_entries: TimeHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^time$/i + $manager.submit_action(Aethyr::Core::Actions::Time::TimeCommand.new(@player, {})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(TimeHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/who.rb b/lib/aethyr/core/input_handlers/who.rb new file mode 100644 index 0000000000000000000000000000000000000000..e7e028f2f7e3a620c98a00869d50297542284c64 --- /dev/null +++ b/lib/aethyr/core/input_handlers/who.rb @@ -0,0 +1,48 @@ +require "aethyr/core/actions/commands/who" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Who + class WhoHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "who" + see_also = nil + syntax_formats = ["WHO"] + aliases = nil + content = <<'EOF' +This will list everyone else who is currently in Aethyr and where they happen to be at the moment. + +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, ["who"], help_entries: WhoHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^who$/i + $manager.submit_action(Aethyr::Core::Actions::Who::WhoCommand.new(@player, {})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(WhoHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/write.rb b/lib/aethyr/core/input_handlers/write.rb new file mode 100644 index 0000000000000000000000000000000000000000..afde91db10cce4ed5862e4102495d077eb7aa249 --- /dev/null +++ b/lib/aethyr/core/input_handlers/write.rb @@ -0,0 +1,47 @@ +require "aethyr/core/actions/commands/write" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Write + class WriteHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + command = "write" + see_also = nil + syntax_formats = ["WRITE [target]"] + aliases = nil + content = <<'EOF' +Write something on the specified target. + +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, ["write"], help_entries: WriteHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^write\s+(.*)/i + $manager.submit_action(Aethyr::Core::Actions::Write::WriteCommand.new(@player, { :target => $1.strip})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(WriteHandler) + end + end + end +end