com.swath
Class MainInfo

java.lang.Object
  extended bycom.swath.Info
      extended bycom.swath.MainInfo

public final class MainInfo
extends Info

This class contains methods for accessing main game and SWATH information.

Since:
SWATH 1.3

Method Summary
 int[] class0ports()
          Gets the locations of the class 0 ports.
 int currPlanet()
          Gets the current planet number.
 int currSector()
          Gets the current sector number.
 void dump()
          Dumps all the main info in the terminal window.
 char gameId()
          Gets the current game id letter.
 java.lang.String gameName()
          Gets the current game name.
 java.io.File gamePath()
          Gets the current game path.
 java.util.Map gameSettings()
          Gets all known game settings.
 java.lang.String gameVersion()
          Gets the current game version.
 java.lang.String hostname()
          Gets the name or IP address of the game server.
 boolean isConnected()
          Indicates if SWATH is connected to a game server or not.
 boolean isGoldGame()
          Indicates if the current TradeWars game is Gold enabled.
 boolean isHelperMode()
          Indicates if the SWATH helper mode is active or not.
 boolean isMBBSGame()
          Indicates if the current TradeWars game is MBBS enabled.
 boolean isParsingText()
          Indicates if SWATH is parsing incoming text or not.
 boolean isProxyMode()
          Indicates if the proxy mode is active or not.
 boolean isTextOutputSuppressed()
          Indicates if text output is suppressed or not.
 int lastRobStealSector()
          Gets the last sector where you robbed or stole from the port.
 java.lang.String password()
          Gets the current game password.
 int port()
          Gets the port number of the game server.
 int prompt()
          Gets the current prompt.
 int sectors()
          Gets the total number of sectors in the database.
 int stardock()
          Gets the StarDock location.
 java.io.File swathPath()
          Gets the path to the SWATH installation.
 java.lang.String swathVersion()
          Gets the current SWATH version.
 int timeOnline()
          Returns how long time SWATH has been connected to the current game server.
 java.lang.String username()
          Gets the current game username.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sectors

public int sectors()
            throws java.lang.Exception
Gets the total number of sectors in the database.

Returns:
Total number of sectors.
Throws:
java.lang.Exception
Since:
SWATH 1.3

currSector

public int currSector()
               throws java.lang.Exception
Gets the current sector number.

Returns:
The current sector number.
Throws:
java.lang.Exception
Since:
SWATH 1.3

currPlanet

public int currPlanet()
               throws java.lang.Exception
Gets the current planet number.

Returns:
The current planet number or 0 if not on a planet.
Throws:
java.lang.Exception
Since:
SWATH 1.4

prompt

public int prompt()
           throws java.lang.Exception
Gets the current prompt.

Returns:
The current prompt or Swath.NO_PROMPT if you're not at any prompt for the moment.
Throws:
java.lang.Exception
Since:
SWATH 1.3
See Also:
Swath.NO_PROMPT, Swath.COMMAND_PROMPT, Swath.COMPUTER_PROMPT, Swath.PLANET_PROMPT, Swath.CITADEL_PROMPT, Swath.CORP_PROMPT, Swath.STARDOCK_PROMPT

stardock

public int stardock()
             throws java.lang.Exception
Gets the StarDock location.

Returns:
The StarDock sector or 0 if not known.
Throws:
java.lang.Exception
Since:
SWATH 1.3

class0ports

public int[] class0ports()
                  throws java.lang.Exception
Gets the locations of the class 0 ports.

Returns:
An array with all known class 0 port sectors.
Throws:
java.lang.Exception
Since:
SWATH 1.3

lastRobStealSector

public int lastRobStealSector()
                       throws java.lang.Exception
Gets the last sector where you robbed or stole from the port.

Returns:
The last sector where you robbed or stole or 0 if none.
Throws:
java.lang.Exception
Since:
SWATH 1.3

hostname

public java.lang.String hostname()
                          throws java.lang.Exception
Gets the name or IP address of the game server.

Returns:
The hostname/IP.
Throws:
java.lang.Exception
Since:
SWATH 1.3
See Also:
port()

port

public int port()
         throws java.lang.Exception
Gets the port number of the game server.

Returns:
The port number.
Throws:
java.lang.Exception
Since:
SWATH 1.3
See Also:
hostname()

