cmd_grant.rb

znmud-0.0.1/cmd/zombie/cmd_grant.rb · 1.2 KB

From the archive znmud-minimal-0.0.1.tar.gz

Download the archive   « Back to the archive contents

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

Site Stats

Snippets: 1791
Codebases: 571