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_rlist.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

  # List rooms around player or in a certain range
  def cmd_rlist(args)
    low = 0
    high = 100
    case args
    when /^(\d+)$/ # Around one number
	low = $1.to_i - 100
	high = $1.to_i + 100
	low = 0 if low < 0
    when /(\d+)-(\d+)/ # Range of IDs
	low = $1.to_i
	high = $2.to_i
    when /(.*)/ # find a room with a set word in it
	high = 0
	rooms = world.find_rooms($1)
	rooms.each do | r |
		sendto(" [#{r.id}] - #{r.name}")
	end
    else
	low = location - 100
	high = location + 100
	low = 0 if low < 0
    end
    if high > low
       (low..high).each do |id|
	begin
		r = get_object(id)
		if r
			sendto(" [#{id}] - #{r.name}") if r.is_a? Room
		end
	end
       end
    end
  end

end