added editorconfig and formatted code

This commit is contained in:
hydrant
2019-07-17 19:52:55 +02:00
parent ada071cc93
commit 123ab7d07b
146 changed files with 10839 additions and 10715 deletions

View File

@@ -16,27 +16,27 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class ATM : IBankAccountOwner, IBankAccount
public class ATM : IBankAccountOwner, IBankAccount
{
[Key]
public int Id { get; set; }
public int Balance { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
[NotMapped]
public Vector3 Position => new Vector3(X, Y, Z);
public bool Faulty { get; set; } = false;
public bool Active { get; set; } = true;
public string Name => throw new NotImplementedException();
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
{
[Key]
public int Id { get; set; }
public int Balance { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
[NotMapped]
public Vector3 Position => new Vector3(X, Y, Z);
public bool Faulty { get; set; } = false;
public bool Active { get; set; } = true;
public string Name => throw new NotImplementedException();
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
{
databaseContext = databaseContext ?? new DatabaseContext();
return databaseContext.ATMs.Where(a => a.Id == this.Id).First();
}
databaseContext = databaseContext ?? new DatabaseContext();
return databaseContext.ATMs.Where(a => a.Id == this.Id).First();
}
}
}

View File

@@ -13,20 +13,20 @@ using ReallifeGamemode.Server.Entities;
namespace ReallifeGamemode.Server.Entities
{
public class Ban
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class Ban
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
public string Reason { get; set; }
public string BannedBy { get; set; }
public string Reason { get; set; }
public string BannedBy { get; set; }
public int Applied { get; set; }
public int UntilDateTime { get; set; }
}
public int Applied { get; set; }
public int UntilDateTime { get; set; }
}
}

View File

@@ -6,34 +6,34 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class BusRoute
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class BusRoute
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Description { get; set; }
public string Description { get; set; }
public List<BusRoutePoint> RoutePoints { get; set; }
}
public List<BusRoutePoint> RoutePoints { get; set; }
}
public class BusRoutePoint
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class BusRoutePoint
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Description { get; set; }
public string Description { get; set; }
public float X { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public float Z { get; set; }
[ForeignKey("BusRouteId")]
public int? BusRouteId { get; set; }
[ForeignKey("BusRouteId")]
public int? BusRouteId { get; set; }
public BusRoute BusRoute { get; set; }
}
public BusRoute BusRoute { get; set; }
}
}

View File

@@ -9,24 +9,24 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class BusinessBankAccount : IBankAccount
public class BusinessBankAccount : IBankAccount
{
[NotMapped]
private int _balance;
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int Balance
{
[NotMapped]
private int _balance;
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int Balance
{
get => _balance;
set
{
_balance = value;
BusinessManager.GetBusiness(BusinessId).Update(value);
}
}
public int BusinessId { get; set; }
get => _balance;
set
{
_balance = value;
BusinessManager.GetBusiness(BusinessId).Update(value);
}
}
public int BusinessId { get; set; }
}
}

View File

