java.lang.Object com.realtime.crossfire.jxclient.server.server.DefaultServerConnection com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection
public class DefaultCrossfireServerConnection
Default implementation of CrossfireServerConnection
.
Field Summary | |
---|---|
private static byte[] |
ACCOUNT_ADD_PLAYER_PREFIX
The command prefix for the "accountaddplayer" command. |
private static byte[] |
ACCOUNT_LOGIN_PREFIX
The command prefix for the "accountlogin" command. |
private static byte[] |
ACCOUNT_NEW_PREFIX
The command prefix for the "accountnew" command. |
private static byte[] |
ACCOUNT_PLAY_PREFIX
The command prefix for the "accountplay" command. |
private java.lang.String |
accountName
The account name. |
private static int |
ACL_CLASS
Parameter type in the "accountplayers" command. |
private static int |
ACL_FACE
Parameter type in the "accountplayers" command. |
private static int |
ACL_FACE_NUM
Parameter type in the "accountplayers" command. |
private static int |
ACL_LEVEL
Parameter type in the "accountplayers" command. |
private static int |
ACL_MAP
Parameter type in the "accountplayers" command. |
private static int |
ACL_NAME
Parameter type in the "accountplayers" command. |
private static int |
ACL_PARTY
Parameter type in the "accountplayers" command. |
private static int |
ACL_RACE
Parameter type in the "accountplayers" command. |
private static byte[] |
ADDME_PREFIX
The command prefix for the "addme" command. |
private static byte[] |
APPLY_PREFIX
The command prefix for the "apply" command. |
private static byte[] |
ASKFACE_PREFIX
The command prefix for the "askface" command. |
private java.nio.ByteBuffer |
byteBuffer
A byte buffer using writeBuffer to store the data. |
private ClientSocketListener |
clientSocketListener
The ClientSocketListener attached to the server socket. |
private ClientSocketState |
clientSocketState
The current connection state. |
private static byte[] |
CREATE_PLAYER_PREFIX
The command prefix for the "createplayer" command. |
private java.util.Collection<CrossfireAccountListener> |
crossfireAccountListeners
The CrossfireAccountListener s to be notified. |
private java.util.Collection<CrossfireComcListener> |
crossfireComcListeners
The CrossfireComcListener s to be notified. |
private java.util.Collection<CrossfireExpTableListener> |
crossfireExpTableListeners
The CrossfireExpTableListener s to be notified. |
private java.util.Collection<CrossfireFaceListener> |
crossfireFaceListeners
The CrossfireFaceListener s to be notified. |
private java.util.Collection<CrossfireFailureListener> |
crossfireFailureListeners
The CrossfireFailureListener s to be notified. |
private java.util.Collection<CrossfireMusicListener> |
crossfireMusicListeners
The CrossfireMusicListener s to be notified. |
private java.util.Collection<CrossfirePickupListener> |
crossfirePickupListeners
The CrossfirePickupListener s to be notified. |
private java.util.Collection<CrossfireServerConnectionListener> |
crossfireServerConnectionListeners
The CrossfireServerConnectionListener s to notify. |
private java.util.Collection<CrossfireSkillInfoListener> |
crossfireSkillInfoListeners
The CrossfireSkillInfoListener s to be notified. |
private java.util.Collection<CrossfireSoundListener> |
crossfireSoundListeners
The CrossfireSoundListener s to be notified. |
private java.util.Collection<CrossfireSpellListener> |
crossfireSpellListeners
The CrossfireSpellListener s to be notified. |
private java.util.Collection<CrossfireStatsListener> |
crossfireStatsListeners
The CrossfireStatsListener s to be notified. |
private java.util.Collection<CrossfireTickListener> |
crossfireTickListeners
The CrossfireTickListener s to be notified. |
private java.util.Collection<CrossfireUpdateFaceListener> |
crossfireUpdateFaceListeners
The CrossfireUpdateFaceListener s to be notified. |
private java.util.Collection<CrossfireUpdateItemListener> |
crossfireUpdateItemListeners
The CrossfireUpdateItemListener s to be notified. |
private java.util.Collection<CrossfireUpdateMapListener> |
crossfireUpdateMapListeners
The CrossfireUpdateMapListener s to be notified. |
private int |
currentMapHeight
The currently active map height. |
private int |
currentMapWidth
The currently active map width. |
private int |
currentNumLookObjects
The currently active number of ground view objects. |
private DebugWriter |
debugProtocol
The appender to write protocol commands to. |
private static int |
DEFAULT_MAP_HEIGHT
The default map height when no "setup mapsize" command has been sent. |
private static int |
DEFAULT_MAP_WIDTH
The default map width when no "setup mapsize" command has been sent. |
private static int |
DEFAULT_NUM_LOOK_OBJECTS
The default number of ground objects when no "setup num_look_objects" command has been sent. |
private java.util.Collection<CrossfireDrawextinfoListener> |
drawextinfoListeners
The CrossfireDrawextinfoListener s to be notified. |
private java.util.Collection<CrossfireDrawinfoListener> |
drawinfoListeners
The CrossfireDrawinfoListener s to be notified. |
private static byte[] |
EXAMINE_PREFIX
The command prefix for the "examine" command. |
private static int |
FACE_COLOR_MASK
Bitmask in magic map information to extract the color information of a tile. |
private static int |
FACE_FLOOR
Bitmask in magic map information to denote a floor tile. |
private static int |
FACE_WALL
Bitmask in magic map information to denote a wall tile. |
private static byte[] |
LOCK_PREFIX
The command prefix for the "lock" command. |
private int |
loginMethod
The login method version supported by the server we're connected to. |
private static byte[] |
LOOKAT_PREFIX
The command prefix for the "lookat" command. |
private java.util.Collection<CrossfireMagicmapListener> |
magicmapListeners
The CrossfireMagicmapListener s to be notified of received
magicmap commands. |
private static byte[] |
MARK_PREFIX
The command prefix for the "mark" command. |
private static byte[] |
MOVE_PREFIX
The command prefix for the "move" command. |
private static byte[] |
NCOM_PREFIX
The command prefix for the "ncom" command. |
private int |
packet
The packet id for the next "ncom" command to send. |
private static java.util.regex.Pattern |
PATTERN_DOT
Pattern to split a string by ":". |
private int |
pendingMapHeight
The map height that is being negotiated with the server. |
private int |
pendingMapWidth
The map width that is being negotiated with the server. |
private int |
pendingNumLookObjects
The number of ground view objects being negotiated with the server. |
private int |
preferredMapHeight
The map height in tiles that is negotiated with the server. |
private int |
preferredMapWidth
The map width in tiles that is negotiated with the server. |
private int |
preferredNumLookObjects
The number of ground view objects to be negotiated with the server. |
private java.util.Collection<CrossfireQueryListener> |
queryListeners
The CrossfireQueryListener s to be notified. |
private java.util.Collection<ReceivedPacketListener> |
receivedPacketListeners
The ReceivedPacketListener s to be notified. |
private java.lang.Object |
redrawSemaphore
The semaphore used to synchronized map model updates and map view redraws. |
private static byte[] |
REPLY_PREFIX
The command prefix for the "reply" command. |
private static byte[] |
REQUESTINFO_PREFIX
The command prefix for the "requestinfo" command. |
private java.util.Collection<SentReplyListener> |
sentReplyListeners
The SentReplyListener s to be notified. |
private static byte[] |
SETUP_PREFIX
The command prefix for the "setup" command. |
private static byte[] |
TOGGLEEXTENDEDTEXT_PREFIX
The command prefix for the "toggleextendedtext" command. |
private static java.nio.charset.Charset |
UTF8
The Charset used for parsing or encoding strings received from or
sent to the Crossfire server. |
private java.lang.String |
version
The version information to send when connecting to the server. |
private static byte[] |
VERSION_PREFIX
The command prefix for the "version" command. |
private byte[] |
writeBuffer
Buffer to build commands to send. |
Constructor Summary | |
---|---|
DefaultCrossfireServerConnection(java.lang.Object redrawSemaphore,
DebugWriter debugProtocol,
java.lang.String version)
Creates a new instance. |
Method Summary | |
---|---|
void |
addCrossfireAccountListener(CrossfireAccountListener listener)
Adds a listener to be notified about account events. |
void |
addCrossfireComcListener(CrossfireComcListener listener)
Adds a listener to be notified about received comc commands. |
void |
addCrossfireDrawextinfoListener(CrossfireDrawextinfoListener listener)
Adds a new listener monitoring the drawextinfo S->C messages. |
void |
addCrossfireDrawinfoListener(CrossfireDrawinfoListener listener)
Adds a new listener monitoring the drawinfo S->C messages. |
void |
addCrossfireExpTableListener(CrossfireExpTableListener crossfireExpTableListener)
Adds a listener to be notified about received experience table changes. |
void |
addCrossfireFaceListener(CrossfireFaceListener listener)
Adds a listener to be notified about received face commands. |
void |
addCrossfireFailureListener(CrossfireFailureListener listener)
Adds a listener to be notified of failure messages. |
void |
addCrossfireMagicmapListener(CrossfireMagicmapListener listener)
Adds a listener from the list of objects listening to magicmap messages. |
void |
addCrossfireMusicListener(CrossfireMusicListener listener)
Adds a listener to be notified about received music commands. |
void |
addCrossfirePickupListener(CrossfirePickupListener listener)
Adds a listener to be notified about received "pickup" messages. |
void |
addCrossfireQueryListener(CrossfireQueryListener listener)
Adds a new listener monitoring the query S->C messages. |
void |
addCrossfireServerConnectionListener(CrossfireServerConnectionListener listener)
Adds a listener to be notified about connection progress. |
void |
addCrossfireSkillInfoListener(CrossfireSkillInfoListener listener)
Adds a listener to be notified about received skill info changes. |
void |
addCrossfireSoundListener(CrossfireSoundListener listener)
Adds a listener to be notified about received sound commands. |
void |
addCrossfireSpellListener(CrossfireSpellListener listener)
Adds a listener to be notified about received spell commands. |
void |
addCrossfireStatsListener(CrossfireStatsListener crossfireStatsListener)
Adds a listener to be notified about stats changes. |
void |
addCrossfireTickListener(CrossfireTickListener listener)
Adds a listener to be notified about tick changes. |
void |
addCrossfireUpdateFaceListener(CrossfireUpdateFaceListener listener)
Add a listener to be notified about face image changes. |
void |
addCrossfireUpdateItemListener(CrossfireUpdateItemListener crossfireUpdateItemListener)
Adds a listener to be notified about item changes. |
void |
addCrossfireUpdateMapListener(CrossfireUpdateMapListener listener)
Adds a listener to be notified about map changes. |
void |
addPacketWatcherListener(ReceivedPacketListener listener)
Adds a listener to be notified about received packets. |
void |
addSentReplyListener(SentReplyListener listener)
Adds a listener to be notified about sent reply packets. |
private void |
clearFailure()
Inform the various failure listeners that they can clean the last displayed failure. |
private void |
cmdMap2Coordinate(java.nio.ByteBuffer packet,
int x,
int y)
Processes the payload data for a map2 coordinate command. |
private void |
cmdMap2CoordinateClearSpace(int x,
int y,
int len)
Processes the payload data for a map2 coordinate "clear_space" sub-command. |
private void |
cmdMap2CoordinateDarkness(java.nio.ByteBuffer packet,
int x,
int y,
int len)
Processes the payload data for a map2 coordinate "darkness" sub-command. |
private void |
cmdMap2CoordinateLayer(java.nio.ByteBuffer packet,
int x,
int y,
int len,
int layer)
Processes the payload data for a map2 coordinate "layer" sub-command. |
private void |
cmdMap2CoordinateLayer3(java.nio.ByteBuffer packet,
int x,
int y,
int layer,
int face)
Processes the additional payload data for a map2 coordinate "layer" sub-command having 4 bytes payload. |
private void |
cmdMap2CoordinateLayer4(java.nio.ByteBuffer packet,
int x,
int y,
int layer,
int face)
Processes the additional payload data for a map2 coordinate "layer" sub-command having 4 bytes payload. |
private void |
cmdReplyinfo(java.lang.String infoType,
java.nio.ByteBuffer packet)
Handles the replyinfo server to client command. |
void |
connect(java.lang.String hostname,
int port)
Attempts to connect the client to a server. |
private void |
connected()
Called after the server connection has been established. |
void |
drawextinfo(int color,
int type,
int subtype,
java.lang.String message)
Pretends that a drawextinfo message has been received. |
void |
drawInfo(java.lang.String message,
int color)
Pretends that a drawinfo message has been received. |
void |
drawInfoSetDebugMode(boolean printMessageTypes)
Enables or disables printing of message types. |
private static java.lang.String |
extractCommand(java.nio.ByteBuffer packet)
Returns the command string for a received packet. |
private void |
fireNewMap()
Notifies all listeners that a "newmap" command has been received. |
java.lang.String |
getAccountName()
Returns the current account name. |
private static int |
getInt1(java.nio.ByteBuffer byteBuffer)
Extracts and removes a 1 byte integer from a ByteBuffer at it's
current position. |
private static int |
getInt2(java.nio.ByteBuffer byteBuffer)
Extracts and removes a 2 byte integer from a ByteBuffer at it's
current position. |
private static int |
getInt4(java.nio.ByteBuffer byteBuffer)
Extracts and removes a 4 byte integer from a ByteBuffer at it's
current position. |
private static long |
getInt8(java.nio.ByteBuffer byteBuffer)
Extracts and removes an 8 byte integer from a ByteBuffer at it's
current position. |
int |
getMapHeight()
Returns the map height in tiles. |
int |
getMapWidth()
Returns the map width in tiles. |
private static java.lang.String |
getString(java.nio.ByteBuffer byteBuffer,
int len)
Extracts and removes a string from a ByteBuffer at it's current
position. |
private static java.lang.String |
hexDump(java.nio.ByteBuffer byteBuffer)
Returns a hex-dump of a ByteBuffer . |
private void |
negotiateMapSize(int mapWidth,
int mapHeight)
Requests a change of the map size from the server. |
private void |
negotiateNumLookObjects(int numLookObjects)
Requests a change of the number of ground objects from the server. |
private static java.lang.String |
newString(java.nio.ByteBuffer byteBuffer,
int start,
int len)
Extracts a string from a ByteBuffer range. |
private void |
notifyPacketWatcherListenersAscii(java.nio.ByteBuffer packet,
int args)
Notifies all ReceivedPacketListener s about a packet having ascii
parameters. |
private void |
notifyPacketWatcherListenersEmpty(java.lang.String command)
Notifies all ReceivedPacketListener s about an empty packet. |
private void |
notifyPacketWatcherListenersIntArray(java.nio.ByteBuffer packet,
int args)
Notifies all ReceivedPacketListener s about a packet having an
array of int values as parameters. |
private void |
notifyPacketWatcherListenersMixed(java.nio.ByteBuffer packet,
int args)
Notifies all ReceivedPacketListener s about a packet having mixed
parameters. |
private void |
notifyPacketWatcherListenersNoData(java.nio.ByteBuffer packet,
int args)
Notifies all ReceivedPacketListener s about a packet having
unknown parameters. |
private void |
notifyPacketWatcherListenersShortArray(java.nio.ByteBuffer packet,
int args)
Notifies all ReceivedPacketListener s about a packet having an
array of short values as parameters. |
private void |
notifyPacketWatcherListenersShortInt(java.nio.ByteBuffer packet,
int args)
Notifies all ReceivedPacketListener s about a packet having a
short and an in value as parameters. |
private void |
notifyPacketWatcherListenersStats(int stat,
java.lang.Object... args)
Notifies all ReceivedPacketListener s about a packet having stat
parameters. |
private static int |
parseDigit(byte ch)
Parses a character into an integer. |
private void |
processAccountPlayers(java.nio.ByteBuffer packet)
Processes an 'accountplayers' server command. |
private void |
processAddmeFailed(java.nio.ByteBuffer packet)
Processes an 'account_failed' server command. |
private void |
processAddmeSuccess(java.nio.ByteBuffer packet)
Processes an 'account_success' server command. |
private void |
processAddSpell(java.nio.ByteBuffer packet)
Processes an 'addspell' server command. |
private void |
processAnim(java.nio.ByteBuffer packet)
Processes an 'anim' server command. |
private void |
processComc(java.nio.ByteBuffer packet)
Processes a 'comc' server command. |
private void |
processDelInv(java.nio.ByteBuffer packet)
Processes a 'delinv' server command. |
private void |
processDelItem(java.nio.ByteBuffer packet)
Processes a 'delitem' server command. |
private void |
processDelSpell(java.nio.ByteBuffer packet)
Processes a 'delspell' server command. |
private void |
processDrawExtInfo(java.nio.ByteBuffer packet)
Processes a 'drawextinfo' server command. |
private void |
processDrawInfo(java.nio.ByteBuffer packet)
Processes a 'drawinfo' server command. |
private void |
processExpTableReplyinfo(java.nio.ByteBuffer packet)
Processes a "replyinfo exp_table" block. |
private void |
processExtendedInfoSet(java.nio.ByteBuffer packet)
Processes an 'ExtendedInfoSet' server command. |
private void |
processExtendedTextSet(java.nio.ByteBuffer packet)
Processes an 'ExtendedTextSet' server command. |
private void |
processFace2(java.nio.ByteBuffer packet)
Processes a 'face2' server command. |
private void |
processFailure(java.nio.ByteBuffer packet)
Processes a 'failure' server command. |
private void |
processGoodbye(java.nio.ByteBuffer packet)
Processes a 'goodbye' server command. |
private void |
processImage2(java.nio.ByteBuffer packet)
Processes an 'image2' server command. |
private static void |
processImageInfoReplyinfo(java.nio.ByteBuffer packet)
Processes a "replyinfo image_info" block. |
private void |
processItem2(java.nio.ByteBuffer packet)
Processes an 'item2' server command. |
private void |
processMagicMap(java.nio.ByteBuffer packet)
Processes a 'magicmap' server command. |
private void |
processMap2(java.nio.ByteBuffer packet)
Processes a 'map2' server command. |
private void |
processMapExtended(java.nio.ByteBuffer packet)
Processes a 'mapextended' server command. |
private void |
processMusic(java.nio.ByteBuffer packet)
Processes a 'music' server command. |
private void |
processNewMap(java.nio.ByteBuffer packet)
Processes a 'newmap' server command. |
private void |
processPacket(java.nio.ByteBuffer packet)
Processes a received packet. |
private void |
processPickup(java.nio.ByteBuffer packet)
Processes a 'pickup' server command. |
private void |
processPlayer(java.nio.ByteBuffer packet)
Processes a 'pickup' server command. |
private void |
processQuery(java.nio.ByteBuffer packet)
Processes a 'pickup' server command. |
private void |
processReplyInfo(java.nio.ByteBuffer packet)
Processes a 'replyinfo' server command. |
private void |
processSetup(java.nio.ByteBuffer packet)
Processes a 'replyinfo' server command. |
private void |
processSkillInfoReplyinfo(java.nio.ByteBuffer packet)
Processes a "replyinfo skill_info" block. |
private void |
processSmooth(java.nio.ByteBuffer packet)
Processes a 'smooth' server command. |
private void |
processSound(java.nio.ByteBuffer packet)
Processes a 'sound' server command. |
private void |
processSound2(java.nio.ByteBuffer packet)
Processes a 'sound2' server command. |
private void |
processStats(java.nio.ByteBuffer packet)
Processes a 'stats' server command. |
private void |
processTick(java.nio.ByteBuffer packet)
Processes a 'tick' server command. |
private void |
processUpdItem(java.nio.ByteBuffer packet)
Processes an 'upditem' server command. |
private void |
processUpdSpell(java.nio.ByteBuffer packet)
Processes an 'updspell' server command. |
private void |
processVersion(java.nio.ByteBuffer packet)
Processes a 'version' server command. |
private void |
putDecimal(int value)
Appends an integer in decimal ASCII representation to byteBuffer . |
void |
removeCrossfireAccountListener(CrossfireAccountListener listener)
Removes a listener to be notified about account events. |
void |
removeCrossfireDrawextinfoListener(CrossfireDrawextinfoListener listener)
Removes the given listener from the list of objects listening to the drawextinfo S->C messages. |
void |
removeCrossfireDrawinfoListener(CrossfireDrawinfoListener listener)
Removes the given listener from the list of objects listening to the drawinfo S->C messages. |
void |
removeCrossfireFailureListener(CrossfireFailureListener listener)
Removes a listener to be notified of failure messages. |
void |
removeCrossfireMagicmapListener(CrossfireMagicmapListener listener)
Removes a listener from the list of objects listening to magicmap messages. |
void |
removeCrossfirePickupListener(CrossfirePickupListener listener)
Removes a listener to be notified about received "pickup" messages. |
void |
removeCrossfireQueryListener(CrossfireQueryListener listener)
Removes the given listener from the list of objects listening to the query S->C messages. |
void |
removeCrossfireSkillInfoListener(CrossfireSkillInfoListener listener)
Removes a listener to be notified about received skill info changes. |
void |
removeCrossfireUpdateItemListener(CrossfireUpdateItemListener crossfireUpdateItemListener)
Removes a listener to be notified about item changes. |
void |
removePacketWatcherListener(ReceivedPacketListener listener)
Removes a listener to be notified about received packets. |
void |
removeSentReplyListener(SentReplyListener listener)
Removes a listener to be notified about sent reply packets. |
void |
sendAccountCharacterCreate(java.lang.String login,
java.lang.String password)
Sends a request to create a new character associated to the account. |
void |
sendAccountCreate(java.lang.String login,
java.lang.String password)
Sends a request to create a new account. |
void |
sendAccountLink(int force,
java.lang.String login,
java.lang.String password)
Sends a request to add an existing character to an account. |
void |
sendAccountLogin(java.lang.String login,
java.lang.String password)
Asks for an account login. |
void |
sendAccountPlay(java.lang.String name)
Sends a request to play a character from an account. |
void |
sendAddme()
Sends an "addme" command to the server. |
void |
sendApply(int tag)
Sends an "apply" command to the server. |
void |
sendAskface(int num)
Sends an "askface" command to the server. |
void |
sendExamine(int tag)
Sends an "examine" command to the server. |
void |
sendLock(boolean val,
int tag)
Sends a "lock" command to the server. |
void |
sendLookat(int dx,
int dy)
Sends a "lookat" command to the server. |
void |
sendMark(int tag)
Sends a "mark" command to the server. |
void |
sendMove(int to,
int tag,
int nrof)
Sends a "move" command to the server. |
int |
sendNcom(int repeat,
java.lang.String command)
Sends a "ncom" command to the server. |
void |
sendReply(java.lang.String text)
Sends a "reply" command to the server. |
void |
sendRequestinfo(java.lang.String infoType)
Sends a "requestinfo" command to the server. |
void |
sendSetup(java.lang.String... options)
Sends a "setup" command to the server. |
void |
sendToggleextendedtext(int... types)
Sends a "toggleextendedtext" command to the server. |
void |
sendVersion(int csval,
int scval,
java.lang.String vinfo)
Sends a "version" command to the server. |
private void |
setClientSocketState(ClientSocketState prevState,
ClientSocketState nextState)
Updates the clientSocketState . |
private void |
setCurrentMapSize(int currentMapWidth,
int currentMapHeight)
Sets the current map size as negotiated with the server. |
private void |
setCurrentNumLookObjects(int currentNumLookObjects)
Sets the current ground view objects as negotiated with the server. |
void |
setPreferredMapSize(int preferredMapWidth,
int preferredMapHeight)
Sets the preferred map size. |
void |
setPreferredNumLookObjects(int preferredNumLookObjects)
Sets the maximum number of objects in the ground view. |
Methods inherited from class com.realtime.crossfire.jxclient.server.server.DefaultServerConnection |
---|
addClientSocketListener, disconnect, removeClientSocketListener, start, stop, writePacket |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection |
---|
start, stop |
Methods inherited from interface com.realtime.crossfire.jxclient.server.server.ServerConnection |
---|
addClientSocketListener, disconnect, removeClientSocketListener |
Field Detail |
---|
@NotNull private static final byte[] ACCOUNT_ADD_PLAYER_PREFIX
@NotNull private static final byte[] ACCOUNT_LOGIN_PREFIX
@NotNull private static final byte[] ACCOUNT_NEW_PREFIX
@NotNull private static final byte[] ACCOUNT_PLAY_PREFIX
@Nullable private java.lang.String accountName
null
if no account name is known.
private static final int ACL_CLASS
private static final int ACL_FACE
private static final int ACL_FACE_NUM
private static final int ACL_LEVEL
private static final int ACL_MAP
private static final int ACL_NAME
private static final int ACL_PARTY
private static final int ACL_RACE
@NotNull private static final byte[] ADDME_PREFIX
@NotNull private static final byte[] APPLY_PREFIX
@NotNull private static final byte[] ASKFACE_PREFIX
@NotNull private final java.nio.ByteBuffer byteBuffer
writeBuffer
to store the data.
@NotNull private final ClientSocketListener clientSocketListener
ClientSocketListener
attached to the server socket.
@NotNull private ClientSocketState clientSocketState
@NotNull private static final byte[] CREATE_PLAYER_PREFIX
@NotNull private final java.util.Collection<CrossfireAccountListener> crossfireAccountListeners
CrossfireAccountListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireComcListener> crossfireComcListeners
CrossfireComcListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireExpTableListener> crossfireExpTableListeners
CrossfireExpTableListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireFaceListener> crossfireFaceListeners
CrossfireFaceListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireFailureListener> crossfireFailureListeners
CrossfireFailureListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireMusicListener> crossfireMusicListeners
CrossfireMusicListener
s to be notified.
@NotNull private final java.util.Collection<CrossfirePickupListener> crossfirePickupListeners
CrossfirePickupListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireServerConnectionListener> crossfireServerConnectionListeners
CrossfireServerConnectionListener
s to notify.
@NotNull private final java.util.Collection<CrossfireSkillInfoListener> crossfireSkillInfoListeners
CrossfireSkillInfoListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireSoundListener> crossfireSoundListeners
CrossfireSoundListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireSpellListener> crossfireSpellListeners
CrossfireSpellListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireStatsListener> crossfireStatsListeners
CrossfireStatsListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireTickListener> crossfireTickListeners
CrossfireTickListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireUpdateFaceListener> crossfireUpdateFaceListeners
CrossfireUpdateFaceListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireUpdateItemListener> crossfireUpdateItemListeners
CrossfireUpdateItemListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireUpdateMapListener> crossfireUpdateMapListeners
CrossfireUpdateMapListener
s to be notified.
private int currentMapHeight
private int currentMapWidth
private int currentNumLookObjects
@Nullable private final DebugWriter debugProtocol
null
to
not write anything.
private static final int DEFAULT_MAP_HEIGHT
private static final int DEFAULT_MAP_WIDTH
private static final int DEFAULT_NUM_LOOK_OBJECTS
@NotNull private final java.util.Collection<CrossfireDrawextinfoListener> drawextinfoListeners
CrossfireDrawextinfoListener
s to be notified.
@NotNull private final java.util.Collection<CrossfireDrawinfoListener> drawinfoListeners
CrossfireDrawinfoListener
s to be notified.
@NotNull private static final byte[] EXAMINE_PREFIX
private static final int FACE_COLOR_MASK
private static final int FACE_FLOOR
private static final int FACE_WALL
@NotNull private static final byte[] LOCK_PREFIX
private int loginMethod
@NotNull private static final byte[] LOOKAT_PREFIX
@NotNull private final java.util.Collection<CrossfireMagicmapListener> magicmapListeners
CrossfireMagicmapListener
s to be notified of received
magicmap commands.
@NotNull private static final byte[] MARK_PREFIX
@NotNull private static final byte[] MOVE_PREFIX
@NotNull private static final byte[] NCOM_PREFIX
private int packet
@NotNull private static final java.util.regex.Pattern PATTERN_DOT
private int pendingMapHeight
0
when not negotiating.
private int pendingMapWidth
0
when not negotiating.
private int pendingNumLookObjects
0
when not negotiating.
private int preferredMapHeight
private int preferredMapWidth
private int preferredNumLookObjects
@NotNull private final java.util.Collection<CrossfireQueryListener> queryListeners
CrossfireQueryListener
s to be notified.
@NotNull private final java.util.Collection<ReceivedPacketListener> receivedPacketListeners
ReceivedPacketListener
s to be notified.
@NotNull private final java.lang.Object redrawSemaphore
@NotNull private static final byte[] REPLY_PREFIX
@NotNull private static final byte[] REQUESTINFO_PREFIX
@NotNull private final java.util.Collection<SentReplyListener> sentReplyListeners
SentReplyListener
s to be notified.
@NotNull private static final byte[] SETUP_PREFIX
@NotNull private static final byte[] TOGGLEEXTENDEDTEXT_PREFIX
@NotNull private static final java.nio.charset.Charset UTF8
Charset
used for parsing or encoding strings received from or
sent to the Crossfire server.
@NotNull private final java.lang.String version
@NotNull private static final byte[] VERSION_PREFIX
@NotNull private final byte[] writeBuffer
Constructor Detail |
---|
public DefaultCrossfireServerConnection(@NotNull java.lang.Object redrawSemaphore, @Nullable DebugWriter debugProtocol, @NotNull java.lang.String version) throws java.io.IOException
redrawSemaphore
- the semaphore used to synchronized map model
updates and map view redrawsdebugProtocol
- tf non-null
, write all protocol
commands to this writerversion
- the version information to send to the server when
connecting
java.io.IOException
- if an internal error occursMethod Detail |
---|
public void addCrossfireAccountListener(@NotNull CrossfireAccountListener listener)
addCrossfireAccountListener
in interface CrossfireServerConnection
listener
- the listener to add.public void addCrossfireComcListener(@NotNull CrossfireComcListener listener)
addCrossfireComcListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireDrawextinfoListener(@NotNull CrossfireDrawextinfoListener listener)
addCrossfireDrawextinfoListener
in interface CrossfireServerConnection
listener
- the listener to removepublic void addCrossfireDrawinfoListener(@NotNull CrossfireDrawinfoListener listener)
addCrossfireDrawinfoListener
in interface CrossfireServerConnection
listener
- the listener to removepublic void addCrossfireExpTableListener(@NotNull CrossfireExpTableListener crossfireExpTableListener)
addCrossfireExpTableListener
in interface CrossfireServerConnection
crossfireExpTableListener
- the listener to addpublic void addCrossfireFaceListener(@NotNull CrossfireFaceListener listener)
addCrossfireFaceListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireFailureListener(@NotNull CrossfireFailureListener listener)
addCrossfireFailureListener
in interface CrossfireServerConnection
listener
- listener to add.public void addCrossfireMagicmapListener(@NotNull CrossfireMagicmapListener listener)
addCrossfireMagicmapListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireMusicListener(@NotNull CrossfireMusicListener listener)
addCrossfireMusicListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfirePickupListener(@NotNull CrossfirePickupListener listener)
addCrossfirePickupListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireQueryListener(@NotNull CrossfireQueryListener listener)
addCrossfireQueryListener
in interface CrossfireServerConnection
listener
- the listener to removepublic void addCrossfireServerConnectionListener(@NotNull CrossfireServerConnectionListener listener)
addCrossfireServerConnectionListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireSkillInfoListener(@NotNull CrossfireSkillInfoListener listener)
addCrossfireSkillInfoListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireSoundListener(@NotNull CrossfireSoundListener listener)
addCrossfireSoundListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireSpellListener(@NotNull CrossfireSpellListener listener)
addCrossfireSpellListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireStatsListener(@NotNull CrossfireStatsListener crossfireStatsListener)
addCrossfireStatsListener
in interface CrossfireServerConnection
crossfireStatsListener
- the listener to addpublic void addCrossfireTickListener(@NotNull CrossfireTickListener listener)
addCrossfireTickListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireUpdateFaceListener(@NotNull CrossfireUpdateFaceListener listener)
addCrossfireUpdateFaceListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addCrossfireUpdateItemListener(@NotNull CrossfireUpdateItemListener crossfireUpdateItemListener)
addCrossfireUpdateItemListener
in interface CrossfireServerConnection
crossfireUpdateItemListener
- the listener to addpublic void addCrossfireUpdateMapListener(@NotNull CrossfireUpdateMapListener listener)
addCrossfireUpdateMapListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addPacketWatcherListener(@NotNull ReceivedPacketListener listener)
addPacketWatcherListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void addSentReplyListener(@NotNull SentReplyListener listener)
addSentReplyListener
in interface CrossfireServerConnection
listener
- the listener to addprivate void clearFailure()
private void cmdMap2Coordinate(@NotNull java.nio.ByteBuffer packet, int x, int y) throws UnknownCommandException
packet
- the packet contentsx
- the x-coordinate of the currently processed squarey
- the y-coordinate of the currently processed square
UnknownCommandException
- if the command cannot be parsedprivate void cmdMap2CoordinateClearSpace(int x, int y, int len) throws UnknownCommandException
x
- the x-coordinate of the currently processed squarey
- the y-coordinate of the currently processed squarelen
- the payload length
UnknownCommandException
- if the command cannot be parsedprivate void cmdMap2CoordinateDarkness(@NotNull java.nio.ByteBuffer packet, int x, int y, int len) throws UnknownCommandException
packet
- the packet contentsx
- the x-coordinate of the currently processed squarey
- the y-coordinate of the currently processed squarelen
- the payload length
UnknownCommandException
- if the command cannot be parsedprivate void cmdMap2CoordinateLayer(@NotNull java.nio.ByteBuffer packet, int x, int y, int len, int layer) throws UnknownCommandException
packet
- the packet contentsx
- the x-coordinate of the currently processed squarey
- the y-coordinate of the currently processed squarelen
- the payload lengthlayer
- the layer to update
UnknownCommandException
- if the command cannot be parsedprivate void cmdMap2CoordinateLayer3(@NotNull java.nio.ByteBuffer packet, int x, int y, int layer, int face) throws UnknownCommandException
packet
- the packet contentsface
- the face numberx
- the x-coordinate of the currently processed squarey
- the y-coordinate of the currently processed squarelayer
- the layer to update
UnknownCommandException
- if the command cannot be parsedprivate void cmdMap2CoordinateLayer4(@NotNull java.nio.ByteBuffer packet, int x, int y, int layer, int face) throws UnknownCommandException
packet
- the packet contentsface
- the face numberx
- the x-coordinate of the currently processed squarey
- the y-coordinate of the currently processed squarelayer
- the layer to update
UnknownCommandException
- if the command cannot be parsedprivate void cmdReplyinfo(@NotNull java.lang.String infoType, java.nio.ByteBuffer packet) throws java.io.IOException
infoType
- the info_type parameterpacket
- the packet payload data
java.io.IOException
- if an I/O error occurspublic void connect(@NotNull java.lang.String hostname, int port)
connect
in interface ServerConnection
connect
in class DefaultServerConnection
hostname
- the hostname to connect toport
- the port to connect toprivate void connected()
public void drawextinfo(int color, int type, int subtype, java.lang.String message)
drawextinfo
in interface CrossfireServerConnection
color
- the colortype
- the message typesubtype
- the message subtypemessage
- the messagepublic void drawInfo(@NotNull java.lang.String message, int color)
drawInfo
in interface CrossfireServerConnection
message
- the messagecolor
- the colorpublic void drawInfoSetDebugMode(boolean printMessageTypes)
drawInfoSetDebugMode
in interface CrossfireServerConnection
printMessageTypes
- whether to enable or disable message typesprivate static java.lang.String extractCommand(@NotNull java.nio.ByteBuffer packet)
packet
- the packet contents
private void fireNewMap()
@Nullable public java.lang.String getAccountName()
getAccountName
in interface CrossfireServerConnection
null
private static int getInt1(@NotNull java.nio.ByteBuffer byteBuffer)
ByteBuffer
at it's
current position.
byteBuffer
- the byte buffer
private static int getInt2(@NotNull java.nio.ByteBuffer byteBuffer)
ByteBuffer
at it's
current position.
byteBuffer
- the byte buffer
private static int getInt4(@NotNull java.nio.ByteBuffer byteBuffer)
ByteBuffer
at it's
current position.
byteBuffer
- the byte buffer
private static long getInt8(@NotNull java.nio.ByteBuffer byteBuffer)
ByteBuffer
at it's
current position.
byteBuffer
- the byte buffer
public int getMapHeight()
getMapHeight
in interface CrossfireServerConnection
public int getMapWidth()
getMapWidth
in interface CrossfireServerConnection
private static java.lang.String getString(java.nio.ByteBuffer byteBuffer, int len)
ByteBuffer
at it's current
position.
byteBuffer
- the byte bufferlen
- the length of the string
@NotNull private static java.lang.String hexDump(@NotNull java.nio.ByteBuffer byteBuffer)
ByteBuffer
.
byteBuffer
- the byte buffer
private void negotiateMapSize(int mapWidth, int mapHeight)
mapWidth
- the map width to requestmapHeight
- the map height to requestprivate void negotiateNumLookObjects(int numLookObjects)
numLookObjects
- the number of ground objects to requestprivate static java.lang.String newString(java.nio.ByteBuffer byteBuffer, int start, int len)
ByteBuffer
range.
byteBuffer
- the byte bufferstart
- the start index of the stringlen
- the length of the string
private void notifyPacketWatcherListenersAscii(@NotNull java.nio.ByteBuffer packet, int args)
ReceivedPacketListener
s about a packet having ascii
parameters.
packet
- the packet contentsargs
- the start index into packet
of the packet's
argumentsprivate void notifyPacketWatcherListenersEmpty(@NotNull java.lang.String command)
ReceivedPacketListener
s about an empty packet.
command
- the command stringprivate void notifyPacketWatcherListenersIntArray(@NotNull java.nio.ByteBuffer packet, int args)
ReceivedPacketListener
s about a packet having an
array of int values as parameters.
packet
- the packet contentsargs
- the start index into packet
of the packet's
argumentsprivate void notifyPacketWatcherListenersMixed(@NotNull java.nio.ByteBuffer packet, int args)
ReceivedPacketListener
s about a packet having mixed
parameters.
packet
- the packet contentsargs
- the start index into packet
of the packet's
argumentsprivate void notifyPacketWatcherListenersNoData(@NotNull java.nio.ByteBuffer packet, int args)
ReceivedPacketListener
s about a packet having
unknown parameters.
packet
- the packet contentsargs
- the start index into packet
of the packet's
argumentsprivate void notifyPacketWatcherListenersShortArray(@NotNull java.nio.ByteBuffer packet, int args)
ReceivedPacketListener
s about a packet having an
array of short values as parameters.
packet
- the packet contentsargs
- the start index into packet
of the packet's
argumentsprivate void notifyPacketWatcherListenersShortInt(@NotNull java.nio.ByteBuffer packet, int args)
ReceivedPacketListener
s about a packet having a
short and an in value as parameters.
packet
- the packet contentsargs
- the start index into packet
of the packet's
argumentsprivate void notifyPacketWatcherListenersStats(int stat, @NotNull java.lang.Object... args)
ReceivedPacketListener
s about a packet having stat
parameters.
stat
- the stat valueargs
- the stat arguments depending on type
and
stat
private static int parseDigit(byte ch) throws UnknownCommandException
ch
- the character to parse
UnknownCommandException
- if ch
is not a digitprivate void processAccountPlayers(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processAddmeFailed(@NotNull java.nio.ByteBuffer packet)
packet
- the packet's payloadprivate void processAddmeSuccess(@NotNull java.nio.ByteBuffer packet)
packet
- the packet's payloadprivate void processAddSpell(@NotNull java.nio.ByteBuffer packet)
packet
- the packet's payloadprivate void processAnim(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processComc(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processDelInv(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processDelItem(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processDelSpell(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processDrawExtInfo(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processDrawInfo(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processExpTableReplyinfo(@NotNull java.nio.ByteBuffer packet)
packet
- the packet to processprivate void processExtendedInfoSet(@NotNull java.nio.ByteBuffer packet)
packet
- the packet's payloadprivate void processExtendedTextSet(@NotNull java.nio.ByteBuffer packet)
packet
- the packet's payloadprivate void processFace2(@NotNull java.nio.ByteBuffer packet)
packet
- the packet's payloadprivate void processFailure(@NotNull java.nio.ByteBuffer packet)
packet
- the packet's payloadprivate void processGoodbye(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processImage2(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private static void processImageInfoReplyinfo(@NotNull java.nio.ByteBuffer packet) throws java.io.IOException
packet
- the packet to process
java.io.IOException
- if the packet cannot be parsedprivate void processItem2(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processMagicMap(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processMap2(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processMapExtended(@NotNull java.nio.ByteBuffer packet)
packet
- the packet's payloadprivate void processMusic(@NotNull java.nio.ByteBuffer packet)
packet
- the packet's payloadprivate void processNewMap(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processPacket(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
try...catch
clause is used to detect invalid packets.
packet
- the packet's payload
UnknownCommandException
- if the packet cannot be parsedprivate void processPickup(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processPlayer(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processQuery(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processReplyInfo(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processSetup(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processSkillInfoReplyinfo(@NotNull java.nio.ByteBuffer packet) throws java.io.IOException
packet
- the packet to process
java.io.IOException
- if the packet cannot be parsedprivate void processSmooth(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processSound(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processSound2(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processStats(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processTick(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processUpdItem(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processUpdSpell(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void processVersion(@NotNull java.nio.ByteBuffer packet) throws UnknownCommandException
packet
- the packet's payload
UnknownCommandException
- if the packet is invalid.private void putDecimal(int value)
byteBuffer
.
value
- the value to appendpublic void removeCrossfireAccountListener(@NotNull CrossfireAccountListener listener)
removeCrossfireAccountListener
in interface CrossfireServerConnection
listener
- the listener to remove.public void removeCrossfireDrawextinfoListener(@NotNull CrossfireDrawextinfoListener listener)
removeCrossfireDrawextinfoListener
in interface CrossfireServerConnection
listener
- the listener to removepublic void removeCrossfireDrawinfoListener(@NotNull CrossfireDrawinfoListener listener)
removeCrossfireDrawinfoListener
in interface CrossfireServerConnection
listener
- the listener to removepublic void removeCrossfireFailureListener(@NotNull CrossfireFailureListener listener)
removeCrossfireFailureListener
in interface CrossfireServerConnection
listener
- listener to be removed.public void removeCrossfireMagicmapListener(@NotNull CrossfireMagicmapListener listener)
removeCrossfireMagicmapListener
in interface CrossfireServerConnection
listener
- the listener to removepublic void removeCrossfirePickupListener(@NotNull CrossfirePickupListener listener)
removeCrossfirePickupListener
in interface CrossfireServerConnection
listener
- the listener to removepublic void removeCrossfireQueryListener(@NotNull CrossfireQueryListener listener)
removeCrossfireQueryListener
in interface CrossfireServerConnection
listener
- the listener to removepublic void removeCrossfireSkillInfoListener(@NotNull CrossfireSkillInfoListener listener)
removeCrossfireSkillInfoListener
in interface CrossfireServerConnection
listener
- the listener to removepublic void removeCrossfireUpdateItemListener(@NotNull CrossfireUpdateItemListener crossfireUpdateItemListener)
removeCrossfireUpdateItemListener
in interface CrossfireServerConnection
crossfireUpdateItemListener
- the listener to removepublic void removePacketWatcherListener(@NotNull ReceivedPacketListener listener)
removePacketWatcherListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void removeSentReplyListener(@NotNull SentReplyListener listener)
removeSentReplyListener
in interface CrossfireServerConnection
listener
- the listener to addpublic void sendAccountCharacterCreate(@NotNull java.lang.String login, @NotNull java.lang.String password)
sendAccountCharacterCreate
in interface CrossfireServerConnection
login
- the character's namepassword
- the character's passwordpublic void sendAccountCreate(@NotNull java.lang.String login, @NotNull java.lang.String password)
sendAccountCreate
in interface CrossfireServerConnection
login
- the account loginpassword
- the account passwordpublic void sendAccountLink(int force, @NotNull java.lang.String login, @NotNull java.lang.String password)
sendAccountLink
in interface CrossfireServerConnection
force
- 0 to allow failure, 1 to force in certain situationslogin
- the character's loginpassword
- the character's passwordpublic void sendAccountLogin(@NotNull java.lang.String login, @NotNull java.lang.String password)
sendAccountLogin
in interface CrossfireServerConnection
login
- the account loginpassword
- the account passwordpublic void sendAccountPlay(@NotNull java.lang.String name)
sendAccountPlay
in interface CrossfireServerConnection
name
- the character's name to playpublic void sendAddme()
sendAddme
in interface CrossfireServerConnection
public void sendApply(int tag)
sendApply
in interface CrossfireServerConnection
tag
- the item to applypublic void sendAskface(int num)
sendAskface
in interface CrossfireServerConnection
num
- the face to querypublic void sendExamine(int tag)
sendExamine
in interface CrossfireServerConnection
tag
- the item to examinepublic void sendLock(boolean val, int tag)
sendLock
in interface CrossfireServerConnection
val
- whether to lock the itemtag
- the item to lockpublic void sendLookat(int dx, int dy)
sendLookat
in interface CrossfireServerConnection
dx
- the x-coordinate in tiles, relative to the playerdy
- the y-coordinate in tiles, relative to the playerpublic void sendMark(int tag)
sendMark
in interface CrossfireServerConnection
tag
- the item to markpublic void sendMove(int to, int tag, int nrof)
sendMove
in interface CrossfireServerConnection
to
- the destination locationtag
- the item to movenrof
- the number of items to movepublic int sendNcom(int repeat, @NotNull java.lang.String command)
sendNcom
in interface CrossfireServerConnection
repeat
- the repeat countcommand
- the command
public void sendReply(@NotNull java.lang.String text)
sendReply
in interface CrossfireServerConnection
text
- the text to replypublic void sendRequestinfo(@NotNull java.lang.String infoType)
sendRequestinfo
in interface CrossfireServerConnection
infoType
- the info type to requestpublic void sendSetup(@NotNull java.lang.String... options)
sendSetup
in interface CrossfireServerConnection
options
- the option/value pairs to sendpublic void sendToggleextendedtext(@NotNull int... types)
sendToggleextendedtext
in interface CrossfireServerConnection
types
- the types to requestpublic void sendVersion(int csval, int scval, @NotNull java.lang.String vinfo)
sendVersion
in interface CrossfireServerConnection
csval
- the client version numberscval
- the server version numbervinfo
- the client identification stringprivate void setClientSocketState(@NotNull ClientSocketState prevState, @NotNull ClientSocketState nextState)
clientSocketState
.
prevState
- the expected current statenextState
- the next stateprivate void setCurrentMapSize(int currentMapWidth, int currentMapHeight)
currentMapWidth
- the new map widthcurrentMapHeight
- the new map heightprivate void setCurrentNumLookObjects(int currentNumLookObjects)
currentNumLookObjects
- the number of objectspublic void setPreferredMapSize(int preferredMapWidth, int preferredMapHeight)
setPreferredMapSize
in interface CrossfireServerConnection
preferredMapWidth
- the preferred map width in tiles; must be oddpreferredMapHeight
- the preferred map height in tiles; must be oddpublic void setPreferredNumLookObjects(int preferredNumLookObjects)
setPreferredNumLookObjects
in interface CrossfireServerConnection
preferredNumLookObjects
- the number of objects