diff --git a/Cargo.toml b/Cargo.toml index 3e3c47b..0ea2e3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,8 @@ members = [ "entity", "maps", "networking", + "shops", + "stats", ] [workspace.dependencies] @@ -16,6 +18,8 @@ libpso = { git = "http://git.sharnoth.com/jake/libpso" } entity = { path = "./entity" } maps = { path = "./maps" } networking = { path = "./networking" } +shops = { path = "./shops" } +stats = { path = "./stats" } async-std = { version = "1.9.0", features = ["unstable", "attributes"] } futures = "0.3.5" rand = "0.7.3" @@ -49,6 +53,8 @@ libpso = { git = "http://git.sharnoth.com/jake/libpso" } entity = { path = "./entity" } maps = { path = "./maps" } networking = { path = "./networking" } +shops = { path = "./shops" } +stats = { path = "./stats" } async-std = { version = "1.9.0", features = ["unstable", "attributes"] } futures = "0.3.5" rand = "0.7.3" diff --git a/shops/Cargo.toml b/shops/Cargo.toml new file mode 100644 index 0000000..495bf2f --- /dev/null +++ b/shops/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "shops" +version = "0.1.0" +edition = "2021" + +[dependencies] +maps = { workspace = true } +stats = { workspace = true } +entity = { workspace = true } + +rand = { workspace = true } +toml = { workspace = true } +serde = { workspace = true } \ No newline at end of file diff --git a/src/ship/shops/armor.rs b/shops/src/armor.rs similarity index 98% rename from src/ship/shops/armor.rs rename to shops/src/armor.rs index 557856e..f424877 100644 --- a/src/ship/shops/armor.rs +++ b/shops/src/armor.rs @@ -9,8 +9,8 @@ use entity::item::ItemDetail; use entity::item::armor::{Armor, ArmorType}; use entity::item::shield::{Shield, ShieldType}; use entity::item::unit::{Unit, UnitType}; -use crate::ship::shops::ShopItem; -use crate::ship::item_stats::{ARMOR_STATS, SHIELD_STATS, UNIT_STATS}; +use crate::ShopItem; +use stats::items::{ARMOR_STATS, SHIELD_STATS, UNIT_STATS}; // #[derive(Debug)] // pub enum ArmorShopItem { diff --git a/src/ship/shops/mod.rs b/shops/src/lib.rs similarity index 100% rename from src/ship/shops/mod.rs rename to shops/src/lib.rs diff --git a/src/ship/shops/tool.rs b/shops/src/tool.rs similarity index 98% rename from src/ship/shops/tool.rs rename to shops/src/tool.rs index 9691456..b068d19 100644 --- a/src/ship/shops/tool.rs +++ b/shops/src/tool.rs @@ -9,8 +9,8 @@ use rand::distributions::{WeightedIndex, Distribution}; use entity::item::ItemDetail; use entity::item::tool::{Tool, ToolType}; use entity::item::tech::{Technique, TechniqueDisk}; -use crate::ship::shops::ShopItem; -use crate::ship::item_stats::{TOOL_STATS, TECH_STATS}; +use crate::ShopItem; +use stats::items::{TOOL_STATS, TECH_STATS}; #[derive(Debug, PartialEq, Eq)] diff --git a/src/ship/shops/weapon.rs b/shops/src/weapon.rs similarity index 99% rename from src/ship/shops/weapon.rs rename to shops/src/weapon.rs index 699b76a..06a8c1e 100644 --- a/src/ship/shops/weapon.rs +++ b/shops/src/weapon.rs @@ -12,8 +12,8 @@ use entity::character::SectionID; use maps::room::Difficulty; use entity::item::ItemDetail; use entity::item::weapon::{Weapon, WeaponType, WeaponSpecial, Attribute, WeaponAttribute}; -use crate::ship::shops::ShopItem; -use crate::ship::item_stats::WEAPON_STATS; +use crate::ShopItem; +use stats::items::WEAPON_STATS; const TIER1_SPECIAL: [WeaponSpecial; 8] = [WeaponSpecial::Draw, WeaponSpecial::Heart, WeaponSpecial::Ice, WeaponSpecial::Bind, diff --git a/src/ship/client.rs b/src/ship/client.rs index 58f75f7..abdf6ea 100644 --- a/src/ship/client.rs +++ b/src/ship/client.rs @@ -14,7 +14,7 @@ use entity::item; use crate::ship::ship::ShipError; use crate::ship::items; use maps::area::MapArea; -use crate::ship::shops::{WeaponShopItem, ToolShopItem, ArmorShopItem}; +use shops::{WeaponShopItem, ToolShopItem, ArmorShopItem}; #[derive(Clone, Default)] diff --git a/src/ship/drops/generic_armor.rs b/src/ship/drops/generic_armor.rs index 6c70934..4fa2667 100644 --- a/src/ship/drops/generic_armor.rs +++ b/src/ship/drops/generic_armor.rs @@ -8,7 +8,7 @@ use entity::item::armor::{ArmorType, Armor}; use maps::room::{Difficulty, Episode}; use maps::area::MapArea; use crate::ship::drops::{ItemDropType, load_data_file}; -use crate::ship::item_stats::{armor_stats, ArmorStats}; +use stats::items::{armor_stats, ArmorStats}; #[derive(Debug, Serialize, Deserialize)] diff --git a/src/ship/drops/generic_shield.rs b/src/ship/drops/generic_shield.rs index 3ca20c9..bed92a6 100644 --- a/src/ship/drops/generic_shield.rs +++ b/src/ship/drops/generic_shield.rs @@ -8,7 +8,7 @@ use entity::character::SectionID; use maps::room::{Difficulty, Episode}; use maps::area::MapArea; use crate::ship::drops::{ItemDropType, load_data_file}; -use crate::ship::item_stats::{shield_stats, ShieldStats}; +use stats::items::{shield_stats, ShieldStats}; #[derive(Debug, Serialize, Deserialize)] diff --git a/src/ship/drops/generic_unit.rs b/src/ship/drops/generic_unit.rs index 137f7d0..a5e1da5 100644 --- a/src/ship/drops/generic_unit.rs +++ b/src/ship/drops/generic_unit.rs @@ -8,7 +8,7 @@ use entity::item::unit::{UnitType, Unit, UnitModifier}; use maps::room::{Difficulty, Episode}; use maps::area::MapArea; use crate::ship::drops::{ItemDropType, load_data_file}; -use crate::ship::item_stats::{unit_stats, UnitStats}; +use stats::items::{unit_stats, UnitStats}; diff --git a/src/ship/items/actions.rs b/src/ship/items/actions.rs index 2359950..f5f93f0 100644 --- a/src/ship/items/actions.rs +++ b/src/ship/items/actions.rs @@ -21,7 +21,7 @@ use crate::ship::items::bank::{BankItem, BankItemDetail}; use crate::ship::items::inventory::{InventoryItem, InventoryItemDetail}; use crate::ship::items::floor::{FloorItem, FloorItemDetail}; use crate::ship::items::apply_item::{apply_item, ApplyItemAction}; -use crate::ship::shops::ShopItem; +use shops::ShopItem; use crate::ship::drops::{ItemDrop, ItemDropType}; use crate::ship::packet::builder; use crate::ship::location::AreaClient; diff --git a/src/ship/items/inventory.rs b/src/ship/items/inventory.rs index ca0e51d..e30eb93 100644 --- a/src/ship/items/inventory.rs +++ b/src/ship/items/inventory.rs @@ -9,7 +9,7 @@ use entity::character::CharacterEntityId; use entity::item::tool::ToolType; use entity::item::mag::Mag; use entity::item::weapon::Weapon; -use crate::ship::shops::{ShopItem, ArmorShopItem, ToolShopItem, WeaponShopItem}; +use shops::{ShopItem, ArmorShopItem, ToolShopItem, WeaponShopItem}; use crate::ship::items::state::ItemStateError; use crate::ship::items::state::{IndividualItemDetail, StackedItemDetail, AddItemResult}; use crate::ship::items::floor::{FloorItem, FloorItemDetail}; diff --git a/src/ship/items/tasks.rs b/src/ship/items/tasks.rs index f224f4c..d4910a1 100644 --- a/src/ship/items/tasks.rs +++ b/src/ship/items/tasks.rs @@ -12,7 +12,7 @@ use crate::ship::items::state::{ItemState, ItemStateProxy, IndividualItemDetail} use crate::ship::items::itemstateaction::{ItemStateAction, ItemAction}; use crate::ship::items::inventory::InventoryItem; use crate::ship::items::floor::FloorItem; -use crate::ship::shops::ShopItem; +use shops::ShopItem; use crate::ship::trade::TradeItem; use crate::ship::location::AreaClient; use crate::ship::drops::ItemDrop; diff --git a/src/ship/mod.rs b/src/ship/mod.rs index 3978099..d769c38 100644 --- a/src/ship/mod.rs +++ b/src/ship/mod.rs @@ -5,12 +5,12 @@ pub mod character; pub mod client; pub mod room; pub mod items; -pub mod item_stats; +//pub mod item_stats; //pub mod map; //pub mod monster; pub mod drops; pub mod packet; pub mod quests; -pub mod shops; +//pub mod shops; pub mod trade; pub mod chatcommand; diff --git a/src/ship/packet/builder/message.rs b/src/ship/packet/builder/message.rs index f83ebbd..85bc90b 100644 --- a/src/ship/packet/builder/message.rs +++ b/src/ship/packet/builder/message.rs @@ -10,7 +10,7 @@ use crate::ship::items::bank::BankState; use crate::ship::items::floor::FloorItem; use crate::ship::location::AreaClient; use std::convert::TryInto; -use crate::ship::shops::ShopItem; +use shops::ShopItem; pub fn item_drop(client: u8, target: u8, item_drop: &FloorItem) -> Result { diff --git a/src/ship/packet/handler/direct_message.rs b/src/ship/packet/handler/direct_message.rs index 0886f79..c43efc9 100644 --- a/src/ship/packet/handler/direct_message.rs +++ b/src/ship/packet/handler/direct_message.rs @@ -14,7 +14,7 @@ use entity::gateway::EntityGateway; use entity::item; use libpso::utf8_to_utf16_array; use crate::ship::packet::builder; -use crate::ship::shops::{ShopItem, ToolShopItem, ArmorShopItem}; +use shops::{ShopItem, ToolShopItem, ArmorShopItem}; use crate::ship::items::state::{ItemState, ItemStateError}; use crate::ship::items::floor::{FloorType, FloorItemDetail}; use crate::ship::items::actions::TriggerCreateItem; diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 7e6293d..a384555 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -29,7 +29,7 @@ use maps::area::MapAreaError; use maps::maps::{Maps, MapsError, generate_free_roam_maps}; use maps::enemy::RareEnemyEvent; use crate::ship::packet::handler; -use crate::ship::shops::{WeaponShop, ToolShop, ArmorShop}; +use shops::{WeaponShop, ToolShop, ArmorShop}; use crate::ship::trade::TradeState; use crate::ship::chatcommand; diff --git a/stats/Cargo.toml b/stats/Cargo.toml new file mode 100644 index 0000000..e1d5801 --- /dev/null +++ b/stats/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "stats" +version = "0.1.0" +edition = "2021" + +[dependencies] +entity = { workspace = true } +toml = { workspace = true } +serde = { workspace = true } +lazy_static = { workspace = true } diff --git a/src/ship/item_stats.rs b/stats/src/items.rs similarity index 100% rename from src/ship/item_stats.rs rename to stats/src/items.rs diff --git a/stats/src/lib.rs b/stats/src/lib.rs new file mode 100644 index 0000000..339b22d --- /dev/null +++ b/stats/src/lib.rs @@ -0,0 +1 @@ +pub mod items;