1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-23 15:47:45 +00:00

Remove more hardcoded values for character

Since we are now backed by a database, the remaining usages are erroneous and
should be removed.
This commit is contained in:
Joshua Goins 2025-03-22 17:06:16 -04:00
parent a91c59aaaa
commit 6190001caa
4 changed files with 40 additions and 48 deletions

View file

@ -1,4 +1,3 @@
use kawari::CONTENT_ID;
use kawari::common::custom_ipc::CustomIpcData; use kawari::common::custom_ipc::CustomIpcData;
use kawari::common::custom_ipc::CustomIpcSegment; use kawari::common::custom_ipc::CustomIpcSegment;
use kawari::common::custom_ipc::CustomIpcType; use kawari::common::custom_ipc::CustomIpcType;
@ -137,7 +136,6 @@ async fn main() {
sequence: character_action.sequence + 1, sequence: character_action.sequence + 1,
unk: 0x00010101, unk: 0x00010101,
details: CharacterDetails { details: CharacterDetails {
content_id: CONTENT_ID,
character_name: character_action character_name: character_action
.name .name
.clone(), .clone(),

View file

@ -20,7 +20,7 @@ use kawari::world::{
}, },
}; };
use kawari::world::{PlayerData, WorldDatabase}; use kawari::world::{PlayerData, WorldDatabase};
use kawari::{CHAR_NAME, CITY_STATE, CONTENT_ID, ZONE_ID, common::timestamp_secs}; use kawari::{ZONE_ID, common::timestamp_secs};
use physis::common::{Language, Platform}; use physis::common::{Language, Platform};
use physis::gamedata::GameData; use physis::gamedata::GameData;
use tokio::io::AsyncReadExt; use tokio::io::AsyncReadExt;
@ -260,7 +260,7 @@ async fn main() {
.chara_make .chara_make
.customize .customize
.subrace, .subrace,
city_state: CITY_STATE, city_state: chara_details.chara_make.unk6 as u8, // TODO: probably wrong
nameday_month: chara_details nameday_month: chara_details
.chara_make .chara_make
.birth_month .birth_month
@ -319,7 +319,7 @@ async fn main() {
op_code: ServerZoneIpcType::PlayerSpawn, op_code: ServerZoneIpcType::PlayerSpawn,
timestamp: timestamp_secs(), timestamp: timestamp_secs(),
data: ServerZoneIpcData::PlayerSpawn(PlayerSpawn { data: ServerZoneIpcData::PlayerSpawn(PlayerSpawn {
content_id: CONTENT_ID, content_id: connection.player_data.content_id,
common: CommonSpawn { common: CommonSpawn {
current_world_id: config.world.world_id, current_world_id: config.world.world_id,
home_world_id: config.world.world_id, home_world_id: config.world.world_id,
@ -419,13 +419,16 @@ async fn main() {
request_type: request.request_type, request_type: request.request_type,
sequence: request.count, sequence: request.count,
entries: vec![PlayerEntry { entries: vec![PlayerEntry {
content_id: CONTENT_ID, // TODO: fill with actual player data, it also shows up wrong in game
content_id: connection
.player_data
.content_id,
zone_id: connection.zone.id, zone_id: connection.zone.id,
zone_id1: 0x0100, zone_id1: 0x0100,
class_job: 36, class_job: 36,
level: 100, level: 100,
one: 1, one: 1,
name: CHAR_NAME.to_string(), name: "INVALID".to_string(),
fc_tag: "LOCAL".to_string(), fc_tag: "LOCAL".to_string(),
..Default::default() ..Default::default()
}], }],

View file

@ -1,6 +1,5 @@
//! A server replacement for a certain MMO. //! A server replacement for a certain MMO.
use common::CustomizeData;
use minijinja::Environment; use minijinja::Environment;
/// The blowfish implementation used for packet encryption. /// The blowfish implementation used for packet encryption.
@ -31,48 +30,11 @@ pub mod login;
/// See the TerritoryType excel sheet for a list of possible IDs. /// See the TerritoryType excel sheet for a list of possible IDs.
pub const ZONE_ID: u16 = 132; pub const ZONE_ID: u16 = 132;
pub const CONTENT_ID: u64 = 11111111111111111;
pub const INVALID_OBJECT_ID: u32 = 0xE0000000; pub const INVALID_OBJECT_ID: u32 = 0xE0000000;
pub const CUSTOMIZE_DATA: CustomizeData = CustomizeData {
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,
};
pub const DEITY: u8 = 0x8;
pub const NAMEDAY_MONTH: u8 = 0x1;
pub const NAMEDAY_DAY: u8 = 0x1;
pub const CITY_STATE: u8 = 0x3;
/// Maxmimum length of a character's name. /// Maxmimum length of a character's name.
pub const CHAR_NAME_MAX_LENGTH: usize = 32; pub const CHAR_NAME_MAX_LENGTH: usize = 32;
pub const CHAR_NAME: &str = "Test User";
pub fn setup_default_environment() -> Environment<'static> { pub fn setup_default_environment() -> Environment<'static> {
let mut env = Environment::new(); let mut env = Environment::new();
env.add_template("admin.html", include_str!("../templates/admin.html")) env.add_template("admin.html", include_str!("../templates/admin.html"))

View file

@ -1,6 +1,6 @@
use crate::{ use crate::{
CHAR_NAME, CUSTOMIZE_DATA, INVALID_OBJECT_ID, INVALID_OBJECT_ID,
common::timestamp_secs, common::{CustomizeData, timestamp_secs},
config::get_config, config::get_config,
packet::{PacketSegment, SegmentType}, packet::{PacketSegment, SegmentType},
world::ipc::{ world::ipc::{
@ -14,6 +14,35 @@ use super::{
ipc::{ChatMessage, Position}, ipc::{ChatMessage, Position},
}; };
pub const CUSTOMIZE_DATA: CustomizeData = CustomizeData {
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,
};
pub struct ChatHandler {} pub struct ChatHandler {}
impl ChatHandler { impl ChatHandler {
@ -85,7 +114,7 @@ impl ChatHandler {
home_world_id: config.world.world_id, home_world_id: config.world.world_id,
title: 1, title: 1,
class_job: 35, class_job: 35,
name: CHAR_NAME.to_string(), name: "Test Actor".to_string(),
hp_curr: 100, hp_curr: 100,
hp_max: 100, hp_max: 100,
mp_curr: 100, mp_curr: 100,