Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions examples/capture_parser/main.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
mod zip_context;

use std::collections::HashMap;
use std::env;
use std::io::{BufReader, Result as Res};
use std::fs;
use std::fs::File;
use std::path::Path;
use std::time::Instant;
use std::{
collections::HashMap,
env, fs,
fs::File,
io::{BufReader, Result as Res},
path::Path,
time::Instant,
};

use lu_packets::world::Lot;
use lu_packets::unified::Message;
use self::zip_context::ZipContext;
use lu_packets::{unified::Message, world::Lot};
use rusqlite::{params, Connection};
use zip::ZipArchive;
use self::zip_context::ZipContext;

static mut PRINT_PACKETS: bool = false;

Expand Down
11 changes: 5 additions & 6 deletions examples/capture_parser/zip_context.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use std::collections::HashMap;
use std::io::Result as Res;
use std::{collections::HashMap, io::Result as Res};

use endio_bit::BEBitReader;
use lu_packets::{
lu,
raknet::client::replica::{
ComponentConstruction, ComponentSerialization, ReplicaContext,
achievement_vendor::{AchievementVendorConstruction, AchievementVendorSerialization},
base_combat_ai::{BaseCombatAiConstruction, BaseCombatAiSerialization},
bbb::{BbbConstruction, BbbSerialization},
Expand All @@ -14,8 +12,8 @@ use lu_packets::{
character::{CharacterConstruction, CharacterSerialization},
collectible::{CollectibleConstruction, CollectibleSerialization},
controllable_physics::{ControllablePhysicsConstruction, ControllablePhysicsSerialization},
donation_vendor::{DonationVendorConstruction, DonationVendorSerialization},
destroyable::{DestroyableConstruction, DestroyableSerialization},
donation_vendor::{DonationVendorConstruction, DonationVendorSerialization},
fx::FxConstruction,
inventory::{InventoryConstruction, InventorySerialization},
item::{ItemConstruction, ItemSerialization},
Expand All @@ -24,9 +22,9 @@ use lu_packets::{
module_assembly::ModuleAssemblyConstruction,
moving_platform::{MovingPlatformConstruction, MovingPlatformSerialization},
mutable_model_behavior::{MutableModelBehaviorConstruction, MutableModelBehaviorSerialization},
pet::{PetConstruction, PetSerialization},
phantom_physics::{PhantomPhysicsConstruction, PhantomPhysicsSerialization},
player_forced_movement::{PlayerForcedMovementConstruction, PlayerForcedMovementSerialization},
pet::{PetConstruction, PetSerialization},
possessable::{PossessableConstruction, PossessableSerialization},
possession_control::{PossessionControlConstruction, PossessionControlSerialization},
quickbuild::{QuickbuildConstruction, QuickbuildSerialization},
Expand All @@ -40,8 +38,9 @@ use lu_packets::{
switch::{SwitchConstruction, SwitchSerialization},
vehicle_physics::{VehiclePhysicsConstruction, VehiclePhysicsSerialization},
vendor::{VendorConstruction, VendorSerialization},
ComponentConstruction, ComponentSerialization, ReplicaContext,
},
world::{Lot, LuNameValue, LnvValue},
world::{LnvValue, Lot, LuNameValue},
};
use zip::read::ZipFile;

Expand Down
5 changes: 2 additions & 3 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
unstable_features = true
hard_tabs = true
reorder_imports = false
reorder_modules = false
imports_granularity = "Crate"
# disable line wrapping
max_width = 1000
use_small_heuristics = "Max"
use_small_heuristics = "Max"
16 changes: 8 additions & 8 deletions src/auth/client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! Client-received auth messages.
use std::io::{Error, ErrorKind::InvalidData, Result as Res, Read};
use std::io::{Error, ErrorKind::InvalidData, Read, Result as Res};

use endio::{LEWrite, LERead, Deserialize, Serialize};
use endio::LittleEndian as LE;
use lu_packets_derive::MessageFromVariants;
use lu_packets_derive::VariantTests;
use endio::{Deserialize, LERead, LEWrite, LittleEndian as LE, Serialize};
use lu_packets_derive::{MessageFromVariants, VariantTests};

use crate::common::{LuString3, LuString33, LuString37, LuVarWString, LuWString33, ServiceId};
use crate::general::client::{DisconnectNotify, Handshake, GeneralMessage};
use crate::world::server::Language;
use crate::{
common::{LuString3, LuString33, LuString37, LuVarWString, LuWString33, ServiceId},
general::client::{DisconnectNotify, GeneralMessage, Handshake},
world::server::Language,
};

/// All messages that can be received by a client from an auth server.
pub type Message = crate::raknet::client::Message<LuMessage>;
Expand Down
2 changes: 1 addition & 1 deletion src/auth/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use endio::{Deserialize, Serialize};
use lu_packets_derive::VariantTests;

use crate::common::{LuWString33, LuWString41, LuWString128, LuWString256, ServiceId};
use crate::common::{LuWString128, LuWString256, LuWString33, LuWString41, ServiceId};
pub use crate::general::server::GeneralMessage;

/// All messages that can be received by an auth server.
Expand Down
6 changes: 4 additions & 2 deletions src/chat/client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use endio::{Deserialize, Serialize};
use lu_packets_derive::{MessageFromVariants, VariantTests};

use crate::common::{LuWString33, ObjId};
use crate::world::client::Message;
pub use super::{GeneralChatMessage, PrivateChatMessage};
use crate::{
common::{LuWString33, ObjId},
world::client::Message,
};

#[derive(Debug, Deserialize, PartialEq, Serialize, MessageFromVariants, VariantTests)]
#[non_exhaustive]
Expand Down
6 changes: 2 additions & 4 deletions src/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
pub mod client;
pub mod server;

use std::io::{Read, Write};
use std::io::Result as Res;
use std::io::{Read, Result as Res, Write};

use endio::{Deserialize, LERead, LEWrite, Serialize};
use endio::LittleEndian as LE;
use endio::{Deserialize, LERead, LEWrite, LittleEndian as LE, Serialize};

use crate::common::{LuVarWString, LuWString33, ObjId};

Expand Down
4 changes: 2 additions & 2 deletions src/chat/server/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use endio::{Deserialize, Serialize};
use lu_packets_derive::VariantTests;

use crate::common::{LuWString33, ObjId};
pub use super::{GeneralChatMessage, PrivateChatMessage};
use super::ChatChannel;
pub use super::{GeneralChatMessage, PrivateChatMessage};
use crate::common::{LuWString33, ObjId};

#[derive(Debug, Deserialize, PartialEq, Serialize, VariantTests)]
#[post_disc_padding = 9]
Expand Down
15 changes: 8 additions & 7 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//! Shared types.
mod str;

use std::convert::{TryFrom, TryInto};
use std::fmt::{Formatter, Debug};
use std::io::{Read, Write};
use std::io::Result as Res;
use std::marker::PhantomData;

use endio::{Deserialize, LE, LERead, LEWrite, Serialize};
use std::{
convert::{TryFrom, TryInto},
fmt::{Debug, Formatter},
io::{Read, Result as Res, Write},
marker::PhantomData,
};

use endio::{Deserialize, LERead, LEWrite, Serialize, LE};

pub use self::str::*;

Expand Down
9 changes: 5 additions & 4 deletions src/common/str/fixed.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::convert::TryFrom;
use std::io::{Read, Write};
use std::io::Result as Res;
use std::{
convert::TryFrom,
io::{Read, Result as Res, Write},
};

use endio::{Deserialize, LE, Serialize};
use endio::{Deserialize, Serialize, LE};

use super::{AbstractLuStr, AsciiChar, AsciiError, LuChar, LuStrExt, Ucs2Char, Ucs2Error};

Expand Down
3 changes: 1 addition & 2 deletions src/common/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ mod variable;

use endio::{Deserialize, Serialize};

pub use self::fixed::*;
pub use self::variable::*;
pub use self::{fixed::*, variable::*};

pub trait LuChar {
type Int;
Expand Down
5 changes: 2 additions & 3 deletions src/common/str/variable.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::convert::{TryFrom};
use std::marker::PhantomData;
use std::{convert::TryFrom, marker::PhantomData};

use crate::common::LVec;
use super::{AsciiChar, AsciiError, LuStrExt, LuWStr, Ucs2Char, Ucs2Error};
use crate::common::LVec;

pub type LuVarString<L> = LVec<L, AsciiChar>;
pub type LuVarWString<L> = LVec<L, Ucs2Char>;
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ macro_rules! lu {
};
}

pub mod raknet;
pub mod auth;
pub mod chat;
pub mod common;
pub mod general;
pub mod world;
pub mod raknet;
pub mod unified;
pub mod world;
3 changes: 1 addition & 2 deletions src/raknet/client/replica/achievement_vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use endio::Serialize;
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use super::vendor::VendorInfo;
use super::{vendor::VendorInfo, ComponentConstruction, ComponentProtocol, ComponentSerialization};

#[derive(BitVariantTests, Debug, PartialEq, ReplicaSerde)]
pub struct AchievementVendorConstruction {
Expand Down
2 changes: 1 addition & 1 deletion src/raknet/client/replica/base_combat_ai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use endio::{Deserialize, Serialize};
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use crate::common::ObjId;
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use crate::common::ObjId;

#[derive(Debug, Deserialize, PartialEq, Serialize)]
#[repr(u32)]
Expand Down
2 changes: 1 addition & 1 deletion src/raknet/client/replica/bbb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use endio::Serialize;
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use crate::common::ObjId;
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use crate::common::ObjId;

#[derive(BitVariantTests, Debug, PartialEq, ReplicaSerde)]
pub struct BbbConstruction {
Expand Down
4 changes: 2 additions & 2 deletions src/raknet/client/replica/buff.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::io::{Read, Result as Res, Write};

use endio::{Deserialize, LE, LERead, LEWrite, Serialize};
use endio::{Deserialize, LERead, LEWrite, Serialize, LE};
use endio_bit::{BEBitReader, BEBitWriter};
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization, ReplicaD};
use crate::common::{LVec, ObjId};
use super::{ReplicaD, ComponentConstruction, ComponentProtocol, ComponentSerialization};

// so close to being able to do serialization automatically...if not for the irregularity with `added_by_teammate`...
#[derive(Debug, PartialEq)]
Expand Down
4 changes: 2 additions & 2 deletions src/raknet/client/replica/character.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::io::{Error, ErrorKind::InvalidData, Read, Result as Res, Write};

use endio::{Deserialize, LE, LERead, LEWrite, Serialize};
use endio::{Deserialize, LERead, LEWrite, Serialize, LE};
use endio_bit::{BEBitReader, BEBitWriter};
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use crate::common::{LuVarWString, ObjId};
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use crate::common::{LuVarWString, ObjId};

#[derive(Debug, PartialEq)]
pub enum TransitionState {
Expand Down
8 changes: 5 additions & 3 deletions src/raknet/client/replica/controllable_physics.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use std::io::{Result as Res};
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 crate::world::{Vector3, Quaternion};
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use crate::{
common::ObjId,
world::{Quaternion, Vector3},
};

#[derive(Debug, PartialEq, ReplicaSerde)]
pub struct JetpackInfo {
Expand Down
4 changes: 2 additions & 2 deletions src/raknet/client/replica/destroyable.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::io::{Read, Result as Res, Write};

use endio::{Deserialize, LE, LERead, LEWrite, Serialize};
use endio::{Deserialize, LERead, LEWrite, Serialize, LE};
use endio_bit::{BEBitReader, BEBitWriter};
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use crate::common::LVec;
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use crate::common::LVec;

#[derive(Debug, Deserialize, PartialEq, Serialize)]
pub struct StatusImmunityInfo {
Expand Down
3 changes: 1 addition & 2 deletions src/raknet/client/replica/donation_vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use endio::Serialize;
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use super::vendor::VendorInfo;
use super::{vendor::VendorInfo, ComponentConstruction, ComponentProtocol, ComponentSerialization};

#[derive(Debug, PartialEq, ReplicaSerde)]
pub struct DonationVendorInfo {
Expand Down
2 changes: 1 addition & 1 deletion src/raknet/client/replica/fx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use endio::Serialize;
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use crate::common::{LuVarString, LuVarWString, LVec, ObjId};
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use crate::common::{LVec, LuVarString, LuVarWString, ObjId};

#[derive(Debug, PartialEq, ReplicaSerde)]
pub struct EffectInfo {
Expand Down
7 changes: 4 additions & 3 deletions src/raknet/client/replica/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ use endio::Serialize;
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use crate::common::{LVec, ObjId};
use crate::world::{LuNameValue, Lot, Quaternion, Vector3};
use crate::world::gm::InventoryType;
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use crate::{
common::{LVec, ObjId},
world::{gm::InventoryType, Lot, LuNameValue, Quaternion, Vector3},
};

#[derive(Debug, PartialEq, ReplicaSerde)]
pub struct EquippedItemInfo {
Expand Down
2 changes: 1 addition & 1 deletion src/raknet/client/replica/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use endio::{Deserialize, Serialize};
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use crate::common::{LuVarWString, ObjId};
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use crate::common::{LuVarWString, ObjId};

#[derive(Debug, Deserialize, PartialEq, Serialize)]
#[repr(u32)]
Expand Down
2 changes: 1 addition & 1 deletion src/raknet/client/replica/lup_exhibit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use endio::Serialize;
use endio_bit::BEBitWriter;
use lu_packets_derive::{BitVariantTests, ReplicaSerde};

use crate::world::Lot;
use super::{ComponentConstruction, ComponentProtocol, ComponentSerialization};
use crate::world::Lot;

#[derive(BitVariantTests, Debug, PartialEq, ReplicaSerde)]
pub struct LupExhibitConstruction {
Expand Down
Loading