@@ -9,74 +9,74 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace ReallifeGamemode.Server.Entities
{
public class Character
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class Character
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
public bool Gender { get; set; }
public byte Father { get; set; }
public byte Mother { get; set; }
public float Similarity { get; set; }
public float SkinSimilarity { get; set; }
public bool Gender { get; set; }
public byte Father { get; set; }
public byte Mother { get; set; }
public float Similarity { get; set; }
public float SkinSimilarity { get; set; }
public float NoseWidth { get; set; }
public float NoseBottomHeight { get; set; }
public float NoseTipLength { get; set; }
public float NoseBridgeDepth { get; set; }
public float NoseTipHeight { get; set; }
public float NoseBroken { get; set; }
public float BrowHeight { get; set; }
public float BrowDepth { get; set; }
public float CheekboneHeight { get; set; }
public float CheekboneWidth { get; set; }
public float CheekDepth { get; set; }
public float EyeSize { get; set; }
public float LipThickness { get; set; }
public float JawWidth { get; set; }
public float JawShape { get; set; }
public float ChinHeight { get; set; }
public float ChinDepth { get; set; }
public float ChinWidth { get; set; }
public float ChinIndent { get; set; }
public float NeckWidth { get; set; }
public float NoseWidth { get; set; }
public float NoseBottomHeight { get; set; }
public float NoseTipLength { get; set; }
public float NoseBridgeDepth { get; set; }
public float NoseTipHeight { get; set; }
public float NoseBroken { get; set; }
public float BrowHeight { get; set; }
public float BrowDepth { get; set; }
public float CheekboneHeight { get; set; }
public float CheekboneWidth { get; set; }
public float CheekDepth { get; set; }
public float EyeSize { get; set; }
public float LipThickness { get; set; }
public float JawWidth { get; set; }
public float JawShape { get; set; }
public float ChinHeight { get; set; }
public float ChinDepth { get; set; }
public float ChinWidth { get; set; }
public float ChinIndent { get; set; }
public float NeckWidth { get; set; }
public byte Blemishes { get; set; }
public float BlemishesOpacity { get; set; }
public byte FacialHair { get; set; }
public float FacialHairOpacity { get; set; }
public byte Eyebrows { get; set; }
public float EyebrowsOpacity { get; set; }
public byte Ageing { get; set; }
public float AgeingOpacity { get; set; }
public byte Makeup { get; set; }
public float MakeupOpacity { get; set; }
public byte Blush { get; set; }
public float BlushOpacity { get; set; }
public byte Complexion { get; set; }
public float ComplexionOpacity { get; set; }
public byte SunDamage { get; set; }
public float SunDamageOpacity { get; set; }
public byte Lipstick { get; set; }
public float LipstickOpacity { get; set; }
public byte Freckles { get; set; }
public float FrecklesOpacity { get; set; }
public byte ChestHair { get; set; }
public float ChestHairOpacity { get; set; }
public byte Blemishes { get; set; }
public float BlemishesOpacity { get; set; }
public byte FacialHair { get; set; }
public float FacialHairOpacity { get; set; }
public byte Eyebrows { get; set; }
public float EyebrowsOpacity { get; set; }
public byte Ageing { get; set; }
public float AgeingOpacity { get; set; }
public byte Makeup { get; set; }
public float MakeupOpacity { get; set; }
public byte Blush { get; set; }
public float BlushOpacity { get; set; }
public byte Complexion { get; set; }
public float ComplexionOpacity { get; set; }
public byte SunDamage { get; set; }
public float SunDamageOpacity { get; set; }
public byte Lipstick { get; set; }
public float LipstickOpacity { get; set; }
public byte Freckles { get; set; }
public float FrecklesOpacity { get; set; }
public byte ChestHair { get; set; }
public float ChestHairOpacity { get; set; }
public byte Hair { get; set; }
public byte HairColor { get; set; }
public byte HairHighlightColor { get; set; }
public byte EyebrowColor { get; set; }
public byte BeardColor { get; set; }
public byte EyeColor { get; set; }
public byte BlushColor { get; set; }
public byte LipstickColor { get; set; }
public byte ChestHairColor { get; set; }
}
public byte Hair { get; set; }
public byte HairColor { get; set; }
public byte HairHighlightColor { get; set; }
public byte EyebrowColor { get; set; }
public byte BeardColor { get; set; }
public byte EyeColor { get; set; }
public byte BlushColor { get; set; }
public byte LipstickColor { get; set; }
public byte ChestHairColor { get; set; }
}
}

View File

@@ -9,21 +9,21 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace ReallifeGamemode.Server.Entities
{
public class CharacterCloth
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class CharacterCloth
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
public bool Duty { get; set; }
public bool Duty { get; set; }
public byte SlotType { get; set; }
public int SlotId { get; set; }
public int ClothId { get; set; }
public int Texture { get; set; }
}
public byte SlotType { get; set; }
public int SlotId { get; set; }
public int ClothId { get; set; }
public int Texture { get; set; }
}
}

View File

@@ -13,13 +13,13 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class ClothCombination
{
[Key]
public int Id { get; set; }
public bool Gender { get; set; }
public int Top { get; set; }
public int Torso { get; set; }
public int Undershirt { get; set; }
}
public class ClothCombination
{
[Key]
public int Id { get; set; }
public bool Gender { get; set; }
public int Top { get; set; }
public int Torso { get; set; }
public int Undershirt { get; set; }
}
}

View File

@@ -13,24 +13,24 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class Door
{
[Key]
public int Id { get; set; }
public string Category { get; set; }
public string Name { get; set; }
public bool Locked { get; set; }
public int Model { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public float Radius { get; set; }
public class Door
{
[Key]
public int Id { get; set; }
public string Category { get; set; }
public string Name { get; set; }
public bool Locked { get; set; }
public int Model { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public float Radius { get; set; }
[NotMapped]
public Vector3 Position => new Vector3(X, Y, Z);
[NotMapped]
public Vector3 Position => new Vector3(X, Y, Z);
[ForeignKey("FactionId")]
public int? FactionId { get; set; }
public Faction Faction { get; set; }
}
[ForeignKey("FactionId")]
public int? FactionId { get; set; }
public Faction Faction { get; set; }
}
}

View File

@@ -12,20 +12,20 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class DutyCloth
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class DutyCloth
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("Faction")]
public int FactionId { get; set; }
public Faction Faction { get; set; }
[ForeignKey("Faction")]
public int FactionId { get; set; }
public Faction Faction { get; set; }
public bool Gender { get; set; }
public bool Gender { get; set; }
public byte SlotType { get; set; }
public int SlotId { get; set; }
public int ClothId { get; set; }
}
public byte SlotType { get; set; }
public int SlotId { get; set; }
public int ClothId { get; set; }
}
}

