mirror of
https://github.com/RustySamovar/RustySamovar.git
synced 2024-11-22 02:45:34 +00:00
A bunch of stuff for 2.7.50. With some workarounds it's now possible to play.
This commit is contained in:
parent
bae03caf99
commit
fcd356e7bf
@ -1082,7 +1082,6 @@ impl DatabaseManager {
|
|||||||
pub const SPOOFED_AVATAR_ID: u32 = 1;
|
pub const SPOOFED_AVATAR_ID: u32 = 1;
|
||||||
pub const SPOOFED_WEAPON_ID: u32 = 2;
|
pub const SPOOFED_WEAPON_ID: u32 = 2;
|
||||||
const SPOOFED_SCENE_ID: u32 = 3; // TODO: that's a different kind of ID!
|
const SPOOFED_SCENE_ID: u32 = 3; // TODO: that's a different kind of ID!
|
||||||
pub const SPOOFED_TEAM_ID: u32 = 4;
|
|
||||||
pub const SPOOFED_MP_LEVEL_ID: u32 = 5;
|
pub const SPOOFED_MP_LEVEL_ID: u32 = 5;
|
||||||
const SPOOFED_SCENE_TOKEN: u32 = 0x1234;
|
const SPOOFED_SCENE_TOKEN: u32 = 0x1234;
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ impl AuthManager {
|
|||||||
|
|
||||||
rsp.account_type = req.account_type;
|
rsp.account_type = req.account_type;
|
||||||
rsp.account_uid = req.account_uid.clone();
|
rsp.account_uid = req.account_uid.clone();
|
||||||
rsp.token = format!("token-game-{}", req.account_uid);
|
rsp.token = req.account_token.clone();
|
||||||
rsp.secret_key_seed = seed;
|
rsp.secret_key_seed = 0;//seed; // TODO: temporary workaround!
|
||||||
rsp.uid = uid;
|
rsp.uid = uid;
|
||||||
|
|
||||||
self.conv_to_user.insert(conv, uid);
|
self.conv_to_user.insert(conv, uid);
|
||||||
|
@ -38,12 +38,12 @@ pub struct DispatchServer {}
|
|||||||
|
|
||||||
// Keys stuff
|
// Keys stuff
|
||||||
#[derive(Deserialize,Debug)]
|
#[derive(Deserialize,Debug)]
|
||||||
struct KeyInfo {
|
pub struct KeyInfo {
|
||||||
key_id: u8,
|
pub key_id: u8,
|
||||||
#[serde(deserialize_with = "deserialize_pub_key")]
|
|
||||||
public_key: Rsa<Public>,
|
|
||||||
#[serde(deserialize_with = "deserialize_priv_key")]
|
#[serde(deserialize_with = "deserialize_priv_key")]
|
||||||
private_key: Rsa<Private>,
|
pub encrypt_key: Rsa<Private>,
|
||||||
|
#[serde(deserialize_with = "deserialize_priv_key")]
|
||||||
|
pub signing_key: Rsa<Private>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deserialize_pub_key<'de, D>(deserializer: D) -> Result<Rsa<Public>, D::Error>
|
fn deserialize_pub_key<'de, D>(deserializer: D) -> Result<Rsa<Public>, D::Error>
|
||||||
@ -317,16 +317,18 @@ impl DispatchServer {
|
|||||||
None => panic!("Unknown key ID {}!", key_id),
|
None => panic!("Unknown key ID {}!", key_id),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut out_buf: Vec<u8> = Vec::new();
|
const key_size: usize = 256; // TODO: hardcoded constant!
|
||||||
let mut enc_buf: Vec<u8> = vec![0; keys.public_key.size() as usize];
|
|
||||||
|
|
||||||
for chunk in region_conf_buf.chunks((keys.public_key.size() - 11) as usize) { // TODO: value hardcoded for the PKCS1 v1.5!
|
let mut out_buf: Vec<u8> = Vec::new();
|
||||||
let len = keys.private_key.public_encrypt(chunk, &mut enc_buf, Padding::PKCS1).unwrap();
|
let mut enc_buf: Vec<u8> = vec![0; key_size];
|
||||||
out_buf.append(&mut enc_buf);
|
|
||||||
enc_buf.resize(keys.public_key.size() as usize, 0);
|
for chunk in region_conf_buf.chunks((key_size - 11) as usize) { // TODO: value hardcoded for the PKCS1 v1.5!
|
||||||
|
let len = keys.encrypt_key.public_encrypt(chunk, &mut enc_buf, Padding::PKCS1).unwrap();
|
||||||
|
out_buf.append(&mut enc_buf[0..len].to_vec());
|
||||||
|
enc_buf.resize(key_size, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
let keypair = PKey::from_rsa(keys.private_key.clone()).unwrap(); // TODO: this is not a correct private key!
|
let keypair = PKey::from_rsa(keys.signing_key.clone()).unwrap();
|
||||||
let mut signer = Signer::new(MessageDigest::sha256(), &keypair).unwrap();
|
let mut signer = Signer::new(MessageDigest::sha256(), &keypair).unwrap();
|
||||||
let signature = signer.sign_oneshot_to_vec(®ion_conf_buf).unwrap();
|
let signature = signer.sign_oneshot_to_vec(®ion_conf_buf).unwrap();
|
||||||
|
|
||||||
@ -658,7 +660,7 @@ impl DispatchServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn log_skip(body: web::Bytes) -> String {
|
async fn log_skip(body: web::Bytes) -> String {
|
||||||
//println!("Logging: {}", std::str::from_utf8(&body).unwrap());
|
println!("Logging: {}", std::str::from_utf8(&body).unwrap());
|
||||||
|
|
||||||
return "{}".to_string();
|
return "{}".to_string();
|
||||||
}
|
}
|
||||||
@ -704,7 +706,7 @@ impl DispatchServer {
|
|||||||
return "127.0.0.1".to_string();
|
return "127.0.0.1".to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_rsa_keys(name: &str) -> HashMap<u8, KeyInfo> {
|
pub fn load_rsa_keys(name: &str) -> HashMap<u8, KeyInfo> {
|
||||||
// Key depo
|
// Key depo
|
||||||
let path = format!("./{}/{}.json", "keys", name);
|
let path = format!("./{}/{}.json", "keys", name);
|
||||||
let json_file_path = Path::new(&path);
|
let json_file_path = Path::new(&path);
|
||||||
|
@ -80,8 +80,8 @@ impl GameWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn process_scene_init_finish(&self, user_id: u32, metadata: &proto::PacketHead, req: &proto::SceneInitFinishReq, rsp: &mut proto::SceneInitFinishRsp) {
|
fn process_scene_init_finish(&self, user_id: u32, metadata: &proto::PacketHead, req: &proto::SceneInitFinishReq, rsp: &mut proto::SceneInitFinishRsp) {
|
||||||
let current_avatar_guid = match self.db.get_player_team_selection(user_id) {
|
let (current_avatar_guid, current_team_id) = match self.db.get_player_team_selection(user_id) {
|
||||||
Some(team_selection) => team_selection.avatar,
|
Some(team_selection) => (team_selection.avatar, team_selection.team),
|
||||||
None => panic!("Team selection info not found for user {}!", user_id),
|
None => panic!("Team selection info not found for user {}!", user_id),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -110,13 +110,15 @@ impl GameWorld {
|
|||||||
uid: user_id,
|
uid: user_id,
|
||||||
nickname: user.nick_name.clone(),
|
nickname: user.nick_name.clone(),
|
||||||
player_level: user_level,
|
player_level: user_level,
|
||||||
avatar_id: user.avatar_id,
|
avatar_id: user.avatar_id, // TODO: this is deprecated in current game versions, profile_picture is used instead
|
||||||
mp_setting_type: proto::MpSettingType::MpSettingEnterAfterApply as i32, // TODO!
|
mp_setting_type: proto::MpSettingType::MpSettingEnterAfterApply as i32, // TODO!
|
||||||
cur_player_num_in_world: 1, // TODO!
|
cur_player_num_in_world: 1, // TODO!
|
||||||
world_level: world_level,
|
world_level: world_level,
|
||||||
name_card_id: user.namecard_id,
|
name_card_id: user.namecard_id,
|
||||||
signature: user.signature.clone(),
|
signature: user.signature.clone(),
|
||||||
// TODO: Field 12!
|
profile_picture: Some(build!(ProfilePicture {
|
||||||
|
avatar_id: user.avatar_id,
|
||||||
|
})),
|
||||||
});
|
});
|
||||||
|
|
||||||
build_and_send!(self, user_id, metadata, WorldPlayerInfoNotify {
|
build_and_send!(self, user_id, metadata, WorldPlayerInfoNotify {
|
||||||
@ -150,7 +152,7 @@ impl GameWorld {
|
|||||||
ability_info: Some(build!(AbilitySyncStateInfo {})),
|
ability_info: Some(build!(AbilitySyncStateInfo {})),
|
||||||
});
|
});
|
||||||
let team_enter_info = build!(TeamEnterSceneInfo {
|
let team_enter_info = build!(TeamEnterSceneInfo {
|
||||||
team_entity_id: IdManager::get_entity_id_by_type_and_sub_id(&proto::ProtEntityType::ProtEntityTeam, DatabaseManager::SPOOFED_TEAM_ID), // TODO
|
team_entity_id: IdManager::get_entity_id_by_type_and_sub_id(&proto::ProtEntityType::ProtEntityTeam, current_team_id as u32),
|
||||||
team_ability_info: Some(build!(AbilitySyncStateInfo {})),
|
team_ability_info: Some(build!(AbilitySyncStateInfo {})),
|
||||||
ability_control_block: Some(build!(AbilityControlBlock {})),
|
ability_control_block: Some(build!(AbilityControlBlock {})),
|
||||||
});
|
});
|
||||||
@ -190,8 +192,10 @@ impl GameWorld {
|
|||||||
player_uid: user_id,
|
player_uid: user_id,
|
||||||
avatar_guid: current_avatar_guid as u64, // FIXME
|
avatar_guid: current_avatar_guid as u64, // FIXME
|
||||||
entity_id: IdManager::get_entity_id_by_type_and_sub_id(&proto::ProtEntityType::ProtEntityAvatar, DatabaseManager::SPOOFED_AVATAR_ID),
|
entity_id: IdManager::get_entity_id_by_type_and_sub_id(&proto::ProtEntityType::ProtEntityAvatar, DatabaseManager::SPOOFED_AVATAR_ID),
|
||||||
|
avatar_ability_info: Some(build!(AbilitySyncStateInfo {})),
|
||||||
weapon_guid: IdManager::get_guid_by_uid_and_id(user_id, DatabaseManager::SPOOFED_WEAPON_ID),
|
weapon_guid: IdManager::get_guid_by_uid_and_id(user_id, DatabaseManager::SPOOFED_WEAPON_ID),
|
||||||
weapon_entity_id: IdManager::get_entity_id_by_type_and_sub_id(&proto::ProtEntityType::ProtEntityWeapon, DatabaseManager::SPOOFED_WEAPON_ID),
|
weapon_entity_id: IdManager::get_entity_id_by_type_and_sub_id(&proto::ProtEntityType::ProtEntityWeapon, DatabaseManager::SPOOFED_WEAPON_ID),
|
||||||
|
weapon_ability_info: Some(build!(AbilitySyncStateInfo {})),
|
||||||
is_player_cur_avatar: true, // TODO
|
is_player_cur_avatar: true, // TODO
|
||||||
scene_entity_info: Some(self.spoof_scene_default_avatar(user_id)),
|
scene_entity_info: Some(self.spoof_scene_default_avatar(user_id)),
|
||||||
ability_control_block: Some(self.spoof_default_abilities()),
|
ability_control_block: Some(self.spoof_default_abilities()),
|
||||||
@ -271,6 +275,7 @@ impl GameWorld {
|
|||||||
equip_id_list: vec![11406], // TODO
|
equip_id_list: vec![11406], // TODO
|
||||||
weapon: Some(weapon),
|
weapon: Some(weapon),
|
||||||
wearing_flycloak_id: 140001, // TODO
|
wearing_flycloak_id: 140001, // TODO
|
||||||
|
excel_info: avatar_info.excel_info.clone(),
|
||||||
});
|
});
|
||||||
|
|
||||||
let scene_ai_info = build!(SceneEntityAiInfo {
|
let scene_ai_info = build!(SceneEntityAiInfo {
|
||||||
@ -288,6 +293,7 @@ impl GameWorld {
|
|||||||
fight_prop_list: Remapper::remap3(¤t_avatar_fight_props),
|
fight_prop_list: Remapper::remap3(¤t_avatar_fight_props),
|
||||||
motion_info: Some(motion_info),
|
motion_info: Some(motion_info),
|
||||||
entity_authority_info: Some(authority_info),
|
entity_authority_info: Some(authority_info),
|
||||||
|
entity_client_data: Some(build!(EntityClientData {})),
|
||||||
animator_para_list: vec![build!(AnimatorParameterValueInfoPair {
|
animator_para_list: vec![build!(AnimatorParameterValueInfoPair {
|
||||||
name_id: 0, // TODO: unknown!
|
name_id: 0, // TODO: unknown!
|
||||||
animator_para: Some(build!(AnimatorParameterValueInfo {})),
|
animator_para: Some(build!(AnimatorParameterValueInfo {})),
|
||||||
@ -342,7 +348,7 @@ impl GameWorld {
|
|||||||
|
|
||||||
for (key, value) in map {
|
for (key, value) in map {
|
||||||
let mut emb = proto::AbilityEmbryo::default();
|
let mut emb = proto::AbilityEmbryo::default();
|
||||||
//emb.ability_id = key; // TODO: ability IDs should be PRECISE or LEFT OUT completely!
|
emb.ability_id = key;
|
||||||
emb.ability_name_hash = value;
|
emb.ability_name_hash = value;
|
||||||
emb.ability_override_name_hash = 0x463810D9;
|
emb.ability_override_name_hash = 0x463810D9;
|
||||||
ability_list.push(emb);
|
ability_list.push(emb);
|
||||||
|
@ -115,6 +115,8 @@ impl LoginManager {
|
|||||||
owned_flycloak_list: vec![140001], // TODO!
|
owned_flycloak_list: vec![140001], // TODO!
|
||||||
});
|
});
|
||||||
|
|
||||||
|
build_and_send!(self, user_id, metadata, CoopDataNotify { });
|
||||||
|
|
||||||
let pos = luamanager::Vector {x: scene_info.pos_x, y: scene_info.pos_y, z: scene_info.pos_z};
|
let pos = luamanager::Vector {x: scene_info.pos_x, y: scene_info.pos_y, z: scene_info.pos_z};
|
||||||
|
|
||||||
self.em.player_teleported(user_id, pos, scene_info.scene_id, scene_info.scene_token, &proto::EnterType::EnterSelf);
|
self.em.player_teleported(user_id, pos, scene_info.scene_id, scene_info.scene_token, &proto::EnterType::EnterSelf);
|
||||||
|
@ -84,6 +84,13 @@ impl AvatarBuilder {
|
|||||||
proud_skill_extra_level_map: fuck, //collection!{739 => 3, 732 => 3},
|
proud_skill_extra_level_map: fuck, //collection!{739 => 3, 732 => 3},
|
||||||
wearing_flycloak_id: 140001, // TODO: hack!
|
wearing_flycloak_id: 140001, // TODO: hack!
|
||||||
life_state: 1,
|
life_state: 1,
|
||||||
|
excel_info: Some(build!(AvatarExcelInfo { // TODO: load values from config!
|
||||||
|
prefab_path_hash: IdManager::get_hash_by_prefix_suffix(50, 2568507538),
|
||||||
|
prefab_path_remote_hash: IdManager::get_hash_by_prefix_suffix(158, 3204428759),
|
||||||
|
controller_path_hash: IdManager::get_hash_by_prefix_suffix(154, 3376713903),
|
||||||
|
controller_path_remote_hash: IdManager::get_hash_by_prefix_suffix(228, 1479775384),
|
||||||
|
combat_config_hash: IdManager::get_hash_by_prefix_suffix(244, 4049143033),
|
||||||
|
})),
|
||||||
});
|
});
|
||||||
return ai;
|
return ai;
|
||||||
}
|
}
|
||||||
|
@ -50,4 +50,8 @@ impl IdManager {
|
|||||||
pub fn get_guid_by_uid_and_id(uid: u32, id: u32) -> u64 {
|
pub fn get_guid_by_uid_and_id(uid: u32, id: u32) -> u64 {
|
||||||
return (((uid as u64) << 32) | (id as u64));
|
return (((uid as u64) << 32) | (id as u64));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_hash_by_prefix_suffix(prefix: u8, suffix: u32) -> u64 {
|
||||||
|
((prefix as u64) << 32) | (suffix as u64)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user