for xavo to look at cuz atp im super confused

This commit is contained in:
RabbyDevs 2025-05-19 00:09:20 +03:00
parent e5211c759a
commit 3adf8cdc19
11 changed files with 358 additions and 426 deletions

30
.zed/settings.json Normal file
View file

@ -0,0 +1,30 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
{
"lsp": {
"rust-analyzer": {
"initialization_options": {
// get more cargo-less diagnostics from rust-analyzer,
// which might include false-positives (those can be turned off by their names)
"diagnostics": {
"experimental": {
"enable": true
}
},
// To disable the checking entirely
// (ignores all cargo and check settings below)
"checkOnSave": false,
// To check the `lib` target only.
"cargo": {
"allTargets": false
},
// Use `-p` instead of `--workspace` for cargo check
"check": {
"workspace": false
}
}
}
}
}

View file

@ -86,12 +86,13 @@ impl BufManager {
pub fn create_permanent_buffs(&mut self, origin_id: i64, role_id: i32) -> Vec<FightBuffInformation> {
let mut buffs = wicked_waifus_data::buff_data::iter().filter(|(id, buf)| {
let id_str = id.to_string();
let role_str = role_id.to_string();
id_str.starts_with(&role_str)
&&
id_str[role_str.len()..].chars().all(|c| c == '0') // ensure remaining chars are all '0'
id.to_string().starts_with(&role_id.to_string()) // must be part of char kit :)
&&
!id.to_string().contains("666")// KURO IS EVIL
&&
buf.duration_policy == 1
&&
!buf.ge_desc.contains("【废弃】") // remove "deprecated" buffs
})
.map(|x| *x.0)
.collect::<Vec<i64>>();

View file

@ -1,16 +1,16 @@
use std::collections::HashMap;
use wicked_waifus_protocol::{
CommonTagData, EntityCommonTagNotify, EntityStateReadyNotify, ItemRewardNotify,
NormalItemUpdateNotify, RewardItemInfo, WR,
CommonTagData, EntityCommonTagNotify, EntityStateReadyNotify, FightBuffInformation, ItemRewardNotify, NormalItemUpdateNotify, RewardItemInfo, WR
};
use wicked_waifus_data::pb_components::action::{
ChangeSelfEntityState, CollectParams, UnlockTeleportTrigger
AddBuffToEntity, AddBuffToPlayer, ChangeSelfEntityState, CollectParams, RemoveBuffFromEntity, RemoveBuffFromPlayer, UnlockTeleportTrigger
};
use wicked_waifus_data::pb_components::entity_state::EntityStateComponent;
use crate::logic::ecs::component::ComponentContainer;
use crate::logic::ecs::world::WorldEntity;
use crate::logic::handler::handle_action;
use crate::logic::player::{ItemUsage, Player};
use crate::logic::utils::tag_utils;
@ -163,3 +163,93 @@ pub fn change_self_entity_state_action(
ready: true, // TODO: Always true? or shall we compare it to something??
});
}
fn add_buff_to_entity(
world: &mut WorldEntity,
entity_ids: Vec<i64>,
buff_ids: Vec<i64>,
) {
for entity_id in entity_ids {
let (Some(mut buff_component),) = query_components!(world, entity_id, FightBuff) else {
continue;
};
for buff_id in &buff_ids {
buff_component.fight_buff_infos.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,
});
}
}
}
pub fn add_buff_to_entity_action(
player: &mut Player,
entity_id: i64,
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
template_config: &wicked_waifus_data::TemplateConfigData,
params: AddBuffToEntity
) {
tracing::info!("entity buff request received with the following details: {:#?}.", params);
let mut world_ref = player.world.borrow_mut();
let world = world_ref.get_mut_world_entity();
match params {
AddBuffToEntity::SingleEntityBuffs(single_entity_buffs) => {
add_buff_to_entity(world, vec![single_entity_buffs.entity_id], single_entity_buffs.buff_ids)
},
AddBuffToEntity::MultipleEntitiesBuff(multiple_entities_buff) => {
add_buff_to_entity(world, multiple_entities_buff.entity_ids, multiple_entities_buff.buff_ids)
},
AddBuffToEntity::SelfEntityBuff(self_entity_buff) => {
add_buff_to_entity(world, vec![entity_id], self_entity_buff.buff_ids)
},
}
}
pub fn remove_buff_from_entity_action(
player: &mut Player,
entity_id: i64,
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
template_config: &wicked_waifus_data::TemplateConfigData,
params: RemoveBuffFromEntity
) {
tracing::info!("entity buff request received with the following details: {:#?}.", params);
let mut world_ref = player.world.borrow_mut();
let world = world_ref.get_mut_world_entity();
}
pub fn add_buff_to_player_action(
player: &mut Player,
entity_id: i64,
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
template_config: &wicked_waifus_data::TemplateConfigData,
params: AddBuffToPlayer
) {
tracing::info!("entity buff request received with the following details: {:#?}.", params);
let mut world_ref = player.world.borrow_mut();
let world = world_ref.get_mut_world_entity();
}
pub fn remove_buff_from_player_action(
player: &mut Player,
entity_id: i64,
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
template_config: &wicked_waifus_data::TemplateConfigData,
params: RemoveBuffFromPlayer
) {
tracing::info!("entity buff request received with the following details: {:#?}.", params);
let mut world_ref = player.world.borrow_mut();
let world = world_ref.get_mut_world_entity();
}

View file

@ -1,4 +1,4 @@
use wicked_waifus_protocol::{EntityAccessInfo, EntityAccessRangeRequest, EntityAccessRangeResponse, EntityActiveRequest, EntityActiveResponse, EntityFollowTrackRequest, EntityFollowTrackResponse, EntityInteractRequest, EntityInteractResponse, EntityOnLandedRequest, EntityOnLandedResponse, EntityPb, EntityPositionRequest, EntityPositionResponse, ErrorCode, GetRewardTreasureBoxRequest, GetRewardTreasureBoxResponse, MovePackagePush};
use wicked_waifus_protocol::{ApplyGameplayEffectPush, ApplyGameplayEffectRequest, ApplyGameplayEffectResponse, EntityAccessInfo, EntityAccessRangeRequest, EntityAccessRangeResponse, EntityActiveRequest, EntityActiveResponse, EntityFollowTrackRequest, EntityFollowTrackResponse, EntityInteractRequest, EntityInteractResponse, EntityOnLandedRequest, EntityOnLandedResponse, EntityPb, EntityPositionRequest, EntityPositionResponse, ErrorCode, GetRewardTreasureBoxRequest, GetRewardTreasureBoxResponse, MovePackagePush, OrderApplyBuffRequest, OrderApplyBuffResponse, OrderRemoveBuffRequest, OrderRemoveBuffResponse, RemoveGameplayEffectPush, RemoveGameplayEffectRequest, RemoveGameplayEffectResponse};
use wicked_waifus_data::pb_components::option::OptionType;
@ -234,6 +234,52 @@ pub fn on_get_reward_treasure_box_request(
tracing::debug!("GetRewardTreasureBoxRequest with ID: {} and ConfigID {config_id}", request.entity_id);
}
pub fn on_order_apply_buff_request(
player: &Player,
request: OrderApplyBuffRequest,
_response: &mut OrderApplyBuffResponse,
) {
tracing::info!("OrderApplyBuffRequest receuived");
}
pub fn on_order_remove_buff_request(
player: &Player,
request: OrderRemoveBuffRequest,
_response: &mut OrderRemoveBuffResponse,
) {
tracing::info!("OrderRemoveBuffRequest receuived");
}
pub fn on_apply_gameplay_effect_request(
player: &Player,
request: ApplyGameplayEffectRequest,
response: &mut ApplyGameplayEffectResponse
) {
tracing::info!("applygameplayeffect receuived");
}
pub fn on_apply_gameplay_effect_push(
player: &Player,
push: ApplyGameplayEffectPush
) {
tracing::info!("applygameplayeffect receuived");
}
pub fn on_remove_gameplay_effect_request(
player: &Player,
request: RemoveGameplayEffectRequest,
response: &mut RemoveGameplayEffectResponse
) {
tracing::info!("applygameplayeffect receuived");
}
pub fn on_remove_gameplay_effect_push(
player: &Player,
push: RemoveGameplayEffectPush
) {
tracing::info!("applygameplayeffect receuived");
}
fn get_config_id_from_entity_id(player: &Player, entity_id: i64) -> i64 {
let world_ref = player.world.borrow();
let world = world_ref.get_world_entity();

View file

@ -183,6 +183,10 @@ handle_request! {
EntityInteract;
EntityFollowTrack;
GetRewardTreasureBox;
OrderApplyBuff;
OrderRemoveBuff;
ApplyGameplayEffect;
RemoveGameplayEffect;
// Friend (TODO: Implement them)
FriendAll;
@ -321,6 +325,9 @@ handle_push! {
// Entity
MovePackage;
ApplyGameplayEffect;
RemoveGameplayEffect;
// Misc
VersionInfo;
}
@ -353,10 +360,10 @@ handle_action! {
// AwakeEntity,
// ChangeLiftTarget,
// CalculateVar,
// AddBuffToPlayer,
// RemoveBuffFromPlayer,
// AddBuffToEntity,
// RemoveBuffFromEntity,
AddBuffToPlayer,
RemoveBuffFromPlayer,
AddBuffToEntity,
RemoveBuffFromEntity,
// Prompt,
// SetEntityVisible,
// DestroyEntity,

View file

@ -9,6 +9,7 @@ use wicked_waifus_protocol::{
use crate::logic::player::Player;
use crate::logic::role::{Role, RoleFormation};
use crate::logic::utils::world_util::summon_concomitant;
pub fn on_role_show_list_update_request(
player: &mut Player,
@ -83,7 +84,7 @@ pub fn on_update_formation_request(
});
player.notify(player.build_player_entity_remove_notify(
removed_entities,
ERemoveEntityType::RemoveTypeNormal,
ERemoveEntityType::RemoveTypeForce,
));
}
@ -94,7 +95,7 @@ pub fn on_update_formation_request(
.collect();
if !added_roles.is_empty() {
// add new roles
// add new role entities
player.notify(player.build_player_entity_add_notify(added_roles, world));
}

View file

@ -1,7 +1,10 @@
use wicked_waifus_commons::time_util;
use wicked_waifus_protocol::{FormationAttr, FormationAttrNotify};
use wicked_waifus_protocol_internal::PlayerSaveData;
use wicked_waifus_protocol::{message::Message, AfterJoinSceneNotify, EnterGameResponse, JoinSceneNotify, SilenceNpcNotify, TransitionOptionPb};
use super::{ecs::world::World, player::Player, utils::world_util};
use crate::logic::ecs::world::WorldEntity;
use crate::{
logic,
player_save_task::{self, PlayerSaveReason},
session::Session,
};
use std::collections::hash_map::Entry::Vacant;
use std::{
cell::RefCell,
@ -14,16 +17,20 @@ use std::{
thread,
time::Duration,
};
use super::{ecs::world::World, player::Player, utils::world_util};
use crate::logic::ecs::world::WorldEntity;
use crate::{logic, player_save_task::{self, PlayerSaveReason}, session::Session};
use wicked_waifus_commons::time_util;
use wicked_waifus_protocol::{
message::Message, AfterJoinSceneNotify, EnterGameResponse, JoinSceneNotify, SilenceNpcNotify,
TransitionOptionPb,
};
use wicked_waifus_protocol::{FormationAttr, FormationAttrNotify};
use wicked_waifus_protocol_internal::PlayerSaveData;
pub enum LogicInput {
AddPlayer {
player_id: i32,
enter_rpc_id: u16,
session: Arc<Session>,
player_save_data: PlayerSaveData,
player_save_data: Box<PlayerSaveData>,
},
RemovePlayer {
player_id: i32,
@ -133,16 +140,14 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
} => {
let (player, is_player) = if let Vacant(e) = state.players.entry(player_id) {
(
e.insert(RefCell::new(Player::load_from_save(player_save_data))),
e.insert(RefCell::new(Player::load_from_save(*player_save_data))),
true,
)
} else if let Some(player) = state.players.get_mut(&player_id) {
(player, false)
} else {
if let Some(player) = state.players.get_mut(&player_id) {
(player, false)
} else {
tracing::warn!("logic_thread: get player requested, but player {player_id} with data doesn't exist");
return;
}
tracing::warn!("logic_thread: get player requested, but player {player_id} with data doesn't exist");
return;
};
let mut player = player.borrow_mut();
@ -179,8 +184,20 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
player.notify(FormationAttrNotify {
duration: 1534854458,
formation_attrs: vec![
FormationAttr { attr_id: 1, ratio: 2400, base_max_value: 24000, max_value: 24000, current_value: 24000 },
FormationAttr { attr_id: 10, ratio: 2400, base_max_value: 15000, max_value: 15000, current_value: 15000 },
FormationAttr {
attr_id: 1,
ratio: 2400,
base_max_value: 24000,
max_value: 24000,
current_value: 24000,
},
FormationAttr {
attr_id: 10,
ratio: 2400,
base_max_value: 15000,
max_value: 15000,
current_value: 15000,
},
],
});

View file

@ -1,292 +0,0 @@
use std::collections::HashMap;
use wicked_waifus_protocol::{
CommonTagData, EntityCommonTagNotify, EntityStateReadyNotify, ItemRewardNotify,
NormalItemUpdateNotify, RewardItemInfo, WR,
};
use wicked_waifus_data::pb_components::action::{
Action, ChangeSelfEntityState, UnlockTeleportTrigger,
};
use wicked_waifus_data::pb_components::entity_state::EntityStateComponent;
use crate::logic::ecs::component::ComponentContainer;
use crate::logic::handler::handle_action;
use crate::logic::player::{ItemUsage, Player};
use crate::logic::utils::tag_utils;
use crate::query_components;
macro_rules! unimplemented_action {
($action:ident) => {{
tracing::warn!("Action not implemented for: {:?}", $action);
}};
}
// pub fn perform_action(player: &mut Player,
// entity_id: i64,
// level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
// template_config: &wicked_waifus_data::TemplateConfigData,
// element: Action) {
// match element {
// Action::SetBattleState(action) => unimplemented_action! { action },
// Action::ExecBattleAction(action) => unimplemented_action! { action },
// Action::WaitBattleCondition(action) => unimplemented_action! { action },
// Action::PlayFlow(action) => unimplemented_action! { action },
// Action::Collect(_) => collect_action(player, level_entity_data, template_config),
// Action::LeisureInteract(action) => unimplemented_action! { action },
// Action::UnlockTeleportTrigger(action) => unlock_teleport_trigger(player, action.params),
// Action::EnableTemporaryTeleport(action) => unimplemented_action! { action },
// Action::OpenSystemBoard(action) => unimplemented_action! { action },
// Action::OpenSystemFunction(action) => unimplemented_action! { action },
// Action::ChangeSelfEntityState(action) => change_self_entity_state(player, entity_id, level_entity_data, template_config, action.params),
// Action::SetPlayerOperationRestriction(action) => unimplemented_action! { action },
// Action::Wait(action) => unimplemented_action! { action },
// Action::ChangeEntityState(action) => unimplemented_action! { action },
// Action::Log(action) => unimplemented_action! { action },
// Action::EnableNearbyTracking(action) => unimplemented_action! { action },
// Action::TeleportDungeon(action) => unimplemented_action! { action },
// Action::DestroySelf(action) => unimplemented_action! { action },
// Action::CameraLookAt(action) => unimplemented_action! { action },
// Action::StopCameraLookAt(action) => unimplemented_action! { action },
// Action::EnterOrbitalCamera(action) => unimplemented_action! { action },
// Action::ExitOrbitalCamera(action) => unimplemented_action! { action },
// Action::SendAiEvent(action) => unimplemented_action! { action },
// Action::SetInteractionLockState(action) => unimplemented_action! { action },
// Action::AwakeEntity(action) => unimplemented_action! { action },
// Action::ChangeLiftTarget(action) => unimplemented_action! { action },
// Action::CalculateVar(action) => unimplemented_action! { action },
// Action::AddBuffToPlayer(action) => unimplemented_action! { action },
// Action::RemoveBuffFromPlayer(action) => unimplemented_action! { action },
// Action::AddBuffToEntity(action) => unimplemented_action! { action },
// Action::RemoveBuffFromEntity(action) => unimplemented_action! { action },
// Action::Prompt(action) => unimplemented_action! { action },
// Action::SetEntityVisible(action) => unimplemented_action! { action },
// Action::DestroyEntity(action) => unimplemented_action! { action },
// Action::GuideTrigger(action) => unimplemented_action! { action },
// Action::TriggerCameraShake(action) => unimplemented_action! { action },
// Action::SetVar(action) => unimplemented_action! { action },
// Action::VehicleEnter(action) => unimplemented_action! { action },
// Action::VehicleExitPlayer(action) => unimplemented_action! { action },
// Action::LockEntity(action) => unimplemented_action! { action },
// Action::UnlockEntity(action) => unimplemented_action! { action },
// Action::CommonTip(action) => unimplemented_action! { action },
// Action::CommonTip2(action) => unimplemented_action! { action },
// Action::PostAkEvent(action) => unimplemented_action! { action },
// Action::VehicleEnterNpc(action) => unimplemented_action! { action },
// Action::VehicleExitNpc(action) => unimplemented_action! { action },
// Action::PlayerLookAt(action) => unimplemented_action! { action },
// Action::PlayBubble(action) => unimplemented_action! { action },
// Action::AddPlayBubble(action) => unimplemented_action! { action },
// Action::ClearPlayBubble(action) => unimplemented_action! { action },
// Action::ExecRiskHarvestEffect(action) => unimplemented_action! { action },
// Action::EnableLevelPlay(action) => unimplemented_action! { action },
// Action::ClaimLevelPlayReward(action) => unimplemented_action! { action },
// Action::SettlementDungeon(action) => unimplemented_action! { action },
// Action::ExitDungeon(action) => unimplemented_action! { action },
// Action::FinishDungeon(action) => unimplemented_action! { action },
// Action::RecordDungeonEvent(action) => unimplemented_action! { action },
// Action::RecoverDurability(action) => unimplemented_action! { action },
// Action::FadeInScreen(action) => unimplemented_action! { action },
// Action::FadeOutScreen(action) => unimplemented_action! { action },
// Action::ChangeNpcPerformState(action) => unimplemented_action! { action },
// Action::EntityTurnTo(action) => unimplemented_action! { action },
// Action::EntityLookAt(action) => unimplemented_action! { action },
// Action::ToggleMapMarkState(action) => unimplemented_action! { action },
// Action::RandomVar(action) => unimplemented_action! { action },
// Action::ModifySceneItemAttributeTag(action) => unimplemented_action! { action },
// Action::VehicleWaterfallClimbing(action) => unimplemented_action! { action },
// Action::VehicleTeleport(action) => unimplemented_action! { action },
// Action::RogueGotoNextFloor(action) => unimplemented_action! { action },
// Action::RogueReceiveReward(action) => unimplemented_action! { action },
// Action::RogueSelectRoom(action) => unimplemented_action! { action },
// Action::RogueActivatePortal(action) => unimplemented_action! { action },
// Action::MowingTowerGotoNextFloor(action) => unimplemented_action! { action },
// Action::SlashAndTowerGotoNextFloor(action) => unimplemented_action! { action },
// Action::PlayMontage(action) => unimplemented_action! { action },
// Action::OpenSystemBoardWithReturn(action) => unimplemented_action! { action },
// Action::UnlockSystemItem(action) => unimplemented_action! { action },
// Action::SetSportsState(action) => unimplemented_action! { action },
// Action::OpenSimpleGameplay(action) => unimplemented_action! { action },
// Action::PlayEffect(action) => unimplemented_action! { action },
// Action::PlayEffect2(action) => unimplemented_action! { action },
// Action::RestorePlayerCameraAdjustment(action) => unimplemented_action! { action },
// Action::AdjustPlayerCamera(action) => unimplemented_action! { action },
// Action::SetPlayerPos(action) => unimplemented_action! { action },
// Action::MoveWithSpline(action) => unimplemented_action! { action },
// Action::EnableSplineMoveModel(action) => unimplemented_action! { action },
// Action::ToggleScanSplineEffect(action) => unimplemented_action! { action },
// Action::MoveSceneItem(action) => unimplemented_action! { action },
// Action::StopSceneItemMove(action) => unimplemented_action! { action },
// Action::FireBullet(action) => unimplemented_action! { action },
// Action::ClearFishingCabinInSaleItems(action) => unimplemented_action! { action },
// Action::AcceptFishingEntrust(action) => unimplemented_action! { action },
// Action::DestroyFishingBoat(action) => unimplemented_action! { action },
// Action::SetJigsawItem(action) => unimplemented_action! { action },
// Action::SetJigsawFoundation(action) => unimplemented_action! { action },
// Action::SetTeleControl(action) => unimplemented_action! { action },
// Action::SetEntityClientVisible(action) => unimplemented_action! { action },
// Action::ToggleHighlightExploreUi(action) => unimplemented_action! { action },
// Action::ExecAlertSystemAction(action) => unimplemented_action! { action },
// Action::AddFlowInteractOption(action) => unimplemented_action! { action },
// Action::RemoveFlowInteractOption(action) => unimplemented_action! { action },
// Action::EnableHostility(action) => unimplemented_action! { action },
// Action::ChangePhantomFormation(action) => unimplemented_action! { action },
// Action::RestorePhantomFormation(action) => unimplemented_action! { action },
// Action::ChangeTimer(action) => unimplemented_action! { action },
// Action::ToggleTimerPauseState(action) => unimplemented_action! { action },
// Action::ChangeFightTeam(action) => unimplemented_action! { action },
// Action::AddTrialFollowShooter(action) => unimplemented_action! { action },
// Action::RemoveTrialFollowShooter(action) => unimplemented_action! { action },
// Action::AddTrialCharacter(action) => unimplemented_action! { action },
// Action::RemoveTrialCharacter(action) => unimplemented_action! { action },
// Action::SetAreaState(action) => unimplemented_action! { action },
// Action::SwitchSubLevels(action) => unimplemented_action! { action },
// Action::ChangeTeamPosition(action) => unimplemented_action! { action },
// Action::GetItem(action) => unimplemented_action! { action },
// Action::CreatePrefab(action) => unimplemented_action! { action },
// Action::DestroyPrefab(action) => unimplemented_action! { action },
// Action::CompleteGuide(action) => unimplemented_action! { action },
// Action::PlayDynamicSettlement(action) => unimplemented_action! { action },
// Action::UsePhantomSkill(action) => unimplemented_action! { action },
// Action::HideTargetRange(action) => unimplemented_action! { action },
// Action::ChangeOtherState(action) => unimplemented_action! { action },
// Action::SetRegionConfig(action) => unimplemented_action! { action },
// Action::SetReviveRegion(action) => unimplemented_action! { action },
// Action::ExecResurrection(action) => unimplemented_action! { action },
// Action::ShowTargetRange(action) => unimplemented_action! { action },
// Action::SetTime(action) => unimplemented_action! { action },
// Action::SetTimeLockState(action) => unimplemented_action! { action },
// Action::EnableSystem(action) => unimplemented_action! { action },
// Action::EnableAoiNotify(action) => unimplemented_action! { action },
// Action::SetForceLock(action) => unimplemented_action! { action },
// Action::PlayRegisteredMontage(action) => unimplemented_action! { action },
// Action::SetAudioState(action) => unimplemented_action! { action },
// Action::HideGroup(action) => unimplemented_action! { action },
// Action::ShowHidedGroup(action) => unimplemented_action! { action },
// Action::HideSpecificEntities(action) => unimplemented_action! { action },
// Action::ShowSpecificEntities(action) => unimplemented_action! { action },
// Action::RemovePreloadResource(action) => unimplemented_action! { action },
// Action::Preload(action) => unimplemented_action! { action },
// Action::EnableAI(action) => unimplemented_action! { action },
// Action::SwitchDataLayers(action) => unimplemented_action! { action },
// Action::DestroyQuest(action) => unimplemented_action! { action },
// Action::DestroyQuestItem(action) => unimplemented_action! { action },
// Action::PromptQuestChapterUI(action) => unimplemented_action! { action },
// Action::TakePlotPhoto(action) => unimplemented_action! { action },
// Action::SetWuYinQuState(action) => unimplemented_action! { action },
// Action::RunActions(action) => unimplemented_action! { action },
// Action::ManualOccupations(action) => unimplemented_action! { action },
// Action::SetWeather(action) => unimplemented_action! { action },
// Action::SendNpcMail(action) => unimplemented_action! { action },
// Action::EnableFunction(action) => unimplemented_action! { action },
// Action::FocusOnMapMark(action) => unimplemented_action! { action },
// Action::CharacterLookAt(action) => unimplemented_action! { action },
// Action::AddGuestCharacter(action) => unimplemented_action! { action },
// Action::RemoveGuestCharacter(action) => unimplemented_action! { action },
// Action::TeleportToAndEnterVehicle(action) => unimplemented_action! { action },
// Action::SetAreaTimeState(action) => unimplemented_action! { action },
// Action::ResetPlayerCameraFocus(action) => unimplemented_action! { action },
// Action::ResetLevelPlay(action) => unimplemented_action! { action },
// Action::VehicleSprint(action) => unimplemented_action! { action },
// Action::VehicleMoveWithPathLine(action) => unimplemented_action! { action },
// Action::ClientPreEnableSubLevels(action) => unimplemented_action! { action },
// Action::GuestOperateUiAnimation(action) => unimplemented_action! { action },
// Action::ChangeEntityCamp(action) => unimplemented_action! { action },
// Action::NewMoveWithSpline(action) => unimplemented_action! { action },
// Action::DangoAbyssActivatePortal(action) => unimplemented_action! { action },
// Action::DangoAbyssCreateRewardTreasureBox(action) => unimplemented_action! { action },
// Action::DangoAbyssGotoNextFloor(action) => unimplemented_action! { action },
// Action::DangoAbyssReceiveReward(action) => unimplemented_action! { action },
// Action::SummonEntity(action) => unimplemented_action! { action },
// Action::GetRewardByInteract(action) => unimplemented_action! { action },
// Action::OpenQte(action) => unimplemented_action! { action },
// Action::ActiveAntiGravitySafePoint(action) => unimplemented_action! { action },
// Action::BvbPlayDialog(action) => unimplemented_action! { action },
// Action::BvbSendSystemEvent(action) => unimplemented_action! { action },
// Action::BvbSendAiEvent(action) => unimplemented_action! { action },
// Action::BvbPlayerOperationConstraint(action) => unimplemented_action! { action },
// Action::ExecClientBattleAction(action) => unimplemented_action! { action },
// Action::TriggerSpecificScanEffect(action) => unimplemented_action! { action },
// Action::SetActorVar(action) => unimplemented_action! { action },
// Action::RunActorCustomEvent(action) => unimplemented_action! { action },
// Action::StopUiScreenEffect(action) => unimplemented_action! { action },
// Action::StopNewMoveWithSpline(action) => unimplemented_action! { action },
// Action::RequestSystemFunction(action) => unimplemented_action! { action },
// }
// }
pub fn change_self_entity_state_action(
player: &mut Player,
entity_id: i64,
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
template_config: &wicked_waifus_data::TemplateConfigData,
action: ChangeSelfEntityState,
) {
let state = tag_utils::get_tag_id_by_name(action.entity_state.as_str());
// TODO: update Tag::CommonEntityTags too??
let old_state = {
let world_ref = player.world.borrow();
let world = world_ref.get_world_entity();
let mut state_tag = query_components!(world, entity_id, StateTag).0.unwrap();
let old_state = state_tag.state_tag_id;
tracing::debug!("ChangeSelfEntityState: old state {old_state} -> new state: {state}");
state_tag.state_tag_id = state;
old_state
};
if let Some(entity_state_component) = level_entity_data
.components_data
.entity_state_component
.as_ref()
.or(template_config
.components_data
.entity_state_component
.as_ref())
.cloned()
{
let entity_state_component: EntityStateComponent = entity_state_component; // TODO: Remove this line, used for casting only
// TODO: implement rest of cases
if let Some(state_change_behaviors) = entity_state_component.state_change_behaviors {
for state_change_behavior in state_change_behaviors {
// TODO: implement rest of cases
let expected = tag_utils::get_tag_id_by_name(state_change_behavior.state.as_str());
if expected == state {
if let Some(actions) = state_change_behavior.action {
for sub in actions {
handle_action(
player,
entity_id,
level_entity_data,
template_config,
sub,
);
}
}
}
}
}
}
player.notify(EntityCommonTagNotify {
id: entity_id,
tags: vec![
CommonTagData {
tag_id: old_state,
remove_tag_ids: false,
}, // Remove
CommonTagData {
tag_id: state,
remove_tag_ids: true,
}, // Add
],
});
player.notify(EntityStateReadyNotify {
entity_id,
tag_id: state,
ready: true, // TODO: Always true? or shall we compare it to something??
});
}

View file

@ -1,4 +1,3 @@
pub mod action_utils;
pub mod condition_utils;
pub mod entity_serializer;
pub mod load_role_info;

View file

@ -24,11 +24,87 @@ use crate::logic::{
};
//use crate::resonator_data::{ResonatorData, Concomitant, SummonerComponent};
use crate::query_with;
use crate::{query_components, query_with};
pub fn summon_concomitant(player: &Player, world: &mut WorldEntity, summon_cfg: &wicked_waifus_data::SummonCfgData, cur_summon_id: i32) -> Entity {
let mut concomitant_buffs: Vec<FightBuffInformation> = Vec::new();
for buff_id in &summon_cfg.born_buff_id {
concomitant_buffs
.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(
cur_summon_id,
EEntityType::Monster.into(),
player.basic_info.cur_map_id,
);
world
.create_builder(con_entity)
.with(ComponentContainer::PlayerOwnedEntityMarker(PlayerOwnedEntityMarker {
entity_type: EEntityType::Monster,
}))
.with(ComponentContainer::EntityConfig(EntityConfig {
camp: 0,
config_id: concomitant_config_id,
config_type: EntityConfigType::Template,
entity_type: EEntityType::Monster,
entity_state: EntityState::Born,
}))
.with(ComponentContainer::OwnerPlayer(OwnerPlayer(
player.basic_info.id,
)))
.with(ComponentContainer::Position(Position(
player.location.position.clone(),
)))
.with(ComponentContainer::Visibility(Visibility {
is_visible: false,
is_actor_visible: true,
}))
.with(ComponentContainer::Attribute(Attribute::from_data(
base_property_data::iter()
.find(|d| d.id == template_config.components_data.attribute_component.clone().unwrap().property_id.unwrap())
.unwrap(),
None,
None,
)))
.with(ComponentContainer::Movement(Movement::default()))
.with(ComponentContainer::FightBuff(FightBuff { fight_buff_infos: con_buffs, ..Default::default() }))
.with(ComponentContainer::Summoner(Summoner {
summon_cfg_id: summon_cfg.id,
summon_skill_id: 0,
summon_type: ESummonType::ESummonTypeConcomitantCustom.into()
}))
.build()
}
#[macro_export]
macro_rules! create_player_entity_pb {
($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)
@ -48,6 +124,34 @@ macro_rules! create_player_entity_pb {
..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(
@ -75,7 +179,7 @@ macro_rules! create_player_entity_pb {
)))
.with(ComponentContainer::Movement(Movement::default()))
.with(ComponentContainer::Equip(Equip {
weapon_id: role.equip_weapon,
weapon_id: equip_weapon,
weapon_breach_level: 90,
}))
.with(ComponentContainer::VisionSkill(VisionSkill {
@ -88,6 +192,11 @@ macro_rules! create_player_entity_pb {
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 {
@ -109,85 +218,6 @@ macro_rules! create_player_entity_pb {
}};
}
fn summon_concomitant(player: &Player, world: &mut WorldEntity, summon_cfg: &wicked_waifus_data::SummonCfgData) -> Entity {
let mut concomitant_buffs: Vec<FightBuffInformation> = Vec::new();
for buff_id in &summon_cfg.born_buff_id {
concomitant_buffs
.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 concomitant_id = template_config_data::get(&summon_cfg.blueprint_type).unwrap().id;
tracing::info!("Adding Concomitant with id: {}", concomitant_id);
let con_buffs = concomitant_buffs.clone();
let con_entity = world.create_entity(
concomitant_id,
EEntityType::Monster.into(),
player.basic_info.cur_map_id,
);
world
.create_builder(con_entity)
.with(ComponentContainer::PlayerOwnedEntityMarker(PlayerOwnedEntityMarker {
entity_type: EEntityType::Monster,
}))
.with(ComponentContainer::EntityConfig(EntityConfig {
camp: 0,
config_id: concomitant_id,
config_type: EntityConfigType::Template,
entity_type: EEntityType::Monster,
entity_state: EntityState::Sleep,
}))
.with(ComponentContainer::OwnerPlayer(OwnerPlayer(
player.basic_info.id,
)))
.with(ComponentContainer::Position(Position(
player.location.position.clone(),
)))
.with(ComponentContainer::Visibility(Visibility {
is_visible: false,
is_actor_visible: false,
}))
.with(ComponentContainer::Attribute(Attribute::from_data(
base_property_data::iter()
.find(|d| d.id == concomitant_id as i32)
.unwrap_or_else(|| {
base_property_data::iter()
.find(|d| d.id == 390070051)
.unwrap_or_else(|| {
tracing::error!("Default base property concomitant not found!");
panic!("Critical config missing: base property concomitant")
})
}),
None,
None,
)))
.with(ComponentContainer::Movement(Movement::default()))
.with(ComponentContainer::FightBuff(FightBuff { fight_buff_infos: con_buffs, ..Default::default() }))
.with(ComponentContainer::Summoner(Summoner {
summon_cfg_id: summon_cfg.id,
summon_skill_id: 0,
summon_type: ESummonType::ESummonTypeConcomitantCustom.into()
}))
.build()
}
pub fn add_player_entities(player: &Player) {
let mut world_ref = player.world.borrow_mut();
let world = world_ref.get_mut_world_entity();
@ -203,22 +233,12 @@ pub fn add_player_entities(player: &Player) {
if world.active_entity_empty() {
for role in role_vec {
let mut concomitants: Vec<i64> = vec![];
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);
concomitants.push(concomitant.entity_id.into());
}
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 buf_manager = FightBuff {
fight_buff_infos,
@ -233,6 +253,19 @@ pub fn add_player_entities(player: &Player) {
_ => 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 entity = world
.create_builder(entity)
.with(ComponentContainer::PlayerOwnedEntityMarker(
@ -283,7 +316,7 @@ pub fn add_player_entities(player: &Player) {
.with(ComponentContainer::Concomitant(Concomitant {
vision_entity_id: 0,
custom_entity_ids: concomitants,
phantom_role_id: 0,
phantom_role_id: 0
}))
.build();

View file

@ -51,12 +51,12 @@ async fn handler_loop(
return;
};
tracing::debug!(
"received message from service: {}, rpc_id: {} message_id: {}",
message.src_service_id,
message.rpc_id,
message.message_id
);
// tracing::debug!(
// "received message from service: {}, rpc_id: {} message_id: {}",
// message.src_service_id,
// message.rpc_id,
// message.message_id
// );
match message.message_id {
CreatePlayerDataRequest::MESSAGE_ID => {
@ -141,7 +141,7 @@ async fn on_start_player_session_request(
player_id: player_data.player_id,
enter_rpc_id: message.rpc_id,
session: session.clone(),
player_save_data,
player_save_data: Box::new(player_save_data),
});
session_mgr.add(session.clone());