Skip to main content

nimbuspulse_client/types/
dcs_runtime.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
6pub enum CurrentRuntimeAction {
7    StartingMission,
8    StartingServer,
9}
10
11#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
12pub struct DcsRuntime {
13    pub current_action: Option<CurrentRuntimeAction>,
14    pub last_full_update: i64,
15    pub paused: bool,
16    pub mission_info: GetMissionInfoResponse,
17    #[serde(flatten)]
18    pub mission_list: GetMissionListResponse,
19    #[serde(flatten)]
20    pub players: GetPlayersResponse,
21    #[serde(flatten)]
22    pub settings: GetServerSettingsResponse,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
26pub struct GetMissionInfoResponse {
27    pub result_red: Option<i32>,
28    pub result_blue: Option<i32>,
29    pub mission_filename: String,
30    pub mission_time: f32,
31    pub mission_name: String,
32    pub mission_description: String,
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
36pub struct GetMissionListResponse {
37    #[serde(
38        rename = "missionList",
39        deserialize_with = "super::deserialize_mission_field"
40    )]
41    pub mission_list: Vec<String>,
42    #[serde(
43        rename = "missionTheatres",
44        deserialize_with = "super::deserialize_mission_field"
45    )]
46    pub mission_theatres: Vec<String>,
47    #[serde(rename = "listStartIndex")]
48    pub list_start_index: i32,
49    #[serde(rename = "listShuffle")]
50    pub list_shuffle: bool,
51    #[serde(rename = "listLoop")]
52    pub list_loop: bool,
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
56pub struct GetPlayersResponse {
57    pub players: Players,
58    pub server_id: i32,
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
62pub struct Players {
63    #[serde(deserialize_with = "super::deserialize_array_object")]
64    pub banned: Vec<BannedPlayer>,
65    pub all: HashMap<String, Player>,
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
69pub struct Player {
70    pub ping: i32,
71    pub side: i32,
72    pub slot: String,
73    pub id: i32,
74    pub name: String,
75    pub score: i32,
76    pub ucid: String,
77    pub started: bool,
78    pub lang: String,
79    pub ipaddr: String,
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
83pub struct BannedPlayer {
84    pub banned_from: i64,
85    pub banned_until: i64,
86    pub ipaddr: String,
87    pub name: String,
88    pub reason: String,
89    pub ucid: String,
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
93pub struct GetServerSettingsResponse {
94    pub mission_list: GetMissionListResponse,
95    pub settings: Settings,
96    pub ip: String,
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
100pub struct Settings {
101    pub description: String,
102    pub require_pure_textures: bool,
103    #[serde(rename = "listStartIndex")]
104    pub list_start_index: i32,
105    pub advanced: AdvancedSettings,
106    pub port: i32,
107    pub mode: i32,
108    pub bind_address: String,
109    #[serde(rename = "isPublic")]
110    pub is_public: bool,
111    #[serde(rename = "listShuffle")]
112    pub list_shuffle: bool,
113    pub password: String,
114    #[serde(rename = "listLoop")]
115    pub list_loop: bool,
116    pub name: String,
117    pub require_pure_scripts: bool,
118    #[serde(
119        rename = "missionList",
120        deserialize_with = "super::deserialize_mission_field"
121    )]
122    pub mission_list: Vec<String>,
123    pub require_pure_clients: bool,
124    pub require_pure_models: bool,
125    #[serde(rename = "maxPlayers")]
126    pub max_players: i32,
127}
128
129#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
130pub struct AdvancedSettings {
131    pub allow_change_tailno: bool,
132    pub disable_events: bool,
133    pub allow_ownship_export: bool,
134    pub allow_object_export: bool,
135    pub pause_on_load: bool,
136    pub allow_sensor_export: bool,
137    #[serde(rename = "event_Takeoff")]
138    pub event_takeoff: bool,
139    pub pause_without_clients: bool,
140    pub client_outbound_limit: i32,
141    pub client_inbound_limit: i32,
142    pub server_can_screenshot: bool,
143    pub allow_players_pool: bool,
144    pub voice_chat_server: bool,
145    pub allow_change_skin: bool,
146    #[serde(rename = "event_Connect")]
147    pub event_connect: bool,
148    #[serde(rename = "event_Ejecting")]
149    pub event_ejecting: bool,
150    #[serde(rename = "event_Kill")]
151    pub event_kill: bool,
152    #[serde(rename = "event_Crash")]
153    pub event_crash: bool,
154    #[serde(rename = "event_Role")]
155    pub event_role: bool,
156    pub resume_mode: i32,
157    #[serde(rename = "maxPing")]
158    pub max_ping: i32,
159    pub allow_trial_only_clients: bool,
160    pub allow_dynamic_radio: bool,
161    #[serde(rename = "redPasswordHash")]
162    pub red_password_hash: Option<String>,
163    #[serde(rename = "bluePasswordHash")]
164    pub blue_password_hash: Option<String>,
165    #[serde(rename = "redPassword")]
166    pub red_password: Option<String>,
167    #[serde(rename = "bluePassword")]
168    pub blue_password: Option<String>,
169}