wyvern.lib.classes.construct
Class VoicePerson
java.lang.Object
wyvern.kernel.properties.PList
wyvern.kernel.maps.MapObject
wyvern.kernel.commands.AbstractCommandable
wyvern.kernel.monsters.MonsterImpl
wyvern.lib.classes.construct.VoicePerson
- All Implemented Interfaces:
- Attackable, Broadcaster, Commandable, Damageable, GameObject, HeartbeatCallback, Hookable, MethodHookable, MethodHookCallback, Monster, MouseInterest, PropertyList, RemoteAudio, RoomHookCallback
- public class VoicePerson
- extends MonsterImpl
- implements RoomHookCallback
A voice-activated NPC. Speak the password and they'll give you
something. Set the "password" (string) property to set the
passphrase. Add a boolean "case-sensitive" property to make
it case-sensitive. You should use this in conjunction with a
wyvern.kernel.monsters.Talker object to make the NPC do any
conversation. In particular, you can set the password as a
Talker subject, and have the NPC emit the appropriate response
when you say the passphrase.
When the player speaks the correct password, the VoicePerson
looks for a "gift-arch" property whose value is a string: the
path to an archetype to instantiate and give to the player.
For example, setting "gift-arch" to "wiz/foobar/jade_key" would
clone an instance of Foobar's jade key and give it to the player.
The archetype must exist at the specified location, of course.
Set the "give-count" property to control how many times the
VoicePerson will hand out their treasure. The default is 1,
after which saying the password has no effect.
Another way to use the VoicePerson is to set a command to
execute on the VoicePerson when the password is spoken.
If a "perform-command" string property is set, such as "move north",
the VoicePerson will execute that command when the passphrase
is spoken. This can be used in conjunction with the "gift-arch" -
for instance, you could set the VoicePerson up to give an item
and then flip head over heels with "perform-command" set to "flip".
Set a "perform-count" int property if you want to limit the number
of times the VoicePerson will perform the command. The default
value is 1.
Summary of properties for customizing the VoicePerson:
Name |
Value/Type |
Description |
password |
string |
the word or phrase to speak to activate the person |
case-sensitive |
boolean |
add this property to make the passphrase case-sensitive |
gift-arch |
string |
path to the archetype to clone and give to the player
(e.g. wiz/foobar/jade_key") |
gift-msg |
string |
(optional) message to print to the player when giving the gift |
give-count |
int |
how many times to give out the treasure (default: 1) |
perform-command |
string |
(optional) command to perform when the player speaks the password |
perform-count |
int |
number of times to perform the command (default: 1) |
- Version:
- 1.0, May 2, 2002
- Author:
- Steve Yegge
Method Summary |
void |
hookEvent(java.lang.String hookName,
Rectangle room,
CommandEvent event)
The desired event has taken place in the specified room.
|
void |
initialize()
Sets class-default properties, after loading from
the archetype. |
void |
performCommands()
Performs any commands we might be required to do. |
void |
remove()
Removes from the map. |
void |
setMap(GameMap map,
int x,
int y)
Puts the door in the map - sets a room-hook for the "say"
command. |
Methods inherited from class wyvern.kernel.monsters.MonsterImpl |
addCustomAttacks, addToMap, adjustHP, adjustSP, adjustStat, adjustWallet, burial, checkDirection, createGenericAttacks, createInventory, dropAll, dropAllForce, ensureAI, ensurePartsList, generateInventory, getDamagedDescription, getHP, getInventory, getLevel, getMaxHP, getMaxSP, getPartsList, getSP, getSpellList, getWallet, getXPAward, heartbeat, initInventory, isAlive, isAttackable, isHostile, isMonster, isMonsterOrPlayer, isNeutral, isPeaceful, isPlayer, kill, message, message, methodCalled, mouseClicked, notifyAttacked, setDefaultAttackSpeed, setHP, setLevelProperties, setSP, snuffActiveSpells, start, stop |
Methods inherited from class wyvern.kernel.commands.AbstractCommandable |
addAttack, addHook, addMessageListener, addMethodHook, checkAnimated, command, command, commandNow, destroy, ensureEventQueue, fireMessageReceived, getAI, getCapName, getCombatQueue, getCommand, getEncumbrance, getFiringPoint, getHookList, getHooks, getName, getQueue, isCommandable, isStarted, isTelnet, message, pauseSound, playAlert, playAlert, playDefaultMusic, playPriorityMusic, playPriorityMusic, playSound, playSound, registerCommand, removeAttack, removeHook, removeMessageListener, removeMethodHook, resumeSound, runFailedPostHook, runMethodHook, runPostHook, runPreHook, sendPicture, sendPicture, setAI, setEncumbrance, setMusicGain, setName, setSoundGain, stopAllSounds, stopMusic, stopSound, unregisterCommand |
Methods inherited from class wyvern.kernel.maps.MapObject |
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, addMotionTracker, addObjectTracker, addPrefix, addSuffix, bless, broadcast, broadcast, broadcast, broadcast, broadcast, canEnter, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, ensureListenerList, ensureWeight, externalize, fireContainerEntered, fireContainerExited, fireEnteredMap, fireExitedMap, fireMovedInMap, getAlpha, getAppearance, getArchetype, getBaseName, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, getDescription, getDirection, getGenderPossessive, getGenderPronoun, getImage, getImageDescriptor, getImageDescriptors, getLayer, getLocations, getMap, getMapLink, getMaterial, getMaterialDescription, getMover, getOwningPlayer, getParentMap, getPrefixes, getQuantity, getReferenceLoc, getRelativeLocs, getShortDesc, getSuffixes, getTile, getTile, getValue, getWeight, groupString, inContainer, initLocs, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isBlessed, isCursed, isDamned, isGroupable, isIdentified, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, removeContainerChangeListener, removeFromMap, removeMapChangeListener, removeMapMotionListener, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, setAlpha, setAnimated, setBitmap, setCategory, setContainer, setDefaultBitmap, setDefaultCategory, setDefaultDesc, setDefaultImage, setDefaultIntProperty, setDefaultLayer, setDefaultMaterial, setDefaultProperty, setDefaultShortDesc, setDirection, setImage, setImage, setLayer, setLocations, setMapLink, setQuantity, setShape, setSize, setTransientSize, setWeight, setWeight, teleport, toString, updateMapLocation |
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.Commandable |
addAttack, addMessageListener, command, command, commandNow, getAI, getCapName, getCombatQueue, getCommand, getEncumbrance, getFiringPoint, getName, getQueue, isStarted, isTelnet, message, registerCommand, removeAttack, removeMessageListener, sendPicture, sendPicture, setAI, setEncumbrance, setName, unregisterCommand |
Methods inherited from interface wyvern.lib.GameObject |
addContainerChangeListener, addMapChangeListener, addMapMotionListener, addMotionTracker, addObjectTracker, addPrefix, addSuffix, bless, canEnter, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, destroy, externalize, getAlpha, getAppearance, getArchetype, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, getDescription, getDirection, getGenderPossessive, getGenderPronoun, getImage, getImageDescriptor, getImageDescriptors, getLayer, getLocations, getMap, getMapLink, getMaterial, getMaterialDescription, getMover, getOwningPlayer, getParentMap, getPrefixes, getQuantity, getReferenceLoc, getRelativeLocs, getShortDesc, getSuffixes, getTile, getTile, getValue, getWeight, inContainer, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isBlessed, isCommandable, isCursed, isDamned, isGroupable, isIdentified, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, removeContainerChangeListener, removeMapChangeListener, removeMapMotionListener, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, setAlpha, setAnimated, setBitmap, setCategory, setContainer, setDirection, setImage, setImage, setLayer, setLocations, setMapLink, setQuantity, setShape, setSize, setTransientSize, setWeight, setWeight, teleport |
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 |
Methods inherited from interface wyvern.common.net.RemoteAudio |
pauseSound, playAlert, playAlert, playDefaultMusic, playPriorityMusic, playPriorityMusic, playSound, playSound, resumeSound, setMusicGain, setSoundGain, stopAllSounds, stopMusic, stopSound |
VoicePerson
public VoicePerson()
initialize
public void initialize()
- Description copied from class:
MonsterImpl
- Sets class-default properties, after loading from
the archetype.
- Specified by:
initialize
in interface GameObject
- Overrides:
initialize
in class MonsterImpl
setMap
public void setMap(GameMap map,
int x,
int y)
- Puts the door in the map - sets a room-hook for the "say"
command.
- Specified by:
setMap
in interface GameObject
- Overrides:
setMap
in class MonsterImpl
remove
public void remove()
- Removes from the map. Removes room-hook.
- Specified by:
remove
in interface GameObject
- Overrides:
remove
in class MonsterImpl
hookEvent
public void hookEvent(java.lang.String hookName,
Rectangle room,
CommandEvent event)
- The desired event has taken place in the specified room.
The callback object should be careful not to do too much
processing on the calling thread. However, it's useful to
note that when this method is called, the RoomHookCallback
object has the map-exclusive and can make changes to the map.
This isn't true if it pushes the processing onto another thread.
- Specified by:
hookEvent
in interface RoomHookCallback
- Parameters:
hookName
- the name of the hook (e.g. "sayPostHook") that's
being run.room
- the room in which the event took place, in case
the callback is registered for the same hook in more than
one room.event
- the event
performCommands
public void performCommands()
- Performs any commands we might be required to do.