fix multi path avatar
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::net::tools::JsonData;
|
||||
use crate::net::tools::FreesrData;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -13,7 +13,7 @@ pub async fn on_get_avatar_data_cs_req(
|
||||
session: &mut PlayerSession,
|
||||
body: &GetAvatarDataCsReq,
|
||||
) -> Result<()> {
|
||||
let json = JsonData::load().await;
|
||||
let json = FreesrData::load().await;
|
||||
session
|
||||
.send(
|
||||
CMD_GET_AVATAR_DATA_SC_RSP,
|
||||
|
||||
@@ -67,14 +67,13 @@ pub async fn on_scene_cast_skill_cs_req(
|
||||
}
|
||||
|
||||
async fn create_battle_info() -> SceneBattleInfo {
|
||||
let player = tools::JsonData::load().await;
|
||||
let player = tools::FreesrData::load().await;
|
||||
|
||||
let mut battle_info = SceneBattleInfo {
|
||||
stage_id: player.battle_config.stage_id,
|
||||
logic_random_seed: rand::thread_rng().gen::<u32>(),
|
||||
battle_id: 1,
|
||||
// cleheggdkal: player.battle_config.cycle_count, // wave
|
||||
rounds_limit: player.battle_config.cycle_count, // wave
|
||||
rounds_limit: player.battle_config.cycle_count,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
use crate::{
|
||||
net::{tools::JsonData, PlayerSession},
|
||||
net::{
|
||||
tools::{FreesrData, MultiPathAvatar},
|
||||
PlayerSession,
|
||||
},
|
||||
util::cur_timestamp_ms,
|
||||
};
|
||||
|
||||
@@ -63,6 +66,13 @@ pub async fn on_get_private_chat_history_cs_req(
|
||||
sender_uid: 727,
|
||||
..Default::default()
|
||||
},
|
||||
Chat {
|
||||
msg_type: MsgType::CustomText.into(),
|
||||
sent_time: cur_timestamp_ms(),
|
||||
text: "'march {march_id}' march_id can be set 1001 or 1224".to_string(),
|
||||
sender_uid: 727,
|
||||
..Default::default()
|
||||
},
|
||||
Chat {
|
||||
msg_type: MsgType::CustomText.into(),
|
||||
sent_time: cur_timestamp_ms(),
|
||||
@@ -80,9 +90,9 @@ pub async fn on_get_private_chat_history_cs_req(
|
||||
}
|
||||
|
||||
pub async fn on_send_msg_cs_req(session: &mut PlayerSession, body: &SendMsgCsReq) -> Result<()> {
|
||||
let json = JsonData::load().await;
|
||||
let mut json = FreesrData::load().await;
|
||||
|
||||
if let Some((cmd, _args)) = parse_command(&body.text) {
|
||||
if let Some((cmd, args)) = parse_command(&body.text) {
|
||||
match cmd {
|
||||
"sync" => {
|
||||
sync_player(session, json).await?;
|
||||
@@ -102,48 +112,76 @@ pub async fn on_send_msg_cs_req(session: &mut PlayerSession, body: &SendMsgCsReq
|
||||
.await?;
|
||||
}
|
||||
"mc" => {
|
||||
// let mc = MainCharacter::from(
|
||||
// args.first()
|
||||
// .unwrap_or(&"")
|
||||
// .parse::<u32>()
|
||||
// .unwrap_or(json.main_character as u32),
|
||||
// );
|
||||
let mc = MultiPathAvatar::from(
|
||||
args.first()
|
||||
.unwrap_or(&"")
|
||||
.parse::<u32>()
|
||||
.unwrap_or(json.main_character as u32),
|
||||
);
|
||||
|
||||
// json.main_character = mc;
|
||||
// json.save().await;
|
||||
json.main_character = mc;
|
||||
json.save().await;
|
||||
|
||||
// session
|
||||
// .send(
|
||||
// CMD_GET_HERO_BASIC_TYPE_INFO_SC_RSP,
|
||||
// GetHeroBasicTypeInfoScRsp {
|
||||
// retcode: 0,
|
||||
// gender: mc.get_gender().into(),
|
||||
// cur_basic_type: mc.get_type().into(),
|
||||
// basic_type_info_list: vec![HeroBasicTypeInfo {
|
||||
// basic_type: mc.get_type().into(),
|
||||
// ..Default::default()
|
||||
// }],
|
||||
// ..Default::default()
|
||||
// },
|
||||
// )
|
||||
// .await?;
|
||||
session
|
||||
.send(
|
||||
CMD_AVATAR_PATH_CHANGED_NOTIFY,
|
||||
AvatarPathChangedNotify {
|
||||
base_avatar_id: 8001,
|
||||
cur_multi_path_avatar_type: mc as i32,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
// sync_player(session, json).await?;
|
||||
session
|
||||
.send(
|
||||
CMD_REVC_MSG_SC_NOTIFY,
|
||||
RevcMsgScNotify {
|
||||
enlmbccjfbg: body.enlmbccjfbg.clone(),
|
||||
msg_type: body.msg_type,
|
||||
text: format!("Success change mc to {:#?}", mc),
|
||||
emote: body.emote,
|
||||
from_uid: 727, // from
|
||||
to_uid: 1337, // to
|
||||
chat_type: body.chat_type,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
"march" => {
|
||||
let march_type = MultiPathAvatar::from(
|
||||
args.first()
|
||||
.unwrap_or(&"")
|
||||
.parse::<u32>()
|
||||
.unwrap_or(json.march_type as u32),
|
||||
);
|
||||
|
||||
// session
|
||||
// .send(
|
||||
// CMD_REVC_MSG_SC_NOTIFY,
|
||||
// Klonpheafip {
|
||||
// ggadmjhlomj: body.ggadmjhlomj.clone(),
|
||||
// kokadficdfb: body.kokadficdfb,
|
||||
// ajlhdpcjand: format!("Set MC to: {mc:#?}"),
|
||||
// mgmicgabebd: body.mgmicgabebd,
|
||||
// ghojifhngmc: 727,
|
||||
// cmmildghfnl: 1337,
|
||||
// nmfepfoojic: body.nmfepfoojic,
|
||||
// },
|
||||
// )
|
||||
// .await?;
|
||||
json.march_type = march_type;
|
||||
json.save().await;
|
||||
|
||||
session
|
||||
.send(
|
||||
CMD_AVATAR_PATH_CHANGED_NOTIFY,
|
||||
AvatarPathChangedNotify {
|
||||
base_avatar_id: 1001,
|
||||
cur_multi_path_avatar_type: march_type as i32,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
session
|
||||
.send(
|
||||
CMD_REVC_MSG_SC_NOTIFY,
|
||||
RevcMsgScNotify {
|
||||
enlmbccjfbg: body.enlmbccjfbg.clone(),
|
||||
msg_type: body.msg_type,
|
||||
text: format!("Success change march to {:#?}", march_type),
|
||||
emote: body.emote,
|
||||
from_uid: 727, // from
|
||||
to_uid: 1337, // to
|
||||
chat_type: body.chat_type,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@@ -170,7 +208,7 @@ fn parse_command(command: &str) -> Option<(&str, Vec<&str>)> {
|
||||
Some((parts[0], parts[1..].to_vec()))
|
||||
}
|
||||
|
||||
async fn sync_player(session: &mut PlayerSession, json: JsonData) -> Result<()> {
|
||||
async fn sync_player(session: &mut PlayerSession, json: FreesrData) -> Result<()> {
|
||||
session
|
||||
.send(
|
||||
CMD_PLAYER_SYNC_SC_NOTIFY,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use anyhow::Result;
|
||||
use proto::*;
|
||||
|
||||
use crate::net::{tools::JsonData, PlayerSession};
|
||||
use crate::net::{tools::FreesrData, PlayerSession};
|
||||
|
||||
pub async fn on_get_bag_cs_req(session: &mut PlayerSession, _: &GetBagCsReq) -> Result<()> {
|
||||
let player = JsonData::load().await;
|
||||
let player = FreesrData::load().await;
|
||||
|
||||
session
|
||||
.send(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use scene_entity_info::Entity;
|
||||
use scene_entity_refresh_info::RefreshType;
|
||||
|
||||
use crate::net::tools::{self, AvatarJson, JsonData};
|
||||
use crate::net::tools::{self, AvatarJson, FreesrData};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -9,7 +9,7 @@ pub async fn on_get_all_lineup_data_cs_req(
|
||||
session: &mut PlayerSession,
|
||||
_body: &GetAllLineupDataCsReq,
|
||||
) -> Result<()> {
|
||||
let player = tools::JsonData::load().await;
|
||||
let player = tools::FreesrData::load().await;
|
||||
let lineup = LineupInfo {
|
||||
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
||||
name: "Squad 1".to_string(),
|
||||
@@ -34,7 +34,7 @@ pub async fn on_get_cur_lineup_data_cs_req(
|
||||
session: &mut PlayerSession,
|
||||
_body: &GetCurLineupDataCsReq,
|
||||
) -> Result<()> {
|
||||
let player = tools::JsonData::load().await;
|
||||
let player = tools::FreesrData::load().await;
|
||||
let mut lineup = LineupInfo {
|
||||
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
||||
name: "Squad 1".to_string(),
|
||||
@@ -91,12 +91,14 @@ pub async fn on_join_lineup_cs_req(
|
||||
// update lineups
|
||||
// TODO: FIX THESE SHIT
|
||||
{
|
||||
let mut player = tools::JsonData::load().await;
|
||||
let mut player = tools::FreesrData::load().await;
|
||||
let lineups = &mut player.lineups;
|
||||
lineups.insert(
|
||||
body.slot,
|
||||
if body.base_avatar_id > 8000 {
|
||||
if body.base_avatar_id == 8001 {
|
||||
player.main_character as u32
|
||||
} else if body.base_avatar_id == 1001 {
|
||||
player.march_type as u32
|
||||
} else {
|
||||
body.base_avatar_id
|
||||
},
|
||||
@@ -105,7 +107,7 @@ pub async fn on_join_lineup_cs_req(
|
||||
}
|
||||
|
||||
{
|
||||
let player = tools::JsonData::load().await;
|
||||
let player = tools::FreesrData::load().await;
|
||||
|
||||
refresh_lineup(session, &player).await?;
|
||||
}
|
||||
@@ -120,13 +122,15 @@ pub async fn on_replace_lineup_cs_req(
|
||||
req: &ReplaceLineupCsReq,
|
||||
) -> Result<()> {
|
||||
{
|
||||
let mut player = tools::JsonData::load().await;
|
||||
let mut player = tools::FreesrData::load().await;
|
||||
|
||||
let lineups = &mut player.lineups;
|
||||
for (slot, avatar_id) in &mut *lineups {
|
||||
if let Some(lineup) = req.slots.get(*slot as usize) {
|
||||
*avatar_id = if lineup.id > 8000 {
|
||||
*avatar_id = if lineup.id == 8001 {
|
||||
player.main_character as u32
|
||||
} else if lineup.id == 1001 {
|
||||
player.march_type as u32
|
||||
} else {
|
||||
lineup.id
|
||||
};
|
||||
@@ -138,7 +142,7 @@ pub async fn on_replace_lineup_cs_req(
|
||||
}
|
||||
|
||||
{
|
||||
let player = tools::JsonData::load().await;
|
||||
let player = tools::FreesrData::load().await;
|
||||
|
||||
refresh_lineup(_session, &player).await?;
|
||||
}
|
||||
@@ -157,7 +161,7 @@ pub async fn on_quit_lineup_cs_req(
|
||||
.await
|
||||
}
|
||||
|
||||
async fn refresh_lineup(sess: &mut PlayerSession, player: &JsonData) -> Result<()> {
|
||||
async fn refresh_lineup(sess: &mut PlayerSession, player: &FreesrData) -> Result<()> {
|
||||
let lineup = LineupInfo {
|
||||
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
||||
name: "Squad 1".to_string(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::util::{self};
|
||||
use crate::{net::tools::FreesrData, util};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -50,12 +50,7 @@ pub async fn on_player_login_finish_cs_req(
|
||||
session
|
||||
.send(CMD_PLAYER_LOGIN_FINISH_SC_RSP, Dummy {})
|
||||
.await?;
|
||||
session
|
||||
.send(CMD_CONTENT_PACKAGE_UNLOCK_SC_RSP, Dummy {})
|
||||
.await?;
|
||||
session
|
||||
.send(CMD_CONTENT_PACKAGE_GET_DATA_SC_RSP, Dummy {})
|
||||
.await?;
|
||||
|
||||
session
|
||||
.send(
|
||||
CMD_CONTENT_PACKAGE_SYNC_DATA_SC_NOTIFY,
|
||||
@@ -96,6 +91,8 @@ pub async fn on_get_multi_path_avatar_info_cs_req(
|
||||
session: &mut PlayerSession,
|
||||
_: &GetMultiPathAvatarInfoCsReq,
|
||||
) -> Result<()> {
|
||||
let json = FreesrData::load().await;
|
||||
|
||||
session
|
||||
.send(
|
||||
CMD_GET_MULTI_PATH_AVATAR_INFO_SC_RSP,
|
||||
@@ -103,70 +100,58 @@ pub async fn on_get_multi_path_avatar_info_cs_req(
|
||||
retcode: 0,
|
||||
multi_path_avatar_type_info_list: vec![
|
||||
MultiPathAvatarTypeInfo {
|
||||
multi_path_avatar_type: MultiPathAvatarType::GirlShamanType.into(),
|
||||
multi_path_avatar_type: json.main_character as i32,
|
||||
rank: 6,
|
||||
equip_relic_list: vec![],
|
||||
skilltree_list: vec![
|
||||
AvatarSkillTree {
|
||||
equip_relic_list: json
|
||||
.relics
|
||||
.iter()
|
||||
.filter(|v| v.equip_avatar == json.main_character as u32)
|
||||
.map(|v| v.to_equipment_relic_proto())
|
||||
.collect(),
|
||||
skilltree_list: (1..=4)
|
||||
.map(|v| AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 8006001,
|
||||
},
|
||||
AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 8006002,
|
||||
},
|
||||
AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 8006003,
|
||||
},
|
||||
AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 8006004,
|
||||
},
|
||||
AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 8006001,
|
||||
},
|
||||
],
|
||||
point_id: (json.main_character as u32) * 1000 + v,
|
||||
})
|
||||
.collect(),
|
||||
all_path_special_skilltree_list: vec![],
|
||||
path_equipment_id: 0,
|
||||
path_equipment_id: json
|
||||
.lightcones
|
||||
.iter()
|
||||
.find(|v| v.equip_avatar == json.main_character as u32)
|
||||
.map(|v| v.internal_uid)
|
||||
.unwrap_or_default(),
|
||||
all_path_unlocked_special_point_id_list: vec![],
|
||||
},
|
||||
MultiPathAvatarTypeInfo {
|
||||
multi_path_avatar_type: MultiPathAvatarType::Mar7thKnightType.into(),
|
||||
multi_path_avatar_type: json.march_type as i32,
|
||||
rank: 6,
|
||||
equip_relic_list: vec![],
|
||||
skilltree_list: vec![
|
||||
AvatarSkillTree {
|
||||
equip_relic_list: json
|
||||
.relics
|
||||
.iter()
|
||||
.filter(|v| v.equip_avatar == json.march_type as u32)
|
||||
.map(|v| v.to_equipment_relic_proto())
|
||||
.collect(),
|
||||
skilltree_list: (1..=4)
|
||||
.map(|v| AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 1224001,
|
||||
},
|
||||
AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 1224002,
|
||||
},
|
||||
AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 1224003,
|
||||
},
|
||||
AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 1224004,
|
||||
},
|
||||
AvatarSkillTree {
|
||||
level: 1,
|
||||
point_id: 1224005,
|
||||
},
|
||||
],
|
||||
point_id: (json.march_type as u32) * 1000 + v,
|
||||
})
|
||||
.collect(),
|
||||
all_path_special_skilltree_list: vec![],
|
||||
path_equipment_id: 1224,
|
||||
path_equipment_id: json
|
||||
.lightcones
|
||||
.iter()
|
||||
.find(|v| v.equip_avatar == json.march_type as u32)
|
||||
.map(|v| v.internal_uid)
|
||||
.unwrap_or_default(),
|
||||
all_path_unlocked_special_point_id_list: vec![],
|
||||
},
|
||||
],
|
||||
gmhdhimdkfi: vec![],
|
||||
current_multi_path_avatar_id: HashMap::from([
|
||||
(8001, MultiPathAvatarType::GirlShamanType.into()),
|
||||
(1001, MultiPathAvatarType::Mar7thRogueType.into()),
|
||||
(8001, json.main_character.get_type().into()),
|
||||
(1001, json.march_type.get_type().into()),
|
||||
]),
|
||||
},
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ use tokio::sync::Mutex;
|
||||
|
||||
use crate::{
|
||||
net::{
|
||||
tools::{AvatarJson, JsonData, Position},
|
||||
tools::{AvatarJson, FreesrData, Position},
|
||||
tools_res::{PropState, GAME_RESOURCES},
|
||||
},
|
||||
util::{self},
|
||||
@@ -20,7 +20,7 @@ pub async fn on_get_cur_scene_info_cs_req(
|
||||
session: &mut PlayerSession,
|
||||
_body: &GetCurSceneInfoCsReq,
|
||||
) -> Result<()> {
|
||||
let mut player = JsonData::load().await;
|
||||
let mut player = FreesrData::load().await;
|
||||
let entry = player.scene.entry_id;
|
||||
|
||||
let scene = load_scene(session, &mut player, entry, false, Option::<u32>::None).await;
|
||||
@@ -63,7 +63,7 @@ pub async fn on_enter_scene_cs_req(
|
||||
session: &mut PlayerSession,
|
||||
request: &EnterSceneCsReq,
|
||||
) -> Result<()> {
|
||||
let mut player = JsonData::load().await;
|
||||
let mut player = FreesrData::load().await;
|
||||
|
||||
// send packet first
|
||||
session
|
||||
@@ -169,7 +169,7 @@ pub async fn on_scene_entity_move_cs_req(
|
||||
session: &mut PlayerSession,
|
||||
request: &SceneEntityMoveCsReq,
|
||||
) -> Result<()> {
|
||||
let mut player = JsonData::load().await;
|
||||
let mut player = FreesrData::load().await;
|
||||
let mut timestamp = NEXT_SCENE_SAVE.lock().await;
|
||||
|
||||
if util::cur_timestamp_ms() <= *timestamp {
|
||||
@@ -236,7 +236,7 @@ pub async fn on_get_entered_scene_cs_req(
|
||||
|
||||
async fn load_scene(
|
||||
session: &mut PlayerSession,
|
||||
json: &mut JsonData,
|
||||
json: &mut FreesrData,
|
||||
entry_id: u32,
|
||||
_save: bool,
|
||||
teleport_id: Option<u32>,
|
||||
|
||||
+40
-22
@@ -129,7 +129,7 @@ impl AvatarJson {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_lineup_avatars(player: &JsonData) -> Vec<LineupAvatar> {
|
||||
pub fn to_lineup_avatars(player: &FreesrData) -> Vec<LineupAvatar> {
|
||||
let avatar_ids = player
|
||||
.avatars
|
||||
.values()
|
||||
@@ -479,7 +479,7 @@ impl Position {
|
||||
|
||||
// FREESR-DATA.json
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct JsonData {
|
||||
pub struct FreesrData {
|
||||
pub lightcones: Vec<Lightcone>,
|
||||
pub relics: Vec<Relic>,
|
||||
pub avatars: BTreeMap<u32, AvatarJson>,
|
||||
@@ -493,11 +493,13 @@ pub struct JsonData {
|
||||
#[serde(default)]
|
||||
pub scene: Scene,
|
||||
#[serde(default)]
|
||||
pub main_character: MainCharacter,
|
||||
pub main_character: MultiPathAvatar,
|
||||
#[serde(default)]
|
||||
pub march_type: MultiPathAvatar,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct JsonData2 {
|
||||
pub struct Persistent {
|
||||
#[serde(default)]
|
||||
pub lineups: BTreeMap<u32, u32>,
|
||||
#[serde(default)]
|
||||
@@ -505,10 +507,12 @@ pub struct JsonData2 {
|
||||
#[serde(default)]
|
||||
pub scene: Scene,
|
||||
#[serde(default)]
|
||||
pub main_character: MainCharacter,
|
||||
pub main_character: MultiPathAvatar,
|
||||
#[serde(default)]
|
||||
pub march_type: MultiPathAvatar,
|
||||
}
|
||||
|
||||
impl Default for JsonData2 {
|
||||
impl Default for Persistent {
|
||||
fn default() -> Self {
|
||||
let mut lineups = BTreeMap::<u32, u32>::new();
|
||||
lineups.insert(0, 8006);
|
||||
@@ -521,21 +525,24 @@ impl Default for JsonData2 {
|
||||
position: Default::default(),
|
||||
main_character: Default::default(),
|
||||
scene: Default::default(),
|
||||
march_type: MultiPathAvatar::MarchHunt,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Copy)]
|
||||
pub enum MainCharacter {
|
||||
pub enum MultiPathAvatar {
|
||||
MalePyhsical = 8001,
|
||||
FemalePhysical = 8002,
|
||||
MalePreservation = 8003,
|
||||
FemalePreservation = 8004,
|
||||
MaleHarmony = 8005,
|
||||
FemaleHarmony = 8006,
|
||||
MarchHunt = 1224,
|
||||
MarchPreservation = 1001,
|
||||
}
|
||||
|
||||
impl From<u32> for MainCharacter {
|
||||
impl From<u32> for MultiPathAvatar {
|
||||
fn from(value: u32) -> Self {
|
||||
match value {
|
||||
8001 => Self::MalePyhsical,
|
||||
@@ -544,14 +551,18 @@ impl From<u32> for MainCharacter {
|
||||
8004 => Self::FemalePreservation,
|
||||
8005 => Self::MaleHarmony,
|
||||
8006 => Self::FemaleHarmony,
|
||||
1224 => Self::MarchHunt,
|
||||
1001 => Self::MarchPreservation,
|
||||
_ => Self::FemaleHarmony,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MainCharacter {
|
||||
impl MultiPathAvatar {
|
||||
pub fn get_gender(&self) -> Gender {
|
||||
if *self as u32 % 2 == 1 {
|
||||
if (*self as u32) < 8000 {
|
||||
Gender::None
|
||||
} else if *self as u32 % 2 == 1 {
|
||||
Gender::Man
|
||||
} else {
|
||||
Gender::Woman
|
||||
@@ -560,33 +571,35 @@ impl MainCharacter {
|
||||
|
||||
pub fn get_type(&self) -> MultiPathAvatarType {
|
||||
match *self {
|
||||
Self::MalePyhsical => MultiPathAvatarType::BoyWarriorType,
|
||||
Self::FemalePhysical => MultiPathAvatarType::GirlWarriorType,
|
||||
Self::MalePreservation => MultiPathAvatarType::BoyKnightType,
|
||||
Self::FemalePreservation => MultiPathAvatarType::GirlKnightType,
|
||||
Self::MaleHarmony => MultiPathAvatarType::BoyShamanType,
|
||||
Self::FemaleHarmony => MultiPathAvatarType::GirlShamanType,
|
||||
MultiPathAvatar::MalePyhsical => MultiPathAvatarType::BoyWarriorType,
|
||||
MultiPathAvatar::FemalePhysical => MultiPathAvatarType::GirlWarriorType,
|
||||
MultiPathAvatar::MalePreservation => MultiPathAvatarType::BoyKnightType,
|
||||
MultiPathAvatar::FemalePreservation => MultiPathAvatarType::GirlKnightType,
|
||||
MultiPathAvatar::MaleHarmony => MultiPathAvatarType::BoyShamanType,
|
||||
MultiPathAvatar::FemaleHarmony => MultiPathAvatarType::GirlShamanType,
|
||||
MultiPathAvatar::MarchHunt => MultiPathAvatarType::Mar7thRogueType,
|
||||
MultiPathAvatar::MarchPreservation => MultiPathAvatarType::Mar7thKnightType,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for MainCharacter {
|
||||
impl Default for MultiPathAvatar {
|
||||
fn default() -> Self {
|
||||
Self::FemaleHarmony
|
||||
}
|
||||
}
|
||||
|
||||
impl JsonData {
|
||||
impl FreesrData {
|
||||
pub async fn load() -> Self {
|
||||
let mut json: JsonData = tokio::fs::read_to_string("freesr-data.json")
|
||||
let mut json: FreesrData = tokio::fs::read_to_string("freesr-data.json")
|
||||
.await
|
||||
.map(|v| {
|
||||
serde_json::from_str::<JsonData>(&v)
|
||||
serde_json::from_str::<FreesrData>(&v)
|
||||
.expect("freesr-data.json is broken, pls redownload")
|
||||
})
|
||||
.expect("failed to read freesr-data.json");
|
||||
|
||||
let json2: JsonData2 = serde_json::from_str(
|
||||
let json2: Persistent = serde_json::from_str(
|
||||
&tokio::fs::read_to_string("persistent")
|
||||
.await
|
||||
.unwrap_or_default(),
|
||||
@@ -600,6 +613,10 @@ impl JsonData {
|
||||
|
||||
json.verify_lineup().await;
|
||||
|
||||
if json.march_type as u32 > 8000 {
|
||||
json.march_type = MultiPathAvatar::MarchHunt;
|
||||
}
|
||||
|
||||
json
|
||||
}
|
||||
|
||||
@@ -623,11 +640,12 @@ impl JsonData {
|
||||
let _ = tokio::fs::write("freesr-data.json", json.as_bytes()).await;
|
||||
let _ = tokio::fs::write(
|
||||
"persistent",
|
||||
serde_json::to_string_pretty(&JsonData2 {
|
||||
serde_json::to_string_pretty(&Persistent {
|
||||
lineups: self.lineups.clone(),
|
||||
main_character: self.main_character,
|
||||
position: self.position.clone(),
|
||||
scene: self.scene.clone(),
|
||||
march_type: self.march_type,
|
||||
})
|
||||
.unwrap()
|
||||
.as_bytes(),
|
||||
|
||||
+255
-240
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@ pub struct VersionConfig {
|
||||
pub asset_bundle_url: String,
|
||||
pub ex_resource_url: String,
|
||||
pub lua_url: String,
|
||||
pub lua_version: String,
|
||||
// pub lua_version: String,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
|
||||
Reference in New Issue
Block a user