diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 0235a64..0ea46cf 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -11,16 +11,15 @@ use kawari::packet::{ send_packet, }; use kawari::world::ipc::{ - ClientZoneIpcData, CommonSpawn, ContainerInfo, ContainerType, DisplayFlag, - GameMasterCommandType, GameMasterRank, ItemInfo, ObjectKind, OnlineStatus, PlayerSubKind, - ServerZoneIpcData, ServerZoneIpcSegment, ServerZoneIpcType, SocialListRequestType, - StatusEffect, + ClientZoneIpcData, CommonSpawn, DisplayFlag, GameMasterCommandType, GameMasterRank, ObjectKind, + OnlineStatus, PlayerSubKind, ServerZoneIpcData, ServerZoneIpcSegment, ServerZoneIpcType, + SocialListRequestType, StatusEffect, }; use kawari::world::{ ChatHandler, Inventory, Zone, ZoneConnection, ipc::{ - ActorControl, ActorControlCategory, ActorControlSelf, PlayerEntry, PlayerSetup, - PlayerSpawn, PlayerStats, SocialList, + ActorControlCategory, ActorControlSelf, PlayerEntry, PlayerSetup, PlayerSpawn, PlayerStats, + SocialList, }, }; use kawari::world::{PlayerData, WorldDatabase}; @@ -781,7 +780,7 @@ async fn main() { "creating character from: {name} {chara_make_json}" ); - let chara_make = CharaMake::from_json(&chara_make_json); + let chara_make = CharaMake::from_json(chara_make_json); let city_state = get_citystate(chara_make.classjob_id as u16); diff --git a/src/lib.rs b/src/lib.rs index 313c96b..9a17106 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,7 @@ //! A server replacement for a certain MMO. +#![allow(clippy::large_enum_variant)] + use std::collections::HashMap; use minijinja::Environment; diff --git a/src/login/database.rs b/src/login/database.rs index 04b2974..56bd2c4 100644 --- a/src/login/database.rs +++ b/src/login/database.rs @@ -14,6 +14,12 @@ pub enum LoginError { InternalError, } +impl Default for LoginDatabase { + fn default() -> Self { + Self::new() + } +} + impl LoginDatabase { pub fn new() -> Self { let connection = Connection::open("login.db").expect("Failed to open database!"); diff --git a/src/packet/mod.rs b/src/packet/mod.rs index dedb8cd..41d80b7 100644 --- a/src/packet/mod.rs +++ b/src/packet/mod.rs @@ -1,6 +1,6 @@ -mod packet; -use packet::PacketHeader; -pub use packet::{ +mod parsing; +use parsing::PacketHeader; +pub use parsing::{ ConnectionType, PacketSegment, PacketState, SegmentType, parse_packet, send_keep_alive, send_packet, }; diff --git a/src/packet/packet.rs b/src/packet/parsing.rs similarity index 100% rename from src/packet/packet.rs rename to src/packet/parsing.rs diff --git a/src/world/chat_handler.rs b/src/world/chat_handler.rs index c611cb6..6f07abd 100644 --- a/src/world/chat_handler.rs +++ b/src/world/chat_handler.rs @@ -1,11 +1,11 @@ use crate::{ - common::{CustomizeData, INVALID_OBJECT_ID, ObjectId, ObjectTypeId, Position, timestamp_secs}, + common::{CustomizeData, ObjectId, ObjectTypeId, Position, timestamp_secs}, config::get_config, packet::{PacketSegment, SegmentType}, world::ipc::{ ActorControl, ActorControlCategory, BattleNpcSubKind, CommonSpawn, DisplayFlag, NpcSpawn, ObjectKind, PlayerSpawn, PlayerSubKind, ServerZoneIpcData, ServerZoneIpcSegment, - ServerZoneIpcType, StatusEffectList, + ServerZoneIpcType, }, }; @@ -135,7 +135,6 @@ impl ChatHandler { warp_finish_anim: 0x0, raise_anim: 0x0, }, - ..Default::default() }), }; diff --git a/src/world/connection.rs b/src/world/connection.rs index 5d2c6c6..34e1176 100644 --- a/src/world/connection.rs +++ b/src/world/connection.rs @@ -174,7 +174,7 @@ impl ZoneConnection { pub async fn send_inventory(&mut self) { // item list { - let equipped = self.inventory.equipped.clone(); + let equipped = self.inventory.equipped; let mut send_slot = async |slot_index: u16, item: &Item| { let ipc = ServerZoneIpcSegment { diff --git a/src/world/database.rs b/src/world/database.rs index f49b610..b866ed2 100644 --- a/src/world/database.rs +++ b/src/world/database.rs @@ -21,6 +21,12 @@ pub struct CharacterData { pub zone_id: u16, } +impl Default for WorldDatabase { + fn default() -> Self { + Self::new() + } +} + impl WorldDatabase { pub fn new() -> Self { let connection = Connection::open("world.db").expect("Failed to open database!"); diff --git a/src/world/inventory.rs b/src/world/inventory.rs index 200f63e..353d8d4 100644 --- a/src/world/inventory.rs +++ b/src/world/inventory.rs @@ -56,6 +56,12 @@ pub struct Inventory { pub equipped: EquippedContainer, } +impl Default for Inventory { + fn default() -> Self { + Self::new() + } +} + impl Inventory { pub fn new() -> Self { Self { diff --git a/src/world/ipc/common_spawn.rs b/src/world/ipc/common_spawn.rs index 79e5601..52c7c2a 100644 --- a/src/world/ipc/common_spawn.rs +++ b/src/world/ipc/common_spawn.rs @@ -3,8 +3,8 @@ use binrw::binrw; use bitflags::bitflags; use crate::common::{ - CHAR_NAME_MAX_LENGTH, CustomizeData, INVALID_OBJECT_ID, ObjectId, ObjectTypeId, Position, - read_string, write_string, + CHAR_NAME_MAX_LENGTH, CustomizeData, ObjectId, ObjectTypeId, Position, read_string, + write_string, }; use super::StatusEffect;