# # file:: cmd_oedit.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/foodedit' require 'olc/liqedit' require 'olc/batteryedit' require 'olc/containeredit' require 'olc/cashedit' # Released under the terms of the TeensyMUD Public License # See LICENSE file for additional information. # module Cmd # Object Editor OLC Command def cmd_oedit(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 Container @olc = ContainerEdit.new(id, o.id) when Food @olc = FoodEdit.new(id, o.id) when Liquid @olc = LiqEdit.new(id, o.id) when Battery @olc = BatteryEdit.new(id, o.id) when Cash @olc = CashEdit.new(id, o.id) else @olc = Oedit.new(id, o.id) end when /^\s*new\s*(.*)/ @mode = :olc arg = $1 if arg=~/food\s+(.*)/i @olc = FoodEdit.new(id, nil, $1) elsif arg=~/liquid\s+(.*)/i @olc = LiqEdit.new(id, nil, $1) elsif arg=~/battery\s+(.*)/i @olc = BatteryEdit.new(id, nil, $1) elsif arg=~/container\s+(.*)/i @olc = ContainerEdit.new(id, nil, $1) elsif arg=~/cash$/i @olc = CashEdit.new(id, nil, "cash") else @olc = Oedit.new(id, nil, arg) end else sendto("Usage: oedit [#<oid>] | new [<food|liquid|container|name]") end end end