diff --git a/ReallifeGamemode.Server/Events/Death.cs b/ReallifeGamemode.Server/Events/Death.cs index 0d919c1e..453a1240 100644 --- a/ReallifeGamemode.Server/Events/Death.cs +++ b/ReallifeGamemode.Server/Events/Death.cs @@ -11,6 +11,7 @@ using ReallifeGamemode.Server.Inventory.Interfaces; using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Types; +using ReallifeGamemode.Server.Util; using ReallifeGamemode.Server.Wanted; /** @@ -154,12 +155,12 @@ namespace ReallifeGamemode.Server.Events /*if (player.Vehicle.GetData("timerJobVehicleRespawn") == true) {*/ if (player.Vehicle.GetServerVehicle() is JobVehicle vehJ) - { - ChatService.SendMessage(player, "Debug4"); - player.Vehicle.ResetData("timerJobVehicleRespawn"); - ServerVehicle sVeh = Managers.VehicleManager.GetServerVehicleFromVehicle(player.Vehicle); - ServerVehicleExtensions.Spawn(sVeh, player.Vehicle); - } + { + ChatService.SendMessage(player, "Debug4"); + player.Vehicle.ResetData("timerJobVehicleRespawn"); + ServerVehicle sVeh = Managers.VehicleManager.GetServerVehicleFromVehicle(player.Vehicle); + ServerVehicleExtensions.Spawn(sVeh, player.Vehicle); + } else { ChatService.SendMessage(player, "Debug5"); @@ -201,7 +202,7 @@ namespace ReallifeGamemode.Server.Events { player.SetData("isDead", false); player.RemoveAllWeapons(); - NAPI.Player.SpawnPlayer(player, new Vector3(-495.45, -336.33, 34.5),-98.36f); + NAPI.Player.SpawnPlayer(player, new Vector3(-495.45, -336.33, 34.5), -98.36f); } } diff --git a/ReallifeGamemode.Server/Events/EnterVehicle.cs b/ReallifeGamemode.Server/Events/EnterVehicle.cs index 25c2f5aa..026bb134 100644 --- a/ReallifeGamemode.Server/Events/EnterVehicle.cs +++ b/ReallifeGamemode.Server/Events/EnterVehicle.cs @@ -27,7 +27,7 @@ namespace ReallifeGamemode.Server.Events { List dealPoint = new List(); dealPoint.Add(vehicle.GetData("weaponDealPoint")); - CheckPointHandle.StartCheckPointRoute(client, dealPoint, 5000, 1, 7, "loadWeaponTransport"); + CheckPointHandle.StartCheckPointRoute(client, dealPoint, 5000, 1, 7, 3, true, "loadWeaponTransport"); } } } diff --git a/ReallifeGamemode.Server/Events/Key.cs b/ReallifeGamemode.Server/Events/Key.cs index 21eb163c..c65dd1ae 100644 --- a/ReallifeGamemode.Server/Events/Key.cs +++ b/ReallifeGamemode.Server/Events/Key.cs @@ -183,17 +183,17 @@ namespace ReallifeGamemode.Server.Events if (!player.IsLoggedIn()) return; var user = player.GetUser(); + DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId); + WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId); + JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData("duty")); + ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3)); + ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData("duty"))); + ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); + BehindVehiclePoint nearestBehindVehiclePoint = MarkerBehinVehicle.behindVehiclePoints.Find(s => s.marker.Position.DistanceTo(player.Position) <= 3 && (user.FactionId == 8 || user.FactionId == 7 || user.FactionId == 1 || user.FactionId == 3)); + JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6); if (user?.FactionId != null) { - DutyPoint nearestDuty = PositionManager.DutyPoints.Find(d => d.Position.DistanceTo(player.Position) <= 1.5 && d.FactionId == user.FactionId); - WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId); - JailReleasePoint nearestJailReleasePoint = PositionManager.JailReleasePoints.Find(j => j.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3) && user.GetData("duty")); - ElevatorPoint nearestElevatorPoint = PositionManager.ElevatorPoints.Find(e => e.Position.DistanceTo(player.Position) <= 1.5 && (user.FactionId == 1 || user.FactionId == 3)); - ClotheshopPoint nearestClotheShopPoint = PositionManager.clotheshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData("duty"))); - ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5); - BehindVehiclePoint nearestBehindVehiclePoint = MarkerBehinVehicle.behindVehiclePoints.Find(s => s.marker.Position.DistanceTo(player.Position) <= 3 && (user.FactionId == 8 || user.FactionId == 7 || user.FactionId == 1 || user.FactionId == 3)); - if (nearestBehindVehiclePoint != null) { if (player.HasAttachment("ammobox")) return; @@ -453,6 +453,7 @@ namespace ReallifeGamemode.Server.Events { player.TriggerEvent("CLIENT:StartGangwar"); } + if (nearestJobPoint != null) { if (player.Vehicle != null) return; diff --git a/ReallifeGamemode.Server/Events/Register.cs b/ReallifeGamemode.Server/Events/Register.cs index 24c29b27..3a18f8a7 100644 --- a/ReallifeGamemode.Server/Events/Register.cs +++ b/ReallifeGamemode.Server/Events/Register.cs @@ -2,6 +2,7 @@ using GTANetworkAPI; using ReallifeGamemode.Database.Entities; using Newtonsoft.Json; +using ReallifeGamemode.Database.Models; /** * @overview Life of German Reallife - Event Register (Register.cs) diff --git a/ReallifeGamemode.Server/Job/BusDriverJob.cs b/ReallifeGamemode.Server/Job/BusDriverJob.cs index 9c55ad6f..9bf72a2d 100644 --- a/ReallifeGamemode.Server/Job/BusDriverJob.cs +++ b/ReallifeGamemode.Server/Job/BusDriverJob.cs @@ -7,6 +7,7 @@ using ReallifeGamemode.Database.Models; using Microsoft.CodeAnalysis.CSharp.Syntax; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Managers; +using ReallifeGamemode.Server.Util; namespace ReallifeGamemode.Server.Job { @@ -386,7 +387,7 @@ namespace ReallifeGamemode.Server.Job } } - public static void payWage(Player jobber, int wage) + public static void payWage(Player jobber, int wage) { using (var dbContext = new DatabaseContext()) { @@ -409,7 +410,7 @@ namespace ReallifeGamemode.Server.Job } else { - JobBase job = JobManager.GetJob(jobber.GetUser().JobId??-1); + JobBase job = JobManager.GetJob(jobber.GetUser().JobId ?? -1); job.StopJob(jobber); CheckPointHandle.DeleteCheckpoints(jobber); ChatService.SendMessage(jobber, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet."); diff --git a/ReallifeGamemode.Server/Job/PilotJob.cs b/ReallifeGamemode.Server/Job/PilotJob.cs index 6e9d2e29..b951e9fc 100644 --- a/ReallifeGamemode.Server/Job/PilotJob.cs +++ b/ReallifeGamemode.Server/Job/PilotJob.cs @@ -6,6 +6,7 @@ using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Database.Models; using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Managers; +using ReallifeGamemode.Server.Util; namespace ReallifeGamemode.Server.Job { @@ -147,6 +148,8 @@ namespace ReallifeGamemode.Server.Job break; } }*/ + } + [RemoteEvent("startPilotRoute")] public void StartPilotRoute(Player player, string type) { @@ -258,7 +261,7 @@ namespace ReallifeGamemode.Server.Job } else { - JobBase job = JobManager.GetJob(jobber.GetUser().JobId??-1); + JobBase job = JobManager.GetJob(jobber.GetUser().JobId ?? -1); job.StopJob(jobber); CheckPointHandle.DeleteCheckpoints(jobber); ChatService.SendMessage(jobber, $"~y~[JOB]~s~ Du hast deinen Job ~o~{job.Name}~s~ beendet."); diff --git a/ReallifeGamemode.Server/Main.cs b/ReallifeGamemode.Server/Main.cs index b65649ce..2a3aa044 100644 --- a/ReallifeGamemode.Server/Main.cs +++ b/ReallifeGamemode.Server/Main.cs @@ -16,6 +16,7 @@ using ReallifeGamemode.Server.Managers; using ReallifeGamemode.Server.Util; using ReallifeGamemode.Services; using System.Threading; +using Microsoft.EntityFrameworkCore; /** * @overview Life of German Reallife - Main Class (Main.cs) diff --git a/ReallifeGamemode.Server/Util/CheckPointHandle.cs b/ReallifeGamemode.Server/Util/CheckPointHandle.cs index 2baeaf81..9177bd09 100644 --- a/ReallifeGamemode.Server/Util/CheckPointHandle.cs +++ b/ReallifeGamemode.Server/Util/CheckPointHandle.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using GTANetworkAPI; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Job; @@ -59,7 +60,7 @@ namespace ReallifeGamemode.Server.Util { if (user.GetUser().JobId == 4) { - Job.JobBase job = Managers.JobManager.GetJob(user.GetUser().JobId??-1); + Job.JobBase job = Managers.JobManager.GetJob(user.GetUser().JobId ?? -1); if (job.GetUsersInJob().Contains(user)) { if (!user.IsInVehicle || user.VehicleSeat != 0) return; @@ -166,7 +167,7 @@ namespace ReallifeGamemode.Server.Util } if (temp.LastCheckpoint != 1) { - Job.JobBase job = Managers.JobManager.GetJob(user.GetUser().JobId??-1); + Job.JobBase job = Managers.JobManager.GetJob(user.GetUser().JobId ?? -1); if (job.GetUsersInJob().Contains(user)) { if (user.GetUser().JobId == 3) @@ -201,7 +202,7 @@ namespace ReallifeGamemode.Server.Util { if (temp.checkPointsDone == 2) { - if(user.GetData("Route") == "Skill1Route1" || user.GetData("Route") == "Skill1Route2" || user.GetData("Route") == "Skill1Route3" || user.GetData("Route") == "Skill1Route4") + if (user.GetData("Route") == "Skill1Route1" || user.GetData("Route") == "Skill1Route2" || user.GetData("Route") == "Skill1Route3" || user.GetData("Route") == "Skill1Route4") { BusDriverJob.payWage(user, BusSkill1RouteVerdienst / temp.list.Count()); BusDriverJob.payWage(user, BusSkill1RouteVerdienst / temp.list.Count()); @@ -288,11 +289,11 @@ namespace ReallifeGamemode.Server.Util this.checkPointsDone++; if (this.list.Count() > checkPointsDone) { - LastCheckpoint = 0; - Vector3 nextCp = list.ElementAt(checkPointsDone); + LastCheckpoint = 0; + Vector3 nextCp = list.ElementAt(checkPointsDone); this.player.TriggerEvent("setCheckPoint", nextCp, player, this.checkPointsDone, delay, this.markerID, this.markerSize, this.markerDist, this.useVehicle, this.eventInCheckpoint); } - if (checkPointsDone == this.list.Count()-1) + if (checkPointsDone == this.list.Count() - 1) { LastCheckpoint = 1; }