|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.commands.LookCommand
Built-in command to examine something. Also handles the Zoology skill for appraising monsters.
Nested Class Summary | |
class |
LookCommand.LookEvent
Event to encapsulate the parameters for the user examining something. |
static interface |
LookCommand.LookOverride
Interface for objects that want to provide a custom description, depending on who looks at them. |
Method Summary | |
void |
addCommands(java.util.Map commands,
CommandList list)
Registers commands for looking. |
void |
appendWizInfo(GameObject obj,
java.lang.StringBuffer sb)
Appends which wizard created the object to the description of the object that we're building up in the passed StringBuffer. |
CommandEvent |
createEvent(CommandEvent initial)
Implements Command.createEvent() |
boolean |
execute(CommandEvent ev)
Looks at the target object. |
GameObject |
findTopObject(DisplayPolicy frame,
Commandable agent,
int x,
int y)
Locates the topmost object under the agent at the (x, y) spot where they clicked. |
static java.lang.String |
getContribInfo(GameObject obj)
Returns which wizard contributed the object, if it has a "wiz-contrib" property, or the player that contributed it, if it has a "player-contrib" property. |
java.lang.String |
getDescription(GameObject obj)
Returns the description for the object, if any. |
static LookCommand |
getImpl()
|
java.lang.String |
getShortDesc(GameObject obj)
Returns a short description for the object. |
CommandEvent |
handleLookAll(CommandEvent event,
Commandable agent)
Creates an event that shows every object on the ground where the user is at. |
CommandEvent |
handleLookXY(LookCommand.LookEvent event,
Commandable agent)
Looks at the top object at the (x,y) location specified in the event's arguments. |
boolean |
isLookAll(CommandEvent event)
Checks if this is a look-all event, and if so, issues the message to the agent. |
boolean |
isLookXY(CommandEvent event,
GameObject obj)
Executes the lookxy command, which is usually from clicking on something with the mouse. |
boolean |
knowsCommand(java.lang.String command)
We don't have any way of determining that we don't know how to handle the command based just on its arguments. |
java.lang.String |
printInventory(GameObject target)
Prints out the target's inventory, or some subset of it. |
void |
readObject(GameObject obj,
LookCommand.LookEvent event)
Shows the object description in fancy text. |
void |
showImageDesc(Commandable agent,
GameObject obj)
Shows the description of the object along with a picture of some sort. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static LookCommand getImpl()
public void addCommands(java.util.Map commands, CommandList list)
addCommands
in interface BuiltInCommand
commands
- the map to add tolist
- the player getting the commandspublic boolean knowsCommand(java.lang.String command)
knowsCommand
in interface Command
command
- the entire command string, including arguments
public CommandEvent createEvent(CommandEvent initial)
createEvent
in interface Command
initial
- a "blank" CommandEvent containing only the
command text and the agent who's performing the command. This
initial event is created by the originator of the event (e.g.
the AI or player's command preprocessor).
Command.createEvent(wyvern.lib.CommandEvent)
public CommandEvent handleLookXY(LookCommand.LookEvent event, Commandable agent)
When finding the top object, the code skips over any objects that have a "mouse-ignore" property.
event
- the LookEventagent
- the event's agentpublic GameObject findTopObject(DisplayPolicy frame, Commandable agent, int x, int y)
frame
- the agent's camera's DisplayPolicy, which
decides what the agent can and can't seeagent
- the playerx
- map x location of mouse clicky
- map y location of mouse clickpublic CommandEvent handleLookAll(CommandEvent event, Commandable agent)
Sets a "lookall" property on the event, where the value is a List of the short descriptions of all the items in the map under the agent.
agent
- the agentevent
- the eventpublic boolean execute(CommandEvent ev)
execute
in interface Command
ev
- the CommandEvent to execute
Command.execute(wyvern.lib.CommandEvent)
public java.lang.String getShortDesc(GameObject obj)
public void readObject(GameObject obj, LookCommand.LookEvent event)
event
- the eventobj
- the object being looked atpublic java.lang.String getDescription(GameObject obj)
obj
- an object to check for a description property
public java.lang.String printInventory(GameObject target)
public void showImageDesc(Commandable agent, GameObject obj)
obj
- the objectagent
- the player looking at itpublic boolean isLookAll(CommandEvent event)
event
- the event
public boolean isLookXY(CommandEvent event, GameObject obj)
event
- the eventobj
- the event targetpublic void appendWizInfo(GameObject obj, java.lang.StringBuffer sb)
obj
- the object being examinedsb
- the StringBuffer with the description so farpublic static java.lang.String getContribInfo(GameObject obj)
obj
- the object to examine
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |