converted jobs to same system as businesses, add option to choose job at cityhall
This commit is contained in:
@@ -15,11 +15,14 @@ export default function (globalData: GlobalData) {
|
|||||||
|
|
||||||
var keyBound = false;
|
var keyBound = false;
|
||||||
var menu: NativeUI.Menu = null;
|
var menu: NativeUI.Menu = null;
|
||||||
|
var joblist: string[] = [];
|
||||||
|
|
||||||
mp.events.add("SERVER:CityHall_ShowHelpText", () => {
|
mp.events.add("SERVER:CityHall_ShowHelpText", (joblista) => {
|
||||||
mp.game.ui.setTextComponentFormat('STRING');
|
mp.game.ui.setTextComponentFormat('STRING');
|
||||||
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Stadthallen-Menü zu öffnen');
|
mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Stadthallen-Menü zu öffnen');
|
||||||
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
|
mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1);
|
||||||
|
|
||||||
|
joblist = JSON.parse(joblista);
|
||||||
|
|
||||||
if (!keyBound) {
|
if (!keyBound) {
|
||||||
keyBound = true;
|
keyBound = true;
|
||||||
@@ -29,6 +32,7 @@ export default function (globalData: GlobalData) {
|
|||||||
|
|
||||||
mp.events.add("SERVER:CityHall_ClearHelpText", () => {
|
mp.events.add("SERVER:CityHall_ClearHelpText", () => {
|
||||||
mp.game.ui.clearHelp(false);
|
mp.game.ui.clearHelp(false);
|
||||||
|
if (menu) menu.Close();
|
||||||
if (keyBound) {
|
if (keyBound) {
|
||||||
mp.keys.unbind(0x45, false, keyPressHandler);
|
mp.keys.unbind(0x45, false, keyPressHandler);
|
||||||
keyBound = false;
|
keyBound = false;
|
||||||
@@ -45,11 +49,32 @@ export default function (globalData: GlobalData) {
|
|||||||
var jobItem = new UIMenuItem("Jobs", "Jobcenter");
|
var jobItem = new UIMenuItem("Jobs", "Jobcenter");
|
||||||
menu.AddItem(jobItem);
|
menu.AddItem(jobItem);
|
||||||
|
|
||||||
var jobMenu = new Menu("Jobcenter", "Hartz 4 und der Tag gehoert dir.", new Point(50, 50), null, null);
|
var jobMenu = new Menu("Jobcenter", "Suche dir einen neuen Job aus", new Point(50, 50), null, null);
|
||||||
jobMenu.Visible = false;
|
|
||||||
|
for (var i = 0; i < joblist.length; i++) {
|
||||||
|
var job = joblist[i];
|
||||||
|
jobMenu.AddItem(new UIMenuItem(job));
|
||||||
|
}
|
||||||
|
|
||||||
|
var cancelJobItem = new UIMenuItem("Job kuendigen");
|
||||||
|
cancelJobItem.BackColor = new Color(213, 0, 0);
|
||||||
|
cancelJobItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||||
|
jobMenu.AddItem(cancelJobItem);
|
||||||
|
|
||||||
menu.BindMenuToItem(jobMenu, jobItem);
|
menu.BindMenuToItem(jobMenu, jobItem);
|
||||||
|
|
||||||
|
jobMenu.ItemSelect.on((item: NativeUI.UIMenuItem, index: number) => {
|
||||||
|
if (item === cancelJobItem) { // Job kündigen
|
||||||
|
mp.events.callRemote("CLIENT:JobCenter_CancelJob");
|
||||||
|
} else {
|
||||||
|
mp.events.callRemote("CLIENT:JobCenter_AcceptJob", index + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu.Close();
|
||||||
|
});
|
||||||
|
|
||||||
|
jobMenu.Visible = false;
|
||||||
|
|
||||||
var groupCreateItem = new UIMenuItem("Gruppe erstellen", "Erstelle eine neue Gruppe");
|
var groupCreateItem = new UIMenuItem("Gruppe erstellen", "Erstelle eine neue Gruppe");
|
||||||
groupCreateItem.SetRightLabel("~g~50.000$");
|
groupCreateItem.SetRightLabel("~g~50.000$");
|
||||||
menu.AddItem(groupCreateItem);
|
menu.AddItem(groupCreateItem);
|
||||||
@@ -59,6 +84,8 @@ export default function (globalData: GlobalData) {
|
|||||||
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
|
||||||
menu.AddItem(cancelItem);
|
menu.AddItem(cancelItem);
|
||||||
|
|
||||||
|
menu.Open();
|
||||||
|
|
||||||
menu.ItemSelect.on((item: NativeUI.UIMenuItem, index) => {
|
menu.ItemSelect.on((item: NativeUI.UIMenuItem, index) => {
|
||||||
if (item === groupCreateItem) { // Gruppe
|
if (item === groupCreateItem) { // Gruppe
|
||||||
var input = new InputHelper("Wie soll die Gruppe heißen?", globalData);
|
var input = new InputHelper("Wie soll die Gruppe heißen?", globalData);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ namespace ReallifeGamemode.Server.Business
|
|||||||
public abstract class BusinessBase : IBankAccountOwner
|
public abstract class BusinessBase : IBankAccountOwner
|
||||||
{
|
{
|
||||||
private TextLabel _informationLabel;
|
private TextLabel _informationLabel;
|
||||||
private Marker _marker;
|
|
||||||
private ColShape _colShape;
|
private ColShape _colShape;
|
||||||
|
|
||||||
public abstract int Id { get; }
|
public abstract int Id { get; }
|
||||||
@@ -36,7 +35,7 @@ namespace ReallifeGamemode.Server.Business
|
|||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_informationLabel = NAPI.TextLabel.CreateTextLabel(Name, Position.Add(new Vector3(0, 0, 0.5)), 20.0f, 1.3f, 0, new Color(255, 255, 255));
|
_informationLabel = NAPI.TextLabel.CreateTextLabel(Name, Position.Add(new Vector3(0, 0, 0.5)), 20.0f, 1.3f, 0, new Color(255, 255, 255));
|
||||||
_marker = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, Position.Subtract(new Vector3(0, 0, 1.5)), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255));
|
NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, Position.Subtract(new Vector3(0, 0, 1.5)), new Vector3(), new Vector3(), 1f, new Color(255, 255, 255));
|
||||||
|
|
||||||
_colShape = NAPI.ColShape.CreateSphereColShape(Position.Subtract(new Vector3(0, 0, 1.5)), 3f);
|
_colShape = NAPI.ColShape.CreateSphereColShape(Position.Subtract(new Vector3(0, 0, 1.5)), 3f);
|
||||||
_colShape.OnEntityEnterColShape += EntityEnterBusinessColShape;
|
_colShape.OnEntityEnterColShape += EntityEnterBusinessColShape;
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace ReallifeGamemode.Server.Entities
|
|
||||||
{
|
|
||||||
public class Job
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
public string Name { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using ReallifeGamemode.Server.Job;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
using ReallifeGamemode.Server.Models;
|
using ReallifeGamemode.Server.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -9,11 +11,14 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
{
|
{
|
||||||
public class JobVehicle : ServerVehicle
|
public class JobVehicle : ServerVehicle
|
||||||
{
|
{
|
||||||
public virtual Job Job { get; set; }
|
public int JobId { get; set; }
|
||||||
|
|
||||||
|
public JobBase GetJob() => JobManager.GetJob(JobId);
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
using (var dbContext = new DatabaseContext())
|
using (var dbContext = new DatabaseContext())
|
||||||
return "Job Fahrzeug | Job: " + dbContext.JobVehicles.Include(j => j.Job).First(j => j.Id == this.Id).Job.Name;
|
return "Job Fahrzeug | Job: " + this.GetJob().Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using ReallifeGamemode.Server.Business;
|
using ReallifeGamemode.Server.Business;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
using ReallifeGamemode.Server.Util;
|
using ReallifeGamemode.Server.Util;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -23,7 +24,7 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "ShopVehicle";
|
return "ShopVehicle | Shop: " + BusinessManager.GetBusiness(BusinessId).Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace ReallifeGamemode.Server.Entities
|
|||||||
|
|
||||||
public GroupRank GroupRank { get; set; }
|
public GroupRank GroupRank { get; set; }
|
||||||
|
|
||||||
public Job Job { get; set; }
|
public int? JobId { get; set; }
|
||||||
|
|
||||||
public FactionRank GetFactionRank()
|
public FactionRank GetFactionRank()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
.Include(u => u.Faction)
|
.Include(u => u.Faction)
|
||||||
.Include(u => u.FactionRank)
|
.Include(u => u.FactionRank)
|
||||||
.Include(u => u.Group)
|
.Include(u => u.Group)
|
||||||
.Include(u => u.Job)
|
|
||||||
.Where(u => u.Name == client.Name)
|
.Where(u => u.Name == client.Name)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|||||||
47
ReallifeGamemode.Server/Job/JobBase.cs
Normal file
47
ReallifeGamemode.Server/Job/JobBase.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Server.Entities;
|
||||||
|
using ReallifeGamemode.Server.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Job
|
||||||
|
{
|
||||||
|
public abstract class JobBase
|
||||||
|
{
|
||||||
|
protected delegate void JobStartHandler();
|
||||||
|
protected delegate void JobStopHandler();
|
||||||
|
|
||||||
|
protected event JobStartHandler JobStart;
|
||||||
|
protected event JobStopHandler JobStop;
|
||||||
|
|
||||||
|
private readonly List<Client> _inJob = new List<Client>();
|
||||||
|
|
||||||
|
public abstract int Id { get; }
|
||||||
|
|
||||||
|
public abstract string Name { get; }
|
||||||
|
|
||||||
|
public void StartJob(Client player)
|
||||||
|
{
|
||||||
|
_inJob.Add(player);
|
||||||
|
JobStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopJob(Client player)
|
||||||
|
{
|
||||||
|
_inJob.Remove(player);
|
||||||
|
JobStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<JobVehicle> GetJobVehicles()
|
||||||
|
{
|
||||||
|
using(var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
return dbContext.JobVehicles.Where(j => j.JobId == Id).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Client> GetUsersInJob() => _inJob;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
ReallifeGamemode.Server/Job/PilotJob.cs
Normal file
13
ReallifeGamemode.Server/Job/PilotJob.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Job
|
||||||
|
{
|
||||||
|
class PilotJob : JobBase
|
||||||
|
{
|
||||||
|
public override int Id => 3;
|
||||||
|
|
||||||
|
public override string Name => "Pilot";
|
||||||
|
}
|
||||||
|
}
|
||||||
13
ReallifeGamemode.Server/Job/RefuseCollectorJob.cs
Normal file
13
ReallifeGamemode.Server/Job/RefuseCollectorJob.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Job
|
||||||
|
{
|
||||||
|
public class RefuseCollectorJob : JobBase
|
||||||
|
{
|
||||||
|
public override int Id => 2;
|
||||||
|
|
||||||
|
public override string Name => "Müllmann";
|
||||||
|
}
|
||||||
|
}
|
||||||
14
ReallifeGamemode.Server/Job/TaxiDriverJob.cs
Normal file
14
ReallifeGamemode.Server/Job/TaxiDriverJob.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using GTANetworkAPI;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Job
|
||||||
|
{
|
||||||
|
class TaxiDriverJob : JobBase
|
||||||
|
{
|
||||||
|
public override int Id => 1;
|
||||||
|
|
||||||
|
public override string Name => "Taxifahrer";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -47,6 +47,7 @@ namespace ReallifeGamemode.Server
|
|||||||
DoorManager.LoadDoors();
|
DoorManager.LoadDoors();
|
||||||
ATMManager.InitATMs();
|
ATMManager.InitATMs();
|
||||||
CityHallManager.LoadCityHall();
|
CityHallManager.LoadCityHall();
|
||||||
|
JobManager.LoadJobs();
|
||||||
|
|
||||||
|
|
||||||
TempBlip tempBlip = new TempBlip()
|
TempBlip tempBlip = new TempBlip()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using ReallifeGamemode.Server.Entities;
|
using ReallifeGamemode.Server.Entities;
|
||||||
using ReallifeGamemode.Server.Extensions;
|
using ReallifeGamemode.Server.Extensions;
|
||||||
using ReallifeGamemode.Server.Models;
|
using ReallifeGamemode.Server.Models;
|
||||||
@@ -22,7 +23,8 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
var colShape = NAPI.ColShape.CreateSphereColShape(_cityHallPosition, 1.0f);
|
var colShape = NAPI.ColShape.CreateSphereColShape(_cityHallPosition, 1.0f);
|
||||||
colShape.OnEntityEnterColShape += (s, c) =>
|
colShape.OnEntityEnterColShape += (s, c) =>
|
||||||
{
|
{
|
||||||
c.TriggerEvent("SERVER:CityHall_ShowHelpText");
|
var jobs = JobManager.GetJobs().Select(j => j.Name).ToArray();
|
||||||
|
c.TriggerEvent("SERVER:CityHall_ShowHelpText", JsonConvert.SerializeObject(jobs));
|
||||||
};
|
};
|
||||||
|
|
||||||
colShape.OnEntityExitColShape += (s, c) =>
|
colShape.OnEntityExitColShape += (s, c) =>
|
||||||
|
|||||||
100
ReallifeGamemode.Server/Managers/JobManager.cs
Normal file
100
ReallifeGamemode.Server/Managers/JobManager.cs
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
using GTANetworkAPI;
|
||||||
|
using ReallifeGamemode.Server.Entities;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
using ReallifeGamemode.Server.Job;
|
||||||
|
using ReallifeGamemode.Server.Models;
|
||||||
|
using ReallifeGamemode.Server.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Server.Managers
|
||||||
|
{
|
||||||
|
class JobManager : Script
|
||||||
|
{
|
||||||
|
private static List<JobBase> _jobs = new List<JobBase>();
|
||||||
|
|
||||||
|
public static void LoadJobs()
|
||||||
|
{
|
||||||
|
IEnumerable<Type> jobTypes = Assembly.GetExecutingAssembly().GetTypes().Where(t => t.IsSubclassOf(typeof(JobBase)) && !t.IsAbstract);
|
||||||
|
|
||||||
|
foreach (var type in jobTypes)
|
||||||
|
{
|
||||||
|
var instance = Activator.CreateInstance(type) as JobBase;
|
||||||
|
if (GetJob(instance.Id) != null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"Double Job ID found: {instance.Id} | {instance.Name}");
|
||||||
|
}
|
||||||
|
_jobs.Add(instance);
|
||||||
|
NAPI.Util.ConsoleOutput($"Loading job {instance.Name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
NAPI.Util.ConsoleOutput($"Loaded {_jobs.Count} jobs");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JobBase GetJob(int id) => _jobs.Where(j => j.Id == id).FirstOrDefault();
|
||||||
|
|
||||||
|
public static T GetJob<T>() where T : JobBase
|
||||||
|
{
|
||||||
|
return _jobs.Where(j => j.GetType() == typeof(T)).FirstOrDefault() as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<JobBase> GetJobs() => _jobs.OrderBy(j => j.Id).ToList();
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:JobCenter_CancelJob")]
|
||||||
|
public void CancelJobEvent(Client player)
|
||||||
|
{
|
||||||
|
using(var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
User u = player.GetUser(dbContext);
|
||||||
|
|
||||||
|
if (u == null) return;
|
||||||
|
|
||||||
|
if(u.JobId == null)
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Du hast momentan keinen Job, den du kündigen könntest.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
u.JobId = null;
|
||||||
|
|
||||||
|
player.SendChatMessage("~y~[JOBCENTER]~s~ Du hast deinen Job erfolgreich gekündigt.");
|
||||||
|
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[RemoteEvent("CLIENT:JobCenter_AcceptJob")]
|
||||||
|
public void AcceptJobEvent(Client player, int jobId)
|
||||||
|
{
|
||||||
|
using (var dbContext = new DatabaseContext())
|
||||||
|
{
|
||||||
|
User u = player.GetUser(dbContext);
|
||||||
|
|
||||||
|
if (u == null) return;
|
||||||
|
|
||||||
|
if (u.JobId != null)
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Du musst deinen alten Job kündigen, bevor du einen neuen ausüben kannst");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
JobBase job = JobManager.GetJob(jobId);
|
||||||
|
|
||||||
|
if(job == null)
|
||||||
|
{
|
||||||
|
ChatService.Error(player, "Bei der Job-Annahme ist ein Fehler aufgetretet: Dieser Job wurde nicht gefunden");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.SendChatMessage($"~y~[JOBCENTER]~s~ Du hast erfolgreich deinen neuen Job: ~o~{job.Name}~s~ angenommen.");
|
||||||
|
|
||||||
|
u.JobId = jobId;
|
||||||
|
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1116
ReallifeGamemode.Server/Migrations/20190516094446_JobFix.Designer.cs
generated
Normal file
1116
ReallifeGamemode.Server/Migrations/20190516094446_JobFix.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
73
ReallifeGamemode.Server/Migrations/20190516094446_JobFix.cs
Normal file
73
ReallifeGamemode.Server/Migrations/20190516094446_JobFix.cs
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace ReallifeGamemode.Migrations
|
||||||
|
{
|
||||||
|
public partial class JobFix : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_ServerVehicles_Jobs_JobId",
|
||||||
|
table: "ServerVehicles");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Users_Jobs_JobId",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Jobs");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Users_JobId",
|
||||||
|
table: "Users");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_ServerVehicles_JobId",
|
||||||
|
table: "ServerVehicles");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Jobs",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||||
|
Name = table.Column<string>(nullable: true)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Jobs", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Users_JobId",
|
||||||
|
table: "Users",
|
||||||
|
column: "JobId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ServerVehicles_JobId",
|
||||||
|
table: "ServerVehicles",
|
||||||
|
column: "JobId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_ServerVehicles_Jobs_JobId",
|
||||||
|
table: "ServerVehicles",
|
||||||
|
column: "JobId",
|
||||||
|
principalTable: "Jobs",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Users_Jobs_JobId",
|
||||||
|
table: "Users",
|
||||||
|
column: "JobId",
|
||||||
|
principalTable: "Jobs",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -420,18 +420,6 @@ namespace ReallifeGamemode.Migrations
|
|||||||
b.ToTable("Interiors");
|
b.ToTable("Interiors");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Job", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd();
|
|
||||||
|
|
||||||
b.Property<string>("Name");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Jobs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.BankAccountTransactionHistory", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.BankAccountTransactionHistory", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@@ -827,8 +815,6 @@ namespace ReallifeGamemode.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GroupId");
|
b.HasIndex("GroupId");
|
||||||
|
|
||||||
b.HasIndex("JobId");
|
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -935,9 +921,7 @@ namespace ReallifeGamemode.Migrations
|
|||||||
{
|
{
|
||||||
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
|
b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle");
|
||||||
|
|
||||||
b.Property<int?>("JobId");
|
b.Property<int>("JobId");
|
||||||
|
|
||||||
b.HasIndex("JobId");
|
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("JobVehicle");
|
b.HasDiscriminator().HasValue("JobVehicle");
|
||||||
});
|
});
|
||||||
@@ -957,8 +941,6 @@ namespace ReallifeGamemode.Migrations
|
|||||||
|
|
||||||
b.Property<int>("Price");
|
b.Property<int>("Price");
|
||||||
|
|
||||||
b.Property<int?>("ShopId");
|
|
||||||
|
|
||||||
b.ToTable("ShopVehicles");
|
b.ToTable("ShopVehicles");
|
||||||
|
|
||||||
b.HasDiscriminator().HasValue("ShopVehicle");
|
b.HasDiscriminator().HasValue("ShopVehicle");
|
||||||
@@ -1079,10 +1061,6 @@ namespace ReallifeGamemode.Migrations
|
|||||||
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("GroupId");
|
.HasForeignKey("GroupId");
|
||||||
|
|
||||||
b.HasOne("ReallifeGamemode.Server.Entities.Job", "Job")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("JobId");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b =>
|
||||||
@@ -1123,13 +1101,6 @@ namespace ReallifeGamemode.Migrations
|
|||||||
.HasForeignKey("GroupId");
|
.HasForeignKey("GroupId");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.JobVehicle", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ReallifeGamemode.Server.Entities.Job", "Job")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("JobId");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b =>
|
modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
|
b.HasOne("ReallifeGamemode.Server.Entities.User", "User")
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ namespace ReallifeGamemode.Server.Models
|
|||||||
public DbSet<Entities.GroupVehicle> GroupVehicles { get; set; }
|
public DbSet<Entities.GroupVehicle> GroupVehicles { get; set; }
|
||||||
|
|
||||||
// Jobs
|
// Jobs
|
||||||
public DbSet<Entities.Job> Jobs { get; set; }
|
|
||||||
public DbSet<Entities.JobVehicle> JobVehicles { get; set; }
|
public DbSet<Entities.JobVehicle> JobVehicles { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user