@ -115,4 +115,8 @@ pub trait EntityGateway: Send + Sync + Clone {
async fn set_character_equips(&mut self, _char_id: &CharacterEntityId, _equips: &EquippedEntity) -> Result<(), GatewayError> {
unimplemented!();
}
async fn set_character_meseta(&mut self, _char_id: &CharacterEntityId, amount: usize) -> Result<(), GatewayError> {
@ -318,4 +318,12 @@ impl EntityGateway for InMemoryGateway {
equips.insert(*char_id, equipped.clone());
Ok(())
async fn set_character_meseta(&mut self, char_id: &CharacterEntityId, amount: usize) -> Result<(), GatewayError> {
let mut characters = self.characters.lock().unwrap();
if let Some(char) = characters.get_mut(&char_id) {
char.meseta = amount as u32;
@ -597,4 +597,13 @@ impl EntityGateway for PostgresGateway {
.await?;
sqlx::query(r#"update player_character set meseta=$2 where id = $1"#)
.bind(char_id.0)
.bind(amount as i32)
.execute(&self.pool)