From b9861086e353e93e87df58dd96394395b3d1868f Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me> Date: Sun, 8 Aug 2021 18:05:37 -0400 Subject: [PATCH] Refactored actor to agent --- lib/aethyr/core/actions/commands/acarea.rb | 8 +-- lib/aethyr/core/actions/commands/acdoor.rb | 24 +++---- lib/aethyr/core/actions/commands/acomment.rb | 14 ++--- lib/aethyr/core/actions/commands/aconfig.rb | 12 ++-- lib/aethyr/core/actions/commands/acportal.rb | 10 +-- lib/aethyr/core/actions/commands/acreate.rb | 20 +++--- lib/aethyr/core/actions/commands/acroom.rb | 24 +++---- lib/aethyr/core/actions/commands/adelete.rb | 20 +++--- lib/aethyr/core/actions/commands/adesc.rb | 20 +++--- lib/aethyr/core/actions/commands/aforce.rb | 10 +-- lib/aethyr/core/actions/commands/ahelp.rb | 6 +- lib/aethyr/core/actions/commands/ahide.rb | 12 ++-- lib/aethyr/core/actions/commands/ainfo.rb | 36 +++++------ lib/aethyr/core/actions/commands/alearn.rb | 6 +- lib/aethyr/core/actions/commands/alist.rb | 10 +-- lib/aethyr/core/actions/commands/all.rb | 6 +- lib/aethyr/core/actions/commands/alog.rb | 22 +++---- lib/aethyr/core/actions/commands/alook.rb | 14 ++--- lib/aethyr/core/actions/commands/aput.rb | 32 +++++----- lib/aethyr/core/actions/commands/areaction.rb | 36 +++++------ lib/aethyr/core/actions/commands/areas.rb | 6 +- lib/aethyr/core/actions/commands/areload.rb | 12 ++-- lib/aethyr/core/actions/commands/asave.rb | 6 +- lib/aethyr/core/actions/commands/aset.rb | 34 +++++----- lib/aethyr/core/actions/commands/astatus.rb | 6 +- lib/aethyr/core/actions/commands/ateach.rb | 8 +-- lib/aethyr/core/actions/commands/awatch.rb | 10 +-- lib/aethyr/core/actions/commands/awho.rb | 6 +- lib/aethyr/core/actions/commands/close.rb | 12 ++-- .../core/actions/commands/command_action.rb | 5 +- lib/aethyr/core/actions/commands/date.rb | 4 +- .../core/actions/commands/delete_player.rb | 6 +- .../core/actions/commands/delete_post.rb | 12 ++-- lib/aethyr/core/actions/commands/deleteme.rb | 24 +++---- lib/aethyr/core/actions/commands/drop.rb | 20 +++--- .../core/actions/commands/emotes/agree.rb | 12 ++-- .../core/actions/commands/emotes/back.rb | 6 +- .../core/actions/commands/emotes/blush.rb | 14 ++--- .../core/actions/commands/emotes/bow.rb | 10 +-- .../core/actions/commands/emotes/brb.rb | 6 +- .../core/actions/commands/emotes/bye.rb | 6 +- .../core/actions/commands/emotes/cheer.rb | 6 +- .../core/actions/commands/emotes/cry.rb | 6 +- .../core/actions/commands/emotes/curtsey.rb | 10 +-- lib/aethyr/core/actions/commands/emotes/eh.rb | 6 +- .../core/actions/commands/emotes/emote.rb | 14 ++--- .../actions/commands/emotes/emote_action.rb | 38 +++++------ lib/aethyr/core/actions/commands/emotes/er.rb | 6 +- lib/aethyr/core/actions/commands/emotes/ew.rb | 6 +- .../core/actions/commands/emotes/frown.rb | 14 ++--- .../core/actions/commands/emotes/grin.rb | 14 ++--- lib/aethyr/core/actions/commands/emotes/hi.rb | 6 +- lib/aethyr/core/actions/commands/emotes/hm.rb | 6 +- .../core/actions/commands/emotes/hug.rb | 10 +-- .../core/actions/commands/emotes/huh.rb | 6 +- .../core/actions/commands/emotes/laugh.rb | 6 +- lib/aethyr/core/actions/commands/emotes/no.rb | 10 +-- .../core/actions/commands/emotes/nod.rb | 12 ++-- .../core/actions/commands/emotes/pet.rb | 10 +-- .../core/actions/commands/emotes/poke.rb | 12 ++-- .../core/actions/commands/emotes/ponder.rb | 12 ++-- .../core/actions/commands/emotes/shrug.rb | 12 ++-- .../core/actions/commands/emotes/sigh.rb | 6 +- .../core/actions/commands/emotes/skip.rb | 6 +- .../core/actions/commands/emotes/smile.rb | 6 +- .../core/actions/commands/emotes/snicker.rb | 6 +- lib/aethyr/core/actions/commands/emotes/uh.rb | 6 +- .../core/actions/commands/emotes/wave.rb | 6 +- .../core/actions/commands/emotes/yawn.rb | 10 +-- .../core/actions/commands/emotes/yes.rb | 10 +-- lib/aethyr/core/actions/commands/feel.rb | 24 +++---- lib/aethyr/core/actions/commands/fill.rb | 22 +++---- lib/aethyr/core/actions/commands/gait.rb | 14 ++--- lib/aethyr/core/actions/commands/get.rb | 50 +++++++-------- lib/aethyr/core/actions/commands/give.rb | 22 +++---- lib/aethyr/core/actions/commands/health.rb | 4 +- lib/aethyr/core/actions/commands/inventory.rb | 2 +- lib/aethyr/core/actions/commands/issue.rb | 46 +++++++------- lib/aethyr/core/actions/commands/kick.rb | 24 +++---- .../core/actions/commands/latest_news.rb | 10 +-- .../core/actions/commands/list_unread.rb | 6 +- lib/aethyr/core/actions/commands/listen.rb | 34 +++++----- lib/aethyr/core/actions/commands/lock.rb | 32 +++++----- lib/aethyr/core/actions/commands/look.rb | 58 ++++++++--------- lib/aethyr/core/actions/commands/map.rb | 6 +- lib/aethyr/core/actions/commands/more.rb | 2 +- lib/aethyr/core/actions/commands/move.rb | 27 ++++---- lib/aethyr/core/actions/commands/open.rb | 6 +- lib/aethyr/core/actions/commands/portal.rb | 14 ++--- lib/aethyr/core/actions/commands/pose.rb | 12 ++-- lib/aethyr/core/actions/commands/punch.rb | 24 +++---- lib/aethyr/core/actions/commands/put.rb | 26 ++++---- lib/aethyr/core/actions/commands/quit.rb | 4 +- lib/aethyr/core/actions/commands/read_post.rb | 10 +-- lib/aethyr/core/actions/commands/remove.rb | 16 ++--- lib/aethyr/core/actions/commands/reply.rb | 8 +-- lib/aethyr/core/actions/commands/restart.rb | 6 +- lib/aethyr/core/actions/commands/satiety.rb | 4 +- lib/aethyr/core/actions/commands/say.rb | 63 +++++++++---------- lib/aethyr/core/actions/commands/set.rb | 18 +++--- lib/aethyr/core/actions/commands/setcolor.rb | 14 ++--- .../core/actions/commands/setpassword.rb | 14 ++--- .../core/actions/commands/showcolors.rb | 6 +- .../core/actions/commands/simple_block.rb | 24 +++---- .../core/actions/commands/simple_dodge.rb | 24 +++---- lib/aethyr/core/actions/commands/sit.rb | 28 ++++----- lib/aethyr/core/actions/commands/skills.rb | 10 +-- lib/aethyr/core/actions/commands/slash.rb | 26 ++++---- lib/aethyr/core/actions/commands/smell.rb | 42 ++++++------- lib/aethyr/core/actions/commands/stand.rb | 12 ++-- lib/aethyr/core/actions/commands/status.rb | 8 +-- lib/aethyr/core/actions/commands/taste.rb | 24 +++---- lib/aethyr/core/actions/commands/tell.rb | 18 +++--- lib/aethyr/core/actions/commands/terrain.rb | 26 ++++---- lib/aethyr/core/actions/commands/time.rb | 4 +- lib/aethyr/core/actions/commands/unlock.rb | 32 +++++----- lib/aethyr/core/actions/commands/unwield.rb | 20 +++--- lib/aethyr/core/actions/commands/wear.rb | 14 ++--- lib/aethyr/core/actions/commands/whereis.rb | 12 ++-- lib/aethyr/core/actions/commands/whisper.rb | 34 +++++----- lib/aethyr/core/actions/commands/who.rb | 4 +- lib/aethyr/core/actions/commands/wield.rb | 20 +++--- lib/aethyr/core/actions/commands/write.rb | 14 ++--- .../core/actions/commands/write_post.rb | 8 +-- 124 files changed, 936 insertions(+), 941 deletions(-) diff --git a/lib/aethyr/core/actions/commands/acarea.rb b/lib/aethyr/core/actions/commands/acarea.rb index a536159..ce30230 100644 --- a/lib/aethyr/core/actions/commands/acarea.rb +++ b/lib/aethyr/core/actions/commands/acarea.rb @@ -10,11 +10,9 @@ module Aethyr end def action - event = @data - - room = $manager.get_object(@player.container) - player = @player - area = $manager.create_object(Area, nil, nil, nil, {:@name => event[:name]}) + room = $manager.get_object(self[:agent].container) + player = self[:agent] + area = $manager.create_object(Area, nil, nil, nil, {:@name => self[:name]}) player.output "Created: #{area}" end diff --git a/lib/aethyr/core/actions/commands/acdoor.rb b/lib/aethyr/core/actions/commands/acdoor.rb index 70d7d3c..3187199 100644 --- a/lib/aethyr/core/actions/commands/acdoor.rb +++ b/lib/aethyr/core/actions/commands/acdoor.rb @@ -10,15 +10,15 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] exit_room = nil - if event[:exit_room].nil? - out = find_object event[:direction], event + if self[:exit_room].nil? + out = find_object self[:direction], event if out and out.is_a? Exit exit_room = $manager.find out.exit_room - other_side = $manager.find opposite_dir(event[:direction]), out.exit_room + other_side = $manager.find opposite_dir(self[:direction]), out.exit_room if other_side $manager.delete_object other_side @@ -31,24 +31,24 @@ module Aethyr player.output "Removed exit (#{out})." end else - exit_room = $manager.get_object event[:exit_room] + exit_room = $manager.get_object self[:exit_room] end if exit_room.nil? - player.output "Cannot find #{event[:exit_room]} to connect to." + player.output "Cannot find #{self[:exit_room]} to connect to." return end - door_here = $manager.create_object Door, room, nil, exit_room.goid, :@alt_names => [event[:direction]], :@name => "a door to the #{event[:direction]}" - door_there = $manager.create_object Door, exit_room, nil, room.goid, :@alt_names => [opposite_dir(event[:direction])], :@name => "a door to the #{opposite_dir event[:direction]}" + door_here = $manager.create_object Door, room, nil, exit_room.goid, :@alt_names => [self[:direction]], :@name => "a door to the #{self[:direction]}" + door_there = $manager.create_object Door, exit_room, nil, room.goid, :@alt_names => [opposite_dir(self[:direction])], :@name => "a door to the #{opposite_dir self[:direction]}" door_here.connect_to door_there player.output "Created: #{door_here}" player.output "Created: #{door_there}" if room - event[:to_player] = "Frowning in concentration, you make vague motions with your hands. There is a small flash of light as #{door_here.name} to #{exit_room.name} appears." - event[:to_other] = "Frowning in concentration, #{player.name} makes vague motions with #{player.pronoun(:possessive)} hands. There is a small flash of light as #{door_here.name} to #{exit_room.name} appears." + self[:to_player] = "Frowning in concentration, you make vague motions with your hands. There is a small flash of light as #{door_here.name} to #{exit_room.name} appears." + self[:to_other] = "Frowning in concentration, #{player.name} makes vague motions with #{player.pronoun(:possessive)} hands. There is a small flash of light as #{door_here.name} to #{exit_room.name} appears." room.out_event event end end diff --git a/lib/aethyr/core/actions/commands/acomment.rb b/lib/aethyr/core/actions/commands/acomment.rb index 24ef59f..fe6329a 100644 --- a/lib/aethyr/core/actions/commands/acomment.rb +++ b/lib/aethyr/core/actions/commands/acomment.rb @@ -10,18 +10,18 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - object = find_object(event[:target], event) + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + object = find_object(self[:target], event) if object.nil? - player.output "Cannot find:#{event[:target]}" + player.output "Cannot find:#{self[:target]}" return end - object.comment = event[:comment] - player.output "Added comment: '#{event[:comment]}'\nto#{object}" + object.comment = self[:comment] + player.output "Added comment: '#{self[:comment]}'\nto#{object}" end end diff --git a/lib/aethyr/core/actions/commands/aconfig.rb b/lib/aethyr/core/actions/commands/aconfig.rb index 38a2481..fa441e3 100644 --- a/lib/aethyr/core/actions/commands/aconfig.rb +++ b/lib/aethyr/core/actions/commands/aconfig.rb @@ -10,17 +10,17 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:setting].nil? + room = $manager.get_object(self[:agent].container) + player = self[:agent] + + if self[:setting].nil? player.output "Current configuration:\n#{ServerConfig}" return end - setting = event[:setting].downcase.to_sym + setting = self[:setting].downcase.to_sym if setting == :reload ServerConfig.reload @@ -31,7 +31,7 @@ module Aethyr return end - value = event[:value] + value = self[:value] if value =~ /^\d+$/ value = value.to_i end diff --git a/lib/aethyr/core/actions/commands/acportal.rb b/lib/aethyr/core/actions/commands/acportal.rb index 61f003a..351dff7 100644 --- a/lib/aethyr/core/actions/commands/acportal.rb +++ b/lib/aethyr/core/actions/commands/acportal.rb @@ -10,13 +10,13 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] object = Admin.acreate(event, player, room) - if event[:portal_action] and event[:portal_action].downcase != "enter" - object.info.portal_action = event[:portal_action].downcase.to_sym + if self[:portal_action] and self[:portal_action].downcase != "enter" + object.info.portal_action = self[:portal_action].downcase.to_sym end end diff --git a/lib/aethyr/core/actions/commands/acreate.rb b/lib/aethyr/core/actions/commands/acreate.rb index d8e1d07..4a9def7 100644 --- a/lib/aethyr/core/actions/commands/acreate.rb +++ b/lib/aethyr/core/actions/commands/acreate.rb @@ -10,11 +10,11 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - class_name = event[:object] + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + class_name = self[:object] class_name[0,1] = class_name[0,1].capitalize @@ -31,16 +31,16 @@ module Aethyr end vars = {} - vars[:@name] = event[:name] if event[:name] - vars[:@alt_names] = event[:alt_names] if event[:alt_names] - vars[:@generic] = event[:generic] if event[:generic] - args = event[:args] + vars[:@name] = self[:name] if self[:name] + vars[:@alt_names] = self[:alt_names] if self[:alt_names] + vars[:@generic] = self[:generic] if self[:generic] + args = self[:args] object = $manager.create_object(klass, room, nil, args, vars) if room - event[:to_player] = "Frowning in concentration, you make vague motions with your hands. There is a small flash of light as #{object.name} appears." - event[:to_other] = "Frowning in concentration, #{player.name} makes vague motions with #{player.pronoun(:possessive)} hands. There is a small flash of light as #{object.name} appears." + self[:to_player] = "Frowning in concentration, you make vague motions with your hands. There is a small flash of light as #{object.name} appears." + self[:to_other] = "Frowning in concentration, #{player.name} makes vague motions with #{player.pronoun(:possessive)} hands. There is a small flash of light as #{object.name} appears." room.out_event event end diff --git a/lib/aethyr/core/actions/commands/acroom.rb b/lib/aethyr/core/actions/commands/acroom.rb index f68efd9..01d14f0 100644 --- a/lib/aethyr/core/actions/commands/acroom.rb +++ b/lib/aethyr/core/actions/commands/acroom.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] area = nil if room.container area = $manager.get_object(room.container) @@ -22,7 +22,7 @@ module Aethyr unless area.nil? or area.map_type.eql? :none current_pos = area.position(room) new_pos = current_pos.dup - case event[:out_dir].downcase.strip + case self[:out_dir].downcase.strip when "north" new_pos[1] += 1 when "south" @@ -32,16 +32,16 @@ module Aethyr when "east" new_pos[0] += 1 when "northeast" - player.output "Can not create a #{event[:out_dir]} exit in a mappable area at this time" + player.output "Can not create a #{self[:out_dir]} exit in a mappable area at this time" return when "northwest" - player.output "Can not create a #{event[:out_dir]} exit in a mappable area at this time" + player.output "Can not create a #{self[:out_dir]} exit in a mappable area at this time" return when "southeast" - player.output "Can not create a #{event[:out_dir]} exit in a mappable area at this time" + player.output "Can not create a #{self[:out_dir]} exit in a mappable area at this time" return when "southwest" - player.output "Can not create a #{event[:out_dir]} exit in a mappable area at this time" + player.output "Can not create a #{self[:out_dir]} exit in a mappable area at this time" return else new_pos = nil @@ -54,9 +54,9 @@ module Aethyr return end - new_room = $manager.create_object(Room, area, new_pos, nil, :@name => event[:name]) - out_exit = $manager.create_object(Exit, room, nil, new_room.goid, :@alt_names => [event[:out_dir]]) - in_exit = $manager.create_object(Exit, new_room, nil, room.goid, :@alt_names => [event[:in_dir]]) + new_room = $manager.create_object(Room, area, new_pos, nil, :@name => self[:name]) + out_exit = $manager.create_object(Exit, room, nil, new_room.goid, :@alt_names => [self[:out_dir]]) + in_exit = $manager.create_object(Exit, new_room, nil, room.goid, :@alt_names => [self[:in_dir]]) player.output "Created: #{new_room}#{new_pos.nil? ? '' : ' @ ' + new_pos_text}" player.output "Created: #{out_exit}" @@ -95,7 +95,7 @@ module Aethyr end if room - room.output "There is a small flash of light as a new room appears to the #{event[:out_dir]}." + room.output "There is a small flash of light as a new room appears to the #{self[:out_dir]}." end end diff --git a/lib/aethyr/core/actions/commands/adelete.rb b/lib/aethyr/core/actions/commands/adelete.rb index e94927d..91010b6 100644 --- a/lib/aethyr/core/actions/commands/adelete.rb +++ b/lib/aethyr/core/actions/commands/adelete.rb @@ -10,13 +10,13 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:object] and event[:object].split.first.downcase == "all" - log event[:object].split - klass = event[:object].split[1] + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:object] and self[:object].split.first.downcase == "all" + log self[:object].split + klass = self[:object].split[1] klass.capitalize! unless klass[0,1] == klass[0,1].upcase begin klass = Module.const_get klass.to_sym @@ -37,10 +37,10 @@ module Aethyr return end - object = find_object(event[:object], event) + object = find_object(self[:object], event) if object.nil? - player.output "Cannot find #{event[:object]} to delete." + player.output "Cannot find #{self[:object]} to delete." return elsif object.is_a? Player player.output "Use DELETEPLAYER to delete players." @@ -52,8 +52,8 @@ module Aethyr $manager.delete_object(object) if room and room.goid == object.container - event[:to_player] = "You casually wave your hand and #{object.name} disappears." - event[:to_other] = "With a casual wave of #{player.pronoun(:possessive)} hand, #{player.name} makes #{object.name} disappear." + self[:to_player] = "You casually wave your hand and #{object.name} disappears." + self[:to_other] = "With a casual wave of #{player.pronoun(:possessive)} hand, #{player.name} makes #{object.name} disappear." room.out_event event else player.output "You casually wave your hand and #{object.name} disappears." diff --git a/lib/aethyr/core/actions/commands/adesc.rb b/lib/aethyr/core/actions/commands/adesc.rb index f57b482..34eb7cf 100644 --- a/lib/aethyr/core/actions/commands/adesc.rb +++ b/lib/aethyr/core/actions/commands/adesc.rb @@ -10,32 +10,32 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] object = nil - if event[:object].downcase == "here" + if self[:object].downcase == "here" object = room else - object = find_object(event[:object], event) + object = find_object(self[:object], event) end if object.nil? - player.output "Cannot find #{event[:object]}." + player.output "Cannot find #{self[:object]}." return end - if event[:inroom] - if event[:desc].nil? or event[:desc].downcase == "false" + if self[:inroom] + if self[:desc].nil? or self[:desc].downcase == "false" object.show_in_look = false player.output "#{object.name} will not be shown in the room description." else - object.show_in_look= event[:desc] + object.show_in_look= self[:desc] player.output "The room will show #{object.show_in_look}" end else - object.instance_variable_set(:@short_desc, event[:desc]) + object.instance_variable_set(:@short_desc, self[:desc]) player.output "#{object.name} now looks like:\n#{object.short_desc}" end end diff --git a/lib/aethyr/core/actions/commands/aforce.rb b/lib/aethyr/core/actions/commands/aforce.rb index 5ce4c21..8dc37e9 100644 --- a/lib/aethyr/core/actions/commands/aforce.rb +++ b/lib/aethyr/core/actions/commands/aforce.rb @@ -10,16 +10,16 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - object = find_object(event[:target], event) + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + object = find_object(self[:target], event) if object.nil? player.output "Force who?" return elsif object.is_a? Player - object.handle_input(event[:command]) + object.handle_input(self[:command]) else player.output "You can only force other players to execute a command." end diff --git a/lib/aethyr/core/actions/commands/ahelp.rb b/lib/aethyr/core/actions/commands/ahelp.rb index d7e9e6b..43020bb 100644 --- a/lib/aethyr/core/actions/commands/ahelp.rb +++ b/lib/aethyr/core/actions/commands/ahelp.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] Generic.help(event, player, room) end diff --git a/lib/aethyr/core/actions/commands/ahide.rb b/lib/aethyr/core/actions/commands/ahide.rb index 7151ad0..22cddcf 100644 --- a/lib/aethyr/core/actions/commands/ahide.rb +++ b/lib/aethyr/core/actions/commands/ahide.rb @@ -10,18 +10,18 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - object = find_object(event[:object], event) + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + object = find_object(self[:object], event) if object.nil? - player.output "Cannot find #{event[:object]}." + player.output "Cannot find #{self[:object]}." return end - if event[:hide] + if self[:hide] object.show_in_look = "" player.output "#{object.name} is now hidden." elsif object.show_in_look == "" diff --git a/lib/aethyr/core/actions/commands/ainfo.rb b/lib/aethyr/core/actions/commands/ainfo.rb index a7c7f97..62af0bb 100644 --- a/lib/aethyr/core/actions/commands/ainfo.rb +++ b/lib/aethyr/core/actions/commands/ainfo.rb @@ -10,17 +10,17 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:object].downcase == "here" - event[:object] = player.container - elsif event[:object].downcase == "me" - event[:object] = player - elsif event[:object] and event[:object].split.first.downcase == "all" - log event[:object].split - klass = event[:object].split[1] + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:object].downcase == "here" + self[:object] = player.container + elsif self[:object].downcase == "me" + self[:object] = player + elsif self[:object] and self[:object].split.first.downcase == "all" + log self[:object].split + klass = self[:object].split[1] klass.capitalize! unless klass[0,1] == klass[0,1].upcase begin klass = Module.const_get klass.to_sym @@ -41,16 +41,16 @@ module Aethyr return end - object = find_object(event[:object], event) + object = find_object(self[:object], event) if object.nil? - player.output "What object? #{event[:object]}" + player.output "What object? #{self[:object]}" return end - case event[:command] + case self[:command] when "set" - value = event[:value] #for ease + value = self[:value] #for ease if value.split.length == 1 if value == "true" value = true @@ -66,11 +66,11 @@ module Aethyr value = "" end end - object.info.set(event[:attrib], value) - player.output "Set #{event[:attrib]} to #{object.info.get(event[:attrib])}" + object.info.set(self[:attrib], value) + player.output "Set #{self[:attrib]} to #{object.info.get(self[:attrib])}" when "delete" - object.info.delete(event[:attrib]) - player.output "Deleted #{event[:attrib]} from #{object}" + object.info.delete(self[:attrib]) + player.output "Deleted #{self[:attrib]} from #{object}" when "show" player.output object.info.inspect when "clear" diff --git a/lib/aethyr/core/actions/commands/alearn.rb b/lib/aethyr/core/actions/commands/alearn.rb index 3ec75e8..75d7a8c 100644 --- a/lib/aethyr/core/actions/commands/alearn.rb +++ b/lib/aethyr/core/actions/commands/alearn.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] end end diff --git a/lib/aethyr/core/actions/commands/alist.rb b/lib/aethyr/core/actions/commands/alist.rb index 835b90d..6f2f564 100644 --- a/lib/aethyr/core/actions/commands/alist.rb +++ b/lib/aethyr/core/actions/commands/alist.rb @@ -10,15 +10,15 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] objects = nil - if event[:match].nil? + if self[:match].nil? objects = $manager.find_all("class", :GameObject) else - objects = $manager.find_all(event[:match], event[:attrib]) + objects = $manager.find_all(self[:match], self[:attrib]) end if objects.empty? diff --git a/lib/aethyr/core/actions/commands/all.rb b/lib/aethyr/core/actions/commands/all.rb index 7c5d101..43231d7 100644 --- a/lib/aethyr/core/actions/commands/all.rb +++ b/lib/aethyr/core/actions/commands/all.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] board = find_board(event, room) if board.nil? diff --git a/lib/aethyr/core/actions/commands/alog.rb b/lib/aethyr/core/actions/commands/alog.rb index 9865553..cb70172 100644 --- a/lib/aethyr/core/actions/commands/alog.rb +++ b/lib/aethyr/core/actions/commands/alog.rb @@ -10,37 +10,37 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:command].nil? + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:command].nil? player.output "What do you want to do with the log?" return else - command = event[:command].downcase + command = self[:command].downcase end case command when /^players?$/ - if event[:value] - lines = event[:value].to_i + if self[:value] + lines = self[:value].to_i else lines = 10 end player.output tail('logs/player.log', lines) when 'server' - if event[:value] - lines = event[:value].to_i + if self[:value] + lines = self[:value].to_i else lines = 10 end player.output tail('logs/server.log', lines) when 'system' - if event[:value] - lines = event[:value].to_i + if self[:value] + lines = self[:value].to_i else lines = 10 end diff --git a/lib/aethyr/core/actions/commands/alook.rb b/lib/aethyr/core/actions/commands/alook.rb index 921e0ee..ab07834 100644 --- a/lib/aethyr/core/actions/commands/alook.rb +++ b/lib/aethyr/core/actions/commands/alook.rb @@ -10,20 +10,20 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:at].nil? + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:at].nil? object = room - elsif event[:at].downcase == "here" + elsif self[:at].downcase == "here" object = $manager.find player.container else - object = find_object(event[:at], event) + object = find_object(self[:at], event) end if object.nil? - player.output "Cannot find #{event[:at]} to inspect." + player.output "Cannot find #{self[:at]} to inspect." return end diff --git a/lib/aethyr/core/actions/commands/aput.rb b/lib/aethyr/core/actions/commands/aput.rb index a08e103..9e1894f 100644 --- a/lib/aethyr/core/actions/commands/aput.rb +++ b/lib/aethyr/core/actions/commands/aput.rb @@ -10,36 +10,36 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:object].is_a? GameObject - object = event[:object] + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:object].is_a? GameObject + object = self[:object] else - event[:object] = player.container if event[:object].downcase == "here" - object = find_object(event[:object], event) + self[:object] = player.container if self[:object].downcase == "here" + object = find_object(self[:object], event) end - container = find_object(event[:in], event) + container = find_object(self[:in], event) if object.nil? - player.output "Cannot find #{event[:object]} to move." + player.output "Cannot find #{self[:object]} to move." return - elsif event[:in] == "!world" + elsif self[:in] == "!world" container = $manager.find object.container container.inventory.remove(object) unless container.nil? object.container = nil player.output "Removed #{object} from any containers." return - elsif event[:in].downcase == "here" + elsif self[:in].downcase == "here" container = $manager.find player.container if container.nil? - player.output "Cannot find #{event[:in]} " + player.output "Cannot find #{self[:in]} " return end elsif container.nil? - player.output "Cannot find #{event[:in]} " + player.output "Cannot find #{self[:in]} " return end @@ -48,8 +48,8 @@ module Aethyr current_container.inventory.remove(object) if current_container end - unless event[:at] == nil - position = event[:at].split('x').map{ |e| e.to_i} + unless self[:at] == nil + position = self[:at].split('x').map{ |e| e.to_i} end if container.is_a? Inventory @@ -61,7 +61,7 @@ module Aethyr object.container = container.goid end - player.output "Moved #{object} into #{container}#{event[:at] == nil ? '' : ' at ' + event[:at]}" + player.output "Moved #{object} into #{container}#{self[:at] == nil ? '' : ' at ' + self[:at]}" end end diff --git a/lib/aethyr/core/actions/commands/areaction.rb b/lib/aethyr/core/actions/commands/areaction.rb index b9b9525..bd7b635 100644 --- a/lib/aethyr/core/actions/commands/areaction.rb +++ b/lib/aethyr/core/actions/commands/areaction.rb @@ -10,12 +10,12 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:command] == "reload" and event[:object] and event[:object].downcase == "all" + room = $manager.get_object(self[:agent].container) + player = self[:agent] + + if self[:command] == "reload" and self[:object] and self[:object].downcase == "all" objects = $manager.find_all("class", Reacts) objects.each do |o| @@ -23,8 +23,8 @@ module Aethyr end player.output "Updated reactions for #{objects.length} objects." - elsif event[:object] and event[:object].split.first.downcase == "all" - klass = event[:object].split[1] + elsif self[:object] and self[:object].split.first.downcase == "all" + klass = self[:object].split[1] klass.capitalize! unless klass[0,1] == klass[0,1].upcase begin klass = Module.const_get klass.to_sym @@ -43,40 +43,40 @@ module Aethyr Admin.areaction(e, player, room) end else - if event[:object] == "here" + if self[:object] == "here" object = room else - object = find_object(event[:object], event) + object = find_object(self[:object], event) end if object.nil? - player.output "Cannot find:#{event[:object]}" + player.output "Cannot find:#{self[:object]}" return - elsif not object.is_a? Reacts and (event[:command] == "load" or event[:command] == "reload") + elsif not object.is_a? Reacts and (self[:command] == "load" or self[:command] == "reload") player.output "Object cannot react, adding react ability." object.extend(Reacts) end - case event[:command] + case self[:command] when "add" - if object.actions.add? event[:action_name] - player.output "Added #{event[:action_name]}" + if object.actions.add? self[:action_name] + player.output "Added #{self[:action_name]}" else player.output "Already had a reaction by that name." end when "delete" - if object.actions.delete? event[:action_name] - player.output "Removed #{event[:action_name]}" + if object.actions.delete? self[:action_name] + player.output "Removed #{self[:action_name]}" else player.output "That verb was not associated with this object." end when "load" - unless File.exist? "objects/reactions/#{event[:file]}.rx" - player.output "No such reaction file - #{event[:file]}" + unless File.exist? "objects/reactions/#{self[:file]}.rx" + player.output "No such reaction file - #{self[:file]}" return end - object.load_reactions event[:file] + object.load_reactions self[:file] player.output "Probably loaded reactions." when "reload" object.reload_reactions if object.can? :reload_reactions diff --git a/lib/aethyr/core/actions/commands/areas.rb b/lib/aethyr/core/actions/commands/areas.rb index 42c0778..8f971d3 100644 --- a/lib/aethyr/core/actions/commands/areas.rb +++ b/lib/aethyr/core/actions/commands/areas.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] areas = $manager.find_all('class', Area) if areas.empty? diff --git a/lib/aethyr/core/actions/commands/areload.rb b/lib/aethyr/core/actions/commands/areload.rb index f23248f..d20c1d9 100644 --- a/lib/aethyr/core/actions/commands/areload.rb +++ b/lib/aethyr/core/actions/commands/areload.rb @@ -10,15 +10,15 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] begin - result = load "#{event[:object]}.rb" - player.output "Reloaded #{event[:object]}: #{result}" + result = load "#{self[:object]}.rb" + player.output "Reloaded #{self[:object]}: #{result}" rescue LoadError - player.output "Unable to load #{event[:object]}" + player.output "Unable to load #{self[:object]}" end end diff --git a/lib/aethyr/core/actions/commands/asave.rb b/lib/aethyr/core/actions/commands/asave.rb index 29c08f7..8ec0976 100644 --- a/lib/aethyr/core/actions/commands/asave.rb +++ b/lib/aethyr/core/actions/commands/asave.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] log "#{player.name} initiated manual save." $manager.save_all player.output "Save complete. Check log for details." diff --git a/lib/aethyr/core/actions/commands/aset.rb b/lib/aethyr/core/actions/commands/aset.rb index ffb488e..b9c7652 100644 --- a/lib/aethyr/core/actions/commands/aset.rb +++ b/lib/aethyr/core/actions/commands/aset.rb @@ -10,15 +10,15 @@ module Aethyr end def action - event = @data - - room = $manager.get_object(@player.container) - player = @player - if event[:object].downcase == "here" - event[:object] = player.container - elsif event[:object] and event[:object].split.first.downcase == "all" - log event[:object].split - klass = event[:object].split[1] + + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:object].downcase == "here" + self[:object] = player.container + elsif self[:object] and self[:object].split.first.downcase == "all" + log self[:object].split + klass = self[:object].split[1] klass.capitalize! unless klass[0,1] == klass[0,1].upcase begin klass = Module.const_get klass.to_sym @@ -39,17 +39,17 @@ module Aethyr return end - object = find_object(event[:object], event) + object = find_object(self[:object], event) if object.nil? - player.output "Cannot find #{event[:object]} to edit." + player.output "Cannot find #{self[:object]} to edit." return end - attrib = event[:attribute] + attrib = self[:attribute] if attrib[0,1] != "@" - value = event[:value] + value = self[:value] if value.downcase == "!nothing" or value.downcase == "nil" value = nil end @@ -101,16 +101,16 @@ module Aethyr end end - if not object.instance_variables.include? attrib and not object.instance_variables.include? attrib.to_sym and not event[:force] + if not object.instance_variables.include? attrib and not object.instance_variables.include? attrib.to_sym and not self[:force] player.output "#{object}:No such setting/variable/attribute: #{attrib}" return else current_value = object.instance_variable_get(attrib) if current_value.is_a? Array - object.instance_variable_set(attrib, event[:value].split(/s*"(.*?)"\s*|\s+/)) - player.output "Set #{object} attribute #{attrib} to #{event[:value].inspect}" + object.instance_variable_set(attrib, self[:value].split(/s*"(.*?)"\s*|\s+/)) + player.output "Set #{object} attribute #{attrib} to #{self[:value].inspect}" else - value = event[:value] #for ease + value = self[:value] #for ease if value.split.length == 1 case value.downcase when "true" diff --git a/lib/aethyr/core/actions/commands/astatus.rb b/lib/aethyr/core/actions/commands/astatus.rb index c5466d5..911dc7a 100644 --- a/lib/aethyr/core/actions/commands/astatus.rb +++ b/lib/aethyr/core/actions/commands/astatus.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] awho(event, player, room) total_objects = $manager.game_objects_count player.output("Object Counts:" , true) diff --git a/lib/aethyr/core/actions/commands/ateach.rb b/lib/aethyr/core/actions/commands/ateach.rb index 39d3318..8556f1e 100644 --- a/lib/aethyr/core/actions/commands/ateach.rb +++ b/lib/aethyr/core/actions/commands/ateach.rb @@ -10,11 +10,11 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - object = find_object(event[:target], event) + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + object = find_object(self[:target], event) if object.nil? player.output "Teach who what where?" return diff --git a/lib/aethyr/core/actions/commands/awatch.rb b/lib/aethyr/core/actions/commands/awatch.rb index bb2a58f..c5006ed 100644 --- a/lib/aethyr/core/actions/commands/awatch.rb +++ b/lib/aethyr/core/actions/commands/awatch.rb @@ -10,11 +10,11 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - object = find_object(event[:target], event) + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + object = find_object(self[:target], event) if object.nil? player.output "What mobile do you want to watch?" return @@ -23,7 +23,7 @@ module Aethyr return end - case event[:command] + case self[:command] when "start" if object.info.redirect_output_to == player.goid player.output "You are already watching #{object.name}." diff --git a/lib/aethyr/core/actions/commands/awho.rb b/lib/aethyr/core/actions/commands/awho.rb index 916eb3e..aaae48e 100644 --- a/lib/aethyr/core/actions/commands/awho.rb +++ b/lib/aethyr/core/actions/commands/awho.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] players = $manager.find_all('class', Player) names = [] diff --git a/lib/aethyr/core/actions/commands/close.rb b/lib/aethyr/core/actions/commands/close.rb index 778ca0b..e9111d9 100644 --- a/lib/aethyr/core/actions/commands/close.rb +++ b/lib/aethyr/core/actions/commands/close.rb @@ -10,15 +10,15 @@ module Aethyr end def action() - event = @data - room = $manager.get_object(@player.container) - object = expand_direction(event[:object]) - object = @player.search_inv(object) || $manager.find(object, room) + + room = $manager.get_object(self[:agent].container) + object = expand_direction(self[:object]) + object = self[:agent].search_inv(object) || $manager.find(object, room) if object.nil? - @player.output("Close what?") + self[:agent].output("Close what?") elsif not object.can? :open - @player.output("You cannot close #{object.name}.") + self[:agent].output("You cannot close #{object.name}.") else object.close(event) end diff --git a/lib/aethyr/core/actions/commands/command_action.rb b/lib/aethyr/core/actions/commands/command_action.rb index 47f1b80..de19525 100644 --- a/lib/aethyr/core/actions/commands/command_action.rb +++ b/lib/aethyr/core/actions/commands/command_action.rb @@ -6,16 +6,15 @@ module Aethyr def initialize(actor, **data) new_data = data.dup super(actor, **new_data) - @player = actor end #Looks in player's inventory and room for name. #Then checks at global level for GOID. def find_object(name, event) - if self[:actor].nil? + if self[:agent].nil? return $manager.find(name, nil) || $manager.get_object(name) else - return $manager.find(name, self[:actor]) || $manager.find(name, self[:actor].container) || $manager.get_object(name) + return $manager.find(name, self[:agent]) || $manager.find(name, self[:agent].container) || $manager.get_object(name) end end end diff --git a/lib/aethyr/core/actions/commands/date.rb b/lib/aethyr/core/actions/commands/date.rb index 73cdd45..d62e5bf 100644 --- a/lib/aethyr/core/actions/commands/date.rb +++ b/lib/aethyr/core/actions/commands/date.rb @@ -10,8 +10,8 @@ module Aethyr end def action - event = @data - @player.output $manager.date + + self[:agent].output $manager.date end #Show who is in the game. end diff --git a/lib/aethyr/core/actions/commands/delete_player.rb b/lib/aethyr/core/actions/commands/delete_player.rb index ae41a00..99dc628 100644 --- a/lib/aethyr/core/actions/commands/delete_player.rb +++ b/lib/aethyr/core/actions/commands/delete_player.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] name = event.object if not $manager.player_exist? name player.output "No such player found: #{name}" diff --git a/lib/aethyr/core/actions/commands/delete_post.rb b/lib/aethyr/core/actions/commands/delete_post.rb index 9d072e5..44f0301 100644 --- a/lib/aethyr/core/actions/commands/delete_post.rb +++ b/lib/aethyr/core/actions/commands/delete_post.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] @@ -25,15 +25,15 @@ module Aethyr return end - post = board.get_post event[:post_id] + post = board.get_post self[:post_id] if post.nil? player.output "No such post." elsif post[:author] != player.name player.output "You can only delete your own posts." else - board.delete_post event[:post_id] - player.output "Deleted post ##{event[:post_id]}" + board.delete_post self[:post_id] + player.output "Deleted post ##{self[:post_id]}" end end diff --git a/lib/aethyr/core/actions/commands/deleteme.rb b/lib/aethyr/core/actions/commands/deleteme.rb index 5170886..be0f225 100644 --- a/lib/aethyr/core/actions/commands/deleteme.rb +++ b/lib/aethyr/core/actions/commands/deleteme.rb @@ -10,21 +10,21 @@ module Aethyr end def action - event = @data - if event[:password] - if $manager.check_password(@player.name, event[:password]) - @player.output "This character #{@player.name} will no longer exist." - @player.quit - $manager.delete_player(@player.name) + + if self[:password] + if $manager.check_password(self[:agent].name, self[:password]) + self[:agent].output "This character #{self[:agent].name} will no longer exist." + self[:agent].quit + $manager.delete_player(self[:agent].name) else - @player.output "That password is incorrect. You are allowed to continue existing." + self[:agent].output "That password is incorrect. You are allowed to continue existing." end else - @player.output "To confirm your deletion, please enter your password:" - @player.io.echo_off - @player.expect do |password| - @player.io.echo_on - event[:password] = password + self[:agent].output "To confirm your deletion, please enter your password:" + self[:agent].io.echo_off + self[:agent].expect do |password| + self[:agent].io.echo_on + self[:password] = password Generic.deleteme(event) end end diff --git a/lib/aethyr/core/actions/commands/drop.rb b/lib/aethyr/core/actions/commands/drop.rb index 3bfd939..8bb22f0 100644 --- a/lib/aethyr/core/actions/commands/drop.rb +++ b/lib/aethyr/core/actions/commands/drop.rb @@ -10,28 +10,28 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - object = @player.inventory.find(event[:object]) + + room = $manager.get_object(self[:agent].container) + object = self[:agent].inventory.find(self[:object]) if object.nil? - if response = @player.equipment.worn_or_wielded?(event[:object]) - @player.output response + if response = self[:agent].equipment.worn_or_wielded?(self[:object]) + self[:agent].output response else - @player.output "You have no #{event[:object]} to drop." + self[:agent].output "You have no #{self[:object]} to drop." end return end - @player.inventory.remove(object) + self[:agent].inventory.remove(object) object.container = room.goid room.add(object) - event[:to_player] = "You drop #{object.name}." - event[:to_other] = "#{@player.name} drops #{object.name}." - event[:to_blind_other] = "You hear something hit the ground." + self[:to_player] = "You drop #{object.name}." + self[:to_other] = "#{self[:agent].name} drops #{object.name}." + self[:to_blind_other] = "You hear something hit the ground." room.out_event(event) end end diff --git a/lib/aethyr/core/actions/commands/emotes/agree.rb b/lib/aethyr/core/actions/commands/emotes/agree.rb index b0ba074..a4916b8 100644 --- a/lib/aethyr/core/actions/commands/emotes/agree.rb +++ b/lib/aethyr/core/actions/commands/emotes/agree.rb @@ -10,30 +10,30 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "You nod your head in agreement." to_other "#{player.name} nods #{player.pronoun(:possessive)} head in agreement." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end self_target do to_player "You are in complete agreement with yourself." to_other "#{player.name} nods at #{player.pronoun(:reflexive)}, apparently in complete agreement." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do to_player "You nod your head in agreement with #{event.target.name}." to_target "#{player.name} nods #{player.pronoun(:possessive)} head in agreement with you." to_other "#{player.name} nods #{player.pronoun(:possessive)} head in agreement with #{event.target.name}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end diff --git a/lib/aethyr/core/actions/commands/emotes/back.rb b/lib/aethyr/core/actions/commands/emotes/back.rb index 44288f0..32eef31 100644 --- a/lib/aethyr/core/actions/commands/emotes/back.rb +++ b/lib/aethyr/core/actions/commands/emotes/back.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/blush.rb b/lib/aethyr/core/actions/commands/emotes/blush.rb index f0533fc..659d31d 100644 --- a/lib/aethyr/core/actions/commands/emotes/blush.rb +++ b/lib/aethyr/core/actions/commands/emotes/blush.rb @@ -10,31 +10,31 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "You feel the blood rush to your cheeks and you look down, blushing." to_other "#{player.name}'s face turns bright red as #{player.pronoun} looks down, blushing." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end self_target do to_player "You blush at your foolishness." to_other "#{player.name} blushes at #{event.target.pronoun(:possessive)} foolishness." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do to_player "Your face turns red and you blush at #{event.target.name} uncomfortably." to_target "#{player.name} blushes in your direction." - to_deaf_target event[:to_target] + to_deaf_target self[:to_target] to_other "#{player.name} blushes at #{event.target.name}, clearly uncomfortable." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end end diff --git a/lib/aethyr/core/actions/commands/emotes/bow.rb b/lib/aethyr/core/actions/commands/emotes/bow.rb index d6dc5ee..abd1949 100644 --- a/lib/aethyr/core/actions/commands/emotes/bow.rb +++ b/lib/aethyr/core/actions/commands/emotes/bow.rb @@ -10,17 +10,17 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "You bow deeply and respectfully." to_other "#{player.name} bows deeply and respectfully." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end self_target do @@ -31,7 +31,7 @@ module Aethyr to_player "You bow respectfully towards #{event.target.name}." to_target "#{player.name} bows respectfully before you." to_other "#{player.name} bows respectfully towards #{event.target.name}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end diff --git a/lib/aethyr/core/actions/commands/emotes/brb.rb b/lib/aethyr/core/actions/commands/emotes/brb.rb index 0a2da88..7fdb744 100644 --- a/lib/aethyr/core/actions/commands/emotes/brb.rb +++ b/lib/aethyr/core/actions/commands/emotes/brb.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/bye.rb b/lib/aethyr/core/actions/commands/emotes/bye.rb index 4f7b865..7cc266b 100644 --- a/lib/aethyr/core/actions/commands/emotes/bye.rb +++ b/lib/aethyr/core/actions/commands/emotes/bye.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/cheer.rb b/lib/aethyr/core/actions/commands/emotes/cheer.rb index 9f89ad0..645616f 100644 --- a/lib/aethyr/core/actions/commands/emotes/cheer.rb +++ b/lib/aethyr/core/actions/commands/emotes/cheer.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/cry.rb b/lib/aethyr/core/actions/commands/emotes/cry.rb index 1513198..4eaacb0 100644 --- a/lib/aethyr/core/actions/commands/emotes/cry.rb +++ b/lib/aethyr/core/actions/commands/emotes/cry.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/curtsey.rb b/lib/aethyr/core/actions/commands/emotes/curtsey.rb index 5966223..75a30ec 100644 --- a/lib/aethyr/core/actions/commands/emotes/curtsey.rb +++ b/lib/aethyr/core/actions/commands/emotes/curtsey.rb @@ -10,17 +10,17 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "You perform a very graceful curtsey." to_other "#{player.name} curtseys quite gracefully." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end self_target do @@ -31,7 +31,7 @@ module Aethyr to_player "You curtsey gracefully and respectfully towards #{event.target.name}." to_target "#{player.name} curtseys gracefully and respectfully in your direction." to_other "#{player.name} curtseys gracefully and respectfully towards #{event.target.name}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end diff --git a/lib/aethyr/core/actions/commands/emotes/eh.rb b/lib/aethyr/core/actions/commands/emotes/eh.rb index 28d1dee..bf4fe1e 100644 --- a/lib/aethyr/core/actions/commands/emotes/eh.rb +++ b/lib/aethyr/core/actions/commands/emotes/eh.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do target do to_player "After giving #{event.target.name} a cursory glance, you emit an unimpressed, 'Eh.'" diff --git a/lib/aethyr/core/actions/commands/emotes/emote.rb b/lib/aethyr/core/actions/commands/emotes/emote.rb index 2a49218..49ac864 100644 --- a/lib/aethyr/core/actions/commands/emotes/emote.rb +++ b/lib/aethyr/core/actions/commands/emotes/emote.rb @@ -10,11 +10,11 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - action = event[:show].strip + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + action = self[:show].strip unless ['!', '.', '?', '"'].include? action[-1..-1] action << '.' @@ -44,9 +44,9 @@ module Aethyr end if show - event[:message_type] = :chat - event[:to_player] = "You emote: #{show}" - event[:to_other] = show + self[:message_type] = :chat + self[:to_player] = "You emote: #{show}" + self[:to_other] = show room.out_event event end end diff --git a/lib/aethyr/core/actions/commands/emotes/emote_action.rb b/lib/aethyr/core/actions/commands/emotes/emote_action.rb index cbfc4d3..e640e90 100644 --- a/lib/aethyr/core/actions/commands/emotes/emote_action.rb +++ b/lib/aethyr/core/actions/commands/emotes/emote_action.rb @@ -28,11 +28,11 @@ module Aethyr def initialize(event, player, room) @event = event.dup - @event[:message_type] = :chat - @event[:player] = player + @self[:message_type] = :chat + @self[:player] = player @player = player @room = room - @post = event[:post] + @post = self[:post] @object = nil @return_event = nil find_target @@ -72,43 +72,43 @@ module Aethyr #Provide output to show player. def to_player output - @event[:to_player] = output + @self[:to_player] = output @event end #Provide output to show others. def to_other output - @event[:to_other] = output + @self[:to_other] = output @event end #Provide output to show target. def to_target output - @event[:to_target] = output + @self[:to_target] = output @event end #Provide output to show blind others. def to_blind_other output - @event[:to_blind_other] = output + @self[:to_blind_other] = output @event end #Provide output to show deaf others. def to_deaf_other output - @event[:to_deaf_other] = output + @self[:to_deaf_other] = output @event end #Provide output to show blind target. def to_blind_target output - @event[:to_blind_target] = output + @self[:to_blind_target] = output @event end #Provide output to show deaf target. def to_deaf_target output - @event[:to_deaf_target] = output + @self[:to_deaf_target] = output @event end @@ -116,19 +116,19 @@ module Aethyr def set_post return if not @post [:to_player, :to_other, :to_target, :to_blind_other, :to_blind_target, :to_deaf_other, :to_deaf_target].each do |t| - if @return_event[t] - if @return_event[t][-1,1] == "." - @return_event[t][-1] = "" + if @return_self[t] + if @return_self[t][-1,1] == "." + @return_self[t][-1] = "" end if @post[0,1] == "," - @return_event[t] << @post + @return_self[t] << @post else - @return_event[t] << " " << @post + @return_self[t] << " " << @post end unless ["!", "?", ".", "\"", "'"].include? @post[-1,1] - @return_event[t] << "." + @return_self[t] << "." end end end @@ -138,9 +138,9 @@ module Aethyr #Find target for emote. def find_target - if @object.nil? and @event[:object] - @object = @room.find(@event[:object]) || @player.search_inv(@event[:object]) - @event[:target] = @object + if @object.nil? and @self[:object] + @object = @room.find(@self[:object]) || @player.search_inv(@self[:object]) + @self[:target] = @object end end end diff --git a/lib/aethyr/core/actions/commands/emotes/er.rb b/lib/aethyr/core/actions/commands/emotes/er.rb index 8c095a6..c7c34c3 100644 --- a/lib/aethyr/core/actions/commands/emotes/er.rb +++ b/lib/aethyr/core/actions/commands/emotes/er.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "With a look of uncertainty, you say, \"Er...\"" diff --git a/lib/aethyr/core/actions/commands/emotes/ew.rb b/lib/aethyr/core/actions/commands/emotes/ew.rb index a065961..951a1aa 100644 --- a/lib/aethyr/core/actions/commands/emotes/ew.rb +++ b/lib/aethyr/core/actions/commands/emotes/ew.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/frown.rb b/lib/aethyr/core/actions/commands/emotes/frown.rb index fe36d16..edaf4e9 100644 --- a/lib/aethyr/core/actions/commands/emotes/frown.rb +++ b/lib/aethyr/core/actions/commands/emotes/frown.rb @@ -10,30 +10,30 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "The edges of your mouth turn down as you frown." to_other "The edges of #{player.name}'s mouth turn down as #{player.pronoun} frowns." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end self_target do to_player "You frown sadly at yourself." to_other "#{player.name} frowns sadly at #{event.target.pronoun(:reflexive)}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do to_player "You frown at #{event.target.name} unhappily." to_target "#{player.name} frowns at you unhappily." - to_deaf_target event[:to_target] + to_deaf_target self[:to_target] to_other "#{player.name} frowns at #{event.target.name} unhappily." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end diff --git a/lib/aethyr/core/actions/commands/emotes/grin.rb b/lib/aethyr/core/actions/commands/emotes/grin.rb index ae688e5..b5b1a09 100644 --- a/lib/aethyr/core/actions/commands/emotes/grin.rb +++ b/lib/aethyr/core/actions/commands/emotes/grin.rb @@ -10,31 +10,31 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player 'You grin widely, flashing all your teeth.' to_other "#{player.name} grins widely, flashing all #{player.pronoun(:possessive)} teeth." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end self_target do to_player "You grin madly at yourself." to_other "#{player.name} grins madly at #{event.target.pronoun(:reflexive)}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do to_player "You give #{event.target.name} a wide grin." to_target "#{player.name} gives you a wide grin." - to_deaf_target event[:to_target] + to_deaf_target self[:to_target] to_other "#{player.name} gives #{event.target.name} a wide grin." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end diff --git a/lib/aethyr/core/actions/commands/emotes/hi.rb b/lib/aethyr/core/actions/commands/emotes/hi.rb index 56364f4..5801304 100644 --- a/lib/aethyr/core/actions/commands/emotes/hi.rb +++ b/lib/aethyr/core/actions/commands/emotes/hi.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/hm.rb b/lib/aethyr/core/actions/commands/emotes/hm.rb index f363f74..d914371 100644 --- a/lib/aethyr/core/actions/commands/emotes/hm.rb +++ b/lib/aethyr/core/actions/commands/emotes/hm.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/hug.rb b/lib/aethyr/core/actions/commands/emotes/hug.rb index 65c86a4..a7cf994 100644 --- a/lib/aethyr/core/actions/commands/emotes/hug.rb +++ b/lib/aethyr/core/actions/commands/emotes/hug.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do @@ -24,7 +24,7 @@ module Aethyr self_target do to_player 'You wrap your arms around yourself and give a tight squeeze.' to_other "#{player.name} gives #{player.pronoun(:reflexive)} a tight squeeze." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do @@ -32,7 +32,7 @@ module Aethyr to_target "#{player.name} gives you a great big hug." to_other "#{player.name} gives #{event.target.name} a great big hug." to_blind_target "Someone gives you a great big hug." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end end diff --git a/lib/aethyr/core/actions/commands/emotes/huh.rb b/lib/aethyr/core/actions/commands/emotes/huh.rb index c70eac4..ef2a3e7 100644 --- a/lib/aethyr/core/actions/commands/emotes/huh.rb +++ b/lib/aethyr/core/actions/commands/emotes/huh.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do diff --git a/lib/aethyr/core/actions/commands/emotes/laugh.rb b/lib/aethyr/core/actions/commands/emotes/laugh.rb index 7917322..bea3fb3 100644 --- a/lib/aethyr/core/actions/commands/emotes/laugh.rb +++ b/lib/aethyr/core/actions/commands/emotes/laugh.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/no.rb b/lib/aethyr/core/actions/commands/emotes/no.rb index 5fa862c..8f12e21 100644 --- a/lib/aethyr/core/actions/commands/emotes/no.rb +++ b/lib/aethyr/core/actions/commands/emotes/no.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "\"No,\" you say, shaking your head." @@ -22,13 +22,13 @@ module Aethyr self_target do to_player "You shake your head negatively in your direction. You are kind of strange." to_other "#{player.name} shakes #{player.pronoun(:possessive)} head at #{player.pronoun(:reflexive)}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do to_player "You shake your head, disagreeing with #{event.target.name}." to_target "#{player.name} shakes #{player.pronoun(:possessive)} head in your direction, disagreeing." to_other "#{player.name} shakes #{player.pronoun(:possessive)} head in disagreement with #{event.target.name}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end diff --git a/lib/aethyr/core/actions/commands/emotes/nod.rb b/lib/aethyr/core/actions/commands/emotes/nod.rb index 63c5c31..bcbd3fb 100644 --- a/lib/aethyr/core/actions/commands/emotes/nod.rb +++ b/lib/aethyr/core/actions/commands/emotes/nod.rb @@ -10,23 +10,23 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "You nod your head." to_other "#{player.name} nods #{player.pronoun(:possessive)} head." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end self_target do to_player 'You nod to yourself thoughtfully.' to_other "#{player.name} nods to #{player.pronoun(:reflexive)} thoughtfully." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do @@ -34,7 +34,7 @@ module Aethyr to_player "You nod your head towards #{event.target.name}." to_target "#{player.name} nods #{player.pronoun(:possessive)} head towards you." to_other "#{player.name} nods #{player.pronoun(:possessive)} head towards #{event.target.name}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end end diff --git a/lib/aethyr/core/actions/commands/emotes/pet.rb b/lib/aethyr/core/actions/commands/emotes/pet.rb index 0759df1..32c0b7e 100644 --- a/lib/aethyr/core/actions/commands/emotes/pet.rb +++ b/lib/aethyr/core/actions/commands/emotes/pet.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do @@ -30,10 +30,10 @@ module Aethyr target do to_player "You pet #{event.target.name} affectionately." to_target "#{player.name} pets you affectionately." - to_deaf_target event[:to_target] + to_deaf_target self[:to_target] to_blind_target "Someone pets you affectionately." to_other "#{player.name} pets #{event.target.name} affectionately." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end end diff --git a/lib/aethyr/core/actions/commands/emotes/poke.rb b/lib/aethyr/core/actions/commands/emotes/poke.rb index c42b94a..5a80470 100644 --- a/lib/aethyr/core/actions/commands/emotes/poke.rb +++ b/lib/aethyr/core/actions/commands/emotes/poke.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do @@ -24,16 +24,16 @@ module Aethyr self_target do to_player "You poke yourself in the eye. 'Ow!'" to_other "#{player.name} pokes #{player.pronoun(:reflexive)} in the eye." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do to_player "You poke #{event.target.name} playfully." to_target "#{player.name} pokes you playfully." to_blind_target "Someone pokes you playfully." - to_deaf_target event[:to_target] + to_deaf_target self[:to_target] to_other "#{player.name} pokes #{event.target.name} playfully." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end end diff --git a/lib/aethyr/core/actions/commands/emotes/ponder.rb b/lib/aethyr/core/actions/commands/emotes/ponder.rb index b01c1f8..58bbb18 100644 --- a/lib/aethyr/core/actions/commands/emotes/ponder.rb +++ b/lib/aethyr/core/actions/commands/emotes/ponder.rb @@ -10,30 +10,30 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "You ponder that idea for a moment." to_other "#{player.name} looks thoughtful as #{player.pronoun} ponders a thought." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end self_target do to_player "You look down in deep thought at your navel." to_other "#{player.name} looks down thoughtfully at #{player.pronoun(:possessive)} navel." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do to_player "You give #{event.target.name} a thoughtful look as you reflect and ponder." to_target "#{player.name} gives you a thoughtful look and seems to be reflecting upon something." to_other "#{player.name} gives #{event.target.name} a thoughtful look and appears to be absorbed in reflection." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end end diff --git a/lib/aethyr/core/actions/commands/emotes/shrug.rb b/lib/aethyr/core/actions/commands/emotes/shrug.rb index 1d4ab61..4e4e782 100644 --- a/lib/aethyr/core/actions/commands/emotes/shrug.rb +++ b/lib/aethyr/core/actions/commands/emotes/shrug.rb @@ -10,17 +10,17 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "You shrug your shoulders." to_other "#{player.name} shrugs #{player.pronoun(:possessive)} shoulders." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end self_target do @@ -32,8 +32,8 @@ module Aethyr to_player "You give #{event.target.name} a brief shrug." to_target "#{player.name} gives you a brief shrug." to_other "#{player.name} gives #{event.target.name} a brief shrug." - to_deaf_other event[:to_other] - to_deaf_target event[:to_target] + to_deaf_other self[:to_other] + to_deaf_target self[:to_target] end end diff --git a/lib/aethyr/core/actions/commands/emotes/sigh.rb b/lib/aethyr/core/actions/commands/emotes/sigh.rb index fcf3e9b..c9d505d 100644 --- a/lib/aethyr/core/actions/commands/emotes/sigh.rb +++ b/lib/aethyr/core/actions/commands/emotes/sigh.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/skip.rb b/lib/aethyr/core/actions/commands/emotes/skip.rb index d80f5f3..7b96bdd 100644 --- a/lib/aethyr/core/actions/commands/emotes/skip.rb +++ b/lib/aethyr/core/actions/commands/emotes/skip.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/smile.rb b/lib/aethyr/core/actions/commands/emotes/smile.rb index 7c0cca9..4aa60db 100644 --- a/lib/aethyr/core/actions/commands/emotes/smile.rb +++ b/lib/aethyr/core/actions/commands/emotes/smile.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/snicker.rb b/lib/aethyr/core/actions/commands/emotes/snicker.rb index 463daf5..26686ee 100644 --- a/lib/aethyr/core/actions/commands/emotes/snicker.rb +++ b/lib/aethyr/core/actions/commands/emotes/snicker.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/uh.rb b/lib/aethyr/core/actions/commands/emotes/uh.rb index 1c6af37..3db1311 100644 --- a/lib/aethyr/core/actions/commands/emotes/uh.rb +++ b/lib/aethyr/core/actions/commands/emotes/uh.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do to_player "\"Uh...\" you say, staring blankly." diff --git a/lib/aethyr/core/actions/commands/emotes/wave.rb b/lib/aethyr/core/actions/commands/emotes/wave.rb index fd0fa27..cf96dad 100644 --- a/lib/aethyr/core/actions/commands/emotes/wave.rb +++ b/lib/aethyr/core/actions/commands/emotes/wave.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do diff --git a/lib/aethyr/core/actions/commands/emotes/yawn.rb b/lib/aethyr/core/actions/commands/emotes/yawn.rb index 6a9f5d2..efc0d81 100644 --- a/lib/aethyr/core/actions/commands/emotes/yawn.rb +++ b/lib/aethyr/core/actions/commands/emotes/yawn.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do @@ -25,14 +25,14 @@ module Aethyr self_target do to_player "You yawn at how boring you are." to_other "#{player.name} yawns at #{player.pronoun(:reflexive)}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do to_player "You yawn at #{event.target.name}, bored out of your mind." to_target "#{player.name} yawns at you, finding you boring." to_other "#{player.name} yawns at how boring #{event.target.name} is." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end diff --git a/lib/aethyr/core/actions/commands/emotes/yes.rb b/lib/aethyr/core/actions/commands/emotes/yes.rb index 46a9689..f822981 100644 --- a/lib/aethyr/core/actions/commands/emotes/yes.rb +++ b/lib/aethyr/core/actions/commands/emotes/yes.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] make_emote event, player, room do no_target do @@ -24,14 +24,14 @@ module Aethyr self_target do to_player "You nod in agreement with yourself." to_other "#{player.name} nods at #{player.pronoun(:reflexive)} strangely." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end target do to_player "You nod in agreement with #{event.target.name}." to_target "#{player.name} nods in your direction, agreeing." to_other "#{player.name} nods in agreement with #{event.target.name}." - to_deaf_other event[:to_other] + to_deaf_other self[:to_other] end end diff --git a/lib/aethyr/core/actions/commands/feel.rb b/lib/aethyr/core/actions/commands/feel.rb index 74ab95d..840fe17 100644 --- a/lib/aethyr/core/actions/commands/feel.rb +++ b/lib/aethyr/core/actions/commands/feel.rb @@ -10,27 +10,27 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - object = @player.search_inv(event[:target]) || room.find(event[:target]) - if object == @player or event[:target] == "me" - @player.output "You feel fine." + room = $manager.get_object(self[:agent].container) + object = self[:agent].search_inv(self[:target]) || room.find(self[:target]) + + if object == self[:agent] or self[:target] == "me" + self[:agent].output "You feel fine." return elsif object.nil? - @player.output "What would you like to feel?" + self[:agent].output "What would you like to feel?" return end - event[:target] = object - event[:to_player] = "You reach out your hand and gingerly feel #{object.name}. " + self[:target] = object + self[:to_player] = "You reach out your hand and gingerly feel #{object.name}. " if object.info.texture.nil? or object.info.texture == "" - event[:to_player] << "#{object.pronoun(:possessive).capitalize} texture is what you would expect." + self[:to_player] << "#{object.pronoun(:possessive).capitalize} texture is what you would expect." else - event[:to_player] << object.info.texture + self[:to_player] << object.info.texture end - event[:to_target] = "#{@player.name} reaches out a hand and gingerly touches you." - event[:to_other] = "#{@player.name} reaches out #{@player.pronoun(:possessive)} hand and touches #{object.name}." + self[:to_target] = "#{self[:agent].name} reaches out a hand and gingerly touches you." + self[:to_other] = "#{self[:agent].name} reaches out #{self[:agent].pronoun(:possessive)} hand and touches #{object.name}." room.out_event event end end diff --git a/lib/aethyr/core/actions/commands/fill.rb b/lib/aethyr/core/actions/commands/fill.rb index 0b53c40..322ed7b 100644 --- a/lib/aethyr/core/actions/commands/fill.rb +++ b/lib/aethyr/core/actions/commands/fill.rb @@ -10,31 +10,31 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - object = @player.search_inv(event[:object]) || room.find(event[:object]) - from = @player.search_inv(event[:from]) || room.find(event[:from]) + + room = $manager.get_object(self[:agent].container) + object = self[:agent].search_inv(self[:object]) || room.find(self[:object]) + from = self[:agent].search_inv(self[:from]) || room.find(self[:from]) if object.nil? - @player.output("What would you like to fill?") + self[:agent].output("What would you like to fill?") return elsif not object.is_a? LiquidContainer - @player.output("You cannot fill #{object.name} with liquids.") + self[:agent].output("You cannot fill #{object.name} with liquids.") return elsif from.nil? - @player.output "There isn't any #{event[:from]} around here." + self[:agent].output "There isn't any #{self[:from]} around here." return elsif not from.is_a? LiquidContainer - @player.output "You cannot fill #{object.name} from #{from.name}." + self[:agent].output "You cannot fill #{object.name} from #{from.name}." return elsif from.empty? - @player.output "That #{object.generic} is empty." + self[:agent].output "That #{object.generic} is empty." return elsif object.full? - @player.output("That #{object.generic} is full.") + self[:agent].output("That #{object.generic} is full.") return elsif object == from - @player.output "Quickly flipping #{object.name} upside-down then upright again, you manage to fill it from itself." + self[:agent].output "Quickly flipping #{object.name} upside-down then upright again, you manage to fill it from itself." return end end diff --git a/lib/aethyr/core/actions/commands/gait.rb b/lib/aethyr/core/actions/commands/gait.rb index 2aa1a71..dc5a57d 100644 --- a/lib/aethyr/core/actions/commands/gait.rb +++ b/lib/aethyr/core/actions/commands/gait.rb @@ -10,24 +10,24 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:phrase].nil? + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:phrase].nil? if player.info.entrance_message player.output "When you move, it looks something like:", true player.output player.exit_message("north") else player.output "You are walking normally." end - elsif event[:phrase].downcase == "none" + elsif self[:phrase].downcase == "none" player.info.entrance_message = nil player.info.exit_message = nil player.output "You will now walk normally." else - player.info.entrance_message = "#{event[:phrase]}, !name comes in from !direction." - player.info.exit_message = "#{event[:phrase]}, !name leaves to !direction." + player.info.entrance_message = "#{self[:phrase]}, !name comes in from !direction." + player.info.exit_message = "#{self[:phrase]}, !name leaves to !direction." player.output "When you move, it will now look something like:", true player.output player.exit_message("north") diff --git a/lib/aethyr/core/actions/commands/get.rb b/lib/aethyr/core/actions/commands/get.rb index dab0089..b9812a3 100644 --- a/lib/aethyr/core/actions/commands/get.rb +++ b/lib/aethyr/core/actions/commands/get.rb @@ -10,63 +10,63 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - if event[:from].nil? - object = $manager.find(event[:object], room) + + room = $manager.get_object(self[:agent].container) + if self[:from].nil? + object = $manager.find(self[:object], room) if object.nil? - @player.output("There is no #{event[:object]} to take.") + self[:agent].output("There is no #{self[:object]} to take.") return elsif not object.movable - @player.output("You cannot take #{object.name}.") + self[:agent].output("You cannot take #{object.name}.") return - elsif @player.inventory.full? - @player.output("You cannot hold any more objects.") + elsif self[:agent].inventory.full? + self[:agent].output("You cannot hold any more objects.") return end room.remove(object) - object.container = @player.goid - @player.inventory << object + object.container = self[:agent].goid + self[:agent].inventory << object - event[:to_player] = "You take #{object.name}." - event[:to_other] = "#{@player.name} takes #{object.name}." + self[:to_player] = "You take #{object.name}." + self[:to_other] = "#{self[:agent].name} takes #{object.name}." room.out_event(event) else - from = event[:from] + from = self[:from] container = $manager.find(from, room) - @player.inventory.find(from) if container.nil? + self[:agent].inventory.find(from) if container.nil? if container.nil? - @player.output("There is no #{from}.") + self[:agent].output("There is no #{from}.") return elsif not container.is_a? Container - @player.output("Not sure how to do that.") + self[:agent].output("Not sure how to do that.") return elsif container.can? :open and container.closed? - @player.output("You will need to open it first.") + self[:agent].output("You will need to open it first.") return end - object = $manager.find(event[:object], container) + object = $manager.find(self[:object], container) if object.nil? - @player.output("There is no #{event[:object]} in the #{container.name}.") + self[:agent].output("There is no #{self[:object]} in the #{container.name}.") return elsif not object.movable - @player.output("You cannot take the #{object.name}.") + self[:agent].output("You cannot take the #{object.name}.") return - elsif @player.inventory.full? - @player.output("You cannot hold any more objects.") + elsif self[:agent].inventory.full? + self[:agent].output("You cannot hold any more objects.") return end container.remove(object) - @player.inventory.add(object) + self[:agent].inventory.add(object) - event[:to_player] = "You take #{object.name} from #{container.name}." - event[:to_other] = "#{@player.name} takes #{object.name} from #{container.name}." + self[:to_player] = "You take #{object.name} from #{container.name}." + self[:to_other] = "#{self[:agent].name} takes #{object.name} from #{container.name}." room.out_event(event) end end diff --git a/lib/aethyr/core/actions/commands/give.rb b/lib/aethyr/core/actions/commands/give.rb index 45aa75c..4e8f661 100644 --- a/lib/aethyr/core/actions/commands/give.rb +++ b/lib/aethyr/core/actions/commands/give.rb @@ -10,24 +10,24 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - item = player.inventory.find(event[:item]) + + room = $manager.get_object(self[:agent].container) + item = player.inventory.find(self[:item]) if item.nil? - if response = player.equipment.worn_or_wielded?(event[:item]) + if response = player.equipment.worn_or_wielded?(self[:item]) player.output response else - player.output "You do not seem to have a #{event[:item]} to give away." + player.output "You do not seem to have a #{self[:item]} to give away." end return end - receiver = $manager.find(event[:to], room) + receiver = $manager.find(self[:to], room) if receiver.nil? - player.output("There is no #{event[:to]}.") + player.output("There is no #{self[:to]}.") return elsif not receiver.is_a? Player and not receiver.is_a? Mobile player.output("You cannot give anything to #{receiver.name}.") @@ -37,10 +37,10 @@ module Aethyr player.inventory.remove(item) receiver.inventory.add(item) - event[:target] = receiver - event[:to_player] = "You give #{item.name} to #{receiver.name}." - event[:to_target] = "#{player.name} gives you #{item.name}." - event[:to_other] = "#{player.name} gives #{item.name} to #{receiver.name}." + self[:target] = receiver + self[:to_player] = "You give #{item.name} to #{receiver.name}." + self[:to_target] = "#{player.name} gives you #{item.name}." + self[:to_other] = "#{player.name} gives #{item.name} to #{receiver.name}." room.out_event(event) end diff --git a/lib/aethyr/core/actions/commands/health.rb b/lib/aethyr/core/actions/commands/health.rb index d931936..eac7522 100644 --- a/lib/aethyr/core/actions/commands/health.rb +++ b/lib/aethyr/core/actions/commands/health.rb @@ -10,8 +10,8 @@ module Aethyr end def action - event = @data - @player.output "You are #{@player.health}." + + self[:agent].output "You are #{self[:agent].health}." end #Display hunger. end diff --git a/lib/aethyr/core/actions/commands/inventory.rb b/lib/aethyr/core/actions/commands/inventory.rb index afe765c..3f82567 100644 --- a/lib/aethyr/core/actions/commands/inventory.rb +++ b/lib/aethyr/core/actions/commands/inventory.rb @@ -10,7 +10,7 @@ module Aethyr end def action - event = @data + player.output(player.show_inventory) end end diff --git a/lib/aethyr/core/actions/commands/issue.rb b/lib/aethyr/core/actions/commands/issue.rb index 9c5980f..ed81ab7 100644 --- a/lib/aethyr/core/actions/commands/issue.rb +++ b/lib/aethyr/core/actions/commands/issue.rb @@ -10,62 +10,62 @@ module Aethyr end def action - event = @data - case event[:option] + + case self[:option] when "new" - issue = Issues.add_issue event[:itype], player.name, event[:value] - player.output "Thank you for submitting #{event[:itype]} ##{issue[:id]}." + issue = Issues.add_issue self[:itype], player.name, self[:value] + player.output "Thank you for submitting #{self[:itype]} ##{issue[:id]}." when "add" - if not event[:issue_id] - player.output "Please specify a #{event[:itype]} number." + if not self[:issue_id] + player.output "Please specify a #{self[:itype]} number." else - denied = Issues.check_access event[:itype], event[:issue_id], player + denied = Issues.check_access self[:itype], self[:issue_id], player if denied player.output denied else - player.output Issues.append_issue(event[:itype], event[:issue_id], player.name, event[:value]) + player.output Issues.append_issue(self[:itype], self[:issue_id], player.name, self[:value]) end end when "del" - if not event[:issue_id] - player.output "Please specify a #{event[:itype]} number." + if not self[:issue_id] + player.output "Please specify a #{self[:itype]} number." else - denied = Issues.check_access event[:itype], event[:issue_id], player + denied = Issues.check_access self[:itype], self[:issue_id], player if denied player.output denied else - player.output Issues.delete_issue(event[:itype], event[:issue_id]) + player.output Issues.delete_issue(self[:itype], self[:issue_id]) end end when "list" if player.admin - list = Issues.list_issues event[:itype] + list = Issues.list_issues self[:itype] else - list = Issues.list_issues event[:itype], player.name + list = Issues.list_issues self[:itype], player.name end if list.empty? - player.output "No #{event[:itype]}s to list." + player.output "No #{self[:itype]}s to list." else player.output list end when "show" - if not event[:issue_id] - player.output "Please specify a #{event[:itype]} number." + if not self[:issue_id] + player.output "Please specify a #{self[:itype]} number." else - denied = Issues.check_access event[:itype], event[:issue_id], player + denied = Issues.check_access self[:itype], self[:issue_id], player if denied player.output denied else - player.output Issues.show_issue(event[:itype], event[:issue_id]) + player.output Issues.show_issue(self[:itype], self[:issue_id]) end end when "status" if not player.admin - player.output "Only administrators may change a #{event[:itype]}'s status." - elsif not event[:issue_id] - player.output "Please specify a #{event[:itype]} number." + player.output "Only administrators may change a #{self[:itype]}'s status." + elsif not self[:issue_id] + player.output "Please specify a #{self[:itype]} number." else - player.output Issues.set_status(event[:itype], event[:issue_id], player.name, event[:value]) + player.output Issues.set_status(self[:itype], self[:issue_id], player.name, self[:value]) end end diff --git a/lib/aethyr/core/actions/commands/kick.rb b/lib/aethyr/core/actions/commands/kick.rb index a326619..854e59c 100644 --- a/lib/aethyr/core/actions/commands/kick.rb +++ b/lib/aethyr/core/actions/commands/kick.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] return if not Combat.ready? player target = (event.target && room.find(event.target)) || room.find(player.last_target) @@ -29,10 +29,10 @@ module Aethyr event.target = target - event[:to_other] = "#{player.name} kicks #{player.pronoun(:possessive)} foot out at #{target.name}." - event[:to_target] = "#{player.name} kicks #{player.pronoun(:possessive)} foot at you." - event[:to_player] = "You balance carefully and kick your foot out towards #{target.name}." - event[:blockable] = true + self[:to_other] = "#{player.name} kicks #{player.pronoun(:possessive)} foot out at #{target.name}." + self[:to_target] = "#{player.name} kicks #{player.pronoun(:possessive)} foot at you." + self[:to_player] = "You balance carefully and kick your foot out towards #{target.name}." + self[:blockable] = true player.balance = false player.info.in_combat = true @@ -40,11 +40,11 @@ module Aethyr room.out_event event - event[:action] = :martial_hit - event[:combat_action] = :kick - event[:to_other] = "#{player.name} kicks #{target.name} with considerable violence." - event[:to_target] = "#{player.name} kicks you rather violently." - event[:to_player] = "Your kick makes good contact with #{target.name}." + self[:action] = :martial_hit + self[:combat_action] = :kick + self[:to_other] = "#{player.name} kicks #{target.name} with considerable violence." + self[:to_target] = "#{player.name} kicks you rather violently." + self[:to_player] = "Your kick makes good contact with #{target.name}." Combat.future_event event end diff --git a/lib/aethyr/core/actions/commands/latest_news.rb b/lib/aethyr/core/actions/commands/latest_news.rb index 5af68eb..c798d7b 100644 --- a/lib/aethyr/core/actions/commands/latest_news.rb +++ b/lib/aethyr/core/actions/commands/latest_news.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] board = find_board(event, room) if board.nil? @@ -25,9 +25,9 @@ module Aethyr log board.class end - offset = event[:offset] || 0 + offset = self[:offset] || 0 wordwrap = player.word_wrap || 100 - limit = event[:limit] || player.page_height + limit = self[:limit] || player.page_height player.output board.list_latest(wordwrap, offset, limit) end diff --git a/lib/aethyr/core/actions/commands/list_unread.rb b/lib/aethyr/core/actions/commands/list_unread.rb index 67e39a8..6f6e02e 100644 --- a/lib/aethyr/core/actions/commands/list_unread.rb +++ b/lib/aethyr/core/actions/commands/list_unread.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] board = find_board(event, room) if board.nil? diff --git a/lib/aethyr/core/actions/commands/listen.rb b/lib/aethyr/core/actions/commands/listen.rb index 4591058..312d5af 100644 --- a/lib/aethyr/core/actions/commands/listen.rb +++ b/lib/aethyr/core/actions/commands/listen.rb @@ -10,39 +10,39 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - if event[:target].nil? - event[:target] = room + + room = $manager.get_object(self[:agent].container) + if self[:target].nil? + self[:target] = room if room.info.sound - event[:to_player] = "You listen carefully. #{room.info.sound}." + self[:to_player] = "You listen carefully. #{room.info.sound}." else - event[:to_player] = "You listen carefully but hear nothing unusual." + self[:to_player] = "You listen carefully but hear nothing unusual." end - event[:to_other] = "A look of concentration forms on #{@player.name}'s face as #{@player.pronoun} listens intently." + self[:to_other] = "A look of concentration forms on #{self[:agent].name}'s face as #{self[:agent].pronoun} listens intently." room.out_event event return end - object = @player.search_inv(event[:target]) || room.find(event[:target]) + object = self[:agent].search_inv(self[:target]) || room.find(self[:target]) - if object == @player or event[:target] == "me" - @player.output "Listening quietly, you can faintly hear your pulse." + if object == self[:agent] or self[:target] == "me" + self[:agent].output "Listening quietly, you can faintly hear your pulse." return elsif object.nil? - @player.output "What would you like to listen to?" + self[:agent].output "What would you like to listen to?" return end - event[:target] = object - event[:to_player] = "You bend your head towards #{object.name}. " + self[:target] = object + self[:to_player] = "You bend your head towards #{object.name}. " if object.info.sound.nil? or object.info.sound == "" - event[:to_player] << "#{object.pronoun.capitalize} emits no unusual sounds." + self[:to_player] << "#{object.pronoun.capitalize} emits no unusual sounds." else - event[:to_player] << object.info.sound + self[:to_player] << object.info.sound end - event[:to_target] = "#{@player.name} listens to you carefully." - event[:to_other] = "#{@player.name} bends #{@player.pronoun(:possessive)} head towards #{object.name} and listens." + self[:to_target] = "#{self[:agent].name} listens to you carefully." + self[:to_other] = "#{self[:agent].name} bends #{self[:agent].pronoun(:possessive)} head towards #{object.name} and listens." room.out_event event end end diff --git a/lib/aethyr/core/actions/commands/lock.rb b/lib/aethyr/core/actions/commands/lock.rb index 474d7c5..5fa5cfe 100644 --- a/lib/aethyr/core/actions/commands/lock.rb +++ b/lib/aethyr/core/actions/commands/lock.rb @@ -10,35 +10,35 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - object = @player.search_inv(event[:object]) || room.find(event[:object]) + + room = $manager.get_object(self[:agent].container) + object = self[:agent].search_inv(self[:object]) || room.find(self[:object]) if object.nil? - @player.output('Lock what?') + self[:agent].output('Lock what?') return elsif not object.can? :lock or not object.lockable? - @player.output('That object cannot be locked.') + self[:agent].output('That object cannot be locked.') return elsif object.locked? - @player.output("#{object.name} is already locked.") + self[:agent].output("#{object.name} is already locked.") return end has_key = false object.keys.each do |key| - if @player.inventory.include? key + if self[:agent].inventory.include? key has_key = key break end end - if has_key or @player.admin - status = object.lock(has_key, @player.admin) + if has_key or self[:agent].admin + status = object.lock(has_key, self[:agent].admin) if status - event[:to_player] = "You lock #{object.name}." - event[:to_other] = "#{@player.name} locks #{object.name}." - event[:to_blind_other] = "You hear the click of a lock." + self[:to_player] = "You lock #{object.name}." + self[:to_other] = "#{self[:agent].name} locks #{object.name}." + self[:to_blind_other] = "You hear the click of a lock." room.out_event(event) @@ -47,15 +47,15 @@ module Aethyr other_side.lock(has_key) other_room = $manager.find other_side.container o_event = event.dup - event[:to_other] = "#{other_side.name} locks from the other side." - event[:to_blind_other] = "You hear the click of a lock." + self[:to_other] = "#{other_side.name} locks from the other side." + self[:to_blind_other] = "You hear the click of a lock." other_room.out_event(event) end else - @player.output("You are unable to lock that #{object.name}.") + self[:agent].output("You are unable to lock that #{object.name}.") end else - @player.output("You do not have the key to that #{object.name}.") + self[:agent].output("You do not have the key to that #{object.name}.") end end diff --git a/lib/aethyr/core/actions/commands/look.rb b/lib/aethyr/core/actions/commands/look.rb index 1036385..193f64b 100644 --- a/lib/aethyr/core/actions/commands/look.rb +++ b/lib/aethyr/core/actions/commands/look.rb @@ -11,66 +11,66 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) + + room = $manager.get_object(self[:agent].container) pre_look_data = { :can_look => true } - @player.broadcast_from(:pre_look, pre_look_data) + self[:agent].broadcast_from(:pre_look, pre_look_data) if not pre_look_data[:can_look] if pre_look_data[:reason].nil? - @player.output "You cannot see." + self[:agent].output "You cannot see." else - @player.output blind_data[:reason] + self[:agent].output blind_data[:reason] end else - if event[:at] - object = room if event[:at] == "here" - object = object || @player.search_inv(event[:at]) || room.find(event[:at]) + if self[:at] + object = room if self[:at] == "here" + object = object || self[:agent].search_inv(self[:at]) || room.find(self[:at]) if object.nil? - @player.output("Look at what, again?") + self[:agent].output("Look at what, again?") return end if object.is_a? Exit - @player.output object.peer + self[:agent].output object.peer elsif object.is_a? Room - @player.output("You are indoors.", true) if object.info.terrain.indoors - @player.output("You are underwater.", true) if object.info.terrain.underwater - @player.output("You are swimming.", true) if object.info.terrain.water + self[:agent].output("You are indoors.", true) if object.info.terrain.indoors + self[:agent].output("You are underwater.", true) if object.info.terrain.underwater + self[:agent].output("You are swimming.", true) if object.info.terrain.water - @player.output "You are in a place called #{room.name} in #{room.area ? room.area.name : "an unknown area"}.", true + self[:agent].output "You are in a place called #{room.name} in #{room.area ? room.area.name : "an unknown area"}.", true if room.area - @player.output "The area is generally #{describe_area(room.area)} and this spot is #{describe_area(room)}." + self[:agent].output "The area is generally #{describe_area(room.area)} and this spot is #{describe_area(room)}." elsif room.info.terrain.room_type - @player.output "Where you are standing is considered to be #{describe_area(room)}." + self[:agent].output "Where you are standing is considered to be #{describe_area(room)}." else - @player.output "You are unsure about anything else concerning the area." + self[:agent].output "You are unsure about anything else concerning the area." end - elsif @player == object - @player.output "You look over yourself and see:\n#{@player.instance_variable_get("@long_desc")}", true - @player.output object.show_inventory + elsif self[:agent] == object + self[:agent].output "You look over yourself and see:\n#{self[:agent].instance_variable_get("@long_desc")}", true + self[:agent].output object.show_inventory else - @player.output object.long_desc + self[:agent].output object.long_desc end - elsif event[:in] - object = room.find(event[:in]) - object = @player.inventory.find(event[:in]) if object.nil? + elsif self[:in] + object = room.find(self[:in]) + object = self[:agent].inventory.find(self[:in]) if object.nil? if object.nil? - @player.output("Look inside what?") + self[:agent].output("Look inside what?") elsif not object.can? :look_inside - @player.output("You cannot look inside that.") + self[:agent].output("You cannot look inside that.") else object.look_inside(event) end else if not room.nil? - look_text = room.look(@player) - @player.output(look_text) + look_text = room.look(self[:agent]) + self[:agent].output(look_text) else - @player.output "Nothing to look at." + self[:agent].output "Nothing to look at." end end end diff --git a/lib/aethyr/core/actions/commands/map.rb b/lib/aethyr/core/actions/commands/map.rb index c8c5728..ece990f 100644 --- a/lib/aethyr/core/actions/commands/map.rb +++ b/lib/aethyr/core/actions/commands/map.rb @@ -10,9 +10,9 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - @player.output(room.area.render_map(@player, room.area.position(room))) + + room = $manager.get_object(self[:agent].container) + self[:agent].output(room.area.render_map(self[:agent], room.area.position(room))) end end end diff --git a/lib/aethyr/core/actions/commands/more.rb b/lib/aethyr/core/actions/commands/more.rb index 9a92180..87f329b 100644 --- a/lib/aethyr/core/actions/commands/more.rb +++ b/lib/aethyr/core/actions/commands/more.rb @@ -10,7 +10,7 @@ module Aethyr end def action - event = @data + player.more end end diff --git a/lib/aethyr/core/actions/commands/move.rb b/lib/aethyr/core/actions/commands/move.rb index 3bc7c7d..653c991 100644 --- a/lib/aethyr/core/actions/commands/move.rb +++ b/lib/aethyr/core/actions/commands/move.rb @@ -10,36 +10,35 @@ module Aethyr end def action - event = @data.dup - room = $manager.get_object(@player.container) - exit = room.exit(event[:direction]) + room = $manager.get_object(self[:agent].container) + exit = room.exit(self[:direction]) if exit.nil? - @player.output("You cannot go #{event[:direction]}.") + self[:agent].output("You cannot go #{self[:direction]}.") return elsif exit.can? :open and not exit.open? - @player.output("That exit is closed. Perhaps you should open it?") + self[:agent].output("That exit is closed. Perhaps you should open it?") return end new_room = $manager.find(exit.exit_room) if new_room.nil? - @player.output("That exit #{exit.name} leads into the void.") + self[:agent].output("That exit #{exit.name} leads into the void.") return end - room.remove(@player) - new_room.add(@player) - @player.container = new_room.game_object_id - event[:to_player] = "You move #{event[:direction]}." - event[:to_other] = "#{@player.name} leaves #{event[:direction]}." - event[:to_blind_other] = "You hear someone leave." + room.remove(self[:agent]) + new_room.add(self[:agent]) + self[:agent].container = new_room.game_object_id + self[:to_player] = "You move #{self[:direction]}." + self[:to_other] = "#{self[:agent].name} leaves #{self[:direction]}." + self[:to_blind_other] = "You hear someone leave." room.out_event(event) - look_text = new_room.look(@player) + look_text = new_room.look(self[:agent]) out_text = Window.split_message(look_text, 79).join("\n") - @player.output(out_text, message_type: :look, internal_clear: true) + self[:agent].output(out_text, message_type: :look, internal_clear: true) end end end diff --git a/lib/aethyr/core/actions/commands/open.rb b/lib/aethyr/core/actions/commands/open.rb index 0524510..c3741a8 100644 --- a/lib/aethyr/core/actions/commands/open.rb +++ b/lib/aethyr/core/actions/commands/open.rb @@ -10,9 +10,9 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - object = expand_direction(event[:object]) + + room = $manager.get_object(self[:agent].container) + object = expand_direction(self[:object]) object = player.search_inv(object) || $manager.find(object, room) if object.nil? diff --git a/lib/aethyr/core/actions/commands/portal.rb b/lib/aethyr/core/actions/commands/portal.rb index 849e4f4..bd5848e 100644 --- a/lib/aethyr/core/actions/commands/portal.rb +++ b/lib/aethyr/core/actions/commands/portal.rb @@ -10,22 +10,22 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - object = find_object(event[:object], event) + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + object = find_object(self[:object], event) if object.nil? - player.output "Cannot find #{event[:object]}" + player.output "Cannot find #{self[:object]}" return elsif not object.is_a? Portal player.output "That is not a portal." return end - value = event[:value] + value = self[:value] - case event[:setting] + case self[:setting] when "action" value.downcase! if value == "enter" diff --git a/lib/aethyr/core/actions/commands/pose.rb b/lib/aethyr/core/actions/commands/pose.rb index 83f1be5..554c027 100644 --- a/lib/aethyr/core/actions/commands/pose.rb +++ b/lib/aethyr/core/actions/commands/pose.rb @@ -10,16 +10,16 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:pose].downcase == "none" + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:pose].downcase == "none" player.pose = nil player.output "You are no longer posing." else - player.pose = event[:pose] - player.output "Your pose is now: #{event[:pose]}." + player.pose = self[:pose] + player.output "Your pose is now: #{self[:pose]}." end end diff --git a/lib/aethyr/core/actions/commands/punch.rb b/lib/aethyr/core/actions/commands/punch.rb index 0cf8805..f6f10ae 100644 --- a/lib/aethyr/core/actions/commands/punch.rb +++ b/lib/aethyr/core/actions/commands/punch.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] return unless Combat.ready? player target = (event.target && room.find(event.target)) || room.find(player.last_target) @@ -29,10 +29,10 @@ module Aethyr event.target = target - event[:to_other] = "#{player.name} swings #{player.pronoun(:possessive)} clenched fist at #{target.name}." - event[:to_target] = "#{player.name} swings #{player.pronoun(:possessive)} fist straight towards your face." - event[:to_player] = "You clench your hand into a fist and swing it at #{target.name}." - event[:blockable] = true + self[:to_other] = "#{player.name} swings #{player.pronoun(:possessive)} clenched fist at #{target.name}." + self[:to_target] = "#{player.name} swings #{player.pronoun(:possessive)} fist straight towards your face." + self[:to_player] = "You clench your hand into a fist and swing it at #{target.name}." + self[:blockable] = true player.balance = false player.info.in_combat = true @@ -40,11 +40,11 @@ module Aethyr room.out_event event - event[:action] = :martial_hit - event[:combat_action] = :punch - event[:to_other] = "#{player.name} punches #{target.name} directly in the face." - event[:to_target] = "You stagger slightly as #{player.name} punches you in the face." - event[:to_player] = "Your fist lands squarely in #{target.name}'s face." + self[:action] = :martial_hit + self[:combat_action] = :punch + self[:to_other] = "#{player.name} punches #{target.name} directly in the face." + self[:to_target] = "You stagger slightly as #{player.name} punches you in the face." + self[:to_player] = "Your fist lands squarely in #{target.name}'s face." Combat.future_event event end diff --git a/lib/aethyr/core/actions/commands/put.rb b/lib/aethyr/core/actions/commands/put.rb index 593563c..caab718 100644 --- a/lib/aethyr/core/actions/commands/put.rb +++ b/lib/aethyr/core/actions/commands/put.rb @@ -10,38 +10,38 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - item = @player.inventory.find(event[:item]) + + room = $manager.get_object(self[:agent].container) + item = self[:agent].inventory.find(self[:item]) if item.nil? - if response = @player.equipment.worn_or_wielded?(event[:item]) - @player.output response + if response = self[:agent].equipment.worn_or_wielded?(self[:item]) + self[:agent].output response else - @player.output "You do not seem to have a #{event[:item]}." + self[:agent].output "You do not seem to have a #{self[:item]}." end return end - container = @player.search_inv(event[:container]) || $manager.find(event[:container], room) + container = self[:agent].search_inv(self[:container]) || $manager.find(self[:container], room) if container.nil? - @player.output("There is no #{event[:container]} in which to put #{item.name}.") + self[:agent].output("There is no #{self[:container]} in which to put #{item.name}.") return elsif not container.is_a? Container - @player.output("You cannot put anything in #{container.name}.") + self[:agent].output("You cannot put anything in #{container.name}.") return elsif container.can? :open and container.closed? - @player.output("You need to open #{container.name} first.") + self[:agent].output("You need to open #{container.name} first.") return end - @player.inventory.remove(item) + self[:agent].inventory.remove(item) container.add(item) - event[:to_player] = "You put #{item.name} in #{container.name}." - event[:to_other] = "#{@player.name} puts #{item.name} in #{container.name}" + self[:to_player] = "You put #{item.name} in #{container.name}." + self[:to_other] = "#{self[:agent].name} puts #{item.name} in #{container.name}" room.out_event(event) end diff --git a/lib/aethyr/core/actions/commands/quit.rb b/lib/aethyr/core/actions/commands/quit.rb index 1551ec4..d6a89b8 100644 --- a/lib/aethyr/core/actions/commands/quit.rb +++ b/lib/aethyr/core/actions/commands/quit.rb @@ -10,8 +10,8 @@ module Aethyr end def action - event = @data - $manager.drop_player @player + + $manager.drop_player self[:agent] end end end diff --git a/lib/aethyr/core/actions/commands/read_post.rb b/lib/aethyr/core/actions/commands/read_post.rb index 6e5a73e..2eccfa6 100644 --- a/lib/aethyr/core/actions/commands/read_post.rb +++ b/lib/aethyr/core/actions/commands/read_post.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] board = find_board(event, room) if board.nil? @@ -21,7 +21,7 @@ module Aethyr return end - post = board.get_post event[:post_id] + post = board.get_post self[:post_id] if post.nil? player.output "No such posting here." return @@ -31,7 +31,7 @@ module Aethyr player.info.boards = {} end - player.info.boards[board.goid] = event[:post_id].to_i + player.info.boards[board.goid] = self[:post_id].to_i player.output board.show_post(post, player.word_wrap || 80) end diff --git a/lib/aethyr/core/actions/commands/remove.rb b/lib/aethyr/core/actions/commands/remove.rb index 598cbef..dacaf0e 100644 --- a/lib/aethyr/core/actions/commands/remove.rb +++ b/lib/aethyr/core/actions/commands/remove.rb @@ -10,15 +10,15 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - object = player.equipment.find(event[:object]) + room = $manager.get_object(self[:agent].container) + player = self[:agent] + + object = player.equipment.find(self[:object]) if object.nil? - player.output("What #{event[:object]} are you trying to remove?") + player.output("What #{self[:object]} are you trying to remove?") return end @@ -32,11 +32,11 @@ module Aethyr return end - response = player.remove(object, event[:position]) + response = player.remove(object, self[:position]) if response - event[:to_player] = "You remove #{object.name}." - event[:to_other] = "#{player.name} removes #{object.name}." + self[:to_player] = "You remove #{object.name}." + self[:to_other] = "#{player.name} removes #{object.name}." room.out_event(event) else player.output "Could not remove #{object.name} for some reason." diff --git a/lib/aethyr/core/actions/commands/reply.rb b/lib/aethyr/core/actions/commands/reply.rb index d1dc5f5..42f3a36 100644 --- a/lib/aethyr/core/actions/commands/reply.rb +++ b/lib/aethyr/core/actions/commands/reply.rb @@ -10,13 +10,13 @@ module Aethyr end def action - event = @data - unless @player.reply_to - @player.output "There is no one to reply to." + + unless self[:agent].reply_to + self[:agent].output "There is no one to reply to." return end - event[:target] = @player.reply_to + self[:target] = self[:agent].reply_to action_tell(event) end diff --git a/lib/aethyr/core/actions/commands/restart.rb b/lib/aethyr/core/actions/commands/restart.rb index a0bc9a8..5aa1ce2 100644 --- a/lib/aethyr/core/actions/commands/restart.rb +++ b/lib/aethyr/core/actions/commands/restart.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] $manager.restart end diff --git a/lib/aethyr/core/actions/commands/satiety.rb b/lib/aethyr/core/actions/commands/satiety.rb index 62777a5..4318125 100644 --- a/lib/aethyr/core/actions/commands/satiety.rb +++ b/lib/aethyr/core/actions/commands/satiety.rb @@ -10,8 +10,8 @@ module Aethyr end def action - event = @data - @player.output "You are #{@player.satiety}." + + self[:agent].output "You are #{self[:agent].satiety}." end #Display status. end diff --git a/lib/aethyr/core/actions/commands/say.rb b/lib/aethyr/core/actions/commands/say.rb index a26d611..9b60ba6 100644 --- a/lib/aethyr/core/actions/commands/say.rb +++ b/lib/aethyr/core/actions/commands/say.rb @@ -10,12 +10,11 @@ module Aethyr end def action - event = @data.dup - room = $manager.get_object(@player.container) + room = $manager.get_object(self[:agent].container) - phrase = event[:phrase] - target = event[:target] && room.find(event[:target]) - prefix = event[:pre] + phrase = self[:phrase] + target = self[:target] && room.find(self[:target]) + prefix = self[:pre] if prefix prefix << ", " @@ -24,13 +23,13 @@ module Aethyr end if phrase.nil? - @player.output("Huh?") + self[:agent].output("Huh?") return - elsif event[:target] and target.nil? - @player.output("Say what to whom?") + elsif self[:target] and target.nil? + self[:agent].output("Say what to whom?") return - elsif target and target == @player - @player.output "Talking to yourself again?" + elsif target and target == self[:agent] + self[:agent].output "Talking to yourself again?" return elsif target to_clause = " to #{target.name}" @@ -51,7 +50,7 @@ module Aethyr rvoice = "frowns and " pvoice = "frown and " when /:D$/ - rvoice = "laughs as #{@player.pronoun} " + rvoice = "laughs as #{self[:agent].pronoun} " pvoice = "laugh as you " else rvoice = "" @@ -78,30 +77,30 @@ module Aethyr phrase = "<say>\"#{phrase}#{ender}\"</say>" - event[:message_type] = :chat - event[:target] = target + self[:message_type] = :chat + self[:target] = target if target and pvoice == "ask" - event[:to_target] = prefix + "#{@player.name} #{rvoice} you, #{phrase}" - event[:to_player] = prefix + "you #{pvoice} #{target.name}, #{phrase}" - event[:to_other] = prefix + "#{@player.name} #{rvoice} #{target.name}, #{phrase}" - event[:to_blind_target] = "Someone asks, #{phrase}" - event[:to_blind_other] = "Someone asks, #{phrase}" - event[:to_deaf_target] = "#{@player.name} seems to be asking you something." - event[:to_deaf_other] = "#{@player.name} seems to be asking #{target.name} something." + self[:to_target] = prefix + "#{self[:agent].name} #{rvoice} you, #{phrase}" + self[:to_player] = prefix + "you #{pvoice} #{target.name}, #{phrase}" + self[:to_other] = prefix + "#{self[:agent].name} #{rvoice} #{target.name}, #{phrase}" + self[:to_blind_target] = "Someone asks, #{phrase}" + self[:to_blind_other] = "Someone asks, #{phrase}" + self[:to_deaf_target] = "#{self[:agent].name} seems to be asking you something." + self[:to_deaf_other] = "#{self[:agent].name} seems to be asking #{target.name} something." elsif target - event[:to_target] = prefix + "#{@player.name} #{rvoice} to you, #{phrase}" - event[:to_player] = prefix + "you #{pvoice} to #{target.name}, #{phrase}" - event[:to_other] = prefix + "#{@player.name} #{rvoice} to #{target.name}, #{phrase}" - event[:to_blind_target] = "Someone #{rvoice}, #{phrase}" - event[:to_blind_other] = "Someone #{rvoice}, #{phrase}" - event[:to_deaf_target] = "You see #{@player.name} say something to you." - event[:to_deaf_other] = "You see #{@player.name} say something to #{target.name}." + self[:to_target] = prefix + "#{self[:agent].name} #{rvoice} to you, #{phrase}" + self[:to_player] = prefix + "you #{pvoice} to #{target.name}, #{phrase}" + self[:to_other] = prefix + "#{self[:agent].name} #{rvoice} to #{target.name}, #{phrase}" + self[:to_blind_target] = "Someone #{rvoice}, #{phrase}" + self[:to_blind_other] = "Someone #{rvoice}, #{phrase}" + self[:to_deaf_target] = "You see #{self[:agent].name} say something to you." + self[:to_deaf_other] = "You see #{self[:agent].name} say something to #{target.name}." else - event[:to_player] = prefix + "you #{pvoice}, #{phrase}" - event[:to_other] = prefix + "#{@player.name} #{rvoice}, #{phrase}" - event[:to_blind_other] = "Someone #{rvoice}, #{phrase}" - event[:to_deaf_target] = "You see #{@player.name} say something." - event[:to_deaf_other] = "You see #{@player.name} say something." + self[:to_player] = prefix + "you #{pvoice}, #{phrase}" + self[:to_other] = prefix + "#{self[:agent].name} #{rvoice}, #{phrase}" + self[:to_blind_other] = "Someone #{rvoice}, #{phrase}" + self[:to_deaf_target] = "You see #{self[:agent].name} say something." + self[:to_deaf_other] = "You see #{self[:agent].name} say something." end room.out_event(event) diff --git a/lib/aethyr/core/actions/commands/set.rb b/lib/aethyr/core/actions/commands/set.rb index 0b36928..dfa89da 100644 --- a/lib/aethyr/core/actions/commands/set.rb +++ b/lib/aethyr/core/actions/commands/set.rb @@ -10,14 +10,14 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - event[:setting].downcase! - case event[:setting] + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + self[:setting].downcase! + case self[:setting] when 'wordwrap' - value = event[:value] + value = self[:value] if player.word_wrap.nil? player.output("Word wrap is currently off.", true) else @@ -43,7 +43,7 @@ module Aethyr end end when 'pagelength', "page_length" - value = event[:value] + value = self[:value] if player.page_height.nil? player.output("Pagination is currently off.", true) else @@ -77,7 +77,7 @@ module Aethyr player.output("Set description to:\r\n#{player.long_desc}") end when "layout" - case event[:value].downcase + case self[:value].downcase when "basic" player.layout = :basic when "partial" @@ -90,7 +90,7 @@ module Aethyr player.output "#{value} is not a valid layout please set one of the following: basic, partial, full, wide." end else - player.output "No such setting: #{event[:setting]}" + player.output "No such setting: #{self[:setting]}" end end diff --git a/lib/aethyr/core/actions/commands/setcolor.rb b/lib/aethyr/core/actions/commands/setcolor.rb index 7984319..d790c37 100644 --- a/lib/aethyr/core/actions/commands/setcolor.rb +++ b/lib/aethyr/core/actions/commands/setcolor.rb @@ -10,21 +10,21 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:option] == "off" + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:option] == "off" player.io.use_color = false player.output "Colors disabled." - elsif event[:option] == "on" + elsif self[:option] == "on" player.io.use_color = true player.output "Colors enabled." - elsif event[:option] == "default" + elsif self[:option] == "default" player.io.to_default player.output "Colors set to defaults." else - player.output player.io.set_color(event[:option], event[:color]) + player.output player.io.set_color(self[:option], self[:color]) end end diff --git a/lib/aethyr/core/actions/commands/setpassword.rb b/lib/aethyr/core/actions/commands/setpassword.rb index dfb6fcd..433e8b0 100644 --- a/lib/aethyr/core/actions/commands/setpassword.rb +++ b/lib/aethyr/core/actions/commands/setpassword.rb @@ -10,16 +10,16 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:new_password] - if event[:new_password] !~ /^\w{6,20}$/ + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:new_password] + if self[:new_password] !~ /^\w{6,20}$/ player.output "Please only use letters and numbers. Password should be between 6 and 20 characters long." return else - $manager.set_password(player, event[:new_password]) + $manager.set_password(player, self[:new_password]) player.output "Your password has been changed." end else @@ -31,7 +31,7 @@ module Aethyr player.io.echo_off player.expect do |password| player.io.echo_on - event[:new_password] = password + self[:new_password] = password Settings.setpassword(event, player, room) end else diff --git a/lib/aethyr/core/actions/commands/showcolors.rb b/lib/aethyr/core/actions/commands/showcolors.rb index 3606bd4..8bdd110 100644 --- a/lib/aethyr/core/actions/commands/showcolors.rb +++ b/lib/aethyr/core/actions/commands/showcolors.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] player.output player.io.display.show_color_config end diff --git a/lib/aethyr/core/actions/commands/simple_block.rb b/lib/aethyr/core/actions/commands/simple_block.rb index da58f6f..b1451bc 100644 --- a/lib/aethyr/core/actions/commands/simple_block.rb +++ b/lib/aethyr/core/actions/commands/simple_block.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] return if not Combat.ready? player @@ -47,17 +47,17 @@ module Aethyr b_event = events[0] if rand > 0.5 - b_event[:action] = :weapon_block - b_event[:type] = :WeaponCombat - b_event[:to_other] = "#{player.name} deftly blocks #{target.name}'s attack with #{weapon.name}." - b_event[:to_player] = "#{player.name} deftly blocks your attack with #{weapon.name}." - b_event[:to_target] = "You deftly block #{target.name}'s attack with #{weapon.name}." + b_self[:action] = :weapon_block + b_self[:type] = :WeaponCombat + b_self[:to_other] = "#{player.name} deftly blocks #{target.name}'s attack with #{weapon.name}." + b_self[:to_player] = "#{player.name} deftly blocks your attack with #{weapon.name}." + b_self[:to_target] = "You deftly block #{target.name}'s attack with #{weapon.name}." end - event[:target] = target - event[:to_other] = "#{player.name} raises #{player.pronoun(:possessive)} #{weapon.generic} to block #{target.name}'s attack." - event[:to_target] = "#{player.name} raises #{player.pronoun(:possessive)} #{weapon.generic} to block your attack." - event[:to_player] = "You raise your #{weapon.generic} to block #{target.name}'s attack." + self[:target] = target + self[:to_other] = "#{player.name} raises #{player.pronoun(:possessive)} #{weapon.generic} to block #{target.name}'s attack." + self[:to_target] = "#{player.name} raises #{player.pronoun(:possessive)} #{weapon.generic} to block your attack." + self[:to_player] = "You raise your #{weapon.generic} to block #{target.name}'s attack." player.balance = false room.out_event event diff --git a/lib/aethyr/core/actions/commands/simple_dodge.rb b/lib/aethyr/core/actions/commands/simple_dodge.rb index a8c1ec9..1b993fc 100644 --- a/lib/aethyr/core/actions/commands/simple_dodge.rb +++ b/lib/aethyr/core/actions/commands/simple_dodge.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] return unless Combat.ready? player target = (event.target && room.find(event.target)) || room.find(player.last_target) @@ -40,17 +40,17 @@ module Aethyr b_event = events[0] if rand > 0.5 - b_event[:action] = :martial_miss - b_event[:type] = :MartialCombat - b_event[:to_other] = "#{player.name} twists away from #{target.name}'s attack." - b_event[:to_player] = "#{player.name} twists away from your attack." - b_event[:to_target] = "You manage to twist your body away from #{target.name}'s attack." + b_self[:action] = :martial_miss + b_self[:type] = :MartialCombat + b_self[:to_other] = "#{player.name} twists away from #{target.name}'s attack." + b_self[:to_player] = "#{player.name} twists away from your attack." + b_self[:to_target] = "You manage to twist your body away from #{target.name}'s attack." end - event[:target] = target - event[:to_other] = "#{player.name} attempts to dodge #{target.name}'s attack." - event[:to_target] = "#{player.name} attempts to dodge your attack." - event[:to_player] = "You attempt to dodge #{target.name}'s attack." + self[:target] = target + self[:to_other] = "#{player.name} attempts to dodge #{target.name}'s attack." + self[:to_target] = "#{player.name} attempts to dodge your attack." + self[:to_player] = "You attempt to dodge #{target.name}'s attack." player.balance = false room.out_event event diff --git a/lib/aethyr/core/actions/commands/sit.rb b/lib/aethyr/core/actions/commands/sit.rb index 74ee9a6..b64ea28 100644 --- a/lib/aethyr/core/actions/commands/sit.rb +++ b/lib/aethyr/core/actions/commands/sit.rb @@ -10,31 +10,31 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] if not player.balance player.output "You cannot sit properly while unbalanced." return - elsif event[:object].nil? + elsif self[:object].nil? if player.sitting? player.output('You are already sitting down.') elsif player.prone? and player.sit - event[:to_player] = 'You stand up then sit on the ground.' - event[:to_other] = "#{player.name} stands up then sits down on the ground." - event[:to_deaf_other] = event[:to_other] + self[:to_player] = 'You stand up then sit on the ground.' + self[:to_other] = "#{player.name} stands up then sits down on the ground." + self[:to_deaf_other] = self[:to_other] room.output(event) elsif player.sit - event[:to_player] = 'You sit down on the ground.' - event[:to_other] = "#{player.name} sits down on the ground." - event[:to_deaf_other] = event[:to_other] + self[:to_player] = 'You sit down on the ground.' + self[:to_other] = "#{player.name} sits down on the ground." + self[:to_deaf_other] = self[:to_other] room.out_event(event) else player.output('You are unable to sit down.') end else - object = $manager.find(event[:object], player.room) + object = $manager.find(self[:object], player.room) if object.nil? player.output('What do you want to sit on?') @@ -46,9 +46,9 @@ module Aethyr player.output("The #{object.generic} #{object.plural? ? "are" : "is"} already occupied.") elsif player.sit(object) object.sat_on_by(player) - event[:to_player] = "You sit down on #{object.name}." - event[:to_other] = "#{player.name} sits down on #{object.name}." - event[:to_deaf_other] = event[:to_other] + self[:to_player] = "You sit down on #{object.name}." + self[:to_other] = "#{player.name} sits down on #{object.name}." + self[:to_deaf_other] = self[:to_other] room.out_event(event) else player.output('You are unable to sit down.') diff --git a/lib/aethyr/core/actions/commands/skills.rb b/lib/aethyr/core/actions/commands/skills.rb index 1a60014..bb74575 100644 --- a/lib/aethyr/core/actions/commands/skills.rb +++ b/lib/aethyr/core/actions/commands/skills.rb @@ -11,11 +11,11 @@ module Aethyr end def action - event = @data + box_width = 25 box_work_width = box_width - 2 - width = @player.word_wrap - width = 200 if @player.word_wrap.nil? + width = self[:agent].word_wrap + width = 200 if self[:agent].word_wrap.nil? boxes_per_row = width / box_width box_top = "┌" + ("─" * box_work_width) + "â”\n" @@ -24,7 +24,7 @@ module Aethyr output = "" text_format = "%-#{box_work_width}.#{box_work_width}s" text_format_right = "%#{box_work_width}.#{box_work_width}s" - @player.info.skills.each do |id, skill| + self[:agent].info.skills.each do |id, skill| output += box_top @@ -54,7 +54,7 @@ module Aethyr output += box_bottom + "\n" end - @player.output(output) + self[:agent].output(output) end private diff --git a/lib/aethyr/core/actions/commands/slash.rb b/lib/aethyr/core/actions/commands/slash.rb index 07b63c6..68cc61a 100644 --- a/lib/aethyr/core/actions/commands/slash.rb +++ b/lib/aethyr/core/actions/commands/slash.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] return if not Combat.ready? player @@ -36,11 +36,11 @@ module Aethyr event.target = target - event[:to_other] = "#{weapon.name} flashes as #{player.name} swings it at #{target.name}." - event[:to_target] = "#{weapon.name} flashes as #{player.name} swings it towards you." - event[:to_player] = "#{weapon.name} flashes as you swing it towards #{target.name}." - event[:attack_weapon] = weapon - event[:blockable] = true + self[:to_other] = "#{weapon.name} flashes as #{player.name} swings it at #{target.name}." + self[:to_target] = "#{weapon.name} flashes as #{player.name} swings it towards you." + self[:to_player] = "#{weapon.name} flashes as you swing it towards #{target.name}." + self[:attack_weapon] = weapon + self[:blockable] = true player.balance = false player.info.in_combat = true @@ -48,11 +48,11 @@ module Aethyr room.out_event event - event[:action] = :weapon_hit - event[:combat_action] = :slash - event[:to_other] = "#{player.name} slashes across #{target.name}'s torso with #{weapon.name}." - event[:to_target] = "#{player.name} slashes across your torso with #{weapon.name}." - event[:to_player] = "You slash across #{target.name}'s torso with #{weapon.name}." + self[:action] = :weapon_hit + self[:combat_action] = :slash + self[:to_other] = "#{player.name} slashes across #{target.name}'s torso with #{weapon.name}." + self[:to_target] = "#{player.name} slashes across your torso with #{weapon.name}." + self[:to_player] = "You slash across #{target.name}'s torso with #{weapon.name}." Combat.future_event event diff --git a/lib/aethyr/core/actions/commands/smell.rb b/lib/aethyr/core/actions/commands/smell.rb index accfd60..c5537b3 100644 --- a/lib/aethyr/core/actions/commands/smell.rb +++ b/lib/aethyr/core/actions/commands/smell.rb @@ -10,47 +10,47 @@ module Aethyr end def action - event = @data.dup - room = $manager.get_object(@player.container) - if event[:target].nil? + + room = $manager.get_object(self[:agent].container) + if self[:target].nil? if room.info.smell - event[:to_player] = "You sniff the air. #{room.info.smell}." + self[:to_player] = "You sniff the air. #{room.info.smell}." else - event[:to_player] = "You sniff the air, but detect no unusual aromas." + self[:to_player] = "You sniff the air, but detect no unusual aromas." end - event[:to_other] = "#{@player.name} sniffs the air." + self[:to_other] = "#{self[:agent].name} sniffs the air." room.out_event event return end - object = @player.search_inv(event[:target]) || room.find(event[:target]) + object = self[:agent].search_inv(self[:target]) || room.find(self[:target]) - if object == @player or event[:target] == "me" - event[:target] = @player - event[:to_player] = "You cautiously sniff your armpits. " + if object == self[:agent] or self[:target] == "me" + self[:target] = self[:agent] + self[:to_player] = "You cautiously sniff your armpits. " if rand > 0.6 - event[:to_player] << "Your head snaps back from the revolting stench coming from beneath your arms." - event[:to_other] = "#{@player.name} sniffs #{@player.pronoun(:possessive)} armpits, then recoils in horror." + self[:to_player] << "Your head snaps back from the revolting stench coming from beneath your arms." + self[:to_other] = "#{self[:agent].name} sniffs #{self[:agent].pronoun(:possessive)} armpits, then recoils in horror." else - event[:to_player] << "Meh, not too bad." - event[:to_other] = "#{@player.name} sniffs #{@player.pronoun(:possessive)} armpits, then shrugs, apparently unconcerned with #{@player.pronoun(:possessive)} current smell." + self[:to_player] << "Meh, not too bad." + self[:to_other] = "#{self[:agent].name} sniffs #{self[:agent].pronoun(:possessive)} armpits, then shrugs, apparently unconcerned with #{self[:agent].pronoun(:possessive)} current smell." end room.out_event event return elsif object.nil? - @player.output "What are you trying to smell?" + self[:agent].output "What are you trying to smell?" return end - event[:target] = object - event[:to_player] = "Leaning in slightly, you sniff #{object.name}. " + self[:target] = object + self[:to_player] = "Leaning in slightly, you sniff #{object.name}. " if object.info.smell.nil? or object.info.smell == "" - event[:to_player] << "#{object.pronoun.capitalize} has no particular aroma." + self[:to_player] << "#{object.pronoun.capitalize} has no particular aroma." else - event[:to_player] << object.info.smell + self[:to_player] << object.info.smell end - event[:to_target] = "#{@player.name} sniffs you curiously." - event[:to_other] = "#{@player.name} thrusts #{@player.pronoun(:possessive)} nose at #{object.name} and sniffs." + self[:to_target] = "#{self[:agent].name} sniffs you curiously." + self[:to_other] = "#{self[:agent].name} thrusts #{self[:agent].pronoun(:possessive)} nose at #{object.name} and sniffs." room.out_event event end end diff --git a/lib/aethyr/core/actions/commands/stand.rb b/lib/aethyr/core/actions/commands/stand.rb index bcdf67e..11478fe 100644 --- a/lib/aethyr/core/actions/commands/stand.rb +++ b/lib/aethyr/core/actions/commands/stand.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] if not player.prone? player.output('You are already on your feet.') return @@ -29,9 +29,9 @@ module Aethyr end if player.stand - event[:to_player] = 'You rise to your feet.' - event[:to_other] = "#{player.name} stands up." - event[:to_deaf_other] = event[:to_other] + self[:to_player] = 'You rise to your feet.' + self[:to_other] = "#{player.name} stands up." + self[:to_deaf_other] = self[:to_other] room.out_event(event) object.evacuated_by(player) unless object.nil? else diff --git a/lib/aethyr/core/actions/commands/status.rb b/lib/aethyr/core/actions/commands/status.rb index 0c7d93b..67666e6 100644 --- a/lib/aethyr/core/actions/commands/status.rb +++ b/lib/aethyr/core/actions/commands/status.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - @player.output("You are #{@player.health}.") - @player.output("You are feeling #{@player.satiety}.") - @player.output "You are currently #{@player.pose || 'standing up'}." + + self[:agent].output("You are #{self[:agent].health}.") + self[:agent].output("You are feeling #{self[:agent].satiety}.") + self[:agent].output "You are currently #{self[:agent].pose || 'standing up'}." end #Fill something. end diff --git a/lib/aethyr/core/actions/commands/taste.rb b/lib/aethyr/core/actions/commands/taste.rb index bb7ba8e..7e399ec 100644 --- a/lib/aethyr/core/actions/commands/taste.rb +++ b/lib/aethyr/core/actions/commands/taste.rb @@ -10,27 +10,27 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - object = @player.search_inv(event[:target]) || room.find(event[:target]) - if object == @player or event[:target] == "me" - @player.output "You covertly lick yourself.\nHmm, not bad." + room = $manager.get_object(self[:agent].container) + object = self[:agent].search_inv(self[:target]) || room.find(self[:target]) + + if object == self[:agent] or self[:target] == "me" + self[:agent].output "You covertly lick yourself.\nHmm, not bad." return elsif object.nil? - @player.output "What would you like to taste?" + self[:agent].output "What would you like to taste?" return end - event[:target] = object - event[:to_player] = "Sticking your tongue out hesitantly, you taste #{object.name}. " + self[:target] = object + self[:to_player] = "Sticking your tongue out hesitantly, you taste #{object.name}. " if object.info.taste.nil? or object.info.taste == "" - event[:to_player] << "#{object.pronoun.capitalize} does not taste that great, but has no particular flavor." + self[:to_player] << "#{object.pronoun.capitalize} does not taste that great, but has no particular flavor." else - event[:to_player] << object.info.taste + self[:to_player] << object.info.taste end - event[:to_target] = "#{@player.name} licks you, apparently in an attempt to find out your flavor." - event[:to_other] = "#{@player.name} hesitantly sticks out #{@player.pronoun(:possessive)} tongue and licks #{object.name}." + self[:to_target] = "#{self[:agent].name} licks you, apparently in an attempt to find out your flavor." + self[:to_other] = "#{self[:agent].name} hesitantly sticks out #{self[:agent].pronoun(:possessive)} tongue and licks #{object.name}." room.out_event event end end diff --git a/lib/aethyr/core/actions/commands/tell.rb b/lib/aethyr/core/actions/commands/tell.rb index e711752..c46818a 100644 --- a/lib/aethyr/core/actions/commands/tell.rb +++ b/lib/aethyr/core/actions/commands/tell.rb @@ -10,19 +10,19 @@ module Aethyr end def action - event = @data - target = $manager.find event[:target] + + target = $manager.find self[:target] unless target and target.is_a? Player - @player.output "That person is not available." + self[:agent].output "That person is not available." return end - if target == @player - @player.output "Talking to yourself?" + if target == self[:agent] + self[:agent].output "Talking to yourself?" return end - phrase = event[:message] + phrase = self[:message] last_char = phrase[-1..-1] @@ -33,9 +33,9 @@ module Aethyr phrase[0,1] = phrase[0,1].upcase phrase = phrase.strip.gsub(/\s{2,}/, ' ') - @player.output "You tell #{target.name}, <tell>\"#{phrase}\"</tell>" - target.output "#{@player.name} tells you, <tell>\"#{phrase}\"</tell>" - target.reply_to = @player.name + self[:agent].output "You tell #{target.name}, <tell>\"#{phrase}\"</tell>" + target.output "#{self[:agent].name} tells you, <tell>\"#{phrase}\"</tell>" + target.reply_to = self[:agent].name end #Reply to a tell. diff --git a/lib/aethyr/core/actions/commands/terrain.rb b/lib/aethyr/core/actions/commands/terrain.rb index f76044f..4ca583d 100644 --- a/lib/aethyr/core/actions/commands/terrain.rb +++ b/lib/aethyr/core/actions/commands/terrain.rb @@ -10,52 +10,52 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:target] == "area" + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + if self[:target] == "area" if room.area.nil? player.output "This room is not in an area." return end - room.area.info.terrain.area_type = event[:value].downcase.to_sym + room.area.info.terrain.area_type = self[:value].downcase.to_sym player.output "Set #{room.area.name} terrain type to #{room.area.info.terrain.area_type}" return end - case event[:setting].downcase + case self[:setting].downcase when "type" - room.info.terrain.room_type = event[:value].downcase.to_sym + room.info.terrain.room_type = self[:value].downcase.to_sym player.output "Set #{room.name} terrain type to #{room.info.terrain.room_type}" when "indoors" - if event[:value] =~ /yes|true/i + if self[:value] =~ /yes|true/i room.info.terrain.indoors = true player.output "Room is now indoors." - elsif event[:value] =~ /no|false/i + elsif self[:value] =~ /no|false/i room.info.terrain.indoors = false player.output "Room is now outdoors." else player.output "Indoors: yes or no?" end when "water" - if event[:value] =~ /yes|true/i + if self[:value] =~ /yes|true/i room.info.terrain.water = true player.output "Room is now water." - elsif event[:value] =~ /no|false/i + elsif self[:value] =~ /no|false/i room.info.terrain.water = false player.output "Room is now dry." else player.output "Water: yes or no?" end when "underwater" - if event[:value] =~ /yes|true/i + if self[:value] =~ /yes|true/i room.info.terrain.underwater = true player.output "Room is now underwater." - elsif event[:value] =~ /no|false/i + elsif self[:value] =~ /no|false/i room.info.terrain.underwater = false player.output "Room is now above water." else diff --git a/lib/aethyr/core/actions/commands/time.rb b/lib/aethyr/core/actions/commands/time.rb index 17a5668..69a6bff 100644 --- a/lib/aethyr/core/actions/commands/time.rb +++ b/lib/aethyr/core/actions/commands/time.rb @@ -10,8 +10,8 @@ module Aethyr end def action - event = @data - @player.output $manager.time + + self[:agent].output $manager.time end #Display date. diff --git a/lib/aethyr/core/actions/commands/unlock.rb b/lib/aethyr/core/actions/commands/unlock.rb index 34eb204..c4b26c9 100644 --- a/lib/aethyr/core/actions/commands/unlock.rb +++ b/lib/aethyr/core/actions/commands/unlock.rb @@ -10,35 +10,35 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - object = @player.search_inv(event[:object]) || room.find(event[:object]) + + room = $manager.get_object(self[:agent].container) + object = self[:agent].search_inv(self[:object]) || room.find(self[:object]) if object.nil? - @player.output("Unlock what? #{event[:object]}?") + self[:agent].output("Unlock what? #{self[:object]}?") return elsif not object.can? :unlock or not object.lockable? - @player.output('That object cannot be unlocked.') + self[:agent].output('That object cannot be unlocked.') return elsif not object.locked? - @player.output("#{object.name} is already unlocked.") + self[:agent].output("#{object.name} is already unlocked.") return end has_key = false object.keys.each do |key| - if @player.inventory.include? key + if self[:agent].inventory.include? key has_key = key break end end - if has_key or @player.admin - status = object.unlock(has_key, @player.admin) + if has_key or self[:agent].admin + status = object.unlock(has_key, self[:agent].admin) if status - event[:to_player] = "You unlock #{object.name}." - event[:to_other] = "#{@player.name} unlocks #{object.name}." - event[:to_blind_other] = "You hear the clunk of a lock." + self[:to_player] = "You unlock #{object.name}." + self[:to_other] = "#{self[:agent].name} unlocks #{object.name}." + self[:to_blind_other] = "You hear the clunk of a lock." room.out_event(event) @@ -47,18 +47,18 @@ module Aethyr other_side.unlock(has_key) other_room = $manager.find other_side.container o_event = event.dup - event[:to_other] = "#{other_side.name} unlocks from the other side." - event[:to_blind_other] = "You hear the click of a lock." + self[:to_other] = "#{other_side.name} unlocks from the other side." + self[:to_blind_other] = "You hear the click of a lock." other_room.out_event(event) end return else - @player.output("You are unable to unlock #{object.name}.") + self[:agent].output("You are unable to unlock #{object.name}.") return end else - @player.output("You do not have the key to #{object.name}.") + self[:agent].output("You do not have the key to #{object.name}.") return end end diff --git a/lib/aethyr/core/actions/commands/unwield.rb b/lib/aethyr/core/actions/commands/unwield.rb index 496ed9c..fff8b61 100644 --- a/lib/aethyr/core/actions/commands/unwield.rb +++ b/lib/aethyr/core/actions/commands/unwield.rb @@ -10,26 +10,26 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - if event[:weapon] == "right" || event[:weapon] == "left" - weapon = player.equipment.get_wielded(event[:weapon]) + room = $manager.get_object(self[:agent].container) + player = self[:agent] + + if self[:weapon] == "right" || self[:weapon] == "left" + weapon = player.equipment.get_wielded(self[:weapon]) if weapon.nil? - player.output "You are not wielding anything in your #{event[:weapon]} hand." + player.output "You are not wielding anything in your #{self[:weapon]} hand." return end - elsif event[:weapon].nil? + elsif self[:weapon].nil? weapon = player.equipment.get_wielded if weapon.nil? player.output "You are not wielding anything." return end else - weapon = player.equipment.find(event[:weapon]) + weapon = player.equipment.find(self[:weapon]) if weapon.nil? player.output "What are you trying to unwield?" @@ -45,8 +45,8 @@ module Aethyr if player.equipment.remove(weapon) player.inventory << weapon - event[:to_player] = "You unwield #{weapon.name}." - event[:to_other] = "#{player.name} unwields #{weapon.name}." + self[:to_player] = "You unwield #{weapon.name}." + self[:to_other] = "#{player.name} unwields #{weapon.name}." room.out_event(event) else player.output "Could not unwield #{weapon.name}." diff --git a/lib/aethyr/core/actions/commands/wear.rb b/lib/aethyr/core/actions/commands/wear.rb index 452aeab..d73f57b 100644 --- a/lib/aethyr/core/actions/commands/wear.rb +++ b/lib/aethyr/core/actions/commands/wear.rb @@ -10,15 +10,15 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - object = player.inventory.find(event[:object]) + room = $manager.get_object(self[:agent].container) + player = self[:agent] + + object = player.inventory.find(self[:object]) if object.nil? - player.output("What #{event[:object]} are you trying to wear?") + player.output("What #{self[:object]} are you trying to wear?") return elsif object.is_a? Weapon player.output "You must wield #{object.name}." @@ -26,8 +26,8 @@ module Aethyr end if player.wear object - event[:to_player] = "You put on #{object.name}." - event[:to_other] = "#{player.name} puts on #{object.name}." + self[:to_player] = "You put on #{object.name}." + self[:to_other] = "#{player.name} puts on #{object.name}." room.out_event(event) end end diff --git a/lib/aethyr/core/actions/commands/whereis.rb b/lib/aethyr/core/actions/commands/whereis.rb index 0263080..cfbf5a7 100644 --- a/lib/aethyr/core/actions/commands/whereis.rb +++ b/lib/aethyr/core/actions/commands/whereis.rb @@ -10,14 +10,14 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - object = find_object(event[:object], event) + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + object = find_object(self[:object], event) if object.nil? - player.output "Could not find #{event[:object]}." + player.output "Could not find #{self[:object]}." return end @@ -34,7 +34,7 @@ module Aethyr player.output "Container for #{object} not found." else player.output "#{object} is in #{container}." - event[:object] = container.goid + self[:object] = container.goid whereis(event, player, room) end end diff --git a/lib/aethyr/core/actions/commands/whisper.rb b/lib/aethyr/core/actions/commands/whisper.rb index 9336f89..fc61a7e 100644 --- a/lib/aethyr/core/actions/commands/whisper.rb +++ b/lib/aethyr/core/actions/commands/whisper.rb @@ -10,28 +10,28 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - object = room.find(event[:to], Player) + + room = $manager.get_object(self[:agent].container) + object = room.find(self[:to], Player) if object.nil? - @player.output("To whom are you trying to whisper?") + self[:agent].output("To whom are you trying to whisper?") return - elsif object == @player - @player.output("Whispering to yourself again?") - event[:to_other] = "#{@player.name} whispers to #{@player.pronoun(:reflexive)}." - room.out_event(event, @player) + elsif object == self[:agent] + self[:agent].output("Whispering to yourself again?") + self[:to_other] = "#{self[:agent].name} whispers to #{self[:agent].pronoun(:reflexive)}." + room.out_event(event, self[:agent]) return end - phrase = event[:phrase] + phrase = self[:phrase] if phrase.nil? - @player.ouput "What are you trying to whisper?" + self[:agent].ouput "What are you trying to whisper?" return end - prefix = event[:pre] + prefix = self[:pre] if prefix prefix << ", " @@ -49,12 +49,12 @@ module Aethyr phrase = ", <say>\"#{phrase}#{ender}\"</say>" - event[:target] = object - event[:to_player] = prefix + "you whisper to #{object.name}#{phrase}" - event[:to_target] = prefix + "#{@player.name} whispers to you#{phrase}" - event[:to_other] = prefix + "#{@player.name} whispers quietly into #{object.name}'s ear." - event[:to_other_blind] = "#{@player.name} whispers." - event[:to_target_blind] = "Someone whispers to you#{phrase}" + self[:target] = object + self[:to_player] = prefix + "you whisper to #{object.name}#{phrase}" + self[:to_target] = prefix + "#{self[:agent].name} whispers to you#{phrase}" + self[:to_other] = prefix + "#{self[:agent].name} whispers quietly into #{object.name}'s ear." + self[:to_other_blind] = "#{self[:agent].name} whispers." + self[:to_target_blind] = "Someone whispers to you#{phrase}" room.out_event(event) end diff --git a/lib/aethyr/core/actions/commands/who.rb b/lib/aethyr/core/actions/commands/who.rb index f10ef4d..642c071 100644 --- a/lib/aethyr/core/actions/commands/who.rb +++ b/lib/aethyr/core/actions/commands/who.rb @@ -10,7 +10,7 @@ module Aethyr end def action - event = @data + players = $manager.find_all("class", Player) output = ["The following people are visiting Aethyr:"] players.sort_by {|p| p.name}.each do |playa| @@ -18,7 +18,7 @@ module Aethyr output << "#{playa.name} - #{room.name if room}" end - @player.output output + self[:agent].output output end #Delete your player. end diff --git a/lib/aethyr/core/actions/commands/wield.rb b/lib/aethyr/core/actions/commands/wield.rb index 90e8dc6..fe6a9b7 100644 --- a/lib/aethyr/core/actions/commands/wield.rb +++ b/lib/aethyr/core/actions/commands/wield.rb @@ -10,13 +10,13 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player - weapon = player.inventory.find(event[:weapon]) + + room = $manager.get_object(self[:agent].container) + player = self[:agent] + weapon = player.inventory.find(self[:weapon]) if weapon.nil? - weapon = player.equipment.find(event[:weapon]) + weapon = player.equipment.find(self[:weapon]) if weapon and player.equipment.get_all_wielded.include? weapon player.output "You are already wielding that." else @@ -30,8 +30,8 @@ module Aethyr return end - if event[:side] - side = event[:side] + if self[:side] + side = self[:side] if side != "right" and side != "left" player.output "Which hand?" return @@ -48,7 +48,7 @@ module Aethyr player.output "You are unable to wield that." return end - event[:to_player] = "You grip #{weapon.name} firmly in your #{side} hand." + self[:to_player] = "You grip #{weapon.name} firmly in your #{side} hand." else result = player.equipment.check_wield(weapon) @@ -63,11 +63,11 @@ module Aethyr return end - event[:to_player] = "You firmly grip #{weapon.name} and begin to wield it." + self[:to_player] = "You firmly grip #{weapon.name} and begin to wield it." end player.inventory.remove weapon - event[:to_other] = "#{player.name} wields #{weapon.name}." + self[:to_other] = "#{player.name} wields #{weapon.name}." room.out_event(event) end diff --git a/lib/aethyr/core/actions/commands/write.rb b/lib/aethyr/core/actions/commands/write.rb index b197e92..b84f9c0 100644 --- a/lib/aethyr/core/actions/commands/write.rb +++ b/lib/aethyr/core/actions/commands/write.rb @@ -10,26 +10,26 @@ module Aethyr end def action - event = @data - object = @player.search_inv(event[:target]) + + object = self[:agent].search_inv(self[:target]) if object.nil? - @player.output "What do you wish to write on?" + self[:agent].output "What do you wish to write on?" return end if not object.info.writable - @player.output "You cannot write on #{object.name}." + self[:agent].output "You cannot write on #{object.name}." return end - @player.output "You begin to write on #{object.name}." + self[:agent].output "You begin to write on #{object.name}." - @player.editor(object.readable_text || [], 100) do |data| + self[:agent].editor(object.readable_text || [], 100) do |data| unless data.nil? object.readable_text = data end - @player.output "You finish your writing." + self[:agent].output "You finish your writing." end end end diff --git a/lib/aethyr/core/actions/commands/write_post.rb b/lib/aethyr/core/actions/commands/write_post.rb index cf7c399..6dcf0d6 100644 --- a/lib/aethyr/core/actions/commands/write_post.rb +++ b/lib/aethyr/core/actions/commands/write_post.rb @@ -10,10 +10,10 @@ module Aethyr end def action - event = @data - room = $manager.get_object(@player.container) - player = @player + + room = $manager.get_object(self[:agent].container) + player = self[:agent] board = find_board(event, room) if board.nil? @@ -26,7 +26,7 @@ module Aethyr player.expect do |subj| player.editor do |message| unless message.nil? - post_id = board.save_post(player, subj, event[:reply_to], message) + post_id = board.save_post(player, subj, self[:reply_to], message) player.output "You have written post ##{post_id}." if board.announce_new area = $manager.get_object(board.container).area -- GitLab