znmud-0.0.1/benchmark/
znmud-0.0.1/cmd/
znmud-0.0.1/cmd/emotes/
znmud-0.0.1/cmd/objects/
znmud-0.0.1/cmd/tiny/
znmud-0.0.1/doc/
znmud-0.0.1/farts/
znmud-0.0.1/lib/
znmud-0.0.1/lib/combat/
znmud-0.0.1/lib/core/bodytypes/
znmud-0.0.1/lib/engine/
znmud-0.0.1/lib/farts/
znmud-0.0.1/logs/
#
# file::    cmd_put.rb
#
# This source code copyright (C) 2009 Craig Smith
# All rights reserved.
#
# Released under the terms of the TeensyMUD Public License
# See LICENSE file for additional information.
#


module Cmd

  bindtextdomain("cmd")

  # put an item in something else
  def cmd_put(args)
    in_keyword = _("in")
    case args
    when /(.+)\s+#{in_keyword}\s+(.+)/
	what = $1
	where = $2
	loc = get_object(location)
	objs = find_inv(what)
	if objs.size == 1
		toobjs = find_inv(where)
		if toobjs.size > 0
			if toobjs.size == 1
				o = toobjs[0]
				if o.kind_of? Container
					add_event(id, o.id, :put, objs[0].id)
				else
					sendto _("You can not put that in there.")
				end
			else
				sendto _("You should be more specific.")
			end
		else
			toobjs = loc.find_objects(where)
			if toobjs.size > 0
				if toobjs.size == 1
					o = toobjs[0]
					if o.has_attribute? :fixed and o.kind_of? Container
						add_event(id, o.id, :put, objs[0].id)
					else
						sendto _("You should pick that up first.")
					end
				else
					sendto _("You should be more specific")
				end
			else
				sendto _("Can not find %{what}" % {:what => where})
			end
		end
	else
		sendto _("You care not carrying %{what}" % {:what => what})
	end
    else
        sendto _("Put what in what?")
    end
  end

end