From fb2167e223afe7bf00638764dc4797295a0c7935 Mon Sep 17 00:00:00 2001 From: Axwabo Date: Sat, 28 Jan 2023 10:03:50 +0100 Subject: [PATCH] simple deaths --- DeathLog/DeathLogPlugin.cs | 4 ++-- DeathLog/LogHandler.cs | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/DeathLog/DeathLogPlugin.cs b/DeathLog/DeathLogPlugin.cs index a01cf26..d250ae5 100644 --- a/DeathLog/DeathLogPlugin.cs +++ b/DeathLog/DeathLogPlugin.cs @@ -10,13 +10,13 @@ public sealed class DeathLogPlugin { [PluginEntryPoint("DeathLog", "1.0.0", "DeathLog", "Axwabo")] public void OnEnabled() { PluginAPI.Events.EventManager.RegisterEvents(this); - Log.Debug("DeathLog loaded!"); + Log.Info("DeathLog loaded!"); } [PluginUnload] public void OnDisabled() { PluginAPI.Events.EventManager.UnregisterEvents(this); - Log.Debug("DeathLog disabled!"); + Log.Info("DeathLog disabled!"); } [PluginConfig] diff --git a/DeathLog/LogHandler.cs b/DeathLog/LogHandler.cs index 1ecbc21..73081f9 100644 --- a/DeathLog/LogHandler.cs +++ b/DeathLog/LogHandler.cs @@ -24,9 +24,17 @@ public static class LogHandler { or ItemType.ParticleDisruptor or ItemType.Jailbird; - public static void LogSimpleDeathMessage(Player player, DamageHandlerBase handler) { - throw new System.NotImplementedException(); - } + public static void LogSimpleDeathMessage(Player player, DamageHandlerBase handler) => Log("DEATH LOG" + "#" + string.Format( + GetDeathMessage(handler), + GetVictimStatus(player) + ), true); + + private static string GetDeathMessage(DamageHandlerBase handler) => handler switch { + CustomReasonDamageHandler custom => $"{{0}} has died: {custom._deathReason.Bold().Color("orange").Size(30)}", + UniversalDamageHandler universal => $"{{0}} has died. Reason: {universal._logsText.TrimEnd('.').Bold().Color("orange").Size(30)}", + WarheadDamageHandler => $"{{0}} died to {"the Alpha Warhead".Bold().Color("orange").Size(30)}", + _ => $"{{0}} has died. {"Reason is unknown".Italic()}" + }; public static void LogAttackerDeathMessage(Player victim, Player attacker, AttackerDamageHandler handler) { var isCuffed = victim.IsDisarmed;