Skip to main content

eldiron_shared/
interaction.rs

1use theframework::prelude::*;
2
3#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
4pub enum InteractionType {
5    Tell,
6    Sell,
7    Reply,
8}
9
10#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
11pub struct Interaction {
12    pub interaction_type: InteractionType,
13    pub from: Uuid,
14    pub from_name: String,
15    pub to: Uuid,
16    pub reply_function: Option<String>,
17    pub item_id: Option<Uuid>,
18    pub value: TheValue,
19}
20
21impl Interaction {
22    pub fn tell(from: Uuid, from_name: String, to: Uuid, text: String) -> Self {
23        Self {
24            interaction_type: InteractionType::Tell,
25            from,
26            from_name,
27            to,
28            reply_function: None,
29            item_id: None,
30            value: TheValue::Text(text),
31        }
32    }
33}