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

require 'olc/zedit'
require 'olc/merchedit'

module Cmd

  # Creates a new mobile NPC
  def cmd_medit(args)
    case args
    when /^\s*#(\d+)\s*$/
	@mode = :olc
	oid = $1.to_i
	o = get_object(oid)
	if not o
		sendto _("Not a valid object id.")
		return
	end
	o = get_object(o.parentid) if o.parentid
	case o
	when Zombie
		@olc = Zedit.new(id, o.id)
	when Merchant
		@olc = MerchEdit.new(id, o.id)
	when Mobile
		@olc = Medit.new(id, o.id)
	else
		sendto _("Oid is not a Mobile.")
	end
    when /^new\s+(\w+)\s+(.*)/
      type = $1
      mname = $2
	case type
	when "npc"
		@mode = :olc
		@olc = Medit.new(id, nil, mname)
	when "zombie"
		@mode = :olc
		@olc = Zedit.new(id, nil, mname)
	when "merchant"
		@mode = :olc
		@olc = MerchEdit.new(id, nil, mname)
	else
		sendto("Unknown mobile type.")
        end
    else
      sendto("Syntax: medit (#oid)|new <type(npc)> <name of NPC>")
    end
  end

end