ed_journals/modules/logs/content/log_event_content/
material_trade_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
//! Fired when the player trades engineering materials at a material trader.

use serde::{Deserialize, Serialize};

use crate::modules::materials::{Material, MaterialCategory};

/// Fired when the player trades engineering materials at a material trader.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct MaterialTradeEvent {
    /// The id of the market where the player has trades materials.
    #[serde(rename = "MarketID")]
    pub market_id: u64,

    /// The kind of material trader where the transaction has taken place.
    pub trader_type: MaterialCategory,

    /// The materials that were paid.
    pub paid: MaterialTradeEventExchange,

    /// The materials received.
    pub received: MaterialTradeEventExchange,
}

/// An entry for a material exchange, either for paying or receiving.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct MaterialTradeEventExchange {
    /// The material paid or received.
    pub material: Material,

    /// The localized name of the material that was exchanged.
    #[serde(rename = "Material_Localised")]
    pub material_localized: Option<String>,

    /// The category the exchanged material is a part off.
    pub category: MaterialCategory,

    /// The number of the given material that was either paid or received during the exchange.
    pub quantity: u16,
}