|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.message.SOCMessage soc.message.SOCPlayerElement
public class SOCPlayerElement
This message conveys one part of the player's status, such as their number of settlements remaining.
Unless otherwise mentioned, any getElementType()
can be sent with
any action (SET
, GAIN
, LOSE
).
Field Summary | |
---|---|
private int |
actionType
Action type: SET , GAIN , or LOSE |
static int |
ASK_SPECIAL_BUILD
For the 6-player board, player element type for asking to build during the Special Building Phase . |
static int |
CITIES
|
static int |
CLAY
player element types. |
private int |
elementType
Player element type, such as SETTLEMENTS |
static int |
GAIN
|
private java.lang.String |
game
Name of game |
static int |
LOSE
|
static int |
NUM_PICK_GOLD_HEX_RESOURCES
For the large sea board ,
player element type for asking to choose
resources from the gold hex after a dice roll,
during the WAITING_FOR_PICK_GOLD_RESOURCE
game state. |
static int |
NUMKNIGHTS
Number of knights in player's army; sent after a Soldier card is played. |
static int |
ORE
|
private int |
playerNumber
Player number |
static int |
ROADS
|
static int |
SCENARIO_CLOTH_COUNT
For scenario _SC_CLVI on the large sea board ,
the number of cloth held by this player. |
static int |
SCENARIO_PLAYEREVENTS_BITMASK
For scenarios on the large sea board ,
bitmask of flags related to scenario player events. |
static int |
SCENARIO_SVP
For scenarios on the large sea board ,
the player's number of Special Victory Points (SVP). |
static int |
SCENARIO_SVP_LANDAREAS_BITMASK
For scenarios on the large sea board ,
bitmask of land areas for tracking Special Victory Points (SVP). |
static int |
SCENARIO_WARSHIP_COUNT
For scenario game option _SC_PIRI, the player's total number of ships that have been converted to warships. |
private static long |
serialVersionUID
|
static int |
SET
player element actions |
static int |
SETTLEMENTS
|
static int |
SHEEP
|
static int |
SHIPS
Number of SHIP pieces; added in v2.0.00. |
static int |
STARTING_LANDAREAS
Player's starting land area numbers. |
static int |
UNKNOWN
|
private int |
value
Element value |
static int |
WHEAT
|
static int |
WOOD
|
Constructor Summary | |
---|---|
SOCPlayerElement(java.lang.String ga,
int pn,
int ac,
int et,
int va)
Create a PlayerElement message. |
Method Summary | |
---|---|
int |
getAction()
Get the type of action. |
int |
getElementType()
Get the element type, the type of info that is changing. |
java.lang.String |
getGame()
Name of game this message is for. |
int |
getPlayerNumber()
Get this element's player number. |
int |
getValue()
Get the new value to set, or the delta to gain/lose. |
static SOCPlayerElement |
parseDataStr(java.lang.String s)
Parse the command String into a PlayerElement message |
java.lang.String |
toCmd()
PLAYERELEMENT sep game sep2 playerNumber sep2 actionType sep2 elementType sep2 value |
static java.lang.String |
toCmd(java.lang.String ga,
int pn,
int ac,
int et,
int va)
PLAYERELEMENT sep game sep2 playerNumber sep2 actionType sep2 elementType sep2 value |
java.lang.String |
toString()
Simple human-readable representation, used for debug purposes. |
Methods inherited from class soc.message.SOCMessage |
---|
arrayIntoStringBuf, enumIntoStringBuf, getClassNameShort, getMaximumVersion, getMinimumVersion, 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 CLAY
SOCResourceConstants.CLAY
;
ORE, SHEEP, WHEAT and WOOD also match SOCResourceConstants.
public static final int ORE
public static final int SHEEP
public static final int WHEAT
public static final int WOOD
public static final int UNKNOWN
public static final int ROADS
public static final int SETTLEMENTS
public static final int CITIES
public static final int SHIPS
public static final int NUMKNIGHTS
public static final int ASK_SPECIAL_BUILD
Special Building Phase
.
This element is SET
to 1 or 0.
public static final int NUM_PICK_GOLD_HEX_RESOURCES
large sea board
,
player element type for asking to choose
resources from the gold hex after a dice roll,
during the WAITING_FOR_PICK_GOLD_RESOURCE
game state.
This element is SET
to 0, or to the number of resources to choose.
Call SOCPlayer.setNeedToPickGoldHexResources(int)
.
public static final int SCENARIO_SVP
large sea board
,
the player's number of Special Victory Points (SVP).
This element is SET
to 0, or to the player's
SOCPlayer.getSpecialVP()
.
public static final int SCENARIO_PLAYEREVENTS_BITMASK
large sea board
,
bitmask of flags related to scenario player events.
This element is SET
to 0, or to the player's flags
from SOCPlayer.getScenarioPlayerEvents()
.
public static final int SCENARIO_SVP_LANDAREAS_BITMASK
large sea board
,
bitmask of land areas for tracking Special Victory Points (SVP).
This element is SET
to 0, or to the player's land areas
from SOCPlayer.getScenarioSVPLandAreas()
.
public static final int STARTING_LANDAREAS
public static final int SCENARIO_CLOTH_COUNT
large sea board
,
the number of cloth held by this player.
This element is SET
to 0, or to the player's cloth count
from SOCPlayer.getCloth()
.
After giving cloth to a player, check their total VP; 2 cloth = 1 Victory Point.
The board's "general supply" is updated with this element type
with getPlayerNumber()
== -1.
Each village's cloth count is updated with a PIECEVALUE
message.
public static final int SCENARIO_WARSHIP_COUNT
SET
or GAIN
ed. For clarity, if the number of
warships decreases, send SET
, never send LOSE
.
GAIN
is sent only in response to a player's successful
SOCPlayDevCardRequest
to convert a ship to a warship.
If a player is joining a game in progress, the PLAYERELEMENT(SCENARIO_WARSHIP_COUNT) message is sent to their client only after sending their SOCShip piece positions.
public static final int SET
public static final int GAIN
public static final int LOSE
private java.lang.String game
private int playerNumber
private int elementType
SETTLEMENTS
private int actionType
SET
, GAIN
, or LOSE
private int value
Constructor Detail |
---|
public SOCPlayerElement(java.lang.String ga, int pn, int ac, int et, int va)
ga
- name of the gamepn
- the player number; v1.1.19 and newer allow -1 for some elements (applies to board or to all players).
Earlier client versions will throw an exception accessing player -1.
If the element type allows -1, its constant's javadoc will mention that.ac
- the type of action: SET
, GAIN
, or LOSE
et
- the type of element, such as SETTLEMENTS
va
- the value of the elementMethod Detail |
---|
public java.lang.String getGame()
SOCMessageForGame
null
if message is in per-game structures or code.
At the server, the message treater dispatches incoming SOCMessageForGame
s
based on their getGame()
:
null
: Message is ignored
SOCMessage.GAME_NONE
: Message is handled by SOCServer
itself
GameHandler
for that game's type. If no game with that name is found,
the message is ignored.
getGame
in interface SOCMessageForGame
SOCMessage.GAME_NONE
public int getPlayerNumber()
public int getAction()
SET
, GAIN
, or LOSE
public int getElementType()
SETTLEMENTS
or NUMKNIGHTS
public int getValue()
SET
, GAIN
, or LOSE
public java.lang.String toCmd()
toCmd
in class SOCMessage
public static java.lang.String toCmd(java.lang.String ga, int pn, int ac, int et, int va)
ga
- the game namepn
- the player number; v1.1.19 and newer allow -1 for some elements (applies to board or to all players).
Earlier client versions will throw an exception accessing player -1.
If the element type allows -1, its constant's javadoc will mention that.ac
- the type of actionet
- the type of elementva
- the value of the element
public static SOCPlayerElement parseDataStr(java.lang.String s)
s
- the String to parse
public java.lang.String toString()
SOCMessage
toString
in class SOCMessage
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |