hats
This commit is contained in:
@@ -5,6 +5,8 @@ pub struct Player {
|
|||||||
pub uuid: String,
|
pub uuid: String,
|
||||||
pub cloaks: Vec<String>,
|
pub cloaks: Vec<String>,
|
||||||
pub cloak: String,
|
pub cloak: String,
|
||||||
|
pub hats: Vec<String>,
|
||||||
|
pub hat: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Database {
|
pub struct Database {
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ pub fn player(session: &Session, uuid: String) -> Result {
|
|||||||
cloak: player.cloak,
|
cloak: player.cloak,
|
||||||
uuid,
|
uuid,
|
||||||
cloaks: player.cloaks,
|
cloaks: player.cloaks,
|
||||||
|
hats: player.hats,
|
||||||
|
hat: player.hat,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,9 +30,11 @@ pub fn create(session: &Session) -> Result {
|
|||||||
let uuid = session.local_player.id.clone();
|
let uuid = session.local_player.id.clone();
|
||||||
|
|
||||||
let player = Player {
|
let player = Player {
|
||||||
cloak: "".to_string(),
|
|
||||||
cloaks: Vec::new(),
|
|
||||||
uuid: uuid.clone(),
|
uuid: uuid.clone(),
|
||||||
|
cloaks: Vec::new(),
|
||||||
|
cloak: "".to_string(),
|
||||||
|
hats: Vec::new(),
|
||||||
|
hat: String::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
session.database.players.insert_one(player.clone()).run()?;
|
session.database.players.insert_one(player.clone()).run()?;
|
||||||
@@ -39,5 +43,7 @@ pub fn create(session: &Session) -> Result {
|
|||||||
cloak: player.cloak,
|
cloak: player.cloak,
|
||||||
uuid,
|
uuid,
|
||||||
cloaks: player.cloaks,
|
cloaks: player.cloaks,
|
||||||
|
hats: player.hats,
|
||||||
|
hat: player.hat,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-3
@@ -5,9 +5,11 @@ pub enum Response {
|
|||||||
Pong,
|
Pong,
|
||||||
Success,
|
Success,
|
||||||
Player {
|
Player {
|
||||||
cloak: String,
|
|
||||||
uuid: String,
|
uuid: String,
|
||||||
cloaks: Vec<String>,
|
cloaks: Vec<String>,
|
||||||
|
cloak: String,
|
||||||
|
hats: Vec<String>,
|
||||||
|
hat: String,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,10 +19,17 @@ impl std::fmt::Display for Response {
|
|||||||
Response::Pong => write!(f, "Pong"),
|
Response::Pong => write!(f, "Pong"),
|
||||||
Response::Success => write!(f, "Success"),
|
Response::Success => write!(f, "Success"),
|
||||||
Response::Player {
|
Response::Player {
|
||||||
cloak,
|
|
||||||
uuid,
|
uuid,
|
||||||
cloaks,
|
cloaks,
|
||||||
} => write!(f, "@cloak={cloak}@uuid={uuid}@cloaks={}", cloaks.join("$")),
|
cloak,
|
||||||
|
hats,
|
||||||
|
hat,
|
||||||
|
} => write!(
|
||||||
|
f,
|
||||||
|
"@cloak={cloak}@uuid={uuid}@cloaks={}@hats={}@hat={hat}",
|
||||||
|
cloaks.join("$"),
|
||||||
|
hats.join("$"),
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user