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 QuickDrops v1.0.0
QuickDrops.dll
Decompiled 3 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace QuickDrops; [BepInPlugin("com.burks.quickdrops", "Quick Drops", "1.0.0")] public class QuickDropsPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(Ragdoll), "Setup")] public static class Ragdoll_Setup_Patch { public static void Postfix(Ragdoll __instance, CharacterDrop characterDrop) { try { if (!Enabled.Value || (Object)(object)__instance == (Object)null || (Object)(object)characterDrop == (Object)null) { return; } float num = Mathf.Clamp(PercentFaster.Value, 0f, 100f) / 100f; if (num <= 0f) { return; } float ttl = __instance.m_ttl; if (ttl <= 0f) { return; } float num2 = Mathf.Max(Mathf.Max(0.1f, MinimumSeconds.Value), ttl * (1f - num)); if (!(num2 >= ttl)) { __instance.m_ttl = num2; ((MonoBehaviour)__instance).CancelInvoke("DestroyNow"); ((MonoBehaviour)__instance).InvokeRepeating("DestroyNow", num2, 1f); if (_logged < LogFirstBodies.Value) { _logged++; Log.LogInfo((object)string.Format("{0}: loot in {1:0.0} s instead of {2:0.0} s.", ((Object)((Component)__instance).gameObject).name.Replace("(Clone)", ""), num2, ttl)); } } } catch (Exception ex) { Log.LogWarning((object)("Could not speed up a body: " + ex.Message)); } } } public const string GUID = "com.burks.quickdrops"; public const string NAME = "Quick Drops"; public const string VERSION = "1.0.0"; public static ManualLogSource Log; public static ConfigEntry<bool> Enabled; public static ConfigEntry<float> PercentFaster; public static ConfigEntry<float> MinimumSeconds; public static ConfigEntry<int> LogFirstBodies; private static int _logged; private void Awake() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Make dead enemies and animals drop their loot sooner."); PercentFaster = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PercentFaster", 80f, "How much of the wait to cut. 80 = loot drops after 20% of the normal wait (5 times sooner). 50 = half the wait. 0 = normal."); MinimumSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MinimumSeconds", 0.5f, "Never drop loot sooner than this many seconds after death, so the body still falls over first."); LogFirstBodies = ((BaseUnityPlugin)this).Config.Bind<int>("Debug", "LogFirstBodies", 3, "Write the old and new wait for the first this-many bodies each time the game starts (0 = never). Handy for checking that it works."); new Harmony("com.burks.quickdrops").PatchAll(Assembly.GetExecutingAssembly()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Quick Drops 1.0.0 loaded."); } }