username

public java.lang.String username()
                          throws java.lang.Exception
Gets the current game username.

Returns:
The username.
Throws:
java.lang.Exception
Since:
SWATH 1.7
See Also:
password()

password

public java.lang.String password()
                          throws java.lang.Exception
Gets the current game password.

Returns:
The password.
Throws:
java.lang.Exception
Since:
SWATH 1.7
See Also:
username()

swathPath

public java.io.File swathPath()
                       throws java.lang.Exception
Gets the path to the SWATH installation.

Returns:
The SWATH path.
Throws:
java.lang.Exception
Since:
SWATH 1.5

swathVersion

public java.lang.String swathVersion()
                              throws java.lang.Exception
Gets the current SWATH version.

Returns:
The SWATH version.
Throws:
java.lang.Exception
Since:
SWATH 1.3

gamePath

public java.io.File gamePath()
                      throws java.lang.Exception
Gets the current game path.

Returns:
The TW game path.
Throws:
java.lang.Exception
Since:
SWATH 1.5
See Also:
gameName()

gameName

public java.lang.String gameName()
                          throws java.lang.Exception
Gets the current game name.

Returns:
The TW game name.
Throws:
java.lang.Exception
Since:
SWATH 1.5
See Also:
gamePath()

gameVersion

public java.lang.String gameVersion()
                             throws java.lang.Exception
Gets the current game version.

Returns:
The TW game version.
Throws:
java.lang.Exception
Since:
SWATH 1.3

gameId

public char gameId()
            throws java.lang.Exception
Gets the current game id letter.

Returns:
The game id letter or '-' if not known.
Throws:
java.lang.Exception
Since:
SWATH 1.7

gameSettings

public java.util.Map gameSettings()
                           throws java.lang.Exception
Gets all known game settings.

Returns:
A map with all the game settings.
Throws:
java.lang.Exception
Since:
SWATH 1.7

isMBBSGame

public boolean isMBBSGame()
                   throws java.lang.Exception
Indicates if the current TradeWars game is MBBS enabled.

Returns:
true if the TW game is MBBS enabled, otherwise false.
Throws:
java.lang.Exception
Since:
SWATH 1.5
See Also:
isGoldGame()

isGoldGame

public boolean isGoldGame()
                   throws java.lang.Exception
Indicates if the current TradeWars game is Gold enabled.

Returns:
true if the TW game is Gold enabled, otherwise false.
Throws:
java.lang.Exception
Since:
SWATH 1.5
See Also:
isMBBSGame()

isConnected

public boolean isConnected()
                    throws java.lang.Exception
Indicates if SWATH is connected to a game server or not.

Returns:
true if connected, otherwise false.
Throws:
java.lang.Exception
Since:
SWATH 1.6.2
See Also:
timeOnline()

timeOnline

public int timeOnline()
               throws java.lang.Exception
Returns how long time SWATH has been connected to the current game server. Only valid if SWATH is connected to a game server.

Returns:
The number of seconds online.
Throws:
java.lang.Exception
Since:
SWATH 1.6.5
See Also:
isConnected()

isHelperMode

public boolean isHelperMode()
                     throws java.lang.Exception
Indicates if the SWATH helper mode is active or not.

Returns:
true if helper mode is active, otherwise false.
Throws:
java.lang.Exception
Since:
SWATH 1.7

isProxyMode

public boolean isProxyMode()
                    throws java.lang.Exception
Indicates if the proxy mode is active or not.

Returns:
true if proxy mode is active, otherwise false.
Throws:
java.lang.Exception
Since:
SWATH 1.7

isParsingText

public boolean isParsingText()
                      throws java.lang.Exception
Indicates if SWATH is parsing incoming text or not.

Returns:
true if SWATH is parsing text, otherwise false.
Throws:
java.lang.Exception
Since:
SWATH 1.7

isTextOutputSuppressed

public boolean isTextOutputSuppressed()
                               throws java.lang.Exception
Indicates if text output is suppressed or not.

Returns:
true if text output is suppressed, otherwise false.
Throws:
java.lang.Exception
Since:
SWATH 1.7

dump

public void dump()
          throws java.lang.Exception
Dumps all the main info in the terminal window.

Throws:
java.lang.Exception
Since:
SWATH 1.3