Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of GentleDeath v1.0.0
Landoria.GentleDeath.dll
Decompiled 16 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Landoria.SharedLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Landoria.GentleDeath")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Landoria.GentleDeath")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("CAA46083-A0C5-4FFC-9180-99BE40D8CAA1")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.17312")] namespace Landoria.GentleDeath { internal static class DeathInventory { internal static void CreateTombstone(Player player) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory.NrOfItems() != 0) { GameObject obj = Object.Instantiate<GameObject>(player.m_tombstone, ((Character)player).GetCenterPoint(), ((Component)player).transform.rotation); Inventory inventory2 = obj.GetComponent<Container>().GetInventory(); int num = MoveNonEquippableItems(inventory, inventory2); SetupTombstone(obj); GentleDeathPlugin.Log.LogInfo($"Death inventory split: kept={inventory.NrOfItems()}, " + $"movedToTombstone={num}."); } } private static int MoveNonEquippableItems(Inventory playerInventory, Inventory graveInventory) { List<ItemData> list = new List<ItemData>(playerInventory.GetAllItems()); int num = 0; foreach (ItemData item in list) { if (!item.IsEquipable() && MoveItem(playerInventory, graveInventory, item)) { num++; } } return num; } private static bool MoveItem(Inventory playerInventory, Inventory graveInventory, ItemData item) { if (!graveInventory.AddItem(item)) { GentleDeathPlugin.Log.LogWarning("The tombstone had no room for " + item.m_shared.m_name + "; the item was kept by the player."); return false; } return playerInventory.RemoveItem(item); } private static void SetupTombstone(GameObject tombstone) { PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); tombstone.GetComponent<TombStone>().Setup(playerProfile.GetName(), playerProfile.GetPlayerID()); } } [BepInPlugin("Landoria.GentleDeath", "Landoria.GentleDeath", "1.0.0")] public sealed class GentleDeathPlugin : LandoriaPlugin { private const string PluginGuid = "Landoria.GentleDeath"; private const string PluginName = "Landoria.GentleDeath"; private const string PluginVersion = "1.0.0"; internal static ModLog Log { get; private set; } private void Awake() { Log = InitializePlugin("Landoria.GentleDeath"); Log.LogInfo("Landoria.GentleDeath 1.0.0 is loaded."); } private void OnDestroy() { ShutdownPlugin(); Log = null; } } [HarmonyPatch(typeof(Player), "CreateTombStone")] internal static class CreateTombstonePatch { private static bool Prefix(Player __instance) { DeathInventory.CreateTombstone(__instance); return false; } } } namespace Landoria.SharedLib { public abstract class LandoriaPlugin : BaseUnityPlugin { private Harmony _harmony; private bool _patchesApplied; protected ModLog InitializePlugin(string pluginGuid) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown ModLog modLog = new ModLog(((BaseUnityPlugin)this).Logger); Version version = ((object)this).GetType().Assembly.GetName().Version; modLog.LogInfo($"AssemblyVersion: {version}."); _harmony = new Harmony(pluginGuid); PatchOwnNamespace(modLog); return modLog; } protected void PatchOwnNamespace(ModLog log) { if (_patchesApplied) { log.LogDebug("Harmony patches are already active; skipping registration."); return; } string text = ((object)this).GetType().Namespace; Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { if (type.Namespace == text) { _harmony.CreateClassProcessor(type).Patch(); } } _patchesApplied = true; log.LogDebug("Harmony patches were applied for the plugin namespace."); } protected void ShutdownPlugin() { if (_patchesApplied) { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } _patchesApplied = false; } } } public sealed class ModLog { private readonly ManualLogSource _logger; public ModLog(ManualLogSource logger) { _logger = logger; } public void LogFatal(object message) { Write((LogLevel)1, message); } public void LogError(object message) { Write((LogLevel)2, message); } public void LogWarning(object message) { Write((LogLevel)4, message); } public void LogMessage(object message) { Write((LogLevel)8, message); } public void LogInfo(object message) { Write((LogLevel)16, message); } public void LogDebug(object message) { Write((LogLevel)32, message); } public void Log(LogLevel level, object message) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Write(level, message); } private void Write(LogLevel level, object message) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) string arg = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); _logger.Log(level, (object)$"[{arg}] {message}"); } } }