|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.commands.OrderCommand
Lets you order something from a tavern menu.
Field Summary | |
static int |
ORDER_DELAY
|
Method Summary | |
void |
addCommands(java.util.Map commands,
CommandList list)
Tells the Command to add the commands that it wants to implement into the passed data structure. |
CommandEvent |
createEvent(CommandEvent initial)
Creates an Order event. |
boolean |
execute(CommandEvent event)
Implements Command.execute() |
static OrderCommand |
getImpl()
|
static boolean |
handleConsume(int value,
GameObject obj,
Commandable agent,
CommandEvent event)
Handles consuming something. |
boolean |
knowsCommand(java.lang.String command)
Returns true if this Command wants to handle the command. |
boolean |
showMenu(CommandEvent event,
Commandable agent)
Shows the contents of the tavern menu. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static int ORDER_DELAY
Method Detail |
public static OrderCommand getImpl()
public void addCommands(java.util.Map commands, CommandList list)
BuiltInCommand
addCommands
in interface BuiltInCommand
commands
- a Map whose keys are commands, and whose values
are Commands that handle those commands.list
- the CommandList the Command is being added to.public boolean knowsCommand(java.lang.String command)
Command
This method exists to allow more than one game object to implement the same command verb, but with different expected arguments.
If two objects register for the same command and the same arguments, the object that was registered most recently gets to handle at the command.
knowsCommand
in interface Command
command
- the entire command string, including arguments
public CommandEvent createEvent(CommandEvent initial)
Sets various error messages in the event (you can query them dynamically to see their current values). Looks for an object with a "menu" property nearby.
createEvent
in interface Command
initial
- the initial, raw event
public boolean execute(CommandEvent event)
execute
in interface Command
event
- the event to execute
public boolean showMenu(CommandEvent event, Commandable agent)
public static boolean handleConsume(int value, GameObject obj, Commandable agent, CommandEvent event)
value
- the value of the object's "drinkable" or "edible"
property i.e. the object's food valueobj
- the target objectagent
- the agent drinking the objectevent
- the event, complete with success-messages, etc.
In particular, it must have the "tooMuchMsg" set properly,
for if the player can't order or drink that much.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |