wyvern.kernel.player
Class PlayerImpl

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.kernel.commands.AbstractCommandable
              extended bywyvern.kernel.monsters.MonsterImpl
                  extended bywyvern.kernel.player.PlayerImpl
All Implemented Interfaces:
Attackable, Broadcaster, Commandable, Damageable, GameObject, HeartbeatCallback, Hookable, MapLoaderListener, MethodHookable, MethodHookCallback, Monster, MouseInterest, Player, PropertyList, RemoteAudio, RPCConstants

public final class PlayerImpl
extends MonsterImpl
implements Player, RPCConstants

The default implementation of the Player interface.

Version:
1.0, Aug 17, 1997
Author:
Steve Yegge

Nested Class Summary
 
Nested classes inherited from class wyvern.kernel.monsters.MonsterImpl
MonsterImpl.WalkVisitor
 
Nested classes inherited from class wyvern.common.net.RPCConstants
RPCConstants.ImageAlign, RPCConstants.ImageFlags, RPCConstants.ImageFormat, RPCConstants.OutputView, RPCConstants.TextStyle
 
Field Summary
 
Fields inherited from class wyvern.kernel.monsters.MonsterImpl
beats_, python_, walkVisitor_
 
Fields inherited from class wyvern.kernel.commands.AbstractCommandable
hookList_, queue_, started_
 
Fields inherited from class wyvern.kernel.maps.MapObject
IN_MAP_EDITOR, listenerList_
 
Fields inherited from class wyvern.kernel.properties.PList
readOnly_
 
Fields inherited from interface wyvern.lib.Player
DEFAULT_PLAYER_SPEED, DEFAULT_WAKE_MONSTER_RADIUS, END_COMBAT_DELAY, MAX_VIEW_SIZE, MAX_WIZ_VIEW_SIZE
 
Fields inherited from interface wyvern.lib.Monster
DEFAULT_MONSTER_ATTACK_SPEED, DEFAULT_MONSTER_SPEED, DEFAULT_MONSTER_STRENGTH, MONSTER_XP_CAP
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Fields inherited from interface wyvern.common.net.RemoteAudio
DEFAULT_ALERT_GAIN, DEFAULT_ALERT_REPEAT_DELAY, DEFAULT_ALERT_REPEATS, DEFAULT_GAIN, DEFAULT_REPEAT_DELAY, DEFAULT_REPEATS
 
Fields inherited from interface wyvern.common.net.RPCConstants
ALERT_EVENT, CHAR_BANISHED, CHAR_BANNED, CHARACTER_NOT_FOUND, CLIENT_END_MUSIC_COMMAND, CLIENT_END_SOUND_COMMAND, CONNECT_RESULT, FLUSH_GRAPHICS, GND_ADD, GND_MODIFY, GND_REMOVE, GND_RESEND, INV_ADD, INV_MODIFY, INV_REMOVE, INV_RESEND, INVALID_PASSWORD, IP_BANISHED, LOGIN_FAILURE, LOGIN_SUCCESS, LOGINS_DISABLED, MAX_IMAGE_SIZE, MUSIC_EVENT, OTHER_LOGIN_ERROR, PAUSE_SOUND, PLAY_ALERT, PLAY_MUSIC, PLAY_SOUND, PROTOCOL_VERSION_MAJOR, PROTOCOL_VERSION_MINOR, QUIT, REGISTER_EXISTING_PLAYER, RESUME_SOUND, SAME_EMAIL_ONLINE, SEND_FILE, SEND_IMAGE, SEND_PICTURE, SEND_TILE, SEND_TILE_MAPPINGS, SERVER_TRANSFER, SET_GAIN, SOUND_EVENT, STAT_SEND_SPELLS, STAT_SET_FOOD, STAT_SET_GOLD, STAT_SET_HP, STAT_SET_LEVEL, STAT_SET_LOAD, STAT_SET_NAME, STAT_SET_RANGE, STAT_SET_SP, STAT_SET_XP, STAT_START_POISON, STAT_STOP_POISON, STAT_UPDATE_ALL, STOP_ALL_SOUNDS, STOP_MUSIC, STOP_SOUND, TEXT_OUT, TOO_MANY_PLAYERS, UNCACHE_IMAGE, XML_COMMAND, XML_COMMAND_WITH_COMPRESSED_DATA, XML_COMMAND_WITH_DATA, ZIP_PARTIAL_SCREEN, ZIP_SCREEN, ZIP_TEXT_OUT
 
Constructor Summary
PlayerImpl()
          Constructs a new PlayerImpl.
 
Method Summary
 void adjustAlign(int adjust)
          Adjusts the player's alignment upwards or downwards.
 void adjustFood(int adjust)
          Adjusts the player's food amount by the specified amount.
 void adjustHP(int adjust)
          Adjusts the object's hit points upwards or downwards.
 void adjustShoutPoints(int adjust)
          Adjusts the player's shout points upwards or downwards.
 void adjustSkill(java.lang.String name, int adjust)
          Adjusts the transient value of a skill for the player.
 void adjustSP(int adjust)
          Adjusts the monster's spell points upwards or downwards.
 void adjustWallet(long amount)
          Adjusts the amount of money the player is carrying by a positive or negative amount.
 void adjustXP(int adjust)
          Adjusts the player's experience points upwards or downwards.
 boolean autosave()
          Saves the current state of the player to the player's file, without issuing any message to the player.
 void broadcastEntry(boolean entered)
          Tells certain lists that the player entered or left the game.
 void burial(GameObject attacker)
          Kills a player, for real.
 long combatTimeLeft()
          Returns time left before we change this API.
 void command(java.lang.String cmd, boolean user)
          Method called when a command is added to the command queue.
 void computeStartTime()
          Initializes idle timer and start date.
protected  java.lang.String computeTitle()
          Figures out what the player's title should be.
 void controlCamera(boolean control)
          Tells the Player to control its own camera (if true) or notifies the Player that the camera will be controlled externally (if false).
 void createInventory()
          Creates the Inventory if not present, and sets the owner field.
 void destroy()
          Destroys the player object.
 void dropInventoryIfGuest()
           
 void enqueueCommand(java.lang.String command, boolean user)
          Puts a command in our command queue.
 void ensureAI()
          Don't give us an AI on construction.
protected  void ensureEventQueue()
          Creates an extra event queue for combat commands, so automatic combat happens in parallel with movement.
protected  void ensurePartsList()
          Makes a default (humanoid) body-parts list for the monster.
 int getAge()
          Returns the player's age in seconds.
 java.util.Map getAliases()
          Returns the aliases for this player.
 int getAlignment()
          Returns player's alignment
 RemoteClient getClient()
          Returns the RemoteClient implementation for this player.
 EventQueue getCombatQueue()
          Returns the combat queue, in case you want to place attack commands into it directly.
 Command getCommand(CommandEvent event)
          Figures out who will handle a given command.
 CommandList getCommandList()
          Returns the CommandList for this player.
 int getFood()
          Returns the player's current food level.
 java.lang.String getFullTitle()
          Returns a full title, such as "Rawk the Elven Adventurer".
 Camera getGroundCamera()
          Returns the camera that displays the ground beneath the player.
 GameObject getGroundObject(int index)
          This is a rather special-purpose method: it returns the game object that's currently being displayed in the client's ground display at the specified index.
 Heart getHeart()
           
 java.lang.String getHostAddress()
          Returns the IP address this player is connected from.
 int getIdleTime()
          Returns the number of seconds the player has been idle.
 Camera getMapCamera()
          Returns the camera that displays the map.
 int getMaxFood()
          Returns the max food the player can eat/drink.
 MusicState getMusicState()
          Returns the MusicState object keeping track of this player's running soundtrack.
 java.lang.String getName()
          Returns the name of this commandable
 java.lang.String getPassword()
          Returns the player's encrypted password.
 Point getPositionInViewport()
          Returns the relative offets of the player within the player's map camera.
 java.lang.String getRace()
          Returns player's race.
 wyvern.server.IClientSession getSession()
          Returns the ClientSession for this player.
 java.lang.String getSex()
          Returns player's gender.
 int getShoutPoints()
          Returns the player's shout points.
 SpellList getSpellList()
          Returns the player's SpellList, or null if they don't know any spells (or are a Wizard who can cast anything.)
 java.util.Date getStartDate()
          Returns the time when the player logged in.
 long getStartTime()
          Returns System.currentTimeMillis() when the player logged in.
 java.lang.String getTitle()
          Returns the player's title, e.g.
 int getXP()
          Returns the player's experience.
 int getXPAward()
          Returns the experience award for killing this monster.
 void heartbeat()
          Heartbeat notification, called every 5 seconds on every player and (started) monster in the game.
 boolean inCombat()
          Returns true if the player has recently been in combat.
 void init(RemoteClient client, Dimension viewsize)
          Initializes the player instance and data structures using the specified RemoteClient.
 boolean isGuest()
          Returns true if the player is a guest.
 boolean isHallOfFamer()
           
 boolean isHandheld()
          Returns true if the player is connected via a handheld client.
 boolean isMonster()
          Returns true if (and only if) this is a Monster (and not a Player).
 boolean isNetDead()
          Returns true if the player is currently net-dead.
 boolean isPlayer()
          Returns true if (and only if) this is a Player.
 boolean isRobot()
           
 boolean isShutDown()
          Returns true if this Player object is defunct (the player has logged out).
 boolean isTelnet()
          Returns true if we're connected via a Telnet client.
 boolean isWizard()
          Returns true if the player is a Wizard (any level).
 void kill(GameObject attacker)
          Kills the player.
 long lastCombat()
          Returns the last time the player had an updateCombat() method called.
 void makeGravestone(GameObject attacker, int xpLost, int guildXpLost)
           
 void mapLoaded(GameMap map, java.lang.String name)
          If the player applies a teleporter for a map that hasn't been loaded yet, this method gets called when the map finishes loading.
 void mapLoadFailed(java.lang.String name)
          Called when the requested map couldn't be loaded.
 void message(java.lang.String msg)
          Outputs a message to this object.
 void message(java.lang.String[] strings, byte[] styles)
          Sends a message to the client as an array of strings and styles to use for each piece.
 void message(java.lang.String msg, byte style)
          Sends a message to the client using the specified style.
 void notifyAttacked(Commandable attacker)
          Notifies the object it's being attacked.
 boolean outranks(Commandable other)
          Returns true if this player outranks the passed player.
 void pauseSound(java.lang.String id)
          Pauses a particular sound.
 void playAlert(java.lang.String path)
          Plays the specified sound file on the client, one repeat, no delay, and the default gain.
 void playAlert(java.lang.String path, int repeats, int repeatDelay, double gain)
          Plays the specified alert with custom parameters.
 void playDefaultMusic()
          The player has switched maps, so figure out the default background music to be playing, and plays it.
 void playPriorityMusic(java.lang.String path)
          Sets the background music track to the specified file, with the default gain/volume.
 void playPriorityMusic(java.lang.String path, int repeats, int delay, double gain)
          Plays the specified music with custom parameters.
 void playSound(java.lang.String path, java.lang.String id)
          Plays a sound effect on the client with the default gain.
 void playSound(java.lang.String path, java.lang.String id, int repeats, int repeatDelay, double gain)
          Plays the specified sound effect with custom parameters.
protected  void processStartupCommands()
          Gets the list of startup commands from the "startcmds" StringList property, and puts each one in the agent's queue.
 void quit()
          Dumps the player out of the game, dropping all inventory before saving the player.
 void quitSafely()
          Player's quitting in an Inn or somewhere they can keep their inventory.
 void readAliases()
          Rebuilds the table of aliases for this player, by looking through all the player's properties that start with "alias-".
 void reconnect(RemoteClient client, Dimension viewsize)
          Reconnects a net-dead player.
 void registerCommand(java.lang.String command, Command handler)
          Registers a new command with the monster or player.
 void remove()
          Removes this object from its map.
 void resetIdleTimer()
          Resets the number of seconds the player has been idle to zero.
 void restart()
          Resets the player after dying.
 void resumeSound(java.lang.String id)
          Resumes a particular sound.
 boolean save()
          Saves the player with notification.
 void sendFile(java.lang.String path, java.lang.String command)
          Downloads a file to the client.
 void sendFood()
          Updates player's food display on the client.
 void sendHP()
          Updates the player's hit-points display on the client.
 void sendImage(java.lang.String path)
           
 void sendLevel()
          Updates player's level display on the client.
 void sendLoad()
          Updates the player's encumbrance display on the client.
 void sendName()
          Updates the player's name on the client.
 void sendPicture(java.lang.String path, java.lang.String title)
          Sends a picture to the client.
 void sendPicture(java.lang.String path, java.lang.String title, byte format, byte align, byte view, int flags)
          Sends a picture to the client.
 void sendRange()
          Updates the player's range-weapon on the client.
 void sendSP()
          Updates the player's spell-points display on the client.
 void sendSpells()
          Resends the player's list of known spells to the client.
 void sendTile(int tile, java.lang.String path, long timestamp)
           
 void sendXP()
          Updates the player's experience display on the client.
 void serverTransfer(java.lang.String host)
          Tells the client to connect to a different server after a successful transfer.
 void setEncumbrance(int load)
          Sets the encumbrance of the player.
 void setHeart(Heart heart)
           
 void setHP(int hp)
          Sets the current HP for the player, but keeps it within the valid range of (0, "max-hp")
 void setLevelProperties()
          Initializes default properties based on the monster's level.
 void setMap(GameMap map, int x, int y)
          Puts the player in a new map.
 void setMusicGain(double gain)
          Sets the volume of the background music.
 void setNetDead()
          Sets the net-dead flag.
 void setSession(wyvern.server.IClientSession session)
          Sets the ClientSession (the thread reading from the socket).
 void setSoundGain(java.lang.String id, double gain)
          Sets the volume of a particular sound playing on the client.
 void setSP(int sp)
          Sets the current SP for the player, but keeps it within the valid range of (0, "max-sp")
 void setTitle(java.lang.String title)
          Sets the player's title, e.g.
 void setViewSize(int width, int height)
          Sets new dimensions for the map camera.
 boolean solvedQuest(java.lang.String name)
          Returns true if the player has solved the specified quest.
 void startPoison()
          Turns the client HP indicator green.
 void stop()
          Stops the player permanently.
 void stopAllSounds()
          Stops all of the currently playing sounds on the client.
 void stopMusic()
          Stops the background music completely.
 void stopPoison()
          Returns the client HP indicator red.
 void stopSound(java.lang.String id)
          Stops the specified sound effect.
 void tellLater(java.lang.String msg, byte style)
          Puts a message in the player's event queue that will be displayed to the player after all current events in the queue are processed.
 java.lang.String toString()
          Prints information about the player.
 void uncacheImage(java.lang.String path)
          Tells the client to uncache the specified image, and request it to be reloaded if it views it again.
 void unregisterCommand(java.lang.String command, Command handler)
          Unregisters a command.
 void updateClient()
          Sends all our visible stats to the client.
 void updateCombat()
          Marks the player as being in combat.
protected  void updateMapLocation(java.util.List src, java.util.List dest)
          This method is called by move(), teleport() and setLocations() to remove the object from its old locations and place it in its new locations.
 void viewMap(GameMap map, int x, int y)
          This is used by the World object to show what's going on in the map while the player is logging in.
 void wakeMonsters()
          Maybe wakes up nearby monsters.
 
Methods inherited from class wyvern.kernel.monsters.MonsterImpl
addCustomAttacks, addToMap, adjustStat, checkDirection, createGenericAttacks, dropAll, dropAllForce, generateInventory, getDamagedDescription, getHP, getInventory, getLevel, getMaxHP, getMaxSP, getPartsList, getSP, getWallet, initialize, initInventory, isAlive, isAttackable, isHostile, isMonsterOrPlayer, isNeutral, isPeaceful, methodCalled, mouseClicked, setDefaultAttackSpeed, snuffActiveSpells, start
 
Methods inherited from class wyvern.kernel.commands.AbstractCommandable
addAttack, addHook, addMessageListener, addMethodHook, checkAnimated, command, commandNow, fireMessageReceived, getAI, getCapName, getEncumbrance, getFiringPoint, getHookList, getHooks, getQueue, isCommandable, isStarted, removeAttack, removeHook, removeMessageListener, removeMethodHook, runFailedPostHook, runMethodHook, runPostHook, runPreHook, setAI, setName
 
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, 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
 
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.Monster
adjustStat, dropAll, dropAllForce, getLevel, getMaxSP, getPartsList, getSP, getWallet, isAlive
 
Methods inherited from interface wyvern.lib.Commandable
addAttack, addMessageListener, command, commandNow, getAI, getCapName, getEncumbrance, getFiringPoint, getInventory, getQueue, isStarted, removeAttack, removeMessageListener, setAI, setName, start
 
Methods inherited from interface wyvern.lib.Hookable
addHook, getHookList, getHooks, removeHook, runFailedPostHook, runPostHook, runPreHook
 
Methods inherited from interface wyvern.lib.MethodHookable
addMethodHook, removeMethodHook, runMethodHook
 
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, externalize, getAlpha, getAppearance, getArchetype, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, getDamagedDescription, 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, initialize, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, isBlessed, isCommandable, isCursed, isDamned, isGroupable, isIdentified, isMonsterOrPlayer, isTerrain, isUncursed, isUnpaid, 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, setIntP