add auto_matchmake_with_search_criteria_postpone
This commit is contained in:
parent
5972833136
commit
e6ec245b87
3 changed files with 43 additions and 7 deletions
|
|
@ -11,9 +11,6 @@ use rnex_core::prudp::station_url::UrlOptions::{
|
|||
use rnex_core::rmc::protocols::matchmake::{
|
||||
Matchmake, RawMatchmake, RawMatchmakeInfo, RemoteMatchmake,
|
||||
};
|
||||
use rnex_core::rmc::protocols::util::{
|
||||
Utility, RawUtility, RawUtilityInfo, RemoteUtility,
|
||||
};
|
||||
use rnex_core::rmc::protocols::matchmake_ext::{
|
||||
MatchmakeExt, RawMatchmakeExt, RawMatchmakeExtInfo, RemoteMatchmakeExt,
|
||||
};
|
||||
|
|
@ -29,6 +26,7 @@ use rnex_core::rmc::protocols::notifications::notification_types::{
|
|||
};
|
||||
use rnex_core::rmc::protocols::ranking::{Ranking, RawRanking, RawRankingInfo, RemoteRanking};
|
||||
use rnex_core::rmc::protocols::secure::{RawSecure, RawSecureInfo, RemoteSecure, Secure};
|
||||
use rnex_core::rmc::protocols::util::{RawUtility, RawUtilityInfo, RemoteUtility, Utility};
|
||||
use rnex_core::rmc::response::ErrorCode;
|
||||
use rnex_core::rmc::structures::any::Any;
|
||||
use rnex_core::rmc::structures::matchmake::{
|
||||
|
|
@ -513,6 +511,36 @@ impl MatchmakeExtension for User {
|
|||
|
||||
Ok(sess.session.session_key.clone())
|
||||
}
|
||||
|
||||
async fn auto_matchmake_with_search_criteria_postpone(
|
||||
&self,
|
||||
criteria: Vec<crate::rmc::structures::matchmake::MatchmakeSessionSearchCriteria>,
|
||||
gathering: Any,
|
||||
join_message: String,
|
||||
) -> Result<Any, ErrorCode> {
|
||||
let session: MatchmakeSession = gathering
|
||||
.try_get()
|
||||
.map(|v| v.ok())
|
||||
.flatten()
|
||||
.ok_or(ErrorCode::Core_InvalidArgument)?;
|
||||
|
||||
let session = self
|
||||
.auto_matchmake_with_param_postpone(AutoMatchmakeParam {
|
||||
matchmake_session: session,
|
||||
additional_participants: vec![],
|
||||
gid_for_participation_check: 0,
|
||||
auto_matchmake_option: 0,
|
||||
join_message,
|
||||
participation_count: 0,
|
||||
search_criteria: criteria,
|
||||
target_gids: vec![],
|
||||
})
|
||||
.await?;
|
||||
|
||||
let any = Any::new(&session).map_err(|_| ErrorCode::Core_SystemError)?;
|
||||
|
||||
Ok(any)
|
||||
}
|
||||
}
|
||||
|
||||
impl Matchmake for User {
|
||||
|
|
@ -774,7 +802,7 @@ fn fetch_team_votes(fest_id: u32) -> Result<Vec<u32>, ErrorCode> {
|
|||
|
||||
impl Utility for User {
|
||||
async fn acquire_nex_unique_id(&self) -> Result<u64, ErrorCode> {
|
||||
return Ok(rand::random())
|
||||
return Ok(rand::random());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use rnex_core::rmc::structures::matchmake::{
|
|||
|
||||
use crate::rmc::protocols::notifications::NotificationEvent;
|
||||
use crate::rmc::structures::any::Any;
|
||||
use crate::rmc::structures::matchmake::MatchmakeSessionSearchCriteria;
|
||||
|
||||
#[rmc_proto(109)]
|
||||
pub trait MatchmakeExtension {
|
||||
|
|
@ -35,6 +36,13 @@ pub trait MatchmakeExtension {
|
|||
&self,
|
||||
ty: i32,
|
||||
) -> Result<Vec<NotificationEvent>, ErrorCode>;
|
||||
#[method_id(15)]
|
||||
async fn auto_matchmake_with_search_criteria_postpone(
|
||||
&self,
|
||||
criteria: Vec<MatchmakeSessionSearchCriteria>,
|
||||
gathering: Any,
|
||||
join_msg: String,
|
||||
) -> Result<Any, ErrorCode>;
|
||||
|
||||
#[method_id(30)]
|
||||
async fn join_matchmake_session_ex(
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ pub struct MatchmakeParam {
|
|||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "v3-5-0")]{
|
||||
#[derive(RmcSerialize, Debug, Clone, Default)]
|
||||
#[derive(RmcSerialize, Debug, Clone, Default, PartialEq)]
|
||||
#[rmc_struct(3)]
|
||||
pub struct MatchmakeSession {
|
||||
//inherits from
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue