Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop
This commit is contained in:
@@ -113,9 +113,7 @@ export default function keys(globalData: IGlobalData) {
|
|||||||
//N //Motor Starten
|
//N //Motor Starten
|
||||||
mp.keys.bind(0x4E, false, function () {
|
mp.keys.bind(0x4E, false, function () {
|
||||||
if (!globalData.InChat) {
|
if (!globalData.InChat) {
|
||||||
if (!player.vehicle) return;
|
mp.events.callRemote("keyPress:N", player.vehicle.getSpeed());
|
||||||
if (player.vehicle.getSpeed() > 5) return;
|
|
||||||
mp.events.callRemote("keyPress:N");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -136,7 +134,8 @@ export default function keys(globalData: IGlobalData) {
|
|||||||
//J // Job Starten
|
//J // Job Starten
|
||||||
mp.keys.bind(0x4A, false, () => {
|
mp.keys.bind(0x4A, false, () => {
|
||||||
if (!globalData.InChat && globalData.LoggedIn && !globalData.InTuning) {
|
if (!globalData.InChat && globalData.LoggedIn && !globalData.InTuning) {
|
||||||
mp.events.callRemote("CLIENT:JobManager_ShowJobMenu");
|
//mp.events.callRemote("CLIENT:JobManager_ShowJobMenu");
|
||||||
|
mp.events.callRemote("keyPress:J");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
public void CmdAdminTSupport(Player player)
|
public void CmdAdminTSupport(Player player)
|
||||||
{
|
{
|
||||||
User user = player.GetUser();
|
User user = player.GetUser();
|
||||||
if (user.IsAdmin(AdminLevel.SUPPORTER))
|
if (!user.IsAdmin(AdminLevel.SUPPORTER))
|
||||||
{
|
{
|
||||||
ChatService.NotAuthorized(player);
|
ChatService.NotAuthorized(player);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Command("heal", "~m~Benutzung: ~s~/heal [Spieler] (Preis)")] //TODO Eventuell noch mit Geldbetrag wie bei SA:MP
|
[Command("heal", "~m~Benutzung: ~s~/heal [Spieler] (Preis)")] //TODO Eventuell noch mit Geldbetrag wie bei SA:MP
|
||||||
public void CmdFactionMedicHealive(Player player, string receiver, int price = 100)
|
public void CmdFactionMedicHealive(Player player, string receiver, int price = 10)
|
||||||
{
|
{
|
||||||
Player target = PlayerService.GetPlayerByNameOrId(receiver);
|
Player target = PlayerService.GetPlayerByNameOrId(receiver);
|
||||||
if (player.GetUser()?.FactionId != 2)
|
if (player.GetUser()?.FactionId != 2)
|
||||||
@@ -391,28 +391,10 @@ namespace ReallifeGamemode.Server.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var dbContext = new DatabaseContext();
|
ChatService.SendMessage(target,"~g~" + player.Name + " ~s~möchte dich für ~g~$" + price + " ~s~heilen. Drücke ~g~J~s~ zum Erlauben oder ~r~N ~s~zum Verbieten");
|
||||||
User targetUser = target.GetUser(dbContext);
|
player.SendNotification("Du hast " + target.Name + " einen Heal angeboten",false);
|
||||||
|
target.SetData<bool>("healDecision", true);
|
||||||
if (targetUser.Handmoney >= price)
|
Medic.HealDecisions.Add(new Medic.HealDecision {dMedic = player, dTarget = target, dPrice = price});
|
||||||
{
|
|
||||||
targetUser.Handmoney -= price;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int bankMoney = price - targetUser.Handmoney;
|
|
||||||
targetUser.Handmoney = 0;
|
|
||||||
targetUser.BankAccount.Balance -= bankMoney;
|
|
||||||
}
|
|
||||||
|
|
||||||
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += price;
|
|
||||||
|
|
||||||
dbContext.SaveChanges();
|
|
||||||
|
|
||||||
target.Health = 100;
|
|
||||||
target.SendNotification($"Du wurdest von ~g~{player.Name} ~s~ für ~g~{price.ToMoneyString()} geheilt.", false);
|
|
||||||
player.SendNotification($"Du hast ~g~{target.Name} ~s~ für {price.ToMoneyString()} geheilt.", false);
|
|
||||||
player.TriggerEvent("delHealTask");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Sanitäter Commands
|
#endregion Sanitäter Commands
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using GTANetworkAPI;
|
using GTANetworkAPI;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -11,6 +12,7 @@ using ReallifeGamemode.Server.Factions.Medic;
|
|||||||
using ReallifeGamemode.Server.Finance;
|
using ReallifeGamemode.Server.Finance;
|
||||||
using ReallifeGamemode.Server.Inventory;
|
using ReallifeGamemode.Server.Inventory;
|
||||||
using ReallifeGamemode.Server.Inventory.Interfaces;
|
using ReallifeGamemode.Server.Inventory.Interfaces;
|
||||||
|
using ReallifeGamemode.Server.Job;
|
||||||
using ReallifeGamemode.Server.Managers;
|
using ReallifeGamemode.Server.Managers;
|
||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Server.Services;
|
||||||
using ReallifeGamemode.Server.Types;
|
using ReallifeGamemode.Server.Types;
|
||||||
@@ -609,6 +611,71 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
InventoryManager.SetBackpackItems(player);
|
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")]
|
[RemoteEvent("keyPress:O")]
|
||||||
public void KeyPressO(Player player)
|
public void KeyPressO(Player player)
|
||||||
{
|
{
|
||||||
@@ -693,12 +760,19 @@ namespace ReallifeGamemode.Server.Events
|
|||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("keyPress:N")]
|
[RemoteEvent("keyPress:N")]
|
||||||
public void KeyPressN(Player player)
|
public void KeyPressN(Player player, int vSpeed)
|
||||||
{
|
{
|
||||||
if (!player.IsLoggedIn()) return;
|
if (!player.IsLoggedIn()) return;
|
||||||
|
|
||||||
|
if (player.GetData<bool>("healDecision") == true)
|
||||||
|
{
|
||||||
|
player.SetData<bool>("healDecision", false);
|
||||||
|
Medic.MakeHealDecision(player, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (!player.IsInVehicle) return;
|
if (!player.IsInVehicle) return;
|
||||||
if (player.VehicleSeat != 0) return;
|
if (player.VehicleSeat != 0) return;
|
||||||
|
if (vSpeed > 5) return;
|
||||||
|
|
||||||
GTANetworkAPI.Vehicle v = player.Vehicle;
|
GTANetworkAPI.Vehicle v = player.Vehicle;
|
||||||
|
|
||||||
|
|||||||
@@ -266,9 +266,13 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
nameTagColor = -1;
|
nameTagColor = -1;
|
||||||
blipColor = 64;
|
blipColor = 64;
|
||||||
}
|
}
|
||||||
else if (user.Faction != null)
|
else if (user.FactionId != null)
|
||||||
|
{
|
||||||
|
if(user.FactionId > 3 || (user.FactionId >= 1 && user.FactionId <= 3 && duty))
|
||||||
{
|
{
|
||||||
nameTagColor = user.FactionId.Value;
|
nameTagColor = user.FactionId.Value;
|
||||||
|
}
|
||||||
|
|
||||||
switch (user.FactionId)
|
switch (user.FactionId)
|
||||||
{
|
{
|
||||||
case 1 when duty:
|
case 1 when duty:
|
||||||
@@ -307,8 +311,6 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NAPI.Util.ConsoleOutput($"{player.Name} - Setting blip and nametag color: nametag = {nameTagColor}, blip = {blipColor}");
|
|
||||||
|
|
||||||
user.Player.SetSharedData("nameTagColor", nameTagColor);
|
user.Player.SetSharedData("nameTagColor", nameTagColor);
|
||||||
user.Player.SetSharedData("blipColor", blipColor);
|
user.Player.SetSharedData("blipColor", blipColor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using ReallifeGamemode.Database.Entities;
|
|||||||
using ReallifeGamemode.Database.Models;
|
using ReallifeGamemode.Database.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
|
using ReallifeGamemode.Server.Extensions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @overview Life of German Reallife - Server Factions Medic Medic.cs
|
* @overview Life of German Reallife - Server Factions Medic Medic.cs
|
||||||
@@ -22,10 +23,18 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
|||||||
public static List<MedicTask> ReviveTasks = new List<MedicTask>();
|
public static List<MedicTask> ReviveTasks = new List<MedicTask>();
|
||||||
public static List<MedicTask> HealTasks = new List<MedicTask>();
|
public static List<MedicTask> HealTasks = new List<MedicTask>();
|
||||||
public static List<MedicTask> FireTasks = new List<MedicTask>();
|
public static List<MedicTask> FireTasks = new List<MedicTask>();
|
||||||
|
public static List<HealDecision> HealDecisions = new List<HealDecision>();
|
||||||
public static int ReviveIncome = 100;
|
public static int ReviveIncome = 100;
|
||||||
public static int dutyMedics = 0;
|
public static int dutyMedics = 0;
|
||||||
public static int reviveTaskTime = 240;
|
public static int reviveTaskTime = 240;
|
||||||
|
|
||||||
|
public class HealDecision
|
||||||
|
{
|
||||||
|
public Player dMedic;
|
||||||
|
public Player dTarget;
|
||||||
|
public int dPrice;
|
||||||
|
}
|
||||||
|
|
||||||
public static void AddTaskToList(MedicTask task)
|
public static void AddTaskToList(MedicTask task)
|
||||||
{
|
{
|
||||||
if (task == null)
|
if (task == null)
|
||||||
@@ -72,6 +81,45 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void MakeHealDecision(Player target, bool decision)
|
||||||
|
{
|
||||||
|
var activeDecision = HealDecisions.FirstOrDefault(d => d.dTarget == target);
|
||||||
|
if(decision == false)
|
||||||
|
{
|
||||||
|
activeDecision.dMedic.SendNotification(activeDecision.dTarget.Name + " hat den Heal ~r~abgelehnt",false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
activeDecision.dMedic.SendNotification(activeDecision.dTarget.Name + " hat den Heal ~g~akzeptiert", false);
|
||||||
|
using var dbContext = new DatabaseContext();
|
||||||
|
{
|
||||||
|
User targetUser = target.GetUser(dbContext);
|
||||||
|
|
||||||
|
if (targetUser.Handmoney >= activeDecision.dPrice)
|
||||||
|
{
|
||||||
|
targetUser.Handmoney -= activeDecision.dPrice;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int bankMoney = activeDecision.dPrice - targetUser.Handmoney;
|
||||||
|
targetUser.Handmoney = 0;
|
||||||
|
targetUser.BankAccount.Balance -= bankMoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbContext.Factions.Include(f => f.BankAccount).Where(f => f.Id == 2).First().BankAccount.Balance += activeDecision.dPrice / 2;
|
||||||
|
activeDecision.dMedic.GetUser(dbContext).Wage += activeDecision.dPrice / 2;
|
||||||
|
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
|
activeDecision.dTarget.Health = 100;
|
||||||
|
activeDecision.dTarget.SendNotification($"Du wurdest von ~g~{activeDecision.dMedic.Name} ~s~ für ~g~{activeDecision.dPrice.ToMoneyString()} geheilt", false);
|
||||||
|
activeDecision.dMedic.SendNotification($"Du hast ~g~{activeDecision.dTarget.Name} ~s~ für {activeDecision.dPrice.ToMoneyString()} geheilt", false);
|
||||||
|
delHealTask(activeDecision.dTarget);
|
||||||
|
}
|
||||||
|
HealDecisions.Remove(activeDecision);
|
||||||
|
}
|
||||||
|
|
||||||
public static void UpdateTaskTimeLeft()
|
public static void UpdateTaskTimeLeft()
|
||||||
{
|
{
|
||||||
DateTime actualTime = DateTime.Now;
|
DateTime actualTime = DateTime.Now;
|
||||||
@@ -139,7 +187,7 @@ namespace ReallifeGamemode.Server.Factions.Medic
|
|||||||
public static void delHealTask(Player player)
|
public static void delHealTask(Player player)
|
||||||
{
|
{
|
||||||
MedicTask task = HealTasks.FirstOrDefault(t => t.Victim == player.Name);
|
MedicTask task = HealTasks.FirstOrDefault(t => t.Victim == player.Name);
|
||||||
RemoveTaskFromList(task);
|
if(task != null) RemoveTaskFromList(task);
|
||||||
player.SetData("healauftrag", false);
|
player.SetData("healauftrag", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -290,10 +290,8 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var dbContext = new DatabaseContext())
|
targetUser.Group = null;
|
||||||
{
|
targetUser.GroupRank = GroupRank.NONE;
|
||||||
target.GetUser(dbContext).Group = null;
|
|
||||||
target.GetUser(dbContext).GroupRank = GroupRank.NONE;
|
|
||||||
|
|
||||||
ChatService.SendMessage(player, "!{02FCFF}Du hast " + target.Name + " aus der Gruppe geworfen.");
|
ChatService.SendMessage(player, "!{02FCFF}Du hast " + target.Name + " aus der Gruppe geworfen.");
|
||||||
ChatService.SendMessage(target, "!{02FCFF}Du wurdest von " + player.Name + " aus der Gruppe geworfen.");
|
ChatService.SendMessage(target, "!{02FCFF}Du wurdest von " + player.Name + " aus der Gruppe geworfen.");
|
||||||
@@ -301,7 +299,6 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
dbContext.SaveChanges();
|
dbContext.SaveChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
[RemoteEvent("CLIENT:InteractionMenu_MemberList")]
|
[RemoteEvent("CLIENT:InteractionMenu_MemberList")]
|
||||||
public void InteractionMenuGroupMemberList(Player player, string type, string name)
|
public void InteractionMenuGroupMemberList(Player player, string type, string name)
|
||||||
|
|||||||
@@ -122,63 +122,6 @@ namespace ReallifeGamemode.Server.Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("CLIENT:JobManager_ShowJobMenu")]
|
|
||||||
public void ShowJobMenuEvent(Player player)
|
|
||||||
{
|
|
||||||
User u = player.GetUser();
|
|
||||||
|
|
||||||
if (u.JobId == null) return;
|
|
||||||
|
|
||||||
JobBase job = 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("CLIENT:Job_StartJob")]
|
[RemoteEvent("CLIENT:Job_StartJob")]
|
||||||
public void StartJobEvent(Player player)
|
public void StartJobEvent(Player player)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user