diff --git a/EvoMp/EvoMp.Module.VehicleHandler/EvoMp.Module.VehicleHandler.csproj b/EvoMp/EvoMp.Module.VehicleHandler/EvoMp.Module.VehicleHandler.csproj index a2a929a..742f77e 100644 --- a/EvoMp/EvoMp.Module.VehicleHandler/EvoMp.Module.VehicleHandler.csproj +++ b/EvoMp/EvoMp.Module.VehicleHandler/EvoMp.Module.VehicleHandler.csproj @@ -61,6 +61,9 @@ + + + diff --git a/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/ComponentDto.cs b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/ComponentDto.cs new file mode 100644 index 0000000..c0a3599 --- /dev/null +++ b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/ComponentDto.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using EvoMp.Module.VehicleHandler.Server.Enum; +using GrandTheftMultiplayer.Shared; +using GrandTheftMultiplayer.Shared.Math; + +namespace EvoMp.Module.VehicleHandler.Server.Entity +{ + [Table("VehicleComponents")] + public class ComponentDto + { + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Key, Column(Order = 0)] + public VehicleDto ComponentId { get; set; } + + [Key, Column("Slot", Order = 1)] + public int Slot { get; set; } + + [Key, Column("Value", Order = 2)] + public int Value { get; set; } + + } +} diff --git a/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleColorDto.cs b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleColorDto.cs new file mode 100644 index 0000000..837fb94 --- /dev/null +++ b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleColorDto.cs @@ -0,0 +1,25 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using EvoMp.Module.VehicleHandler.Server.Enum; +using GrandTheftMultiplayer.Shared; +using GrandTheftMultiplayer.Shared.Math; + +namespace EvoMp.Module.VehicleHandler.Server.Entity +{ + [Table("VehicleColors")] + public class VehicleColorDto + { + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + [Key, Column(Order = 0)] + public int VehicleColorId { get; set; } + + [Key, Column("Red", Order = 1)] + public int Red { get; set; } + + [Key, Column("Green", Order = 2)] + public int Green { get; set; } + + [Key, Column("Blue", Order = 3)] + public int Blue { get; set; } + } +} diff --git a/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleComponentDto.cs b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleComponentDto.cs new file mode 100644 index 0000000..cad799b --- /dev/null +++ b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleComponentDto.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using EvoMp.Module.VehicleHandler.Server.Enum; +using GrandTheftMultiplayer.Shared; +using GrandTheftMultiplayer.Shared.Math; + +namespace EvoMp.Module.VehicleHandler.Server.Entity +{ + [Table("VehicleComponentMappings")] + public class VehicleComponentDto + { + [Key] + public VehicleDto Vehicle { get; set; } + + [Key, Column(Order = 1)] + public ComponentDto Component { get; set; } + } +} diff --git a/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleContext.cs b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleContext.cs index 5e9c933..af83fc3 100644 --- a/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleContext.cs +++ b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleContext.cs @@ -11,11 +11,18 @@ public VehicleContext() : base(Environment.GetEnvironmentVariable("NameOrConnect { } - // Tables + #region Tables public DbSet Vehicles { get; set; } public DbSet DoorStates { get; set; } + //public DbSet Components { get; set; } + + //public DbSet VehicleComponents { get; set; } + + public DbSet VehicleColors { get; set; } + #endregion Tables + // Overwriting Convention to allow private fields protected override void OnModelCreating(DbModelBuilder modelBuilder) { diff --git a/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleDto.cs b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleDto.cs index 660901b..5402d34 100644 --- a/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleDto.cs +++ b/EvoMp/EvoMp.Module.VehicleHandler/Server/Entity/VehicleDto.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using EvoMp.Module.VehicleHandler.Server.Enum; @@ -61,8 +62,11 @@ public Vector3 Rotation [Column("Zr")] private double Zr { get; set; } - //public string PrimaryColorID { get; set; } - //public string SecondaryColorID { get; set; } + [Column("PrimaryColor")] + public VehicleColorDto PrimaryColor { get; set; } + + [Column("SecondaryColor")] + public VehicleColorDto SecondaryColor { get; set; } [Column("NumberplateValue")] public string NumberplateValue { get; set; }