?
This commit is contained in:
@@ -24,7 +24,7 @@ pub async fn on_start_cocoon_stage_cs_req(
|
|||||||
if **avatar_id == 0 {
|
if **avatar_id == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if let Some(avatar) = player.avatars.get(&avatar_id) {
|
if let Some(avatar) = player.avatars.get(avatar_id) {
|
||||||
let (battle_avatar, techs) = avatar.to_battle_avatar_proto(
|
let (battle_avatar, techs) = avatar.to_battle_avatar_proto(
|
||||||
i,
|
i,
|
||||||
player
|
player
|
||||||
@@ -47,7 +47,7 @@ pub async fn on_start_cocoon_stage_cs_req(
|
|||||||
// custom stats for avatars
|
// custom stats for avatars
|
||||||
for stat in &player.battle_config.custom_stats {
|
for stat in &player.battle_config.custom_stats {
|
||||||
for avatar in &mut battle_info.battle_avatar_list {
|
for avatar in &mut battle_info.battle_avatar_list {
|
||||||
if avatar.relic_list.len() == 0 {
|
if avatar.relic_list.is_empty() {
|
||||||
avatar.relic_list.push(BattleRelic {
|
avatar.relic_list.push(BattleRelic {
|
||||||
id: 61011,
|
id: 61011,
|
||||||
main_affix_id: 1,
|
main_affix_id: 1,
|
||||||
@@ -184,7 +184,7 @@ pub async fn on_mpemgbdkigg(session: &mut PlayerSession, request: &Mpemgbdkigg)
|
|||||||
if **avatar_id == 0 {
|
if **avatar_id == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if let Some(avatar) = player.avatars.get(&avatar_id) {
|
if let Some(avatar) = player.avatars.get(avatar_id) {
|
||||||
let (battle_avatar, techs) = avatar.to_battle_avatar_proto(
|
let (battle_avatar, techs) = avatar.to_battle_avatar_proto(
|
||||||
i,
|
i,
|
||||||
player
|
player
|
||||||
@@ -207,7 +207,7 @@ pub async fn on_mpemgbdkigg(session: &mut PlayerSession, request: &Mpemgbdkigg)
|
|||||||
// custom stats for avatars
|
// custom stats for avatars
|
||||||
for stat in &player.battle_config.custom_stats {
|
for stat in &player.battle_config.custom_stats {
|
||||||
for avatar in &mut battle_info.battle_avatar_list {
|
for avatar in &mut battle_info.battle_avatar_list {
|
||||||
if avatar.relic_list.len() == 0 {
|
if avatar.relic_list.is_empty() {
|
||||||
avatar.relic_list.push(BattleRelic {
|
avatar.relic_list.push(BattleRelic {
|
||||||
id: 61011,
|
id: 61011,
|
||||||
main_affix_id: 1,
|
main_affix_id: 1,
|
||||||
@@ -317,7 +317,5 @@ pub async fn on_mpemgbdkigg(session: &mut PlayerSession, request: &Mpemgbdkigg)
|
|||||||
|
|
||||||
resp.battle_info = Some(battle_info);
|
resp.battle_info = Some(battle_info);
|
||||||
|
|
||||||
session.send(CMD_SCENE_CAST_SKILL_SC_RSP, resp).await?;
|
session.send(CMD_SCENE_CAST_SKILL_SC_RSP, resp).await
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ pub async fn on_get_all_lineup_data_cs_req(
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
session
|
session
|
||||||
.send(
|
.send(
|
||||||
CMD_GET_ALL_LINEUP_DATA_SC_RSP,
|
CMD_GET_ALL_LINEUP_DATA_SC_RSP,
|
||||||
@@ -33,7 +32,7 @@ pub async fn on_get_cur_lineup_data_cs_req(
|
|||||||
_body: &GetCurLineupDataCsReq,
|
_body: &GetCurLineupDataCsReq,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let player = tools::JsonData::load().await;
|
let player = tools::JsonData::load().await;
|
||||||
let mut lineup = LineupInfo {
|
let mut lineup = LineupInfo {
|
||||||
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
||||||
name: "Squad 1".to_string(),
|
name: "Squad 1".to_string(),
|
||||||
njjbfegnhjc: 5,
|
njjbfegnhjc: 5,
|
||||||
@@ -43,8 +42,8 @@ pub async fn on_get_cur_lineup_data_cs_req(
|
|||||||
|
|
||||||
let avatar_ids = player
|
let avatar_ids = player
|
||||||
.avatars
|
.avatars
|
||||||
.iter()
|
.values()
|
||||||
.map(|(_, v)| v.avatar_id)
|
.map(|v| v.avatar_id)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut avatars = player
|
let mut avatars = player
|
||||||
@@ -62,7 +61,6 @@ pub async fn on_get_cur_lineup_data_cs_req(
|
|||||||
|
|
||||||
lineup.avatar_list.append(&mut avatars);
|
lineup.avatar_list.append(&mut avatars);
|
||||||
|
|
||||||
|
|
||||||
session
|
session
|
||||||
.send(
|
.send(
|
||||||
CMD_GET_CUR_LINEUP_DATA_SC_RSP,
|
CMD_GET_CUR_LINEUP_DATA_SC_RSP,
|
||||||
@@ -78,30 +76,31 @@ pub async fn on_join_lineup_cs_req(
|
|||||||
session: &mut PlayerSession,
|
session: &mut PlayerSession,
|
||||||
body: &JoinLineupCsReq,
|
body: &JoinLineupCsReq,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
|
||||||
// update lineups
|
// update lineups
|
||||||
// TODO: FIX THESE SHIT
|
// TODO: FIX THESE SHIT
|
||||||
{
|
{
|
||||||
let mut player = tools::JsonData::load().await;
|
let mut player = tools::JsonData::load().await;
|
||||||
let lineups = &mut player.lineups;
|
let lineups = &mut player.lineups;
|
||||||
lineups.insert(body.slot, if body.base_avatar_id > 8000 {
|
lineups.insert(
|
||||||
player.main_character as u32
|
body.slot,
|
||||||
} else {
|
if body.base_avatar_id > 8000 {
|
||||||
body.base_avatar_id
|
player.main_character as u32
|
||||||
});
|
} else {
|
||||||
|
body.base_avatar_id
|
||||||
|
},
|
||||||
|
);
|
||||||
player.save_lineup().await;
|
player.save_lineup().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
let player = tools::JsonData::load().await;
|
let player = tools::JsonData::load().await;
|
||||||
|
|
||||||
refresh_lineup(session,&player).await?;
|
refresh_lineup(session, &player).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.send(CMD_JOIN_LINEUP_SC_RSP, JoinLineupScRsp::default())
|
session
|
||||||
.await?;
|
.send(CMD_JOIN_LINEUP_SC_RSP, JoinLineupScRsp::default())
|
||||||
|
.await
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn on_replace_lineup_cs_req(
|
pub async fn on_replace_lineup_cs_req(
|
||||||
@@ -116,7 +115,7 @@ pub async fn on_replace_lineup_cs_req(
|
|||||||
if let Some(lineup) = req.jkifflmenfn.get(*slot as usize) {
|
if let Some(lineup) = req.jkifflmenfn.get(*slot as usize) {
|
||||||
*avatar_id = if lineup.id > 8000 {
|
*avatar_id = if lineup.id > 8000 {
|
||||||
player.main_character as u32
|
player.main_character as u32
|
||||||
} else {
|
} else {
|
||||||
lineup.id
|
lineup.id
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@@ -132,30 +131,25 @@ pub async fn on_replace_lineup_cs_req(
|
|||||||
refresh_lineup(_session, &player).await?;
|
refresh_lineup(_session, &player).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
_session.send(CMD_JOIN_LINEUP_SC_RSP, JoinLineupScRsp::default())
|
_session
|
||||||
.await?;
|
.send(CMD_JOIN_LINEUP_SC_RSP, JoinLineupScRsp::default())
|
||||||
|
.await
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn on_quit_lineup_cs_req(
|
pub async fn on_quit_lineup_cs_req(
|
||||||
_session: &mut PlayerSession,
|
_session: &mut PlayerSession,
|
||||||
_: &QuitLineupCsReq,
|
_: &QuitLineupCsReq,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
_session.send(CMD_JOIN_LINEUP_SC_RSP, JoinLineupScRsp::default())
|
_session
|
||||||
.await?;
|
.send(CMD_JOIN_LINEUP_SC_RSP, JoinLineupScRsp::default())
|
||||||
|
.await
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn refresh_lineup(
|
async fn refresh_lineup(sess: &mut PlayerSession, player: &JsonData) -> Result<()> {
|
||||||
sess: &mut PlayerSession,
|
|
||||||
player: &JsonData
|
|
||||||
) -> Result<()> {
|
|
||||||
let lineup = LineupInfo {
|
let lineup = LineupInfo {
|
||||||
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
||||||
name: "Squad 1".to_string(),
|
name: "Squad 1".to_string(),
|
||||||
avatar_list: AvatarJson::to_lineup_avatars(&player),
|
avatar_list: AvatarJson::to_lineup_avatars(player),
|
||||||
njjbfegnhjc: 5,
|
njjbfegnhjc: 5,
|
||||||
bpkggopoppf: 5,
|
bpkggopoppf: 5,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@@ -165,12 +159,10 @@ async fn refresh_lineup(
|
|||||||
CMD_SYNC_LINEUP_NOTIFY,
|
CMD_SYNC_LINEUP_NOTIFY,
|
||||||
SyncLineupNotify {
|
SyncLineupNotify {
|
||||||
lineup: Some(lineup),
|
lineup: Some(lineup),
|
||||||
reason_list: vec![]
|
reason_list: vec![],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn on_change_lineup_leader_cs_req(
|
pub async fn on_change_lineup_leader_cs_req(
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ pub async fn on_get_cur_scene_info_cs_req(
|
|||||||
_body: &GetCurSceneInfoCsReq,
|
_body: &GetCurSceneInfoCsReq,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut player = JsonData::load().await;
|
let mut player = JsonData::load().await;
|
||||||
let entry = player.scene.entry_id.clone();
|
let entry = player.scene.entry_id;
|
||||||
|
|
||||||
let scene = load_scene(session, &mut player, entry, false, Option::<u32>::None).await;
|
let scene = load_scene(session, &mut player, entry, false, Option::<u32>::None).await;
|
||||||
|
|
||||||
@@ -66,14 +66,14 @@ pub async fn on_lckgkdehclb(session: &mut PlayerSession, request: &Lckgkdehclb)
|
|||||||
.send(CMD_ENTER_SCENE_SC_RSP, Dummy::default())
|
.send(CMD_ENTER_SCENE_SC_RSP, Dummy::default())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let _ = load_scene(
|
load_scene(
|
||||||
session,
|
session,
|
||||||
&mut player,
|
&mut player,
|
||||||
request.entry_id,
|
request.entry_id,
|
||||||
true,
|
true,
|
||||||
Some(request.maplanefddc),
|
Some(request.maplanefddc),
|
||||||
)
|
)
|
||||||
.await;
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -107,16 +107,11 @@ pub async fn on_fkjoeabiioe(sesison: &mut PlayerSession, request: &Fkjoeabiioe)
|
|||||||
map_info.phicefeaigb.push(i)
|
map_info.phicefeaigb.push(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
let group_config = GAME_RESOURCES
|
let group_config = GAME_RESOURCES.map_entrance.get(entry_id).and_then(|v| {
|
||||||
.map_entrance
|
GAME_RESOURCES
|
||||||
.get(&entry_id)
|
.level_group
|
||||||
.map(|v| {
|
.get(&format!("P{}_F{}", v.plane_id, v.floor_id))
|
||||||
GAME_RESOURCES
|
});
|
||||||
.level_group
|
|
||||||
.get(&format!("P{}_F{}", v.plane_id, v.floor_id))
|
|
||||||
})
|
|
||||||
.flatten();
|
|
||||||
|
|
||||||
if let Some(level) = group_config {
|
if let Some(level) = group_config {
|
||||||
// add teleports
|
// add teleports
|
||||||
for teleport in &level.teleports {
|
for teleport in &level.teleports {
|
||||||
@@ -138,7 +133,7 @@ pub async fn on_fkjoeabiioe(sesison: &mut PlayerSession, request: &Fkjoeabiioe)
|
|||||||
} else {
|
} else {
|
||||||
prop.state.clone() as u32
|
prop.state.clone() as u32
|
||||||
},
|
},
|
||||||
ifjocipnpgd: prop.id as u32,
|
ifjocipnpgd: prop.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,9 +200,7 @@ pub async fn on_scene_entity_move_cs_req(
|
|||||||
player.save().await;
|
player.save().await;
|
||||||
session
|
session
|
||||||
.send(CMD_SCENE_ENTITY_MOVE_SC_RSP, Dummy::default())
|
.send(CMD_SCENE_ENTITY_MOVE_SC_RSP, Dummy::default())
|
||||||
.await?;
|
.await
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type GetEnteredSceneCsReq = Dummy;
|
pub type GetEnteredSceneCsReq = Dummy;
|
||||||
@@ -219,7 +212,7 @@ pub async fn on_get_entered_scene_cs_req(
|
|||||||
.map_entrance
|
.map_entrance
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|(_, v)| {
|
.filter(|(_, v)| {
|
||||||
v.finish_main_mission_list.len() > 0 || v.finish_sub_mission_list.len() > 0
|
!v.finish_main_mission_list.is_empty() || !v.finish_sub_mission_list.is_empty()
|
||||||
})
|
})
|
||||||
.map(|(_, v)| Lpllljogfeh {
|
.map(|(_, v)| Lpllljogfeh {
|
||||||
floor_id: v.floor_id,
|
floor_id: v.floor_id,
|
||||||
@@ -235,8 +228,7 @@ pub async fn on_get_entered_scene_cs_req(
|
|||||||
retcode: 0,
|
retcode: 0,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// getunlockteleportcsreq
|
// getunlockteleportcsreq
|
||||||
@@ -272,8 +264,7 @@ async fn load_scene(
|
|||||||
let anchor = group_config
|
let anchor = group_config
|
||||||
.group_items
|
.group_items
|
||||||
.get(&teleport.anchor_group_id.unwrap_or_default())
|
.get(&teleport.anchor_group_id.unwrap_or_default())
|
||||||
.map(|v| v.anchors.get(&teleport.anchor_id.unwrap_or_default()))
|
.and_then(|v| v.anchors.get(&teleport.anchor_id.unwrap_or_default()));
|
||||||
.flatten();
|
|
||||||
if let Some(anchor) = anchor {
|
if let Some(anchor) = anchor {
|
||||||
position.x = (anchor.pos_x * 1000f64) as i32;
|
position.x = (anchor.pos_x * 1000f64) as i32;
|
||||||
position.y = (anchor.pos_y * 1000f64) as i32;
|
position.y = (anchor.pos_y * 1000f64) as i32;
|
||||||
@@ -284,8 +275,8 @@ async fn load_scene(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut scene_info = SceneInfo {
|
let mut scene_info = SceneInfo {
|
||||||
floor_id: enterance.floor_id as u32,
|
floor_id: enterance.floor_id,
|
||||||
plane_id: enterance.plane_id as u32,
|
plane_id: enterance.plane_id,
|
||||||
entry_id,
|
entry_id,
|
||||||
game_mode_type: plane.plane_type as u32,
|
game_mode_type: plane.plane_type as u32,
|
||||||
pbfgagecpcd: plane.world_id,
|
pbfgagecpcd: plane.world_id,
|
||||||
@@ -338,7 +329,7 @@ async fn load_scene(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let entity_info = SceneEntityInfo {
|
let entity_info = SceneEntityInfo {
|
||||||
inst_id: prop.id as u32,
|
inst_id: prop.id,
|
||||||
group_id: prop.group_id,
|
group_id: prop.group_id,
|
||||||
motion: Some(prop_position.to_motion()),
|
motion: Some(prop_position.to_motion()),
|
||||||
prop: Some(ScenePropInfo {
|
prop: Some(ScenePropInfo {
|
||||||
@@ -355,13 +346,11 @@ async fn load_scene(
|
|||||||
|
|
||||||
// Load NPCs
|
// Load NPCs
|
||||||
for npc in &group.npcs {
|
for npc in &group.npcs {
|
||||||
if loaded_npc.contains(&(npc.npcid as u32))
|
if loaded_npc.contains(&(npc.npcid)) || json.avatars.contains_key(&(npc.npcid)) {
|
||||||
|| json.avatars.contains_key(&(npc.npcid as u32))
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
npc_entity_id += 1;
|
npc_entity_id += 1;
|
||||||
loaded_npc.push(npc.npcid as u32);
|
loaded_npc.push(npc.npcid);
|
||||||
|
|
||||||
let npc_position = Position {
|
let npc_position = Position {
|
||||||
x: (npc.pos_x * 1000f64) as i32,
|
x: (npc.pos_x * 1000f64) as i32,
|
||||||
@@ -371,12 +360,12 @@ async fn load_scene(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let info = SceneEntityInfo {
|
let info = SceneEntityInfo {
|
||||||
inst_id: npc.id as u32,
|
inst_id: npc.id,
|
||||||
group_id: npc.group_id,
|
group_id: npc.group_id,
|
||||||
entity_id: npc_entity_id,
|
entity_id: npc_entity_id,
|
||||||
motion: Some(npc_position.to_motion()),
|
motion: Some(npc_position.to_motion()),
|
||||||
npc: Some(SceneNpcInfo {
|
npc: Some(SceneNpcInfo {
|
||||||
egeneneoadj: npc.npcid as u32,
|
egeneneoadj: npc.npcid,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@@ -396,14 +385,14 @@ async fn load_scene(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let npc_monster = SceneNpcMonsterInfo {
|
let npc_monster = SceneNpcMonsterInfo {
|
||||||
monster_id: monster.npcmonster_id as u32,
|
monster_id: monster.npcmonster_id,
|
||||||
event_id: monster.event_id as u32,
|
event_id: monster.event_id,
|
||||||
world_level: 6,
|
world_level: 6,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let info = SceneEntityInfo {
|
let info = SceneEntityInfo {
|
||||||
inst_id: monster.id as u32,
|
inst_id: monster.id,
|
||||||
group_id: monster.group_id,
|
group_id: monster.group_id,
|
||||||
entity_id: monster_entity_id,
|
entity_id: monster_entity_id,
|
||||||
motion: Some(monster_position.to_motion()),
|
motion: Some(monster_position.to_motion()),
|
||||||
@@ -477,8 +466,8 @@ async fn load_scene(
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
json.scene.entry_id = entry_id;
|
json.scene.entry_id = entry_id;
|
||||||
json.scene.floor_id = enterance.floor_id as u32;
|
json.scene.floor_id = enterance.floor_id;
|
||||||
json.scene.plane_id = enterance.plane_id as u32;
|
json.scene.plane_id = enterance.plane_id;
|
||||||
json.position.x = position.x;
|
json.position.x = position.x;
|
||||||
json.position.y = position.y;
|
json.position.y = position.y;
|
||||||
json.position.z = position.z;
|
json.position.z = position.z;
|
||||||
@@ -486,5 +475,5 @@ async fn load_scene(
|
|||||||
json.save().await;
|
json.save().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(scene_info);
|
Ok(scene_info)
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-17
@@ -28,7 +28,6 @@ pub struct AvatarData {
|
|||||||
pub skills: BTreeMap<u32, u32>,
|
pub skills: BTreeMap<u32, u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
impl AvatarJson {
|
impl AvatarJson {
|
||||||
pub fn to_avatar_proto(&self, lightcone: Option<&Lightcone>, relics: Vec<&Relic>) -> Avatar {
|
pub fn to_avatar_proto(&self, lightcone: Option<&Lightcone>, relics: Vec<&Relic>) -> Avatar {
|
||||||
Avatar {
|
Avatar {
|
||||||
@@ -105,7 +104,7 @@ impl AvatarJson {
|
|||||||
for buff_id in &self.techniques {
|
for buff_id in &self.techniques {
|
||||||
battle_buff.push(BattleBuff {
|
battle_buff.push(BattleBuff {
|
||||||
wave_flag: 0xffffffff,
|
wave_flag: 0xffffffff,
|
||||||
owner_index: index as u32,
|
owner_index: index,
|
||||||
level: 1,
|
level: 1,
|
||||||
id: *buff_id,
|
id: *buff_id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@@ -132,8 +131,8 @@ impl AvatarJson {
|
|||||||
pub fn to_lineup_avatars(player: &JsonData) -> Vec<LineupAvatar> {
|
pub fn to_lineup_avatars(player: &JsonData) -> Vec<LineupAvatar> {
|
||||||
let avatar_ids = player
|
let avatar_ids = player
|
||||||
.avatars
|
.avatars
|
||||||
.iter()
|
.values()
|
||||||
.map(|(_, v)| &v.avatar_id)
|
.map(|v| &v.avatar_id)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
player
|
player
|
||||||
@@ -159,7 +158,7 @@ impl AvatarJson {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for (_, id) in lineups {
|
for id in lineups.values() {
|
||||||
if *id == 0 {
|
if *id == 0 {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -194,7 +193,6 @@ pub struct Lightcone {
|
|||||||
pub internal_uid: u32,
|
pub internal_uid: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
impl Lightcone {
|
impl Lightcone {
|
||||||
pub fn to_equipment_proto(&self) -> Equipment {
|
pub fn to_equipment_proto(&self) -> Equipment {
|
||||||
Equipment {
|
Equipment {
|
||||||
@@ -208,7 +206,6 @@ impl Lightcone {
|
|||||||
tid: self.item_id,
|
tid: self.item_id,
|
||||||
// ?
|
// ?
|
||||||
unique_id: 2000 + self.internal_uid,
|
unique_id: 2000 + self.internal_uid,
|
||||||
..Default::default()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +245,6 @@ pub struct SubAffix {
|
|||||||
pub step: u32,
|
pub step: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
impl Relic {
|
impl Relic {
|
||||||
pub fn to_relic_proto(&self) -> proto::Relic {
|
pub fn to_relic_proto(&self) -> proto::Relic {
|
||||||
proto::Relic {
|
proto::Relic {
|
||||||
@@ -312,7 +308,6 @@ pub struct Monster {
|
|||||||
pub max_hp: u32,
|
pub max_hp: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
impl Monster {
|
impl Monster {
|
||||||
fn to_scene_monster_info(&self) -> SceneMonsterParam {
|
fn to_scene_monster_info(&self) -> SceneMonsterParam {
|
||||||
SceneMonsterParam {
|
SceneMonsterParam {
|
||||||
@@ -322,9 +317,9 @@ impl Monster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_scene_monster_wave(wave_index: u32, monsters: &Vec<Self>) -> SceneMonsterWave {
|
pub fn to_scene_monster_wave(wave_index: u32, monsters: &[Self]) -> SceneMonsterWave {
|
||||||
let mut wave_index = wave_index;
|
let mut wave_index = wave_index;
|
||||||
if wave_index <= 0 {
|
if wave_index < 1 {
|
||||||
wave_index += 1;
|
wave_index += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +340,7 @@ impl Monster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_scene_monster_waves(monsters: &Vec<Vec<Self>>) -> Vec<SceneMonsterWave> {
|
pub fn to_scene_monster_waves(monsters: &[Vec<Self>]) -> Vec<SceneMonsterWave> {
|
||||||
monsters
|
monsters
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
@@ -386,15 +381,17 @@ impl Default for BattleConfig {
|
|||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||||
pub enum BattleType {
|
pub enum BattleType {
|
||||||
DEFAULT = 0,
|
#[serde(alias = "DEFAULT")]
|
||||||
MOC = 1,
|
Default = 0,
|
||||||
|
#[serde(alias = "MOC")]
|
||||||
|
Moc = 1,
|
||||||
PF = 2,
|
PF = 2,
|
||||||
SU = 3,
|
SU = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BattleType {
|
impl Default for BattleType {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::DEFAULT
|
Self::Default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +456,7 @@ pub struct Position {
|
|||||||
|
|
||||||
impl Position {
|
impl Position {
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
return self.x == 0 && self.y == 0 && self.z == 0;
|
self.x == 0 && self.y == 0 && self.z == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_motion(&self) -> MotionInfo {
|
pub fn to_motion(&self) -> MotionInfo {
|
||||||
@@ -604,7 +601,7 @@ impl JsonData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn verify_lineup(&mut self) {
|
async fn verify_lineup(&mut self) {
|
||||||
if self.lineups.len() == 0 {
|
if self.lineups.is_empty() {
|
||||||
self.lineups = BTreeMap::<u32, u32>::from([(0, 8006), (1, 0), (2, 0), (3, 0)])
|
self.lineups = BTreeMap::<u32, u32>::from([(0, 8006), (1, 0), (2, 0), (3, 0)])
|
||||||
} else if self.lineups.len() < 4 {
|
} else if self.lineups.len() < 4 {
|
||||||
for i in self.lineups.len()..4 {
|
for i in self.lineups.len()..4 {
|
||||||
|
|||||||
@@ -263,16 +263,16 @@ impl Default for PlaneType {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct MazeProp {
|
pub struct MazeProp {
|
||||||
#[serde(rename = "ID")]
|
#[serde(rename = "ID")]
|
||||||
pub id: i64,
|
pub id: u32,
|
||||||
#[serde(rename = "PropType")]
|
#[serde(rename = "PropType")]
|
||||||
pub prop_type: String,
|
pub prop_type: String,
|
||||||
#[serde(rename = "PropStateList")]
|
#[serde(rename = "PropStateList")]
|
||||||
pub prop_state_list: Vec<PropState>,
|
pub prop_state_list: Vec<PropState>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
|
||||||
pub enum PropState {
|
pub enum PropState {
|
||||||
Closed = 0,
|
#[default] Closed = 0,
|
||||||
Open = 1,
|
Open = 1,
|
||||||
Locked = 2,
|
Locked = 2,
|
||||||
BridgeState1 = 3,
|
BridgeState1 = 3,
|
||||||
@@ -309,12 +309,6 @@ pub enum PropState {
|
|||||||
CustomState09 = 109,
|
CustomState09 = 109,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PropState {
|
|
||||||
fn default() -> Self {
|
|
||||||
PropState::Closed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub type IntMap<T> = HashMap<u32, T>;
|
pub type IntMap<T> = HashMap<u32, T>;
|
||||||
pub type StringMap<T> = HashMap<String, T>;
|
pub type StringMap<T> = HashMap<String, T>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user