converted jobs to same system as businesses, add option to choose job at cityhall

This commit is contained in:
hydrant
2019-05-16 14:52:19 +02:00
parent 8fd4041b3c
commit aa81fa95a4
18 changed files with 1422 additions and 59 deletions

View File

@@ -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; }
}
}

View File

@@ -1,4 +1,6 @@
using Microsoft.EntityFrameworkCore;
using ReallifeGamemode.Server.Job;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Models;
using System;
using System.Collections.Generic;
@@ -9,11 +11,14 @@ namespace ReallifeGamemode.Server.Entities
{
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()
{
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;
}
}
}

View File

@@ -1,5 +1,6 @@
using GTANetworkAPI;
using ReallifeGamemode.Server.Business;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Util;
using System;
using System.Collections.Generic;
@@ -23,7 +24,7 @@ namespace ReallifeGamemode.Server.Entities
public override string ToString()
{
return "ShopVehicle";
return "ShopVehicle | Shop: " + BusinessManager.GetBusiness(BusinessId).Name;
}
}
}

View File

@@ -62,7 +62,7 @@ namespace ReallifeGamemode.Server.Entities
public GroupRank GroupRank { get; set; }
public Job Job { get; set; }
public int? JobId { get; set; }
public FactionRank GetFactionRank()
{