Heal Decision / JobManager dadurch angepasst
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
@@ -11,6 +12,7 @@ using ReallifeGamemode.Server.Factions.Medic;
|
||||
using ReallifeGamemode.Server.Finance;
|
||||
using ReallifeGamemode.Server.Inventory;
|
||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||
using ReallifeGamemode.Server.Job;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
@@ -214,7 +216,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
FriseurPoint nearestFriseurPoint = PositionManager.friseurPoints.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.6);
|
||||
|
||||
|
||||
if (user?.FactionId != null)
|
||||
{
|
||||
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));
|
||||
@@ -624,6 +626,71 @@ namespace ReallifeGamemode.Server.Events
|
||||
InventoryManager.SetBackpackItems(player);
|
||||
}
|
||||
|
||||
[RemoteEvent("keyPress:J")]
|
||||
public void KeyPressJ(Player player)
|
||||
{
|
||||
if (!player.IsLoggedIn()) return;
|
||||
if (player.GetData<bool>("healDecision") == true)
|
||||
{
|
||||
player.SetData<bool>("healDecision", false);
|
||||
Medic.MakeHealDecision(player, true);
|
||||
}
|
||||
|
||||
User u = player.GetUser();
|
||||
|
||||
if (u.JobId == null) return;
|
||||
|
||||
JobBase job = JobManager.GetJob(u.JobId.Value);
|
||||
|
||||
dynamic data = null;
|
||||
|
||||
if (job.Id == 1 && job.GetUsersInJob().Contains(player))
|
||||
{
|
||||
var taxiCalls = JobManager.GetJob<TaxiDriverJob>().TaxiContracts;
|
||||
if (!taxiCalls.Any(t => t.Driver?.Handle == player.Handle)) // Spieler in keiner aktiven Fahrt
|
||||
{
|
||||
data = new
|
||||
{
|
||||
job.Id,
|
||||
Status = 0,
|
||||
JobData = new
|
||||
{
|
||||
TaxiCalls = taxiCalls
|
||||
.Where(t => t.Driver == null)
|
||||
.Select(t => new
|
||||
{
|
||||
t.Name,
|
||||
Distance = Math.Round(t.Position.DistanceTo(player.Position), 0)
|
||||
})
|
||||
.OrderBy(t => t.Distance)
|
||||
}
|
||||
};
|
||||
}
|
||||
else // Spieler in aktiver Fahrt
|
||||
{
|
||||
data = new
|
||||
{
|
||||
job.Id,
|
||||
Status = 1,
|
||||
JobData = new
|
||||
{
|
||||
taxiCalls.Where(t => t.Driver.Handle == player.Handle).First().Name
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
//JobPoint nearJobPoint = PositionManager.JobPoints.Find(p => p.Position.DistanceTo(player.Position) <= 2);
|
||||
if (u.JobId == 2 || u.JobId == 3 || u.JobId == 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var json = JsonConvert.SerializeObject(data);
|
||||
|
||||
player.TriggerEvent("SERVER:Job_ShowJobMenu", job.Name, json);
|
||||
}
|
||||
|
||||
|
||||
[RemoteEvent("keyPress:O")]
|
||||
public void KeyPressO(Player player)
|
||||
{
|
||||
@@ -715,6 +782,12 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (!player.IsInVehicle) return;
|
||||
if (player.VehicleSeat != 0) return;
|
||||
|
||||
if (player.GetData<bool>("healDecision") == true)
|
||||
{
|
||||
player.SetData<bool>("healDecision", true);
|
||||
Medic.MakeHealDecision(player, false);
|
||||
}
|
||||
|
||||
GTANetworkAPI.Vehicle v = player.Vehicle;
|
||||
|
||||
User u = player.GetUser();
|
||||
|
||||
Reference in New Issue
Block a user