|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.client.SOCDisplaylessPlayerClient
public class SOCDisplaylessPlayerClient
GUI-less standalone client for connecting to the SOCServer. If you want another connection port, you have to specify it as the "port" argument in the html source. If you run this as a stand-alone, you have to specify the port.
The SOCRobotClient
is based on this client.
Because of this, some methods (such as handleVERSION(boolean, SOCVersion)
)
assume the client and server are the same version.
Since client and server are the same version, this client ignores game option sync
and scenario synchronization messages (SOCGameOptionInfo
, SOCScenarioInfo
).
Being GUI-less, it ignores i18n localization messages (SOCLocalizedStrings
).
Field Summary | |
---|---|
protected java.util.Hashtable<java.lang.String,?> |
channels
Chat channels; for general use, or possibly in a future version to control bots. |
protected boolean |
connected
|
protected java.lang.String |
doc
|
protected java.lang.Exception |
ex
|
protected java.util.Hashtable<java.lang.String,SOCGame> |
games
the games we're playing |
protected boolean |
gotPassword
true if we've stored the password |
protected java.lang.String |
host
|
protected java.io.DataInputStream |
in
|
protected java.lang.String |
lastMessage
|
protected java.lang.String |
nickname
the nickname |
protected java.io.DataOutputStream |
out
|
protected java.lang.String |
password
the password |
protected int |
port
|
protected java.lang.Thread |
reader
|
protected boolean |
rejected
were we rejected from server? (full or robot name taken) |
protected java.net.Socket |
s
|
protected SOCServerFeatures |
sFeatures
Server's active optional features, sent soon after connect, or null if unknown. |
protected LocalStringConnection |
sLocal
|
protected SOCServerFeatures |
sLocalFeatures
Server's active optional features, sent soon after connect, or null if unknown. |
protected int |
sLocalVersion
Server version number, sent soon after connect, or -1 if unknown. |
protected static java.lang.String |
STATSPREFEX
|
protected java.lang.String |
strSocketName
|
protected int |
sVersion
Server version number, sent soon after connect, or -1 if unknown. |
Constructor Summary | |
---|---|
SOCDisplaylessPlayerClient()
Create a SOCDisplaylessPlayerClient, which would connect to localhost port 8889. |
|
SOCDisplaylessPlayerClient(java.lang.String s,
boolean visual)
Constructor for connecting to a local game (practice) on a local stringport. |
|
SOCDisplaylessPlayerClient(java.lang.String h,
int p,
boolean visual)
Constructor for connecting to the specified host, on the specified port. |
Method Summary | |
---|---|
void |
acceptOffer(SOCGame ga,
int from)
the user is accepting an offer |
void |
bankTrade(SOCGame ga,
SOCResourceSet give,
SOCResourceSet get)
the user wants to trade with the bank or a port. |
void |
buildRequest(SOCGame ga,
int piece)
request to build something |
void |
buyDevCard(SOCGame ga)
request to buy a development card |
void |
cancelBuildRequest(SOCGame ga,
int piece)
request to cancel building something |
void |
changeFace(SOCGame ga,
int id)
the user is changing the face image |
void |
choosePlayer(SOCGame ga,
int ch)
The user chose a player to steal from, or (game state SOCGame.WAITING_FOR_ROBBER_OR_PIRATE )
chose whether to move the robber or the pirate,
or (game state SOCGame.WAITING_FOR_ROB_CLOTH_OR_RESOURCE )
chose whether to steal a resource or cloth. |
void |
chSend(java.lang.String ch,
java.lang.String mes)
send a text message to a channel |
void |
clearOffer(SOCGame ga)
the user is clearing an offer |
void |
destroy()
destroy the applet |
void |
discard(SOCGame ga,
SOCResourceSet rs)
the user wants to discard |
protected void |
disconnect()
disconnect from the net, and from any local practice server |
void |
discoveryPick(SOCGame ga,
SOCResourceSet rscs)
the user picked 2 resources to discover |
void |
endTurn(SOCGame ga)
the user is done with the turn |
java.lang.String |
getNickname()
|
protected void |
handleBCASTTEXTMSG(SOCBCastTextMsg mes)
handle a broadcast text message |
protected void |
handleBOARDLAYOUT(SOCBoardLayout mes)
handle the "board layout" message |
static boolean |
handleBOARDLAYOUT2(java.util.Map<java.lang.String,SOCGame> games,
SOCBoardLayout2 mes)
handle the "board layout" message, new format |
static boolean |
handleBOARDSPECIALEDGE(java.util.Map<java.lang.String,SOCGame> games,
SOCBoardSpecialEdge mes)
Handle the "board special edge" message: Set or clear a special edge on the board. |
protected void |
handleCANCELBUILDREQUEST(SOCCancelBuildRequest mes)
handle the rare "cancel build request" message; usually not sent from server to client. |
protected void |
handleCHANGEFACE(SOCChangeFace mes)
handle the "change face" message |
protected void |
handleCHANNELS(SOCChannels mes)
handle the "list of channels" message |
protected void |
handleCHOOSEPLAYERREQUEST(SOCChoosePlayerRequest mes)
handle the "choose player request" message |
protected void |
handleCLEAROFFER(SOCClearOffer mes)
handle the "clear offer" message |
protected void |
handleCLEARTRADEMSG(SOCClearTradeMsg mes)
handle the "clear trade message" message |
protected void |
handleDELETECHANNEL(SOCDeleteChannel mes)
handle the "delete channel" message |
protected void |
handleDELETEGAME(SOCDeleteGame mes)
handle the "delete game" message |
protected void |
handleDEVCARDACTION(boolean isPractice,
SOCDevCardAction mes)
handle the "development card action" message |
protected void |
handleDEVCARDCOUNT(SOCDevCardCount mes)
handle the "number of development cards" message |
protected void |
handleDICERESULT(SOCDiceResult mes)
handle the "dice result" message |
protected void |
handleDICERESULTRESOURCES(SOCDiceResultResources mes)
Handle all players' dice roll result resources. |
protected static void |
handleDICERESULTRESOURCES(SOCDiceResultResources mes,
SOCGame ga)
Handle all players' dice roll result resources: static version to share with SOCPlayerClient. |
protected void |
handleDISCARDREQUEST(SOCDiscardRequest mes)
handle the "discard request" message |
protected void |
handleFIRSTPLAYER(SOCFirstPlayer mes)
handle the "first player" message |
protected void |
handleGAMEMEMBERS(SOCGameMembers mes)
handle the "game members" message |
protected void |
handleGAMES(SOCGames mes)
handle the "list of games" message |
protected void |
handleGAMESERVERTEXT(SOCGameServerText mes)
handle the "game server text" message; stub for now |
protected void |
handleGAMESTATE(SOCGameState mes)
handle the "game state" message |
protected void |
handleGAMESTATS(SOCGameStats mes)
handle the "game stats" message |
protected void |
handleGAMETEXTMSG(SOCGameTextMsg mes)
handle the "game text message" message |
static boolean |
handleINVENTORYITEMACTION(java.util.Hashtable<java.lang.String,SOCGame> games,
SOCInventoryItemAction mes)
Handle the "inventory item action" message by updating player inventory. |
protected void |
handleJOIN(SOCJoin mes)
handle the "join channel" message |
protected void |
handleJOINAUTH(SOCJoinAuth mes)
handle the "join authorization" message |
protected void |
handleJOINGAME(SOCJoinGame mes)
handle the "join game" message |
protected void |
handleJOINGAMEAUTH(SOCJoinGameAuth mes,
boolean isPractice)
handle the "join game authorization" message |
protected void |
handleLARGESTARMY(SOCLargestArmy mes)
handle the "largest army" message |
protected void |
handleLEAVE(SOCLeave mes)
handle the "leave channel" message |
protected void |
handleLEAVEGAME(SOCLeaveGame mes)
handle the "leave game" message |
protected void |
handleLONGESTROAD(SOCLongestRoad mes)
handle the "longest road" message |
protected void |
handleMAKEOFFER(SOCMakeOffer mes)
handle the "make offer" message |
protected void |
handleMEMBERS(SOCMembers mes)
handle the "members" message |
protected void |
handleMOVEPIECE(SOCMovePiece mes)
Handle moving a piece (a ship) around on the board. |
protected void |
handleMOVEROBBER(SOCMoveRobber mes)
handle the "robber moved" or "pirate moved" message. |
protected void |
handleNEWCHANNEL(SOCNewChannel mes)
handle the "new channel" message |
protected void |
handleNEWGAME(SOCNewGame mes)
handle the "new game" message |
protected void |
handlePIECEVALUE(SOCPieceValue mes)
Update a village piece's value on the board (cloth remaining) in _SC_CLVI, or a pirate fortress's strength in _SC_PIRI. |
static void |
handlePLAYERELEMENT_numKnights(SOCPlayerElement mes,
SOCPlayer pl,
SOCGame ga)
Update a player's amount of knights, and game's largest army, for handlePLAYERELEMENT(SOCPlayerElement) . |
static void |
handlePLAYERELEMENT_numPieces(SOCPlayerElement mes,
SOCPlayer pl,
int pieceType)
Update a player's amount of a playing piece, for handlePLAYERELEMENT(SOCPlayerElement) . |
static void |
handlePLAYERELEMENT_numRsrc(SOCPlayerElement mes,
SOCPlayer pl,
int rtype)
Update a player's amount of a resource, for handlePLAYERELEMENT(SOCPlayerElement) . |
static void |
handlePLAYERELEMENT_simple(SOCPlayerElement mes,
SOCGame ga,
SOCPlayer pl,
int pn)
Update game data for a simple player element or flag, for handlePLAYERELEMENT(SOCPlayerElement) . |
protected void |
handlePLAYERELEMENT(SOCPlayerElement mes)
handle the "player information" message |
static void |
handlePOTENTIALSETTLEMENTS(SOCPotentialSettlements mes,
java.util.Hashtable<java.lang.String,SOCGame> games)
handle the "list of potential settlements" message |
static void |
handlePUTPIECE(SOCPutPiece mes,
SOCGame ga)
handle the "put piece" message |
protected void |
handleREJECTCONNECTION(SOCRejectConnection mes)
handle the "reject connection" message |
protected void |
handleREJECTOFFER(SOCRejectOffer mes)
handle the "reject offer" message |
protected void |
handleREMOVEPIECE(SOCRemovePiece mes)
A player's piece (a ship) has been removed from the board. |
protected void |
handleRESETBOARDAUTH(SOCResetBoardAuth mes)
handle board reset (new game with same players, same game name, new layout). |
protected void |
handleRESOURCECOUNT(SOCResourceCount mes)
handle "resource count" message |
protected void |
handleREVEALFOGHEX(SOCRevealFogHex mes)
Reveal a hidden hex on the board. |
protected void |
handleSETPLAYEDDEVCARD(SOCSetPlayedDevCard mes)
handle the "set played dev card flag" message |
protected void |
handleSETSEATLOCK(SOCSetSeatLock mes)
handle the "set seat lock" message |
protected static void |
handleSETSPECIALITEM(java.util.Map<java.lang.String,SOCGame> games,
SOCSetSpecialItem mes)
Handle the "set special item" message. |
protected void |
handleSETTURN(SOCSetTurn mes)
handle the "set turn" message |
static void |
handleSIMPLEACTION(java.util.Map<java.lang.String,SOCGame> games,
SOCSimpleAction mes)
Update any game data from "simple action" announcements from the server. |
static void |
handleSIMPLEREQUEST(java.util.Map<java.lang.String,SOCGame> games,
SOCSimpleRequest mes)
Update any game data from "simple request" announcements from the server. |
protected void |
handleSITDOWN(SOCSitDown mes)
handle the "player sitting down" message |
protected static void |
handleSTARTGAME(java.util.Hashtable<java.lang.String,SOCGame> games,
SOCStartGame mes)
handle the "start game" message |
protected void |
handleSTATUSMESSAGE(SOCStatusMessage mes)
handle the "status message" message |
protected void |
handleTEXTMSG(SOCTextMsg mes)
handle a text message |
protected void |
handleTURN(SOCTurn mes)
handle the "turn" message |
private void |
handleVERSION(boolean isLocal,
SOCVersion mes)
Handle the "version" message, server's version report. |
void |
leaveChannel(java.lang.String ch)
the user leaves the given channel |
void |
leaveGame(SOCGame ga)
the user leaves the given game |
static void |
main(java.lang.String[] args)
for stand-alones |
void |
monopolyPick(SOCGame ga,
int res)
the user picked a resource to monopolize |
void |
moveRobber(SOCGame ga,
SOCPlayer pl,
int coord)
the player wants to move the robber |
void |
offerTrade(SOCGame ga,
SOCTradeOffer offer)
the user is making an offer to trade with another player. |
void |
pickFreeResources(SOCGame ga,
SOCResourceSet rs)
The user wants to pick these resources to gain from the gold hex. |
void |
pickSpecialItem(SOCGame ga,
java.lang.String typeKey,
int gi,
int pi)
Send a request to pick a Special Item , using a
SOCSetSpecialItem (PICK, typeKey, gi, pi, owner=-1, coord=-1, level=0) message. |
void |
playDevCard(SOCGame ga,
int dc)
the user wants to play a development card |
boolean |
put(java.lang.String s)
write a message to the net |
void |
putPiece(SOCGame ga,
SOCPlayingPiece pp)
put a piece on the board |
void |
rejectOffer(SOCGame ga)
the user is rejecting the current offers |
void |
resend()
resend the last message |
void |
rollDice(SOCGame ga)
the user rolls the dice |
void |
run()
continuously read from the net in a separate thread |
void |
sendText(SOCGame ga,
java.lang.String me)
send a text message to the people in the game |
void |
setSeatLock(SOCGame ga,
int pn,
SOCGame.SeatLockState sl)
The user is locking or unlocking a seat. |
void |
simpleRequest(SOCGame ga,
int ourPN,
int reqType,
int value1,
int value2)
Send a SOCSimpleRequest to the server. |
void |
sitDown(SOCGame ga,
int pn)
the user sits down to play |
void |
startGame(SOCGame ga)
the user is starting the game |
void |
treat(SOCMessage mes)
Treat the incoming messages. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.lang.String STATSPREFEX
protected java.lang.String doc
protected java.lang.String lastMessage
protected java.lang.String host
protected int port
protected java.lang.String strSocketName
protected java.net.Socket s
protected java.io.DataInputStream in
protected java.io.DataOutputStream out
protected LocalStringConnection sLocal
protected int sVersion
sLocalVersion
should always equal our own version.
protected int sLocalVersion
sLocalVersion
should always equal our own version.
protected SOCServerFeatures sFeatures
sLocalFeatures
goes with our locally hosted server, if any.
protected SOCServerFeatures sLocalFeatures
sLocalFeatures
goes with our locally hosted server, if any.
protected java.lang.Thread reader
protected java.lang.Exception ex
protected boolean connected
protected boolean rejected
protected java.lang.String nickname
protected java.lang.String password
protected boolean gotPassword
protected java.util.Hashtable<java.lang.String,?> channels
protected java.util.Hashtable<java.lang.String,SOCGame> games
Constructor Detail |
---|
public SOCDisplaylessPlayerClient()
SOCRobotClient.init()
Note: The default JSettlers server port is 8880.
public SOCDisplaylessPlayerClient(java.lang.String h, int p, boolean visual)
SOCRobotClient.init()
h
- hostp
- portvisual
- true if this client is visualpublic SOCDisplaylessPlayerClient(java.lang.String s, boolean visual)
SOCRobotClient.init()
s
- the stringport that the server listens onvisual
- true if this client is visualMethod Detail |
---|
public java.lang.String getNickname()
public void run()
run
in interface java.lang.Runnable
public void resend()
public boolean put(java.lang.String s)
s
- the message
public void treat(SOCMessage mes)
SOCMessage.toMsg(String)
).
Note: Currently, SOCRobotClient.treat(mes) does not generally call this method. New messages should be added in both places if both displayless and robot should handle them. The robot treat's switch case can call super.treat before or after any robot-specific handling.
mes
- the messageprotected void handleSTATUSMESSAGE(SOCStatusMessage mes)
mes
- the messageprotected void handleJOINAUTH(SOCJoinAuth mes)
mes
- the messageprivate void handleVERSION(boolean isLocal, SOCVersion mes)
Because SOCDisplaylessPlayerClient is used only for the
robot, and the robot should always be the same version as
the server, don't ask server for info about
game option
deltas between
the two versions.
If somehow the server isn't our version, print an error and disconnect.
isLocal
- Is the server local, or remote? Client can be connected
only to local, or remote.mes
- the messageprotected void handleJOIN(SOCJoin mes)
mes
- the messageprotected void handleMEMBERS(SOCMembers mes)
mes
- the messageprotected void handleNEWCHANNEL(SOCNewChannel mes)
mes
- the messageprotected void handleCHANNELS(SOCChannels mes)
mes
- the messageprotected void handleBCASTTEXTMSG(SOCBCastTextMsg mes)
mes
- the messageprotected void handleTEXTMSG(SOCTextMsg mes)
mes
- the messageprotected void handleLEAVE(SOCLeave mes)
mes
- the messageprotected void handleDELETECHANNEL(SOCDeleteChannel mes)
mes
- the messageprotected void handleGAMES(SOCGames mes)
mes
- the messageprotected void handleJOINGAMEAUTH(SOCJoinGameAuth mes, boolean isPractice)
mes
- the messageisPractice
- Is the server local for practice, or remote?protected void handleJOINGAME(SOCJoinGame mes)
mes
- the messageprotected void handleLEAVEGAME(SOCLeaveGame mes)
mes
- the messageprotected void handleNEWGAME(SOCNewGame mes)
mes
- the messageprotected void handleDELETEGAME(SOCDeleteGame mes)
mes
- the messageprotected void handleGAMEMEMBERS(SOCGameMembers mes)
mes
- the messageprotected void handleGAMESTATS(SOCGameStats mes)
protected void handleGAMETEXTMSG(SOCGameTextMsg mes)
mes
- the messageprotected void handleGAMESERVERTEXT(SOCGameServerText mes)
mes
- the messageprotected void handleDICERESULTRESOURCES(SOCDiceResultResources mes)
handleDICERESULTRESOURCES(SOCDiceResultResources, SOCGame)
so the players gain resources.
protected static void handleDICERESULTRESOURCES(SOCDiceResultResources mes, SOCGame ga)
protected void handleSITDOWN(SOCSitDown mes)
mes
- the messageprotected void handleBOARDLAYOUT(SOCBoardLayout mes)
mes
- the messagepublic static boolean handleBOARDLAYOUT2(java.util.Map<java.lang.String,SOCGame> games, SOCBoardLayout2 mes)
games
- Games the client is playing, for method reuse by SOCPlayerClientmes
- the message
protected static void handleSTARTGAME(java.util.Hashtable<java.lang.String,SOCGame> games, SOCStartGame mes)
games
- The hashtable of client's SOCGame
s; key = game namemes
- the messageprotected void handleGAMESTATE(SOCGameState mes)
mes
- the messageprotected void handleSETTURN(SOCSetTurn mes)
mes
- the messageprotected void handleFIRSTPLAYER(SOCFirstPlayer mes)
mes
- the messageprotected void handleTURN(SOCTurn mes)
mes
- the messageprotected void handlePLAYERELEMENT(SOCPlayerElement mes)
mes
- the messagepublic static void handlePLAYERELEMENT_simple(SOCPlayerElement mes, SOCGame ga, SOCPlayer pl, int pn)
handlePLAYERELEMENT(SOCPlayerElement)
.
Handles ASK_SPECIAL_BUILD, NUM_PICK_GOLD_HEX_RESOURCES, SCENARIO_CLOTH_COUNT, etc.
To avoid code duplication, also called from
SOCPlayerClient.MessageTreater.handlePLAYERELEMENT(SOCPlayerElement)
and SOCRobotBrain.run()
.
mes
- Message with amount and action (SET/GAIN/LOSE)ga
- Game to updatepl
- Player to updatepn
- Player number from message (sometimes -1 for none)public static void handlePLAYERELEMENT_numPieces(SOCPlayerElement mes, SOCPlayer pl, int pieceType)
handlePLAYERELEMENT(SOCPlayerElement)
.
To avoid code duplication, also called from
SOCPlayerClient.MessageTreater.handlePLAYERELEMENT(SOCPlayerElement)
and SOCRobotBrain.run()
.
mes
- Message with amount and action (SET/GAIN/LOSE)pl
- Player to updatepieceType
- Playing piece type, as in SOCPlayingPiece.ROAD
public static void handlePLAYERELEMENT_numKnights(SOCPlayerElement mes, SOCPlayer pl, SOCGame ga)
handlePLAYERELEMENT(SOCPlayerElement)
.
To avoid code duplication, also called from
SOCPlayerClient.MessageTreater.handlePLAYERELEMENT(SOCPlayerElement)
and SOCRobotBrain.run()
.
mes
- Message with amount and action (SET/GAIN/LOSE)pl
- Player to updatega
- Game of playerpublic static void handlePLAYERELEMENT_numRsrc(SOCPlayerElement mes, SOCPlayer pl, int rtype)
handlePLAYERELEMENT(SOCPlayerElement)
.
SOCPlayerElement.LOSE
action, and the player does not have enough of that type,
the rest are taken from the player's UNKNOWN amount.
To avoid code duplication, also called from
SOCPlayerClient.MessageTreater.handlePLAYERELEMENT(SOCPlayerElement)
and SOCRobotBrain.run()
.
mes
- Message with amount and action (SET/GAIN/LOSE)pl
- Player to updatertype
- Type of resource, like SOCResourceConstants.CLAY
protected void handleRESOURCECOUNT(SOCResourceCount mes)
mes
- the messageprotected void handleDICERESULT(SOCDiceResult mes)
mes
- the messagepublic static void handlePUTPIECE(SOCPutPiece mes, SOCGame ga)
This method is public static for access by
SOCRobotBrain.handlePUTPIECE_updateGameData(SOCPutPiece)
.
mes
- the messagega
- Message's game from SOCPutPiece.getGame()
; if null
, message is ignoredprotected void handleCANCELBUILDREQUEST(SOCCancelBuildRequest mes)
- When sent from client to server, CANCELBUILDREQUEST means the player has changed their mind about spending resources to build a piece. Only allowed during normal game play (PLACING_ROAD, PLACING_SETTLEMENT, or PLACING_CITY).
When sent from server to client:
- During game startup (START1B or START2B):
Sent from server, CANCELBUILDREQUEST means the current player
wants to undo the placement of their initial settlement.
- During piece placement (PLACING_ROAD, PLACING_CITY, PLACING_SETTLEMENT, PLACING_FREE_ROAD1 or PLACING_FREE_ROAD2):
Sent from server, CANCELBUILDREQUEST means the player has sent an illegal PUTPIECE (bad building location). Humans can probably decide a better place to put their road, but robots must cancel the build request and decide on a new plan.
Our client can ignore this case, because the server also sends a text message that the human player is capable of reading and acting on.
mes
- the messageprotected void handleMOVEROBBER(SOCMoveRobber mes)
mes
- the messageprotected void handleDISCARDREQUEST(SOCDiscardRequest mes)
mes
- the messageprotected void handleCHOOSEPLAYERREQUEST(SOCChoosePlayerRequest mes)
mes
- the messageprotected void handleMAKEOFFER(SOCMakeOffer mes)
mes
- the messageprotected void handleCLEAROFFER(SOCClearOffer mes)
mes
- the messageprotected void handleREJECTOFFER(SOCRejectOffer mes)
mes
- the messageprotected void handleCLEARTRADEMSG(SOCClearTradeMsg mes)
mes
- the messageprotected void handleDEVCARDCOUNT(SOCDevCardCount mes)
mes
- the messageprotected void handleDEVCARDACTION(boolean isPractice, SOCDevCardAction mes)
isPractice
- Is the server local, or remote? Client can be connected
only to local, or remote.mes
- the messageprotected void handleSETPLAYEDDEVCARD(SOCSetPlayedDevCard mes)
mes
- the messagepublic static boolean handleINVENTORYITEMACTION(java.util.Hashtable<java.lang.String,SOCGame> games, SOCInventoryItemAction mes)
games
- The hashtable of client's SOCGame
s; key = game namemes
- the message
public static void handlePOTENTIALSETTLEMENTS(SOCPotentialSettlements mes, java.util.Hashtable<java.lang.String,SOCGame> games) throws java.lang.IllegalStateException
mes
- the messagegames
- The hashtable of client's SOCGame
s; key = game name
java.lang.IllegalStateException
- if the board has
SOCBoardLarge.getAddedLayoutPart("AL")
!= null
but
badly formed (node list number 0, or a node list number not followed by a land area number).
This Added Layout Part is rarely used, and this would be discovered quickly while testing
the board layout that contained it.protected void handleCHANGEFACE(SOCChangeFace mes)
mes
- the messageprotected void handleREJECTCONNECTION(SOCRejectConnection mes)
mes
- the messageprotected void handleLONGESTROAD(SOCLongestRoad mes)
mes
- the messageprotected void handleLARGESTARMY(SOCLargestArmy mes)
mes
- the messageprotected void handleSETSEATLOCK(SOCSetSeatLock mes)
mes
- the messageprotected void handleRESETBOARDAUTH(SOCResetBoardAuth mes)
mes
- the messageSOCServer.resetBoardAndNotify(String, int)
,
SOCGame.resetAsCopy()
public static void handleSIMPLEREQUEST(java.util.Map<java.lang.String,SOCGame> games, SOCSimpleRequest mes)
TRADE_PORT_PLACE
:
Calls SOCGame.placePort(SOCPlayer, int, int)
if pn
>= 0
games
- Games the client is playing, for method reuse by SOCPlayerClientmes
- the messagepublic static void handleSIMPLEACTION(java.util.Map<java.lang.String,SOCGame> games, SOCSimpleAction mes)
games
- Games the client is playing, for method reuse by SOCPlayerClientmes
- the messageprotected void handleMOVEPIECE(SOCMovePiece mes)
protected void handleREMOVEPIECE(SOCRemovePiece mes)
Currently, only ships can be removed, in game scenario _SC_PIRI
.
Other pieceType
s are ignored.
protected void handleREVEALFOGHEX(SOCRevealFogHex mes)
protected void handlePIECEVALUE(SOCPieceValue mes)
public static final boolean handleBOARDSPECIALEDGE(java.util.Map<java.lang.String,SOCGame> games, SOCBoardSpecialEdge mes)
games
- Games the client is playing, for method reuse by SOCPlayerClientmes
- the message
SOCBoardLarge
.protected static void handleSETSPECIALITEM(java.util.Map<java.lang.String,SOCGame> games, SOCSetSpecialItem mes)
OP_SET
and OP_CLEAR
and ignores other operations, such as OP_PICK
. If your client needs to react
to those other operations, override this method.
games
- Games the client is playing, for method reuse by SOCPlayerClientmes
- the messagepublic void chSend(java.lang.String ch, java.lang.String mes)
ch
- the name of the channelmes
- the messagepublic void leaveChannel(java.lang.String ch)
ch
- the name of the channelprotected void disconnect()
public void buyDevCard(SOCGame ga)
ga
- the gamepublic void buildRequest(SOCGame ga, int piece)
ga
- the gamepiece
- the type of piece, from SOCPlayingPiece
constants,
or -1 to request the Special Building Phase.public void cancelBuildRequest(SOCGame ga, int piece)
ga
- the gamepiece
- the type of piece from SOCPlayingPiecepublic void putPiece(SOCGame ga, SOCPlayingPiece pp)
ga
- the game where the action is taking placepp
- the piece being placedpublic void moveRobber(SOCGame ga, SOCPlayer pl, int coord)
ga
- the gamepl
- the playercoord
- where the player wants the robberpublic void simpleRequest(SOCGame ga, int ourPN, int reqType, int value1, int value2)
SOCSimpleRequest
to the server.
reqType
gives the request type, and the optional
value1
and value2
depend on request type.
ga
- the gameourPN
- our player's player numberreqType
- Request type, such as SOCSimpleRequest.SC_PIRI_FORT_ATTACK
.
See SOCSimpleRequest
public int fields for possible types and their meanings.value1
- First optional detail value, or 0value2
- Second optional detail value, or 0public void pickSpecialItem(SOCGame ga, java.lang.String typeKey, int gi, int pi)
Special Item
, using a
SOCSetSpecialItem
(PICK, typeKey, gi, pi, owner=-1, coord=-1, level=0)
message.
ga
- GametypeKey
- Special item type. Typically a SOCGameOption
keyname; see the SOCSpecialItem
class javadoc for details.gi
- Game Item Index, as in SOCGame.getSpecialItem(String, int)
or
SOCSpecialItem.playerPickItem(String, SOCGame, SOCPlayer, int, int)
, or -1pi
- Player Item Index, as in SOCSpecialItem.playerPickItem(String, SOCGame, SOCPlayer, int, int)
,
or -1public void sendText(SOCGame ga, java.lang.String me)
ga
- the gameme
- the messagepublic void leaveGame(SOCGame ga)
ga
- the gamepublic void sitDown(SOCGame ga, int pn)
ga
- the gamepn
- the number of the seat where the user wants to sitpublic void startGame(SOCGame ga)
ga
- the gamepublic void rollDice(SOCGame ga)
ga
- the gamepublic void endTurn(SOCGame ga)
ga
- the gamepublic void discard(SOCGame ga, SOCResourceSet rs)
ga
- the gamers
- Resources to discardpublic void pickFreeResources(SOCGame ga, SOCResourceSet rs)
ga
- the gamers
- Resources to gainpublic void choosePlayer(SOCGame ga, int ch)
SOCGame.WAITING_FOR_ROBBER_OR_PIRATE
)
chose whether to move the robber or the pirate,
or (game state SOCGame.WAITING_FOR_ROB_CLOTH_OR_RESOURCE
)
chose whether to steal a resource or cloth.
ga
- the gamech
- the player number,
or SOCChoosePlayer.CHOICE_MOVE_ROBBER
to move the robber
or SOCChoosePlayer.CHOICE_MOVE_PIRATE
to move the pirate ship.
See SOCChoosePlayer.SOCChoosePlayer(String, int)
for meaning
of ch for game state WAITING_FOR_ROB_CLOTH_OR_RESOURCE.public void rejectOffer(SOCGame ga)
ga
- the gamepublic void acceptOffer(SOCGame ga, int from)
ga
- the gamefrom
- the number of the player that is making the offerpublic void clearOffer(SOCGame ga)
ga
- the gamepublic void bankTrade(SOCGame ga, SOCResourceSet give, SOCResourceSet get)
ga
- the gamegive
- what is being offeredget
- what the player wantspublic void offerTrade(SOCGame ga, SOCTradeOffer offer)
ga
- the gameoffer
- the trade offerpublic void playDevCard(SOCGame ga, int dc)
ga
- the gamedc
- the type of development cardpublic void discoveryPick(SOCGame ga, SOCResourceSet rscs)
ga
- the gamerscs
- the resourcespublic void monopolyPick(SOCGame ga, int res)
ga
- the gameres
- the resourcepublic void changeFace(SOCGame ga, int id)
ga
- the gameid
- the image idpublic void setSeatLock(SOCGame ga, int pn, SOCGame.SeatLockState sl)
ga
- the gamepn
- the seat numbersl
- new seat lock state; remember that servers older than v2.0.00 won't recognize CLEAR_ON_RESET
public void destroy()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |