submit work for now
This commit is contained in:
parent
3adf8cdc19
commit
1480baae70
13 changed files with 306 additions and 351 deletions
|
@ -138,6 +138,7 @@ json_data! {
|
||||||
LevelPlayNodeData;
|
LevelPlayNodeData;
|
||||||
LivenessTask;
|
LivenessTask;
|
||||||
LordGym;
|
LordGym;
|
||||||
|
ModelConfigPreload;
|
||||||
MonsterDetection;
|
MonsterDetection;
|
||||||
MonsterPropertyGrowth;
|
MonsterPropertyGrowth;
|
||||||
Motion;
|
Motion;
|
||||||
|
|
26
wicked-waifus-data/src/model_config_preload.rs
Normal file
26
wicked-waifus-data/src/model_config_preload.rs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||||
|
#[serde(rename_all = "PascalCase")]
|
||||||
|
pub struct ModelConfigPreloadData {
|
||||||
|
pub id: i32,
|
||||||
|
pub actor_class_path: String,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
pub actor_class: Vec<String>,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
pub animations: Vec<String>,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
pub effects: Vec<String>,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
pub audios: Vec<String>,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
pub meshes: Vec<String>,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
pub materials: Vec<String>,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
pub animation_blueprints: Vec<String>,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
pub others: Vec<String>,
|
||||||
|
|
||||||
|
}
|
|
@ -4,8 +4,8 @@ use serde::Deserialize;
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||||
#[serde(rename_all = "PascalCase")]
|
#[serde(rename_all = "PascalCase")]
|
||||||
pub struct ModelType {
|
pub struct ModelType {
|
||||||
r#type: Option<String>,
|
pub r#type: Option<String>,
|
||||||
model_id: Option<i32>
|
pub model_id: Option<i32>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
|
|
@ -100,7 +100,6 @@ pub struct RoleInfoData {
|
||||||
pub role_guide: i32,
|
pub role_guide: i32,
|
||||||
#[cfg(feature = "strict_json_fields")]
|
#[cfg(feature = "strict_json_fields")]
|
||||||
pub red_dot_disable_rule: i32,
|
pub red_dot_disable_rule: i32,
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub skin_damage: Vec<String>,
|
pub skin_damage: Vec<String>,
|
||||||
#[cfg(feature = "strict_json_fields")]
|
#[cfg(feature = "strict_json_fields")]
|
||||||
pub hide_hu_lu: bool,
|
pub hide_hu_lu: bool,
|
||||||
|
|
|
@ -26,14 +26,6 @@ const ROLE_OVERRIDES: &[(i32, &[i64])] = &[
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
const ROLE_BUFF_BLACKLIST: &[(i32, &[i64])] = &[
|
|
||||||
(1407, &[
|
|
||||||
// ciaconna's forte buffs are completely fucked to get from an algorithm and i hate kuro!
|
|
||||||
1407900003,
|
|
||||||
1407500040,
|
|
||||||
]),
|
|
||||||
];
|
|
||||||
|
|
||||||
fn get_role_buff_overrides(role_id: i32) -> Option<&'static [i64]> {
|
fn get_role_buff_overrides(role_id: i32) -> Option<&'static [i64]> {
|
||||||
for &(role, buff) in ROLE_OVERRIDES {
|
for &(role, buff) in ROLE_OVERRIDES {
|
||||||
if role == role_id {
|
if role == role_id {
|
||||||
|
@ -128,6 +120,26 @@ impl BufManager {
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn create_buff(&mut self, origin_id: i64, buff_id: i64) -> FightBuffInformation {
|
||||||
|
let mut buff = FightBuffInformation {
|
||||||
|
handle_id: 0,
|
||||||
|
buff_id,
|
||||||
|
level: 1,
|
||||||
|
stack_count: 1,
|
||||||
|
instigator_id: origin_id,
|
||||||
|
entity_id: origin_id,
|
||||||
|
apply_type: 0,
|
||||||
|
duration: -1f32,
|
||||||
|
left_duration: -1f32,
|
||||||
|
context: vec![],
|
||||||
|
is_active: true,
|
||||||
|
server_id: 0,
|
||||||
|
message_id: 0,
|
||||||
|
};
|
||||||
|
self.create(&mut buff);
|
||||||
|
buff
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BufManager {
|
impl Default for BufManager {
|
||||||
|
|
|
@ -108,11 +108,15 @@ impl WorldEntity {
|
||||||
self.components.remove(&entity_id).is_some() && self.entity_manager.remove(entity_id)
|
self.components.remove(&entity_id).is_some() && self.entity_manager.remove(entity_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn active_entity_empty(&self) -> bool {
|
pub fn get_all_entity_ids(&mut self) -> Vec<i32> {
|
||||||
self.entity_manager.active_entity_empty()
|
self.entity_manager.get_all_entity_id()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_role_permanent_buffs(&mut self, entity_id: i32, role_id: i32) -> Vec<FightBuffInformation> {
|
pub fn generate_role_permanent_buffs(&mut self, entity_id: i32, role_id: i32) -> Vec<FightBuffInformation> {
|
||||||
self.buff_manager.create_permanent_buffs(entity_id as i64, role_id)
|
self.buff_manager.create_permanent_buffs(entity_id as i64, role_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn create_buff(&mut self, entity_id: i32, buff_id: i64) -> FightBuffInformation {
|
||||||
|
self.buff_manager.create_buff(entity_id as i64, buff_id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,38 +160,38 @@ fn handle_damage_execute_request(
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
if let Some((value, _)) = query_components!(world, request.target_entity_id, Attribute)
|
// if let Some((value, _)) = query_components!(world, request.target_entity_id, Attribute)
|
||||||
.0
|
// .0
|
||||||
.unwrap()
|
// .unwrap()
|
||||||
.attr_map
|
// .attr_map
|
||||||
.get(&EAttributeType::Life)
|
// .get(&EAttributeType::Life)
|
||||||
{
|
// {
|
||||||
let updated_value = match value - damage >= 0 {
|
// let updated_value = match value - damage >= 0 {
|
||||||
true => value - damage,
|
// true => value - damage,
|
||||||
false => 0,
|
// false => 0,
|
||||||
};
|
// };
|
||||||
receive_pack.data.push(create_combat_notify(
|
// receive_pack.data.push(create_combat_notify(
|
||||||
CombatCommon {
|
// CombatCommon {
|
||||||
entity_id: request.target_entity_id,
|
// entity_id: request.target_entity_id,
|
||||||
..Default::default()
|
// ..Default::default()
|
||||||
},
|
// },
|
||||||
combat_notify_data::Message::AttributeChangedNotify(AttributeChangedNotify {
|
// combat_notify_data::Message::AttributeChangedNotify(AttributeChangedNotify {
|
||||||
id: request.target_entity_id,
|
// id: request.target_entity_id,
|
||||||
attributes: vec![GameplayAttributeData {
|
// attributes: vec![GameplayAttributeData {
|
||||||
current_value: updated_value,
|
// current_value: updated_value,
|
||||||
value_increment: updated_value,
|
// value_increment: updated_value,
|
||||||
attribute_type: EAttributeType::Life.into(),
|
// attribute_type: EAttributeType::Life.into(),
|
||||||
}],
|
// }],
|
||||||
}),
|
// }),
|
||||||
));
|
// ));
|
||||||
if updated_value == 0 {
|
// if updated_value == 0 {
|
||||||
world_util::remove_entity(
|
// world_util::remove_entity(
|
||||||
player,
|
// player,
|
||||||
request.target_entity_id,
|
// request.target_entity_id,
|
||||||
ERemoveEntityType::HpIsZero,
|
// ERemoveEntityType::HpIsZero,
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ macro_rules! handle_request {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::debug!("logic: processing request {}", stringify!($($inner_package::)?[<$name Request>]));
|
// tracing::debug!("logic: processing request {}", stringify!($($inner_package::)?[<$name Request>]));
|
||||||
|
|
||||||
let mut response = ::wicked_waifus_protocol::$($inner_package::)?[<$name Response>]::default();
|
let mut response = ::wicked_waifus_protocol::$($inner_package::)?[<$name Response>]::default();
|
||||||
[<on_ $($inner_package:snake _)? $name:snake _request>](player, request, &mut response);
|
[<on_ $($inner_package:snake _)? $name:snake _request>](player, request, &mut response);
|
||||||
|
|
|
@ -7,9 +7,12 @@ use wicked_waifus_protocol::{
|
||||||
RoleShowListUpdateResponse, UpdateFormationRequest, UpdateFormationResponse,
|
RoleShowListUpdateResponse, UpdateFormationRequest, UpdateFormationResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::logic::ecs::world;
|
||||||
use crate::logic::player::Player;
|
use crate::logic::player::Player;
|
||||||
use crate::logic::role::{Role, RoleFormation};
|
use crate::logic::role::{Role, RoleFormation};
|
||||||
use crate::logic::utils::world_util::summon_concomitant;
|
use crate::logic::utils::world_util::{add_player_entities, summon_concomitant};
|
||||||
|
use crate::query_components;
|
||||||
|
use crate::logic::ecs::component::ComponentContainer;
|
||||||
|
|
||||||
pub fn on_role_show_list_update_request(
|
pub fn on_role_show_list_update_request(
|
||||||
player: &mut Player,
|
player: &mut Player,
|
||||||
|
@ -58,6 +61,22 @@ pub fn on_update_formation_request(
|
||||||
let cur_role = formation.cur_role;
|
let cur_role = formation.cur_role;
|
||||||
let is_current = formation.is_current;
|
let is_current = formation.is_current;
|
||||||
|
|
||||||
|
// update all formation and check formation_list
|
||||||
|
player
|
||||||
|
.formation_list
|
||||||
|
.entry(formation_id)
|
||||||
|
.and_modify(|r| {
|
||||||
|
r.cur_role = formation.cur_role;
|
||||||
|
r.role_ids = formation.role_ids.clone();
|
||||||
|
r.is_current = is_current;
|
||||||
|
})
|
||||||
|
.or_insert(RoleFormation {
|
||||||
|
id: formation_id,
|
||||||
|
cur_role: formation.cur_role,
|
||||||
|
role_ids: formation.role_ids.clone(),
|
||||||
|
is_current,
|
||||||
|
});
|
||||||
|
|
||||||
if is_current {
|
if is_current {
|
||||||
// update player current formation id
|
// update player current formation id
|
||||||
player.cur_formation_id = formation_id;
|
player.cur_formation_id = formation_id;
|
||||||
|
@ -74,11 +93,16 @@ pub fn on_update_formation_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(old_formation) = player.formation_list.get(&real_formation_id) {
|
if let Some(old_formation) = player.formation_list.get(&real_formation_id) {
|
||||||
let removed_entities: Vec<i64> = old_formation
|
let mut removed_entities: Vec<i64> = old_formation
|
||||||
.role_ids
|
.role_ids
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&role_id| world.get_entity_id(role_id))
|
.map(|&role_id| world.get_entity_id(role_id))
|
||||||
.collect();
|
.collect();
|
||||||
|
for id in removed_entities.clone() {
|
||||||
|
if let (Some(concomitant),) = query_components!(world, id, Concomitant) {
|
||||||
|
removed_entities.extend(concomitant.custom_entity_ids.clone());
|
||||||
|
};
|
||||||
|
}
|
||||||
removed_entities.iter().for_each(|&entity_id| {
|
removed_entities.iter().for_each(|&entity_id| {
|
||||||
world.remove_entity(entity_id as i32);
|
world.remove_entity(entity_id as i32);
|
||||||
});
|
});
|
||||||
|
@ -88,16 +112,7 @@ pub fn on_update_formation_request(
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let added_roles: Vec<Role> = formation
|
player.build_player_entity_add_notify(world);
|
||||||
.role_ids
|
|
||||||
.iter()
|
|
||||||
.map(|&role_id| Role::new(role_id))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
if !added_roles.is_empty() {
|
|
||||||
// add new role entities
|
|
||||||
player.notify(player.build_player_entity_add_notify(added_roles, world));
|
|
||||||
}
|
|
||||||
|
|
||||||
// send update group formation notify
|
// send update group formation notify
|
||||||
player.notify(player.build_update_group_formation_notify(
|
player.notify(player.build_update_group_formation_notify(
|
||||||
|
@ -112,22 +127,6 @@ pub fn on_update_formation_request(
|
||||||
|
|
||||||
response.formation = Some(formation.clone());
|
response.formation = Some(formation.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
// update all formation and check formation_list
|
|
||||||
player
|
|
||||||
.formation_list
|
|
||||||
.entry(formation_id)
|
|
||||||
.and_modify(|r| {
|
|
||||||
r.cur_role = formation.cur_role;
|
|
||||||
r.role_ids = formation.role_ids.clone();
|
|
||||||
r.is_current = is_current;
|
|
||||||
})
|
|
||||||
.or_insert(RoleFormation {
|
|
||||||
id: formation_id,
|
|
||||||
cur_role: formation.cur_role,
|
|
||||||
role_ids: formation.role_ids,
|
|
||||||
is_current,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
player.notify(player.build_update_formation_notify());
|
player.notify(player.build_update_formation_notify());
|
||||||
|
|
|
@ -9,11 +9,11 @@ use wicked_waifus_protocol::message::Message;
|
||||||
use wicked_waifus_protocol::player_attr::Value;
|
use wicked_waifus_protocol::player_attr::Value;
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{
|
||||||
AdventreTask, AdventureManualData, AdventureUpdateNotify, AdviceSettingNotify, BuffItemNotify,
|
AdventreTask, AdventureManualData, AdventureUpdateNotify, AdviceSettingNotify, BuffItemNotify,
|
||||||
ControlInfoNotify, EEntityType, ERemoveEntityType, EnergyInfo, EnergyUpdateNotify,
|
ControlInfoNotify, ERemoveEntityType, EnergyInfo, EnergyUpdateNotify,
|
||||||
EntityAddNotify, EntityConfigType, EntityPb, EntityRemoveInfo, EntityRemoveNotify, EntityState,
|
EntityRemoveInfo, EntityRemoveNotify,
|
||||||
FavorItem, FightFormationNotifyInfo, FightRoleInfo, FightRoleInfos, FormationRoleInfo,
|
FavorItem, FightFormationNotifyInfo, FightRoleInfo, FightRoleInfos, FormationRoleInfo,
|
||||||
GroupFormation, HostTeleportUnlockNotify, InstDataNotify, ItemPkgOpenNotify,
|
GroupFormation, HostTeleportUnlockNotify, InstDataNotify, ItemPkgOpenNotify,
|
||||||
LevelPlayInfoNotify, LivingStatus, MailInfosNotify, MapUnlockFieldNotify,
|
LevelPlayInfoNotify, LivingStatus, MailInfosNotify,
|
||||||
MonthCardDailyRewardNotify, MoonChasingTargetGetCountNotify,
|
MonthCardDailyRewardNotify, MoonChasingTargetGetCountNotify,
|
||||||
MoonChasingTrackMoonHandbookRewardNotify, NormalItemUpdateNotify, PassiveSkillNotify,
|
MoonChasingTrackMoonHandbookRewardNotify, NormalItemUpdateNotify, PassiveSkillNotify,
|
||||||
PbGetRoleListNotify, PlayerAttr, PlayerAttrKey, PlayerAttrNotify, PlayerAttrType,
|
PbGetRoleListNotify, PlayerAttr, PlayerAttrKey, PlayerAttrNotify, PlayerAttrType,
|
||||||
|
@ -24,11 +24,12 @@ use wicked_waifus_protocol::{
|
||||||
};
|
};
|
||||||
use wicked_waifus_protocol_internal::{PlayerBasicData, PlayerRoleData, PlayerSaveData};
|
use wicked_waifus_protocol_internal::{PlayerBasicData, PlayerRoleData, PlayerSaveData};
|
||||||
|
|
||||||
|
use super::ecs::component::ComponentContainer;
|
||||||
|
use super::utils::world_util::add_player_entities;
|
||||||
use super::{
|
use super::{
|
||||||
ecs::world::World,
|
ecs::world::World,
|
||||||
role::{Role, RoleFormation},
|
role::{Role, RoleFormation},
|
||||||
};
|
};
|
||||||
use crate::logic::components::RoleSkin;
|
|
||||||
use crate::logic::ecs::world::WorldEntity;
|
use crate::logic::ecs::world::WorldEntity;
|
||||||
use crate::logic::player::basic_info::PlayerBasicInfo;
|
use crate::logic::player::basic_info::PlayerBasicInfo;
|
||||||
use crate::logic::player::explore_tools::ExploreTools;
|
use crate::logic::player::explore_tools::ExploreTools;
|
||||||
|
@ -46,15 +47,8 @@ use crate::logic::player::player_mc_element::PlayerMcElement;
|
||||||
use crate::logic::player::player_month_card::PlayerMonthCard;
|
use crate::logic::player::player_month_card::PlayerMonthCard;
|
||||||
use crate::logic::player::player_teleports::{PlayerTeleport, PlayerTeleports};
|
use crate::logic::player::player_teleports::{PlayerTeleport, PlayerTeleports};
|
||||||
use crate::logic::player::player_tutorials::{PlayerTutorial, PlayerTutorials};
|
use crate::logic::player::player_tutorials::{PlayerTutorial, PlayerTutorials};
|
||||||
use crate::logic::{
|
|
||||||
components::{
|
|
||||||
Attribute, EntityConfig, Equip, FightBuff, Movement, OwnerPlayer, PlayerOwnedEntityMarker,
|
|
||||||
Position, Visibility, VisionSkill, SoarWingSkin
|
|
||||||
},
|
|
||||||
ecs::component::ComponentContainer,
|
|
||||||
};
|
|
||||||
use crate::session::Session;
|
use crate::session::Session;
|
||||||
use crate::{config, create_player_entity_pb, query_components};
|
use crate::{config, query_components};
|
||||||
use crate::logic::player::Element::Spectro;
|
use crate::logic::player::Element::Spectro;
|
||||||
|
|
||||||
mod basic_info;
|
mod basic_info;
|
||||||
|
@ -358,16 +352,8 @@ impl Player {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_player_entity_add_notify(&self, role_list: Vec<Role>, world: &mut WorldEntity) -> EntityAddNotify {
|
pub fn build_player_entity_add_notify(&self, world: &mut WorldEntity) {
|
||||||
create_player_entity_pb!(
|
add_player_entities(self, self.formation_list.get(&self.cur_formation_id).unwrap(), Some(world))
|
||||||
role_list,
|
|
||||||
self.basic_info.cur_map_id,
|
|
||||||
self,
|
|
||||||
self.basic_info.id,
|
|
||||||
self.location.position.clone(),
|
|
||||||
self.explore_tools,
|
|
||||||
world
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_player_entity_remove_notify(
|
pub fn build_player_entity_remove_notify(
|
||||||
|
@ -403,8 +389,7 @@ impl Player {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&role_id| {
|
.map(|&role_id| {
|
||||||
let entity_id = world.get_entity_id(role_id);
|
let entity_id = world.get_entity_id(role_id);
|
||||||
let _role_skin =
|
let _role_skin = query_components!(world, entity_id, RoleSkin).0.unwrap();
|
||||||
query_components!(world, entity_id, RoleSkin).0.unwrap();
|
|
||||||
FightRoleInfo {
|
FightRoleInfo {
|
||||||
role_id,
|
role_id,
|
||||||
entity_id: world.get_entity_id(role_id),
|
entity_id: world.get_entity_id(role_id),
|
||||||
|
|
|
@ -160,10 +160,10 @@ impl Role {
|
||||||
// TODO: Integrity check, value has to be between 0 and max
|
// TODO: Integrity check, value has to be between 0 and max
|
||||||
base_stats.life = base_stats.life_max;
|
base_stats.life = base_stats.life_max;
|
||||||
base_stats.energy = base_stats.energy_max;
|
base_stats.energy = base_stats.energy_max;
|
||||||
base_stats.special_energy_1 = base_stats.special_energy_1_max;
|
base_stats.special_energy_1 = self.special_energy_1;
|
||||||
base_stats.special_energy_2 = base_stats.special_energy_2_max;
|
base_stats.special_energy_2 = self.special_energy_2;
|
||||||
base_stats.special_energy_3 = base_stats.special_energy_3_max;
|
base_stats.special_energy_3 = self.special_energy_3;
|
||||||
base_stats.special_energy_4 = base_stats.special_energy_4_max;
|
base_stats.special_energy_4 = self.special_energy_4;
|
||||||
base_stats.element_energy = base_stats.element_energy_max;
|
base_stats.element_energy = base_stats.element_energy_max;
|
||||||
base_stats
|
base_stats
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,8 +169,7 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
||||||
.world
|
.world
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.set_in_world_player_data(player.build_in_world_player());
|
.set_in_world_player_data(player.build_in_world_player());
|
||||||
|
world_util::add_player_entities(&player, player.formation_list.get(&player.cur_formation_id).unwrap(), None);
|
||||||
world_util::add_player_entities(&player);
|
|
||||||
let scene_info = world_util::build_scene_information(&player);
|
let scene_info = world_util::build_scene_information(&player);
|
||||||
|
|
||||||
player.notify(SilenceNpcNotify::default());
|
player.notify(SilenceNpcNotify::default());
|
||||||
|
@ -237,10 +236,14 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let _ = state.worlds.remove(&player_id);
|
let removed_world = state.worlds.remove(&player_id).unwrap();
|
||||||
|
let mut removed_world_ref = removed_world.borrow_mut();
|
||||||
|
let world = removed_world_ref.get_mut_world_entity();
|
||||||
|
for entity_id in world.get_all_entity_ids() {
|
||||||
|
world.remove_entity(entity_id);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: kick co-op players from removed world
|
// TODO: kick co-op players from removed world
|
||||||
// TODO: Remove all entities
|
|
||||||
|
|
||||||
player_save_task::push(
|
player_save_task::push(
|
||||||
player_id,
|
player_id,
|
||||||
player.borrow().build_save_data(),
|
player.borrow().build_save_data(),
|
||||||
|
|
|
@ -5,7 +5,7 @@ use wicked_waifus_protocol::{
|
||||||
|
|
||||||
use wicked_waifus_data::pb_components::ComponentsData;
|
use wicked_waifus_data::pb_components::ComponentsData;
|
||||||
use wicked_waifus_data::{
|
use wicked_waifus_data::{
|
||||||
base_property_data, blueprint_config_data, template_config_data, EntityLogic, EntityType, LevelEntityConfigData
|
base_property_data, blueprint_config_data, summon_cfg_data, template_config_data, EntityLogic, EntityType, LevelEntityConfigData
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::logic::components::{Autonomous, Fsm, Interact, MonsterAi, SoarWingSkin, StateTag, Tag};
|
use crate::logic::components::{Autonomous, Fsm, Interact, MonsterAi, SoarWingSkin, StateTag, Tag};
|
||||||
|
@ -13,6 +13,7 @@ use crate::logic::ecs::entity::{Entity, EntityBuilder};
|
||||||
use crate::logic::ecs::world::{World, WorldEntity};
|
use crate::logic::ecs::world::{World, WorldEntity};
|
||||||
use crate::logic::math::Transform;
|
use crate::logic::math::Transform;
|
||||||
use crate::logic::player::Player;
|
use crate::logic::player::Player;
|
||||||
|
use crate::logic::role::RoleFormation;
|
||||||
use crate::logic::utils::growth_utils::get_monster_props_by_level;
|
use crate::logic::utils::growth_utils::get_monster_props_by_level;
|
||||||
use crate::logic::utils::{entity_serializer, tag_utils};
|
use crate::logic::utils::{entity_serializer, tag_utils};
|
||||||
use crate::logic::{
|
use crate::logic::{
|
||||||
|
@ -24,35 +25,13 @@ use crate::logic::{
|
||||||
};
|
};
|
||||||
//use crate::resonator_data::{ResonatorData, Concomitant, SummonerComponent};
|
//use crate::resonator_data::{ResonatorData, Concomitant, SummonerComponent};
|
||||||
|
|
||||||
use crate::{query_components, query_with};
|
use crate::query_with;
|
||||||
|
|
||||||
pub fn summon_concomitant(player: &Player, world: &mut WorldEntity, summon_cfg: &wicked_waifus_data::SummonCfgData, cur_summon_id: i32) -> Entity {
|
pub fn summon_concomitant(player: &Player, world: &mut WorldEntity, template_cfg: &wicked_waifus_data::TemplateConfigData, cur_summon_id: i32) -> (Entity, Vec<i64>) {
|
||||||
let mut concomitant_buffs: Vec<FightBuffInformation> = Vec::new();
|
let mut concomitant_buffs: Vec<FightBuffInformation> = Vec::new();
|
||||||
|
|
||||||
for buff_id in &summon_cfg.born_buff_id {
|
let summon_cfg = summon_cfg_data::get(&template_cfg.blueprint_type).unwrap();
|
||||||
concomitant_buffs
|
let concomitant_config_id = template_cfg.id;
|
||||||
.push(FightBuffInformation {
|
|
||||||
handle_id: 1,
|
|
||||||
buff_id: *buff_id,
|
|
||||||
level: 1,
|
|
||||||
stack_count: 1,
|
|
||||||
instigator_id: 0,
|
|
||||||
entity_id: 0,
|
|
||||||
apply_type: 0,
|
|
||||||
duration: -1.0,
|
|
||||||
left_duration: -1.0,
|
|
||||||
context: vec![],
|
|
||||||
is_active: true,
|
|
||||||
server_id: 1,
|
|
||||||
message_id: 1,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let template_config = template_config_data::get(&summon_cfg.blueprint_type).unwrap();
|
|
||||||
let concomitant_config_id = template_config.id;
|
|
||||||
tracing::info!("Adding Concomitant with id: {}", concomitant_config_id);
|
|
||||||
let con_buffs = concomitant_buffs.clone();
|
|
||||||
|
|
||||||
let con_entity = world.create_entity(
|
let con_entity = world.create_entity(
|
||||||
cur_summon_id,
|
cur_summon_id,
|
||||||
|
@ -60,7 +39,13 @@ pub fn summon_concomitant(player: &Player, world: &mut WorldEntity, summon_cfg:
|
||||||
player.basic_info.cur_map_id,
|
player.basic_info.cur_map_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
world
|
for buff_id in &summon_cfg.born_buff_id {
|
||||||
|
concomitant_buffs.push(world.create_buff(cur_summon_id, *buff_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
tracing::info!("Adding Concomitant with id: {} and buffs {:#?}", concomitant_config_id, concomitant_buffs);
|
||||||
|
|
||||||
|
(world
|
||||||
.create_builder(con_entity)
|
.create_builder(con_entity)
|
||||||
.with(ComponentContainer::PlayerOwnedEntityMarker(PlayerOwnedEntityMarker {
|
.with(ComponentContainer::PlayerOwnedEntityMarker(PlayerOwnedEntityMarker {
|
||||||
entity_type: EEntityType::Monster,
|
entity_type: EEntityType::Monster,
|
||||||
|
@ -84,249 +69,190 @@ pub fn summon_concomitant(player: &Player, world: &mut WorldEntity, summon_cfg:
|
||||||
}))
|
}))
|
||||||
.with(ComponentContainer::Attribute(Attribute::from_data(
|
.with(ComponentContainer::Attribute(Attribute::from_data(
|
||||||
base_property_data::iter()
|
base_property_data::iter()
|
||||||
.find(|d| d.id == template_config.components_data.attribute_component.clone().unwrap().property_id.unwrap())
|
.find(|d| d.id == template_cfg.components_data.attribute_component.clone().unwrap().property_id.unwrap())
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
)))
|
)))
|
||||||
.with(ComponentContainer::Movement(Movement::default()))
|
.with(ComponentContainer::FightBuff(FightBuff { fight_buff_infos: concomitant_buffs, ..Default::default() }))
|
||||||
.with(ComponentContainer::FightBuff(FightBuff { fight_buff_infos: con_buffs, ..Default::default() }))
|
|
||||||
.with(ComponentContainer::Summoner(Summoner {
|
.with(ComponentContainer::Summoner(Summoner {
|
||||||
summon_cfg_id: summon_cfg.id,
|
summon_cfg_id: summon_cfg.id,
|
||||||
summon_skill_id: 0,
|
summon_skill_id: 0,
|
||||||
summon_type: ESummonType::ESummonTypeConcomitantCustom.into()
|
summon_type: ESummonType::ESummonTypeConcomitantCustom.into()
|
||||||
}))
|
}))
|
||||||
.build()
|
.with(ComponentContainer::Autonomous(Autonomous { autonomous_id: 3 }))
|
||||||
|
.build(), summon_cfg.born_buff_id.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
fn add_player_entity(player: &Player, formation: &RoleFormation, world: &mut WorldEntity) {
|
||||||
macro_rules! create_player_entity_pb {
|
let role_vec = formation
|
||||||
($role_list:expr, $cur_map_id:expr, $player:expr, $player_id:expr, $position:expr, $explore_tools:expr, $world:expr) => {{
|
|
||||||
use $crate::logic::components::Concomitant;
|
|
||||||
use $crate::logic::utils::world_util::summon_concomitant;
|
|
||||||
|
|
||||||
let current_formation = $player
|
|
||||||
.formation_list
|
|
||||||
.get(&$player.cur_formation_id)
|
|
||||||
.unwrap();
|
|
||||||
let cur_role_id = current_formation.cur_role;
|
|
||||||
|
|
||||||
let mut pbs = Vec::new();
|
|
||||||
|
|
||||||
for role in $role_list {
|
|
||||||
let role_id: i32 = role.role_id;
|
|
||||||
let entity =
|
|
||||||
$world.create_entity(role.role_id, EEntityType::Player.into(), $cur_map_id);
|
|
||||||
let fight_buff_infos = $world.generate_role_permanent_buffs(entity.entity_id, role_id);
|
|
||||||
|
|
||||||
let buffs = FightBuff {
|
|
||||||
fight_buff_infos,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: add actual weapon switching and remove this! - rabby
|
|
||||||
let equip_weapon = match role.role_id {
|
|
||||||
1409 => 21020056, // cartethyia
|
|
||||||
1207 => 21010036, // lupa
|
|
||||||
1301 => 21010036,
|
|
||||||
_ => role.equip_weapon,
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut concomitants: Vec<i64> = vec![];
|
|
||||||
let mut summon_id = 1000;
|
|
||||||
|
|
||||||
for (_, summon_cfg) in wicked_waifus_data::summon_cfg_data::iter().filter(|(_, cfg)| {
|
|
||||||
cfg.blueprint_type.starts_with("Player0") && cfg.born_buff_id.iter().any(|x| {
|
|
||||||
x.to_string().starts_with(&role.role_id.to_string())
|
|
||||||
})
|
|
||||||
}) {
|
|
||||||
let concomitant = summon_concomitant($player, $world, summon_cfg, summon_id);
|
|
||||||
summon_id += 1;
|
|
||||||
concomitants.push(concomitant.entity_id.into());
|
|
||||||
|
|
||||||
let pb = EntityPb {
|
|
||||||
id: summon_id as i64,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
pbs.push(pb);
|
|
||||||
}
|
|
||||||
|
|
||||||
let entity = $world
|
|
||||||
.create_builder(entity)
|
|
||||||
.with(ComponentContainer::PlayerOwnedEntityMarker(
|
|
||||||
PlayerOwnedEntityMarker {
|
|
||||||
entity_type: EEntityType::Player,
|
|
||||||
},
|
|
||||||
))
|
|
||||||
.with(ComponentContainer::EntityConfig(EntityConfig {
|
|
||||||
camp: 0,
|
|
||||||
config_id: role.role_id,
|
|
||||||
config_type: EntityConfigType::Character,
|
|
||||||
entity_type: EEntityType::Player.into(),
|
|
||||||
entity_state: EntityState::Default,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::OwnerPlayer(OwnerPlayer($player_id)))
|
|
||||||
.with(ComponentContainer::Position(Position($position)))
|
|
||||||
.with(ComponentContainer::Visibility(Visibility {
|
|
||||||
is_visible: role.role_id == cur_role_id,
|
|
||||||
is_actor_visible: true,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::Attribute(Attribute::from_data(
|
|
||||||
&role.get_base_properties(),
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
)))
|
|
||||||
.with(ComponentContainer::Movement(Movement::default()))
|
|
||||||
.with(ComponentContainer::Equip(Equip {
|
|
||||||
weapon_id: equip_weapon,
|
|
||||||
weapon_breach_level: 90,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::VisionSkill(VisionSkill {
|
|
||||||
skill_id: $explore_tools.active_explore_skill,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::RoleSkin(RoleSkin {
|
|
||||||
skin_id: role.skin_id,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
|
||||||
skin_id: 84000001,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::FightBuff(buffs))
|
|
||||||
.with(ComponentContainer::Concomitant(Concomitant {
|
|
||||||
vision_entity_id: 0,
|
|
||||||
custom_entity_ids: concomitants,
|
|
||||||
phantom_role_id: 0
|
|
||||||
}))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let mut pb = EntityPb {
|
|
||||||
id: entity.entity_id as i64,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
$world
|
|
||||||
.get_entity_components(entity.entity_id)
|
|
||||||
.into_iter()
|
|
||||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
|
||||||
pbs.push(pb);
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityAddNotify {
|
|
||||||
entity_pbs: pbs,
|
|
||||||
remove_tag_ids: true,
|
|
||||||
}
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn add_player_entities(player: &Player) {
|
|
||||||
let mut world_ref = player.world.borrow_mut();
|
|
||||||
let world = world_ref.get_mut_world_entity();
|
|
||||||
|
|
||||||
let current_formation = player.formation_list.get(&player.cur_formation_id).unwrap();
|
|
||||||
|
|
||||||
let role_vec = current_formation
|
|
||||||
.role_ids
|
.role_ids
|
||||||
.iter()
|
.iter()
|
||||||
.map(|role_id| player.role_list.get(role_id).unwrap())
|
.map(|role_id| player.role_list.get(role_id).unwrap())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let cur_role_id = current_formation.cur_role;
|
|
||||||
|
|
||||||
if world.active_entity_empty() {
|
tracing::info!("adding player entity for formation {:#?}", formation.role_ids);
|
||||||
for role in role_vec {
|
let cur_role_id = formation.cur_role;
|
||||||
let entity = world.create_entity(
|
|
||||||
role.role_id,
|
|
||||||
EEntityType::Player.into(),
|
|
||||||
player.basic_info.cur_map_id,
|
|
||||||
);
|
|
||||||
|
|
||||||
let fight_buff_infos = world.generate_role_permanent_buffs(entity.entity_id, role.role_id);
|
let mut pbs = Vec::new();
|
||||||
let buf_manager = FightBuff {
|
|
||||||
fight_buff_infos,
|
|
||||||
list_buff_effect_cd: vec![]
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: add actual weapon switching and remove this! - rabby
|
for role in role_vec {
|
||||||
let equip_weapon = match role.role_id {
|
let entity = world.create_entity(
|
||||||
1409 => 21020056, // cartethyia
|
role.role_id,
|
||||||
1207 => 21010036, // lupa
|
EEntityType::Player.into(),
|
||||||
1301 => 21010036,
|
player.basic_info.cur_map_id,
|
||||||
_ => role.equip_weapon,
|
);
|
||||||
};
|
|
||||||
|
let mut fight_buff_infos = world.generate_role_permanent_buffs(entity.entity_id, role.role_id);
|
||||||
|
|
||||||
|
// TODO: add actual weapon switching and remove this! - rabby
|
||||||
|
let equip_weapon = match role.role_id {
|
||||||
|
1409 => 21020056, // cartethyia
|
||||||
|
1207 => 21010036, // lupa
|
||||||
|
1301 => 21010036,
|
||||||
|
_ => role.equip_weapon,
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut concomitants: Vec<i64> = vec![];
|
||||||
|
let mut concom_pbs = Vec::new();
|
||||||
|
|
||||||
|
let role_data = wicked_waifus_data::role_info_data::iter().find(|r| r.id == role.role_id).unwrap();
|
||||||
|
if let Some(skin_damage_first) = role_data.skin_damage.first() {
|
||||||
|
let role_name = skin_damage_first.as_str()
|
||||||
|
.split('/').next_back()
|
||||||
|
.and_then(|s| s.strip_prefix("DA_"))
|
||||||
|
.and_then(|s| s.split('_').next()).unwrap();
|
||||||
|
|
||||||
let mut concomitants: Vec<i64> = vec![];
|
|
||||||
let mut summon_id = 1000;
|
let mut summon_id = 1000;
|
||||||
|
for model_config in wicked_waifus_data::model_config_preload_data::iter().filter(|cfg| {
|
||||||
for (_, summon_cfg) in wicked_waifus_data::summon_cfg_data::iter().filter(|(_, cfg)| {
|
cfg.actor_class_path.starts_with("/Game/Aki/Character/Monster/Summon/") && cfg.actor_class_path.contains(role_name)
|
||||||
cfg.blueprint_type.starts_with("Player0") && cfg.born_buff_id.iter().any(|x| {
|
|
||||||
x.to_string().starts_with(&role.role_id.to_string())
|
|
||||||
})
|
|
||||||
}) {
|
}) {
|
||||||
let concomitant = summon_concomitant(player, world, summon_cfg, summon_id);
|
let template_cfg = wicked_waifus_data::template_config_data::iter().find(|cfg| {
|
||||||
|
let template_model_component = cfg.1.components_data.model_component.clone();
|
||||||
|
template_model_component.is_some()
|
||||||
|
&&
|
||||||
|
template_model_component.clone().unwrap().model_type.unwrap().model_id.is_some()
|
||||||
|
&&
|
||||||
|
template_model_component.unwrap().model_type.unwrap().model_id.unwrap() == model_config.id
|
||||||
|
}).unwrap().1;
|
||||||
|
|
||||||
|
let (concomitant, buffs) = summon_concomitant(player, world, template_cfg, summon_id);
|
||||||
|
let mut pb = EntityPb {
|
||||||
|
id: summon_id as i64,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
for buff_id in buffs {
|
||||||
|
fight_buff_infos.push(world.create_buff(entity.entity_id, buff_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
world
|
||||||
|
.get_entity_components(summon_id)
|
||||||
|
.into_iter()
|
||||||
|
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||||
|
concom_pbs.push(pb);
|
||||||
summon_id += 1;
|
summon_id += 1;
|
||||||
concomitants.push(concomitant.entity_id.into());
|
concomitants.push(concomitant.entity_id.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
let entity = world
|
player.notify(EntityAddNotify {
|
||||||
.create_builder(entity)
|
entity_pbs: concom_pbs,
|
||||||
.with(ComponentContainer::PlayerOwnedEntityMarker(
|
remove_tag_ids: true,
|
||||||
PlayerOwnedEntityMarker {
|
});
|
||||||
entity_type: EEntityType::Player,
|
|
||||||
},
|
|
||||||
))
|
|
||||||
.with(ComponentContainer::EntityConfig(EntityConfig {
|
|
||||||
camp: 0,
|
|
||||||
config_id: role.role_id,
|
|
||||||
config_type: EntityConfigType::Character,
|
|
||||||
entity_type: EEntityType::Player,
|
|
||||||
entity_state: EntityState::Default,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::OwnerPlayer(OwnerPlayer(
|
|
||||||
player.basic_info.id,
|
|
||||||
)))
|
|
||||||
.with(ComponentContainer::Position(Position(
|
|
||||||
player.location.position.clone(),
|
|
||||||
)))
|
|
||||||
.with(ComponentContainer::Visibility(Visibility {
|
|
||||||
is_visible: role.role_id == cur_role_id,
|
|
||||||
is_actor_visible: true,
|
|
||||||
}))
|
|
||||||
// TODO: from role
|
|
||||||
// TODO: Check if role has hardness or rage_mode
|
|
||||||
// TODO: Support AddProp from Equipment(Echo, weapon, buffs??), weapon base state goes to base_prop too.
|
|
||||||
.with(ComponentContainer::Attribute(Attribute::from_data(
|
|
||||||
&role.get_base_properties(),
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
)))
|
|
||||||
.with(ComponentContainer::Movement(Movement::default()))
|
|
||||||
.with(ComponentContainer::Equip(Equip {
|
|
||||||
weapon_id: equip_weapon,
|
|
||||||
weapon_breach_level: 0, // TODO: store this too
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::VisionSkill(VisionSkill {
|
|
||||||
skill_id: player.explore_tools.active_explore_skill,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::RoleSkin(RoleSkin {
|
|
||||||
skin_id: role.skin_id,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
|
||||||
skin_id: 84000001,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::FightBuff(buf_manager))
|
|
||||||
.with(ComponentContainer::Concomitant(Concomitant {
|
|
||||||
vision_entity_id: 0,
|
|
||||||
custom_entity_ids: concomitants,
|
|
||||||
phantom_role_id: 0
|
|
||||||
}))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
tracing::debug!(
|
|
||||||
"created player entity, id: {}, role_id: {}",
|
|
||||||
entity.entity_id,
|
|
||||||
role.role_id
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
fight_buff_infos.dedup_by(|x, z| x.buff_id == z.buff_id);
|
||||||
|
|
||||||
|
let buf_manager = FightBuff {
|
||||||
|
fight_buff_infos,
|
||||||
|
list_buff_effect_cd: vec![]
|
||||||
|
};
|
||||||
|
|
||||||
|
let entity = world
|
||||||
|
.create_builder(entity)
|
||||||
|
.with(ComponentContainer::PlayerOwnedEntityMarker(
|
||||||
|
PlayerOwnedEntityMarker {
|
||||||
|
entity_type: EEntityType::Player,
|
||||||
|
},
|
||||||
|
))
|
||||||
|
.with(ComponentContainer::EntityConfig(EntityConfig {
|
||||||
|
camp: 0,
|
||||||
|
config_id: role.role_id,
|
||||||
|
config_type: EntityConfigType::Character,
|
||||||
|
entity_type: EEntityType::Player,
|
||||||
|
entity_state: EntityState::Default,
|
||||||
|
}))
|
||||||
|
.with(ComponentContainer::OwnerPlayer(OwnerPlayer(
|
||||||
|
player.basic_info.id,
|
||||||
|
)))
|
||||||
|
.with(ComponentContainer::Position(Position(
|
||||||
|
player.location.position.clone(),
|
||||||
|
)))
|
||||||
|
.with(ComponentContainer::Visibility(Visibility {
|
||||||
|
is_visible: role.role_id == cur_role_id,
|
||||||
|
is_actor_visible: true,
|
||||||
|
}))
|
||||||
|
// TODO: from role
|
||||||
|
// TODO: Check if role has hardness or rage_mode
|
||||||
|
// TODO: Support AddProp from Equipment(Echo, weapon, buffs??), weapon base state goes to base_prop too.
|
||||||
|
.with(ComponentContainer::Attribute(Attribute::from_data(
|
||||||
|
&role.get_base_properties(),
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
)))
|
||||||
|
.with(ComponentContainer::Movement(Movement::default()))
|
||||||
|
.with(ComponentContainer::Equip(Equip {
|
||||||
|
weapon_id: equip_weapon,
|
||||||
|
weapon_breach_level: 0, // TODO: store this too
|
||||||
|
}))
|
||||||
|
.with(ComponentContainer::VisionSkill(VisionSkill {
|
||||||
|
skill_id: player.explore_tools.active_explore_skill,
|
||||||
|
}))
|
||||||
|
.with(ComponentContainer::RoleSkin(RoleSkin {
|
||||||
|
skin_id: role.skin_id,
|
||||||
|
}))
|
||||||
|
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
||||||
|
skin_id: 84000001,
|
||||||
|
}))
|
||||||
|
.with(ComponentContainer::FightBuff(buf_manager))
|
||||||
|
.with(ComponentContainer::Concomitant(Concomitant {
|
||||||
|
vision_entity_id: 0,
|
||||||
|
custom_entity_ids: concomitants,
|
||||||
|
phantom_role_id: 0
|
||||||
|
}))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let mut pb = EntityPb {
|
||||||
|
id: entity.entity_id as i64,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
world
|
||||||
|
.get_entity_components(entity.entity_id)
|
||||||
|
.into_iter()
|
||||||
|
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||||
|
pbs.push(pb);
|
||||||
|
|
||||||
|
tracing::debug!(
|
||||||
|
"created player entity, id: {}, role_id: {}",
|
||||||
|
entity.entity_id,
|
||||||
|
role.role_id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player.notify(EntityAddNotify {
|
||||||
|
entity_pbs: pbs,
|
||||||
|
remove_tag_ids: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_player_entities(player: &Player, formation: &RoleFormation, possible_world: Option<&mut WorldEntity>) {
|
||||||
|
match possible_world {
|
||||||
|
Some(world) => add_player_entity(player, formation, world),
|
||||||
|
None => {
|
||||||
|
let mut world_ref = player.world.borrow_mut();
|
||||||
|
add_player_entity(player, formation, world_ref.get_mut_world_entity())
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_scene_information(player: &Player) -> SceneInformation {
|
pub fn build_scene_information(player: &Player) -> SceneInformation {
|
||||||
|
|
Loading…
Reference in a new issue