1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! Includes information about engineer progress.
use crate::civilization::Engineer;
use serde::{Deserialize, Serialize};
/// Includes information about engineer progress.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase", untagged)]
pub enum EngineerProgressEvent {
/// Fired during startup and includes current engineer progress.
Startup(EngineerProgressStartup),
/// Fired when the player progresses with an engineer.
Update(EngineerProgressUpdate),
}
/// Fired during startup and includes current engineer progress.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct EngineerProgressStartup {
/// List of current engineer progress.
pub engineers: Vec<EngineerProgressStartupEntry>,
}
/// Entry for a single engineer and the progress.
// TODO the data for this struct is so inconsistent, it could use some work.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct EngineerProgressStartupEntry {
/// The name of the engineer.
pub engineer: Option<String>,
/// The id of the engineer.
#[serde(rename = "EngineerID")]
pub engineer_id: Option<Engineer>,
// TODO somehow this is optional even when the [rank] field is present? Why Frontier?!
/// The current progress unlock status.
pub progress: Option<EngineerProgressStartupProgress>,
/// The currently unlocked rank or highest possible 'tier' for the engineer.
pub rank: Option<u8>,
/// The current progress towards the next rank.
pub rank_progress: Option<f32>,
}
/// The status for a given engineer.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub enum EngineerProgressStartupProgress {
/// The engineer has been unlocked and the player can apply upgrades at this engineer.
Unlocked,
/// The player has been invited to the engineer, but still needs to complete their unlock task.
Invited,
/// The engineer is known, but the player has not unlocked the engineer or has been invited.
Known,
}
/// Fired when the player progresses with an engineer.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct EngineerProgressUpdate {
/// The name of the engineer.
pub engineer: String,
/// The id of the engineer.
#[serde(rename = "EngineerID")]
pub engineer_id: Engineer,
// TODO somehow this is optional even when the [rank] field is present? Why Frontier?!
/// The current progress unlock status.
pub progress: Option<EngineerProgressStartupProgress>,
/// The currently unlocked rank or highest possible 'tier' for the engineer.
pub rank: Option<u8>,
/// The current progress towards the next rank.
pub rank_progress: Option<f32>,
}