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_summon.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")

  # Priv. command that allows teleporting
  # Can teleport to a room number or to a players name
  def cmd_summon(args)
    case args
    when /(\w+)/ # Player name
	whom = $1
	world.all_characters.each do |cid|
		plyr = get_object(cid)
		if plyr.name=~/^#{whom}$/i
			if plyr.location == location
				sendto _("%{pronoun} is already here." % {:pronoun => plyr.pronoun})
			elsif world.is_admin? plyr.id
				sendto _("You can not summon a god.")
			else
				msg = Msg.new _("^p1 mumbles some words and waves %{pos} hands." % {:pos => pos_pronoun})
				msg.p1 = name
				sendroom(msg)
				add_event(id, cid, :show, _("The room spins and dissolves in front of you!"))
				loc = get_object(plyr.location)
				if loc
					loc.delete_contents(cid)
					add_event(loc.id, location, :arrive, cid)
				else
					add_event(nil, location, :arrive, cid)
				end
			end
			return
		end
	end
	sendto(_("Player %{whom} not found." % {:whom => whom}))
    else
      sendto _("Usage: @summon playerName")
    end
  end

end