cmd_wizhelp.rb

znmud-0.0.1/cmd/zombie/cmd_wizhelp.rb · 1.1 KB

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

Download the archive   « Back to the archive contents

#
# file::    cmd_wizhelp.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")

  # The wizhelp command for builder/wizard help system
  def cmd_wizhelp(args)
    case args
    when nil, ""
      sendto _("================WIZ HELP=======================")
      line = String.new
      wordcnt = 0
      world.cmds.to_hash.values.each do |h|
	case h.perm
	when "builder"
		if world.can_build? id
			line += sprintf("%-15s", h.name)
			wordcnt+=1
		end
	when "admin"
		if world.is_admin? id
			line += sprintf("%-15s", h.name)
			wordcnt+=1
		end
	end
	if wordcnt == 3
		sendto(line)
		line = ""
		wordcnt = 0
	end
      end
      sendto(line) if line
    else
      q = world.cmds.find(args)
      if q
        sendto _("================WIZ HELP=======================")
        q.each do |h|
          sendto(sprintf("%-10s - %s", h.name, h.help))
        end
      else
        sendto _("No help on that.")
      end
    end
  end

end

Site Stats

Snippets: 1791
Codebases: 571