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

  # Find and lists objects and their oid
  def cmd_grant(args)
    case args
    when /builder (\w+)/
	d = world.all_characters.find {|pid| $1 == get_object(pid).name }
	if !d
		sendto _("Can't find them.")
	else
		world.add_builder(d)
		sendto _("Permission Granted")
		add_event(id,d,:show, _("%{name} has granted you builder permission" % {:name => name}))
		d = get_object(d)
		log.info("#{name} granted #{d.name} builder permissions")
	end
    when /admin (\w+)/
	d = world.all_characters.find {|pid| $1 == get_object(pid).name }
	if !d
		sendto _("Can't find them.")
	else
		world.add_admin(d)
		sendto _("Permission Granted")
		add_event(id,d,:show, _("%{name} has granted you admin permission" % {:name => name}))
		d = get_object(d)
		log.info("#{name} granted #{d.name} admin permissions")
	end
    else
        sendto _("@grant builder|admin <playername>")
    end
  end

end