Fix E-Job Starten
This commit is contained in:
@@ -172,17 +172,17 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (!player.IsLoggedIn()) return;
|
||||
var user = player.GetUser();
|
||||
|
||||
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<bool>("duty")));
|
||||
|
||||
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
|
||||
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<bool>("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<bool>("duty")));
|
||||
|
||||
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
|
||||
|
||||
if (nearestDuty != null)// Duty Point
|
||||
@@ -262,62 +262,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
UpdateCharacterCloth.LoadCharacterDefaults(player);
|
||||
}
|
||||
}
|
||||
if (nearestJobPoint != null)
|
||||
{
|
||||
Job.JobBase job = JobManager.GetJob(player.GetUser().JobId.Value);
|
||||
JobManager jobb = new JobManager();
|
||||
if (nearestJobPoint.jobId != 3 && nearestJobPoint.jobId == player.GetUser().JobId)
|
||||
{
|
||||
if (job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StopJob(player);
|
||||
return;
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StartJobEvent(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (nearestJobPoint.jobId == 3 && player.GetUser().JobId == 3)
|
||||
{
|
||||
if (nearestJobPoint.Skill < 300 && player.GetUser().PilotSkill < 300)
|
||||
{
|
||||
if (job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StopJob(player);
|
||||
user.SetData("PilotenBase2", false);
|
||||
return;
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StartJobEvent(player);
|
||||
user.SetData("PilotenBase2", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (nearestJobPoint.Skill >= 300 && player.GetUser().PilotSkill >= 300)
|
||||
{
|
||||
if (job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StopJob(player);
|
||||
user.SetData("PilotenBase2", false);
|
||||
return;
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StartJobEvent(player);
|
||||
user.SetData("PilotenBase2", true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendChatMessage("~y~[JOB] ~r~Dein Skilllevel ist noch zu niedrig.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nearestWeapon != null) // Weapon Point
|
||||
{
|
||||
|
||||
@@ -404,29 +349,85 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
player.TriggerEvent("showJailMenu", JsonConvert.SerializeObject(criminals.ToArray()));
|
||||
}
|
||||
if (nearestElevatorPoint != null)
|
||||
}
|
||||
if (nearestElevatorPoint != null)
|
||||
{
|
||||
List<string> stages = new List<string>();
|
||||
foreach (var e in PositionManager.ElevatorPoints)
|
||||
{
|
||||
List<string> stages = new List<string>();
|
||||
foreach (var e in PositionManager.ElevatorPoints)
|
||||
if (e.Position.DistanceTo2D(player.Position) <= 25 && e.Position.DistanceTo(player.Position) > 1.5)
|
||||
{
|
||||
if (e.Position.DistanceTo2D(player.Position) <= 25 && e.Position.DistanceTo(player.Position) > 1.5)
|
||||
stages.Add(e.Stage);
|
||||
}
|
||||
}
|
||||
player.TriggerEvent("showElevatorMenu", JsonConvert.SerializeObject(stages.ToArray()));
|
||||
}
|
||||
if (nearestClotheShopPoint != null)
|
||||
{
|
||||
nearestClotheShopPoint.clotheShop.LoadShopNUI(player);
|
||||
}
|
||||
if (nearestItemShopPoint != null)
|
||||
{
|
||||
nearestItemShopPoint.itemShop.LoadShopNUI(player);
|
||||
}
|
||||
if (user.FactionLeader)
|
||||
{
|
||||
player.TriggerEvent("CLIENT:StartGangwar");
|
||||
}
|
||||
if (nearestJobPoint != null)
|
||||
{
|
||||
Job.JobBase job = JobManager.GetJob(player.GetUser().JobId.Value);
|
||||
JobManager jobb = new JobManager();
|
||||
if (nearestJobPoint.jobId != 3 && nearestJobPoint.jobId == player.GetUser().JobId)
|
||||
{
|
||||
if (job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StopJob(player);
|
||||
return;
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StartJobEvent(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (nearestJobPoint.jobId == 3 && player.GetUser().JobId == 3)
|
||||
{
|
||||
if (nearestJobPoint.Skill < 300 && player.GetUser().PilotSkill < 300)
|
||||
{
|
||||
if (job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
stages.Add(e.Stage);
|
||||
jobb.StopJob(player);
|
||||
user.SetData("PilotenBase2", false);
|
||||
return;
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StartJobEvent(player);
|
||||
user.SetData("PilotenBase2", false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
player.TriggerEvent("showElevatorMenu", JsonConvert.SerializeObject(stages.ToArray()));
|
||||
}
|
||||
if (nearestClotheShopPoint != null)
|
||||
{
|
||||
nearestClotheShopPoint.clotheShop.LoadShopNUI(player);
|
||||
}
|
||||
if (nearestItemShopPoint != null)
|
||||
{
|
||||
nearestItemShopPoint.itemShop.LoadShopNUI(player);
|
||||
}
|
||||
if (user.FactionLeader)
|
||||
{
|
||||
player.TriggerEvent("CLIENT:StartGangwar");
|
||||
if (nearestJobPoint.Skill >= 300 && player.GetUser().PilotSkill >= 300)
|
||||
{
|
||||
if (job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StopJob(player);
|
||||
user.SetData("PilotenBase2", false);
|
||||
return;
|
||||
}
|
||||
if (!job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
jobb.StartJobEvent(player);
|
||||
user.SetData("PilotenBase2", true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendChatMessage("~y~[JOB] ~r~Dein Skilllevel ist noch zu niedrig.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user