Skip to main content

AutohostUpdateEventData

Struct AutohostUpdateEventData 

Source
pub struct AutohostUpdateEventData {
    pub battle_id: Uuid,
    pub time: UnixTime,
    pub update: AutohostUpdateEventDataUpdate,
}
Expand description

AutohostUpdateEventData

JSON schema
{
 "title": "AutohostUpdateEventData",
 "type": "object",
 "required": [
   "battleId",
   "time",
   "update"
 ],
 "properties": {
   "battleId": {
     "type": "string",
     "format": "uuid"
   },
   "time": {
     "$ref": "#/definitions/unixTime"
   },
   "update": {
     "anyOf": [
       {
         "title": "StartUpdate",
         "description": "The battle has started.",
         "type": "object",
         "required": [
           "type"
         ],
         "properties": {
           "type": {
             "const": "start"
           }
         }
       },
       {
         "title": "FinishedUpdate",
         "description": "The battle finished, generated once per every single player reporting who won.",
         "type": "object",
         "required": [
           "type",
           "userId",
           "winningAllyTeams"
         ],
         "properties": {
           "type": {
             "const": "finished"
           },
           "userId": {
             "$ref": "#/definitions/userId"
           },
           "winningAllyTeams": {
             "description": "Ally team IDs",
             "type": "array",
             "items": {
               "type": "integer"
             },
             "minItems": 1
           }
         }
       },
       {
         "title": "EngineMessageUpdate",
         "description": "A message from the engine, e.g. some ip is trying to connect.",
         "type": "object",
         "required": [
           "message",
           "type"
         ],
         "properties": {
           "message": {
             "type": "string"
           },
           "type": {
             "const": "engine_message"
           }
         }
       },
       {
         "title": "EngineWarningUpdate",
         "description": "A warning from the engine.",
         "type": "object",
         "required": [
           "message",
           "type"
         ],
         "properties": {
           "message": {
             "type": "string"
           },
           "type": {
             "const": "engine_warning"
           }
         }
       },
       {
         "title": "EngineQuitUpdate",
         "description": "The engine process for battle has quit cleanly, no more updates will be sent for this battle.",
         "type": "object",
         "required": [
           "type"
         ],
         "properties": {
           "type": {
             "const": "engine_quit"
           }
         }
       },
       {
         "title": "EngineCrashUpdate",
         "description": "The engine process for battle has crashed, no more updates will be sent for this battle.",
         "type": "object",
         "required": [
           "type"
         ],
         "properties": {
           "details": {
             "description": "Optional, short, details of the crash.",
             "type": "string"
           },
           "type": {
             "const": "engine_crash"
           }
         }
       },
       {
         "title": "PlayerJoinedUpdate",
         "type": "object",
         "required": [
           "playerNumber",
           "type",
           "userId"
         ],
         "properties": {
           "playerNumber": {
             "description": "Player number in the game, can be useful for custom commands",
             "type": "integer"
           },
           "type": {
             "const": "player_joined"
           },
           "userId": {
             "$ref": "#/definitions/userId"
           }
         }
       },
       {
         "title": "PlayerLeftUpdate",
         "type": "object",
         "required": [
           "reason",
           "type",
           "userId"
         ],
         "properties": {
           "reason": {
             "enum": [
               "lost_connection",
               "left",
               "kicked"
             ]
           },
           "type": {
             "const": "player_left"
           },
           "userId": {
             "$ref": "#/definitions/userId"
           }
         }
       },
       {
         "title": "PlayerChatUpdate",
         "anyOf": [
           {
             "type": "object",
             "required": [
               "destination",
               "message",
               "type",
               "userId"
             ],
             "properties": {
               "destination": {
                 "enum": [
                   "allies",
                   "all",
                   "spectators"
                 ]
               },
               "message": {
                 "type": "string"
               },
               "type": {
                 "const": "player_chat"
               },
               "userId": {
                 "$ref": "#/definitions/userId"
               }
             }
           },
           {
             "type": "object",
             "required": [
               "destination",
               "message",
               "toUserId",
               "type",
               "userId"
             ],
             "properties": {
               "destination": {
                 "const": "player"
               },
               "message": {
                 "type": "string"
               },
               "toUserId": {
                 "$ref": "#/definitions/userId"
               },
               "type": {
                 "const": "player_chat"
               },
               "userId": {
                 "$ref": "#/definitions/userId"
               }
             }
           }
         ]
       },
       {
         "title": "PlayerDefeatedUpdate",
         "type": "object",
         "required": [
           "type",
           "userId"
         ],
         "properties": {
           "type": {
             "const": "player_defeated"
           },
           "userId": {
             "$ref": "#/definitions/userId"
           }
         }
       },
       {
         "title": "LuaMsgUpdate",
         "description": "This update is generated only for messages matching luamsgRegexp set in the battle start script.",
         "type": "object",
         "required": [
           "data",
           "script",
           "type",
           "userId"
         ],
         "properties": {
           "data": {
             "type": "string",
             "contentEncoding": "base64",
             "contentMediaType": "application/octet-stream"
           },
           "script": {
             "enum": [
               "ui",
               "game",
               "rules"
             ]
           },
           "type": {
             "const": "luamsg"
           },
           "uiMode": {
             "description": "Set when script is 'ui'",
             "enum": [
               "all",
               "allies",
               "spectators"
             ]
           },
           "userId": {
             "$ref": "#/definitions/userId"
           }
         }
       }
     ]
   }
 }
}

Fields§

§battle_id: Uuid§time: UnixTime§update: AutohostUpdateEventDataUpdate

Implementations§

Trait Implementations§

Source§

impl Clone for AutohostUpdateEventData

Source§

fn clone(&self) -> AutohostUpdateEventData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AutohostUpdateEventData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AutohostUpdateEventData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<AutohostUpdateEventData> for AutohostUpdateEventData

Source§

fn from(value: AutohostUpdateEventData) -> Self

Converts to this type from the input type.
Source§

impl Serialize for AutohostUpdateEventData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<AutohostUpdateEventData> for AutohostUpdateEventData

Source§

type Error = ConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(value: AutohostUpdateEventData) -> Result<Self, ConversionError>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,