fix resources
This commit is contained in:
@@ -100,9 +100,7 @@ pub async fn on_start_cocoon_stage_cs_req(
|
|||||||
|
|
||||||
battle_info.ichnbmifjdi.insert(1, battle_target);
|
battle_info.ichnbmifjdi.insert(1, battle_target);
|
||||||
for i in 2..=4 {
|
for i in 2..=4 {
|
||||||
battle_info
|
battle_info.ichnbmifjdi.insert(i, Hbinjjdphdo::default());
|
||||||
.ichnbmifjdi
|
|
||||||
.insert(i, Hbinjjdphdo::default());
|
|
||||||
}
|
}
|
||||||
battle_info.ichnbmifjdi.insert(
|
battle_info.ichnbmifjdi.insert(
|
||||||
5,
|
5,
|
||||||
@@ -125,18 +123,16 @@ pub async fn on_start_cocoon_stage_cs_req(
|
|||||||
|
|
||||||
// SU
|
// SU
|
||||||
if player.battle_config.battle_type == BattleType::SU {
|
if player.battle_config.battle_type == BattleType::SU {
|
||||||
battle_info
|
battle_info.mpobegkcikn.push(Npjnkmmjfdf {
|
||||||
.mpobegkcikn
|
chgdaadjepi: player.battle_config.path_resonance_id,
|
||||||
.push(Npjnkmmjfdf {
|
status: Some(Agpocmnmmdi {
|
||||||
chgdaadjepi: player.battle_config.path_resonance_id,
|
sp: Some(AmountInfo {
|
||||||
status: Some(Agpocmnmmdi {
|
cur_amount: 10_000,
|
||||||
sp: Some(AmountInfo {
|
max_amount: 10_000,
|
||||||
cur_amount: 10_000,
|
|
||||||
max_amount: 10_000,
|
|
||||||
}),
|
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
}),
|
||||||
})
|
..Default::default()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// monsters
|
// monsters
|
||||||
@@ -309,10 +305,18 @@ pub async fn on_mpemgbdkigg(session: &mut PlayerSession, request: &Mpemgbdkigg)
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
if request.hjopkcdlmln.len() > 0 && request.oknicldeddl <= 4 {
|
let targets = request
|
||||||
resp.battle_info = Some(battle_info)
|
.jpieajikioh
|
||||||
|
.iter()
|
||||||
|
.filter(|id| **id > 20_000 || **id < 10)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
if targets.is_empty() {
|
||||||
|
return session.send(CMD_SCENE_CAST_SKILL_SC_RSP, resp).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(())
|
Ok(())
|
||||||
|
|||||||
@@ -118,4 +118,5 @@ dummy! {
|
|||||||
GetCurBattleInfo,
|
GetCurBattleInfo,
|
||||||
GetPhoneData,
|
GetPhoneData,
|
||||||
PlayerLoginFinish,
|
PlayerLoginFinish,
|
||||||
|
InteractProp
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use tokio::sync::Mutex;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
net::{
|
net::{
|
||||||
tools::{AvatarJson, JsonData},
|
tools::{AvatarJson, JsonData, Position},
|
||||||
tools_res::{PropState, GAME_RESOURCES},
|
tools_res::{PropState, GAME_RESOURCES},
|
||||||
},
|
},
|
||||||
util,
|
util,
|
||||||
@@ -80,71 +80,81 @@ pub async fn on_lckgkdehclb(session: &mut PlayerSession, request: &Lckgkdehclb)
|
|||||||
|
|
||||||
// getscenemapinfocsreq
|
// getscenemapinfocsreq
|
||||||
pub async fn on_fkjoeabiioe(sesison: &mut PlayerSession, request: &Fkjoeabiioe) -> Result<()> {
|
pub async fn on_fkjoeabiioe(sesison: &mut PlayerSession, request: &Fkjoeabiioe) -> Result<()> {
|
||||||
let player = JsonData::load().await;
|
let mut map_infos = Vec::<Fjniajephmj>::new();
|
||||||
|
|
||||||
let back = vec![
|
for entry_id in &request.dmkkkfnkofh {
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
|
let mut map_info = Fjniajephmj {
|
||||||
26, 27, 28, 29, 30, 31, 32, 33, 34, 0,
|
retcode: 0,
|
||||||
];
|
dcbdhkkkpgd: vec![
|
||||||
|
Gbiimoglajl {
|
||||||
|
gommoeicmjg: Kihbdaniehp::MapInfoChestTypeNormal.into(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
Gbiimoglajl {
|
||||||
|
gommoeicmjg: Kihbdaniehp::MapInfoChestTypePuzzle.into(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
Gbiimoglajl {
|
||||||
|
gommoeicmjg: Kihbdaniehp::MapInfoChestTypeChallenge.into(),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
],
|
||||||
|
entry_id: *entry_id,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
let mut map_info = Fjniajephmj {
|
for i in 0..100 {
|
||||||
retcode: 0,
|
map_info.phicefeaigb.push(i)
|
||||||
// lighten section list
|
|
||||||
phicefeaigb: back.clone(),
|
|
||||||
// maze chest
|
|
||||||
dcbdhkkkpgd: vec![
|
|
||||||
Gbiimoglajl {
|
|
||||||
gommoeicmjg: Kihbdaniehp::MapInfoChestTypeNormal.into(),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
Gbiimoglajl {
|
|
||||||
gommoeicmjg: Kihbdaniehp::MapInfoChestTypePuzzle.into(),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
Gbiimoglajl {
|
|
||||||
gommoeicmjg: Kihbdaniehp::MapInfoChestTypeChallenge.into(),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some((level, enterance, _)) = player.get_level_group(request.dmkkkfnkofh[0]).await {
|
|
||||||
// add teleports
|
|
||||||
for teleport in &level.teleports {
|
|
||||||
map_info.ojlnmnehgai.push(*teleport.0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// prop
|
let group_config = GAME_RESOURCES
|
||||||
for prop in &level.props {
|
.map_entrance
|
||||||
let group = Gecjjlmabhp {
|
.get(&entry_id)
|
||||||
group_id: prop.group_id,
|
.map(|v| {
|
||||||
..Default::default()
|
GAME_RESOURCES
|
||||||
};
|
.level_group
|
||||||
if !map_info.pmolfbcbfpe.contains(&group) {
|
.get(&format!("P{}_F{}", v.plane_id, v.floor_id))
|
||||||
map_info.pmolfbcbfpe.push(group);
|
})
|
||||||
|
.flatten();
|
||||||
|
|
||||||
|
if let Some(level) = group_config {
|
||||||
|
// add teleports
|
||||||
|
for teleport in &level.teleports {
|
||||||
|
map_info.ojlnmnehgai.push(*teleport.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
map_info.cgkfbhoadpc.push(Kangcibfhee {
|
for (group_id, group) in &level.group_items {
|
||||||
group_id: prop.group_id,
|
map_info.pmolfbcbfpe.push(Gecjjlmabhp {
|
||||||
state: if prop.prop_state_list.contains(&PropState::CheckPointEnable) {
|
group_id: *group_id,
|
||||||
PropState::CheckPointEnable as u32
|
..Default::default()
|
||||||
} else {
|
});
|
||||||
prop.state.clone() as u32
|
|
||||||
},
|
// prop
|
||||||
ifjocipnpgd: prop.id as u32,
|
for prop in &group.props {
|
||||||
});
|
map_info.cgkfbhoadpc.push(Kangcibfhee {
|
||||||
|
group_id: prop.group_id,
|
||||||
|
state: if prop.prop_state_list.contains(&PropState::CheckPointEnable) {
|
||||||
|
PropState::CheckPointEnable as u32
|
||||||
|
} else {
|
||||||
|
prop.state.clone() as u32
|
||||||
|
},
|
||||||
|
ifjocipnpgd: prop.id as u32,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
map_info.entry_id = enterance.id;
|
// Debug
|
||||||
|
// tokio::fs::write(format!("./text-{}.txt", entry_id), format!("{:#?}", map_info)).await?;
|
||||||
|
map_infos.push(map_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
sesison
|
sesison
|
||||||
.send(
|
.send(
|
||||||
CMD_GET_SCENE_MAP_INFO_SC_RSP,
|
CMD_GET_SCENE_MAP_INFO_SC_RSP,
|
||||||
Cegeebldbke {
|
Cegeebldbke {
|
||||||
retcode: 0,
|
retcode: 0,
|
||||||
mhefdgcamjl: vec![map_info],
|
mhefdgcamjl: map_infos,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -241,220 +251,240 @@ async fn load_scene(
|
|||||||
_save: bool,
|
_save: bool,
|
||||||
teleport_id: Option<u32>,
|
teleport_id: Option<u32>,
|
||||||
) -> Result<SceneInfo> {
|
) -> Result<SceneInfo> {
|
||||||
if let Some((level, enterance, plane)) = json.get_level_group(entry_id).await {
|
let enterance = GAME_RESOURCES
|
||||||
let mut position = json.position.clone();
|
.map_entrance
|
||||||
if let Some(teleport_id) = teleport_id {
|
.get(&entry_id)
|
||||||
if let Some(teleport) = level.teleports.get(&teleport_id) {
|
.ok_or_else(|| anyhow::format_err!("Map Entrance Not Found"))?;
|
||||||
position.x = (teleport.pos_x * 1000f64) as i32;
|
|
||||||
position.y = (teleport.pos_y * 1000f64) as i32;
|
let plane = GAME_RESOURCES
|
||||||
position.z = (teleport.pos_z * 1000f64) as i32;
|
.maze_plane
|
||||||
position.rot_y = (teleport.rot_y * 1000f64) as i32;
|
.get(&enterance.plane_id)
|
||||||
|
.ok_or_else(|| anyhow::format_err!("Map Plane Not Found"))?;
|
||||||
|
|
||||||
|
let group_config = GAME_RESOURCES
|
||||||
|
.level_group
|
||||||
|
.get(&format!("P{}_F{}", enterance.plane_id, enterance.floor_id))
|
||||||
|
.ok_or_else(|| anyhow::format_err!("Group Config Not Found"))?;
|
||||||
|
|
||||||
|
let mut position = json.position.clone();
|
||||||
|
if let Some(teleport_id) = teleport_id {
|
||||||
|
if let Some(teleport) = group_config.teleports.get(&teleport_id) {
|
||||||
|
let anchor = group_config
|
||||||
|
.group_items
|
||||||
|
.get(&teleport.anchor_group_id.unwrap_or_default())
|
||||||
|
.map(|v| v.anchors.get(&teleport.anchor_id.unwrap_or_default()))
|
||||||
|
.flatten();
|
||||||
|
if let Some(anchor) = anchor {
|
||||||
|
position.x = (anchor.pos_x * 1000f64) as i32;
|
||||||
|
position.y = (anchor.pos_y * 1000f64) as i32;
|
||||||
|
position.z = (anchor.pos_z * 1000f64) as i32;
|
||||||
|
position.rot_y = (anchor.rot_y * 1000f64) as i32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut scene_info = SceneInfo {
|
let mut scene_info = SceneInfo {
|
||||||
floor_id: enterance.floor_id as u32,
|
floor_id: enterance.floor_id as u32,
|
||||||
plane_id: enterance.plane_id as u32,
|
plane_id: enterance.plane_id as u32,
|
||||||
entry_id,
|
entry_id,
|
||||||
game_mode_type: plane
|
game_mode_type: plane.plane_type as u32,
|
||||||
.as_ref()
|
pbfgagecpcd: plane.world_id,
|
||||||
.map(|v| v.plane_type)
|
..Default::default()
|
||||||
.unwrap_or(enterance.entrance_type) as u32,
|
};
|
||||||
|
|
||||||
pbfgagecpcd: plane.map(|v| v.world_id).unwrap_or_default(),
|
let lineup_info = AvatarJson::to_lineup_info(&json.lineups);
|
||||||
|
let player_pos = MotionInfo {
|
||||||
|
// rot
|
||||||
|
eiaoiankefd: Some(Vector {
|
||||||
|
baimdminomk: 0,
|
||||||
|
bemlopmcgch: position.rot_y,
|
||||||
|
bagloppgnpb: 0,
|
||||||
|
}),
|
||||||
|
// pos
|
||||||
|
aomilajjmii: Some(Vector {
|
||||||
|
baimdminomk: position.x,
|
||||||
|
bemlopmcgch: position.y,
|
||||||
|
bagloppgnpb: position.z,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut loaded_npc: Vec<u32> = vec![];
|
||||||
|
let mut prop_entity_id = 10;
|
||||||
|
let mut npc_entity_id = 10_000;
|
||||||
|
let mut monster_entity_id = 20_000;
|
||||||
|
|
||||||
|
for (group_id, group) in &group_config.group_items {
|
||||||
|
let mut group_info = Dhkacjhaoid {
|
||||||
|
state: 0,
|
||||||
|
group_id: *group_id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let lineup_info = AvatarJson::to_lineup_info(&json.lineups);
|
// Load Props
|
||||||
let player_pos = MotionInfo {
|
for prop in &group.props {
|
||||||
// rot
|
let prop_state = if prop.prop_state_list.contains(&PropState::CheckPointEnable) {
|
||||||
eiaoiankefd: Some(Vector {
|
PropState::CheckPointEnable
|
||||||
baimdminomk: 0,
|
|
||||||
bemlopmcgch: position.rot_y,
|
|
||||||
bagloppgnpb: 0,
|
|
||||||
}),
|
|
||||||
// pos
|
|
||||||
aomilajjmii: Some(Vector {
|
|
||||||
baimdminomk: position.x,
|
|
||||||
bemlopmcgch: position.y,
|
|
||||||
bagloppgnpb: position.z,
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut entity_id = 10;
|
|
||||||
|
|
||||||
// LOAD PROPS
|
|
||||||
for prop in level.props {
|
|
||||||
entity_id += 1;
|
|
||||||
|
|
||||||
let prop_state = if prop.anchor_id.unwrap_or_default() > 0 {
|
|
||||||
8
|
|
||||||
} else {
|
} else {
|
||||||
continue; // skip non anchor prop
|
prop.state.clone()
|
||||||
// prop.state as u32
|
|
||||||
};
|
};
|
||||||
let info = SceneEntityInfo {
|
|
||||||
|
prop_entity_id += 1;
|
||||||
|
|
||||||
|
let prop_position = Position {
|
||||||
|
x: (prop.pos_x * 1000f64) as i32,
|
||||||
|
y: (prop.pos_y * 1000f64) as i32,
|
||||||
|
z: (prop.pos_z * 1000f64) as i32,
|
||||||
|
rot_y: (prop.rot_y * 1000f64) as i32,
|
||||||
|
};
|
||||||
|
|
||||||
|
let entity_info = SceneEntityInfo {
|
||||||
inst_id: prop.id as u32,
|
inst_id: prop.id as u32,
|
||||||
group_id: prop.group_id,
|
group_id: prop.group_id,
|
||||||
entity_id,
|
motion: Some(prop_position.to_motion()),
|
||||||
motion: Some(MotionInfo {
|
|
||||||
// pos
|
|
||||||
aomilajjmii: Some(Vector {
|
|
||||||
baimdminomk: (prop.pos_x * 1000f64) as i32,
|
|
||||||
bemlopmcgch: (prop.pos_y * 1000f64) as i32,
|
|
||||||
bagloppgnpb: (prop.pos_z * 1000f64) as i32,
|
|
||||||
}),
|
|
||||||
// rot
|
|
||||||
eiaoiankefd: Some(Vector {
|
|
||||||
baimdminomk: 0,
|
|
||||||
bemlopmcgch: (prop.rot_y * 1000f64) as i32,
|
|
||||||
bagloppgnpb: 0,
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
prop: Some(ScenePropInfo {
|
prop: Some(ScenePropInfo {
|
||||||
prop_id: prop.prop_id as u32,
|
prop_id: prop.prop_id,
|
||||||
prop_state: prop_state,
|
prop_state: prop_state as u32,
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
|
entity_id: prop_entity_id,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
group_info.entity_list.push(entity_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load NPCs
|
||||||
|
for npc in &group.npcs {
|
||||||
|
if loaded_npc.contains(&(npc.npcid as u32))
|
||||||
|
|| json.avatars.contains_key(&(npc.npcid as u32))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
npc_entity_id += 1;
|
||||||
|
loaded_npc.push(npc.npcid as u32);
|
||||||
|
|
||||||
|
let npc_position = Position {
|
||||||
|
x: (npc.pos_x * 1000f64) as i32,
|
||||||
|
y: (npc.pos_y * 1000f64) as i32,
|
||||||
|
z: (npc.pos_z * 1000f64) as i32,
|
||||||
|
rot_y: (npc.rot_y * 1000f64) as i32,
|
||||||
|
};
|
||||||
|
|
||||||
|
let info = SceneEntityInfo {
|
||||||
|
inst_id: npc.id as u32,
|
||||||
|
group_id: npc.group_id,
|
||||||
|
entity_id: npc_entity_id,
|
||||||
|
motion: Some(npc_position.to_motion()),
|
||||||
|
npc: Some(SceneNpcInfo {
|
||||||
|
egeneneoadj: npc.npcid as u32,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(group) = scene_info
|
group_info.entity_list.push(info);
|
||||||
.chhmmbdhjpg
|
|
||||||
.iter_mut()
|
|
||||||
.find(|v| v.group_id == prop.group_id)
|
|
||||||
{
|
|
||||||
group.entity_list.push(info)
|
|
||||||
} else {
|
|
||||||
let mut group_info = Dhkacjhaoid {
|
|
||||||
state: 0,
|
|
||||||
group_id: prop.group_id,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
group_info.entity_list.push(info);
|
|
||||||
scene_info.chhmmbdhjpg.push(group_info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOAD MONSTERS
|
// Load Monsters
|
||||||
for monster in level.monsters {
|
for monster in &group.monsters {
|
||||||
entity_id += 1;
|
monster_entity_id += 1;
|
||||||
|
let monster_position = Position {
|
||||||
|
x: (monster.pos_x * 1000f64) as i32,
|
||||||
|
y: (monster.pos_y * 1000f64) as i32,
|
||||||
|
z: (monster.pos_z * 1000f64) as i32,
|
||||||
|
rot_y: (monster.rot_y * 1000f64) as i32,
|
||||||
|
};
|
||||||
|
|
||||||
|
let npc_monster = SceneNpcMonsterInfo {
|
||||||
|
monster_id: monster.npcmonster_id as u32,
|
||||||
|
event_id: monster.event_id as u32,
|
||||||
|
world_level: 6,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
let info = SceneEntityInfo {
|
let info = SceneEntityInfo {
|
||||||
inst_id: monster.id as u32,
|
inst_id: monster.id as u32,
|
||||||
group_id: monster.group_id,
|
group_id: monster.group_id,
|
||||||
entity_id,
|
entity_id: monster_entity_id,
|
||||||
motion: Some(MotionInfo {
|
motion: Some(monster_position.to_motion()),
|
||||||
// pos
|
npc_monster: Some(npc_monster),
|
||||||
aomilajjmii: Some(Vector {
|
|
||||||
baimdminomk: (monster.pos_x * 1000f64) as i32,
|
|
||||||
bemlopmcgch: (monster.pos_y * 1000f64) as i32,
|
|
||||||
bagloppgnpb: (monster.pos_z * 1000f64) as i32,
|
|
||||||
}),
|
|
||||||
// rot
|
|
||||||
eiaoiankefd: Some(Vector {
|
|
||||||
baimdminomk: 0,
|
|
||||||
bemlopmcgch: (monster.rot_y * 1000f64) as i32,
|
|
||||||
bagloppgnpb: 0,
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
npc_monster: Some(SceneNpcMonsterInfo {
|
|
||||||
monster_id: monster.npcmonster_id as u32,
|
|
||||||
event_id: monster.event_id as u32,
|
|
||||||
world_level: 6,
|
|
||||||
..Default::default()
|
|
||||||
}),
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(group) = scene_info
|
group_info.entity_list.push(info);
|
||||||
.chhmmbdhjpg
|
|
||||||
.iter_mut()
|
|
||||||
.find(|v| v.group_id == monster.group_id)
|
|
||||||
{
|
|
||||||
group.entity_list.push(info)
|
|
||||||
} else {
|
|
||||||
let mut group_info = Dhkacjhaoid {
|
|
||||||
state: 0,
|
|
||||||
group_id: monster.group_id,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
group_info.entity_list.push(info);
|
|
||||||
scene_info.chhmmbdhjpg.push(group_info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// load player entity
|
scene_info.chhmmbdhjpg.push(group_info);
|
||||||
let mut player_group = Dhkacjhaoid {
|
|
||||||
state: 0,
|
|
||||||
group_id: 0,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
for (slot, avatar_id) in &json.lineups {
|
|
||||||
player_group.entity_list.push(SceneEntityInfo {
|
|
||||||
inst_id: 0,
|
|
||||||
entity_id: (*slot) + 1,
|
|
||||||
motion: Some(MotionInfo {
|
|
||||||
// pos
|
|
||||||
aomilajjmii: Some(Vector {
|
|
||||||
baimdminomk: json.position.x,
|
|
||||||
bemlopmcgch: json.position.y,
|
|
||||||
bagloppgnpb: json.position.z,
|
|
||||||
}),
|
|
||||||
// rot
|
|
||||||
eiaoiankefd: Some(Vector {
|
|
||||||
baimdminomk: 0,
|
|
||||||
bemlopmcgch: json.position.rot_y,
|
|
||||||
bagloppgnpb: 0,
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
actor: Some(SceneActorInfo {
|
|
||||||
avatar_type: AvatarType::AvatarFormalType.into(),
|
|
||||||
base_avatar_id: *avatar_id,
|
|
||||||
map_layer: 0,
|
|
||||||
uid: 0,
|
|
||||||
}),
|
|
||||||
..Default::default()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
scene_info.chhmmbdhjpg.push(player_group);
|
|
||||||
|
|
||||||
if _save {
|
|
||||||
session
|
|
||||||
.send(
|
|
||||||
CMD_ENTER_SCENE_BY_SERVER_SC_NOTIFY,
|
|
||||||
Jdokmmikidp {
|
|
||||||
scene: Some(scene_info.clone()),
|
|
||||||
lineup: Some(lineup_info),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
session
|
|
||||||
.send(
|
|
||||||
CMD_SCENE_ENTITY_MOVE_SC_NOTIFY,
|
|
||||||
SceneEntityMoveScNotify {
|
|
||||||
entity_id: 0,
|
|
||||||
entry_id: entry_id,
|
|
||||||
motion: Some(player_pos),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
json.scene.entry_id = entry_id;
|
|
||||||
json.scene.floor_id = enterance.floor_id as u32;
|
|
||||||
json.scene.plane_id = enterance.plane_id as u32;
|
|
||||||
json.position.x = position.x;
|
|
||||||
json.position.y = position.y;
|
|
||||||
json.position.z = position.z;
|
|
||||||
json.position.rot_y = position.rot_y;
|
|
||||||
json.save().await;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(scene_info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(anyhow::format_err!("Scene Not Found"))
|
// load player entity
|
||||||
|
let mut player_group = Dhkacjhaoid {
|
||||||
|
state: 0,
|
||||||
|
group_id: 0,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
for (slot, avatar_id) in &json.lineups {
|
||||||
|
player_group.entity_list.push(SceneEntityInfo {
|
||||||
|
inst_id: 0,
|
||||||
|
entity_id: (*slot) + 1,
|
||||||
|
motion: Some(MotionInfo {
|
||||||
|
// pos
|
||||||
|
aomilajjmii: Some(Vector {
|
||||||
|
baimdminomk: json.position.x,
|
||||||
|
bemlopmcgch: json.position.y,
|
||||||
|
bagloppgnpb: json.position.z,
|
||||||
|
}),
|
||||||
|
// rot
|
||||||
|
eiaoiankefd: Some(Vector {
|
||||||
|
baimdminomk: 0,
|
||||||
|
bemlopmcgch: json.position.rot_y,
|
||||||
|
bagloppgnpb: 0,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
actor: Some(SceneActorInfo {
|
||||||
|
avatar_type: AvatarType::AvatarFormalType.into(),
|
||||||
|
base_avatar_id: *avatar_id,
|
||||||
|
map_layer: 0,
|
||||||
|
uid: 0,
|
||||||
|
}),
|
||||||
|
..Default::default()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
scene_info.chhmmbdhjpg.push(player_group);
|
||||||
|
|
||||||
|
if _save {
|
||||||
|
session
|
||||||
|
.send(
|
||||||
|
CMD_ENTER_SCENE_BY_SERVER_SC_NOTIFY,
|
||||||
|
Jdokmmikidp {
|
||||||
|
scene: Some(scene_info.clone()),
|
||||||
|
lineup: Some(lineup_info),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
session
|
||||||
|
.send(
|
||||||
|
CMD_SCENE_ENTITY_MOVE_SC_NOTIFY,
|
||||||
|
SceneEntityMoveScNotify {
|
||||||
|
entity_id: 0,
|
||||||
|
motion: Some(player_pos),
|
||||||
|
entry_id,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
json.scene.entry_id = entry_id;
|
||||||
|
json.scene.floor_id = enterance.floor_id as u32;
|
||||||
|
json.scene.plane_id = enterance.plane_id as u32;
|
||||||
|
json.position.x = position.x;
|
||||||
|
json.position.y = position.y;
|
||||||
|
json.position.z = position.z;
|
||||||
|
json.position.rot_y = position.rot_y;
|
||||||
|
json.save().await;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(scene_info);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ use proto::*;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::{BTreeMap, HashMap};
|
||||||
|
|
||||||
use super::tools_res::{MapEntrance, MazePlane, SimpleLevelGroup, GAME_RESOURCES};
|
|
||||||
|
|
||||||
// AVATAR
|
// AVATAR
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
pub struct AvatarJson {
|
pub struct AvatarJson {
|
||||||
@@ -156,9 +154,8 @@ impl AvatarJson {
|
|||||||
let mut lineup_info = LineupInfo {
|
let mut lineup_info = LineupInfo {
|
||||||
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
||||||
name: "Squad 1".to_string(),
|
name: "Squad 1".to_string(),
|
||||||
// mp: 5,
|
njjbfegnhjc: 5,
|
||||||
// leader_slot: 0,
|
bpkggopoppf: 5,
|
||||||
// max_mp: 5,
|
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -637,24 +634,4 @@ impl JsonData {
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_level_group(
|
|
||||||
&self,
|
|
||||||
entry_id: u32,
|
|
||||||
) -> Option<(SimpleLevelGroup, MapEntrance, Option<MazePlane>)> {
|
|
||||||
let resources = &GAME_RESOURCES;
|
|
||||||
let enterance = resources.map_entrance.get(&entry_id);
|
|
||||||
|
|
||||||
if let Some(enterance) = enterance {
|
|
||||||
let plane = resources.maze_plane.get(&enterance.plane_id);
|
|
||||||
if let Some(level) = resources
|
|
||||||
.level_group
|
|
||||||
.get(&format!("P{}_F{}", enterance.plane_id, enterance.floor_id))
|
|
||||||
{
|
|
||||||
return Some((level.clone(), enterance.clone(), plane.cloned()));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,14 @@ pub struct LevelGroup {
|
|||||||
pub group_guid: String,
|
pub group_guid: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "LoadSide")]
|
#[serde(rename = "LoadSide")]
|
||||||
pub load_side: String,
|
pub load_side: LoadSide,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "LoadOnInitial")]
|
#[serde(rename = "LoadOnInitial")]
|
||||||
pub load_on_initial: bool,
|
pub load_on_initial: bool,
|
||||||
|
|
||||||
// #[serde(rename = "AnchorList")]
|
#[serde(default)]
|
||||||
// pub anchor_list: Vec<LevelAnchor>,
|
#[serde(rename = "AnchorList")]
|
||||||
|
pub anchor_list: Vec<LevelAnchor>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "MonsterList")]
|
#[serde(rename = "MonsterList")]
|
||||||
pub monster_list: Vec<LevelMonster>,
|
pub monster_list: Vec<LevelMonster>,
|
||||||
@@ -32,7 +33,7 @@ pub struct LevelGroup {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LevelProp {
|
pub struct LevelProp {
|
||||||
#[serde(rename = "ID")]
|
#[serde(rename = "ID")]
|
||||||
pub id: i64,
|
pub id: u32, // need
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "Category")]
|
#[serde(rename = "Category")]
|
||||||
pub category: String,
|
pub category: String,
|
||||||
@@ -41,27 +42,30 @@ pub struct LevelProp {
|
|||||||
pub group_name: String,
|
pub group_name: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "LoadSide")]
|
#[serde(rename = "LoadSide")]
|
||||||
pub load_side: String,
|
pub load_side: Option<LoadSide>, // need
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "PosX")]
|
#[serde(rename = "PosX")]
|
||||||
pub pos_x: f64,
|
pub pos_x: f64, // n
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "PosY")]
|
#[serde(rename = "PosY")]
|
||||||
pub pos_y: f64,
|
pub pos_y: f64, // n
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "PosZ")]
|
#[serde(rename = "PosZ")]
|
||||||
pub pos_z: f64,
|
pub pos_z: f64, // n
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "RotY")]
|
#[serde(rename = "RotY")]
|
||||||
pub rot_y: f64,
|
pub rot_y: f64, // n
|
||||||
#[serde(rename = "PropID")]
|
#[serde(rename = "PropID")]
|
||||||
pub prop_id: u32,
|
pub prop_id: u32, // n
|
||||||
#[serde(rename = "AnchorID")]
|
#[serde(rename = "AnchorID")]
|
||||||
pub anchor_id: Option<u32>,
|
pub anchor_id: Option<u32>, // n
|
||||||
#[serde(rename = "AnchorGroupID")]
|
#[serde(rename = "AnchorGroupID")]
|
||||||
pub anchor_group_id: Option<u32>,
|
pub anchor_group_id: Option<u32>, // n
|
||||||
#[serde(rename = "MappingInfoID")]
|
#[serde(rename = "MappingInfoID")]
|
||||||
pub mapping_info_id: Option<u32>,
|
pub mapping_info_id: Option<u32>, // n
|
||||||
|
|
||||||
|
#[serde(rename = "InitLevelGraph")]
|
||||||
|
pub init_level_graph: Option<String>,
|
||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "State")]
|
#[serde(rename = "State")]
|
||||||
@@ -73,17 +77,24 @@ pub struct LevelProp {
|
|||||||
pub group_id: u32,
|
pub group_id: u32,
|
||||||
#[serde(rename = "IsDelete")]
|
#[serde(rename = "IsDelete")]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub is_delete: bool,
|
pub is_delete: bool, // n
|
||||||
#[serde(rename = "IsClientOnly")]
|
#[serde(rename = "IsClientOnly")]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub client_only: bool,
|
pub client_only: bool, // n
|
||||||
|
|
||||||
|
// #[serde(default)]
|
||||||
|
// pub is_door: bool,
|
||||||
|
// #[serde(default)]
|
||||||
|
// pub is_chest: bool,
|
||||||
|
#[serde(default)]
|
||||||
|
pub __test_field: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LevelAnchor {
|
pub struct LevelAnchor {
|
||||||
#[serde(rename = "ID")]
|
#[serde(rename = "ID")]
|
||||||
pub id: i64,
|
pub id: u32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "PosX")]
|
#[serde(rename = "PosX")]
|
||||||
pub pos_x: f64,
|
pub pos_x: f64,
|
||||||
@@ -104,7 +115,7 @@ pub struct LevelAnchor {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LevelNPC {
|
pub struct LevelNPC {
|
||||||
#[serde(rename = "ID")]
|
#[serde(rename = "ID")]
|
||||||
pub id: i64,
|
pub id: u32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "PosX")]
|
#[serde(rename = "PosX")]
|
||||||
pub pos_x: f64,
|
pub pos_x: f64,
|
||||||
@@ -120,16 +131,22 @@ pub struct LevelNPC {
|
|||||||
#[serde(rename = "RotY")]
|
#[serde(rename = "RotY")]
|
||||||
pub rot_y: f64,
|
pub rot_y: f64,
|
||||||
#[serde(rename = "NPCID")]
|
#[serde(rename = "NPCID")]
|
||||||
pub npcid: i64,
|
pub npcid: u32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub group_id: u32,
|
pub group_id: u32,
|
||||||
|
#[serde(rename = "IsDelete")]
|
||||||
|
#[serde(default)]
|
||||||
|
pub is_delete: bool,
|
||||||
|
#[serde(rename = "IsClientOnly")]
|
||||||
|
#[serde(default)]
|
||||||
|
pub client_only: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LevelMonster {
|
pub struct LevelMonster {
|
||||||
#[serde(rename = "ID")]
|
#[serde(rename = "ID")]
|
||||||
pub id: i64,
|
pub id: u32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "RotY")]
|
#[serde(rename = "RotY")]
|
||||||
pub rot_y: f64,
|
pub rot_y: f64,
|
||||||
@@ -143,12 +160,44 @@ pub struct LevelMonster {
|
|||||||
#[serde(rename = "PosZ")]
|
#[serde(rename = "PosZ")]
|
||||||
pub pos_z: f64,
|
pub pos_z: f64,
|
||||||
#[serde(rename = "NPCMonsterID")]
|
#[serde(rename = "NPCMonsterID")]
|
||||||
pub npcmonster_id: i64,
|
pub npcmonster_id: u32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[serde(rename = "EventID")]
|
#[serde(rename = "EventID")]
|
||||||
pub event_id: i64,
|
pub event_id: u32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub group_id: u32,
|
pub group_id: u32,
|
||||||
|
#[serde(rename = "IsDelete")]
|
||||||
|
#[serde(default)]
|
||||||
|
pub is_delete: bool,
|
||||||
|
#[serde(rename = "IsClientOnly")]
|
||||||
|
#[serde(default)]
|
||||||
|
pub client_only: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Copy)]
|
||||||
|
pub enum LoadSide {
|
||||||
|
Client = 0,
|
||||||
|
Server = 1,
|
||||||
|
Unk = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for LoadSide {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::Client
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct LevelFloor {
|
||||||
|
#[serde(rename = "FloorID")]
|
||||||
|
pub floor_id: u32,
|
||||||
|
#[serde(rename = "FloorName")]
|
||||||
|
pub floor_name: String,
|
||||||
|
#[serde(rename = "StartGroupID")]
|
||||||
|
pub start_group_id: u32,
|
||||||
|
#[serde(rename = "StartAnchorID")]
|
||||||
|
pub start_anchor_id: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
@@ -272,10 +321,14 @@ pub type StringMap<T> = HashMap<String, T>;
|
|||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct SimpleLevelGroup {
|
pub struct SimpleLevelGroup {
|
||||||
pub teleports: IntMap<LevelProp>,
|
pub teleports: IntMap<LevelProp>,
|
||||||
|
pub group_items: IntMap<LevelGroupItem>,
|
||||||
|
}
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
|
pub struct LevelGroupItem {
|
||||||
pub props: Vec<LevelProp>,
|
pub props: Vec<LevelProp>,
|
||||||
pub npcs: Vec<LevelNPC>,
|
pub npcs: Vec<LevelNPC>,
|
||||||
pub monsters: Vec<LevelMonster>,
|
pub monsters: Vec<LevelMonster>,
|
||||||
pub group_ids: Vec<u32>,
|
pub anchors: HashMap<u32, LevelAnchor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
@@ -285,6 +338,7 @@ pub struct GameResources {
|
|||||||
pub level_group: StringMap<SimpleLevelGroup>,
|
pub level_group: StringMap<SimpleLevelGroup>,
|
||||||
pub maze_prop: IntMap<MazeProp>,
|
pub maze_prop: IntMap<MazeProp>,
|
||||||
pub maze_plane: IntMap<MazePlane>,
|
pub maze_plane: IntMap<MazePlane>,
|
||||||
|
pub level_floor: StringMap<LevelFloor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GameResources {
|
impl GameResources {
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user