soc.message
Class SOCGameOptionGetInfos

java.lang.Object
  extended by soc.message.SOCMessage
      extended by soc.message.SOCGameOptionGetInfos
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class SOCGameOptionGetInfos
extends SOCMessage

This message from client sends a list of game options to the server. The server will respond with GAMEOPTIONINFO message(s), one per option keyname listed in this message.

If the only 'option' keyname sent is '-', server will send info on all options which are new or changed since the client's version. (this usage assumes client is older than server).

This is so clients can find out about options which were introduced in versions newer than the client's version, but which may be applicable to their version or all versions.

In v2.0.00 and newer, clients can also request localized descriptions of all options if available, by including OPTKEY_GET_I18N_DESCS as the last option keyname in their list sent to the server. Check server version against SOCStringManager.VERSION_FOR_I18N. The keyname list sent by the client would be:

This message type introduced in v1.1.07; check server version against SOCNewGameWithOptions.VERSION_FOR_NEWGAMEWITHOPTIONS before sending this message.

Robot clients don't need to know about or handle this message type, because they don't create games.

Since:
1.1.07
Author:
Jeremy D Monin
See Also:
Serialized Form

Field Summary
private  boolean hasTokenGetI18nDescs
          True if client is also asking server for localized game option descriptions (v2.0.00 and newer); will send OPTKEY_GET_I18N_DESCS along with optkeys.
static java.lang.String OPTKEY_GET_I18N_DESCS
          I18N option-description request token "?I18N" sent from client when its locale isn't en_US.
private  java.util.Vector<java.lang.String> optkeys
          List of game option keynames (Strings), or null.
private static long serialVersionUID
           
 
Fields inherited from class soc.message.SOCMessage
ACCEPTOFFER, ADMINPING, ADMINRESET, AUTHREQUEST, BANKTRADE, BCASTTEXTMSG, BOARDLAYOUT, BOARDLAYOUT2, BOARDSPECIALEDGE, BUILDREQUEST, BUYCARDREQUEST, CANCELBUILDREQUEST, CHANGEFACE, CHANNELS, CHOOSEPLAYER, CHOOSEPLAYERREQUEST, CLEAROFFER, CLEARTRADEMSG, CREATEACCOUNT, DEBUGFREEPLACE, DELETECHANNEL, DELETEGAME, DEVCARDACTION, DEVCARDCOUNT, DICERESULT, DICERESULTRESOURCES, DISCARD, DISCARDREQUEST, DISCOVERYPICK, ENDTURN, FIRSTPLAYER, GAME_NONE, GAMEMEMBERS, GAMEOPTIONGETDEFAULTS, GAMEOPTIONGETINFOS, GAMEOPTIONINFO, GAMES, GAMESERVERTEXT, GAMESTATE, GAMESTATS, GAMESWITHOPTIONS, GAMETEXTMSG, IMAROBOT, INVENTORYITEMACTION, JOIN, JOINAUTH, JOINGAME, JOINGAMEAUTH, LARGESTARMY, LASTSETTLEMENT, LEAVE, LEAVEALL, LEAVEGAME, LEGALEDGES, LOCALIZEDSTRINGS, LONGESTROAD, MAKEOFFER, MEMBERS, messageType, MONOPOLYPICK, MOVEPIECE, MOVEPIECEREQUEST, MOVEROBBER, NEWCHANNEL, NEWGAME, NEWGAMEWITHOPTIONS, NEWGAMEWITHOPTIONSREQUEST, NULLMESSAGE, PICKRESOURCES, PICKRESOURCESREQUEST, PIECEVALUE, PLAYDEVCARDREQUEST, PLAYERELEMENT, PLAYERELEMENTS, PLAYERSTATS, POTENTIALSETTLEMENTS, PUTPIECE, REJECTCONNECTION, REJECTOFFER, REMOVEPIECE, RESETBOARDAUTH, RESETBOARDREJECT, RESETBOARDREQUEST, RESETBOARDVOTE, RESETBOARDVOTEREQUEST, RESOURCECOUNT, REVEALFOGHEX, ROBOTDISMISS, ROBOTJOINGAMEREQUEST, ROLLDICE, ROLLDICEPROMPT, ROLLDICEREQUEST, SCENARIOINFO, sep, sep_char, sep2, sep2_char, SERVERPING, SETPLAYEDDEVCARD, SETSEATLOCK, SETSPECIALITEM, SETTURN, SETUPDONE, SIMPLEACTION, SIMPLEREQUEST, SITDOWN, STARTGAME, STATUSMESSAGE, SVPTEXTMSG, TEXTMSG, TIMINGPING, TURN, UPDATEROBOTPARAMS, VERSION
 
Constructor Summary
SOCGameOptionGetInfos(java.util.Vector<java.lang.String> okeys, boolean withTokenI18nDescs)
          Create a GameOptionGetInfos Message.
 
