From 205fda45dcfacaae1cb06bc890153ced727a09a0 Mon Sep 17 00:00:00 2001 From: xeon Date: Thu, 12 Dec 2024 17:41:29 +0300 Subject: [PATCH] Implement W-Engines --- README.md | 2 +- crates/game-server/src/player_util.rs | 32 +- crates/game-server/src/rpc_ptc/item.rs | 110 +- crates/game-server/src/rpc_ptc/mod.rs | 4 + crates/game-server/src/rpc_ptc/player.rs | 11 + crates/gate-server/src/net/packet_handler.rs | 2 +- crates/protocol/src/lib.rs | 56 +- crates/protocol/src/util.rs | 49 +- .../qwer-rpc/src/protocol/protocol_point.rs | 4 +- .../qwer-rpc/src/protocol/protocol_service.rs | 2 +- crates/qwer-rpc/src/rpc_ptc/rpc_ptc_point.rs | 5 +- crates/yanagi-data/fbs/tables.fbs | 44 +- .../gen_flatbuffers/tables_generated.rs | 949 ++++++++++++++++-- crates/yanagi-data/src/lib.rs | 3 +- crates/yanagi-proto/out/_.rs | 62 +- crates/yanagi-proto/out/proto_conversion.rs | 193 +++- 16 files changed, 1391 insertions(+), 137 deletions(-) diff --git a/README.md b/README.md index 9d3102f..8e2d87a 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ You should configure each service using their own config files. They're being cr ### Connecting You have to get a compatible game client. Currently supported one is `CNBetaWin1.4.2`, you can [get it here](https://git.xeondev.com/xeon/3/raw/branch/3/ZZZ_1.4_beta_reversedrooms.torrent). Next, you have to apply [this patch](https://git.xeondev.com/HollowSpecialOperationsS6/Yanagi-Patch/releases), it allows you to connect to local server and replaces RSA encryption keys with custom ones. -##### NOTE: you have to create in-game account, by default, you can do so at https://127.0.0.1:10001/account/register +##### NOTE: you have to create in-game account, by default, you can do so at http://127.0.0.1:10001/account/register ##### NOTE2: to register an account, you should have `yanagi-sdk-server` up and running! ## Community diff --git a/crates/game-server/src/player_util.rs b/crates/game-server/src/player_util.rs index d20aeee..47a3f1f 100644 --- a/crates/game-server/src/player_util.rs +++ b/crates/game-server/src/player_util.rs @@ -310,6 +310,8 @@ pub fn create_starting_player_info(uid: u64, nick_name: &str) -> (UidCounter, Pl main_city_avatar_id: Some(1221), }; + let first_get_time = time_util::unix_timestamp(); + // Give all avatars FILECFG .get() @@ -328,7 +330,7 @@ pub fn create_starting_player_info(uid: u64, nick_name: &str) -> (UidCounter, Pl id: tmpl.id(), count: 1, package: 0, - first_get_time: time_util::unix_timestamp(), + first_get_time, star: 6, exp: 0, level: 60, @@ -342,5 +344,33 @@ pub fn create_starting_player_info(uid: u64, nick_name: &str) -> (UidCounter, Pl ); }); + // Give all w-engines + FILECFG + .get() + .unwrap() + .weapon_template_tb + .data() + .unwrap_or_default() + .iter() + .for_each(|tmpl| { + let uid = counter.next(); + player_info.items.as_mut().unwrap().insert( + uid, + ItemInfo::Weapon { + uid, + id: tmpl.item_id(), + count: 1, + package: 0, + first_get_time, + avatar_uid: 0, + star: 1 + tmpl.star_limit() as u8, + exp: 0, + level: 60, + lock: 0, + refine_level: tmpl.refine_limit() as u8, + }, + ); + }); + (counter, player_info) } diff --git a/crates/game-server/src/rpc_ptc/item.rs b/crates/game-server/src/rpc_ptc/item.rs index b8ec8cf..0bccf3a 100644 --- a/crates/game-server/src/rpc_ptc/item.rs +++ b/crates/game-server/src/rpc_ptc/item.rs @@ -1,3 +1,6 @@ +use item_info::ItemInfo; +use tracing::{debug, instrument}; + use super::*; pub async fn on_rpc_get_weapon_data_arg( @@ -30,14 +33,7 @@ pub async fn on_rpc_get_resource_data_arg( Ok(RpcGetResourceDataRet { retcode: 0, resource_list: protocol::util::build_sync_resource_info_list(&session.player_info), - auto_recovery_info: session - .player_info - .auto_recovery_info - .as_ref() - .unwrap() - .iter() - .map(|(id, info)| (*id as u32, info.clone())) - .collect(), + auto_recovery_info: protocol::util::build_sync_auto_recovery_info(&session.player_info), }) } @@ -70,3 +66,101 @@ pub async fn on_rpc_get_buddy_data_arg( ) -> Result { Ok(RpcGetBuddyDataRet::default()) } + +#[instrument(skip(ctx, session))] +pub async fn on_rpc_weapon_dress_arg( + ctx: &RpcPtcContext, + session: &mut PlayerSession, + arg: RpcWeaponDressArg, +) -> Result { + let Some(target_avatar_uid) = session + .player_info + .items + .as_ref() + .unwrap() + .iter() + .find(|(_, item)| { + if let ItemInfo::AvatarInfo { id, .. } = item { + *id as u32 == arg.avatar_id + } else { + false + } + }) + .map(|(uid, _)| *uid) + else { + debug!("target avatar not found"); + return Err(-1); + }; + + let Some((_, ItemInfo::Weapon { avatar_uid, .. })) = session + .player_info + .items + .as_mut() + .unwrap() + .iter_mut() + .find(|(uid, _)| (*uid & 0xFFFFFFFF) as u32 == arg.weapon_uid) + else { + debug!("target weapon not found"); + return Err(-1); + }; + + *avatar_uid = target_avatar_uid; + + ctx.send_ptc(PtcPlayerSyncArg { + avatar: Some(protocol::util::build_avatar_sync(&session.player_info)), + item: Some(protocol::util::build_item_sync(&session.player_info)), + ..Default::default() + }) + .await; + + Ok(RpcWeaponDressRet::default()) +} + +#[instrument(skip(ctx, session))] +pub async fn on_rpc_weapon_un_dress_arg( + ctx: &RpcPtcContext, + session: &mut PlayerSession, + arg: RpcWeaponUnDressArg, +) -> Result { + let Some(target_avatar_uid) = session + .player_info + .items + .as_ref() + .unwrap() + .iter() + .find(|(_, item)| { + if let ItemInfo::AvatarInfo { id, .. } = item { + *id as u32 == arg.avatar_id + } else { + false + } + }) + .map(|(uid, _)| *uid) + else { + debug!("target avatar not found"); + return Err(-1); + }; + + session + .player_info + .items + .as_mut() + .unwrap() + .iter_mut() + .for_each(|(_, item)| { + if let ItemInfo::Weapon { avatar_uid, .. } = item { + if *avatar_uid == target_avatar_uid { + *avatar_uid = 0; + } + } + }); + + ctx.send_ptc(PtcPlayerSyncArg { + avatar: Some(protocol::util::build_avatar_sync(&session.player_info)), + item: Some(protocol::util::build_item_sync(&session.player_info)), + ..Default::default() + }) + .await; + + Ok(RpcWeaponUnDressRet::default()) +} diff --git a/crates/game-server/src/rpc_ptc/mod.rs b/crates/game-server/src/rpc_ptc/mod.rs index 1f8908c..eb7298f 100644 --- a/crates/game-server/src/rpc_ptc/mod.rs +++ b/crates/game-server/src/rpc_ptc/mod.rs @@ -180,5 +180,9 @@ pub fn register_handlers(listen_point: &RpcPtcPoint) { RpcBattleReport; RpcEndBattle; RpcLeaveCurDungeon; + + RpcGetPlayerNetworkData; + RpcWeaponDress; + RpcWeaponUnDress; }; } diff --git a/crates/game-server/src/rpc_ptc/player.rs b/crates/game-server/src/rpc_ptc/player.rs index 707c447..81aa9cf 100644 --- a/crates/game-server/src/rpc_ptc/player.rs +++ b/crates/game-server/src/rpc_ptc/player.rs @@ -107,3 +107,14 @@ pub async fn on_rpc_player_transaction_arg( transaction: format!("{player_uid}-{scene_uid}"), }) } + +pub async fn on_rpc_get_player_network_data_arg( + _: &RpcPtcContext, + _: &mut PlayerSession, + _: RpcGetPlayerNetworkDataArg, +) -> Result { + Ok(RpcGetPlayerNetworkDataRet { + retcode: 0, + player_network_data: Some(PlayerNetworkData::default()), + }) +} diff --git a/crates/gate-server/src/net/packet_handler.rs b/crates/gate-server/src/net/packet_handler.rs index b1ea59e..798f125 100644 --- a/crates/gate-server/src/net/packet_handler.rs +++ b/crates/gate-server/src/net/packet_handler.rs @@ -51,7 +51,7 @@ pub async fn decode_and_handle( session.rpc_ptc_point.lock().await, end_point, middleware_list, - Duration::from_secs(30) + Duration::from_secs(2) ) } cmd_id => debug!("received cmd_id: {cmd_id}, session is not logged in, expected PlayerGetTokenCsReq (cmd_id: {})", PlayerGetTokenCsReq::CMD_ID), diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index f645c70..d17693d 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -67,6 +67,7 @@ pub struct AvatarInfo { pub unlocked_talent_num: u32, pub talent_switch_list: Vec, pub skill_type_level: Vec, + pub cur_weapon_uid: u32, } #[derive(OctData, Debug, Default)] @@ -805,7 +806,9 @@ pub struct RpcSavePosInMainCityRet { #[derive(OctData, Debug, Default, ProtocolID)] #[id(156)] -pub struct RpcPlayerOperationArg {} +pub struct RpcPlayerOperationArg { + pub param: i32, +} #[derive(OctData, Debug, Default)] pub struct RpcPlayerOperationRet { @@ -929,10 +932,25 @@ pub struct RpcModMainCityAvatarRet { pub retcode: i32, } +#[derive(OctData, Debug, Default)] +pub struct AvatarSync { + pub avatar_list: Vec, +} + +#[derive(OctData, Debug, Default)] +pub struct ItemSync { + pub weapon_list: Vec, + pub equip_list: Vec, + pub resource_list: Vec, + pub auto_recovery_info: HashMap, +} + #[derive(OctData, Debug, Default, ProtocolID)] #[id(500)] pub struct PtcPlayerSyncArg { pub basic_info: Option, + pub avatar: Option, + pub item: Option, } #[derive(OctData, Debug, Default, ProtocolID)] @@ -1117,3 +1135,39 @@ pub struct RpcLeaveCurDungeonArg {} pub struct RpcLeaveCurDungeonRet { pub retcode: i32, } + +#[derive(OctData, Debug, Default, ProtocolID)] +#[id(178)] +pub struct RpcGetPlayerNetworkDataArg {} + +#[derive(OctData, Debug, Default)] +pub struct PlayerNetworkData {} + +#[derive(OctData, Debug, Default)] +pub struct RpcGetPlayerNetworkDataRet { + pub retcode: i32, + pub player_network_data: Option, +} + +#[derive(OctData, Debug, Default, ProtocolID)] +#[id(179)] +pub struct RpcWeaponDressArg { + pub avatar_id: u32, + pub weapon_uid: u32, +} + +#[derive(OctData, Debug, Default)] +pub struct RpcWeaponDressRet { + pub retcode: i32, +} + +#[derive(OctData, Debug, Default, ProtocolID)] +#[id(180)] +pub struct RpcWeaponUnDressArg { + pub avatar_id: u32, +} + +#[derive(OctData, Debug, Default)] +pub struct RpcWeaponUnDressRet { + pub retcode: i32, +} diff --git a/crates/protocol/src/util.rs b/crates/protocol/src/util.rs index f2b00b0..c085aa7 100644 --- a/crates/protocol/src/util.rs +++ b/crates/protocol/src/util.rs @@ -1,7 +1,9 @@ +use std::collections::HashMap; + use crate::{ item_info::ItemInfo, player_info::PlayerInfo, scene_info::SceneInfo, AvatarInfo, - AvatarSkillInfo, AvatarUnitInfo, EquipInfo, PlayerBasicInfo, PtcHallRefreshArg, ResourceInfo, - WeaponInfo, + AvatarSkillInfo, AvatarSync, AvatarUnitInfo, EquipInfo, ItemSync, PlayerBasicInfo, + PtcHallRefreshArg, ResourceInfo, WeaponInfo, }; pub fn build_player_basic_info(player_info: &PlayerInfo) -> PlayerBasicInfo { @@ -223,7 +225,7 @@ pub fn build_sync_avatar_info_list(player_info: &PlayerInfo) -> Vec .as_ref() .unwrap() .iter() - .map(|(_, item)| { + .map(|(uid, item)| { if let ItemInfo::AvatarInfo { id, first_get_time, @@ -246,6 +248,20 @@ pub fn build_sync_avatar_info_list(player_info: &PlayerInfo) -> Vec unlocked_talent_num: *unlocked_talent_num as u32, first_get_time: *first_get_time as i64, talent_switch_list: talent_switch.clone(), + cur_weapon_uid: player_info + .items + .as_ref() + .unwrap() + .iter() + .find(|(_, item)| { + if let ItemInfo::Weapon { avatar_uid, .. } = item { + *avatar_uid == *uid + } else { + false + } + }) + .map(|(uid, _)| (*uid & 0xFFFFFFFF) as u32) + .unwrap_or(0), skill_type_level: skills .iter() .map(|(ty, lv)| AvatarSkillInfo { @@ -358,3 +374,30 @@ pub fn build_sync_resource_info_list(player_info: &PlayerInfo) -> Vec HashMap { + player_info + .auto_recovery_info + .as_ref() + .unwrap() + .iter() + .map(|(id, info)| (*id as u32, info.clone())) + .collect() +} + +pub fn build_item_sync(player_info: &PlayerInfo) -> ItemSync { + ItemSync { + weapon_list: build_sync_weapon_info_list(player_info), + equip_list: build_sync_equip_info_list(player_info), + resource_list: build_sync_resource_info_list(player_info), + auto_recovery_info: build_sync_auto_recovery_info(player_info), + } +} + +pub fn build_avatar_sync(player_info: &PlayerInfo) -> AvatarSync { + AvatarSync { + avatar_list: build_sync_avatar_info_list(player_info), + } +} diff --git a/crates/qwer-rpc/src/protocol/protocol_point.rs b/crates/qwer-rpc/src/protocol/protocol_point.rs index 6e4f2ea..62e1ad9 100644 --- a/crates/qwer-rpc/src/protocol/protocol_point.rs +++ b/crates/qwer-rpc/src/protocol/protocol_point.rs @@ -51,7 +51,7 @@ impl ProtocolPoint { self.channel, to_channel, addr, - rpc_arg, + &rpc_arg, Duration::ZERO, arg_uid == 0, arg_uid, @@ -62,7 +62,7 @@ impl ProtocolPoint { pub async fn call_rpc( &self, addr: SocketAddr, - rpc_arg: Box<[u8]>, + rpc_arg: &[u8], timeout: Duration, ) -> Option> { self.service_backend diff --git a/crates/qwer-rpc/src/protocol/protocol_service.rs b/crates/qwer-rpc/src/protocol/protocol_service.rs index faa085e..ecaa503 100644 --- a/crates/qwer-rpc/src/protocol/protocol_service.rs +++ b/crates/qwer-rpc/src/protocol/protocol_service.rs @@ -114,7 +114,7 @@ impl ProtocolServiceFrontendImpl { from_channel: u16, to_channel: u16, to_addr: SocketAddr, - body: Box<[u8]>, + body: &[u8], timeout: Duration, is_ptc: bool, arg_uid: u64, diff --git a/crates/qwer-rpc/src/rpc_ptc/rpc_ptc_point.rs b/crates/qwer-rpc/src/rpc_ptc/rpc_ptc_point.rs index 2d1b1fb..734c39b 100644 --- a/crates/qwer-rpc/src/rpc_ptc/rpc_ptc_point.rs +++ b/crates/qwer-rpc/src/rpc_ptc/rpc_ptc_point.rs @@ -232,10 +232,7 @@ impl RpcPtcPoint { marshal_middleware_list(&mut ProtocolStream::new(&mut cursor), &middleware_list).unwrap(); - let ret_buf = self - .protocol_point - .call_rpc(addr, buf.into_boxed_slice(), timeout) - .await?; + let ret_buf = self.protocol_point.call_rpc(addr, &buf, timeout).await?; Some(RpcRawRet(ret_buf)) } diff --git a/crates/yanagi-data/fbs/tables.fbs b/crates/yanagi-data/fbs/tables.fbs index 32089cf..5bf87cf 100644 --- a/crates/yanagi-data/fbs/tables.fbs +++ b/crates/yanagi-data/fbs/tables.fbs @@ -13,8 +13,50 @@ table AvatarBaseTemplate { unk_2: [string]; } +struct Property { + property: int; + value: int; +} + +struct RefineCost { + item_id: int; + number: int; +} + +table WeaponTemplate { + item_id: int; + weapon_name: string; + unk_missing_field: int; + base_property: Property; + rand_property: Property; + star_limit: int; + exp_recycle: int; + weapon_script_config: string; + weapon_ui_model: string; + unk_1: int; + unk_missing_field_2: int; + unk_weapon_path: string; + unk_missing_field_3: int; + refine_initial: int; + refine_limit: int; + unk_missing_field_4: int; + unk_missing_field_5: int; + unk_string_with_values: string; + unk_missing_field_6: int; + unk_2: int; // 3 + weapon_desc: string; + weapon_release_tag: string; + unk_empty_string: string; + avatar_id: int; + weapon_comment: string; + refine_costs: [RefineCost]; + unk_3: int; +} + table AvatarBaseTemplateTb { data: [AvatarBaseTemplate]; } -root_type AvatarBaseTemplateTb; +table WeaponTemplateTb { + data: [WeaponTemplate]; +} diff --git a/crates/yanagi-data/gen_flatbuffers/tables_generated.rs b/crates/yanagi-data/gen_flatbuffers/tables_generated.rs index 0309324..4c2837f 100644 --- a/crates/yanagi-data/gen_flatbuffers/tables_generated.rs +++ b/crates/yanagi-data/gen_flatbuffers/tables_generated.rs @@ -9,6 +9,254 @@ use core::cmp::Ordering; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; +// struct Property, aligned to 4 +#[repr(transparent)] +#[derive(Clone, Copy, PartialEq)] +pub struct Property(pub [u8; 8]); +impl Default for Property { + fn default() -> Self { + Self([0; 8]) + } +} +impl core::fmt::Debug for Property { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + f.debug_struct("Property") + .field("property", &self.property()) + .field("value", &self.value()) + .finish() + } +} + +impl flatbuffers::SimpleToVerifyInSlice for Property {} +impl<'a> flatbuffers::Follow<'a> for Property { + type Inner = &'a Property; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + <&'a Property>::follow(buf, loc) + } +} +impl<'a> flatbuffers::Follow<'a> for &'a Property { + type Inner = &'a Property; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + flatbuffers::follow_cast_ref::(buf, loc) + } +} +impl<'b> flatbuffers::Push for Property { + type Output = Property; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + let src = ::core::slice::from_raw_parts(self as *const Property as *const u8, Self::size()); + dst.copy_from_slice(src); + } +} + +impl<'a> flatbuffers::Verifiable for Property { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.in_buffer::(pos) + } +} + +impl<'a> Property { + #[allow(clippy::too_many_arguments)] + pub fn new( + property: i32, + value: i32, + ) -> Self { + let mut s = Self([0; 8]); + s.set_property(property); + s.set_value(value); + s + } + + pub fn property(&self) -> i32 { + let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid value in this slot + EndianScalar::from_little_endian(unsafe { + core::ptr::copy_nonoverlapping( + self.0[0..].as_ptr(), + mem.as_mut_ptr() as *mut u8, + core::mem::size_of::<::Scalar>(), + ); + mem.assume_init() + }) + } + + pub fn set_property(&mut self, x: i32) { + let x_le = x.to_little_endian(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid value in this slot + unsafe { + core::ptr::copy_nonoverlapping( + &x_le as *const _ as *const u8, + self.0[0..].as_mut_ptr(), + core::mem::size_of::<::Scalar>(), + ); + } + } + + pub fn value(&self) -> i32 { + let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid value in this slot + EndianScalar::from_little_endian(unsafe { + core::ptr::copy_nonoverlapping( + self.0[4..].as_ptr(), + mem.as_mut_ptr() as *mut u8, + core::mem::size_of::<::Scalar>(), + ); + mem.assume_init() + }) + } + + pub fn set_value(&mut self, x: i32) { + let x_le = x.to_little_endian(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid value in this slot + unsafe { + core::ptr::copy_nonoverlapping( + &x_le as *const _ as *const u8, + self.0[4..].as_mut_ptr(), + core::mem::size_of::<::Scalar>(), + ); + } + } + +} + +// struct RefineCost, aligned to 4 +#[repr(transparent)] +#[derive(Clone, Copy, PartialEq)] +pub struct RefineCost(pub [u8; 8]); +impl Default for RefineCost { + fn default() -> Self { + Self([0; 8]) + } +} +impl core::fmt::Debug for RefineCost { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + f.debug_struct("RefineCost") + .field("item_id", &self.item_id()) + .field("number", &self.number()) + .finish() + } +} + +impl flatbuffers::SimpleToVerifyInSlice for RefineCost {} +impl<'a> flatbuffers::Follow<'a> for RefineCost { + type Inner = &'a RefineCost; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + <&'a RefineCost>::follow(buf, loc) + } +} +impl<'a> flatbuffers::Follow<'a> for &'a RefineCost { + type Inner = &'a RefineCost; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + flatbuffers::follow_cast_ref::(buf, loc) + } +} +impl<'b> flatbuffers::Push for RefineCost { + type Output = RefineCost; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + let src = ::core::slice::from_raw_parts(self as *const RefineCost as *const u8, Self::size()); + dst.copy_from_slice(src); + } +} + +impl<'a> flatbuffers::Verifiable for RefineCost { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.in_buffer::(pos) + } +} + +impl<'a> RefineCost { + #[allow(clippy::too_many_arguments)] + pub fn new( + item_id: i32, + number: i32, + ) -> Self { + let mut s = Self([0; 8]); + s.set_item_id(item_id); + s.set_number(number); + s + } + + pub fn item_id(&self) -> i32 { + let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid value in this slot + EndianScalar::from_little_endian(unsafe { + core::ptr::copy_nonoverlapping( + self.0[0..].as_ptr(), + mem.as_mut_ptr() as *mut u8, + core::mem::size_of::<::Scalar>(), + ); + mem.assume_init() + }) + } + + pub fn set_item_id(&mut self, x: i32) { + let x_le = x.to_little_endian(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid value in this slot + unsafe { + core::ptr::copy_nonoverlapping( + &x_le as *const _ as *const u8, + self.0[0..].as_mut_ptr(), + core::mem::size_of::<::Scalar>(), + ); + } + } + + pub fn number(&self) -> i32 { + let mut mem = core::mem::MaybeUninit::<::Scalar>::uninit(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid value in this slot + EndianScalar::from_little_endian(unsafe { + core::ptr::copy_nonoverlapping( + self.0[4..].as_ptr(), + mem.as_mut_ptr() as *mut u8, + core::mem::size_of::<::Scalar>(), + ); + mem.assume_init() + }) + } + + pub fn set_number(&mut self, x: i32) { + let x_le = x.to_little_endian(); + // Safety: + // Created from a valid Table for this object + // Which contains a valid value in this slot + unsafe { + core::ptr::copy_nonoverlapping( + &x_le as *const _ as *const u8, + self.0[4..].as_mut_ptr(), + core::mem::size_of::<::Scalar>(), + ); + } + } + +} + pub enum AvatarBaseTemplateOffset {} #[derive(Copy, Clone, PartialEq)] @@ -293,6 +541,545 @@ impl core::fmt::Debug for AvatarBaseTemplate<'_> { ds.finish() } } +pub enum WeaponTemplateOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct WeaponTemplate<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for WeaponTemplate<'a> { + type Inner = WeaponTemplate<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> WeaponTemplate<'a> { + pub const VT_ITEM_ID: flatbuffers::VOffsetT = 4; + pub const VT_WEAPON_NAME: flatbuffers::VOffsetT = 6; + pub const VT_UNK_MISSING_FIELD: flatbuffers::VOffsetT = 8; + pub const VT_BASE_PROPERTY: flatbuffers::VOffsetT = 10; + pub const VT_RAND_PROPERTY: flatbuffers::VOffsetT = 12; + pub const VT_STAR_LIMIT: flatbuffers::VOffsetT = 14; + pub const VT_EXP_RECYCLE: flatbuffers::VOffsetT = 16; + pub const VT_WEAPON_SCRIPT_CONFIG: flatbuffers::VOffsetT = 18; + pub const VT_WEAPON_UI_MODEL: flatbuffers::VOffsetT = 20; + pub const VT_UNK_1: flatbuffers::VOffsetT = 22; + pub const VT_UNK_MISSING_FIELD_2: flatbuffers::VOffsetT = 24; + pub const VT_UNK_WEAPON_PATH: flatbuffers::VOffsetT = 26; + pub const VT_UNK_MISSING_FIELD_3: flatbuffers::VOffsetT = 28; + pub const VT_REFINE_INITIAL: flatbuffers::VOffsetT = 30; + pub const VT_REFINE_LIMIT: flatbuffers::VOffsetT = 32; + pub const VT_UNK_MISSING_FIELD_4: flatbuffers::VOffsetT = 34; + pub const VT_UNK_MISSING_FIELD_5: flatbuffers::VOffsetT = 36; + pub const VT_UNK_STRING_WITH_VALUES: flatbuffers::VOffsetT = 38; + pub const VT_UNK_MISSING_FIELD_6: flatbuffers::VOffsetT = 40; + pub const VT_UNK_2: flatbuffers::VOffsetT = 42; + pub const VT_WEAPON_DESC: flatbuffers::VOffsetT = 44; + pub const VT_WEAPON_RELEASE_TAG: flatbuffers::VOffsetT = 46; + pub const VT_UNK_EMPTY_STRING: flatbuffers::VOffsetT = 48; + pub const VT_AVATAR_ID: flatbuffers::VOffsetT = 50; + pub const VT_WEAPON_COMMENT: flatbuffers::VOffsetT = 52; + pub const VT_REFINE_COSTS: flatbuffers::VOffsetT = 54; + pub const VT_UNK_3: flatbuffers::VOffsetT = 56; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + WeaponTemplate { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args WeaponTemplateArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = WeaponTemplateBuilder::new(_fbb); + builder.add_unk_3(args.unk_3); + if let Some(x) = args.refine_costs { builder.add_refine_costs(x); } + if let Some(x) = args.weapon_comment { builder.add_weapon_comment(x); } + builder.add_avatar_id(args.avatar_id); + if let Some(x) = args.unk_empty_string { builder.add_unk_empty_string(x); } + if let Some(x) = args.weapon_release_tag { builder.add_weapon_release_tag(x); } + if let Some(x) = args.weapon_desc { builder.add_weapon_desc(x); } + builder.add_unk_2(args.unk_2); + builder.add_unk_missing_field_6(args.unk_missing_field_6); + if let Some(x) = args.unk_string_with_values { builder.add_unk_string_with_values(x); } + builder.add_unk_missing_field_5(args.unk_missing_field_5); + builder.add_unk_missing_field_4(args.unk_missing_field_4); + builder.add_refine_limit(args.refine_limit); + builder.add_refine_initial(args.refine_initial); + builder.add_unk_missing_field_3(args.unk_missing_field_3); + if let Some(x) = args.unk_weapon_path { builder.add_unk_weapon_path(x); } + builder.add_unk_missing_field_2(args.unk_missing_field_2); + builder.add_unk_1(args.unk_1); + if let Some(x) = args.weapon_ui_model { builder.add_weapon_ui_model(x); } + if let Some(x) = args.weapon_script_config { builder.add_weapon_script_config(x); } + builder.add_exp_recycle(args.exp_recycle); + builder.add_star_limit(args.star_limit); + if let Some(x) = args.rand_property { builder.add_rand_property(x); } + if let Some(x) = args.base_property { builder.add_base_property(x); } + builder.add_unk_missing_field(args.unk_missing_field); + if let Some(x) = args.weapon_name { builder.add_weapon_name(x); } + builder.add_item_id(args.item_id); + builder.finish() + } + + + #[inline] + pub fn item_id(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_ITEM_ID, Some(0)).unwrap()} + } + #[inline] + pub fn weapon_name(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(WeaponTemplate::VT_WEAPON_NAME, None)} + } + #[inline] + pub fn unk_missing_field(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_UNK_MISSING_FIELD, Some(0)).unwrap()} + } + #[inline] + pub fn base_property(&self) -> Option<&'a Property> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_BASE_PROPERTY, None)} + } + #[inline] + pub fn rand_property(&self) -> Option<&'a Property> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_RAND_PROPERTY, None)} + } + #[inline] + pub fn star_limit(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_STAR_LIMIT, Some(0)).unwrap()} + } + #[inline] + pub fn exp_recycle(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_EXP_RECYCLE, Some(0)).unwrap()} + } + #[inline] + pub fn weapon_script_config(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(WeaponTemplate::VT_WEAPON_SCRIPT_CONFIG, None)} + } + #[inline] + pub fn weapon_ui_model(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(WeaponTemplate::VT_WEAPON_UI_MODEL, None)} + } + #[inline] + pub fn unk_1(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_UNK_1, Some(0)).unwrap()} + } + #[inline] + pub fn unk_missing_field_2(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_UNK_MISSING_FIELD_2, Some(0)).unwrap()} + } + #[inline] + pub fn unk_weapon_path(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(WeaponTemplate::VT_UNK_WEAPON_PATH, None)} + } + #[inline] + pub fn unk_missing_field_3(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_UNK_MISSING_FIELD_3, Some(0)).unwrap()} + } + #[inline] + pub fn refine_initial(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_REFINE_INITIAL, Some(0)).unwrap()} + } + #[inline] + pub fn refine_limit(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_REFINE_LIMIT, Some(0)).unwrap()} + } + #[inline] + pub fn unk_missing_field_4(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_UNK_MISSING_FIELD_4, Some(0)).unwrap()} + } + #[inline] + pub fn unk_missing_field_5(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_UNK_MISSING_FIELD_5, Some(0)).unwrap()} + } + #[inline] + pub fn unk_string_with_values(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(WeaponTemplate::VT_UNK_STRING_WITH_VALUES, None)} + } + #[inline] + pub fn unk_missing_field_6(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_UNK_MISSING_FIELD_6, Some(0)).unwrap()} + } + #[inline] + pub fn unk_2(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_UNK_2, Some(0)).unwrap()} + } + #[inline] + pub fn weapon_desc(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(WeaponTemplate::VT_WEAPON_DESC, None)} + } + #[inline] + pub fn weapon_release_tag(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(WeaponTemplate::VT_WEAPON_RELEASE_TAG, None)} + } + #[inline] + pub fn unk_empty_string(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(WeaponTemplate::VT_UNK_EMPTY_STRING, None)} + } + #[inline] + pub fn avatar_id(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_AVATAR_ID, Some(0)).unwrap()} + } + #[inline] + pub fn weapon_comment(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(WeaponTemplate::VT_WEAPON_COMMENT, None)} + } + #[inline] + pub fn refine_costs(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(WeaponTemplate::VT_REFINE_COSTS, None)} + } + #[inline] + pub fn unk_3(&self) -> i32 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(WeaponTemplate::VT_UNK_3, Some(0)).unwrap()} + } +} + +impl flatbuffers::Verifiable for WeaponTemplate<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("item_id", Self::VT_ITEM_ID, false)? + .visit_field::>("weapon_name", Self::VT_WEAPON_NAME, false)? + .visit_field::("unk_missing_field", Self::VT_UNK_MISSING_FIELD, false)? + .visit_field::("base_property", Self::VT_BASE_PROPERTY, false)? + .visit_field::("rand_property", Self::VT_RAND_PROPERTY, false)? + .visit_field::("star_limit", Self::VT_STAR_LIMIT, false)? + .visit_field::("exp_recycle", Self::VT_EXP_RECYCLE, false)? + .visit_field::>("weapon_script_config", Self::VT_WEAPON_SCRIPT_CONFIG, false)? + .visit_field::>("weapon_ui_model", Self::VT_WEAPON_UI_MODEL, false)? + .visit_field::("unk_1", Self::VT_UNK_1, false)? + .visit_field::("unk_missing_field_2", Self::VT_UNK_MISSING_FIELD_2, false)? + .visit_field::>("unk_weapon_path", Self::VT_UNK_WEAPON_PATH, false)? + .visit_field::("unk_missing_field_3", Self::VT_UNK_MISSING_FIELD_3, false)? + .visit_field::("refine_initial", Self::VT_REFINE_INITIAL, false)? + .visit_field::("refine_limit", Self::VT_REFINE_LIMIT, false)? + .visit_field::("unk_missing_field_4", Self::VT_UNK_MISSING_FIELD_4, false)? + .visit_field::("unk_missing_field_5", Self::VT_UNK_MISSING_FIELD_5, false)? + .visit_field::>("unk_string_with_values", Self::VT_UNK_STRING_WITH_VALUES, false)? + .visit_field::("unk_missing_field_6", Self::VT_UNK_MISSING_FIELD_6, false)? + .visit_field::("unk_2", Self::VT_UNK_2, false)? + .visit_field::>("weapon_desc", Self::VT_WEAPON_DESC, false)? + .visit_field::>("weapon_release_tag", Self::VT_WEAPON_RELEASE_TAG, false)? + .visit_field::>("unk_empty_string", Self::VT_UNK_EMPTY_STRING, false)? + .visit_field::("avatar_id", Self::VT_AVATAR_ID, false)? + .visit_field::>("weapon_comment", Self::VT_WEAPON_COMMENT, false)? + .visit_field::>>("refine_costs", Self::VT_REFINE_COSTS, false)? + .visit_field::("unk_3", Self::VT_UNK_3, false)? + .finish(); + Ok(()) + } +} +pub struct WeaponTemplateArgs<'a> { + pub item_id: i32, + pub weapon_name: Option>, + pub unk_missing_field: i32, + pub base_property: Option<&'a Property>, + pub rand_property: Option<&'a Property>, + pub star_limit: i32, + pub exp_recycle: i32, + pub weapon_script_config: Option>, + pub weapon_ui_model: Option>, + pub unk_1: i32, + pub unk_missing_field_2: i32, + pub unk_weapon_path: Option>, + pub unk_missing_field_3: i32, + pub refine_initial: i32, + pub refine_limit: i32, + pub unk_missing_field_4: i32, + pub unk_missing_field_5: i32, + pub unk_string_with_values: Option>, + pub unk_missing_field_6: i32, + pub unk_2: i32, + pub weapon_desc: Option>, + pub weapon_release_tag: Option>, + pub unk_empty_string: Option>, + pub avatar_id: i32, + pub weapon_comment: Option>, + pub refine_costs: Option>>, + pub unk_3: i32, +} +impl<'a> Default for WeaponTemplateArgs<'a> { + #[inline] + fn default() -> Self { + WeaponTemplateArgs { + item_id: 0, + weapon_name: None, + unk_missing_field: 0, + base_property: None, + rand_property: None, + star_limit: 0, + exp_recycle: 0, + weapon_script_config: None, + weapon_ui_model: None, + unk_1: 0, + unk_missing_field_2: 0, + unk_weapon_path: None, + unk_missing_field_3: 0, + refine_initial: 0, + refine_limit: 0, + unk_missing_field_4: 0, + unk_missing_field_5: 0, + unk_string_with_values: None, + unk_missing_field_6: 0, + unk_2: 0, + weapon_desc: None, + weapon_release_tag: None, + unk_empty_string: None, + avatar_id: 0, + weapon_comment: None, + refine_costs: None, + unk_3: 0, + } + } +} + +pub struct WeaponTemplateBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> WeaponTemplateBuilder<'a, 'b, A> { + #[inline] + pub fn add_item_id(&mut self, item_id: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_ITEM_ID, item_id, 0); + } + #[inline] + pub fn add_weapon_name(&mut self, weapon_name: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_WEAPON_NAME, weapon_name); + } + #[inline] + pub fn add_unk_missing_field(&mut self, unk_missing_field: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_UNK_MISSING_FIELD, unk_missing_field, 0); + } + #[inline] + pub fn add_base_property(&mut self, base_property: &Property) { + self.fbb_.push_slot_always::<&Property>(WeaponTemplate::VT_BASE_PROPERTY, base_property); + } + #[inline] + pub fn add_rand_property(&mut self, rand_property: &Property) { + self.fbb_.push_slot_always::<&Property>(WeaponTemplate::VT_RAND_PROPERTY, rand_property); + } + #[inline] + pub fn add_star_limit(&mut self, star_limit: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_STAR_LIMIT, star_limit, 0); + } + #[inline] + pub fn add_exp_recycle(&mut self, exp_recycle: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_EXP_RECYCLE, exp_recycle, 0); + } + #[inline] + pub fn add_weapon_script_config(&mut self, weapon_script_config: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_WEAPON_SCRIPT_CONFIG, weapon_script_config); + } + #[inline] + pub fn add_weapon_ui_model(&mut self, weapon_ui_model: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_WEAPON_UI_MODEL, weapon_ui_model); + } + #[inline] + pub fn add_unk_1(&mut self, unk_1: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_UNK_1, unk_1, 0); + } + #[inline] + pub fn add_unk_missing_field_2(&mut self, unk_missing_field_2: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_UNK_MISSING_FIELD_2, unk_missing_field_2, 0); + } + #[inline] + pub fn add_unk_weapon_path(&mut self, unk_weapon_path: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_UNK_WEAPON_PATH, unk_weapon_path); + } + #[inline] + pub fn add_unk_missing_field_3(&mut self, unk_missing_field_3: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_UNK_MISSING_FIELD_3, unk_missing_field_3, 0); + } + #[inline] + pub fn add_refine_initial(&mut self, refine_initial: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_REFINE_INITIAL, refine_initial, 0); + } + #[inline] + pub fn add_refine_limit(&mut self, refine_limit: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_REFINE_LIMIT, refine_limit, 0); + } + #[inline] + pub fn add_unk_missing_field_4(&mut self, unk_missing_field_4: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_UNK_MISSING_FIELD_4, unk_missing_field_4, 0); + } + #[inline] + pub fn add_unk_missing_field_5(&mut self, unk_missing_field_5: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_UNK_MISSING_FIELD_5, unk_missing_field_5, 0); + } + #[inline] + pub fn add_unk_string_with_values(&mut self, unk_string_with_values: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_UNK_STRING_WITH_VALUES, unk_string_with_values); + } + #[inline] + pub fn add_unk_missing_field_6(&mut self, unk_missing_field_6: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_UNK_MISSING_FIELD_6, unk_missing_field_6, 0); + } + #[inline] + pub fn add_unk_2(&mut self, unk_2: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_UNK_2, unk_2, 0); + } + #[inline] + pub fn add_weapon_desc(&mut self, weapon_desc: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_WEAPON_DESC, weapon_desc); + } + #[inline] + pub fn add_weapon_release_tag(&mut self, weapon_release_tag: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_WEAPON_RELEASE_TAG, weapon_release_tag); + } + #[inline] + pub fn add_unk_empty_string(&mut self, unk_empty_string: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_UNK_EMPTY_STRING, unk_empty_string); + } + #[inline] + pub fn add_avatar_id(&mut self, avatar_id: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_AVATAR_ID, avatar_id, 0); + } + #[inline] + pub fn add_weapon_comment(&mut self, weapon_comment: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_WEAPON_COMMENT, weapon_comment); + } + #[inline] + pub fn add_refine_costs(&mut self, refine_costs: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(WeaponTemplate::VT_REFINE_COSTS, refine_costs); + } + #[inline] + pub fn add_unk_3(&mut self, unk_3: i32) { + self.fbb_.push_slot::(WeaponTemplate::VT_UNK_3, unk_3, 0); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> WeaponTemplateBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + WeaponTemplateBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for WeaponTemplate<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("WeaponTemplate"); + ds.field("item_id", &self.item_id()); + ds.field("weapon_name", &self.weapon_name()); + ds.field("unk_missing_field", &self.unk_missing_field()); + ds.field("base_property", &self.base_property()); + ds.field("rand_property", &self.rand_property()); + ds.field("star_limit", &self.star_limit()); + ds.field("exp_recycle", &self.exp_recycle()); + ds.field("weapon_script_config", &self.weapon_script_config()); + ds.field("weapon_ui_model", &self.weapon_ui_model()); + ds.field("unk_1", &self.unk_1()); + ds.field("unk_missing_field_2", &self.unk_missing_field_2()); + ds.field("unk_weapon_path", &self.unk_weapon_path()); + ds.field("unk_missing_field_3", &self.unk_missing_field_3()); + ds.field("refine_initial", &self.refine_initial()); + ds.field("refine_limit", &self.refine_limit()); + ds.field("unk_missing_field_4", &self.unk_missing_field_4()); + ds.field("unk_missing_field_5", &self.unk_missing_field_5()); + ds.field("unk_string_with_values", &self.unk_string_with_values()); + ds.field("unk_missing_field_6", &self.unk_missing_field_6()); + ds.field("unk_2", &self.unk_2()); + ds.field("weapon_desc", &self.weapon_desc()); + ds.field("weapon_release_tag", &self.weapon_release_tag()); + ds.field("unk_empty_string", &self.unk_empty_string()); + ds.field("avatar_id", &self.avatar_id()); + ds.field("weapon_comment", &self.weapon_comment()); + ds.field("refine_costs", &self.refine_costs()); + ds.field("unk_3", &self.unk_3()); + ds.finish() + } +} pub enum AvatarBaseTemplateTbOffset {} #[derive(Copy, Clone, PartialEq)] @@ -390,74 +1177,100 @@ impl core::fmt::Debug for AvatarBaseTemplateTb<'_> { ds.finish() } } -#[inline] -/// Verifies that a buffer of bytes contains a `AvatarBaseTemplateTb` -/// and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_avatar_base_template_tb_unchecked`. -pub fn root_as_avatar_base_template_tb(buf: &[u8]) -> Result { - flatbuffers::root::(buf) -} -#[inline] -/// Verifies that a buffer of bytes contains a size prefixed -/// `AvatarBaseTemplateTb` and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `size_prefixed_root_as_avatar_base_template_tb_unchecked`. -pub fn size_prefixed_root_as_avatar_base_template_tb(buf: &[u8]) -> Result { - flatbuffers::size_prefixed_root::(buf) -} -#[inline] -/// Verifies, with the given options, that a buffer of bytes -/// contains a `AvatarBaseTemplateTb` and returns it. -/// Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_avatar_base_template_tb_unchecked`. -pub fn root_as_avatar_base_template_tb_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], -) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::root_with_opts::>(opts, buf) -} -#[inline] -/// Verifies, with the given verifier options, that a buffer of -/// bytes contains a size prefixed `AvatarBaseTemplateTb` and returns -/// it. Note that verification is still experimental and may not -/// catch every error, or be maximally performant. For the -/// previous, unchecked, behavior use -/// `root_as_avatar_base_template_tb_unchecked`. -pub fn size_prefixed_root_as_avatar_base_template_tb_with_opts<'b, 'o>( - opts: &'o flatbuffers::VerifierOptions, - buf: &'b [u8], -) -> Result, flatbuffers::InvalidFlatbuffer> { - flatbuffers::size_prefixed_root_with_opts::>(opts, buf) -} -#[inline] -/// Assumes, without verification, that a buffer of bytes contains a AvatarBaseTemplateTb and returns it. -/// # Safety -/// Callers must trust the given bytes do indeed contain a valid `AvatarBaseTemplateTb`. -pub unsafe fn root_as_avatar_base_template_tb_unchecked(buf: &[u8]) -> AvatarBaseTemplateTb { - flatbuffers::root_unchecked::(buf) -} -#[inline] -/// Assumes, without verification, that a buffer of bytes contains a size prefixed AvatarBaseTemplateTb and returns it. -/// # Safety -/// Callers must trust the given bytes do indeed contain a valid size prefixed `AvatarBaseTemplateTb`. -pub unsafe fn size_prefixed_root_as_avatar_base_template_tb_unchecked(buf: &[u8]) -> AvatarBaseTemplateTb { - flatbuffers::size_prefixed_root_unchecked::(buf) -} -#[inline] -pub fn finish_avatar_base_template_tb_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>( - fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, - root: flatbuffers::WIPOffset>) { - fbb.finish(root, None); +pub enum WeaponTemplateTbOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct WeaponTemplateTb<'a> { + pub _tab: flatbuffers::Table<'a>, } -#[inline] -pub fn finish_size_prefixed_avatar_base_template_tb_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset>) { - fbb.finish_size_prefixed(root, None); +impl<'a> flatbuffers::Follow<'a> for WeaponTemplateTb<'a> { + type Inner = WeaponTemplateTb<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> WeaponTemplateTb<'a> { + pub const VT_DATA: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + WeaponTemplateTb { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args WeaponTemplateTbArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = WeaponTemplateTbBuilder::new(_fbb); + if let Some(x) = args.data { builder.add_data(x); } + builder.finish() + } + + + #[inline] + pub fn data(&self) -> Option>>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>>(WeaponTemplateTb::VT_DATA, None)} + } +} + +impl flatbuffers::Verifiable for WeaponTemplateTb<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>>("data", Self::VT_DATA, false)? + .finish(); + Ok(()) + } +} +pub struct WeaponTemplateTbArgs<'a> { + pub data: Option>>>>, +} +impl<'a> Default for WeaponTemplateTbArgs<'a> { + #[inline] + fn default() -> Self { + WeaponTemplateTbArgs { + data: None, + } + } +} + +pub struct WeaponTemplateTbBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> WeaponTemplateTbBuilder<'a, 'b, A> { + #[inline] + pub fn add_data(&mut self, data: flatbuffers::WIPOffset>>>) { + self.fbb_.push_slot_always::>(WeaponTemplateTb::VT_DATA, data); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> WeaponTemplateTbBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + WeaponTemplateTbBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for WeaponTemplateTb<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("WeaponTemplateTb"); + ds.field("data", &self.data()); + ds.finish() + } } diff --git a/crates/yanagi-data/src/lib.rs b/crates/yanagi-data/src/lib.rs index de2beb2..8b4e082 100644 --- a/crates/yanagi-data/src/lib.rs +++ b/crates/yanagi-data/src/lib.rs @@ -19,7 +19,7 @@ macro_rules! file_cfg { Self { $( [<$name:snake>]: { - [](archive_file.open(::const_format::formatcp!("{}", ::xxhash_rust::const_xxh64::xxh64(stringify!([<$name:lower>]).as_bytes(), 0))).unwrap()).unwrap() + ::flatbuffers::root::<$name>(archive_file.open(::const_format::formatcp!("{}", ::xxhash_rust::const_xxh64::xxh64(stringify!([<$name:lower>]).as_bytes(), 0))).unwrap()).unwrap() }, )* } @@ -31,6 +31,7 @@ macro_rules! file_cfg { file_cfg! { AvatarBaseTemplateTb; + WeaponTemplateTb; } pub fn read_archive_file(buf: R) -> std::io::Result { diff --git a/crates/yanagi-proto/out/_.rs b/crates/yanagi-proto/out/_.rs index 5c3fa4b..d8ef400 100644 --- a/crates/yanagi-proto/out/_.rs +++ b/crates/yanagi-proto/out/_.rs @@ -647,7 +647,7 @@ pub struct Pmnndmijimi { #[prost(message, optional, tag = "1")] pub iidnjcionhi: ::core::option::Option, #[prost(message, optional, tag = "2")] - pub fmkfjcmjjik: ::core::option::Option, + pub param: ::core::option::Option, #[prost(enumeration = "Jpnihhbgepd", tag = "3")] pub odnpbhepnoa: i32, #[prost(enumeration = "Pcekojidped", tag = "4")] @@ -2180,7 +2180,7 @@ pub struct Mmiiehdmfgp { pub plcmabdfkpf: u32, #[xor(9424)] #[prost(uint32, tag = "7")] - pub ohdkcchhekh: u32, + pub weapon_uid: u32, } #[derive(yanagi_proto_derive::CmdID)] #[derive(yanagi_proto_derive::XorFields)] @@ -5062,7 +5062,7 @@ pub struct Mjfpfcnncgp { pub struct Bekmebilpcb { #[xor(433)] #[prost(int32, tag = "2")] - pub fmkfjcmjjik: i32, + pub param: i32, #[xor(1641)] #[prost(int32, tag = "6")] pub dajkfnlgcbh: i32, @@ -7671,7 +7671,7 @@ pub struct Iaklgbglpem { #[derive(yanagi_proto_derive::CmdID)] #[derive(yanagi_proto_derive::XorFields)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct Pokljdnilhl { +pub struct ItemSync { #[prost(uint32, repeated, tag = "1")] pub icdbfaacpgk: ::prost::alloc::vec::Vec, #[prost(uint32, repeated, tag = "2")] @@ -10367,12 +10367,12 @@ pub struct Jnmaoeoikpl { #[cmdid(1918)] #[derive(yanagi_proto_derive::XorFields)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct Ecloiccbepc { +pub struct GetPlayerNetworkDataScRsp { #[xor(11954)] #[prost(int32, tag = "10")] pub retcode: i32, #[prost(message, optional, tag = "5")] - pub ccjiedgdklb: ::core::option::Option, + pub player_network_data: ::core::option::Option, } #[derive(yanagi_proto_derive::CmdID)] #[derive(yanagi_proto_derive::XorFields)] @@ -11854,7 +11854,7 @@ pub struct Njjffeiflin { pub mcpmobeikhc: i64, #[xor(3054)] #[prost(uint32, tag = "9")] - pub fmkfjcmjjik: u32, + pub param: u32, #[xor(4875)] #[prost(uint32, tag = "8")] pub fceflpmncba: u32, @@ -12204,7 +12204,7 @@ pub struct Mhbjjkncegl { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Poabpdcddaf { #[prost(message, optional, tag = "1")] - pub fmkfjcmjjik: ::core::option::Option, + pub param: ::core::option::Option, #[prost(uint32, tag = "2")] pub khdllfefdko: u32, #[prost(uint32, tag = "3")] @@ -13137,7 +13137,7 @@ pub struct Ohockeiibig { pub pbehkahplpc: bool, #[xor(5023)] #[prost(uint32, tag = "14")] - pub ohdkcchhekh: u32, + pub weapon_uid: u32, } #[derive(yanagi_proto_derive::CmdID)] #[cmdid(4940)] @@ -13148,7 +13148,7 @@ pub struct Legpdhniadi { pub aoppojcdgge: ::prost::alloc::vec::Vec, #[xor(11061)] #[prost(uint32, tag = "6")] - pub fmkfjcmjjik: u32, + pub param: u32, #[prost(enumeration = "Mdjodbafohl", tag = "14")] pub nkjhacjoagi: i32, } @@ -13391,7 +13391,7 @@ pub struct AvatarInfo { pub mggafoelnin: u32, #[xor(5052)] #[prost(uint32, tag = "2")] - pub bleigcnljfo: u32, + pub cur_weapon_uid: u32, #[prost(message, repeated, tag = "5")] pub skill_type_level: ::prost::alloc::vec::Vec, #[xor(1670)] @@ -13704,7 +13704,7 @@ pub struct Pibgkaalkka { #[prost(message, optional, tag = "1")] pub iidnjcionhi: ::core::option::Option, #[prost(message, optional, tag = "2")] - pub fmkfjcmjjik: ::core::option::Option, + pub param: ::core::option::Option, #[prost(enumeration = "Jpnihhbgepd", tag = "3")] pub odnpbhepnoa: i32, #[prost(enumeration = "Pcekojidped", tag = "4")] @@ -13872,10 +13872,10 @@ pub struct Njedfobgbll { #[cmdid(2244)] #[derive(yanagi_proto_derive::XorFields)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct Pkfmcbgahle { +pub struct WeaponDressCsReq { #[xor(3727)] #[prost(uint32, tag = "13")] - pub ohdkcchhekh: u32, + pub weapon_uid: u32, #[xor(2088)] #[prost(uint32, tag = "1")] pub avatar_id: u32, @@ -14543,7 +14543,7 @@ pub struct Mmncdfccjjl { #[prost(enumeration = "TimePeriodType", tag = "4")] pub time_period: i32, #[prost(enumeration = "Ompbfjdfljk", tag = "5")] - pub iiggaglkijl: i32, + pub avatar: i32, } #[derive(yanagi_proto_derive::CmdID)] #[cmdid(737)] @@ -15700,7 +15700,7 @@ pub struct Mcncgpompai { #[derive(yanagi_proto_derive::CmdID)] #[derive(yanagi_proto_derive::XorFields)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct Ijihfcaondn { +pub struct PlayerNetworkData { #[prost(message, optional, tag = "5")] pub lbfnphfiaef: ::core::option::Option, #[prost(message, optional, tag = "9")] @@ -16129,7 +16129,7 @@ pub struct PlayerOperationCsReq { pub cjbdlgcdgcb: bool, #[xor(5029)] #[prost(int32, tag = "14")] - pub fmkfjcmjjik: i32, + pub param: i32, #[prost(bytes = "vec", tag = "15")] pub info: ::prost::alloc::vec::Vec, #[xor(8845)] @@ -16205,13 +16205,13 @@ pub struct Kndfnifkdac { #[derive(Clone, PartialEq, ::prost::Message)] pub struct PlayerSyncScNotify { #[prost(message, optional, tag = "1")] - pub iiggaglkijl: ::core::option::Option, + pub avatar: ::core::option::Option, #[prost(message, optional, tag = "2")] pub gllgbdhaphh: ::core::option::Option, #[prost(message, optional, tag = "3")] pub dmfpbeopfko: ::core::option::Option, #[prost(message, optional, tag = "4")] - pub cgcgfgfnhne: ::core::option::Option, + pub item: ::core::option::Option, #[prost(message, optional, tag = "5")] pub anblgeifhjh: ::core::option::Option, #[prost(message, optional, tag = "6")] @@ -16904,7 +16904,7 @@ pub struct Eilbfkaaahk { #[prost(int32, tag = "11")] pub retcode: i32, #[prost(message, optional, tag = "9")] - pub ccjiedgdklb: ::core::option::Option, + pub player_network_data: ::core::option::Option, } #[derive(yanagi_proto_derive::CmdID)] #[derive(yanagi_proto_derive::XorFields)] @@ -17371,7 +17371,7 @@ pub struct Anaapljedem { #[prost(string, tag = "2")] pub hhdhdjphojg: ::prost::alloc::string::String, #[prost(message, repeated, tag = "3")] - pub fmkfjcmjjik: ::prost::alloc::vec::Vec, + pub param: ::prost::alloc::vec::Vec, #[prost(message, repeated, tag = "4")] pub jbmhoedjjlc: ::prost::alloc::vec::Vec, } @@ -18724,7 +18724,7 @@ pub struct Adgncnkkbhj { pub struct Pggkcgckcal { #[xor(5182)] #[prost(uint32, tag = "7")] - pub fmkfjcmjjik: u32, + pub param: u32, #[prost(uint32, repeated, tag = "14")] pub bfgenanklmg: ::prost::alloc::vec::Vec, #[prost(enumeration = "Dniekkmfapo", tag = "10")] @@ -18966,7 +18966,7 @@ pub struct Imphglieghn { #[cmdid(8854)] #[derive(yanagi_proto_derive::XorFields)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct Akbciceipfe { +pub struct GetPlayerNetworkDataCsReq { #[xor(1373)] #[prost(uint32, tag = "10")] pub tag: u32, @@ -19490,7 +19490,7 @@ pub struct RefreshSectionScRsp { #[cmdid(6782)] #[derive(yanagi_proto_derive::XorFields)] #[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct Hpbcepaeoda { +pub struct WeaponUnDressCsReq { #[xor(11698)] #[prost(uint32, tag = "15")] pub avatar_id: u32, @@ -25331,7 +25331,7 @@ pub struct Ieeigfmmmoo { #[prost(enumeration = "Heonecgjbdl", tag = "1")] pub balojeikfko: i32, #[prost(uint32, tag = "2")] - pub fmkfjcmjjik: u32, + pub param: u32, } #[derive(yanagi_proto_derive::CmdID)] #[derive(yanagi_proto_derive::XorFields)] @@ -25422,7 +25422,7 @@ pub struct AvatarWishlistPlan { #[prost(uint32, tag = "3")] pub avatar_plan_param2: u32, #[prost(uint32, tag = "4")] - pub ohdkcchhekh: u32, + pub weapon_uid: u32, #[prost(uint32, tag = "5")] pub fpdghbnfdha: u32, #[prost(uint32, tag = "6")] @@ -30770,7 +30770,7 @@ pub struct Pfbijfegcce { pub lgegnbdmjnl: u32, #[xor(13905)] #[prost(uint32, tag = "2")] - pub ohdkcchhekh: u32, + pub weapon_uid: u32, } #[derive(yanagi_proto_derive::CmdID)] #[cmdid(2014)] @@ -30803,7 +30803,7 @@ pub struct Jjpgjfacajh { #[prost(string, tag = "3")] pub iidnjcionhi: ::prost::alloc::string::String, #[prost(int32, tag = "4")] - pub fmkfjcmjjik: i32, + pub param: i32, #[prost(enumeration = "Jpnihhbgepd", tag = "5")] pub odnpbhepnoa: i32, } @@ -32933,7 +32933,7 @@ pub struct Onbnjigpcna {} #[derive(yanagi_proto_derive::CmdID)] #[derive(yanagi_proto_derive::XorFields)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct Ojmfigbbpli { +pub struct AvatarSync { #[prost(message, repeated, tag = "3")] pub avatar_list: ::prost::alloc::vec::Vec, #[prost(uint32, repeated, tag = "14")] @@ -34206,7 +34206,7 @@ pub struct Ggecejkbaef { pub paaaeeobgoa: i32, #[xor(2241)] #[prost(int32, tag = "5")] - pub fmkfjcmjjik: i32, + pub param: i32, } #[derive(yanagi_proto_derive::CmdID)] #[derive(yanagi_proto_derive::XorFields)] @@ -34279,7 +34279,7 @@ pub struct Anhibikpjdf { #[prost(enumeration = "Ogepfnogkhm", tag = "1")] pub r#type: i32, #[prost(message, optional, tag = "2")] - pub fmkfjcmjjik: ::core::option::Option, + pub param: ::core::option::Option, } #[derive(yanagi_proto_derive::CmdID)] #[cmdid(5491)] diff --git a/crates/yanagi-proto/out/proto_conversion.rs b/crates/yanagi-proto/out/proto_conversion.rs index fca702c..408a4d3 100644 --- a/crates/yanagi-proto/out/proto_conversion.rs +++ b/crates/yanagi-proto/out/proto_conversion.rs @@ -556,6 +556,38 @@ impl From for ::protocol::RpcReportUiLayoutPlatform } } #[allow(unused)] +impl From<::protocol::ItemSync> for ItemSync { + fn from(value: ::protocol::ItemSync) -> Self { + Self { + weapon_list: value.weapon_list.into_iter().map(|v| v.into()).collect(), + auto_recovery_info: value + .auto_recovery_info + .into_iter() + .map(|(k, v)| (k.into(), v.into())) + .collect(), + resource_list: value.resource_list.into_iter().map(|v| v.into()).collect(), + equip_list: value.equip_list.into_iter().map(|v| v.into()).collect(), + ..Default::default() + } + } +} +#[allow(unused)] +impl From for ::protocol::ItemSync { + fn from(value: ItemSync) -> Self { + Self { + weapon_list: value.weapon_list.into_iter().map(|v| v.into()).collect(), + auto_recovery_info: value + .auto_recovery_info + .into_iter() + .map(|(k, v)| (k.into(), v.into())) + .collect(), + resource_list: value.resource_list.into_iter().map(|v| v.into()).collect(), + equip_list: value.equip_list.into_iter().map(|v| v.into()).collect(), + ..Default::default() + } + } +} +#[allow(unused)] impl From<::protocol::RpcBattleReportArg> for BattleReportCsReq { fn from(value: ::protocol::RpcBattleReportArg) -> Self { Self { ..Default::default() } @@ -708,6 +740,26 @@ impl From for ::protocol::RpcEndBattleRet { } } #[allow(unused)] +impl From<::protocol::RpcGetPlayerNetworkDataRet> for GetPlayerNetworkDataScRsp { + fn from(value: ::protocol::RpcGetPlayerNetworkDataRet) -> Self { + Self { + retcode: value.retcode.into(), + player_network_data: value.player_network_data.map(|v| v.into()), + ..Default::default() + } + } +} +#[allow(unused)] +impl From for ::protocol::RpcGetPlayerNetworkDataRet { + fn from(value: GetPlayerNetworkDataScRsp) -> Self { + Self { + retcode: value.retcode.into(), + player_network_data: value.player_network_data.map(|v| v.into()), + ..Default::default() + } + } +} +#[allow(unused)] impl From<::protocol::RpcGetArchiveInfoArg> for GetArchiveInfoCsReq { fn from(value: ::protocol::RpcGetArchiveInfoArg) -> Self { Self { ..Default::default() } @@ -935,6 +987,7 @@ impl From<::protocol::AvatarInfo> for AvatarInfo { level: value.level.into(), first_get_time: value.first_get_time.into(), exp: value.exp.into(), + cur_weapon_uid: value.cur_weapon_uid.into(), skill_type_level: value .skill_type_level .into_iter() @@ -960,6 +1013,7 @@ impl From for ::protocol::AvatarInfo { level: value.level.into(), first_get_time: value.first_get_time.into(), exp: value.exp.into(), + cur_weapon_uid: value.cur_weapon_uid.into(), skill_type_level: value .skill_type_level .into_iter() @@ -1032,6 +1086,26 @@ impl From for ::protocol::JourneyInfo { } } #[allow(unused)] +impl From<::protocol::RpcWeaponDressArg> for WeaponDressCsReq { + fn from(value: ::protocol::RpcWeaponDressArg) -> Self { + Self { + weapon_uid: value.weapon_uid.into(), + avatar_id: value.avatar_id.into(), + ..Default::default() + } + } +} +#[allow(unused)] +impl From for ::protocol::RpcWeaponDressArg { + fn from(value: WeaponDressCsReq) -> Self { + Self { + weapon_uid: value.weapon_uid.into(), + avatar_id: value.avatar_id.into(), + ..Default::default() + } + } +} +#[allow(unused)] impl From<::protocol::RpcModMainCityAvatarArg> for ModMainCityAvatarCsReq { fn from(value: ::protocol::RpcModMainCityAvatarArg) -> Self { Self { @@ -1090,6 +1164,18 @@ impl From for ::protocol::RpcGetBabelTowerDataArg { } } #[allow(unused)] +impl From<::protocol::PlayerNetworkData> for PlayerNetworkData { + fn from(value: ::protocol::PlayerNetworkData) -> Self { + Self { ..Default::default() } + } +} +#[allow(unused)] +impl From for ::protocol::PlayerNetworkData { + fn from(value: PlayerNetworkData) -> Self { + Self { ..Default::default() } + } +} +#[allow(unused)] impl From<::protocol::PtcEnterSceneArg> for EnterSceneScNotify { fn from(value: ::protocol::PtcEnterSceneArg) -> Self { Self { @@ -1124,19 +1210,27 @@ impl From for ::protocol::RpcGetBuddyDataArg { #[allow(unused)] impl From<::protocol::RpcPlayerOperationArg> for PlayerOperationCsReq { fn from(value: ::protocol::RpcPlayerOperationArg) -> Self { - Self { ..Default::default() } + Self { + param: value.param.into(), + ..Default::default() + } } } #[allow(unused)] impl From for ::protocol::RpcPlayerOperationArg { fn from(value: PlayerOperationCsReq) -> Self { - Self { ..Default::default() } + Self { + param: value.param.into(), + ..Default::default() + } } } #[allow(unused)] impl From<::protocol::PtcPlayerSyncArg> for PlayerSyncScNotify { fn from(value: ::protocol::PtcPlayerSyncArg) -> Self { Self { + avatar: value.avatar.map(|v| v.into()), + item: value.item.map(|v| v.into()), basic_info: value.basic_info.map(|v| v.into()), ..Default::default() } @@ -1146,6 +1240,8 @@ impl From<::protocol::PtcPlayerSyncArg> for PlayerSyncScNotify { impl From for ::protocol::PtcPlayerSyncArg { fn from(value: PlayerSyncScNotify) -> Self { Self { + avatar: value.avatar.map(|v| v.into()), + item: value.item.map(|v| v.into()), basic_info: value.basic_info.map(|v| v.into()), ..Default::default() } @@ -1324,6 +1420,18 @@ impl From for ::protocol::RpcGetAbyssInfoRet { } } #[allow(unused)] +impl From<::protocol::RpcGetPlayerNetworkDataArg> for GetPlayerNetworkDataCsReq { + fn from(value: ::protocol::RpcGetPlayerNetworkDataArg) -> Self { + Self { ..Default::default() } + } +} +#[allow(unused)] +impl From for ::protocol::RpcGetPlayerNetworkDataArg { + fn from(value: GetPlayerNetworkDataCsReq) -> Self { + Self { ..Default::default() } + } +} +#[allow(unused)] impl From<::protocol::RpcGetNewsStandDataRet> for GetNewsStandDataScRsp { fn from(value: ::protocol::RpcGetNewsStandDataRet) -> Self { Self { @@ -1364,6 +1472,24 @@ impl From for ::protocol::RpcRefreshSectionRet { } } #[allow(unused)] +impl From<::protocol::RpcWeaponUnDressArg> for WeaponUnDressCsReq { + fn from(value: ::protocol::RpcWeaponUnDressArg) -> Self { + Self { + avatar_id: value.avatar_id.into(), + ..Default::default() + } + } +} +#[allow(unused)] +impl From for ::protocol::RpcWeaponUnDressArg { + fn from(value: WeaponUnDressCsReq) -> Self { + Self { + avatar_id: value.avatar_id.into(), + ..Default::default() + } + } +} +#[allow(unused)] impl From<::protocol::LevelRewardInfo> for LevelRewardInfo { fn from(value: ::protocol::LevelRewardInfo) -> Self { Self { ..Default::default() } @@ -2208,6 +2334,24 @@ impl From for ::protocol::RpcGetPlayerMailsArg { } } #[allow(unused)] +impl From<::protocol::AvatarSync> for AvatarSync { + fn from(value: ::protocol::AvatarSync) -> Self { + Self { + avatar_list: value.avatar_list.into_iter().map(|v| v.into()).collect(), + ..Default::default() + } + } +} +#[allow(unused)] +impl From for ::protocol::AvatarSync { + fn from(value: AvatarSync) -> Self { + Self { + avatar_list: value.avatar_list.into_iter().map(|v| v.into()).collect(), + ..Default::default() + } + } +} +#[allow(unused)] impl From<::protocol::RpcEndBattleArg> for EndBattleCsReq { fn from(value: ::protocol::RpcEndBattleArg) -> Self { Self { ..Default::default() } @@ -3054,7 +3198,12 @@ macro_rules! decode_and_forward_proto { rpc_arg = ::protocol::RpcGetChatEmojiListArg::from(packet.body); let rpc_ret : ::protocol::RpcGetChatEmojiListRet = $point .call_rpc($addr, rpc_arg, $middlewares, $timeout). await ?; $session .send_null_rsp(packet.head.packet_id); - }, ModMainCityAvatarCsReq::CMD_ID => { let packet = NetPacket:: < + }, WeaponDressCsReq::CMD_ID => { let packet = NetPacket:: < + ::yanagi_proto::WeaponDressCsReq > ::decode($buf) ?; let rpc_arg = + ::protocol::RpcWeaponDressArg::from(packet.body); let rpc_ret : + ::protocol::RpcWeaponDressRet = $point .call_rpc($addr, rpc_arg, $middlewares, + $timeout). await ?; $session .send_null_rsp(packet.head.packet_id); }, + ModMainCityAvatarCsReq::CMD_ID => { let packet = NetPacket:: < ::yanagi_proto::ModMainCityAvatarCsReq > ::decode($buf) ?; let rpc_arg = ::protocol::RpcModMainCityAvatarArg::from(packet.body); let rpc_ret : ::protocol::RpcModMainCityAvatarRet = $point .call_rpc($addr, rpc_arg, @@ -3100,11 +3249,23 @@ macro_rules! decode_and_forward_proto { : ::protocol::RpcGetClientSystemsInfoRet = $point .call_rpc($addr, rpc_arg, $middlewares, $timeout). await ?; let proto_rsp = ::yanagi_proto::GetClientSystemsInfoScRsp::from(rpc_ret); $session - .send_rsp(packet.head.packet_id, proto_rsp); }, RefreshSectionCsReq::CMD_ID => { - let packet = NetPacket:: < ::yanagi_proto::RefreshSectionCsReq > ::decode($buf) - ?; let rpc_arg = ::protocol::RpcRefreshSectionArg::from(packet.body); let rpc_ret - : ::protocol::RpcRefreshSectionRet = $point .call_rpc($addr, rpc_arg, + .send_rsp(packet.head.packet_id, proto_rsp); }, GetPlayerNetworkDataCsReq::CMD_ID + => { let packet = NetPacket:: < ::yanagi_proto::GetPlayerNetworkDataCsReq > + ::decode($buf) ?; let rpc_arg = + ::protocol::RpcGetPlayerNetworkDataArg::from(packet.body); let rpc_ret : + ::protocol::RpcGetPlayerNetworkDataRet = $point .call_rpc($addr, rpc_arg, $middlewares, $timeout). await ?; let proto_rsp = + ::yanagi_proto::GetPlayerNetworkDataScRsp::from(rpc_ret); $session + .send_rsp(packet.head.packet_id, proto_rsp); }, WeaponUnDressCsReq::CMD_ID => { + let packet = NetPacket:: < ::yanagi_proto::WeaponUnDressCsReq > ::decode($buf) ?; + let rpc_arg = ::protocol::RpcWeaponUnDressArg::from(packet.body); let rpc_ret : + ::protocol::RpcWeaponUnDressRet = $point .call_rpc($addr, rpc_arg, $middlewares, + $timeout). await ?; $session .send_null_rsp(packet.head.packet_id); }, + RefreshSectionCsReq::CMD_ID => { let packet = NetPacket:: < + ::yanagi_proto::RefreshSectionCsReq > ::decode($buf) ?; let rpc_arg = + ::protocol::RpcRefreshSectionArg::from(packet.body); let rpc_ret : + ::protocol::RpcRefreshSectionRet = $point .call_rpc($addr, rpc_arg, $middlewares, + $timeout). await ?; let proto_rsp = ::yanagi_proto::RefreshSectionScRsp::from(rpc_ret); $session .send_rsp(packet .head.packet_id, proto_rsp); }, PlayerTransactionCsReq::CMD_ID => { let packet = NetPacket:: < ::yanagi_proto::PlayerTransactionCsReq > ::decode($buf) ?; let @@ -3363,11 +3524,12 @@ macro_rules! impl_qwer_to_proto_match { ::protocol::RpcGetWeaponDataArg::PROTOCOL_ID => $process_proto_message (GetWeaponDataCsReq::from(qwer)), ::protocol::RpcGetChatEmojiListArg::PROTOCOL_ID => $process_proto_message (GetChatEmojiListCsReq::from(qwer)), - ::protocol::RpcModMainCityAvatarArg::PROTOCOL_ID => $process_proto_message - (ModMainCityAvatarCsReq::from(qwer)), ::protocol::RpcGetCafeDataArg::PROTOCOL_ID - => $process_proto_message (GetCafeDataCsReq::from(qwer)), - ::protocol::RpcGetAvatarDataArg::PROTOCOL_ID => $process_proto_message - (GetAvatarDataCsReq::from(qwer)), + ::protocol::RpcWeaponDressArg::PROTOCOL_ID => $process_proto_message + (WeaponDressCsReq::from(qwer)), ::protocol::RpcModMainCityAvatarArg::PROTOCOL_ID + => $process_proto_message (ModMainCityAvatarCsReq::from(qwer)), + ::protocol::RpcGetCafeDataArg::PROTOCOL_ID => $process_proto_message + (GetCafeDataCsReq::from(qwer)), ::protocol::RpcGetAvatarDataArg::PROTOCOL_ID => + $process_proto_message (GetAvatarDataCsReq::from(qwer)), ::protocol::RpcGetBabelTowerDataArg::PROTOCOL_ID => $process_proto_message (GetBabelTowerDataCsReq::from(qwer)), ::protocol::PtcEnterSceneArg::PROTOCOL_ID => $process_proto_message (EnterSceneScNotify::from(qwer)), @@ -3381,8 +3543,11 @@ macro_rules! impl_qwer_to_proto_match { (PlayerLoginCsReq::from(qwer)), ::protocol::RpcGetClientSystemsInfoArg::PROTOCOL_ID => $process_proto_message (GetClientSystemsInfoCsReq::from(qwer)), - ::protocol::RpcRefreshSectionArg::PROTOCOL_ID => $process_proto_message - (RefreshSectionCsReq::from(qwer)), + ::protocol::RpcGetPlayerNetworkDataArg::PROTOCOL_ID => $process_proto_message + (GetPlayerNetworkDataCsReq::from(qwer)), + ::protocol::RpcWeaponUnDressArg::PROTOCOL_ID => $process_proto_message + (WeaponUnDressCsReq::from(qwer)), ::protocol::RpcRefreshSectionArg::PROTOCOL_ID + => $process_proto_message (RefreshSectionCsReq::from(qwer)), ::protocol::RpcPlayerTransactionArg::PROTOCOL_ID => $process_proto_message (PlayerTransactionCsReq::from(qwer)), ::protocol::RpcGetAbyssArpeggioDataArg::PROTOCOL_ID => $process_proto_message