move characterclass/sectionid to libpso
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
bdc5a5ae89
commit
f10406232f
@ -42,7 +42,7 @@ patch_server = { path = "./src/patch_server" }
|
||||
login_server = { path = "./src/login_server" }
|
||||
ship_server = { path = "./src/ship_server" }
|
||||
|
||||
libpso = { git = "http://git.sharnoth.com/jake/libpso", rev="90246b6" }
|
||||
libpso = { git = "http://git.sharnoth.com/jake/libpso", rev="fb898e3" }
|
||||
|
||||
async-std = { version = "1.9.0", features = ["unstable", "attributes"] }
|
||||
futures = "0.3.5"
|
||||
|
@ -9,6 +9,8 @@ entity = { workspace = true }
|
||||
maps = { workspace = true }
|
||||
stats = { workspace = true }
|
||||
|
||||
libpso = { workspace = true }
|
||||
|
||||
rand = { workspace = true }
|
||||
rand_chacha = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
@ -2,7 +2,7 @@
|
||||
use rand::{Rng};
|
||||
use rand::distributions::{WeightedIndex, Distribution};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use maps::room::{Difficulty, Episode};
|
||||
use maps::area::MapArea;
|
||||
use crate::{ItemDropType, load_data_file};
|
||||
|
@ -3,7 +3,7 @@ use serde::{Serialize, Deserialize};
|
||||
use rand::Rng;
|
||||
use rand::distributions::{WeightedIndex, Distribution};
|
||||
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use entity::item::armor::{ArmorType, Armor};
|
||||
use maps::room::{Difficulty, Episode};
|
||||
use maps::area::MapArea;
|
||||
|
@ -4,7 +4,7 @@ use rand::Rng;
|
||||
use rand::distributions::{WeightedIndex, Distribution};
|
||||
|
||||
use entity::item::shield::{ShieldType, Shield};
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use maps::room::{Difficulty, Episode};
|
||||
use maps::area::MapArea;
|
||||
use crate::{ItemDropType, load_data_file};
|
||||
|
@ -3,7 +3,7 @@ use serde::{Serialize, Deserialize};
|
||||
use rand::Rng;
|
||||
use rand::seq::IteratorRandom;
|
||||
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use entity::item::unit::{UnitType, Unit, UnitModifier};
|
||||
use maps::room::{Difficulty, Episode};
|
||||
use maps::area::MapArea;
|
||||
|
@ -4,7 +4,7 @@ use rand::Rng;
|
||||
use rand::distributions::{WeightedIndex, Distribution};
|
||||
use rand::seq::SliceRandom;
|
||||
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use entity::item::weapon::{Weapon, WeaponType, Attribute, WeaponAttribute, WeaponSpecial};
|
||||
use maps::room::{Difficulty, Episode};
|
||||
use maps::area::MapArea;
|
||||
|
@ -24,7 +24,7 @@ use rand::{Rng, SeedableRng};
|
||||
use maps::monster::MonsterType;
|
||||
use maps::room::{Difficulty, Episode};
|
||||
use maps::area::MapArea;
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use crate::generic_weapon::GenericWeaponTable;
|
||||
use crate::generic_armor::GenericArmorTable;
|
||||
use crate::generic_shield::GenericShieldTable;
|
||||
|
@ -7,7 +7,7 @@ use entity::item::shield::{Shield, ShieldType};
|
||||
use entity::item::unit::{Unit, UnitType};
|
||||
use entity::item::tool::{Tool, ToolType};
|
||||
use entity::item::mag::{Mag, MagType};
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use maps::monster::MonsterType;
|
||||
use maps::room::{Difficulty, Episode};
|
||||
use maps::area::MapArea;
|
||||
|
@ -6,7 +6,7 @@ use rand::distributions::{WeightedIndex, Distribution};
|
||||
use entity::item::tech::{Technique, TechniqueDisk};
|
||||
use maps::room::{Difficulty, Episode};
|
||||
use maps::area::MapArea;
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use crate::{ItemDropType, load_data_file};
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ use rand::distributions::{WeightedIndex, Distribution};
|
||||
use entity::item::tool::{Tool, ToolType};
|
||||
use maps::room::{Difficulty, Episode};
|
||||
use maps::area::MapArea;
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use crate::{ItemDropType, load_data_file};
|
||||
use crate::tech_table::TechniqueTable;
|
||||
|
||||
|
@ -3,144 +3,11 @@ use std::collections::HashMap;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use libpso::packet::ship::{UpdateConfig, WriteInfoboard};
|
||||
use libpso::character::{CharacterClass, SectionID};
|
||||
use libpso::character::settings::{DEFAULT_PALETTE_CONFIG, DEFAULT_TECH_MENU};
|
||||
use crate::item::tech::Technique;
|
||||
use crate::account::UserAccountId;
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize, Default)]
|
||||
pub enum CharacterClass {
|
||||
#[default]
|
||||
HUmar,
|
||||
HUnewearl,
|
||||
HUcast,
|
||||
HUcaseal,
|
||||
RAmar,
|
||||
RAmarl,
|
||||
RAcast,
|
||||
RAcaseal,
|
||||
FOmar,
|
||||
FOmarl,
|
||||
FOnewm,
|
||||
FOnewearl,
|
||||
}
|
||||
|
||||
// TODO: TryFrom
|
||||
impl From<u8> for CharacterClass {
|
||||
fn from(f: u8) -> CharacterClass {
|
||||
match f {
|
||||
0 => CharacterClass::HUmar,
|
||||
1 => CharacterClass::HUnewearl,
|
||||
2 => CharacterClass::HUcast,
|
||||
3 => CharacterClass::RAmar,
|
||||
4 => CharacterClass::RAcast,
|
||||
5 => CharacterClass::RAcaseal,
|
||||
6 => CharacterClass::FOmarl,
|
||||
7 => CharacterClass::FOnewm,
|
||||
8 => CharacterClass::FOnewearl,
|
||||
9 => CharacterClass::HUcaseal,
|
||||
10 => CharacterClass::FOmar,
|
||||
11 => CharacterClass::RAmarl,
|
||||
_ => panic!("unknown class")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CharacterClass> for u8 {
|
||||
fn from(other: CharacterClass) -> u8 {
|
||||
match other {
|
||||
CharacterClass::HUmar => 0,
|
||||
CharacterClass::HUnewearl => 1,
|
||||
CharacterClass::HUcast => 2,
|
||||
CharacterClass::RAmar => 3,
|
||||
CharacterClass::RAcast => 4,
|
||||
CharacterClass::RAcaseal => 5,
|
||||
CharacterClass::FOmarl => 6,
|
||||
CharacterClass::FOnewm => 7,
|
||||
CharacterClass::FOnewearl => 8,
|
||||
CharacterClass::HUcaseal => 9,
|
||||
CharacterClass::FOmar => 10,
|
||||
CharacterClass::RAmarl => 11,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CharacterClass {
|
||||
pub fn is_human(&self) -> bool {
|
||||
matches!(self,
|
||||
CharacterClass::HUmar |
|
||||
CharacterClass::RAmar |
|
||||
CharacterClass::RAmarl |
|
||||
CharacterClass::FOmar |
|
||||
CharacterClass::FOmarl)
|
||||
}
|
||||
|
||||
pub fn is_newman(&self) -> bool {
|
||||
matches!(self,
|
||||
CharacterClass::HUnewearl |
|
||||
CharacterClass::FOnewm |
|
||||
CharacterClass::FOnewearl)
|
||||
}
|
||||
|
||||
pub fn is_android(&self) -> bool {
|
||||
matches!(self,
|
||||
CharacterClass::HUcast |
|
||||
CharacterClass::HUcaseal |
|
||||
CharacterClass::RAcast |
|
||||
CharacterClass::RAcaseal)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize, Default)]
|
||||
pub enum SectionID {
|
||||
#[default]
|
||||
Viridia,
|
||||
Greenill,
|
||||
Skyly,
|
||||
Bluefull,
|
||||
Purplenum,
|
||||
Pinkal,
|
||||
Redria,
|
||||
Oran,
|
||||
Yellowboze,
|
||||
Whitill,
|
||||
}
|
||||
|
||||
impl From<u8> for SectionID {
|
||||
fn from(id: u8) -> SectionID {
|
||||
match id {
|
||||
0 => SectionID::Viridia,
|
||||
1 => SectionID::Greenill,
|
||||
2 => SectionID::Skyly,
|
||||
3 => SectionID::Bluefull,
|
||||
4 => SectionID::Purplenum,
|
||||
5 => SectionID::Pinkal,
|
||||
6 => SectionID::Redria,
|
||||
7 => SectionID::Oran,
|
||||
8 => SectionID::Yellowboze,
|
||||
9 => SectionID::Whitill,
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SectionID> for u8 {
|
||||
fn from(other: SectionID) -> u8 {
|
||||
match other {
|
||||
SectionID::Viridia => 0,
|
||||
SectionID::Greenill => 1,
|
||||
SectionID::Skyly => 2,
|
||||
SectionID::Bluefull => 3,
|
||||
SectionID::Purplenum => 4,
|
||||
SectionID::Pinkal => 5,
|
||||
SectionID::Redria => 6,
|
||||
SectionID::Oran => 7,
|
||||
SectionID::Yellowboze => 8,
|
||||
SectionID::Whitill => 9,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct CharacterAppearance {
|
||||
|
@ -6,6 +6,7 @@ use libpso::character::settings;
|
||||
use libpso::util::vec_to_array;
|
||||
use crate::account::*;
|
||||
use crate::character::*;
|
||||
use libpso::character::{CharacterClass, SectionID};
|
||||
use crate::item::*;
|
||||
use crate::room::*;
|
||||
use maps::area::MapArea;
|
||||
|
@ -1,8 +1,8 @@
|
||||
use std::collections::HashMap;
|
||||
use thiserror::Error;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use libpso::character::{CharacterClass, SectionID};
|
||||
use crate::item::tool::ToolType;
|
||||
use crate::character::{CharacterClass, SectionID};
|
||||
use crate::item::ItemEntityId;
|
||||
use std::io::Read;
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
|
||||
use crate::character::{CharacterEntityId, SectionID};
|
||||
use crate::character::CharacterEntityId;
|
||||
use libpso::character::SectionID;
|
||||
use maps::room::{Episode, Difficulty};
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@ use libpso::packet::ship::{MenuDetail, SmallLeftDialog};
|
||||
use libpso::{PacketParseError, PSOPacket};
|
||||
use libpso::crypto::bb::PSOBBCipher;
|
||||
use libpso::character::character;
|
||||
use libpso::character::CharacterClass;
|
||||
use entity::item;
|
||||
|
||||
use networking::cipherkeys::{ELSEWHERE_PRIVATE_KEY, ELSEWHERE_PARRAY};
|
||||
@ -29,7 +30,7 @@ use entity::item::armor::Armor;
|
||||
use entity::item::tech::Technique;
|
||||
use entity::item::tool::Tool;
|
||||
use entity::item::mag::Mag;
|
||||
use entity::character::{CharacterEntity, NewCharacterEntity, CharacterClass, TechLevel};
|
||||
use entity::character::{CharacterEntity, NewCharacterEntity, TechLevel};
|
||||
|
||||
use crate::login::get_login_status;
|
||||
use networking::interserver::AuthToken;
|
||||
|
@ -10,6 +10,8 @@ quests = { workspace = true }
|
||||
location = { workspace = true }
|
||||
drops = { workspace = true }
|
||||
|
||||
libpso = { workspace = true }
|
||||
|
||||
rand = { workspace = true }
|
||||
async-std = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
|
@ -10,7 +10,7 @@ use rand::Rng;
|
||||
use quests::{QuestList, QuestLoadError};
|
||||
use maps::maps::Maps;
|
||||
use drops::DropTable;
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use entity::room::{RoomEntityId, RoomEntityMode};
|
||||
use maps::monster::{load_monster_stats_table, MonsterType, MonsterStats};
|
||||
use maps::area::MapAreaLookup;
|
||||
|
@ -30,7 +30,7 @@ use networking::serverstate::{SendServerPacket, RecvServerPacket, ServerState, O
|
||||
use networking::interserver::{AuthToken, Ship, ServerId, InterserverActor, LoginMessage, ShipMessage};
|
||||
use pktbuilder::ship::SHIP_MENU_ID;
|
||||
use entity::gateway::{EntityGateway, GatewayError};
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use entity::room::RoomNote;
|
||||
use location::{ClientLocation, RoomLobby, ClientLocationError, RoomId};
|
||||
use drops::{DropTable, StandardDropTable};
|
||||
|
@ -8,7 +8,7 @@ use libpso::packet::messages::*;
|
||||
use networking::serverstate::ClientId;
|
||||
use stats::leveltable::LEVEL_TABLE;
|
||||
use entity::gateway::EntityGateway;
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use entity::room::{NewRoomEntity, RoomEntityMode, RoomNote};
|
||||
use drops::DropTable;
|
||||
use crate::SendShipPacket;
|
||||
|
@ -8,6 +8,8 @@ maps = { workspace = true }
|
||||
stats = { workspace = true }
|
||||
entity = { workspace = true }
|
||||
|
||||
libpso = { workspace = true }
|
||||
|
||||
async-std = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
|
@ -7,7 +7,7 @@ use futures::future::OptionFuture;
|
||||
use std::collections::HashMap;
|
||||
use entity::item::ItemDetail;
|
||||
use maps::room::Difficulty;
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
|
||||
pub use weapon::{WeaponShop, WeaponShopItem};
|
||||
pub use tool::{ToolShop, ToolShopItem};
|
||||
|
@ -8,7 +8,7 @@ use serde::Deserialize;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use rand::distributions::{WeightedIndex, Distribution};
|
||||
use rand::seq::{SliceRandom, IteratorRandom};
|
||||
use entity::character::SectionID;
|
||||
use libpso::character::SectionID;
|
||||
use maps::room::Difficulty;
|
||||
use entity::item::ItemDetail;
|
||||
use entity::item::weapon::{Weapon, WeaponType, WeaponSpecial, Attribute, WeaponAttribute};
|
||||
|
@ -4,6 +4,7 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
libpso = { workspace = true }
|
||||
entity = { workspace = true }
|
||||
toml = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::fs::File;
|
||||
use serde_json::Value;
|
||||
use entity::character::CharacterClass;
|
||||
use libpso::character::CharacterClass;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub static LEVEL_TABLE: LazyLock<CharacterLevelTable> = LazyLock::new(CharacterLevelTable::default);
|
||||
|
@ -3,7 +3,8 @@
|
||||
use networking::serverstate::{ClientId, ServerState};
|
||||
use entity::gateway::EntityGateway;
|
||||
use entity::account::{UserAccountEntity, NewUserAccountEntity, NewUserSettingsEntity};
|
||||
use entity::character::{CharacterEntity, NewCharacterEntity, SectionID};
|
||||
use entity::character::{CharacterEntity, NewCharacterEntity};
|
||||
use libpso::character::SectionID;
|
||||
use entity::item::{Meseta, BankIdentifier};
|
||||
use ship_server::{ShipServerState, ShipServerStateBuilder, RecvShipPacket};
|
||||
use maps::room::{RoomMode, Difficulty, Episode};
|
||||
|
@ -2,7 +2,7 @@ use networking::serverstate::{ClientId, ServerState};
|
||||
use entity::gateway::{EntityGateway, InMemoryGateway};
|
||||
use entity::item;
|
||||
use ship_server::RecvShipPacket;
|
||||
use entity::character::{CharacterClass, SectionID};
|
||||
use libpso::character::{CharacterClass, SectionID};
|
||||
|
||||
use libpso::packet::ship::*;
|
||||
use libpso::packet::messages::*;
|
||||
|
Loading…
x
Reference in New Issue
Block a user