1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-23 07:37:46 +00:00
kawari/src/lib.rs
Joshua Goins d0bb7f4ba9 Start defining IPC opcodes in JSON
This is to make it easier to interpolate with other tools and projects,
and to reduce the mental barrier (of me and other contributors) of
changing these. This only ports the Lobby connection to use JSON so far,
the World connection is next.
2025-03-26 19:23:14 -04:00

79 lines
2 KiB
Rust

//! A server replacement for a certain MMO.
#![allow(clippy::large_enum_variant)]
use std::collections::HashMap;
use minijinja::Environment;
use patch::Version;
/// The blowfish implementation used for packet encryption.
pub mod blowfish;
/// Common functions, structures used between all servers.
pub mod common;
/// Config management.
pub mod config;
/// Bindings for Oodle network compression.
pub mod oodle;
/// Lobby server-specific code.
pub mod lobby;
/// World server-specific code.
pub mod world;
/// Everything packet parsing related.
pub mod packet;
/// Logic server-specific code.
pub mod login;
/// Patch server-specific code.
pub mod patch;
/// Opcodes, see `resources/opcodes.json`
pub mod opcodes;
/// Used in the encryption key.
const GAME_VERSION: u16 = 7000;
/// Supported boot version.
pub const SUPPORTED_BOOT_VERSION: Version = Version("2025.01.10.0000.0001");
/// Supported game version.
pub const SUPPORTED_GAME_VERSION: Version = Version("2025.03.18.0000.0000");
const SUPPORTED_EXPAC_VERSIONS: [(&str, Version); 5] = [
("ex1", Version("2025.03.14.0000.0000")),
("ex2", Version("2025.03.18.0000.0000")),
("ex3", Version("2025.03.18.0000.0000")),
("ex4", Version("2025.03.18.0000.0000")),
("ex5", Version("2025.03.18.0000.0000")),
];
/// Supported expansion versions.
pub fn get_supported_expac_versions() -> HashMap<&'static str, Version<'static>> {
HashMap::from(SUPPORTED_EXPAC_VERSIONS)
}
pub fn setup_default_environment() -> Environment<'static> {
let mut env = Environment::new();
env.add_template("admin.html", include_str!("../templates/admin.html"))
.unwrap();
env.add_template("web.html", include_str!("../templates/web.html"))
.unwrap();
env.add_template("login.html", include_str!("../templates/login.html"))
.unwrap();
env.add_template("register.html", include_str!("../templates/register.html"))
.unwrap();
env.add_template(
"worldstatus.html",
include_str!("../templates/worldstatus.html"),
)
.unwrap();
env
}