This commit is contained in:
yoncodes
2025-10-28 21:21:28 -04:00
commit e58fd190b4
2962 changed files with 3063199 additions and 0 deletions

10
common/Cargo.toml Normal file
View File

@@ -0,0 +1,10 @@
[package]
name = "common"
edition.workspace = true
version.workspace = true
[dependencies]
once_cell.workspace = true
ansi_term.workspace = true
tracing-subscriber.workspace = true
serde.workspace = true

23
common/src/error_type.rs Normal file
View File

@@ -0,0 +1,23 @@
#[allow(non_camel_case_types)]
pub enum EErrorType {
SESSION_DST = -1,
DB_CLOSE = -2,
QUERY_ERROR = -3,
WAIT_TIMEOUT = -4,
REQUEST_FAILED = -5,
NOT_PINGCHECK_SESSION_DST = -6,
WAIT_PROCESS_REDIRECT = -7,
RPE_REQUEST_MISSING_PARAM = -8,
RPE_XML_DATA_NOT_FOUND = -9,
RPE_PROTOBUF_ENCODING_ERROR = -10,
RPE_UPDATE_MAJOR_CLIENT_DOWN = -11,
RPE_CDN_ASSET_BUNDLE_UPDATE = -12,
PRE_NETWORK_ERROR_NEON_API = -13,
RPE_PURCHASED_DISABLED = -14,
RPE_NEON_API_ACCESS_TOKEN_EXPIRE = -15,
RPE_BLOCK_IP = -16,
PRE_BLOCK_NETWORK_TYPE = -17,
CLINET_NET_TIMEOUT = -1000,
CLIENT_LOGIC_ERROR = -9999,
None,
}

29
common/src/lib.rs Normal file
View File

@@ -0,0 +1,29 @@
use once_cell::sync::Lazy;
use std::path::PathBuf;
pub mod error_type;
pub mod packet_code;
pub const GAME_SERVER_ADDRESS: &str = "0.0.0.0";
pub const GAME_SERVER_PORT: u16 = 10800;
pub static CERT_FILE_PATH: Lazy<PathBuf> =
Lazy::new(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../certs/cert.pem"));
pub static KEY_FILE_PATH: Lazy<PathBuf> =
Lazy::new(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../certs/key.pem"));
pub static DATABASE_PATH: Lazy<PathBuf> = Lazy::new(|| {
std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(|p| p.to_path_buf()))
.unwrap_or_else(|| PathBuf::from("."))
.join("db")
});
pub fn init_tracing() {
#[cfg(target_os = "windows")]
ansi_term::enable_ansi_support().unwrap();
tracing_subscriber::fmt().init();
}

1802
common/src/packet_code.rs Normal file

File diff suppressed because it is too large Load Diff