View File

@@ -12,28 +12,28 @@ using System.Linq;
namespace ReallifeGamemode.Server.Entities
{
public class Faction : IBankAccountOwner
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[StringLength(32)]
public string Name { get; set; }
public bool StateOwned { get; set; }
public class Faction : IBankAccountOwner
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[StringLength(32)]
public string Name { get; set; }
public bool StateOwned { get; set; }
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
{
if (databaseContext == null)
{
using (databaseContext = new DatabaseContext())
{
if (databaseContext == null)
{
using (databaseContext = new DatabaseContext())
{
return databaseContext.FactionBankAccounts.FirstOrDefault(u => u.FactionId == this.Id);
}
}
else
{
return databaseContext.FactionBankAccounts.FirstOrDefault(u => u.FactionId == this.Id);
}
return databaseContext.FactionBankAccounts.FirstOrDefault(u => u.FactionId == this.Id);
}
}
else
{
return databaseContext.FactionBankAccounts.FirstOrDefault(u => u.FactionId == this.Id);
}
}
}
}

View File

@@ -13,19 +13,19 @@ using System.Text;
*/
namespace ReallifeGamemode.Server.Entities
{
public class FactionBankAccount : IBankAccount
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("Faction")]
public int FactionId { get; set; }
public Faction Faction { get; set; }
[StringLength(12)]
public string Bic { get; set; }
[StringLength(32)]
public string Iban { get; set; }
public int Balance { get; set; }
public bool Active { get; set; }
}
public class FactionBankAccount : IBankAccount
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("Faction")]
public int FactionId { get; set; }
public Faction Faction { get; set; }
[StringLength(12)]
public string Bic { get; set; }
[StringLength(32)]
public string Iban { get; set; }
public int Balance { get; set; }
public bool Active { get; set; }
}
}

View File

@@ -4,23 +4,23 @@ using System.Linq;
namespace ReallifeGamemode.Server.Entities
{
public class FactionRank
public class FactionRank
{
[Key]
public int Id { get; set; }
public string RankName { get; set; }
public int Order { get; set; }
public int FactionId { get; set; }
public Faction Faction { get; set; }
public Faction GetFaction()
{
[Key]
public int Id { get; set; }
public string RankName { get; set; }
public int Order { get; set; }
public int FactionId { get; set; }
public Faction Faction { get; set; }
public Faction GetFaction()
{
using (var context = new DatabaseContext())
{
return context.Factions.FirstOrDefault(f => f.Id == FactionId);
}
}
using (var context = new DatabaseContext())
{
return context.Factions.FirstOrDefault(f => f.Id == FactionId);
}
}
}
}

View File

@@ -10,24 +10,24 @@ using System.Linq;
namespace ReallifeGamemode.Server.Entities
{
[Table("FactionVehicles")]
public class FactionVehicle : ServerVehicle
[Table("FactionVehicles")]
public class FactionVehicle : ServerVehicle
{
[ForeignKey("Faction")]
public int? FactionId { get; set; }
public Faction Faction { get; set; }
public Faction GetFaction()
{
[ForeignKey("Faction")]
public int? FactionId { get; set; }
public Faction Faction { get; set; }
public Faction GetFaction()
{
using (var context = new DatabaseContext())
{
return context.Factions.FirstOrDefault(f => f.Id == FactionId);
}
}
public override string ToString()
{
return "Fraktions Fahrzeug | Fraktion: " + GetFaction().Name;
}
using (var context = new DatabaseContext())
{
return context.Factions.FirstOrDefault(f => f.Id == FactionId);
}
}
public override string ToString()
{
return "Fraktions Fahrzeug | Fraktion: " + GetFaction().Name;
}
}
}

View File

@@ -13,16 +13,16 @@ using ReallifeGamemode.Server.Entities;
namespace ReallifeGamemode.Server.Entities
{
public class GotoPoint
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[StringLength(32)]
public string Description { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public bool Active { get; set; }
}
public class GotoPoint
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[StringLength(32)]
public string Description { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public bool Active { get; set; }
}
}

View File

@@ -10,42 +10,42 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class Group : IBankAccountOwner
public class Group : IBankAccountOwner
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
GroupBankAccount bankAccount = null;
if (databaseContext == null)
{
using (databaseContext = new DatabaseContext())
{
GroupBankAccount bankAccount = null;
if (databaseContext == null)
{
using (databaseContext = new DatabaseContext())
{
bankAccount = databaseContext.GroupBankAccounts.Include(g => g.Group).Where(g => g.Group == this).FirstOrDefault();
}
}
else
{
bankAccount = databaseContext.GroupBankAccounts.Include(g => g.Group).Where(g => g.Group == this).FirstOrDefault();
}
if (bankAccount == null)
{
bankAccount = new GroupBankAccount
{
Group = this,
Balance = 0
};
databaseContext.GroupBankAccounts.Add(bankAccount);
databaseContext.SaveChanges();
}
return bankAccount;
bankAccount = databaseContext.GroupBankAccounts.Include(g => g.Group).Where(g => g.Group == this).FirstOrDefault();
}
}
else
{
bankAccount = databaseContext.GroupBankAccounts.Include(g => g.Group).Where(g => g.Group == this).FirstOrDefault();
}
if (bankAccount == null)
{
bankAccount = new GroupBankAccount
{
Group = this,
Balance = 0
};
databaseContext.GroupBankAccounts.Add(bankAccount);
databaseContext.SaveChanges();
}
return bankAccount;
}
}
}

View File

@@ -7,14 +7,14 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class GroupBankAccount : IBankAccount
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class GroupBankAccount : IBankAccount
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public Group Group { get; set; }
public Group Group { get; set; }
public int Balance { get; set; }
}
public int Balance { get; set; }
}
}

View File

@@ -8,17 +8,17 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class GroupVehicle : ServerVehicle
public class GroupVehicle : ServerVehicle
{
public Group Group { get; set; }
[ForeignKey("Group")]
public int? GroupId { get; set; }
public override string ToString()
{
public Group Group { get; set; }
[ForeignKey("Group")]
public int? GroupId { get; set; }
public override string ToString()
{
using(var dbContext = new DatabaseContext())
return "Gruppen Fahrzeug | Gruppe: " + dbContext.GroupVehicles.Include(g => g.Group).First(g => g.Id == this.Id).Group.Name;
}
using (var dbContext = new DatabaseContext())
return "Gruppen Fahrzeug | Gruppe: " + dbContext.GroupVehicles.Include(g => g.Group).First(g => g.Id == this.Id).Group.Name;
}
}
}

View File

@@ -9,28 +9,28 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class House
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class House
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Type { get; set; }
public string Type { get; set; }
public int Price { get; set; }
public int Price { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
[NotMapped]
public Vector3 Position => new Vector3(X, Y, Z);
[NotMapped]
public Vector3 Position => new Vector3(X, Y, Z);
[ForeignKey("Owner")]
public int? OwnerId { get; set; }
public User Owner { get; set; }
[ForeignKey("Owner")]
public int? OwnerId { get; set; }
public User Owner { get; set; }
[NotMapped]
public Client User => Owner?.Client;
}
[NotMapped]
public Client User => Owner?.Client;
}
}

View File

@@ -8,68 +8,68 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class Interior
public class Interior
{
[NotMapped]
private Vector3 _enterPosition;
[NotMapped]
private Vector3 _exitPosition;
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
[Column("EnterPosition")]
public string EnterPositionStr
{
[NotMapped]
private Vector3 _enterPosition;
[NotMapped]
private Vector3 _exitPosition;
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
[Column("EnterPosition")]
public string EnterPositionStr
{
get
{
return JsonConvert.SerializeObject(this._enterPosition);
}
set
{
this._enterPosition = JsonConvert.DeserializeObject<Vector3>(value);
}
}
[Column("ExitPosition")]
public string ExitPositionStr
{
get
{
return JsonConvert.SerializeObject(this._exitPosition);
}
set
{
this._exitPosition = JsonConvert.DeserializeObject<Vector3>(value);
}
}
[NotMapped]
public Vector3 EnterPosition
{
get
{
return this._enterPosition;
}
set
{
this._enterPosition = value;
}
}
[NotMapped]
public Vector3 ExitPosition
{
get
{
return this._exitPosition;
}
set
{
this._exitPosition = value;
}
}
get
{
return JsonConvert.SerializeObject(this._enterPosition);
}
set
{
this._enterPosition = JsonConvert.DeserializeObject<Vector3>(value);
}
}
[Column("ExitPosition")]
public string ExitPositionStr
{
get
{
return JsonConvert.SerializeObject(this._exitPosition);
}
set
{
this._exitPosition = JsonConvert.DeserializeObject<Vector3>(value);
}
}
[NotMapped]
public Vector3 EnterPosition
{
get
{
return this._enterPosition;
}
set
{
this._enterPosition = value;
}
}
[NotMapped]
public Vector3 ExitPosition
{
get
{
return this._exitPosition;
}
set
{
this._exitPosition = value;
}
}
}
}

View File

@@ -9,16 +9,16 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class JobVehicle : ServerVehicle
public class JobVehicle : ServerVehicle
{
public int JobId { get; set; }
public JobBase GetJob() => JobManager.GetJob(JobId);
public override string ToString()
{
public int JobId { get; set; }
public JobBase GetJob() => JobManager.GetJob(JobId);
public override string ToString()
{
using (var dbContext = new DatabaseContext())
return "Job Fahrzeug | Job: " + this.GetJob().Name;
}
using (var dbContext = new DatabaseContext())
return "Job Fahrzeug | Job: " + this.GetJob().Name;
}
}
}

View File

@@ -12,25 +12,25 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities.Logs
{
public class BankAccountTransactionHistory
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class BankAccountTransactionHistory
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[StringLength(32)]
public string Sender { get; set; }
public int SenderBalance { get; set; }
public int MoneySent { get; set; }
[StringLength(32)]
public string Receiver { get; set; }
public int ReceiverBalance { get; set; }
public int NewSenderBalance { get; set; }
public int NewReceiverBalance { get; set; }
public int Fee { get; set; }
[StringLength(32)]
public string Origin { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public DateTime Timestamp { get; set; }
}
[StringLength(32)]
public string Sender { get; set; }
public int SenderBalance { get; set; }
public int MoneySent { get; set; }
[StringLength(32)]
public string Receiver { get; set; }
public int ReceiverBalance { get; set; }
public int NewSenderBalance { get; set; }
public int NewReceiverBalance { get; set; }
public int Fee { get; set; }
[StringLength(32)]
public string Origin { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public DateTime Timestamp { get; set; }
}
}

View File

@@ -13,33 +13,33 @@ using ReallifeGamemode.Server.Entities;
namespace ReallifeGamemode.Server.Entities.Logs
{
public class Death
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class Death
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("Victim")]
public int VictimId { get; set; }
public User Victim { get; set; }
[ForeignKey("Victim")]
public int VictimId { get; set; }
public User Victim { get; set; }
[ForeignKey("Killer")]
public int? KillerId { get; set; }
public User Killer { get; set; }
[ForeignKey("Killer")]
public int? KillerId { get; set; }
public User Killer { get; set; }
public float VictimPositionX { get; set; }
public float VictimPositionY { get; set; }
public float VictimPositionZ { get; set; }
public float VictimHeading { get; set; }
public float VictimPositionX { get; set; }
public float VictimPositionY { get; set; }
public float VictimPositionZ { get; set; }
public float VictimHeading { get; set; }
public float KillerPositionX { get; set; }
public float KillerPositionY { get; set; }
public float KillerPositionZ { get; set; }
public float KillerHeading { get; set; }
public float KillerPositionX { get; set; }
public float KillerPositionY { get; set; }
public float KillerPositionZ { get; set; }
public float KillerHeading { get; set; }
[StringLength(64)]
public string CauseOfDeath { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public DateTime Timestamp { get; set; }
}
[StringLength(64)]
public string CauseOfDeath { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public DateTime Timestamp { get; set; }
}
}

View File

@@ -6,19 +6,19 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class News
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class News
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("User")]
public int? UserId { get; set; }
public User User { get; set; }
[ForeignKey("User")]
public int? UserId { get; set; }
public User User { get; set; }
public string Caption { get; set; }
public string Content { get; set; }
public bool Active { get; set; }
public int Timestamp { get; set; }
}
public string Caption { get; set; }
public string Content { get; set; }
public bool Active { get; set; }
public int Timestamp { get; set; }
}
}

View File

@@ -12,27 +12,27 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace ReallifeGamemode.Server.Entities.Saves
{
public class SavedBlip
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public short Sprite { get; set; }
[Required]
public float PositionX { get; set; }
[Required]
public float PositionY { get; set; }
[Required]
public float PositionZ { get; set; }
public string Name { get; set; }
public float Scale { get; set; }
public byte Color { get; set; }
public byte Alpha { get; set; }
public float DrawDistance { get; set; }
public bool ShortRange { get; set; }
public float Rotation { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
public class SavedBlip
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public short Sprite { get; set; }
[Required]
public float PositionX { get; set; }
[Required]
public float PositionY { get; set; }
[Required]
public float PositionZ { get; set; }
public string Name { get; set; }
public float Scale { get; set; }
public byte Color { get; set; }
public byte Alpha { get; set; }
public float DrawDistance { get; set; }
public bool ShortRange { get; set; }
public float Rotation { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
}

View File

@@ -12,28 +12,28 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace ReallifeGamemode.Server.Entities.Saves
{
public class SavedMarker
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public byte Type { get; set; }
public float PositionX { get; set; }
public float PositionY { get; set; }
public float PositionZ { get; set; }
public float Scale { get; set; }
public float DirectionX { get; set; }
public float DirectionY { get; set; }
public float DirectionZ { get; set; }
public float RotationX { get; set; }
public float RotationY { get; set; }
public float RotationZ { get; set; }
public byte ColorR { get; set; }
public byte ColorG { get; set; }
public byte ColorB { get; set; }
public byte ColorA { get; set; }
public bool Visible { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
public class SavedMarker
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public byte Type { get; set; }
public float PositionX { get; set; }
public float PositionY { get; set; }
public float PositionZ { get; set; }
public float Scale { get; set; }
public float DirectionX { get; set; }
public float DirectionY { get; set; }
public float DirectionZ { get; set; }
public float RotationX { get; set; }
public float RotationY { get; set; }
public float RotationZ { get; set; }
public byte ColorR { get; set; }
public byte ColorG { get; set; }
public byte ColorB { get; set; }
public byte ColorA { get; set; }
public bool Visible { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
}

View File

@@ -12,17 +12,17 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace ReallifeGamemode.Server.Entities.Saves
{
public class SavedPed
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string HashModel { get; set; }
public float PositionX { get; set; }
public float PositionY { get; set; }
public float PositionZ { get; set; }
public float Heading { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
public class SavedPed
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string HashModel { get; set; }
public float PositionX { get; set; }
public float PositionY { get; set; }
public float PositionZ { get; set; }
public float Heading { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
}

View File

@@ -12,21 +12,21 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace ReallifeGamemode.Server.Entities.Saves
{
public class SavedPickup
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[StringLength(128)]
public float PositionX { get; set; }
public float PositionY { get; set; }
public float PositionZ { get; set; }
public float RotationX { get; set; }
public float RotationY { get; set; }
public float RotationZ { get; set; }
public bool Vehicle { get; set; }
public int RespawnTime { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
public class SavedPickup
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[StringLength(128)]
public float PositionX { get; set; }
public float PositionY { get; set; }
public float PositionZ { get; set; }
public float RotationX { get; set; }
public float RotationY { get; set; }
public float RotationZ { get; set; }
public bool Vehicle { get; set; }
public int RespawnTime { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
}

View File

@@ -12,27 +12,27 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace ReallifeGamemode.Server.Entities.Saves
{
public class SavedTextLabel
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public string Text { get; set; }
[Required]
public float PositionX { get; set; }
[Required]
public float PositionY { get; set; }
[Required]
public float PositionZ { get; set; }
public bool LOS { get; set; }
public byte Font { get; set; }
public float DrawDistance { get; set; }
public byte ColorR { get; set; }
public byte ColorG { get; set; }
public byte ColorB { get; set; }
public byte ColorA { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
public class SavedTextLabel
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
public string Text { get; set; }
[Required]
public float PositionX { get; set; }
[Required]
public float PositionY { get; set; }
[Required]
public float PositionZ { get; set; }
public bool LOS { get; set; }
public byte Font { get; set; }
public float DrawDistance { get; set; }
public byte ColorR { get; set; }
public byte ColorG { get; set; }
public byte ColorB { get; set; }
public byte ColorA { get; set; }
public byte Dimension { get; set; }
public bool Active { get; set; }
}
}

View File

@@ -14,11 +14,11 @@ using ReallifeGamemode.Server.Entities;
namespace ReallifeGamemode.Server.Entities.Saves
{
public class SavedVehicle : ServerVehicle
public class SavedVehicle : ServerVehicle
{
public override string ToString()
{
public override string ToString()
{
return "Gespeichertes Fahrzeug";
}
return "Gespeichertes Fahrzeug";
}
}
}

View File

@@ -7,85 +7,85 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace ReallifeGamemode.Server.Entities
{
public abstract class ServerVehicle
public abstract class ServerVehicle
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public VehicleHash Model { get; set; }
public float PositionX { get; set; }
public float PositionY { get; set; }
public float PositionZ { get; set; }
public float Heading { get; set; }
[StringLength(8)]
public string NumberPlate { get; set; }
public int PrimaryColor { get; set; }
public int SecondaryColor { get; set; }
public bool Locked { get; set; }
public bool Active { get; set; }
public float DistanceDriven { get; set; }
public float TankAmount { get; set; }
[NotMapped]
public Vector3 Position => new Vector3(PositionX, PositionY, PositionZ);
[NotMapped]
public Vehicle Vehicle => VehicleManager.GetVehicleFromServerVehicle(this);
public Vehicle Spawn(Vehicle currentVeh = null)
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
if (currentVeh != null) VehicleManager.DeleteVehicle(currentVeh);
Vector3 position = this.Position;
uint model = (uint)this.Model;
float heading = this.Heading;
int c1 = this.PrimaryColor;
int c2 = this.SecondaryColor;
string np = this.NumberPlate;
Vehicle veh = NAPI.Vehicle.CreateVehicle(Model, position, heading, c1, c2, "", 255, false, false);
VehicleStreaming.SetEngineState(veh, false);
VehicleStreaming.SetLockStatus(veh, this.Locked);
VehicleManager.AddVehicle(this, veh);
public VehicleHash Model { get; set; }
public float PositionX { get; set; }
public float PositionY { get; set; }
public float PositionZ { get; set; }
public float Heading { get; set; }
[StringLength(8)]
public string NumberPlate { get; set; }
public int PrimaryColor { get; set; }
public int SecondaryColor { get; set; }
public bool Locked { get; set; }
public bool Active { get; set; }
public float DistanceDriven { get; set; }
public float TankAmount { get; set; }
veh.SetSharedData("drivenDistance", this.DistanceDriven);
[NotMapped]
public Vector3 Position => new Vector3(PositionX, PositionY, PositionZ);
string numberplate = $"{this.Id}";
[NotMapped]
public Vehicle Vehicle => VehicleManager.GetVehicleFromServerVehicle(this);
if (this is FactionVehicle fV)
{
numberplate = $"F{fV.FactionId} " + numberplate;
}
public Vehicle Spawn(Vehicle currentVeh = null)
{
if (currentVeh != null) VehicleManager.DeleteVehicle(currentVeh);
Vector3 position = this.Position;
uint model = (uint)this.Model;
float heading = this.Heading;
int c1 = this.PrimaryColor;
int c2 = this.SecondaryColor;
string np = this.NumberPlate;
Vehicle veh = NAPI.Vehicle.CreateVehicle(Model, position, heading, c1, c2, "", 255, false, false);
VehicleStreaming.SetEngineState(veh, false);
VehicleStreaming.SetLockStatus(veh, this.Locked);
VehicleManager.AddVehicle(this, veh);
if (this is UserVehicle uV)
{
numberplate = $"U{uV.UserId} " + numberplate;
}
veh.SetSharedData("drivenDistance", this.DistanceDriven);
if (this is ShopVehicle sV)
{
numberplate = "Shop";
VehicleStreaming.SetLockStatus(veh, false);
TextLabel label = NAPI.TextLabel.CreateTextLabel("SHOPVEHICLE\n" + "~g~" + sV.Price.ToMoneyString(),
veh.Position.Add(new Vector3(0, 0, 1.3)), 10.0f, 1f, 1, new Color(255, 255, 255));
string numberplate = $"{this.Id}";
veh.SetSharedData("shopVehicleTextLabel", label.Handle.Value);
}
if (this is FactionVehicle fV)
{
numberplate = $"F{fV.FactionId} " + numberplate;
}
if (this is GroupVehicle gV)
{
numberplate = $"G{gV.GroupId} " + numberplate;
}
if (this is UserVehicle uV)
{
numberplate = $"U{uV.UserId} " + numberplate;
}
if (this is JobVehicle jV)
{
numberplate = $"J{jV.JobId} " + numberplate;
}
if (this is ShopVehicle sV)
{
numberplate = "Shop";
VehicleStreaming.SetLockStatus(veh, false);
TextLabel label = NAPI.TextLabel.CreateTextLabel("SHOPVEHICLE\n" + "~g~" + sV.Price.ToMoneyString(),
veh.Position.Add(new Vector3(0, 0, 1.3)), 10.0f, 1f, 1, new Color(255, 255, 255));
veh.NumberPlate = numberplate;
veh.SetSharedData("shopVehicleTextLabel", label.Handle.Value);
}
if (this is GroupVehicle gV)
{
numberplate = $"G{gV.GroupId} " + numberplate;
}
if(this is JobVehicle jV)
{
numberplate = $"J{jV.JobId} " + numberplate;
}
veh.NumberPlate = numberplate;
return veh;
}
public abstract override string ToString();
return veh;
}
public abstract override string ToString();
}
}

View File

@@ -16,15 +16,15 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
[Table("ShopVehicles")]
public class ShopVehicle : ServerVehicle
{
public int BusinessId { get; set; }
public int Price { get; set; }
[Table("ShopVehicles")]
public class ShopVehicle : ServerVehicle
{
public int BusinessId { get; set; }
public int Price { get; set; }
public override string ToString()
{
return "ShopVehicle | Shop: " + BusinessManager.GetBusiness(BusinessId).Name;
}
public override string ToString()
{
return "ShopVehicle | Shop: " + BusinessManager.GetBusiness(BusinessId).Name;
}
}
}

View File

@@ -7,19 +7,19 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class TuningGarage
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class TuningGarage
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public float X { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public float Z { get; set; }
[NotMapped]
public Vector3 Position => new Vector3(X, Y, Z);
}
[NotMapped]
public Vector3 Position => new Vector3(X, Y, Z);
}
}

View File

@@ -17,101 +17,101 @@ using System.Linq;
namespace ReallifeGamemode.Server.Entities
{
public class User : IBankAccountOwner
public class User : IBankAccountOwner
{
[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
{
[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;
Client.TriggerEvent("SERVER:SetWanteds", value);
}
}
public int Wage { get; set; }
public int JailTime { get; set; }
public bool IsAdmin(AdminLevel level) => AdminLevel >= level;
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
{
if (databaseContext == null)
{
using (databaseContext = new DatabaseContext())
{
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
}
}
else
{
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
}
}
[NotMapped]
public Client Client
{
get => NAPI.Pools.GetAllPlayers().Where(c => c.Name.ToLower() == this.Name.ToLower()).FirstOrDefault();
}
get => _wanteds;
set
{
this._wanteds = value;
Client.TriggerEvent("SERVER:SetWanteds", value);
}
}
public int Wage { get; set; }
public int JailTime { get; set; }
public bool IsAdmin(AdminLevel level) => AdminLevel >= level;
public IBankAccount GetBankAccount(DatabaseContext databaseContext = null)
{
if (databaseContext == null)
{
using (databaseContext = new DatabaseContext())
{
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
}
}
else
{
return databaseContext.UserBankAccounts.FirstOrDefault(u => u.UserId == this.Id);
}
}
[NotMapped]
public Client Client
{
get => NAPI.Pools.GetAllPlayers().Where(c => c.Name.ToLower() == this.Name.ToLower()).FirstOrDefault();
}
}
}

View File

@@ -13,33 +13,33 @@ using System.Linq;
namespace ReallifeGamemode.Server.Entities
{
public class UserBankAccount : IBankAccount
{
[NotMapped]
private int _balance;
public class UserBankAccount : IBankAccount
{
[NotMapped]
private int _balance;
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
[StringLength(12)]
public string Bic { get; set; }
[StringLength(32)]
public string Iban { get; set; }
public int Balance
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
[StringLength(12)]
public string Bic { get; set; }
[StringLength(32)]
public string Iban { get; set; }
public int Balance
{
get => _balance;
set
{
_balance = value;
using (var dbContext = new DatabaseContext())
{
get => _balance;
set
{
_balance = value;
using (var dbContext = new DatabaseContext())
{
ClientService.GetClientByNameOrId(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
}
}
ClientService.GetClientByNameOrId(dbContext.Users.First(u => u.Id == UserId).Name).TriggerEvent("updateMoney", value);
}
public bool Active { get; set; }
}
}
public bool Active { get; set; }
}
}

View File

@@ -11,27 +11,27 @@ using System.Linq;
namespace ReallifeGamemode.Server.Entities
{
public class UserItem
public class UserItem
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int ItemId { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
public int Amount { get; set; }
public int Slot { get; set; }
public User GetUser()
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int ItemId { get; set; }
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
public int Amount { get; set; }
public int Slot { get; set; }
public User GetUser()
{
using (var dbContext = new DatabaseContext())
{
return dbContext.Users.FirstOrDefault(u => u.Id == UserId);
}
}
using (var dbContext = new DatabaseContext())
{
return dbContext.Users.FirstOrDefault(u => u.Id == UserId);
}
}
}
}

View File

@@ -10,31 +10,31 @@ using System.Linq;
namespace ReallifeGamemode.Server.Entities
{
[Table("UserVehicles")]
public class UserVehicle : ServerVehicle
[Table("UserVehicles")]
public class UserVehicle : ServerVehicle
{
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
public override string ToString()
{
[ForeignKey("User")]
public int UserId { get; set; }
public User User { get; set; }
public override string ToString()
{
return "Spieler Fahrzeug | Besitzer: " + GetOwner().Name;
}
public User GetOwner(DatabaseContext dbContext = null)
{
if (dbContext == null)
{
using (dbContext = new DatabaseContext())
{
return dbContext.Users.FirstOrDefault(u => u.Id == UserId);
}
}
else
{
return dbContext.Users.FirstOrDefault(u => u.Id == UserId);
}
}
return "Spieler Fahrzeug | Besitzer: " + GetOwner().Name;
}
public User GetOwner(DatabaseContext dbContext = null)
{
if (dbContext == null)
{
using (dbContext = new DatabaseContext())
{
return dbContext.Users.FirstOrDefault(u => u.Id == UserId);
}
}
else
{
return dbContext.Users.FirstOrDefault(u => u.Id == UserId);
}
}
}
}

View File

@@ -6,17 +6,17 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class VehicleMod
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public class VehicleMod
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[ForeignKey("Vehicle")]
public int ServerVehicleId { get; set; }
public ServerVehicle Vehicle { get; set; }
[ForeignKey("Vehicle")]
public int ServerVehicleId { get; set; }
public ServerVehicle Vehicle { get; set; }
public int Slot { get; set; }
public int ModId { get; set; }
}
public int Slot { get; set; }
public int ModId { get; set; }
}
}

View File

@@ -6,11 +6,11 @@ using System.Text;
namespace ReallifeGamemode.Server.Entities
{
public class Whitelist
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string SocialClubName { get; set; }
}
public class Whitelist
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string SocialClubName { get; set; }
}
}