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 SoftCadaverRework v0.0.1
SoftCadaverRework.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using HarmonyLib; using Microsoft.CodeAnalysis; using SoftCadaverRework.NetcodePatcher; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SoftCadaverRework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SoftCadaverRework")] [assembly: AssemblyTitle("SoftCadaverRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } [HarmonyPatch(typeof(NetworkManager))] internal static class NetworkPrefabPatch2 { private static readonly string MOD_GUID = "ZetaArcade.SoftCadaverRework"; [HarmonyPostfix] [HarmonyPatch("SetSingleton")] private static void RegisterPrefab() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(MOD_GUID + " Prefab"); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D); Object.DontDestroyOnLoad((Object)(object)val); NetworkObject obj = val.AddComponent<NetworkObject>(); FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(obj, GetHash(MOD_GUID)); NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val); static uint GetHash(string value) { return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0; } } } namespace SoftCadaverRework { public class ConfigHandler : SyncedConfig2<ConfigHandler> { [SyncedEntryField] public SyncedEntry<bool> onlyInfectDamaged; [SyncedEntryField] public SyncedEntry<bool> cancelOut60Multiplier; [SyncedEntryField] public SyncedEntry<float> maxMultiplier; [SyncedEntryField] public SyncedEntry<float> airFilterStrengthScaler; [SyncedEntryField] public SyncedEntry<float> maxProgressionMultiplier; [SyncedEntryField] public SyncedEntry<bool> cancelOut100HPMultiplier; [SyncedEntryField] public SyncedEntry<bool> cancelOut40HPMultiplier; public ConfigHandler(ConfigFile cfg) : base("ZetaArcade.SoftCadaverRework") { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown onlyInfectDamaged = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "1) Initial Infection", "Only Infect When Damaged", true, new ConfigDescription("If enabled, the initial infection chance will only be applied when your health is below 100, meaning you will always be immune to infection at full health. This does not factor in mods that may increase your Max HP, you must go below 100 for it to trigger.", (AcceptableValueBase)null, Array.Empty<object>())); cancelOut60Multiplier = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "1) Initial Infection", "Cancel out 60 HP Multiplier", true, new ConfigDescription("By default in Vanilla, the chance to get infected is already increased by 1.2x when your health is <= 60. When this setting is enabled, that bonus is cancelled out. If disabled, this mod's infection chance when you're on lower HP will STACK with Vanilla's. Please note this does not affect Vanilla's additional 1.5x multiplier when you're on critical, which will still stack with this mod regardless.", (AcceptableValueBase)null, Array.Empty<object>())); maxMultiplier = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "1) Initial Infection", "Damaged Player Max Multiplier", 8f, new ConfigDescription("The max multiplier for the initial infection chance, assuming your health is 20 or lower. If your health is higher than 20, this value is decreased. E.g. with a max mult of 8, if you're on 20hp it would be 8x, 60hp would be 4.5x, and 100hp would be 1x (or 0x if you disable infections when on full health).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>())); airFilterStrengthScaler = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "1) Initial Infection", "Air Filter Strength Scaler", 1f, new ConfigDescription("In Vanilla, in Singleplayer, there is a 7s Air Filter that prevents infection, acting as a grace period. This 7s is lowered down to around 4s in multiplayer. With this scaler, you can buff the duration of the Air filter, giving yourself more of a shield before you are infected, regardless of your health. 1f = Vanilla duration, 0.5f = 2x longer protection, 0.25f 4x longer protection, 0f = You can never be infected.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); maxProgressionMultiplier = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "2) Infection Progression", "Damaged Player Max Progression Multiplier", 8f, new ConfigDescription("The max multiplier for the infection progression speed (The countdown to turn into a CadaverBloom once you're already infected), assuming your Health is 20 or lower. If your health is higher than 20, this value is decreased. E.g. with a max progression mult of 8, if you're on 20hp it would be 8x progresion speed, 60hp would be 4.5x, and 100hp would be 1x", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>())); cancelOut100HPMultiplier = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "2) Infection Progression", "Cancel out 100 HP Multiplier", true, new ConfigDescription("By default in Vanilla, the infection progression speed is decreased by 0.85x when your health is at 100. When this setting is enabled, that bonus is cancelled out. If disabled, whatever increase in infection speed this mod provides will be reduced by Vanilla if you're at 100.", (AcceptableValueBase)null, Array.Empty<object>())); cancelOut40HPMultiplier = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "2) Infection Progression", "Cancel out 40 HP Multiplier", true, new ConfigDescription("By default in Vanilla, the infection progression speed is increased by 1.15x when your health is <= 40. When this setting is enabled, that bonus is cancelled out. If disabled, this mod's infection progression speed when you're that low will STACK with Vanilla's!", (AcceptableValueBase)null, Array.Empty<object>())); ConfigManager.Register<ConfigHandler>((SyncedConfig2<ConfigHandler>)(object)this); } } [BepInPlugin("ZetaArcade.SoftCadaverRework", "SoftCadaverRework", "0.0.1")] public class MyPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(CadaverGrowthAI), "InfectPlayers")] public static class InfectPlayersPatch { [HarmonyPrefix] public static void InfectPlayersPre(CadaverGrowthAI __instance, out (float chanceToInfect, float airFilterInterval) __state) { __state = (chanceToInfect: __instance.ChanceToInfectMultiplier, airFilterInterval: __instance.InfectIntervalTime); __instance.InfectIntervalTime *= Config.airFilterStrengthScaler.Value; float num = GameNetworkManager.Instance.localPlayerController.health; float num2 = Mathf.Clamp01((100f - num) / 80f); float num3 = Mathf.Lerp(1f, Config.maxMultiplier.Value, num2); if (Config.onlyInfectDamaged.Value && num >= 100f) { Logger.LogInfo((object)"Player is at full health, skipping infection."); num3 = 0f; } else { Logger.LogInfo((object)"Player is damaged, rolling chance for infection"); if (Config.cancelOut60Multiplier.Value && num <= 60f) { num3 /= 1.2f; } } __instance.ChanceToInfectMultiplier *= num3; } [HarmonyPostfix] public static void InfectPlayersPost(CadaverGrowthAI __instance, (float chance, float interval) __state) { (__instance.ChanceToInfectMultiplier, __instance.InfectIntervalTime) = __state; } } [HarmonyPatch(typeof(CadaverGrowthAI), "ProgressPlayerInfections")] public static class InfectionProgressionPatch { [HarmonyPrefix] public static void Prefix(CadaverGrowthAI __instance, out float __state) { __state = __instance.InfectionSpeedMultiplier; float num = GameNetworkManager.Instance.localPlayerController.health; float num2 = Mathf.Clamp01((100f - num) / 80f); float num3 = Mathf.Lerp(1f, Config.maxProgressionMultiplier.Value, num2); if (num <= 40f && Config.cancelOut40HPMultiplier.Value) { num3 /= 1.15f; } else if (num == 100f && Config.cancelOut100HPMultiplier.Value) { num3 /= 0.85f; } __instance.InfectionSpeedMultiplier *= num3; } [HarmonyPostfix] public static void Postfix(CadaverGrowthAI __instance, float __state) { __instance.InfectionSpeedMultiplier = __state; } } private Harmony harmony = new Harmony("ZetaArcade.SoftCadaverRework"); public static ManualLogSource Logger; internal static ConfigHandler Config; public static MyPlugin Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; Config = new ConfigHandler(((BaseUnityPlugin)this).Config); harmony.PatchAll(); Logger.LogInfo((object)"Plugin is loaded!"); } } internal class PluginInfo { public const string modGUID = "ZetaArcade.SoftCadaverRework"; public const string modName = "SoftCadaverRework"; public const string modVersion = "0.0.1"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace SoftCadaverRework.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }