|
||||||||||
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.SOCPlayerStats
public class SOCPlayerStats
Statistics of one type for one player. Sent at end of game, or by player's request ("*STATS*" command). Design allows multiple types of stats. The first item in this message is the type number. Content of further items depends on the stats type.
Type 1: Resource roll stats:
For item details see STYPE_RES_ROLL
. Introduced in 1.1.09;
check client version against VERSION_FOR_RES_ROLL
before sending this type.
In 2.0.00 and newer, this type optionally includes an additional item for the number of gold hex resource picks/gains. Older clients would ignore the extra item, but wouldn't be compatible anyway with any game scenario that features gold hexes.
Robot clients don't need to know about or handle this message type, because they don't care about their player stats.
Field Summary | |
---|---|
private static long |
serialVersionUID
|
static int |
STYPE_MAX
Highest-numbered stat stype in this version (1) |
static int |
STYPE_MIN
Lowest-numbered stats type (1) |
static int |
STYPE_RES_ROLL
Stats type 1: Resource roll stats. |
static int |
VERSION_FOR_RES_ROLL
Minimum client version 1.1.09 for stats type 1 ( STYPE_RES_ROLL : resource roll stats). |
Fields inherited from class soc.message.SOCMessageTemplateMi |
---|
game, pa |
Constructor Summary | |
---|---|
|
SOCPlayerStats(SOCPlayer pl,
int stype)
Constructor for server to tell client about a player stat. |
protected |
SOCPlayerStats(java.lang.String gameName,
int[] pa)
Constructor for client to parse message from server. |
Method Summary | |
---|---|
int |
getMinimumVersion()
Minimum version where this message type is used. |
int |
getStatType()
Get the stat type. |
private static int |
len(SOCPlayer pl,
int stype)
Given a stat type and specific player, find the array length needed to send that player's stats of that type. |
static SOCPlayerStats |
parseDataStr(java.util.List<java.lang.String> pa)
Parse the command String list into a SOCPlayerStats 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 |
---|
private static final long serialVersionUID
public static final int STYPE_MIN
public static final int STYPE_RES_ROLL
pa[1] = clay count pa[2] = ore pa[3] = sheep pa[4] = wheat pa[5] = wood count pa[6] = gold gains count (v2.0.00+); value is 0 if omitted
In 2.0.00 and newer, this type optionally includes an additional item for the number of gold hex resource picks/gains; this is omitted when value is 0 and there are no further items. Older clients would ignore the extra item, but wouldn't be compatible anyway with any game scenario that features gold hexes.
Check client version against VERSION_FOR_RES_ROLL
before sending this type.
public static final int STYPE_MAX
public static final int VERSION_FOR_RES_ROLL
STYPE_RES_ROLL
: resource roll stats).
Constructor Detail |
---|
public SOCPlayerStats(SOCPlayer pl, int stype) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
pl
- Player for these statsstype
- Stats type. Newer servers and clients may support
more types. For each type (such as STYPE_RES_ROLL
),
check the corresponding VERSION_FOR_ field before sending.
java.lang.IllegalArgumentException
- if stype < STYPE_MIN
or > STYPE_MAX
java.lang.NullPointerException
- if pl nullprotected SOCPlayerStats(java.lang.String gameName, int[] pa) throws java.lang.IllegalArgumentException
gameName
- Game namepa
- Parameters of the option:
pa[0]
= stats type (only type 1 is defined for now):
Use STYPE_RES_ROLL
for this parameter.
pa[1 - n]
= items for that stats type:
see stats-type constant javadocs.
java.lang.IllegalArgumentException
Method Detail |
---|
private static final int len(SOCPlayer pl, int stype) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
pl
- Player for these statsstype
- Stats type, such as STYPE_RES_ROLL
; see class javadoc or constructors
stype
at index 0; always 6 before v2.0.00
java.lang.IllegalArgumentException
- if stype
< STYPE_MIN
or > STYPE_MAX
java.lang.NullPointerException
- if pl
nullpublic int getMinimumVersion()
getMinimumVersion
in class SOCMessage
public int getStatType()
For the actual statistic data. call SOCMessageTemplateMi.getParams()
but
remember that stats[i] will be in params[i+1],
because params[0] is the stat type.
STYPE_RES_ROLL
public static SOCPlayerStats parseDataStr(java.util.List<java.lang.String> pa)
SOCPlayerStats(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 |