// // Licensed under the MIT License. See LICENSE file in the project root for full license information. // namespace MUnique.OpenMU.DataModel.Entities; using System.ComponentModel; using MUnique.OpenMU.AttributeSystem; using MUnique.OpenMU.DataModel.Configuration; /// /// The state of an account. /// public enum AccountState { /// /// Normal player account. /// Normal, /// /// Spectator account, invisible to players and monsters. /// Spectator, /// /// Game Master account. /// GameMaster, /// /// Game Master account, invisible to players and monsters. /// GameMasterInvisible, /// /// Banned account. /// Banned, /// /// Temporarily banned account. /// TemporarilyBanned, } /// /// The account of a player. /// [AggregateRoot] public class Account { /// /// Gets or sets the unique login name. /// [Required] public string LoginName { get; set; } = string.Empty; /// /// Gets or sets the hash of the password, preferrably of BCrypt. /// public string PasswordHash { get; set; } = string.Empty; /// /// Gets or sets the security code which is used to confirm character deletion and guild kicks. /// public string SecurityCode { get; set; } = string.Empty; /// /// Gets or sets the e mail address. /// public string EMail { get; set; } = string.Empty; /// /// Gets or sets the iso code (ISO 639-2/3) of the preferred language of the player. /// [DefaultValue("en")] public string LanguageIsoCode { get; set; } = "en"; /// /// Gets or sets the date and time until which the chat ban is in effect. /// public DateTime? ChatBanUntil { get; set; } /// /// Gets or sets the unlocked character classes which are locked by default. /// /// /// Some classes are only available when the player reached a certain level before, or when he paid for some unlock ticket. /// [HiddenAtCreation] public virtual ICollection UnlockedCharacterClasses { get; protected set; } = null!; /// /// Gets or sets the registration date. /// public DateTime RegistrationDate { get; set; } = DateTime.UtcNow; /// /// Gets or sets the state. /// public AccountState State { get; set; } /// /// Gets or sets the timezone of the player, difference to UTC. /// public short TimeZone { get; set; } /// /// Gets or sets the vault password. /// [HiddenAtCreation] public string VaultPassword { get; set; } = string.Empty; /// /// Gets or sets the vault. /// [MemberOfAggregate] [HiddenAtCreation] public virtual ItemStorage? Vault { get; set; } /// /// Gets or sets a value indicating whether this instance is vault extended. /// public bool IsVaultExtended { get; set; } /// /// Gets or sets a value indicating whether this instance is a template account /// and therefore read-only within the game server. /// public bool IsTemplate { get; set; } /// /// Gets or sets a value indicating whether this account is a server-side bot account. /// Bot accounts are generated and maintained by the bot feature; this flag is the reliable /// marker used to load them on startup (instead of regenerating) and to purge them. /// public bool IsBot { get; set; } /// /// Gets or sets the characters. /// [MemberOfAggregate] [HiddenAtCreation] public virtual ICollection Characters { get; protected set; } = null!; /// /// Gets or sets the stat attributes which are applied across all characters of the account. /// /// /// Please note, that it's not possible to add stat attribute with the same /// attribute definition to the and the . /// [MemberOfAggregate] public virtual ICollection Attributes { get; protected set; } = null!; /// public override string ToString() { return this.LoginName; } }