wyvern.lib.commands
Class SayEvent
java.lang.Object
wyvern.kernel.properties.PList
wyvern.kernel.commands.EventImpl
wyvern.lib.commands.SayEvent
- All Implemented Interfaces:
- Broadcaster, CommandEvent, PropertyList, VerbalEvent
- public class SayEvent
- extends EventImpl
- implements VerbalEvent
Event generated when someone says something with "say" or "nofilter".
- Version:
- 1.0, Oct 18, 2003
- Author:
- Steve Yegge
Field Summary |
protected boolean |
hello_
|
protected java.lang.String |
message_
|
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_ |
Constructor Summary |
SayEvent(java.lang.String originalText,
Commandable agent)
Constructs a new SayEvent. |
Method Summary |
protected void |
checkHello(java.lang.String msg)
Checks if the message is some form of "Hello", and
saves a flag in instance. |
void |
checkTalkingMonster()
Looks for an NPC or monster nearby who can respond to
what the user said. |
boolean |
execute()
Executes the command. |
java.lang.String |
getMessage()
Gets the message that the player is saying. |
java.util.Set |
getMonstersInEarshot(Commandable agent)
Returns all the monsters within earshot of the agent. |
Rectangle |
getTalkArea(Commandable agent)
Returns the area around the player where chatting can
be heard by monsters. |
boolean |
isHello()
Returns true if the message is "Hi", "Hello", "Greetings",
or some such. |
void |
setMessage(java.lang.String msg)
Sets the message the player will say. |
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 |
message_
protected java.lang.String message_
hello_
protected boolean hello_
SayEvent
public SayEvent(java.lang.String originalText,
Commandable agent)
- Constructs a new SayEvent.
- Parameters:
originalText
- whatever the user typedagent
- the person saying something
checkHello
protected void checkHello(java.lang.String msg)
- Checks if the message is some form of "Hello", and
saves a flag in instance.
- Parameters:
msg
- the message
execute
public boolean execute()
- Executes the command.
- Returns:
- true if successful
setMessage
public void setMessage(java.lang.String msg)
- Sets the message the player will say.
- Specified by:
setMessage
in interface VerbalEvent
- Parameters:
msg
- the new message
getMessage
public java.lang.String getMessage()
- Gets the message that the player is saying.
- Specified by:
getMessage
in interface VerbalEvent
- Returns:
- the message
isHello
public boolean isHello()
- Returns true if the message is "Hi", "Hello", "Greetings",
or some such.
checkTalkingMonster
public void checkTalkingMonster()
- Looks for an NPC or monster nearby who can respond to
what the user said.
getTalkArea
public Rectangle getTalkArea(Commandable agent)
- Returns the area around the player where chatting can
be heard by monsters.
- Parameters:
agent
- the player
- Returns:
- the bounding rectangle, clipped against the map bounds
getMonstersInEarshot
public java.util.Set getMonstersInEarshot(Commandable agent)
- Returns all the monsters within earshot of the agent.
- Parameters:
agent
- the player that said something
- Returns:
- a set, possibly null, of monsters who can hear us