Class: ClasslessMud::Commands::Get

Inherits:
Object
  • Object
show all
Defined in:
lib/classless_mud/commands/get.rb

Class Method Summary collapse

Class Method Details

.perform(game, player, message) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/classless_mud/commands/get.rb', line 4

def self.perform game, player, message
  get_command, get_target = message.split " ", 2
  found = player.room.find get_target
  if found
    player.items << found
    player.room.items.delete found
    player.items.save!
    player.room.items.save!
    player.room.broadcast "#{player.name} picks up #{found.name}"
    player.puts "You pick up #{found.name}"
  else
    player.puts "I don't see that anywhere"
  end
end