|
|
@ -309,3 +309,21 @@ where |
|
|
|
|
|
|
|
Ok(Box::new(None.into_iter()))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub async fn player_used_medical_center<EG>(id: ClientId,
|
|
|
|
_pumc: &PlayerUsedMedicalCenter, // not needed?
|
|
|
|
entity_gateway: &mut EG,
|
|
|
|
clients: &mut Clients)
|
|
|
|
-> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, ShipError>
|
|
|
|
where
|
|
|
|
EG: EntityGateway
|
|
|
|
{
|
|
|
|
let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
|
if client.character.meseta >= 10 {
|
|
|
|
client.character.meseta -= 10;
|
|
|
|
entity_gateway.save_character(&client.character).await;
|
|
|
|
Ok(Box::new(None.into_iter()))
|
|
|
|
} else {
|
|
|
|
Err(ShipError::NotEnoughMeseta(id, client.character.meseta))
|
|
|
|
}
|
|
|
|
}
|