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.

97 lines
2.6 KiB

  1. #![allow(dead_code)]
  2. use std::time::SystemTime;
  3. use libpso::character::settings;
  4. use libpso::character::guildcard;
  5. pub const USERFLAG_NEWCHAR: u32 = 0x00000001;
  6. pub const USERFLAG_DRESSINGROOM: u32 = 0x00000002;
  7. #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
  8. pub struct UserAccountId(pub u32);
  9. #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
  10. pub struct UserSettingsId(pub u32);
  11. #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
  12. pub struct GuildCardDataId(pub u32);
  13. #[derive(Clone, Debug)]
  14. pub struct NewUserAccountEntity {
  15. pub username: String,
  16. pub password: String,
  17. pub guildcard: u32,
  18. pub team_id: Option<u32>,
  19. pub banned_until: Option<chrono::DateTime<chrono::Utc>>,
  20. pub muted_until: Option<chrono::DateTime<chrono::Utc>>,
  21. pub created_at: chrono::DateTime<chrono::Utc>,
  22. pub flags: u32,
  23. }
  24. #[derive(Clone, Debug)]
  25. pub struct UserAccountEntity {
  26. pub id: UserAccountId,
  27. pub username: String,
  28. pub password: String,
  29. pub guildcard: u32,
  30. pub team_id: Option<u32>,
  31. pub banned_until: Option<chrono::DateTime<chrono::Utc>>,
  32. pub muted_until: Option<chrono::DateTime<chrono::Utc>>,
  33. pub created_at: chrono::DateTime<chrono::Utc>,
  34. pub flags: u32, // TODO: is this used for anything other than character creation?
  35. }
  36. #[derive(Clone, Debug)]
  37. pub struct NewUserSettingsEntity {
  38. pub user_id: UserAccountId,
  39. pub settings: settings::UserSettings,
  40. }
  41. impl NewUserSettingsEntity {
  42. pub fn new(user_id: UserAccountId) -> NewUserSettingsEntity {
  43. NewUserSettingsEntity {
  44. user_id: user_id,
  45. settings: settings::UserSettings::default(),
  46. }
  47. }
  48. }
  49. #[derive(Clone, Debug)]
  50. pub struct UserSettingsEntity {
  51. pub id: UserSettingsId,
  52. pub user_id: UserAccountId,
  53. pub settings: settings::UserSettings,
  54. }
  55. #[derive(Clone)]
  56. pub struct NewGuildCardDataEntity {
  57. pub user_id: UserAccountId,
  58. pub guildcard: guildcard::GuildCardData,
  59. }
  60. impl NewGuildCardDataEntity {
  61. pub fn new(user_id: UserAccountId) -> NewGuildCardDataEntity {
  62. NewGuildCardDataEntity {
  63. user_id: user_id,
  64. guildcard: guildcard::GuildCardData::default(),
  65. }
  66. }
  67. }
  68. // TODO: implement this properly
  69. #[derive(Clone)]
  70. pub struct GuildCardDataEntity {
  71. pub id: GuildCardDataId,
  72. pub user_id: UserAccountId,
  73. pub guildcard: guildcard::GuildCardData,
  74. }
  75. impl GuildCardDataEntity {
  76. pub fn new(user_id: UserAccountId) -> GuildCardDataEntity {
  77. GuildCardDataEntity {
  78. id: GuildCardDataId(0),
  79. user_id: user_id,
  80. guildcard: guildcard::GuildCardData::default(),
  81. }
  82. }
  83. }