150 lines
3.6 KiB
C#
150 lines
3.6 KiB
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using GTANetworkAPI;
|
|
using ReallifeGamemode.Database.Models;
|
|
using ReallifeGamemode.Server.Core.API;
|
|
using ReallifeGamemode.Server.Core.RageMP;
|
|
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<UserBankAccount>
|
|
{
|
|
[NotMapped]
|
|
private int _wanteds;
|
|
|
|
[NotMapped]
|
|
private int _handmoney;
|
|
|
|
public delegate void UserHandMoneyChangedEvent(User account);
|
|
public static event UserHandMoneyChangedEvent HandMoneyChanged;
|
|
|
|
[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 => _handmoney;
|
|
|
|
set
|
|
{
|
|
_handmoney = value;
|
|
HandMoneyChanged?.Invoke(this);
|
|
}
|
|
}
|
|
|
|
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 BusSkill { get; set; }
|
|
public int PilotSkill { get; set; }
|
|
|
|
public int trashcount { 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 int PlayedMinutes { get; set; } = 1;
|
|
|
|
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;
|
|
public int Points { get; set; }
|
|
|
|
public int otheramount { get; set; } = 0;
|
|
public int failpoints { get; set; } = 0;
|
|
|
|
public int warn { get; set; } = 0;
|
|
|
|
[NotMapped]
|
|
public Player Player
|
|
{
|
|
get => NAPI.Pools.GetAllPlayers().Where(c => c.Name.ToLower() == this.Name.ToLower()).FirstOrDefault();
|
|
}
|
|
|
|
[NotMapped]
|
|
public IPlayer NewPlayer
|
|
{
|
|
get
|
|
{
|
|
if (Player != null) return new RagePlayer(Player);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public override string BankAccountName => Name;
|
|
}
|
|
}
|