Class GameClient
java.lang.Object
it.polimi.ingsw.communication.sugar_framework.message_processing.SugarMessageProcessor
it.polimi.ingsw.client.game_client_and_cli.GameClient
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Patternbooleanprivate Stringprivate static final Patternprivate final GameLoggerprivate static final Patternprivate final SugarClient -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanarePresent(Optional<?>... args) voidbase(SugarMessage message) voidvoidchatMsg(SugarMessage message) voidendTurn()voidexecuteCommand(CLICommand command, Map<String, String> params) extractAndParseParameters(String input) private StringextractCommand(String input) voidGameOverMsg(GameOverMsg message) voidgamesUpdateMsg(GamesUpdateMsg message) intgetCharacterIndexFromId(int id) voidgrabStudentsFromCloud(int cloudIndex) voidhelp()voidjoinMatchMaking(int numberOfPlayers, boolean expertMode) voidvoidvoidvoidmoveMotherNature(int numberOfSteps) voidmoveMotherNatureToDest(int archipelagoId) voidmoveStudentFromEntranceToArchipelago(String student, int archipelagoIslandCode) voidvoidprivate Optional<CLICommand>parseCommand(String command) voidvoidpeerUPIMessage(SugarMessage message) voidplayCard(int cardValue) voidplayChar(int characterId) voidplayChar(int characterId, int archipelago) voidvoidvoidprivate voidPlays the character of the expert modevoidvoidrollback()voidrun()private voidsend(SugarMessage message) private voidsendAndHandleDisconnection(SugarMessage message) voidsendChatMessage(@NotNull String to, @NotNull String message) voidvoidupdateClientMsg(UpdateClientMsg message) Methods inherited from class it.polimi.ingsw.communication.sugar_framework.message_processing.SugarMessageProcessor
drop, process, process, processFromLowerLayers
-
Field Details
-
sugarClient
-
logger
-
jwt
-
username
-
currentlyPlaying
public boolean currentlyPlaying -
command
-
parameter
-
keyValue
-
lastSnapshot
-
-
Constructor Details
-
GameClient
public GameClient()
-
-
Method Details
-
run
public void run() -
send
- Throws:
DisconnectionException
-
signUp
-
login
-
joinMatchMaking
public void joinMatchMaking(int numberOfPlayers, boolean expertMode) -
playCard
public void playCard(int cardValue) -
moveStudentFromEntranceToDiningRoom
-
moveStudentFromEntranceToArchipelago
-
moveMotherNature
public void moveMotherNature(int numberOfSteps) -
moveMotherNatureToDest
public void moveMotherNatureToDest(int archipelagoId) -
grabStudentsFromCloud
public void grabStudentsFromCloud(int cloudIndex) -
endTurn
public void endTurn() -
help
public void help() -
characters
public void characters() -
sendAndHandleDisconnection
-
OKMsg
-
KOMsg
-
GameOverMsg
-
updateClientMsg
-
JWTMsg
-
peerUPIMessage
-
gamesUpdateMsg
-
base
-
parseLine
-
parseCommand
-
extractCommand
-
extractAndParseParameters
- Throws:
SyntaxError
-
arePresent
-
executeCommand
- Throws:
SyntaxError
-
chatMsg
-
sendChatMessage
-
rejoinMatch
public void rejoinMatch() -
rollback
public void rollback() -
playChar
Plays the character of the expert mode- Parameters:
parametersMap- maps of parameters that contains all the parameters and their values- Throws:
SyntaxError- if there is a problem with the data entered the CLI
-
playChar
public void playChar(int characterId) -
playChar
-
playChar
public void playChar(int characterId, int archipelago) -
playChar
-
playChar
-
getCharacterIndexFromId
public int getCharacterIndexFromId(int id) - Parameters:
id- character id- Returns:
- the position on the available characters list of the character with the given id, if not present -1 is returned
-