|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.message.SOCMessage soc.message.SOCChoosePlayer
public class SOCChoosePlayer
This message from client to server has a few purposes, all related to robbing:
SOCChoosePlayerRequest
,
it says which player the current player wants to
steal from.
In some game scenarios in version 2.0.00 or newer,
the player might have the option to steal from no one.
If the player makes that choice, getChoice()
is CHOICE_NO_PLAYER
.
SOCGameState
(WAITING_FOR_ROBBER_OR_PIRATE
) message,
it says whether the player wants to move the robber
or the pirate ship. (v2.0.00+)
SOCChoosePlayer
message, it says whether the player wants to
rob cloth or rob a resource from the victim. (v2.0.00+)
getChoice()
gets the client's choice.
Also sent from server to client (v2.0.00+) to prompt the client to choose to rob
cloth or rob a resource from the victim; getChoice()
is the victim player number.
Field Summary | |
---|---|
private int |
choice
The number of the chosen player, or CHOICE_NO_PLAYER to choose no one,
or CHOICE_MOVE_ROBBER to move the robber
or CHOICE_MOVE_PIRATE to move the pirate ship. |
static int |
CHOICE_MOVE_PIRATE
Constant for getChoice() in game state
WAITING_FOR_ROBBER_OR_PIRATE: move Pirate Ship (not robber). |
static int |
CHOICE_MOVE_ROBBER
Constant for getChoice() in game state
WAITING_FOR_ROBBER_OR_PIRATE: move Robber (not pirate ship). |
static int |
CHOICE_NO_PLAYER
Constant for getChoice() in response to server's SOCChoosePlayerRequest ,
if player has chosen to not rob from any player. |
private java.lang.String |
game
Name of game |
private static long |
serialVersionUID
|
Constructor Summary | |
---|---|
SOCChoosePlayer(java.lang.String ga,
int ch)
Create a ChoosePlayer message. |
Method Summary | |
---|---|
int |
getChoice()
|
java.lang.String |
getGame()
Name of game this message is for. |
static SOCChoosePlayer |
parseDataStr(java.lang.String s)
Parse the command String into a ChoosePlayer message |
java.lang.String |
toCmd()
CHOOSEPLAYER sep game sep2 choice |
static java.lang.String |
toCmd(java.lang.String ga,
int ch)
CHOOSEPLAYER sep game sep2 choice |
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 CHOICE_NO_PLAYER
getChoice()
in response to server's SOCChoosePlayerRequest
,
if player has chosen to not rob from any player.
public static final int CHOICE_MOVE_ROBBER
getChoice()
in game state
WAITING_FOR_ROBBER_OR_PIRATE: move Robber (not pirate ship).
public static final int CHOICE_MOVE_PIRATE
getChoice()
in game state
WAITING_FOR_ROBBER_OR_PIRATE: move Pirate Ship (not robber).
private java.lang.String game
private int choice
CHOICE_NO_PLAYER
to choose no one,
or CHOICE_MOVE_ROBBER
to move the robber
or CHOICE_MOVE_PIRATE
to move the pirate ship.
Constructor Detail |
---|
public SOCChoosePlayer(java.lang.String ga, int ch)
ga
- the name of the gamech
- the number of the chosen player,
or CHOICE_NO_PLAYER
to choose no one,
or CHOICE_MOVE_ROBBER
to move the robber
or CHOICE_MOVE_PIRATE
to move the pirate ship.
Method 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 getChoice()
CHOICE_NO_PLAYER
to choose no one,
or CHOICE_MOVE_ROBBER
to move the robber
or CHOICE_MOVE_PIRATE
to move the pirate ship.
public java.lang.String toCmd()
toCmd
in class SOCMessage
public static java.lang.String toCmd(java.lang.String ga, int ch)
ga
- the name of the gamech
- the number of the chosen player;
see SOCChoosePlayer(String, int)
for meaning
public static SOCChoosePlayer 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 |