|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
RPC interface for the client. The server makes calls through this interface to communicate with a client.
Nested Class Summary |
Nested classes inherited from class wyvern.common.net.RPCConstants |
RPCConstants.ImageAlign, RPCConstants.ImageFlags, RPCConstants.ImageFormat, RPCConstants.OutputView, RPCConstants.TextStyle |
Field Summary |
Fields inherited from interface wyvern.common.net.RemoteInventory |
GROUND, INVENTORY |
Method Summary | |
java.lang.String |
getHostAddress()
Returns the IP address this socket is connected to. |
java.lang.String |
getIP()
Returns the IP address for the associated Player. |
int |
getMajorVersion()
|
int |
getMinorVersion()
Returns the major version number of this client. |
java.lang.String |
getName()
Returns the name of the player we're associated with. |
Player |
getPlayer()
Returns the Player associated with this client. |
int |
getReleaseVersion()
Returns the major version number of this client. |
RPCVersion |
getRPCVersion()
Gets the protocol version for this client. |
wyvern.server.IClientSession |
getSession()
Returns the ClientSession we're paired with (we do the output, it does the input). |
java.net.Socket |
getSocket()
Returns the TCP Socket for this client. |
java.lang.String |
getVersionString()
Returns the entire version string for this client. |
boolean |
isHandheld()
Returns true if this is a handheld client. |
boolean |
isRobot()
Used for automated testing scripts. |
boolean |
isShutDown()
Returns true if the client has been told to shut down, e.g. from an IOException, or because the player quit normally. |
boolean |
isTelnet()
Returns true if this is a telnet client. |
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 |
playMusic(java.lang.String path,
java.lang.String id)
Sets the background music track to the specified file, with the default gain/volume. |
void |
playMusic(java.lang.String path,
java.lang.String id,
int repeats,
int repeatDelay,
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. |
void |
quit()
Tells the client that the player has been dumped off the game. |
void |
resumeSound(java.lang.String id)
Resumes a particular sound. |
void |
sendFile(java.lang.String path,
java.lang.String command)
Sends a file to the client, requested by a #download command. |
void |
sendHandshake(boolean success,
java.lang.String msg)
Acknowledges registration with a success or failure code. |
void |
sendImage(java.lang.String path)
Sends an image file 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 be displayed in the text-display area, or in a popup. |
void |
sendTile(int tile,
java.lang.String path,
long timestamp)
Sends a tile-number-to-image mapping to the client. |
void |
sendTileMappings()
Sends the tile/image mappings that have been generated on the server since the server started up. |
void |
serverTransfer(java.lang.String host)
Instructs the player to connect to the specified server. |
void |
setHandheld(boolean handheld)
Flags this as a handheld client. |
void |
setMusicGain(double gain)
Sets the volume of the background music. |
void |
setPlayer(Player player)
Sets the Player object for this RemoteClient. |
void |
setRPCVersion(RPCVersion v)
Sets the protocol version for this client. |
void |
setSoundGain(java.lang.String id,
double gain)
Sets the volume of a particular sound playing on the client. |
void |
shutDown()
Shuts the client down. |
void |
stopAllSounds()
Stops all of the currently playing sounds on the client. |
void |
stopMusic()
Stops the background music completely. |
void |
stopSound(java.lang.String id)
Stops the specified sound effect. |
void |
textOut(java.lang.String text)
Outputs some text to the client text display area, using the default style. |
void |
textOut(java.lang.String[] pieces,
byte[] styles)
Outputs a message to the client text display area. |
void |
textOut(java.lang.String text,
byte style)
Outputs some text to the client text display area. |
void |
textOut(java.lang.String text,
java.lang.String font,
int rgba,
int size)
Outputs some text to the client text display area. |
void |
uncacheImage(java.lang.String path)
Tells the client to uncache an image's data, which will force it to ask for a new copy. |
void |
writeByte(byte b)
Writes a single byte to the output stream, usually one of the commands in RPCConstants. |
Methods inherited from interface wyvern.common.net.RemoteMap |
sendPartialScreen, sendZippedScreen |
Methods inherited from interface wyvern.common.net.RemoteInventory |
add, modify, remove, resend |
Methods inherited from interface wyvern.common.net.RemoteStats |
sendSpells, setFood, setGold, setHP, setLevel, setLoad, setName, setRange, setSP, setXP, startPoison, stopPoison, updateAll |
Method Detail |
public void writeByte(byte b)
b
- the byte to writepublic void textOut(java.lang.String text)
text
- text to displaypublic void textOut(java.lang.String text, byte style)
text
- text to displaystyle
- an RPCConstants.TextStyle enum valuepublic void textOut(java.lang.String text, java.lang.String font, int rgba, int size)
text
- the message to displayfont
- the font style ( "serif", "dialog", etc. - must
be interpreted by the client, and the client may not support it.)rgba
- a 32-bit rgba value for the colorsize
- the font size (e.g. 10 for 10-point)public void textOut(java.lang.String[] pieces, byte[] styles)
pieces
- a list of strings that will be joined togetherstyles
- the RPCConstants.TextStyle for each piece
The styles and pieces arrays must be the same length.public void sendPicture(java.lang.String path, java.lang.String title, byte format, byte align, byte view, int flags)
path
- the relative path to the image filetitle
- the title of the picture, to be displayed
if the client doesn't support images, or if the image
couldn't be loadedalign
- an RPCConstants.ImageAlign constantformat
- an RPCConstants.ImageFormat constantview
- an RPCConstants.OutputView constantflags
- RPCConstants.ImageFlagspublic void sendFile(java.lang.String path, java.lang.String command)
path
- the relative path to the file, including extension.
Files without extensions cannot be sent.command
- the (entire) command that the client sent in
order to request the file, e.g. "#download music/ogg/foo.ogg".
The last argument to the command is the file path, and
anything before it can be used for routing on the client side.
E.g. "#download audio 12345 music/ogg/foo.ogg" will still
request a file download of foo.ogg, but the client can get
read the routing stuff out of the original command string
when it comes back.public void quit()
public void sendHandshake(boolean success, java.lang.String msg)
success
- true if the player was registeredmsg
- the message to display if unsuccessfulpublic void serverTransfer(java.lang.String host)
host
- the host that's expecting this player to connect,
e.g. "jade.cabochon.com"public void sendTileMappings()
public void sendTile(int tile, java.lang.String path, long timestamp)
tile
- the tile numberpath
- the path to the image in the client's image cachetimestamp
- the last time the image was modifiedpublic void sendImage(java.lang.String path)
path
- where to put the image in the client's image cachepublic void uncacheImage(java.lang.String path)
path
- the (relative) image path to uncachepublic void playAlert(java.lang.String path)
Can't be stopped, so use with care.
path
- the relative path to the sound filepublic void playAlert(java.lang.String path, int repeats, int repeatDelay, double gain)
Parameters are file path, number of repeats, delay between repeats, and gain (volume). The alert won't play if the path is null or not found on the server. All other params are adjusted to be within the valid range for the parameter, if necessary.
path
- the relative path to the sound file.repeats
- number of times the client should repeat
the piece before stopping (and for music and sound,
sending the notification back to the server). 0 means
don't repeat; just play and stop.repeatDelay
- number of milliseconds to pause
between repeats, if we're repeating.gain
- the volume for this track, from 0.0 to 1.0public void playMusic(java.lang.String path, java.lang.String id)
Client sends an "#endmusic" directive back to the server when it's finished playing all the repeats. If the piece is looping indefinitely, it will not send the directive, even when the music is changed or stopped.
path
- the relative path to the sound file, including
extension. Can be any supported sound format (midi, ogg,
others.) Nothing will be played if the path is null, or
the file isn't found on the server. public void playMusic(java.lang.String path, java.lang.String id, int repeats, int repeatDelay, double gain)
path
- the relative path to the sound file. Can
be any supported sound format.repeats
- number of times the client should repeat
the piece before stopping and sending a notification
back to the server. A value of 0 means don't repeat;
just play the track once. A value of -1 means repeat
indefinitely.repeatDelay
- number of milliseconds to pause
between repeats, if we're repeating. Negative values
are interpreted as zero (no delay).gain
- the volume for this track, from 0.0 to 1.0.
Values outside the range are clipped to 0.0 or 1.0.public void stopMusic()
public void setMusicGain(double gain)
gain
- the new background music gain, from 0.0 to 1.0public void playSound(java.lang.String path, java.lang.String id)
Client sends a "#endsound id" directive back to the server when the sound finishes playing, unless it was interrupted with stopSound() or stopAllSounds().
path
- relative path to the sound file, in any
supported format, including midi.id
- the unique ID of this sound. It has to
be unique, so you can't use (for example) the hashcode
of the path to the file, since more than one of the
same sound may be playing at once. Usually you pass
the hashcode of the object that emitted the sound.public void playSound(java.lang.String path, java.lang.String id, int repeats, int repeatDelay, double gain)
path
- the relative path to the sound file, in
any supported format, including midi.id
- the unique ID of this sound. It has to
be unique, so you can't use (for example) the hashcode
of the path to the file, since more than one of the
same sound may be playing at once. Usually you pass
the hashcode of the object that emitted the sound.repeats
- number of times the client should repeat
the piece before stopping and sending a notification
back to the server. A value of 0 means don't repeat;
just play the track once. A value of -1 means repeat
indefinitely, until explicitly stopped.repeatDelay
- number of milliseconds to pause
between repeats, if we're repeating. Negative values
are interpreted as zero (no delay).gain
- the volume for this track, from 0.0 to 1.0.
Values outside the range are clipped to 0.0 or 1.0.public void stopSound(java.lang.String id)
id
- the unique ID of the sound effect. The client
will not send an "#endsound" back to the server.public void stopAllSounds()
public void setSoundGain(java.lang.String id, double gain)
gain
- the new background music gain, from 0.0 to 1.0id
- the unique track ID for the sound to modifypublic void pauseSound(java.lang.String id)
id
- the unique track id of the sound to resumepublic void resumeSound(java.lang.String id)
id
- the unique track id of the sound to resumepublic boolean isTelnet()
public void setPlayer(Player player)
public Player getPlayer()
public java.lang.String getName()
public java.lang.String getHostAddress()
public void setHandheld(boolean handheld)
public wyvern.server.IClientSession getSession()
public java.net.Socket getSocket()
public java.lang.String getIP()
public boolean isHandheld()
public void shutDown()
public boolean isShutDown()
public int getMajorVersion()
public int getMinorVersion()
public int getReleaseVersion()
public java.lang.String getVersionString()
public void setRPCVersion(RPCVersion v)
public RPCVersion getRPCVersion()
public boolean isRobot()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |