diff --git a/src/dbmanager/avatar_fight_prop.rs b/src/dbmanager/avatar_fight_prop.rs new file mode 100644 index 0000000..ad0b9fc --- /dev/null +++ b/src/dbmanager/avatar_fight_prop.rs @@ -0,0 +1,26 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "avatar_fight_prop")] +pub struct Model { + #[sea_orm(primary_key)] + pub guid: i64, + pub prop_id: u32, + pub value: f32, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/avatar_info.rs b/src/dbmanager/avatar_info.rs index fee1bdd..fd25f83 100644 --- a/src/dbmanager/avatar_info.rs +++ b/src/dbmanager/avatar_info.rs @@ -9,7 +9,7 @@ pub struct Model { pub uid: u32, pub character_id: u32, pub avatar_type: u8, - pub guid: u64, + pub guid: i64, pub born_time: u32, } diff --git a/src/dbmanager/avatar_prop.rs b/src/dbmanager/avatar_prop.rs new file mode 100644 index 0000000..71ebe89 --- /dev/null +++ b/src/dbmanager/avatar_prop.rs @@ -0,0 +1,26 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "avatar_prop")] +pub struct Model { + #[sea_orm(primary_key)] + pub guid: i64, + pub prop_id: u32, + pub prop_value: i64, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/avatar_team_info.rs b/src/dbmanager/avatar_team_info.rs index 3cb4140..3caf7f9 100644 --- a/src/dbmanager/avatar_team_info.rs +++ b/src/dbmanager/avatar_team_info.rs @@ -8,7 +8,7 @@ pub struct Model { #[sea_orm(primary_key)] pub uid: u32, pub team_id: u8, - pub guid: u64, + pub guid: i64, } #[derive(Copy, Clone, Debug, EnumIter)] diff --git a/src/dbmanager/database_manager.rs b/src/dbmanager/database_manager.rs index 71cef16..bfd570d 100644 --- a/src/dbmanager/database_manager.rs +++ b/src/dbmanager/database_manager.rs @@ -3,6 +3,9 @@ use std::collections::HashMap; use sea_orm::{entity::*, error::*, query::*, DbConn, FromQueryResult, Database}; use sea_orm::entity::prelude::*; +use crate::JsonManager; +use crate::server::AuthManager; +use crate::utils::IdManager; pub use super::player_info::Model as PlayerInfo; use super::player_info::Entity as PlayerInfoEntity; @@ -22,6 +25,40 @@ use super::avatar_team_info::Entity as AvatarTeamInfoEntity; pub use super::team_selection_info::Model as TeamSelectionInfo; use super::team_selection_info::Entity as TeamSelectionInfoEntity; +pub use super::player_prop::Model as PlayerProp; +use super::player_prop::Entity as PlayerPropEntity; + +pub use super::avatar_prop::Model as AvatarProp; +use super::avatar_prop::Entity as AvatarPropEntity; + +pub use super::avatar_fight_prop::Model as AvatarFightProp; +use super::avatar_fight_prop::Entity as AvatarFightPropEntity; + +pub use super::open_state::Model as OpenState; +use super::open_state::Entity as OpenStateEntity; + +/* Inventory */ +pub use super::material_info::Model as MaterialInfo; +use super::material_info::Entity as MaterialInfoEntity; + +pub use super::reliquary_info::Model as ReliquaryInfo; +use super::reliquary_info::Entity as ReliquaryInfoEntity; + +pub use super::equip_info::Model as EquipInfo; +use super::equip_info::Entity as EquipInfoEntity; + +pub use super::item_info::Model as ItemInfo; +use super::item_info::Entity as ItemInfoEntity; + +pub use super::weapon_affix_info::Model as WeaponAffixInfo; +use super::weapon_affix_info::Entity as WeaponAffixInfoEntity; + +pub use super::reliquary_prop::Model as ReliquaryProp; +use super::reliquary_prop::Entity as ReliquaryPropEntity; + +pub use super::furniture_info::Model as FurnitureInfo; +use super::furniture_info::Entity as FurnitureInfoEntity; + macro_rules! collection { // map-like ($($k:expr => $v:expr),* $(,)?) => {{ @@ -58,65 +95,91 @@ impl DatabaseManager { }; } - pub fn _get_player_info(&self, uid: u32) -> Option { + pub fn get_player_info(&self, uid: u32) -> Option { match PlayerInfoEntity::find_by_id(uid).one(&self.db).wait() { Err(_) => { println!("DB ERROR!"); None }, Ok(p_info) => p_info, } } - - pub fn get_player_info(&self, uid: u32) -> Option { +/* + pub fn _get_player_info(&self, uid: u32) -> Option { Some(PlayerInfo { uid: uid, nick_name: "Fapper".into(), - level: 56, signature: "Hello world!".into(), birthday: 0, - world_level: 8, namecard_id: 210051, finish_achievement_num: 42, tower_floor_index: 1, tower_level_index: 1, avatar_id: 10000007, }) - } + }*/ +/* + pub fn _get_player_props(&self, uid: u32) -> Option> { + Some(collection! { + //proto::PropType::PropIsSpringAutoUse as u32 => 1, + //proto::PropType::PropIsFlyable as u32 => 1, + //proto::PropType::PropIsTransferable as u32 => 1, + //proto::PropType::PropPlayerLevel as u32 => 56, + //proto::PropType::PropPlayerExp as u32 => 1337, + //proto::PropType::PropPlayerHcoin as u32 => 9001, + //proto::PropType::PropPlayerScoin as u32 => 9002, + //proto::PropType::PropPlayerWorldLevel as u32 => 8, + //proto::PropType::PropPlayerResin as u32 => 159, + //proto::PropType::PropPlayerMcoin as u32 => 9003, + //proto::PropType::PropMaxStamina as u32 => 12000, + //proto::PropType::PropCurPersistStamina as u32 => 12000, + }) + }*/ pub fn get_player_props(&self, uid: u32) -> Option> { - Some(collection! { - proto::PropType::PropIsSpringAutoUse as u32 => 1, - proto::PropType::PropIsFlyable as u32 => 1, - proto::PropType::PropIsTransferable as u32 => 1, - proto::PropType::PropPlayerLevel as u32 => 56, - proto::PropType::PropPlayerExp as u32 => 1337, - proto::PropType::PropPlayerHcoin as u32 => 9001, - proto::PropType::PropPlayerScoin as u32 => 9002, - proto::PropType::PropPlayerWorldLevel as u32 => 8, - proto::PropType::PropPlayerResin as u32 => 159, - proto::PropType::PropPlayerMcoin as u32 => 9003, - proto::PropType::PropMaxStamina as u32 => 120, - proto::PropType::PropCurPersistStamina as u32 => 120, - }) - } + let props = match PlayerPropEntity::find_by_id(uid).all(&self.db).wait() { + Err(_) => { panic!("DB ERROR!") }, + Ok(p_info) => p_info, + }; - pub fn get_avatar_props(&self, guid: u64) -> Option> { + let props = props + .into_iter() + .map(|p| (p.prop_id, p.prop_value)) + .collect(); + + return Some(props); + } +/* + pub fn _get_avatar_props(&self, guid: u64) -> Option> { let map = collection! { - proto::PropType::PropExp as u32 => 0, - proto::PropType::PropLevel as u32 => 80, - proto::PropType::PropBreakLevel as u32 => 5, - proto::PropType::PropSatiationVal as u32 => 0, - proto::PropType::PropSatiationPenaltyTime as u32 => 0, + //proto::PropType::PropExp as u32 => 0, + //proto::PropType::PropLevel as u32 => 80, + //proto::PropType::PropBreakLevel as u32 => 5, + //proto::PropType::PropSatiationVal as u32 => 0, + //proto::PropType::PropSatiationPenaltyTime as u32 => 0, }; return Some(map); + }*/ + + pub fn get_avatar_props(&self, guid: i64) -> Option> { + let props = match AvatarPropEntity::find_by_id(guid).all(&self.db).wait() { + Err(_) => { panic!("DB ERROR!") }, + Ok(p_info) => p_info, + }; + + let props = props + .into_iter() + .map(|p| (p.prop_id, p.prop_value)) + .collect(); + + return Some(props); } - pub fn get_avatar_equip(&self, guid: u64) -> Option> { + pub fn get_avatar_equip(&self, guid: i64) -> Option> { let equip = vec![Self::SPOOFED_WEAPON_GUID]; return Some(equip); } - pub fn get_skill_levels(&self, guid: u64) -> Option> { + pub fn get_skill_levels(&self, guid: i64) -> Option> { let map = collection! { 10068 => 3, 100553 => 3, @@ -126,7 +189,8 @@ impl DatabaseManager { return Some(map); } - pub fn get_avatar_fight_props(&self, guid: u64) -> Option> { + pub fn get_avatar_fight_props(&self, guid: i64) -> Option> { + /* let map = collection! { proto::FightPropType::FightPropBaseHp as u32 => 9000.0, proto::FightPropType::FightPropHp as u32 => 3000.0, @@ -181,9 +245,23 @@ impl DatabaseManager { }; return Some(map); + + */ + let props = match AvatarFightPropEntity::find_by_id(guid).all(&self.db).wait() { + Err(e) => { panic!("DB ERROR {}: {}!", guid, e) }, + Ok(props) => props, + }; + + let props = props + .into_iter() + .map(|p| (p.prop_id, p.value)) + .collect(); + + return Some(props); } pub fn get_open_state(&self, uid: u32) -> Option> { + /* Some(collection! { proto::OpenStateType::OpenStatePaimon as u32 => 1, @@ -217,9 +295,23 @@ impl DatabaseManager { proto::OpenStateType::OpenStateLiyueInfusedcrystal as u32 => 1, proto::OpenStateType::OpenStateInazumaMainquestFinished as u32 => 1, }) + + */ + let states = match OpenStateEntity::find_by_id(uid).all(&self.db).wait() { + Err(_) => { panic!("DB ERROR!") }, + Ok(states) => states, + }; + + let states = states + .into_iter() + .map(|s| (s.state_id, s.value)) + .collect(); + + return Some(states); } pub fn get_inventory(&self, uid: u32) -> Option> { + let mut weapon = proto::Weapon::default(); weapon.level = 70; weapon.promote_level = 4; @@ -231,13 +323,68 @@ impl DatabaseManager { let mut item = proto::Item::default(); item.item_id = 11406; - item.guid = Self::SPOOFED_WEAPON_GUID; + item.guid = Self::SPOOFED_WEAPON_GUID as u64; // FIXME item.detail = Some(proto::item::Detail::Equip(equip)); return Some(vec![item]); + + + + /* + Inventory item can be of three types: material, equip and furniture + Equip is further divided into relic and weapon + Sp we need to get: + 1) Materials + 2) Furniture + 3) Relics (+their properties) + 4) Weapons (+their affices) + */ + /* + let items = match ItemInfoEntity::find_by_id(uid).all(&self.db).wait() { + Err(e) => { panic!("DB ERROR: {}!", e) }, + Ok(items) => items, + }; + + let materials: Vec<(ItemInfo, MaterialInfo)> = self.find_related_to_items(&items, MaterialInfoEntity); + + let furniture: Vec<(ItemInfo, FurnitureInfo)> = self.find_related_to_items(&items, FurnitureInfoEntity); + + let equip: Vec<(ItemInfo, EquipInfo)> = self.find_related_to_items(&items, EquipInfoEntity); + + return None;*/ + } + + fn find_related_to_items(&self, items: &Vec, entity_type: T) -> Vec<(ItemInfo, T::Model)> + where + ItemInfoEntity: sea_orm::Related + { + return items.into_iter() + .map(|item| { + let ret = match item.find_related(entity_type).one(&self.db).wait() { + Err(e) => { panic!("DB ERROR: {}!", e) }, + Ok(data) => data, + }; + + match ret { + None => None, + Some(data) => Some( (item.clone(), data) ), + } + }) + .filter(|x| !x.is_none()) + .map(|x| x.unwrap()) + .collect(); } pub fn get_avatars(&self, uid: u32) -> Option> { + let avatars = match AvatarInfoEntity::find_by_id(uid).all(&self.db).wait() { + Err(_) => { panic!("DB ERROR!") }, + Ok(avatars) => avatars, + }; + + return Some(avatars); + } +/* + pub fn _get_avatars(&self, uid: u32) -> Option> { let ai = AvatarInfo { uid: uid, character_id: 7, @@ -247,23 +394,55 @@ impl DatabaseManager { }; return Some(vec![ai]); - } - pub fn get_player_scene_info(&self, uid: u32) -> Option { + + }*/ + + pub fn get_avatar(&self, guid: i64) -> Option { + let avatar = match AvatarInfoEntity::find().filter(super::avatar_info::Column::Guid.eq(guid)).one(&self.db).wait() { + Err(_) => { panic!("DB ERROR!") }, + Ok(avatar) => avatar, + }; + + return avatar; + } +/* + pub fn _get_avatar(&self, guid: u64) -> Option { + let ai = AvatarInfo { + uid: AuthManager::SPOOFED_PLAYER_UID, // TODO! + character_id: 7, + avatar_type: 1, + guid: Self::SPOOFED_AVATAR_GUID, + born_time: 1633790000, + }; + + return Some(ai); + }*/ +/* + pub fn _get_player_scene_info(&self, uid: u32) -> Option { let si = SceneInfo { uid: uid, scene_id: Self::SPOOFED_SCENE_ID, scene_token: Self::SPOOFED_SCENE_TOKEN, pos_x: -3400.0, pos_y: 233.0, - pos_z: 3427.6, + pos_z: -3427.6, }; return Some(si); } +*/ + pub fn get_player_scene_info(&self, uid: u32) -> Option { + let scene_info = match SceneInfoEntity::find_by_id(uid).one(&self.db).wait() { + Err(_) => { panic!("DB ERROR!") }, + Ok(info) => info, + }; + + return scene_info; + } pub fn get_player_teams(&self, uid: u32) -> Option> { - let t1 = TeamInfo { + /*let t1 = TeamInfo { uid: uid.clone(), id: 1, name: "Team 1".to_string(), @@ -288,9 +467,17 @@ impl DatabaseManager { }; return Some(vec![t1, t2, t3, t4]); + */ + let teams = match TeamInfoEntity::find_by_id(uid).all(&self.db).wait() { + Err(_) => panic!("Failed to retrieve teams for user {}!", uid), + Ok(teams) => teams, + }; + + return Some(teams); } pub fn get_player_teams_avatars(&self, uid: u32) -> Option> { + /* let a1 = AvatarTeamInfo { uid: uid.clone(), team_id: 1, @@ -316,9 +503,17 @@ impl DatabaseManager { }; return Some(vec![a1, a2, a3, a4]); + */ + let teams = match AvatarTeamInfoEntity::find_by_id(uid).all(&self.db).wait() { + Err(_) => panic!("Failed to retrieve avatar teams for user {}!", uid), + Ok(teams) => teams, + }; + + return Some(teams); } pub fn get_player_team_selection(&self, uid: u32) -> Option { + /* let tsi = TeamSelectionInfo { uid: uid.clone(), avatar: Self::SPOOFED_AVATAR_GUID, @@ -326,11 +521,18 @@ impl DatabaseManager { }; return Some(tsi); + */ + let tsi = match TeamSelectionInfoEntity::find_by_id(uid).one(&self.db).wait() { + Err(_) => { panic!("DB ERROR!") }, + Ok(info) => info, + }; + + return tsi; } - const BASE_GUID: u64 = 0x2400000000000000; - const SPOOFED_AVATAR_GUID: u64 = Self::BASE_GUID + 1; - const SPOOFED_WEAPON_GUID: u64 = Self::BASE_GUID + 2; + const BASE_GUID: i64 = 0x2400000000000000; + const SPOOFED_AVATAR_GUID: i64 = Self::BASE_GUID + 1; + const SPOOFED_WEAPON_GUID: i64 = Self::BASE_GUID + 2; const SPOOFED_SCENE_ID: u32 = 3; const SPOOFED_SCENE_TOKEN: u32 = 0x1234; } diff --git a/src/dbmanager/equip_info.rs b/src/dbmanager/equip_info.rs new file mode 100644 index 0000000..9396aec --- /dev/null +++ b/src/dbmanager/equip_info.rs @@ -0,0 +1,33 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "equip_info")] +pub struct Model { + #[sea_orm(primary_key)] + pub guid: i64, + pub is_locked: bool, + pub level: u32, + pub exp: u32, + pub promote_level: u32, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Item, +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Item => Entity::belongs_to(super::item_info::Entity) + .from(Column::Guid) + .to(super::item_info::Column::Guid) + .into(), + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/furniture_info.rs b/src/dbmanager/furniture_info.rs new file mode 100644 index 0000000..eae37ee --- /dev/null +++ b/src/dbmanager/furniture_info.rs @@ -0,0 +1,30 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "furniture_info")] +pub struct Model { + #[sea_orm(primary_key)] + pub guid: i64, + pub count: u32, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Item, +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Item => Entity::belongs_to(super::item_info::Entity) + .from(Column::Guid) + .to(super::item_info::Column::Guid) + .into(), + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/item_info.rs b/src/dbmanager/item_info.rs new file mode 100644 index 0000000..2a90edd --- /dev/null +++ b/src/dbmanager/item_info.rs @@ -0,0 +1,47 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "item_info")] +pub struct Model { + #[sea_orm(primary_key)] + pub uid: u32, + pub guid: i64, + pub item_id: u32, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Material, + Equip, + Furniture, +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + _ => panic!("Unknown relation type!"), + } + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Material.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Equip.def() + } +} + +impl Related for Entity { + fn to() -> RelationDef { + Relation::Furniture.def() + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/material_info.rs b/src/dbmanager/material_info.rs new file mode 100644 index 0000000..7efd24b --- /dev/null +++ b/src/dbmanager/material_info.rs @@ -0,0 +1,32 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "material_info")] +pub struct Model { + #[sea_orm(primary_key)] + pub guid: i64, + pub count: u32, + pub has_delete_config: bool, + // TODO: Add MaterialDeleteInfo! +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Item, +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Item => Entity::belongs_to(super::item_info::Entity) + .from(Column::Guid) + .to(super::item_info::Column::Guid) + .into(), + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/mod.rs b/src/dbmanager/mod.rs index 49769aa..4fb1921 100644 --- a/src/dbmanager/mod.rs +++ b/src/dbmanager/mod.rs @@ -8,3 +8,14 @@ mod scene_info; mod avatar_team_info; mod team_info; mod team_selection_info; +mod avatar_prop; +mod avatar_fight_prop; +mod player_prop; +mod open_state; +mod material_info; +mod reliquary_info; +mod equip_info; +mod item_info; +mod weapon_affix_info; +mod reliquary_prop; +mod furniture_info; \ No newline at end of file diff --git a/src/dbmanager/open_state.rs b/src/dbmanager/open_state.rs new file mode 100644 index 0000000..85926a7 --- /dev/null +++ b/src/dbmanager/open_state.rs @@ -0,0 +1,26 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "open_state")] +pub struct Model { + #[sea_orm(primary_key)] + pub uid: u32, + pub state_id: u32, + pub value: u32, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/player_info.rs b/src/dbmanager/player_info.rs index 7610a8e..9b64241 100644 --- a/src/dbmanager/player_info.rs +++ b/src/dbmanager/player_info.rs @@ -1,6 +1,7 @@ // Database Manager use sea_orm::entity::prelude::*; +use chrono::NaiveDate; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[sea_orm(table_name = "player_info")] @@ -8,10 +9,8 @@ pub struct Model { #[sea_orm(primary_key)] pub uid: u32, pub nick_name: String, - pub level: u8, pub signature: String, - pub birthday: u32, - pub world_level: u8, + pub birthday: NaiveDate, pub namecard_id: u32, pub finish_achievement_num: u32, pub tower_floor_index: u8, diff --git a/src/dbmanager/player_prop.rs b/src/dbmanager/player_prop.rs new file mode 100644 index 0000000..37a5b54 --- /dev/null +++ b/src/dbmanager/player_prop.rs @@ -0,0 +1,26 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "player_prop")] +pub struct Model { + #[sea_orm(primary_key)] + pub uid: u32, + pub prop_id: u32, + pub prop_value: i64, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/reliquary_info.rs b/src/dbmanager/reliquary_info.rs new file mode 100644 index 0000000..ddeac26 --- /dev/null +++ b/src/dbmanager/reliquary_info.rs @@ -0,0 +1,25 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "reliquary_info")] +pub struct Model { + #[sea_orm(primary_key)] + pub guid: i64, + pub main_prop_id: u32, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/reliquary_prop.rs b/src/dbmanager/reliquary_prop.rs new file mode 100644 index 0000000..328fabf --- /dev/null +++ b/src/dbmanager/reliquary_prop.rs @@ -0,0 +1,25 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "reliquary_prop")] +pub struct Model { + #[sea_orm(primary_key)] + pub guid: i64, + pub prop_id: u32, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/src/dbmanager/team_selection_info.rs b/src/dbmanager/team_selection_info.rs index a3e5035..42e0ebc 100644 --- a/src/dbmanager/team_selection_info.rs +++ b/src/dbmanager/team_selection_info.rs @@ -7,7 +7,7 @@ use sea_orm::entity::prelude::*; pub struct Model { #[sea_orm(primary_key)] pub uid: u32, - pub avatar: u64, + pub avatar: i64, pub team: u8, } diff --git a/src/dbmanager/weapon_affix_info.rs b/src/dbmanager/weapon_affix_info.rs new file mode 100644 index 0000000..0177c28 --- /dev/null +++ b/src/dbmanager/weapon_affix_info.rs @@ -0,0 +1,26 @@ +// Database Manager + +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] +#[sea_orm(table_name = "weapon_affix_info")] +pub struct Model { + #[sea_orm(primary_key)] + pub guid: i64, + pub affix_id: u32, + pub affix_value: u32, +} + +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { +} + +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + _ => panic!("Unknown relation type!"), + } + } +} + +impl ActiveModelBehavior for ActiveModel {}