Merge branch 'v0' of https://git.spbr.net/spacebar/rust-nex into v0
All checks were successful
Build and Test / sonic-transformed (push) Successful in 4m7s
Build and Test / splatoon-testfire (push) Successful in 4m14s
Build and Test / mario-tennis (push) Successful in 4m17s
Build and Test / fast-racing-neo (push) Successful in 4m18s
Build and Test / splatoon (push) Successful in 4m23s
Build and Test / wii-u-chat (push) Successful in 5m33s
Build and Test / wii-sports-club (push) Successful in 5m35s
Build and Test / terraria (push) Successful in 5m37s
Build and Test / minecraft-wiiu (push) Successful in 6m14s
Build and Test / super-mario-maker (push) Successful in 6m15s
Build and Test / puyopuyo (push) Successful in 6m28s
Build and Test / friends (push) Successful in 6m52s
All checks were successful
Build and Test / sonic-transformed (push) Successful in 4m7s
Build and Test / splatoon-testfire (push) Successful in 4m14s
Build and Test / mario-tennis (push) Successful in 4m17s
Build and Test / fast-racing-neo (push) Successful in 4m18s
Build and Test / splatoon (push) Successful in 4m23s
Build and Test / wii-u-chat (push) Successful in 5m33s
Build and Test / wii-sports-club (push) Successful in 5m35s
Build and Test / terraria (push) Successful in 5m37s
Build and Test / minecraft-wiiu (push) Successful in 6m14s
Build and Test / super-mario-maker (push) Successful in 6m15s
Build and Test / puyopuyo (push) Successful in 6m28s
Build and Test / friends (push) Successful in 6m52s
This commit is contained in:
commit
302b4e3410
6 changed files with 25 additions and 5 deletions
|
|
@ -31,6 +31,8 @@ jobs:
|
||||||
- edition: super-mario-maker
|
- edition: super-mario-maker
|
||||||
db_secret: DATABASE_SMM
|
db_secret: DATABASE_SMM
|
||||||
- edition: terraria
|
- edition: terraria
|
||||||
|
|
||||||
|
name: ${{ matrix.edition }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|
|
||||||
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -2618,6 +2618,7 @@ dependencies = [
|
||||||
name = "rnex-rk"
|
name = "rnex-rk"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
"rnex-rk-protos",
|
"rnex-rk-protos",
|
||||||
"rnex-rmc",
|
"rnex-rmc",
|
||||||
"rnex-server",
|
"rnex-server",
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,13 @@ pub struct CompetitionRankingScoreData {
|
||||||
#[rmc_proto(112)]
|
#[rmc_proto(112)]
|
||||||
pub trait Ranking {
|
pub trait Ranking {
|
||||||
#[method_id(16)]
|
#[method_id(16)]
|
||||||
|
#[cfg(feature = "splatoon")]
|
||||||
async fn competition_ranking_get_param(
|
async fn competition_ranking_get_param(
|
||||||
&self,
|
&self,
|
||||||
param: CompetitionRankingGetParam,
|
param: CompetitionRankingGetParam,
|
||||||
) -> Result<Vec<CompetitionRankingScoreInfo>, ErrorCode>;
|
) -> Result<Vec<CompetitionRankingScoreInfo>, ErrorCode>;
|
||||||
#[method_id(18)]
|
#[method_id(18)]
|
||||||
|
#[cfg(feature = "splatoon")]
|
||||||
async fn upload_competition_ranking_score(
|
async fn upload_competition_ranking_score(
|
||||||
&self,
|
&self,
|
||||||
param: UploadCompetitionData,
|
param: UploadCompetitionData,
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ datastore = ["database-support", "v3-8-15"]
|
||||||
database-support = []
|
database-support = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
cfg-if = "1.0.4"
|
||||||
rnex-rmc = { path = "../../rnex-rmc" }
|
rnex-rmc = { path = "../../rnex-rmc" }
|
||||||
rnex-util = { path = "../../rnex-util" }
|
rnex-util = { path = "../../rnex-util" }
|
||||||
rnex-rk-protos = { path = "../../rnex-protocols/rk-protos" }
|
rnex-rk-protos = { path = "../../rnex-protocols/rk-protos" }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use rnex_rmc::response::ErrorCode;
|
use rnex_rmc::response::ErrorCode;
|
||||||
use rnex_server::{ConnectionInitData, EnvVarError, RnexManager, RnexModule, env_var};
|
use rnex_server::{ConnectionInitData, EnvVarError, RnexManager, RnexModule, env_var};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
use cfg_if::cfg_if;
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
use crate::user::RankingUser;
|
use crate::user::RankingUser;
|
||||||
|
|
@ -18,6 +19,7 @@ pub struct RankingModule;
|
||||||
|
|
||||||
impl RankingManager {
|
impl RankingManager {
|
||||||
// Seperate function because I cannot give a fuck right now
|
// Seperate function because I cannot give a fuck right now
|
||||||
|
#[cfg(feature = "splatoon")]
|
||||||
async fn fetch_team_votes(&self, fest_id: u32) -> Result<Vec<u32>, ErrorCode> {
|
async fn fetch_team_votes(&self, fest_id: u32) -> Result<Vec<u32>, ErrorCode> {
|
||||||
let url_votes = format!("{}?splatfest_id={}", self.rnex_result_votes_get, fest_id);
|
let url_votes = format!("{}?splatfest_id={}", self.rnex_result_votes_get, fest_id);
|
||||||
let Ok(response) = tokio::task::spawn_blocking(move || {
|
let Ok(response) = tokio::task::spawn_blocking(move || {
|
||||||
|
|
@ -76,10 +78,20 @@ impl RnexModule for RankingModule {
|
||||||
async fn create_manager(
|
async fn create_manager(
|
||||||
_: &rnex_server::ModuleHolder,
|
_: &rnex_server::ModuleHolder,
|
||||||
) -> Result<Self::Manager, Self::InitError> {
|
) -> Result<Self::Manager, Self::InitError> {
|
||||||
Ok(RankingManager {
|
cfg_if!{
|
||||||
rnex_result_votes_get: env_var("RNEX_SPLATOON_RESULTS_VOTES_GET")?,
|
if #[cfg(feature = "splatoon")] {
|
||||||
rnex_result_post: env_var("RNEX_SPLATOON_RESULTS_POST")?,
|
Ok(RankingManager {
|
||||||
rnex_result_get: env_var("RNEX_SPLATOON_RESULTS_GET")?,
|
rnex_result_votes_get: env_var("RNEX_SPLATOON_RESULTS_VOTES_GET")?,
|
||||||
})
|
rnex_result_post: env_var("RNEX_SPLATOON_RESULTS_POST")?,
|
||||||
|
rnex_result_get: env_var("RNEX_SPLATOON_RESULTS_GET")?,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Ok(RankingManager {
|
||||||
|
rnex_result_get: "".into(),
|
||||||
|
rnex_result_post: "".into(),
|
||||||
|
rnex_result_votes_get: "".into(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ pub struct CompetitionPostResults {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ranking for RankingUser {
|
impl Ranking for RankingUser {
|
||||||
|
#[cfg(feature = "splatoon")]
|
||||||
async fn competition_ranking_get_param(
|
async fn competition_ranking_get_param(
|
||||||
&self,
|
&self,
|
||||||
param: CompetitionRankingGetParam,
|
param: CompetitionRankingGetParam,
|
||||||
|
|
@ -93,6 +94,7 @@ impl Ranking for RankingUser {
|
||||||
Ok(vec![info])
|
Ok(vec![info])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "splatoon")]
|
||||||
async fn upload_competition_ranking_score(
|
async fn upload_competition_ranking_score(
|
||||||
&self,
|
&self,
|
||||||
param: UploadCompetitionData,
|
param: UploadCompetitionData,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue