From e6a9f8f8a62844445119796e5017a2893c8c9889 Mon Sep 17 00:00:00 2001 From: Axwabo Date: Fri, 30 Jun 2023 16:34:28 +0200 Subject: [PATCH] ignored victims + improve weapon message --- DeathLog/DeathLogPlugin.cs | 5 +++-- DeathLog/LogHandler.cs | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/DeathLog/DeathLogPlugin.cs b/DeathLog/DeathLogPlugin.cs index 17aba49..8b8c015 100644 --- a/DeathLog/DeathLogPlugin.cs +++ b/DeathLog/DeathLogPlugin.cs @@ -15,14 +15,14 @@ public sealed class DeathLogPlugin [PluginEntryPoint("DeathLog", "1.1.0", "DeathLog", "Axwabo")] public void OnEnabled() { - PluginAPI.Events.EventManager.RegisterEvents(this); + EventManager.RegisterEvents(this); Log.Info("DeathLog loaded!"); } [PluginUnload] public void OnDisabled() { - PluginAPI.Events.EventManager.UnregisterEvents(this); + EventManager.UnregisterEvents(this); Log.Info("DeathLog disabled!"); } @@ -36,6 +36,7 @@ public sealed class DeathLogPlugin { _spawnWaveOccurred = false; _lastId = ""; + LogHandler.KosIgnoredVictimNetIdList.Clear(); } [PluginEvent(ServerEventType.TeamRespawn)] diff --git a/DeathLog/LogHandler.cs b/DeathLog/LogHandler.cs index cc2dda6..9130939 100644 --- a/DeathLog/LogHandler.cs +++ b/DeathLog/LogHandler.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using Axwabo.Helpers; using PlayerRoles; @@ -18,6 +19,8 @@ public static class LogHandler private static readonly Color DntColor = new(0.59f, 0.59f, 0.59f); + public static readonly HashSet KosIgnoredVictimNetIdList = new(); + private static bool IsWeapon(ItemType type) => type is ItemType.GunCOM15 or ItemType.GunCOM18 or ItemType.GunCom45 @@ -56,7 +59,7 @@ public static class LogHandler var victimRole = victim.Role; var footprint = handler.Attacker; var attackerRole = footprint.Role; - var canBeKos = !kosPermitted && IsKos(victimRole, attackerRole); + var canBeKos = !KosIgnoredVictimNetIdList.Contains(victim.NetworkId) && !kosPermitted && IsKos(victimRole, attackerRole); var scpAttacker = PlayerRoleLoader.TryGetRoleTemplate(attackerRole, out FpcStandardScp _); Log(sizeScalar => "KILL LOG".Bold().Color("yellow") + "#" + string.Format( GetKillMessage(handler, canBeKos, hasWeaponEquipped, isCuffed, carriesWeapon, scpAttacker, sizeScalar), @@ -130,7 +133,7 @@ public static class LogHandler show && (carriesWeapon || hasWeaponEquipped) ? (hasWeaponEquipped ? " Victim was " + "holding".Underline() + " a weapon." - : " Victim was " + "carrying".Underline() + " a weapon." + : " Victim had a weapon " + "in their inventory.".Underline() ).Color(Cyan).Size(30.Scale(sizeScalar)) : "";