/*
** j###t ########## #### ####
** j###t ########## #### ####
** j###T "###L J###"
** ######P' ########## #########
** ######k, ########## T######T
** ####~###L ####
** #### q###L ########## .#####
** #### \###L ########## #####"
**
** $Id$
**
** Class History
**
** Date Name Description
** ---------|------------|-----------------------------------------------
** 22Jul97 exile player gets passed to the rooms aspect so
** that the room knows who the obsever is.
** 24Aug98 subtle start of recorded history
**
*/
package key.commands;
import key.*;
import java.io.IOException;
import java.util.StringTokenizer;
public class Look extends Command
{
public Look()
{
setKey( "look" );
usage = "[<object>]";
}
public void run( Player p, StringTokenizer args, String fullLine, CategoryCommand caller, InteractiveConnection ic, Flags flags ) throws IOException
{
if( args.hasMoreTokens() )
{
String nt = args.nextToken();
if( nt.equals( "-" ) )
{
if( p.connected() && p.located() )
ic.send( p.getLocation().who( p ), false );
else
ic.sendError( "You can't see a thing." );
}
else
{
Thing t = null;
if( nt.equalsIgnoreCase( "my" ) && args.hasMoreTokens() )
{
nt = args.nextToken();
t = getObjectFromInventory( p, ic, nt );
}
else
t = getObjectFromLocation( p, ic, nt );
if( t != null )
t.look( p, args, ic, flags, (Atom) t );
else
ic.sendFeedback( "(You can use 'look my <obj>' to look at something in your inventory." );
}
}
else
{
if( p.connected() && p.located() )
ic.send( p.getLocation().aspect( p ), false );
else
ic.sendError( "You can't see a thing." );
}
}
}