diplomacy.communication.notifications

Server -> Client notifications.

class diplomacy.communication.notifications.AccountDeleted(**kwargs)[source]

Bases: diplomacy.communication.notifications._ChannelNotification

Notification about an account deleted.

class diplomacy.communication.notifications.OmniscientUpdated(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about a grade updated. Sent at channel level.

Properties:

  • grade_update: str One of ‘promote’ or ‘demote’.
  • game: parsing.JsonableClassType(Game) a diplomacy.engine.game.Game object.
class diplomacy.communication.notifications.ClearedCenters(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about centers cleared.

class diplomacy.communication.notifications.ClearedOrders(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about orders cleared.

class diplomacy.communication.notifications.ClearedUnits(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about units cleared.

class diplomacy.communication.notifications.VoteCountUpdated(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about new count of draw votes for a game (for observers).

Properties:

  • count_voted: int number of powers that have voted.
  • count_expected: int number of powers to be expected to vote.
class diplomacy.communication.notifications.VoteUpdated(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about votes updated for a game (for omniscient observers).

Properties:

  • vote: Dict mapping a power name to a Vote (str) object representing power vote. Possible votes are: yes, no, neutral.
class diplomacy.communication.notifications.PowerVoteUpdated(**kwargs)[source]

Bases: diplomacy.communication.notifications.VoteCountUpdated

Notification about a new vote for a specific game power (for player games).

Properties:

  • vote: str vote object representing associated power vote. Can be yes, no, neutral.
class diplomacy.communication.notifications.PowersControllers(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about current controller for each power in a game.

Properties:

  • powers: A Dict that maps a power_name to a controller_name str.
  • timestamps: A Dict that maps a power_name to timestamp where the controller took over.
class diplomacy.communication.notifications.GameDeleted(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about a game deleted.

class diplomacy.communication.notifications.GameProcessed(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about a game phase update. Sent after game has processed a phase.

Properties:

  • previous_phase_data: diplomacy.utils.game_phase_data.GamePhaseData of the previous phase
  • current_phase_data: diplomacy.utils.game_phase_data.GamePhaseData of the current phase
class diplomacy.communication.notifications.GamePhaseUpdate(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about a game phase update.

Properties:

  • phase_data: diplomacy.utils.game_phase_data.GamePhaseData of the updated phase
  • phase_data_type: str. One of ‘state_history’, ‘state’, ‘phase’
class diplomacy.communication.notifications.GameStatusUpdate(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about a game status update.

Properties:

-status: str. One of ‘forming’, ‘active’, ‘paused’, ‘completed’, ‘canceled’
class diplomacy.communication.notifications.GameMessageReceived(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about a game message received.

Properties:

class diplomacy.communication.notifications.PowerOrdersUpdate(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about a power order update.

Properties:

  • orders: List of updated orders (i.e. str)
class diplomacy.communication.notifications.PowerOrdersFlag(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about a power order flag update.

Properties:

  • order_is_set: int. O = ORDER_NOT_SET, 1 = ORDER_SET_EMPTY, 2 = ORDER_SET.
class diplomacy.communication.notifications.PowerWaitFlag(**kwargs)[source]

Bases: diplomacy.communication.notifications._GameNotification

Notification about a power wait flag update.

Properties:

  • wait: bool that indicates to wait until the deadline is reached before proceeding. Otherwise if all powers are not waiting, the game is processed as soon as all non-eliminated powers have submitted their orders.
diplomacy.communication.notifications.parse_dict(json_notification)[source]

Parse a JSON expected to represent a notification. Raise an exception if parsing failed.

Parameters:json_notification – JSON dictionary.
Returns:a notification class instance.