1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Implement basic chat functionality

This commit is contained in:
NGnius (Graham)
2025-04-14 21:17:41 -04:00
parent 4d2ddaeafb
commit 792a6362e3
37 changed files with 1119 additions and 34 deletions

View File

@@ -5,7 +5,7 @@ use serde::{Serialize, Deserialize};
use polariton::operation::{Typed, Dict};
use polariton::serdes::TypePrefix;
use super::super::{MovementCategoryData, MovementData, Cube, ItemCategory, ItemTier, BattleConfig, Settings};
use super::super::{MovementCategoryData, MovementData, Cube, ItemCategory, ItemTier, BattleConfig, Settings, ChatConfig};
const CUBE_CONFIG_FILENAME: &str = "config.json";
@@ -15,6 +15,7 @@ pub struct CubeConfig {
movement: HashMap<ItemCategory, MovementCategoryData>,
lerp_value: f32,
battle: BattleConfig,
chat: ChatConfig,
settings: Settings,
}
@@ -247,4 +248,11 @@ impl <C: Clone> super::ConfigProvider<C> for CubeConfig {
fn login_messages(&self) -> super::DevMessageProvider<C> {
super::DevMessageProvider::new(self.settings.banners.iter().map(|msg| (msg.message.clone(), msg.duration as i32)).collect())
}
fn public_channels(&self) -> Typed<C> {
Typed::Arr(polariton::operation::Arr {
ty: TypePrefix::Str,
items: self.chat.public_channels.iter().map(|s| Typed::Str(s.into())).collect(),
})
}
}

View File

@@ -17,6 +17,7 @@ pub trait ConfigProvider<C: Clone> {
fn campaign_details(&self) -> CompleteCampaignProvider;
fn client_config(&self) -> Typed<C>;
fn login_messages(&self) -> DevMessageProvider<C>;
fn public_channels(&self) -> Typed<C>;
}
pub struct CompleteCampaignProvider {