mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Make rank and level use some saner scales
This commit is contained in:
@@ -2,6 +2,7 @@ use polariton::operation::{Typed, Dict, Arr};
|
||||
use polariton::serdes::TypePrefix;
|
||||
|
||||
pub struct PlayerRankStaticInfo {
|
||||
pub sub_rank_count: i32,
|
||||
pub sub_rank_thresholds: Vec<i32>,
|
||||
}
|
||||
|
||||
@@ -11,7 +12,7 @@ impl PlayerRankStaticInfo {
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: vec![
|
||||
(Typed::Str("subRankCount".into()), Typed::Int(self.sub_rank_thresholds.len() as i32)),
|
||||
(Typed::Str("subRankCount".into()), Typed::Int(self.sub_rank_count)),
|
||||
(Typed::Str("subRankThresholds".into()), Typed::Arr(Arr {
|
||||
ty: TypePrefix::Int, // int
|
||||
items: self.sub_rank_thresholds.iter().map(|x| Typed::Int(*x)).collect(),
|
||||
|
||||
@@ -13,8 +13,7 @@ pub(super) fn player_level_info_provider() -> SimpleFunc<3, crate::UserTy, impl
|
||||
// FIXME load this from config
|
||||
// these are interpolated by the client
|
||||
(Typed::Int(0), Typed::Int(0)),
|
||||
// this should interpolate to display a level of 1337
|
||||
(Typed::Int(2674), Typed::Int(1)),
|
||||
(Typed::Int(10), Typed::Int(10_000)),
|
||||
(Typed::Int(10_000), Typed::Int(i32::MAX / 2)),
|
||||
] }));
|
||||
Ok(params.into())
|
||||
|
||||
@@ -8,7 +8,7 @@ const PARAM_KEY: u8 = 80;
|
||||
pub(super) fn rank_provider() -> SimpleFunc<80, crate::UserTy, impl (Fn(ParameterTable, &crate::UserTy) -> Result<ParameterTable, i16>) + Sync + Sync> {
|
||||
SimpleFunc::new(|params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(PARAM_KEY, Typed::Int(3));
|
||||
params.insert(PARAM_KEY, Typed::Int(0));
|
||||
Ok(params.into())
|
||||
})
|
||||
}
|
||||
@@ -19,7 +19,14 @@ pub(super) fn rank_static_provider() -> SimpleFunc<126, crate::UserTy, impl (Fn(
|
||||
SimpleFunc::new(|params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(STATIC_PARAM_KEY, PlayerRankStaticInfo {
|
||||
sub_rank_thresholds: vec![1, 2, 3, 4, 5],
|
||||
sub_rank_count: 5,
|
||||
sub_rank_thresholds: vec![
|
||||
0, 200, 500, 800, 1200,
|
||||
1600, 2000, 2500, 3000, 3500,
|
||||
4000, 6000, 8000, 10_000, 12_000,
|
||||
16_000, 20_000, 25_000, 30_000, 35_000,
|
||||
40_000, 50_000, 60_000, 70_000, 80_000,
|
||||
],
|
||||
}.as_transmissible());
|
||||
Ok(params.into())
|
||||
})
|
||||
|
||||
@@ -7,9 +7,33 @@ pub(super) fn weapon_rating_provider() -> SimpleFunc<127, crate::UserTy, impl (F
|
||||
SimpleFunc::new(|params, _| {
|
||||
let mut params = params.to_dict();
|
||||
params.insert(PARAM_KEY, Typed::HashMap(vec![
|
||||
(Typed::Str("subRankCount".into()), Typed::Int(2)),
|
||||
(Typed::Str("subRankCount".into()), Typed::Int(5)),
|
||||
(Typed::Str("subRankInterval".into()), Typed::Int(10)),
|
||||
(Typed::Str("gainsPerRank".into()), Typed::ObjArr(vec![
|
||||
Typed::Dict(Dict {
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: vec![
|
||||
(Typed::Str("win".into()), Typed::Int(1)),
|
||||
(Typed::Str("loss".into()), Typed::Int(5)),
|
||||
],
|
||||
}),
|
||||
Typed::Dict(Dict {
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: vec![
|
||||
(Typed::Str("win".into()), Typed::Int(3)),
|
||||
(Typed::Str("loss".into()), Typed::Int(5)),
|
||||
],
|
||||
}),
|
||||
Typed::Dict(Dict {
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
items: vec![
|
||||
(Typed::Str("win".into()), Typed::Int(5)),
|
||||
(Typed::Str("loss".into()), Typed::Int(5)),
|
||||
],
|
||||
}),
|
||||
Typed::Dict(Dict {
|
||||
key_ty: TypePrefix::Str,
|
||||
val_ty: TypePrefix::Any,
|
||||
|
||||
@@ -14,6 +14,7 @@ pub(super) fn weapon_xp_provider() -> SimpleFunc<129, crate::UserTy, impl (Fn(Pa
|
||||
key_ty: TypePrefix::Int, // int
|
||||
val_ty: TypePrefix::ObjArr, // obj arr
|
||||
items: vec![
|
||||
// TODO load from config
|
||||
(Typed::Int(ItemTier::T0 as _), Typed::ObjArr(vec![
|
||||
Typed::Dict(Dict {
|
||||
key_ty: TypePrefix::Str,
|
||||
|
||||
Reference in New Issue
Block a user