Please disclose if your mod was created primarily 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 PeacefulCompany v1.0.0
PeacefulCompany.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Amrv.ConfigurableCompany; using Amrv.ConfigurableCompany.content.model; using BepInEx; using BepInEx.Logging; using EnermyRemoverPatch; using IndoorHazardRemoverPatch; using Microsoft.CodeAnalysis; using On; using OutdoorHazardRemoverPatch; using PeacefulCompany; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("PeacefulCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PeacefulCompany")] [assembly: AssemblyTitle("PeacefulCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PeacefulCompany { [BepInPlugin("Rocksnotch.PeacefulCompany", "Peaceful Company", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string modName = "Peaceful Company"; private const string modVersion = "1.0.0"; private const string modGUID = "Rocksnotch.PeacefulCompany"; internal static Plugin Instance; public static ManualLogSource logSrc = Logger.CreateLogSource("loggingSource"); public static Configuration enemyRemoval; public static Configuration outdoorHazardsRemoval; public static Configuration indoorHazardsRemoval; public Plugin() { enemyRemoval = LethalConfiguration.CreateConfig().SetID("enemy_removal").SetName("Disable Enemy Spawning") .SetType(ConfigurationTypes.Boolean) .SetValue((object)true) .SetSynchronized(true) .Build(); outdoorHazardsRemoval = LethalConfiguration.CreateConfig().SetID("outdoor_removal").SetName("Disable Outdoor Hazard Spawning") .SetType(ConfigurationTypes.Boolean) .SetValue((object)true) .SetSynchronized(true) .Build(); indoorHazardsRemoval = LethalConfiguration.CreateConfig().SetID("indoor_removal").SetName("Disable Indoor Hazard Spawning") .SetType(ConfigurationTypes.Boolean) .SetValue((object)true) .SetSynchronized(true) .Build(); } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } try { EnemyPatch.Init(); logSrc.LogInfo((object)"Patched EnemyPatch!"); OutdoorHazardPatch.Init(); logSrc.LogInfo((object)"Patched OutdoorHazardPatch!"); IndoorHazardPatch.Init(); logSrc.LogInfo((object)"Patched IndoorHazardPatch!"); } catch (Exception arg) { logSrc.LogError((object)$"Error patching Patch files: {arg}"); } logSrc.LogInfo((object)"Plugin Rocksnotch.PeacefulCompany is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "PeacefulCompany"; public const string PLUGIN_NAME = "PeacefulCompany"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace OutdoorHazardRemoverPatch { internal class OutdoorHazardPatch { [CompilerGenerated] private static class <>O { public static hook_OnGlobalTimeSync <0>__OnGlobalTimeSync; public static hook_SetStaticElectricityWarning <1>__SetStaticElectricityWarning; public static hook_LightningStrikeRandom <2>__LightningStrikeRandom; public static hook_LightningStrike <3>__LightningStrike; public static hook_SpawnOutsideHazards <4>__SpawnOutsideHazards; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown object obj = <>O.<0>__OnGlobalTimeSync; if (obj == null) { hook_OnGlobalTimeSync val = OnGlobalTimeSync; <>O.<0>__OnGlobalTimeSync = val; obj = (object)val; } FloodWeather.OnGlobalTimeSync += (hook_OnGlobalTimeSync)obj; object obj2 = <>O.<1>__SetStaticElectricityWarning; if (obj2 == null) { hook_SetStaticElectricityWarning val2 = SetStaticElectricityWarning; <>O.<1>__SetStaticElectricityWarning = val2; obj2 = (object)val2; } StormyWeather.SetStaticElectricityWarning += (hook_SetStaticElectricityWarning)obj2; object obj3 = <>O.<2>__LightningStrikeRandom; if (obj3 == null) { hook_LightningStrikeRandom val3 = LightningStrikeRandom; <>O.<2>__LightningStrikeRandom = val3; obj3 = (object)val3; } StormyWeather.LightningStrikeRandom += (hook_LightningStrikeRandom)obj3; object obj4 = <>O.<3>__LightningStrike; if (obj4 == null) { hook_LightningStrike val4 = LightningStrike; <>O.<3>__LightningStrike = val4; obj4 = (object)val4; } StormyWeather.LightningStrike += (hook_LightningStrike)obj4; object obj5 = <>O.<4>__SpawnOutsideHazards; if (obj5 == null) { hook_SpawnOutsideHazards val5 = SpawnOutsideHazards; <>O.<4>__SpawnOutsideHazards = val5; obj5 = (object)val5; } RoundManager.SpawnOutsideHazards += (hook_SpawnOutsideHazards)obj5; } private static void OnGlobalTimeSync(orig_OnGlobalTimeSync orig, FloodWeather self) { orig.Invoke(self); if (((object)Plugin.outdoorHazardsRemoval).Equals((object?)true)) { self.floodLevelOffset = 0f; } } private static void SetStaticElectricityWarning(orig_SetStaticElectricityWarning orig, StormyWeather self, NetworkObject warningObject, float particleTime) { if (((object)Plugin.outdoorHazardsRemoval).Equals((object?)true)) { Plugin.logSrc.LogWarning((object)"Tried to give static warning, removed function."); } else { orig.Invoke(self, warningObject, particleTime); } } private static void LightningStrikeRandom(orig_LightningStrikeRandom orig, StormyWeather self) { if (Plugin.outdoorHazardsRemoval.Get<bool>(false)) { Plugin.logSrc.LogWarning((object)"Tried to summon random lightning, removed function."); } else { orig.Invoke(self); } } private static void LightningStrike(orig_LightningStrike orig, StormyWeather self, Vector3 strikePosition, bool useTargetedObject) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (Plugin.outdoorHazardsRemoval.Get<bool>(false)) { Plugin.logSrc.LogWarning((object)"Tried to summon lightning, removed function."); } else { orig.Invoke(self, strikePosition, useTargetedObject); } } private static void SpawnOutsideHazards(orig_SpawnOutsideHazards orig, RoundManager self) { if (Plugin.outdoorHazardsRemoval.Get<bool>(false)) { Plugin.logSrc.LogWarning((object)"Tried to spawn outside hazards, removed function."); } else { orig.Invoke(self); } } } } namespace IndoorHazardRemoverPatch { internal class IndoorHazardPatch { [CompilerGenerated] private static class <>O { public static hook_GeneratedFloorPostProcessing <0>__GeneratedFloorPostProcessing; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__GeneratedFloorPostProcessing; if (obj == null) { hook_GeneratedFloorPostProcessing val = GeneratedFloorPostProcessing; <>O.<0>__GeneratedFloorPostProcessing = val; obj = (object)val; } RoundManager.GeneratedFloorPostProcessing += (hook_GeneratedFloorPostProcessing)obj; } private static void GeneratedFloorPostProcessing(orig_GeneratedFloorPostProcessing orig, RoundManager self) { if (((NetworkBehaviour)self).IsServer && Plugin.indoorHazardsRemoval.Get<bool>(false)) { self.SpawnScrapInLevel(); } else { orig.Invoke(self); } } } } namespace EnermyRemoverPatch { internal class EnemyPatch { [CompilerGenerated] private static class <>O { public static hook_SpawnRandomDaytimeEnemy <0>__SpawnRandomDaytimeEnemy; public static hook_SpawnRandomOutsideEnemy <1>__SpawnRandomOutsideEnemy; public static hook_AssignRandomEnemyToVent <2>__AssignRandomEnemyToVent; } public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown object obj = <>O.<0>__SpawnRandomDaytimeEnemy; if (obj == null) { hook_SpawnRandomDaytimeEnemy val = SpawnRandomDaytimeEnemy; <>O.<0>__SpawnRandomDaytimeEnemy = val; obj = (object)val; } RoundManager.SpawnRandomDaytimeEnemy += (hook_SpawnRandomDaytimeEnemy)obj; object obj2 = <>O.<1>__SpawnRandomOutsideEnemy; if (obj2 == null) { hook_SpawnRandomOutsideEnemy val2 = SpawnRandomOutsideEnemy; <>O.<1>__SpawnRandomOutsideEnemy = val2; obj2 = (object)val2; } RoundManager.SpawnRandomOutsideEnemy += (hook_SpawnRandomOutsideEnemy)obj2; object obj3 = <>O.<2>__AssignRandomEnemyToVent; if (obj3 == null) { hook_AssignRandomEnemyToVent val3 = AssignRandomEnemyToVent; <>O.<2>__AssignRandomEnemyToVent = val3; obj3 = (object)val3; } RoundManager.AssignRandomEnemyToVent += (hook_AssignRandomEnemyToVent)obj3; } private static GameObject SpawnRandomDaytimeEnemy(orig_SpawnRandomDaytimeEnemy orig, RoundManager self, GameObject[] spawnPoints, float timeUpToCurrentHour) { if (Plugin.enemyRemoval.Get<bool>(false)) { Plugin.logSrc.LogWarning((object)"Tried to Spawn Random Daytime Enemy, Removed Function."); return null; } return orig.Invoke(self, spawnPoints, timeUpToCurrentHour); } private static GameObject SpawnRandomOutsideEnemy(orig_SpawnRandomOutsideEnemy orig, RoundManager self, GameObject[] spawnPoints, float timeUpToCurrentHour) { if (Plugin.enemyRemoval.Get<bool>(false)) { Plugin.logSrc.LogWarning((object)"Tried to Spawn Random Daytime Enemy, Removed Function."); return null; } return orig.Invoke(self, spawnPoints, timeUpToCurrentHour); } private static bool AssignRandomEnemyToVent(orig_AssignRandomEnemyToVent orig, RoundManager self, EnemyVent vent, float spawnTime) { if (Plugin.enemyRemoval.Get<bool>(false)) { Plugin.logSrc.LogWarning((object)"Tried to Spawn Random Daytime Enemy, Removed Function."); return false; } return orig.Invoke(self, vent, spawnTime); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }