|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.commands.OfferCommand
Implements a safe-trading system. A player can "offer" an item for sale in their inventory, optionally specifying a particular player to sell it to.
Field Summary | |
static int |
AUCTION_FEE
|
Method Summary | |
void |
addCommands(java.util.Map commands,
CommandList list)
Adds commands. |
CommandEvent |
createBuyEvent(CommandEvent event)
Creates an event for buying an item from a player. |
CommandEvent |
createEvent(CommandEvent event)
Implements Command.createEvent() |
CommandEvent |
createRescindEvent(CommandEvent event)
Creates an event for rescinding an offer. |
boolean |
execute(CommandEvent ev)
Executes the event by marking the item for sale. |
boolean |
executeBuyEvent(CommandEvent ev)
Executes a purchase. |
boolean |
executeRescindEvent(CommandEvent ev)
Executes a rescind. |
static OfferCommand |
getImpl()
|
CommandEvent |
getTarget(CommandEvent event)
Looks for the thing to offer for sale. |
boolean |
knowsCommand(java.lang.String command)
Built-in commands always return true, so that *someone* handles it. |
static void |
main(java.lang.String[] args)
Tests the regular expression for matching args. |
CommandEvent |
parseArgs(CommandEvent event)
Splits up the args to the event. |
static void |
removeOfferingProperties(GameObject obj)
Removes the properties set by the "offer" command, including the suffix showing the price. |
CommandEvent |
usage(CommandEvent event)
Vetoes the event with a Usage message. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int AUCTION_FEE
Method Detail |
public static OfferCommand getImpl()
public void addCommands(java.util.Map commands, CommandList list)
addCommands
in interface BuiltInCommand
commands
- the map to add tolist
- the command list we're registering in, from which
we can derive the command agent (i.e. player or monster) and other
information.public boolean knowsCommand(java.lang.String command)
knowsCommand
in interface Command
command
- the complete original text of the command.
public CommandEvent createEvent(CommandEvent event)
createEvent
in interface Command
event
- the initial, raw event
public CommandEvent parseArgs(CommandEvent event)
event
- the initial event
public CommandEvent usage(CommandEvent event)
public CommandEvent getTarget(CommandEvent event)
event
- the original event, with args parsed into
"item", "price", and optional "buyer" properties.
public boolean execute(CommandEvent ev)
execute
in interface Command
ev
- the CommandEvent to execute
public CommandEvent createRescindEvent(CommandEvent event)
public boolean executeRescindEvent(CommandEvent ev)
public static void removeOfferingProperties(GameObject obj)
obj
- an offered object for which to remove the properties
public CommandEvent createBuyEvent(CommandEvent event)
event
- the original event encapsulating the command
public boolean executeBuyEvent(CommandEvent ev)
ev
- a TargetedEvent created by createBuyEvent()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |