2019-08-28 20:39:11 -07:00
|
|
|
use std::time::SystemTime;
|
|
|
|
|
|
|
|
use libpso::character::settings;
|
2019-09-05 15:09:29 -07:00
|
|
|
use libpso::character::guildcard;
|
2019-08-28 20:39:11 -07:00
|
|
|
|
2019-09-23 22:24:51 -07:00
|
|
|
pub const USERFLAG_NEWCHAR: u32 = 0x00000001;
|
|
|
|
pub const USERFLAG_DRESSINGROOM: u32 = 0x00000002;
|
|
|
|
|
2020-03-29 22:00:07 -07:00
|
|
|
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
|
2020-03-29 16:11:14 -07:00
|
|
|
pub struct UserAccountId(pub u32);
|
2020-03-29 22:00:07 -07:00
|
|
|
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
|
2020-03-29 16:11:14 -07:00
|
|
|
pub struct UserSettingsId(pub u32);
|
2020-03-29 22:00:07 -07:00
|
|
|
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
|
2020-03-29 16:11:14 -07:00
|
|
|
pub struct GuildCardDataId(pub u32);
|
|
|
|
|
2019-09-23 22:24:51 -07:00
|
|
|
#[derive(Clone, Debug)]
|
2020-03-29 16:11:14 -07:00
|
|
|
pub struct UserAccountEntity {
|
2020-03-29 22:00:07 -07:00
|
|
|
pub id: Option<UserAccountId>,
|
2019-08-28 20:39:11 -07:00
|
|
|
pub username: String,
|
|
|
|
pub password: String,
|
2020-03-22 22:40:40 -03:00
|
|
|
pub guildcard: u32,
|
2019-09-05 15:09:29 -07:00
|
|
|
pub team_id: Option<u32>,
|
2019-08-28 20:39:11 -07:00
|
|
|
pub banned: bool,
|
|
|
|
pub muted_until: SystemTime,
|
|
|
|
pub created_at: SystemTime,
|
2019-09-23 22:24:51 -07:00
|
|
|
pub flags: u32, // TODO: is this used for anything other than character creation?
|
2019-08-28 20:39:11 -07:00
|
|
|
}
|
2019-09-05 15:09:29 -07:00
|
|
|
|
2020-03-29 22:00:07 -07:00
|
|
|
#[derive(Clone, Debug)]
|
2020-03-29 16:11:14 -07:00
|
|
|
pub struct UserSettingsEntity {
|
2020-03-29 22:00:07 -07:00
|
|
|
pub id: Option<UserSettingsId>,
|
2020-03-29 16:11:14 -07:00
|
|
|
pub user_id: UserAccountId,
|
2019-08-28 20:39:11 -07:00
|
|
|
pub settings: settings::UserSettings,
|
|
|
|
}
|
2019-09-05 15:09:29 -07:00
|
|
|
|
2020-03-29 22:00:07 -07:00
|
|
|
impl UserSettingsEntity {
|
|
|
|
pub fn new(user_id: UserAccountId) -> UserSettingsEntity {
|
|
|
|
UserSettingsEntity {
|
|
|
|
id: None,
|
|
|
|
user_id: user_id,
|
|
|
|
settings: settings::UserSettings::default(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
2020-03-29 16:11:14 -07:00
|
|
|
pub struct GuildCardDataEntity {
|
2020-03-29 22:00:07 -07:00
|
|
|
pub id: Option<GuildCardDataId>,
|
2020-03-29 16:11:14 -07:00
|
|
|
pub user_id: UserAccountId,
|
2019-09-05 15:09:29 -07:00
|
|
|
pub guildcard: guildcard::GuildCardData,
|
|
|
|
}
|
2020-03-29 22:00:07 -07:00
|
|
|
|
|
|
|
impl GuildCardDataEntity {
|
|
|
|
pub fn new(user_id: UserAccountId) -> GuildCardDataEntity {
|
|
|
|
GuildCardDataEntity {
|
|
|
|
id: None,
|
|
|
|
user_id: user_id,
|
|
|
|
guildcard: guildcard::GuildCardData::default(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|