|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsoc.message.SOCMessage
soc.message.SOCMessageMulti
soc.message.SOCMessageTemplateMi
soc.message.SOCDiceResultResources
public class SOCDiceResultResources
All resources gained by players from a dice roll.
Before v2.0.00, these were sent as SOCPlayerElement(GAIN) and SOCGameTextMsg.
This single message is more efficient and also easier for i18n/localization.
| Field Summary | |
|---|---|
java.util.List<java.lang.Integer> |
playerNum
playerNum(i) is the player number gaining the resources in playerRsrc(i). |
java.util.List<SOCResourceSet> |
playerRsrc
playerRsrc(i) is the resource set gained by player playerNum(i). |
private static long |
serialVersionUID
|
static int |
VERSION_FOR_DICERESULTRESOURCES
Version number (2.0.00) where the server no longer sends dice roll result resources as a game text message + several SOCPlayerElement(GAIN) messages,
and instead sends a single SOCDiceResultResources message. |
| Fields inherited from class soc.message.SOCMessageTemplateMi |
|---|
game, pa |
| Constructor Summary | |
|---|---|
protected |
SOCDiceResultResources(java.lang.String gameName,
int[] pa)
Constructor for client to parse message from server via parseDataStr(List<String>). |
|
SOCDiceResultResources(java.lang.String gaName,
java.util.List<java.lang.Integer> pn,
java.util.List<SOCResourceSet> rsrc)
Constructor for server to tell clients about players' gained resources. |
| Method Summary | |
|---|---|
private static int[] |
buildIntList(java.util.List<java.lang.Integer> pnum,
java.util.List<SOCResourceSet> rsrc)
Used by server constructor to build an outbound array of ints from these players and these resources. |
int |
getMinimumVersion()
Minimum version where this message type is used ( VERSION_FOR_DICERESULTRESOURCES). |
static SOCDiceResultResources |
parseDataStr(java.util.List<java.lang.String> pa)
Parse the command String list into a SOCDiceResultResources message. |
| Methods inherited from class soc.message.SOCMessageTemplateMi |
|---|
getGame, getParams, toCmd, toCmd, toString |
| 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 |
| Methods inherited from interface soc.message.SOCMessageForGame |
|---|
getType |
| Field Detail |
|---|
public static final int VERSION_FOR_DICERESULTRESOURCES
SOCPlayerElement(GAIN) messages,
and instead sends a single SOCDiceResultResources message.
private static final long serialVersionUID
public java.util.List<java.lang.Integer> playerNum
playerNum(i) is the player number gaining the resources in playerRsrc(i).
Used at client only, null at server.
public java.util.List<SOCResourceSet> playerRsrc
playerRsrc(i) is the resource set gained by player playerNum(i).
Used at client only, null at server.
| Constructor Detail |
|---|
public SOCDiceResultResources(java.lang.String gaName,
java.util.List<java.lang.Integer> pn,
java.util.List<SOCResourceSet> rsrc)
throws java.lang.IllegalArgumentException,
java.lang.NullPointerException
pn and rsrc; the playerNum and
playerRsrc fields will be left blank, we don't need them to send the ints to clients.
gaName - Game namepn - Player numbers, same format as playerNumrsrc - Resources gained by each pn, same format as playerRsrc
java.lang.IllegalArgumentException - if pn.size() != rsrc.size(), or if either is empty
java.lang.NullPointerException - if any parameter is null
protected SOCDiceResultResources(java.lang.String gameName,
int[] pa)
throws java.lang.IllegalArgumentException
parseDataStr(List<String>).
Decodes the integers in pa[] into playerNum and playerRsrc.
gameName - Game namepa - Parameters, each of which is a sequence of integers with this format:
pa[i] = player number gaining resource(s)
Pair of:
pa[i+1] = resource amount gained
pa[i+2] = resource type
More pairs, if any, for each other resource type gained by the player
If there are more players after this one:
pa[i+n] = 0, marking the end of the pairs
java.lang.IllegalArgumentException - if pa[] doesn't fit that format, or ends in the middle of parsing| Method Detail |
|---|
private static final int[] buildIntList(java.util.List<java.lang.Integer> pnum,
java.util.List<SOCResourceSet> rsrc)
pnum - Player numbers, same format as playerNumrsrc - Resources gained by each pn, same format as playerRsrc
java.lang.IllegalArgumentException - if pn.size() != rsrc.size(), or if either is empty
java.lang.NullPointerException - if any parameter is nullpublic int getMinimumVersion()
VERSION_FOR_DICERESULTRESOURCES).
DICERESULTRESOURCES introduced in 2.0.00 for dice roll result resources.
getMinimumVersion in class SOCMessagepublic static SOCDiceResultResources parseDataStr(java.util.List<java.lang.String> pa)
SOCDiceResultResources(String, int[]) constructor,
see its javadoc for parameter details.
pa - the parameters; length 2 or more required.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||