Method Summary
 int getMinimumVersion()
          Minimum version where this message type is used.
 java.util.Vector<java.lang.String> getOptionKeys()
           
 boolean hasTokenGetI18nDescs()
           
static SOCGameOptionGetInfos parseDataStr(java.lang.String s)
          Parse the command String into a GameOptionGetInfos message
 java.lang.String toCmd()
          GAMEOPTIONGETINFOS sep optkeys
static java.lang.String toCmd(java.util.List<?> opts, boolean withTokenI18nDescs)
          GAMEOPTIONGETINFOS sep optkeys
 java.lang.String toString()
          Simple human-readable representation, used for debug purposes.
 
Methods inherited from class soc.message.SOCMessage
arrayIntoStringBuf, enumIntoStringBuf, getClassNameShort, getMaximumVersion, getType, isSingleLineAndSafe, isSingleLineAndSafe, toMsg
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

OPTKEY_GET_I18N_DESCS

public static final java.lang.String OPTKEY_GET_I18N_DESCS
I18N option-description request token "?I18N" sent from client when its locale isn't en_US.

If the list of game option keys from the client includes this item, the server should check the client's locale and send localized descriptions for all game options available at this client's version.

When present, this will be at the end of the list of option keys sent over the network, but isn't part of the list returned by getOptionKeys(). The receiving parser will remove it from the list and set hasTokenGetI18nDescs().

If the server does not have game option names in the client's locale, this token is ignored and only the changed options will be sent by version as described above.

Introduced in v2.0.00: Before sending, check the server's version against SOCStringManager.VERSION_FOR_I18N.

Since:
2.0.00
See Also:
hasTokenGetI18nDescs(), Constant Field Values

optkeys

private java.util.Vector<java.lang.String> optkeys
List of game option keynames (Strings), or null. Will not include OPTKEY_GET_I18N_DESCS, use hasTokenGetI18nDescs() instead.


hasTokenGetI18nDescs

private boolean hasTokenGetI18nDescs
True if client is also asking server for localized game option descriptions (v2.0.00 and newer); will send OPTKEY_GET_I18N_DESCS along with optkeys.

Since:
2.0.00
Constructor Detail

SOCGameOptionGetInfos

public SOCGameOptionGetInfos(java.util.Vector<java.lang.String> okeys,
                             boolean withTokenI18nDescs)
Create a GameOptionGetInfos Message.

Parameters:
okeys - list of game option keynames (Strings), or null for "-". Do not include OPTKEY_GET_I18N_DESCS in this list; set withTokenI18nDescs true instead.
withTokenI18nDescs - true if client is also asking server for localized game option descriptions (v2.0.00 and newer); will send OPTKEY_GET_I18N_DESCS along with okeys. Before sending this token, check the server's version against SOCStringManager.VERSION_FOR_I18N.
Method Detail

getMinimumVersion

public int getMinimumVersion()
Minimum version where this message type is used. GAMEOPTIONGETINFOS introduced in 1.1.07 for game-options feature.

Overrides:
getMinimumVersion in class SOCMessage
Returns:
Version number, 1107 for JSettlers 1.1.07.

getOptionKeys

public java.util.Vector<java.lang.String> getOptionKeys()
Returns:
the list of option keynames (a vector of Strings), or null if "-" was sent. Will not include OPTKEY_GET_I18N_DESCS; see hasTokenGetI18nDescs() instead.

hasTokenGetI18nDescs

public boolean hasTokenGetI18nDescs()
Returns:
True if client is also asking server for localized game option descriptions (v2.0.00 and newer); message includes OPTKEY_GET_I18N_DESCS along with getOptionKeys().
Since:
2.0.00

toCmd

public java.lang.String toCmd()
GAMEOPTIONGETINFOS sep optkeys

Specified by:
toCmd in class SOCMessage
Returns:
the command string

toCmd

public static java.lang.String toCmd(java.util.List<?> opts,
                                     boolean withTokenI18nDescs)
GAMEOPTIONGETINFOS sep optkeys

Parameters:
opts - the list of option keynames, as a list of Strings or SOCGameOptions, or null to use "-" as 'optkeys'
withTokenI18nDescs - true if client is also asking server for localized game option descriptions (v2.0.00 and newer); will send OPTKEY_GET_I18N_DESCS along with opts. Before sending this token, check the server's version against SOCStringManager.VERSION_FOR_I18N.
Returns:
the command string

parseDataStr

public static SOCGameOptionGetInfos parseDataStr(java.lang.String s)
Parse the command String into a GameOptionGetInfos message

Parameters:
s - the String to parse
Returns:
a GetInfos message, or null of the data is garbled

toString

public java.lang.String toString()
Description copied from class: SOCMessage
Simple human-readable representation, used for debug purposes.

Specified by:
toString in class SOCMessage
Returns:
a human readable form of the message