You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.4 KiB

use std::time::SystemTime;
use libpso::character::settings;
use libpso::character::guildcard;
pub const USERFLAG_NEWCHAR: u32 = 0x00000001;
pub const USERFLAG_DRESSINGROOM: u32 = 0x00000002;
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub struct UserAccountId(pub u32);
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub struct UserSettingsId(pub u32);
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub struct GuildCardDataId(pub u32);
#[derive(Clone, Debug)]
pub struct NewUserAccountEntity {
pub username: String,
pub password: String,
pub guildcard: u32,
pub team_id: Option<u32>,
pub banned: bool,
pub muted_until: SystemTime,
pub created_at: SystemTime,
pub flags: u32,
}
#[derive(Clone, Debug)]
pub struct UserAccountEntity {
pub id: UserAccountId,
pub username: String,
pub password: String,
pub guildcard: u32,
pub team_id: Option<u32>,
pub banned: bool,
pub muted_until: SystemTime,
pub created_at: SystemTime,
pub flags: u32, // TODO: is this used for anything other than character creation?
}
#[derive(Clone, Debug)]
pub struct NewUserSettingsEntity {
pub user_id: UserAccountId,
pub settings: settings::UserSettings,
}
impl NewUserSettingsEntity {
pub fn new(user_id: UserAccountId) -> NewUserSettingsEntity {
NewUserSettingsEntity {
user_id: user_id,
settings: settings::UserSettings::default(),
}
}
}
#[derive(Clone, Debug)]
pub struct UserSettingsEntity {
pub id: UserSettingsId,
pub user_id: UserAccountId,
pub settings: settings::UserSettings,
}
#[derive(Clone)]
pub struct NewGuildCardDataEntity {
pub user_id: UserAccountId,
pub guildcard: guildcard::GuildCardData,
}
impl NewGuildCardDataEntity {
pub fn new(user_id: UserAccountId) -> NewGuildCardDataEntity {
NewGuildCardDataEntity {
user_id: user_id,
guildcard: guildcard::GuildCardData::default(),
}
}
}
// TODO: implement this properly
#[derive(Clone)]
pub struct GuildCardDataEntity {
pub id: GuildCardDataId,
pub user_id: UserAccountId,
pub guildcard: guildcard::GuildCardData,
}
impl GuildCardDataEntity {
pub fn new(user_id: UserAccountId) -> GuildCardDataEntity {
GuildCardDataEntity {
id: GuildCardDataId(0),
user_id: user_id,
guildcard: guildcard::GuildCardData::default(),
}
}
}