Package net.sf.colossus.server
Class ClientHandlerStub
java.lang.Object
net.sf.colossus.server.ClientHandlerStub
- All Implemented Interfaces:
IClient
- Direct Known Subclasses:
ClientHandler
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCreature
(Legion legion, CreatureType creature, String reason) void
appendToConnectionLog
(String message) void
askAcquireAngel
(Legion legion, List<CreatureType> recruits) void
askChooseStrikePenalty
(List<String> choices) void
askConcede
(Legion ally, Legion enemy) void
void
askNegotiate
(Legion attacker, Legion defender) void
askPickColor
(List<PlayerColor> colorsLeft) void
boolean
protected boolean
void
protected void
void
void
createSummonAngel
(Legion legion) void
didMove
(Legion legion, MasterHex startingHex, MasterHex currentHex, EntrySide entrySide, boolean teleport, CreatureType teleportingLord, boolean splitLegionHasForcedMove) void
didRecruit
(Legion legion, CreatureType recruit, CreatureType recruiter, int numRecruiters) void
didSplit
(MasterHex hex, Legion parent, Legion child, int childHeight, List<CreatureType> splitoffs, int turn) void
didSummon
(Legion summoner, Legion donor, CreatureType summon) void
Server side disposes a client (and informs it about it first) To be used only for "disposeAllClients()", otherwise setIsGone reason is misleading.void
doReinforce
(Legion legion) protected void
enqueueToRedoQueue
(int messageNr, String message) protected void
Selector reported that client became writable again (after a prior write attempt had not written all bytes).void
initBattle
(MasterHex hex, int battleTurnNumber, Player battleActivePlayer, BattlePhase battlePhase, Legion attacker, Legion defender) void
protected boolean
isStub()
void
void
void
messageFromServer
(String message) void
void
void
void
placeNewChit
(String imageName, boolean inverted, int tag, BattleHex hex) void
removeCreature
(Legion legion, CreatureType creature, String reason) void
void
removeLegion
(Legion legion) void
revealCreatures
(Legion legion, List<CreatureType> creatures, String reason) void
revealEngagedCreatures
(Legion legion, List<CreatureType> creatures, boolean isAttacker, String reason) print the 'revealEngagagedCreature'-message, args: markerId, isAttacker, list of creature namesprotected void
sendToClient
(String message) void
void
setBoardActive
(boolean val) void
setColor
(PlayerColor color) void
void
setLegionStatus
(Legion legion, boolean moved, boolean teleported, EntrySide entrySide, CreatureType lastRecruit) void
setPlayerName
(String playerName) void
setupBattleFight
(BattlePhase battlePhase, Player battleActivePlayer) void
setupBattleMove
(Player battleActivePlayer, int battleTurnNumber) void
setupBattleRecruit
(Player battleActivePlayer, int battleTurnNumber) void
setupBattleSummon
(Player battleActivePlayer, int battleTurnNumber) void
void
void
void
setupSplit
(Player activePlayer, int turnNumber) void
setupTurnState
(Player activePlayer, int turnNumber) protected boolean
void
syncOption
(String optname, String value) void
tellBattleMove
(int tag, BattleHex startingHex, BattleHex endingHex, boolean undo) void
tellEngagement
(MasterHex hex, Legion attacker, Legion defender) void
tellEngagementResults
(Legion winner, String method, int points, int turns) void
tellGameOver
(String message, boolean disposeFollows) void
tellInitialGameInfo
(String variantName, Collection<String> playerNames) void
tellLegionLocation
(Legion legion, MasterHex hex) void
tellMovementRoll
(int roll) void
tellPlayerElim
(Player player, Player slayer) void
tellProposal
(String proposalString) void
tellRedo
(boolean val) void
tellReplay
(boolean val, int maxTurn) void
tellSlowResults
(int targetTag, int slowValue) void
tellStrikeResults
(int strikerTag, int targetTag, int strikeNumber, List<String> rolls, int damage, boolean killed, boolean wasCarry, int carryDamageLeft, Set<String> carryTargetDescriptions) void
tellSyncCompleted
(int syncRequestNumber) void
tellWhatsHappening
(String message) void
undidMove
(Legion legion, MasterHex formerHex, MasterHex currentHex, boolean splitLegionHasForcedMove) void
undidRecruit
(Legion legion, CreatureType recruit) void
undidSplit
(Legion splitoff, Legion survivor, int turn) void
updateCreatureCount
(CreatureType type, int count, int deadCount) void
updateOnePlayersInfo
(boolean redundant, String reason, String ShouldBeSeveralSeparateVariablesHerePerhaps) A new way to pass changed player info to clients.void
updatePlayerInfo
(List<String> infoStrings)
-
Field Details
-
LOGGER
-
sep
- See Also:
-
server
-
counter
protected static int counter -
isGone
protected boolean isGone -
playerName
-
signonName
-
messageCounter
protected int messageCounter -
isCommitPoint
protected boolean isCommitPoint -
redoQueue
-
previousInfoStringsString
-
alreadyHandled
private int alreadyHandled
-
-
Constructor Details
-
ClientHandlerStub
-
-
Method Details
-
isStub
protected boolean isStub() -
canHandlePingRequest
protected boolean canHandlePingRequest() -
canHandleAdvancedSync
public boolean canHandleAdvancedSync() -
supportsReconnect
protected boolean supportsReconnect() -
setIsGone
-
sendToClient
-
flushQueuedContent
protected void flushQueuedContent()Selector reported that client became writable again (after a prior write attempt had not written all bytes). Now start/try writing the message(s) which are still in the queue. -
enqueueToRedoQueue
-
commitPoint
protected void commitPoint() -
disposeClient
public void disposeClient()Server side disposes a client (and informs it about it first) To be used only for "disposeAllClients()", otherwise setIsGone reason is misleading.- Specified by:
disposeClient
in interfaceIClient
-
tellEngagement
- Specified by:
tellEngagement
in interfaceIClient
-
tellEngagementResults
- Specified by:
tellEngagementResults
in interfaceIClient
-
tellWhatsHappening
- Specified by:
tellWhatsHappening
in interfaceIClient
-
tellMovementRoll
public void tellMovementRoll(int roll) - Specified by:
tellMovementRoll
in interfaceIClient
-
syncOption
- Specified by:
syncOption
in interfaceIClient
-
updatePlayerInfo
- Specified by:
updatePlayerInfo
in interfaceIClient
-
updateOnePlayersInfo
public void updateOnePlayersInfo(boolean redundant, String reason, String ShouldBeSeveralSeparateVariablesHerePerhaps) A new way to pass changed player info to clients. Shortened info (e.g. color, dead state, ...) not sent every time; Includes a reason why sent (mostly used internally on server side for debugging/development purposes), and a flag whether this info should be redundant; idea behind it: on the long run, clients should be able to update game/player info "autonomously" (same logic implemented on client as on server) instead of server doing it and synching to all clients. So this redundant is meant to be used as safety net to detect where that new approach might miss something.- Specified by:
updateOnePlayersInfo
in interfaceIClient
-
setColor
-
updateCreatureCount
- Specified by:
updateCreatureCount
in interfaceIClient
-
removeLegion
- Specified by:
removeLegion
in interfaceIClient
-
setLegionStatus
public void setLegionStatus(Legion legion, boolean moved, boolean teleported, EntrySide entrySide, CreatureType lastRecruit) - Specified by:
setLegionStatus
in interfaceIClient
-
addCreature
- Specified by:
addCreature
in interfaceIClient
-
removeCreature
- Specified by:
removeCreature
in interfaceIClient
-
revealCreatures
- Specified by:
revealCreatures
in interfaceIClient
-
revealEngagedCreatures
public void revealEngagedCreatures(Legion legion, List<CreatureType> creatures, boolean isAttacker, String reason) print the 'revealEngagagedCreature'-message, args: markerId, isAttacker, list of creature names- Specified by:
revealEngagedCreatures
in interfaceIClient
- Parameters:
creatures
- List of creatures in this legionisAttacker
- true for attacker, false for defenderreason
- why this was revealedmarkerId
- legion marker name that is currently in battle
-
removeDeadBattleChits
public void removeDeadBattleChits()- Specified by:
removeDeadBattleChits
in interfaceIClient
-
placeNewChit
- Specified by:
placeNewChit
in interfaceIClient
-
tellReplay
public void tellReplay(boolean val, int maxTurn) - Specified by:
tellReplay
in interfaceIClient
-
tellRedo
public void tellRedo(boolean val) -
initBoard
public void initBoard() -
setPlayerName
- Specified by:
setPlayerName
in interfaceIClient
-
getSignonName
-
getClientName
-
getPlayerName
-
createSummonAngel
- Specified by:
createSummonAngel
in interfaceIClient
-
askAcquireAngel
- Specified by:
askAcquireAngel
in interfaceIClient
-
askChooseStrikePenalty
- Specified by:
askChooseStrikePenalty
in interfaceIClient
-
tellGameOver
- Specified by:
tellGameOver
in interfaceIClient
-
tellPlayerElim
- Specified by:
tellPlayerElim
in interfaceIClient
-
askConcede
- Specified by:
askConcede
in interfaceIClient
-
askFlee
-
askNegotiate
- Specified by:
askNegotiate
in interfaceIClient
-
tellProposal
- Specified by:
tellProposal
in interfaceIClient
-
tellSlowResults
public void tellSlowResults(int targetTag, int slowValue) - Specified by:
tellSlowResults
in interfaceIClient
-
tellStrikeResults
public void tellStrikeResults(int strikerTag, int targetTag, int strikeNumber, List<String> rolls, int damage, boolean killed, boolean wasCarry, int carryDamageLeft, Set<String> carryTargetDescriptions) - Specified by:
tellStrikeResults
in interfaceIClient
-
initBattle
public void initBattle(MasterHex hex, int battleTurnNumber, Player battleActivePlayer, BattlePhase battlePhase, Legion attacker, Legion defender) - Specified by:
initBattle
in interfaceIClient
-
cleanupBattle
public void cleanupBattle()- Specified by:
cleanupBattle
in interfaceIClient
-
nextEngagement
public void nextEngagement()- Specified by:
nextEngagement
in interfaceIClient
-
doReinforce
- Specified by:
doReinforce
in interfaceIClient
-
didRecruit
public void didRecruit(Legion legion, CreatureType recruit, CreatureType recruiter, int numRecruiters) - Specified by:
didRecruit
in interfaceIClient
-
undidRecruit
- Specified by:
undidRecruit
in interfaceIClient
-
setupTurnState
- Specified by:
setupTurnState
in interfaceIClient
-
setupSplit
- Specified by:
setupSplit
in interfaceIClient
-
setupMove
public void setupMove() -
setupFight
public void setupFight()- Specified by:
setupFight
in interfaceIClient
-
setupMuster
public void setupMuster()- Specified by:
setupMuster
in interfaceIClient
-
kickPhase
public void kickPhase() -
setupBattleSummon
- Specified by:
setupBattleSummon
in interfaceIClient
-
setupBattleRecruit
- Specified by:
setupBattleRecruit
in interfaceIClient
-
setupBattleMove
- Specified by:
setupBattleMove
in interfaceIClient
-
setupBattleFight
- Specified by:
setupBattleFight
in interfaceIClient
-
tellLegionLocation
- Specified by:
tellLegionLocation
in interfaceIClient
-
tellBattleMove
- Specified by:
tellBattleMove
in interfaceIClient
-
didMove
public void didMove(Legion legion, MasterHex startingHex, MasterHex currentHex, EntrySide entrySide, boolean teleport, CreatureType teleportingLord, boolean splitLegionHasForcedMove) -
undidMove
-
didSummon
-
undidSplit
- Specified by:
undidSplit
in interfaceIClient
-
didSplit
public void didSplit(MasterHex hex, Legion parent, Legion child, int childHeight, List<CreatureType> splitoffs, int turn) -
askPickColor
- Specified by:
askPickColor
in interfaceIClient
-
askPickFirstMarker
public void askPickFirstMarker()- Specified by:
askPickFirstMarker
in interfaceIClient
-
log
-
nak
-
setBoardActive
public void setBoardActive(boolean val) - Specified by:
setBoardActive
in interfaceIClient
-
tellInitialGameInfo
-
confirmWhenCaughtUp
public void confirmWhenCaughtUp()- Specified by:
confirmWhenCaughtUp
in interfaceIClient
-
serverConfirmsConnection
public void serverConfirmsConnection()- Specified by:
serverConfirmsConnection
in interfaceIClient
-
pingRequest
public void pingRequest()- Specified by:
pingRequest
in interfaceIClient
-
messageFromServer
- Specified by:
messageFromServer
in interfaceIClient
-
appendToConnectionLog
- Specified by:
appendToConnectionLog
in interfaceIClient
-
tellSyncCompleted
public void tellSyncCompleted(int syncRequestNumber) - Specified by:
tellSyncCompleted
in interfaceIClient
-