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::{
|
use rnex_core::rmc::protocols::matchmake::{
|
||||||
Matchmake, RawMatchmake, RawMatchmakeInfo, RemoteMatchmake,
|
Matchmake, RawMatchmake, RawMatchmakeInfo, RemoteMatchmake,
|
||||||
};
|
};
|
||||||
use rnex_core::rmc::protocols::util::{
|
|
||||||
Utility, RawUtility, RawUtilityInfo, RemoteUtility,
|
|
||||||
};
|
|
||||||
use rnex_core::rmc::protocols::matchmake_ext::{
|
use rnex_core::rmc::protocols::matchmake_ext::{
|
||||||
MatchmakeExt, RawMatchmakeExt, RawMatchmakeExtInfo, RemoteMatchmakeExt,
|
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::ranking::{Ranking, RawRanking, RawRankingInfo, RemoteRanking};
|
||||||
use rnex_core::rmc::protocols::secure::{RawSecure, RawSecureInfo, RemoteSecure, Secure};
|
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::response::ErrorCode;
|
||||||
use rnex_core::rmc::structures::any::Any;
|
use rnex_core::rmc::structures::any::Any;
|
||||||
use rnex_core::rmc::structures::matchmake::{
|
use rnex_core::rmc::structures::matchmake::{
|
||||||
|
|
@ -513,6 +511,36 @@ impl MatchmakeExtension for User {
|
||||||
|
|
||||||
Ok(sess.session.session_key.clone())
|
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 {
|
impl Matchmake for User {
|
||||||
|
|
@ -772,9 +800,9 @@ fn fetch_team_votes(fest_id: u32) -> Result<Vec<u32>, ErrorCode> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Utility for User{
|
impl Utility for User {
|
||||||
async fn acquire_nex_unique_id(&self) -> Result<u64, ErrorCode>{
|
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::protocols::notifications::NotificationEvent;
|
||||||
use crate::rmc::structures::any::Any;
|
use crate::rmc::structures::any::Any;
|
||||||
|
use crate::rmc::structures::matchmake::MatchmakeSessionSearchCriteria;
|
||||||
|
|
||||||
#[rmc_proto(109)]
|
#[rmc_proto(109)]
|
||||||
pub trait MatchmakeExtension {
|
pub trait MatchmakeExtension {
|
||||||
|
|
@ -35,6 +36,13 @@ pub trait MatchmakeExtension {
|
||||||
&self,
|
&self,
|
||||||
ty: i32,
|
ty: i32,
|
||||||
) -> Result<Vec<NotificationEvent>, ErrorCode>;
|
) -> 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)]
|
#[method_id(30)]
|
||||||
async fn join_matchmake_session_ex(
|
async fn join_matchmake_session_ex(
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ pub struct MatchmakeParam {
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "v3-5-0")]{
|
if #[cfg(feature = "v3-5-0")]{
|
||||||
#[derive(RmcSerialize, Debug, Clone, Default)]
|
#[derive(RmcSerialize, Debug, Clone, Default, PartialEq)]
|
||||||
#[rmc_struct(3)]
|
#[rmc_struct(3)]
|
||||||
pub struct MatchmakeSession {
|
pub struct MatchmakeSession {
|
||||||
//inherits from
|
//inherits from
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue