lückenlose nachvollziehbarkeit

This commit is contained in:
hydrant
2021-05-25 20:45:31 +02:00
parent 8c964dc026
commit 16aab6a8bb
6 changed files with 44 additions and 17 deletions

View File

@@ -1,16 +1,20 @@
using System.Collections.Generic;
using System.Linq;
using GTANetworkAPI;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Log;
using ReallifeGamemode.Server.Services;
namespace ReallifeGamemode.Server.Gangwar
{
public class Gangwar : Script
{
private static ILogger logger = LogManager.GetLogger<Gangwar>();
public static Turf[] _loadedTurfs;
private static List<Turfs> turfs;
public const int GANGWAR_TOTAL_TIME = 900;
@@ -53,19 +57,19 @@ namespace ReallifeGamemode.Server.Gangwar
var killerInsideTurf = killer.HasData("GotInsideOfTurf");
var victimInsideTurf = victim.HasData("GotInsideOfTurf");
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - KillerInsideTurf = {killerInsideTurf}, VictimInsideTurf = {victimInsideTurf}");
logger.LogDebug($"GangwarKill - Victim {victim.Name} - KillerInsideTurf = {killerInsideTurf}, VictimInsideTurf = {victimInsideTurf}");
if (killerInsideTurf && victimInsideTurf)
{
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killer and Victim are in Turf area");
logger.LogDebug($"GangwarKill - Victim {victim.Name} - Killer and Victim are in Turf area");
killer.TriggerEvent("gangWarKillNotification", victim.Name);
foreach (var turf in getTurfs())
{
if (turf.getId() == victim.GetData<int>("inGangWar"))
{
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Killed in turf id {turf.getId()}");
logger.LogDebug($"GangwarKill - Victim {victim.Name} - Killed in turf id {turf.getId()}");
var victimFactionName = victim.GetUser().Faction.Name;
NAPI.Util.ConsoleOutput($"GangwarKill - Victim {victim.Name} - Faction Name = {victimFactionName}");
logger.LogDebug($"GangwarKill - Victim {victim.Name} - Faction Name = {victimFactionName}");
turf.setKill(victimFactionName);
return;
}
@@ -96,7 +100,7 @@ namespace ReallifeGamemode.Server.Gangwar
[RemoteEvent("Gangarea:Leave")]
public void RmtEvent_TurfLeave(Player client, string jsonId)
{
if(string.IsNullOrEmpty(jsonId))
if (string.IsNullOrEmpty(jsonId))
{
return;
}
@@ -189,7 +193,7 @@ namespace ReallifeGamemode.Server.Gangwar
public void RmtEvent_StartGangwar(Player client)
{
User user = client.GetUser();
if(user == null || user.Faction == null)
if (user == null || user.Faction == null)
{
return;
}