mirror of
https://github.com/lcdr/lu_packets.git
synced 2025-12-30 09:00:38 -06:00
Add support for vendor component
This commit is contained in:
@@ -20,7 +20,7 @@ use self::zip_context::ZipContext;
|
||||
|
||||
static mut PRINT_PACKETS: bool = false;
|
||||
|
||||
const COMP_ORDER : [u32; 18] = [1, 3, 40, 98, 7, 110, 109, 106, 4, 17, 5, 9, 60, 48, 6, 2, 44, 107];
|
||||
const COMP_ORDER : [u32; 19] = [1, 3, 40, 98, 7, 110, 109, 106, 4, 17, 5, 9, 60, 48, 16, 6, 2, 44, 107];
|
||||
|
||||
pub struct Cdclient {
|
||||
conn: Connection,
|
||||
@@ -152,6 +152,7 @@ fn parse(path: &Path, cdclient: &mut Cdclient) -> Res<usize> {
|
||||
&& !file.name().contains("[1647]")
|
||||
&& !file.name().contains("[1648]"))
|
||||
|| (file.name().contains("[24]")
|
||||
&& !file.name().contains("(4930)")
|
||||
&& !file.name().contains("(5958)")
|
||||
&& !file.name().contains("(6267)")
|
||||
&& !file.name().contains("(6010)")
|
||||
|
||||
@@ -22,6 +22,7 @@ use lu_packets::{
|
||||
simple_physics::{SimplePhysicsConstruction, SimplePhysicsSerialization},
|
||||
script::ScriptConstruction,
|
||||
skill::SkillConstruction,
|
||||
vendor::{VendorConstruction, VendorSerialization},
|
||||
},
|
||||
world::Lot,
|
||||
};
|
||||
@@ -52,57 +53,24 @@ impl ReplicaContext for ZipContext<'_> {
|
||||
let mut constrs: Vec<fn(&mut BEBitReader<R>) -> Res<Box<dyn ComponentConstruction>>> = vec![];
|
||||
for comp in comps {
|
||||
match comp {
|
||||
1 => {
|
||||
constrs.push(|x| Ok(Box::new(ControllablePhysicsConstruction::deserialize(x)?)));
|
||||
}
|
||||
3 => {
|
||||
constrs.push(|x| Ok(Box::new(SimplePhysicsConstruction::deserialize(x)?)));
|
||||
}
|
||||
4 => {
|
||||
constrs.push(|x| Ok(Box::new(CharacterConstruction::deserialize(x)?)));
|
||||
}
|
||||
5 => {
|
||||
constrs.push(|x| Ok(Box::new(ScriptConstruction::deserialize(x)?)));
|
||||
}
|
||||
6 => {
|
||||
constrs.push(|x| Ok(Box::new(BouncerConstruction::deserialize(x)?)));
|
||||
}
|
||||
7 => {
|
||||
constrs.push(|x| Ok(Box::new(DestroyableConstruction::deserialize(x)?)));
|
||||
}
|
||||
9 => {
|
||||
constrs.push(|x| Ok(Box::new(SkillConstruction::deserialize(x)?)));
|
||||
}
|
||||
17 => {
|
||||
constrs.push(|x| Ok(Box::new(InventoryConstruction::deserialize(x)?)));
|
||||
}
|
||||
40 => {
|
||||
constrs.push(|x| Ok(Box::new(PhantomPhysicsConstruction::deserialize(x)?)));
|
||||
}
|
||||
44 => {
|
||||
constrs.push(|x| Ok(Box::new(FxConstruction::deserialize(x)?)));
|
||||
}
|
||||
48 => {
|
||||
constrs.push(|x| Ok(Box::new(QuickbuildConstruction::deserialize(x)?)));
|
||||
}
|
||||
60 => {
|
||||
constrs.push(|x| Ok(Box::new(BaseCombatAiConstruction::deserialize(x)?)));
|
||||
}
|
||||
98 => {
|
||||
constrs.push(|x| Ok(Box::new(BuffConstruction::deserialize(x)?)));
|
||||
}
|
||||
106 => {
|
||||
constrs.push(|x| Ok(Box::new(PlayerForcedMovementConstruction::deserialize(x)?)));
|
||||
}
|
||||
107 => {
|
||||
constrs.push(|x| Ok(Box::new(BbbConstruction::deserialize(x)?)));
|
||||
}
|
||||
109 => {
|
||||
constrs.push(|x| Ok(Box::new(LevelProgressionConstruction::deserialize(x)?)));
|
||||
}
|
||||
110 => {
|
||||
constrs.push(|x| Ok(Box::new(PossessionControlConstruction::deserialize(x)?)));
|
||||
}
|
||||
1 => { constrs.push(|x| Ok(Box::new(ControllablePhysicsConstruction::deserialize(x)?))); }
|
||||
3 => { constrs.push(|x| Ok(Box::new(SimplePhysicsConstruction::deserialize(x)?))); }
|
||||
4 => { constrs.push(|x| Ok(Box::new(CharacterConstruction::deserialize(x)?))); }
|
||||
5 => { constrs.push(|x| Ok(Box::new(ScriptConstruction::deserialize(x)?))); }
|
||||
6 => { constrs.push(|x| Ok(Box::new(BouncerConstruction::deserialize(x)?))); }
|
||||
7 => { constrs.push(|x| Ok(Box::new(DestroyableConstruction::deserialize(x)?))); }
|
||||
9 => { constrs.push(|x| Ok(Box::new(SkillConstruction::deserialize(x)?))); }
|
||||
16 => { constrs.push(|x| Ok(Box::new(VendorConstruction::deserialize(x)?))); }
|
||||
17 => { constrs.push(|x| Ok(Box::new(InventoryConstruction::deserialize(x)?))); }
|
||||
40 => { constrs.push(|x| Ok(Box::new(PhantomPhysicsConstruction::deserialize(x)?))); }
|
||||
44 => { constrs.push(|x| Ok(Box::new(FxConstruction::deserialize(x)?))); }
|
||||
48 => { constrs.push(|x| Ok(Box::new(QuickbuildConstruction::deserialize(x)?))); }
|
||||
60 => { constrs.push(|x| Ok(Box::new(BaseCombatAiConstruction::deserialize(x)?))); }
|
||||
98 => { constrs.push(|x| Ok(Box::new(BuffConstruction::deserialize(x)?))); }
|
||||
106 => { constrs.push(|x| Ok(Box::new(PlayerForcedMovementConstruction::deserialize(x)?))); }
|
||||
107 => { constrs.push(|x| Ok(Box::new(BbbConstruction::deserialize(x)?))); }
|
||||
109 => { constrs.push(|x| Ok(Box::new(LevelProgressionConstruction::deserialize(x)?))); }
|
||||
110 => { constrs.push(|x| Ok(Box::new(PossessionControlConstruction::deserialize(x)?))); }
|
||||
2 | 31 | 35 | 55 | 56 | 64 | 68 | 73 => {},
|
||||
x => panic!("{}", x),
|
||||
}
|
||||
@@ -119,45 +87,20 @@ impl ReplicaContext for ZipContext<'_> {
|
||||
let mut sers: Vec<fn(&mut BEBitReader<R>) -> Res<Box<dyn ComponentSerialization>>> = vec![];
|
||||
for comp in comps {
|
||||
match comp {
|
||||
1 => {
|
||||
sers.push(|x| Ok(Box::new(ControllablePhysicsSerialization::deserialize(x)?)));
|
||||
}
|
||||
3 => {
|
||||
sers.push(|x| Ok(Box::new(SimplePhysicsSerialization::deserialize(x)?)));
|
||||
}
|
||||
4 => {
|
||||
sers.push(|x| Ok(Box::new(CharacterSerialization::deserialize(x)?)));
|
||||
}
|
||||
6 => {
|
||||
sers.push(|x| Ok(Box::new(BouncerSerialization::deserialize(x)?)));
|
||||
}
|
||||
7 => {
|
||||
sers.push(|x| Ok(Box::new(DestroyableSerialization::deserialize(x)?)));
|
||||
}
|
||||
17 => {
|
||||
sers.push(|x| Ok(Box::new(InventorySerialization::deserialize(x)?)));
|
||||
}
|
||||
40 => {
|
||||
sers.push(|x| Ok(Box::new(PhantomPhysicsSerialization::deserialize(x)?)));
|
||||
}
|
||||
48 => {
|
||||
sers.push(|x| Ok(Box::new(QuickbuildSerialization::deserialize(x)?)));
|
||||
}
|
||||
60 => {
|
||||
sers.push(|x| Ok(Box::new(BaseCombatAiSerialization::deserialize(x)?)));
|
||||
}
|
||||
106 => {
|
||||
sers.push(|x| Ok(Box::new(PlayerForcedMovementSerialization::deserialize(x)?)));
|
||||
}
|
||||
107 => {
|
||||
sers.push(|x| Ok(Box::new(BbbSerialization::deserialize(x)?)));
|
||||
}
|
||||
109 => {
|
||||
sers.push(|x| Ok(Box::new(LevelProgressionSerialization::deserialize(x)?)));
|
||||
}
|
||||
110 => {
|
||||
sers.push(|x| Ok(Box::new(PossessionControlSerialization::deserialize(x)?)));
|
||||
}
|
||||
1 => { sers.push(|x| Ok(Box::new(ControllablePhysicsSerialization::deserialize(x)?))); }
|
||||
3 => { sers.push(|x| Ok(Box::new(SimplePhysicsSerialization::deserialize(x)?))); }
|
||||
4 => { sers.push(|x| Ok(Box::new(CharacterSerialization::deserialize(x)?))); }
|
||||
6 => { sers.push(|x| Ok(Box::new(BouncerSerialization::deserialize(x)?))); }
|
||||
7 => { sers.push(|x| Ok(Box::new(DestroyableSerialization::deserialize(x)?))); }
|
||||
16 => { sers.push(|x| Ok(Box::new(VendorSerialization::deserialize(x)?))); }
|
||||
17 => { sers.push(|x| Ok(Box::new(InventorySerialization::deserialize(x)?))); }
|
||||
40 => { sers.push(|x| Ok(Box::new(PhantomPhysicsSerialization::deserialize(x)?))); }
|
||||
48 => { sers.push(|x| Ok(Box::new(QuickbuildSerialization::deserialize(x)?))); }
|
||||
60 => { sers.push(|x| Ok(Box::new(BaseCombatAiSerialization::deserialize(x)?))); }
|
||||
106 => { sers.push(|x| Ok(Box::new(PlayerForcedMovementSerialization::deserialize(x)?))); }
|
||||
107 => { sers.push(|x| Ok(Box::new(BbbSerialization::deserialize(x)?))); }
|
||||
109 => { sers.push(|x| Ok(Box::new(LevelProgressionSerialization::deserialize(x)?))); }
|
||||
110 => { sers.push(|x| Ok(Box::new(PossessionControlSerialization::deserialize(x)?))); }
|
||||
2 | 5 | 9 | 31 | 35 | 44 | 55 | 56 | 64 | 68 | 73 | 98 => {},
|
||||
x => panic!("{}", x),
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ pub mod quickbuild;
|
||||
pub mod script;
|
||||
pub mod simple_physics;
|
||||
pub mod skill;
|
||||
pub mod vendor;
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::io::{Read, Result as Res, Write};
|
||||
|
||||
1
src/raknet/client/replica/tests/VendorConstruction.bin
Normal file
1
src/raknet/client/replica/tests/VendorConstruction.bin
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD>
|
||||
6
src/raknet/client/replica/tests/VendorConstruction.rs
Normal file
6
src/raknet/client/replica/tests/VendorConstruction.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
VendorConstruction {
|
||||
vendor_info: Some(VendorInfo {
|
||||
has_standard_items: true,
|
||||
has_multicost_items: true,
|
||||
}),
|
||||
}
|
||||
33
src/raknet/client/replica/vendor.rs
Normal file
33
src/raknet/client/replica/vendor.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
use std::io::Result as Res;
|
||||
|
||||
use endio::{Deserialize, Serialize};
|
||||
use endio_bit::BEBitWriter;
|
||||
use lu_packets_derive::{BitVariantTests, ReplicaSerde};
|
||||
|
||||
use crate::common::ObjId;
|
||||
use super::{ComponentConstruction, ComponentSerialization};
|
||||
|
||||
#[derive(Debug, PartialEq, ReplicaSerde)]
|
||||
pub struct VendorInfo {
|
||||
pub has_standard_items: bool,
|
||||
pub has_multicost_items: bool,
|
||||
}
|
||||
|
||||
#[derive(BitVariantTests, Debug, PartialEq, ReplicaSerde)]
|
||||
pub struct VendorConstruction {
|
||||
pub vendor_info: Option<VendorInfo>,
|
||||
}
|
||||
|
||||
impl ComponentConstruction for VendorConstruction {
|
||||
fn ser(&self, writer: &mut BEBitWriter<Vec<u8>>) -> Res<()> {
|
||||
self.serialize(writer)
|
||||
}
|
||||
}
|
||||
|
||||
pub type VendorSerialization = VendorConstruction;
|
||||
|
||||
impl ComponentSerialization for VendorSerialization {
|
||||
fn ser(&self, writer: &mut BEBitWriter<Vec<u8>>) -> Res<()> {
|
||||
self.serialize(writer)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user