2025-03-16 15:39:44 -04:00
|
|
|
use common::CustomizeData;
|
2024-05-11 13:58:58 -04:00
|
|
|
use minijinja::Environment;
|
2024-05-11 13:50:05 -04:00
|
|
|
use rand::Rng;
|
2025-03-08 13:27:41 -05:00
|
|
|
use rand::distributions::Alphanumeric;
|
2024-05-11 13:50:05 -04:00
|
|
|
|
2025-03-16 15:42:46 -04:00
|
|
|
/// The blowfish implementation used for packet encryption.
|
2025-03-11 18:39:30 -04:00
|
|
|
pub mod blowfish;
|
2025-03-16 15:42:46 -04:00
|
|
|
|
|
|
|
/// Common functions, structures used between all servers.
|
2025-03-16 15:39:44 -04:00
|
|
|
pub mod common;
|
2025-03-16 15:42:46 -04:00
|
|
|
|
|
|
|
/// Config management.
|
2024-05-11 13:50:05 -04:00
|
|
|
pub mod config;
|
2025-03-17 16:44:17 -04:00
|
|
|
|
|
|
|
/// Bindings for Oodle network compression.
|
2025-03-10 21:31:21 -04:00
|
|
|
pub mod oodle;
|
2025-03-16 15:42:46 -04:00
|
|
|
|
|
|
|
/// Patch server-specific code.
|
|
|
|
pub mod patch;
|
|
|
|
|
|
|
|
/// Lobby server-specific code.
|
|
|
|
pub mod lobby;
|
|
|
|
|
|
|
|
/// World server-specific code.
|
2025-03-12 17:47:58 -04:00
|
|
|
pub mod world;
|
2024-05-11 13:50:05 -04:00
|
|
|
|
2025-03-16 17:43:29 -04:00
|
|
|
/// Everything packet parsing related.
|
|
|
|
pub mod packet;
|
|
|
|
|
2025-03-10 21:31:21 -04:00
|
|
|
// TODO: make this configurable
|
2025-03-17 16:44:17 -04:00
|
|
|
/// The world ID and name for the lobby.
|
|
|
|
/// See https://ffxiv.consolegameswiki.com/wiki/Servers for a list of possible IDs.
|
2025-03-10 21:31:21 -04:00
|
|
|
pub const WORLD_ID: u16 = 63;
|
|
|
|
pub const WORLD_NAME: &str = "KAWARI";
|
|
|
|
|
2025-03-17 16:44:17 -04:00
|
|
|
/// The zone ID you initially spawn in.
|
|
|
|
/// See the TerritoryType excel sheet for a list of possible IDs.
|
2025-03-14 00:30:37 -04:00
|
|
|
pub const ZONE_ID: u16 = 132;
|
2025-03-10 21:31:21 -04:00
|
|
|
|
|
|
|
pub const CONTENT_ID: u64 = 11111111111111111;
|
|
|
|
|
2025-03-16 15:39:44 -04:00
|
|
|
pub const CUSTOMIZE_DATA: CustomizeData = CustomizeData {
|
2025-03-14 00:30:37 -04:00
|
|
|
race: 4,
|
|
|
|
gender: 1,
|
|
|
|
age: 1,
|
|
|
|
height: 50,
|
|
|
|
subrace: 7,
|
|
|
|
face: 3,
|
|
|
|
hair: 5,
|
|
|
|
enable_highlights: 0,
|
|
|
|
skin_tone: 10,
|
|
|
|
right_eye_color: 75,
|
|
|
|
hair_tone: 50,
|
|
|
|
highlights: 0,
|
|
|
|
facial_features: 1,
|
|
|
|
facial_feature_color: 19,
|
|
|
|
eyebrows: 1,
|
|
|
|
left_eye_color: 75,
|
|
|
|
eyes: 1,
|
|
|
|
nose: 0,
|
|
|
|
jaw: 1,
|
|
|
|
mouth: 1,
|
|
|
|
lips_tone_fur_pattern: 169,
|
|
|
|
race_feature_size: 100,
|
|
|
|
race_feature_type: 1,
|
|
|
|
bust: 100,
|
|
|
|
face_paint: 0,
|
|
|
|
face_paint_color: 167,
|
|
|
|
};
|
|
|
|
|
2025-03-16 14:43:30 -04:00
|
|
|
pub const DEITY: u8 = 0x8;
|
|
|
|
pub const NAMEDAY_MONTH: u8 = 0x1;
|
|
|
|
pub const NAMEDAY_DAY: u8 = 0x1;
|
|
|
|
pub const CITY_STATE: u8 = 0x3;
|
|
|
|
|
2025-03-13 00:18:00 -04:00
|
|
|
/// Maxmimum length of a character's name.
|
|
|
|
pub const CHAR_NAME_MAX_LENGTH: usize = 32;
|
|
|
|
|
2025-03-14 00:30:37 -04:00
|
|
|
pub const CHAR_NAME: &str = "Test User";
|
|
|
|
|
2024-05-11 13:50:05 -04:00
|
|
|
pub fn generate_sid() -> String {
|
|
|
|
let random_id: String = rand::thread_rng()
|
|
|
|
.sample_iter(&Alphanumeric)
|
|
|
|
.take(56)
|
|
|
|
.map(char::from)
|
|
|
|
.collect();
|
|
|
|
random_id.to_lowercase()
|
2024-05-11 13:58:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn setup_default_environment() -> Environment<'static> {
|
|
|
|
let mut env = Environment::new();
|
2025-03-08 13:27:41 -05:00
|
|
|
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();
|
2024-05-11 13:58:58 -04:00
|
|
|
|
|
|
|
env
|
2025-03-08 13:27:41 -05:00
|
|
|
}
|