# # 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