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

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