This commit is contained in:
27
server-rs/crates/spacetime-client/src/npc.rs
Normal file
27
server-rs/crates/spacetime-client/src/npc.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use super::*;
|
||||
use crate::mapper::*;
|
||||
|
||||
impl SpacetimeClient {
|
||||
pub async fn resolve_npc_battle_interaction(
|
||||
&self,
|
||||
input: crate::mapper::ResolveNpcBattleInteractionInput,
|
||||
) -> Result<NpcBattleInteractionRecord, SpacetimeClientError> {
|
||||
validate_npc_battle_interaction_input(&input)?;
|
||||
let procedure_input = input.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.resolve_npc_battle_interaction_and_return_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_npc_battle_interaction_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
})
|
||||
.await
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user