Browse Source

crates for shops and stats

pull/135/head
jake 1 year ago
committed by andy
parent
commit
7020f38863
  1. 6
      Cargo.toml
  2. 13
      shops/Cargo.toml
  3. 4
      shops/src/armor.rs
  4. 0
      shops/src/lib.rs
  5. 4
      shops/src/tool.rs
  6. 4
      shops/src/weapon.rs
  7. 2
      src/ship/client.rs
  8. 2
      src/ship/drops/generic_armor.rs
  9. 2
      src/ship/drops/generic_shield.rs
  10. 2
      src/ship/drops/generic_unit.rs
  11. 2
      src/ship/items/actions.rs
  12. 2
      src/ship/items/inventory.rs
  13. 2
      src/ship/items/tasks.rs
  14. 4
      src/ship/mod.rs
  15. 2
      src/ship/packet/builder/message.rs
  16. 2
      src/ship/packet/handler/direct_message.rs
  17. 2
      src/ship/ship.rs
  18. 10
      stats/Cargo.toml
  19. 0
      stats/src/items.rs
  20. 1
      stats/src/lib.rs

6
Cargo.toml

@ -9,6 +9,8 @@ members = [
"entity", "entity",
"maps", "maps",
"networking", "networking",
"shops",
"stats",
] ]
[workspace.dependencies] [workspace.dependencies]
@ -16,6 +18,8 @@ libpso = { git = "http://git.sharnoth.com/jake/libpso" }
entity = { path = "./entity" } entity = { path = "./entity" }
maps = { path = "./maps" } maps = { path = "./maps" }
networking = { path = "./networking" } networking = { path = "./networking" }
shops = { path = "./shops" }
stats = { path = "./stats" }
async-std = { version = "1.9.0", features = ["unstable", "attributes"] } async-std = { version = "1.9.0", features = ["unstable", "attributes"] }
futures = "0.3.5" futures = "0.3.5"
rand = "0.7.3" rand = "0.7.3"
@ -49,6 +53,8 @@ libpso = { git = "http://git.sharnoth.com/jake/libpso" }
entity = { path = "./entity" } entity = { path = "./entity" }
maps = { path = "./maps" } maps = { path = "./maps" }
networking = { path = "./networking" } networking = { path = "./networking" }
shops = { path = "./shops" }
stats = { path = "./stats" }
async-std = { version = "1.9.0", features = ["unstable", "attributes"] } async-std = { version = "1.9.0", features = ["unstable", "attributes"] }
futures = "0.3.5" futures = "0.3.5"
rand = "0.7.3" rand = "0.7.3"

13
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 }

4
src/ship/shops/armor.rs → shops/src/armor.rs

@ -9,8 +9,8 @@ use entity::item::ItemDetail;
use entity::item::armor::{Armor, ArmorType}; use entity::item::armor::{Armor, ArmorType};
use entity::item::shield::{Shield, ShieldType}; use entity::item::shield::{Shield, ShieldType};
use entity::item::unit::{Unit, UnitType}; 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)] // #[derive(Debug)]
// pub enum ArmorShopItem { // pub enum ArmorShopItem {

0
src/ship/shops/mod.rs → shops/src/lib.rs

4
src/ship/shops/tool.rs → shops/src/tool.rs

@ -9,8 +9,8 @@ use rand::distributions::{WeightedIndex, Distribution};
use entity::item::ItemDetail; use entity::item::ItemDetail;
use entity::item::tool::{Tool, ToolType}; use entity::item::tool::{Tool, ToolType};
use entity::item::tech::{Technique, TechniqueDisk}; 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)] #[derive(Debug, PartialEq, Eq)]

4
src/ship/shops/weapon.rs → shops/src/weapon.rs

@ -12,8 +12,8 @@ use entity::character::SectionID;
use maps::room::Difficulty; use maps::room::Difficulty;
use entity::item::ItemDetail; use entity::item::ItemDetail;
use entity::item::weapon::{Weapon, WeaponType, WeaponSpecial, Attribute, WeaponAttribute}; 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, const TIER1_SPECIAL: [WeaponSpecial; 8] = [WeaponSpecial::Draw, WeaponSpecial::Heart, WeaponSpecial::Ice, WeaponSpecial::Bind,

2
src/ship/client.rs

@ -14,7 +14,7 @@ use entity::item;
use crate::ship::ship::ShipError; use crate::ship::ship::ShipError;
use crate::ship::items; use crate::ship::items;
use maps::area::MapArea; use maps::area::MapArea;
use crate::ship::shops::{WeaponShopItem, ToolShopItem, ArmorShopItem};
use shops::{WeaponShopItem, ToolShopItem, ArmorShopItem};
#[derive(Clone, Default)] #[derive(Clone, Default)]

2
src/ship/drops/generic_armor.rs

@ -8,7 +8,7 @@ use entity::item::armor::{ArmorType, Armor};
use maps::room::{Difficulty, Episode}; use maps::room::{Difficulty, Episode};
use maps::area::MapArea; use maps::area::MapArea;
use crate::ship::drops::{ItemDropType, load_data_file}; 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)] #[derive(Debug, Serialize, Deserialize)]

2
src/ship/drops/generic_shield.rs

@ -8,7 +8,7 @@ use entity::character::SectionID;
use maps::room::{Difficulty, Episode}; use maps::room::{Difficulty, Episode};
use maps::area::MapArea; use maps::area::MapArea;
use crate::ship::drops::{ItemDropType, load_data_file}; 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)] #[derive(Debug, Serialize, Deserialize)]

2
src/ship/drops/generic_unit.rs

@ -8,7 +8,7 @@ use entity::item::unit::{UnitType, Unit, UnitModifier};
use maps::room::{Difficulty, Episode}; use maps::room::{Difficulty, Episode};
use maps::area::MapArea; use maps::area::MapArea;
use crate::ship::drops::{ItemDropType, load_data_file}; use crate::ship::drops::{ItemDropType, load_data_file};
use crate::ship::item_stats::{unit_stats, UnitStats};
use stats::items::{unit_stats, UnitStats};

2
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::inventory::{InventoryItem, InventoryItemDetail};
use crate::ship::items::floor::{FloorItem, FloorItemDetail}; use crate::ship::items::floor::{FloorItem, FloorItemDetail};
use crate::ship::items::apply_item::{apply_item, ApplyItemAction}; 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::drops::{ItemDrop, ItemDropType};
use crate::ship::packet::builder; use crate::ship::packet::builder;
use crate::ship::location::AreaClient; use crate::ship::location::AreaClient;

2
src/ship/items/inventory.rs

@ -9,7 +9,7 @@ use entity::character::CharacterEntityId;
use entity::item::tool::ToolType; use entity::item::tool::ToolType;
use entity::item::mag::Mag; use entity::item::mag::Mag;
use entity::item::weapon::Weapon; 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::ItemStateError;
use crate::ship::items::state::{IndividualItemDetail, StackedItemDetail, AddItemResult}; use crate::ship::items::state::{IndividualItemDetail, StackedItemDetail, AddItemResult};
use crate::ship::items::floor::{FloorItem, FloorItemDetail}; use crate::ship::items::floor::{FloorItem, FloorItemDetail};

2
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::itemstateaction::{ItemStateAction, ItemAction};
use crate::ship::items::inventory::InventoryItem; use crate::ship::items::inventory::InventoryItem;
use crate::ship::items::floor::FloorItem; use crate::ship::items::floor::FloorItem;
use crate::ship::shops::ShopItem;
use shops::ShopItem;
use crate::ship::trade::TradeItem; use crate::ship::trade::TradeItem;
use crate::ship::location::AreaClient; use crate::ship::location::AreaClient;
use crate::ship::drops::ItemDrop; use crate::ship::drops::ItemDrop;

4
src/ship/mod.rs

@ -5,12 +5,12 @@ pub mod character;
pub mod client; pub mod client;
pub mod room; pub mod room;
pub mod items; pub mod items;
pub mod item_stats;
//pub mod item_stats;
//pub mod map; //pub mod map;
//pub mod monster; //pub mod monster;
pub mod drops; pub mod drops;
pub mod packet; pub mod packet;
pub mod quests; pub mod quests;
pub mod shops;
//pub mod shops;
pub mod trade; pub mod trade;
pub mod chatcommand; pub mod chatcommand;

2
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::items::floor::FloorItem;
use crate::ship::location::AreaClient; use crate::ship::location::AreaClient;
use std::convert::TryInto; use std::convert::TryInto;
use crate::ship::shops::ShopItem;
use shops::ShopItem;
pub fn item_drop(client: u8, target: u8, item_drop: &FloorItem) -> Result<ItemDrop, ShipError> { pub fn item_drop(client: u8, target: u8, item_drop: &FloorItem) -> Result<ItemDrop, ShipError> {

2
src/ship/packet/handler/direct_message.rs

@ -14,7 +14,7 @@ use entity::gateway::EntityGateway;
use entity::item; use entity::item;
use libpso::utf8_to_utf16_array; use libpso::utf8_to_utf16_array;
use crate::ship::packet::builder; 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::state::{ItemState, ItemStateError};
use crate::ship::items::floor::{FloorType, FloorItemDetail}; use crate::ship::items::floor::{FloorType, FloorItemDetail};
use crate::ship::items::actions::TriggerCreateItem; use crate::ship::items::actions::TriggerCreateItem;

2
src/ship/ship.rs

@ -29,7 +29,7 @@ use maps::area::MapAreaError;
use maps::maps::{Maps, MapsError, generate_free_roam_maps}; use maps::maps::{Maps, MapsError, generate_free_roam_maps};
use maps::enemy::RareEnemyEvent; use maps::enemy::RareEnemyEvent;
use crate::ship::packet::handler; 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::trade::TradeState;
use crate::ship::chatcommand; use crate::ship::chatcommand;

10
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 }

0
src/ship/item_stats.rs → stats/src/items.rs

1
stats/src/lib.rs

@ -0,0 +1 @@
pub mod items;
Loading…
Cancel
Save