wyvern.lib.commands
Class PickupEvent
java.lang.Object
wyvern.kernel.properties.PList
wyvern.kernel.commands.EventImpl
wyvern.kernel.commands.TargetedEvent
wyvern.lib.commands.PickupEvent
- All Implemented Interfaces:
- Broadcaster, CommandEvent, PropertyList
- public class PickupEvent
- extends TargetedEvent
Encapsulates the parameters for the "get" command.
- Version:
- 1.0, Nov 05, 1997
- Author:
- Steve Yegge
Fields inherited from class wyvern.kernel.commands.EventImpl |
agent_, appendToFile_, argString_, argStringParsed_, argv_, argvParsed_, delay_, failureMessage_, filterObjects_, filters_, handler_, map_, modified_, originalText_, playerOriginated_, redirectFile_, redirecting_, sendToAgent_, successMessage_, verb_, vetoed_, wizParsed_ |
Method Summary |
void |
addGetAllObject(GameObject obj)
Used by "get all" processing to indicate that a particular
object was successfully picked up by the agent. |
boolean |
findTargetOrVeto()
Looks for the target object to pick up. |
java.util.Set |
getAllObjects()
Returns the set of all the objects the agent picked up via
"get all". |
GameObject |
getFinalTarget()
Returns the object that was finally added to the agent's
inventory after the event completes. |
Predicate |
getPredicate()
Returns the predicate to use for determining whether
an object can be picked up. |
Point |
getTargetStartLocation()
Returns initial reference location for the target object |
boolean |
isGetAll()
Returns true if the event is a "get all" command. |
void |
setIsGetAll(boolean all)
Sets the flag indicating whether this is a "get all" command. |
void |
setPredicate(Predicate p)
Sets the predicate used to determine whether an object
can be picked up. |
void |
setTargetStartLocation(Point targetStartLocation)
Sets initial reference location for the target object |
boolean |
takingWholeObject()
Returns true if they're picking up the whole object, or
the whole stack if it's a stack. |
Methods inherited from class wyvern.kernel.commands.TargetedEvent |
getCloneErrorMsg, getLocation, getQuantity, getTarget, getTargetName, hasTarget, isQuantified, isTargetSpecifiedByHashcode, setLocation, setQuantified, setQuantity, setTarget, setTargetName |
Methods inherited from class wyvern.kernel.commands.EventImpl |
broadcast, broadcast, broadcast, broadcast, broadcast, checkVeto, fail, filterMessage, findAllMatches, findByHashcode, findInMap, findNeighbor, findObject, findTarget, getAgent, getArgs, getArgString, getDelay, getFailureMessage, getFilterObjects, getFilters, getHandler, getMap, getOriginalText, getRedirectFile, getSuccessMessage, getVerb, hasArgs, isAppending, isModified, isMonster, isPlayer, isPlayerOriginated, isRedirecting, isSendingToAgent, isVetoed, isWizard, main, message, message, noArgs, parseArgString, parseARGV, parseVerb, profileParsing, redirectMessage, runPostHooks, runPreHooks, searchInv, searchInvAndMapNearby, searchInvAndMapUnder, searchInvByHashcode, searchMapNearby, searchMapUnder, searchMapUnderByHashcode, setAgent, setArgs, setDelay, setFailureMessage, setHandler, setMap, setModified, setOriginalText, setPlayerOriginated, setSuccessMessage, setVerb, setVeto, toString, veto |
Methods inherited from class wyvern.kernel.properties.PList |
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, debugProperties, dismantlePropertyList, getDoubleProperty, getInheritedProperty, getInteger, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProfilingInfo, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, transientlyRemoveProperty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface wyvern.lib.PropertyList |
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, getDoubleProperty, getInheritedProperty, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, transientlyRemoveProperty |
PickupEvent
public PickupEvent(CommandEvent event)
- Constructs a new PickupEvent
PickupEvent
public PickupEvent(java.lang.String originalText,
Commandable agent)
- Constructs a new standard PickupEvent.
getPredicate
public Predicate getPredicate()
- Returns the predicate to use for determining whether
an object can be picked up.
- Returns:
- the predicate
setPredicate
public void setPredicate(Predicate p)
- Sets the predicate used to determine whether an object
can be picked up.
- Parameters:
p
- the Predicate to use to see if it can be picked up.
Used during event creation, so it doesn't do any good to set
this during a hook callback. If necessary you can pass the
event target through your own predicate and veto the event
if the target can't be picked up for some reason.
setIsGetAll
public void setIsGetAll(boolean all)
- Sets the flag indicating whether this is a "get all" command.
- Parameters:
all
- true to "get all".
isGetAll
public boolean isGetAll()
- Returns true if the event is a "get all" command.
findTargetOrVeto
public boolean findTargetOrVeto()
- Looks for the target object to pick up. If not found,
vetoes the event with an appropriate message for the player.
- Returns:
- true if we found the target, false if it was vetoed
getTargetStartLocation
public Point getTargetStartLocation()
- Returns initial reference location for the target object
- Returns:
- initial reference location for the target object
setTargetStartLocation
public void setTargetStartLocation(Point targetStartLocation)
- Sets initial reference location for the target object
- Parameters:
targetStartLocation
- initial reference location for
the target object
getFinalTarget
public GameObject getFinalTarget()
- Returns the object that was finally added to the agent's
inventory after the event completes. If the agent took
the whole object (or stack), it's the same as the event target.
If the agent only took part of a stack, this returns the
part they took. If the event failed, returns null.
- Returns:
- the object added to the agent's inventory, if any.
If they got part of a stack, it's a clone of the original,
and both quantities are set appropriately.
takingWholeObject
public boolean takingWholeObject()
- Returns true if they're picking up the whole object, or
the whole stack if it's a stack.
addGetAllObject
public void addGetAllObject(GameObject obj)
- Used by "get all" processing to indicate that a particular
object was successfully picked up by the agent. All such
objects are kept in a list you can obtain, after the event
executes, via getAllObjects().
- Parameters:
obj
- an object the agent picked up during "get all" processing
getAllObjects
public java.util.Set getAllObjects()
- Returns the set of all the objects the agent picked up via
"get all". They're not in any particular order.
- Returns:
- the set of objects the agent picked up. Returns
an empty set if the agent didn't pick anything up successfully,
or if it wasn't a "get all" event. You can test the latter
via event.isGetAll().