diplomacy.client.network_game¶
Game object used on client side.
-
class
diplomacy.client.network_game.
NetworkGame
(channel, received_game)[source]¶ Bases:
diplomacy.engine.game.Game
NetworkGame class.
Properties:
- channel: associated
diplomacy.client.channel.Channel
object. - notification_callbacks:
Dict
mapping a notification class name to a callback to be called when a corresponding game notification is received.
-
__init__
(channel, received_game)[source]¶ Initialize network game object with a channel and a game object sent by server.
Parameters: - channel (diplomacy.client.channel.Channel) – a Channel object.
- received_game (diplomacy.engine.game.Game) – a Game object.
-
get_phase_history
(**kwargs)¶ Send game request
GetPhaseHistory
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeGetPhaseHistory
about request parameters and response.
-
leave
(**kwargs)¶ Send game request
LeaveGame
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeLeaveGame
about request parameters and response.
-
send_game_message
(**kwargs)¶ Send game request
SendGameMessage
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeSendGameMessage
about request parameters and response.
-
set_orders
(**kwargs)¶ Send game request
SetOrders
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeSetOrders
about request parameters and response.
-
clear_centers
(**kwargs)¶ Send game request
ClearCenters
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeClearCenters
about request parameters and response.
-
clear_orders
(**kwargs)¶ Send game request
ClearOrders
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeClearOrders
about request parameters and response.
-
clear_units
(**kwargs)¶ Send game request
ClearUnits
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeClearUnits
about request parameters and response.
-
wait
(**kwargs)¶ Send game request
SetWaitFlag
with forced parameters(wait=True)
and additional request parameterskwargs
. SeeSetWaitFlag
about request parameters and response.
-
no_wait
(**kwargs)¶ Send game request
SetWaitFlag
with forced parameters(wait=False)
and additional request parameterskwargs
. SeeSetWaitFlag
about request parameters and response.
-
vote
(**kwargs)¶ Send game request
Vote
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeVote
about request parameters and response.
-
save
(**kwargs)¶ Send game request
SaveGame
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeSaveGame
about request parameters and response.
-
synchronize
()[source]¶ Send a
Synchronize
request to synchronize this game with associated server game.
-
delete
(**kwargs)¶ Send game request
DeleteGame
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeDeleteGame
about request parameters and response.
-
kick_powers
(**kwargs)¶ Send game request
SetDummyPowers
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeSetDummyPowers
about request parameters and response.
-
set_state
(**kwargs)¶ Send game request
SetGameState
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeSetGameState
about request parameters and response.
-
process
(**kwargs)¶ Send game request
ProcessGame
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeProcessGame
about request parameters and response.
-
query_schedule
(**kwargs)¶ Send game request
QuerySchedule
with forced parameters( with request parameters )
and additional request parameterskwargs
. SeeQuerySchedule
about request parameters and response.
-
start
(**kwargs)¶ Send game request
SetGameStatus
with forced parameters(status=active)
and additional request parameterskwargs
. SeeSetGameStatus
about request parameters and response.
-
pause
(**kwargs)¶ Send game request
SetGameStatus
with forced parameters(status=paused)
and additional request parameterskwargs
. SeeSetGameStatus
about request parameters and response.
-
resume
(**kwargs)¶ Send game request
SetGameStatus
with forced parameters(status=active)
and additional request parameterskwargs
. SeeSetGameStatus
about request parameters and response.
-
cancel
(**kwargs)¶ Send game request
SetGameStatus
with forced parameters(status=canceled)
and additional request parameterskwargs
. SeeSetGameStatus
about request parameters and response.
-
draw
(**kwargs)¶ Send game request
SetGameStatus
with forced parameters(status=completed)
and additional request parameterskwargs
. SeeSetGameStatus
about request parameters and response.
-
add_on_cleared_centers
(notification_callback)¶ Add callback for notification
ClearedCenters
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_cleared_orders
(notification_callback)¶ Add callback for notification
ClearedOrders
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_cleared_units
(notification_callback)¶ Add callback for notification
ClearedUnits
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_game_deleted
(notification_callback)¶ Add callback for notification
GameDeleted
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_game_message_received
(notification_callback)¶ Add callback for notification
GameMessageReceived
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_game_processed
(notification_callback)¶ Add callback for notification
GameProcessed
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_game_phase_update
(notification_callback)¶ Add callback for notification
GamePhaseUpdate
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_game_status_update
(notification_callback)¶ Add callback for notification
GameStatusUpdate
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_omniscient_updated
(notification_callback)¶ Add callback for notification
OmniscientUpdated
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_power_orders_flag
(notification_callback)¶ Add callback for notification
PowerOrdersFlag
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_power_orders_update
(notification_callback)¶ Add callback for notification
PowerOrdersUpdate
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_power_vote_updated
(notification_callback)¶ Add callback for notification
PowerVoteUpdated
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_power_wait_flag
(notification_callback)¶ Add callback for notification
PowerWaitFlag
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_powers_controllers
(notification_callback)¶ Add callback for notification
PowersControllers
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_vote_count_updated
(notification_callback)¶ Add callback for notification
VoteCountUpdated
. Callback signature:callback(network_game, notification) -> None
.
-
add_on_vote_updated
(notification_callback)¶ Add callback for notification
VoteUpdated
. Callback signature:callback(network_game, notification) -> None
.
-
clear_on_cleared_centers
()¶ Clear callbacks for notification
ClearedCenters
..
-
clear_on_cleared_orders
()¶ Clear callbacks for notification
ClearedOrders
..
-
clear_on_cleared_units
()¶ Clear callbacks for notification
ClearedUnits
..
-
clear_on_game_deleted
()¶ Clear callbacks for notification
GameDeleted
..
-
clear_on_game_message_received
()¶ Clear callbacks for notification
GameMessageReceived
..
-
clear_on_game_processed
()¶ Clear callbacks for notification
GameProcessed
..
-
clear_on_game_phase_update
()¶ Clear callbacks for notification
GamePhaseUpdate
..
-
clear_on_game_status_update
()¶ Clear callbacks for notification
GameStatusUpdate
..
-
clear_on_omniscient_updated
()¶ Clear callbacks for notification
OmniscientUpdated
..
-
clear_on_power_orders_flag
()¶ Clear callbacks for notification
PowerOrdersFlag
..
-
clear_on_power_orders_update
()¶ Clear callbacks for notification
PowerOrdersUpdate
..
-
clear_on_power_vote_updated
()¶ Clear callbacks for notification
PowerVoteUpdated
..
-
clear_on_power_wait_flag
()¶ Clear callbacks for notification
PowerWaitFlag
..
-
clear_on_powers_controllers
()¶ Clear callbacks for notification
PowersControllers
..
-
clear_on_vote_count_updated
()¶ Clear callbacks for notification
VoteCountUpdated
..
-
clear_on_vote_updated
()¶ Clear callbacks for notification
VoteUpdated
..
-
add_notification_callback
(notification_class, notification_callback)[source]¶ Add a callback for a notification.
Parameters: - notification_class – a notification class.
See
diplomacy.communication.notifications
about available notifications. - notification_callback – callback to add:
callback(network_game, notification) -> None
.
- notification_class – a notification class.
See
- channel: associated