ed_journals/modules/logs/content/log_event_content/
bounty_event.rs

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
82
83
84
85
86
87
88
89
90
91
92
93
//! Fired when the player takes on a bounty.

use serde::{Deserialize, Serialize};

use crate::modules::odyssey::Citizen;
use crate::modules::ship::ShipType;

/// Fired when the player takes on a bounty.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase", untagged)]
pub enum BountyEvent {
    /// For when the player takes on a normal (ship) target.
    Normal(BountyEventNormal),

    /// For when the player takes on a Skimmer drone as target.
    Skimmer(BountyEventSkimmer),
}

/// Details about the normal bounty.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct BountyEventNormal {
    /// A list of rewards which are rewarded when the player hands in the bounty.
    pub rewards: Vec<BountyEventNormalReward>,

    /// The name of the pilot the player took down, if any.
    pub pilot_name: Option<String>,

    /// The localized name of the pilot the player took down.
    #[serde(rename = "PilotName_Localised")]
    pub pilot_name_localized: Option<String>,

    /// The target of the bounty.
    pub target: BountyEventTarget,

    /// The name of the target localized.
    #[serde(rename = "Target_Localised")]
    pub target_localized: Option<String>,

    /// The total reward of credits that are rewarded for this bounty.
    pub total_reward: u64,

    /// The name of the faction the victim is a part of.
    pub victim_faction: String,
}

/// The type of target for the bounty.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
pub enum BountyEventTarget {
    /// For Skimmer drone targets.
    #[serde(rename = "skimmerdrone")]
    SentrySkimmer,

    /// For bomb Skimmer drone targets.
    #[serde(rename = "bombskimmerdrone")]
    Stringer,

    /// For targets that fly the specified ship.
    #[serde(untagged)]
    Ship(ShipType),

    /// For on-foot targets.
    #[serde(untagged)]
    Citizen(Citizen),
}

/// Details about the reward for the bounty.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct BountyEventNormalReward {
    /// The name of the faction that contributed to the reward.
    pub faction: String,

    /// The contribution of the faction to the total reward.
    pub reward: u64,
}

/// Details about a Skimmer bounty.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct BountyEventSkimmer {
    /// The name of the faction that placed the bounty.
    pub faction: Option<String>,

    /// The name of the target.
    pub target: String,

    /// The total number of credits rewarded when completing the bounty.
    pub reward: u64,

    /// The name of the faction the target Skimmer drone is part of.
    pub victim_faction: String,
}