Interface CrossfireServerConnection

All Superinterfaces:
AskfaceQueue, ServerConnection
All Known Implementing Classes:
AbstractCrossfireServerConnection, DefaultCrossfireServerConnection

public interface CrossfireServerConnection extends AskfaceQueue, ServerConnection
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
  • Method Details

    • start

      void start()
      Starts operation.
    • stop

      void stop() throws InterruptedException
      Stops operation.
      Throws:
      InterruptedException - if stopping was interrupted
    • addCrossfireDrawinfoListener

      void addCrossfireDrawinfoListener(@NotNull @NotNull CrossfireDrawinfoListener listener)
      Adds a new listener monitoring the drawinfo S->C messages.
      Parameters:
      listener - the listener to remove
    • removeCrossfireDrawinfoListener

      void removeCrossfireDrawinfoListener(@NotNull @NotNull CrossfireDrawinfoListener listener)
      Removes the given listener from the list of objects listening to the drawinfo S->C messages.
      Parameters:
      listener - the listener to remove
    • addCrossfireDrawextinfoListener

      void addCrossfireDrawextinfoListener(@NotNull @NotNull CrossfireDrawextinfoListener listener)
      Adds a new listener monitoring the drawextinfo S->C messages.
      Parameters:
      listener - the listener to remove
    • removeCrossfireDrawextinfoListener

      void removeCrossfireDrawextinfoListener(@NotNull @NotNull CrossfireDrawextinfoListener listener)
      Removes the given listener from the list of objects listening to the drawextinfo S->C messages.
      Parameters:
      listener - the listener to remove
    • addCrossfireQueryListener

      void addCrossfireQueryListener(@NotNull @NotNull CrossfireQueryListener listener)
      Adds a new listener monitoring the query S->C messages.
      Parameters:
      listener - the listener to remove
    • removeCrossfireQueryListener

      void removeCrossfireQueryListener(@NotNull @NotNull CrossfireQueryListener listener)
      Removes the given listener from the list of objects listening to the query S->C messages.
      Parameters:
      listener - the listener to remove
    • addCrossfireMagicmapListener

      void addCrossfireMagicmapListener(@NotNull @NotNull CrossfireMagicmapListener listener)
      Adds a listener from the list of objects listening to magicmap messages.
      Parameters:
      listener - the listener to add
    • removeCrossfireMagicmapListener

      void removeCrossfireMagicmapListener(@NotNull @NotNull CrossfireMagicmapListener listener)
      Removes a listener from the list of objects listening to magicmap messages.
      Parameters:
      listener - the listener to remove
    • addCrossfireMapScrollListener

      void addCrossfireMapScrollListener(@NotNull @NotNull CrossfireMapScrollListener listener)
      Registers a listener to be called whenever the map was scolled.
      Parameters:
      listener - the listener
    • addCrossfireUpdateItemListener

      void addCrossfireUpdateItemListener(@NotNull @NotNull CrossfireUpdateItemListener crossfireUpdateItemListener)
      Adds a listener to be notified about item changes.
      Parameters:
      crossfireUpdateItemListener - the listener to add
    • removeCrossfireUpdateItemListener

      void removeCrossfireUpdateItemListener(@NotNull @NotNull CrossfireUpdateItemListener crossfireUpdateItemListener)
      Removes a listener to be notified about item changes.
      Parameters:
      crossfireUpdateItemListener - the listener to remove
    • setCrossfireUpdateMapListener

      void setCrossfireUpdateMapListener(@NotNull @NotNull CrossfireUpdateMapListener listener)
      Sets a listener to be notified about map changes. At most one such listener may be set.
      Parameters:
      listener - the listener
    • addCrossfireTickListener

      void addCrossfireTickListener(@NotNull @NotNull CrossfireTickListener listener)
      Adds a listener to be notified about tick changes.
      Parameters:
      listener - the listener to add
    • addCrossfireSoundListener

      void addCrossfireSoundListener(@NotNull @NotNull CrossfireSoundListener listener)
      Adds a listener to be notified about received sound commands.
      Parameters:
      listener - the listener to add
    • addCrossfireMusicListener

      void addCrossfireMusicListener(@NotNull @NotNull CrossfireMusicListener listener)
      Adds a listener to be notified about received music commands.
      Parameters:
      listener - the listener to add
    • addCrossfireComcListener

      void addCrossfireComcListener(@NotNull @NotNull CrossfireComcListener listener)
      Adds a listener to be notified about received comc commands.
      Parameters:
      listener - the listener to add
    • addCrossfirePickupListener

      void addCrossfirePickupListener(@NotNull @NotNull CrossfirePickupListener listener)
      Adds a listener to be notified about received "pickup" messages.
      Parameters:
      listener - the listener to add
    • removeCrossfirePickupListener

      void removeCrossfirePickupListener(@NotNull @NotNull CrossfirePickupListener listener)
      Removes a listener to be notified about received "pickup" messages.
      Parameters:
      listener - the listener to remove
    • addPacketWatcherListener

      void addPacketWatcherListener(@NotNull @NotNull ReceivedPacketListener listener)
      Adds a listener to be notified about received packets.
      Parameters:
      listener - the listener to add
    • removePacketWatcherListener

      void removePacketWatcherListener(@NotNull @NotNull ReceivedPacketListener listener)
      Removes a listener to be notified about received packets.
      Parameters:
      listener - the listener to add
    • addSentPacketListener

      void addSentPacketListener(@NotNull @NotNull SentPacketListener listener)
      Adds a listener to be notified about sent reply packets.
      Parameters:
      listener - the listener to add
    • removeSentPacketListener

      void removeSentPacketListener(@NotNull @NotNull SentPacketListener listener)
      Removes a listener to be notified about sent reply packets.
      Parameters:
      listener - the listener to add
    • addCrossfireAccountListener

      void addCrossfireAccountListener(@NotNull @NotNull CrossfireAccountListener listener)
      Adds a listener to be notified about account events.
      Parameters:
      listener - the listener to add
    • removeCrossfireAccountListener

      void removeCrossfireAccountListener(@NotNull @NotNull CrossfireAccountListener listener)
      Removes a listener to be notified about account events.
      Parameters:
      listener - the listener to remove
    • addCrossfireFailureListener

      void addCrossfireFailureListener(@NotNull @NotNull CrossfireFailureListener listener)
      Adds a listener to be notified of failure messages.
      Parameters:
      listener - the listener to add
    • removeCrossfireFailureListener

      void removeCrossfireFailureListener(@NotNull @NotNull CrossfireFailureListener listener)
      Removes a listener to be notified of failure messages.
      Parameters:
      listener - the listener to remove
    • drawInfo

      void drawInfo(@NotNull @NotNull String message, int color)
      Pretends that a drawinfo message has been received.
      Parameters:
      message - the message
      color - the color
    • drawextinfo

      void drawextinfo(int color, int type, int subtype, String message)
      Pretends that a drawextinfo message has been received.
      Parameters:
      type - the message type
      subtype - the message subtype
      message - the message
      color - the color
    • drawInfoSetDebugMode

      void drawInfoSetDebugMode(boolean printMessageTypes)
      Enables or disables printing of message types.
      Parameters:
      printMessageTypes - whether to enable or disable message types
    • sendAccountLogin

      void sendAccountLogin(@NotNull @NotNull String login, @NotNull @NotNull String password)
      Asks for an account login.
      Parameters:
      login - the account login
      password - the account password
    • sendAccountPlay

      void sendAccountPlay(@NotNull @NotNull String name)
      Sends a request to play a character from an account.
      Parameters:
      name - the character's name to play
    • sendAccountLink

      void sendAccountLink(int force, @NotNull @NotNull String login, @NotNull @NotNull String password)
      Sends a request to add an existing character to an account.
      Parameters:
      force - 0 to allow failure, 1 to force in certain situations
      login - the character's login
      password - the character's password
    • sendAccountCreate

      void sendAccountCreate(@NotNull @NotNull String login, @NotNull @NotNull String password)
      Sends a request to create a new account.
      Parameters:
      login - the account login
      password - the account password
    • sendAccountCharacterCreate

      void sendAccountCharacterCreate(@NotNull @NotNull String login, @NotNull @NotNull String password, @NotNull @NotNull Collection<String> attributes)
      Sends a request to create a new character associated to the account.
      Parameters:
      login - the character's name
      password - the character's password
      attributes - the character attributes
    • sendAccountPassword

      void sendAccountPassword(@NotNull @NotNull String currentPassword, @NotNull @NotNull String newPassword)
      Sends a request to change the account's password.
      Parameters:
      currentPassword - current account password
      newPassword - new account password
    • sendAddme

      void sendAddme()
      Sends an "addme" command to the server.
    • sendApply

      void sendApply(int tag)
      Sends an "apply" command to the server.
      Parameters:
      tag - the item to apply
    • sendExamine

      void sendExamine(int tag)
      Sends an "examine" command to the server.
      Parameters:
      tag - the item to examine
    • sendLock

      void sendLock(boolean val, int tag)
      Sends a "lock" command to the server.
      Parameters:
      val - whether to lock the item
      tag - the item to lock
    • sendLookat

      void sendLookat(int dx, int dy)
      Sends a "lookat" command to the server.
      Parameters:
      dx - the x-coordinate in tiles, relative to the player
      dy - the y-coordinate in tiles, relative to the player
    • sendMark

      void sendMark(int tag)
      Sends a "mark" command to the server.
      Parameters:
      tag - the item to mark
    • sendMove

      void sendMove(int to, int tag, int nrof)
      Sends a "move" command to the server.
      Parameters:
      to - the destination location
      tag - the item to move
      nrof - the number of items to move
    • sendNcom

      int sendNcom(int repeat, @NotNull @NotNull String command)
      Sends a "ncom" command to the server.
      Parameters:
      repeat - the repeat count
      command - the command
      Returns:
      the packet id
    • sendRawString

      void sendRawString(@NotNull @NotNull String command)
      Sends an arbitrary string command to the server.
      Parameters:
      command - the command
    • sendReply

      void sendReply(@NotNull @NotNull String text)
      Sends a "reply" command to the server.
      Parameters:
      text - the text to reply
    • sendRequestinfo

      void sendRequestinfo(@NotNull @NotNull String infoType)
      Sends a "requestinfo" command to the server.
      Parameters:
      infoType - the info type to request
    • sendSetup

      void sendSetup(@NotNull @NotNull String... options)
      Sends a "setup" command to the server.
      Parameters:
      options - the option/value pairs to send
    • sendToggleextendedtext

      void sendToggleextendedtext(@NotNull @org.jetbrains.annotations.NotNull int... types)
      Sends a "toggleextendedtext" command to the server.
      Parameters:
      types - the types to request
    • sendVersion

      void sendVersion(int csval, int scval, @NotNull @NotNull String vinfo)
      Sends a "version" command to the server.
      Parameters:
      csval - the client version number
      scval - the server version number
      vinfo - the client identification string
    • setPreferredMapSize

      void setPreferredMapSize(int preferredMapWidth, int preferredMapHeight)
      Sets the preferred map size.
      Parameters:
      preferredMapWidth - the preferred map width in tiles; must be odd
      preferredMapHeight - the preferred map height in tiles; must be odd
    • setPreferredNumLookObjects

      void setPreferredNumLookObjects(int preferredNumLookObjects)
      Sets the maximum number of objects in the ground view. Must not be called in connected state.
      Parameters:
      preferredNumLookObjects - the number of objects
      Throws:
      IllegalArgumentException - if the number of objects is invalid
    • getAccountName

      @Nullable @Nullable String getAccountName()
      Returns the current account name.
      Returns:
      the current account name or null