using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using GTANetworkAPI; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Types; /** * @overview Life of German Reallife - Entities User (User.cs) * @author VegaZ, hydrant * @copyright (c) 2008 - 2018 Life of German */ namespace ReallifeGamemode.Database.Entities { public partial class User : BankAccountHolder { [NotMapped] private int _wanteds; [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [StringLength(32)] public string Name { get; set; } [StringLength(32)] public string SocialClubName { get; set; } [StringLength(64)] public string Password { get; set; } public int LogUserId { get; set; } [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public DateTime RegistrationDate { get; set; } [EmailAddress] [StringLength(64)] public string Email { get; set; } public AdminLevel AdminLevel { get; set; } public bool Dead { get; set; } public int Handmoney { get; set; } public float PositionX { get; set; } public float PositionY { get; set; } public float PositionZ { get; set; } [ForeignKey("Character")] public int? CharacterId { get; set; } public Character Character { get; set; } [ForeignKey("Ban")] public int? BanId { get; set; } public Ban Ban { get; set; } public int? BusinessId { get; set; } public int? FactionId { get; set; } public Faction Faction { get; set; } public bool FactionLeader { get; set; } public int? FactionRankId { get; set; } public FactionRank FactionRank { get; set; } public Group Group { get; set; } public GroupRank GroupRank { get; set; } [ForeignKey("House")] public int? HouseId { get; set; } public House House { get; set; } public int? JobId { get; set; } public int Wanteds { get => _wanteds; set { this._wanteds = value; Player.TriggerEvent("SERVER:SetWanteds", value); } } public int Wage { get; set; } public int JailTime { get; set; } public int PaydayTimer { get; set; } = 60; public bool DriverLicenseVehicle { get; set; } = false; public bool FlyingLicensePlane { get; set; } = false; public bool DriverLicenseBike { get; set; } = false; public bool WeaponLicense { get; set; } = false; public bool IsAdmin(AdminLevel level) => AdminLevel >= level; [NotMapped] public Player Player { get => NAPI.Pools.GetAllPlayers().Where(c => c.Name.ToLower() == this.Name.ToLower()).FirstOrDefault(); } public override string BankAccountName => Name; } }