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 PlayZone v1.1.4
BepInEx/plugins/PlayZone.dll
Decompiled 7 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CullFactory; using CullFactory.Behaviours.CullingMethods; using HarmonyLib; using Microsoft.CodeAnalysis; using PlayZone.Compatibility; using UnityEngine; using itolib.Behaviours.Events; using itolib.Behaviours.Props; using itolib.Extensions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("LethalLevelLoader")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PlayZone")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A custom interior for Company employees to bring their families to. Created by LethalMatt and pacoito.")] [assembly: AssemblyFileVersion("1.1.4.0")] [assembly: AssemblyInformationalVersion("1.1.4+67f70f53282853ebf5adbce65d5e44f66b288fe1")] [assembly: AssemblyProduct("PlayZone")] [assembly: AssemblyTitle("PlayZone")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.4.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.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] [Microsoft.CodeAnalysis.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; } } [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 PlayZone { public class Config { public ConfigEntry<bool> INJECT_CUSTOM_SCRAP { get; private set; } public ConfigEntry<float> ELEVATOR_MUSIC_VOLUME { get; private set; } public ConfigEntry<float> BOWLING_MUSIC_VOLUME { get; private set; } public ConfigEntry<float> TRAMPOLINE_VOLUME { get; private set; } public ConfigEntry<float> ROTATOR_BONK_VOLUME { get; private set; } public ConfigEntry<float> ROTATOR_WHOOSH_VOLUME { get; private set; } public ConfigEntry<float> VENT_AMBIENCE_VOLUME { get; private set; } public ConfigEntry<float> LIGHT_AMBIENCE_VOLUME { get; private set; } public ConfigEntry<float> VENDING_MACHINE_VOLUME { get; private set; } public ConfigEntry<bool> BOWLING_BALL_TOM_SCREAM { get; private set; } public ConfigEntry<bool> CULLFACTORY_BLACKLIST { get; private set; } public Config(ConfigFile cfg) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown cfg.SaveOnConfigSet = false; INJECT_CUSTOM_SCRAP = cfg.Bind<bool>("Scrap", "InjectScrap", true, "Inject custom scrap into the spawnable scrap pool of any moon PlayZone generates in. Can be disabled to let other mods handle or tweak item spawn weights."); ELEVATOR_MUSIC_VOLUME = cfg.Bind<float>("Audio", "ElevatorMusicVolume", 1f, new ConfigDescription("Volume level for PlayZone's elevator music.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); BOWLING_MUSIC_VOLUME = cfg.Bind<float>("Audio", "BowlingMusicVolume", 1f, new ConfigDescription("Volume level for music played at the CosmicZone.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); TRAMPOLINE_VOLUME = cfg.Bind<float>("Audio", "TrampolineVolume", 1f, new ConfigDescription("Volume level for all trampolines and bouncy surfaces.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); ROTATOR_BONK_VOLUME = cfg.Bind<float>("Audio", "RotatorBonkVolume", 1f, new ConfigDescription("Volume level for the rotator hazard's hit sound effect.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); ROTATOR_WHOOSH_VOLUME = cfg.Bind<float>("Audio", "RotatorWhooshVolume", 1f, new ConfigDescription("Volume level for the rotator hazard's spinning sound effect.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); VENT_AMBIENCE_VOLUME = cfg.Bind<float>("Audio", "VentAmbienceVolume", 1f, new ConfigDescription("Volume level for the air conditioner vent ambience sounds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); LIGHT_AMBIENCE_VOLUME = cfg.Bind<float>("Audio", "LightAmbienceVolume", 1f, new ConfigDescription("Volume level for the fluorescent light humming ambience sounds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); VENDING_MACHINE_VOLUME = cfg.Bind<float>("Audio", "VendingMachineVolume", 1f, new ConfigDescription("Volume level for the vending machine humming ambience sounds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); BOWLING_BALL_TOM_SCREAM = cfg.Bind<bool>("Other", "BowlingBallTomScream", true, "Adds a 2% chance to play a Tom scream when kicking a Cosmic Bowling Ball."); CULLFACTORY_BLACKLIST = cfg.Bind<bool>("Compatibility", "CullFactoryBlacklist", true, "Add PlayZone to CullFactory's interior blacklist. If you'd rather have it be handled by CullFactory's settings, disable this and add 'PlayZoneDungeonFlow' to the config."); ClearOrphanedEntries(cfg); cfg.SaveOnConfigSet = true; cfg.Save(); } private static void ClearOrphanedEntries(ConfigFile config) { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); ((Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config))?.Clear(); } } [BepInDependency("pacoito.itolib", "0.6.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("LethalMatt.PlayZone", "PlayZone", "1.1.4")] public class Plugin : BaseUnityPlugin { public const string PLUGIN_GUID = "LethalMatt.PlayZone"; public const string PLUGIN_NAME = "PlayZone"; public const string VERSION = "1.1.4"; internal static ManualLogSource StaticLogger { get; private set; } internal static Harmony Harmony { get; private set; } public static Config Settings { get; private set; } private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown StaticLogger = ((BaseUnityPlugin)this).Logger; try { Settings = new Config(((BaseUnityPlugin)this).Config); Harmony = new Harmony("LethalMatt.PlayZone"); if (CullFactoryCompatibility.Enabled) { Harmony.PatchAll(typeof(CullFactoryCompatibility)); } StaticLogger.LogInfo((object)"PlayZone v1.1.4 loaded!"); } catch (Exception arg) { StaticLogger.LogError((object)string.Format("Error while initializing '{0}': {1}", "PlayZone", arg)); } } } } namespace PlayZone.Compatibility { [HarmonyPatch] public class CullFactoryCompatibility { private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.fumiko.CullFactory"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] [HarmonyPatch(typeof(CullingMethod), "Initialize")] [HarmonyPrefix] internal static void AddToCullingBlacklist() { if (!Plugin.Settings.CULLFACTORY_BLACKLIST.Value) { return; } for (int i = 0; i < Config.InteriorsWithDisabledCulling.Length; i++) { if (StringExtensions.CompareOrdinal(Config.InteriorsWithDisabledCulling[i], "PlayZoneDungeonFlow")) { return; } } string[] array = new string[Config.InteriorsWithDisabledCulling.Length + 1]; Config.InteriorsWithDisabledCulling.CopyTo(array, 0); array[^1] = "PlayZoneDungeonFlow"; Config.InteriorsWithDisabledCulling = array; } } } namespace PlayZone.Behaviours { public class ChangeSettings : MonoBehaviour { [Header("Change Settings")] [Tooltip("")] public ScrapInjector? scrapInjector; [Tooltip("")] public AudioSource? elevatorSource; [Tooltip("")] public AudioSource? discoSource; [Tooltip("")] public AudioSource? trampolineSource; [Tooltip("")] public AudioSource? rotatorBonkSource; [Tooltip("")] public AudioSource? rotatorWhooshSource; [Tooltip("")] public AudioSource? airVentSource; [Tooltip("")] public AudioSource? lightsHumSource; [Tooltip("")] public AudioSource? vendingMachineSource; [Tooltip("")] public WeightedEvent? bowlingBallEvent; public float DefaultElevatorVolume { get; private set; } public float DefaultDiscoVolume { get; private set; } public float DefaultTrampolineVolume { get; private set; } public float DefaultRotatorBonkVolume { get; private set; } public float DefaultRotatorWhooshVolume { get; private set; } public float DefaultAirVentVolume { get; private set; } public float DefaultLightsHumVolume { get; private set; } public float DefaultVendingMachineVolume { get; private set; } public void Start() { if ((Object)(object)scrapInjector != (Object)null) { ((Behaviour)scrapInjector).enabled = Plugin.Settings.INJECT_CUSTOM_SCRAP.Value; } if ((Object)(object)elevatorSource != (Object)null) { DefaultElevatorVolume = elevatorSource.volume; AudioSource? obj = elevatorSource; obj.volume *= Plugin.Settings.ELEVATOR_MUSIC_VOLUME.Value; Plugin.Settings.ELEVATOR_MUSIC_VOLUME.SettingChanged += ChangeElevatorVolume; } if ((Object)(object)discoSource != (Object)null) { DefaultDiscoVolume = discoSource.volume; AudioSource? obj2 = discoSource; obj2.volume *= Plugin.Settings.BOWLING_MUSIC_VOLUME.Value; Plugin.Settings.BOWLING_MUSIC_VOLUME.SettingChanged += ChangeDiscoVolume; } if ((Object)(object)trampolineSource != (Object)null) { DefaultTrampolineVolume = trampolineSource.volume; AudioSource? obj3 = trampolineSource; obj3.volume *= Plugin.Settings.TRAMPOLINE_VOLUME.Value; Plugin.Settings.TRAMPOLINE_VOLUME.SettingChanged += ChangeTrampolineVolume; } if ((Object)(object)rotatorBonkSource != (Object)null) { DefaultRotatorBonkVolume = rotatorBonkSource.volume; AudioSource? obj4 = rotatorBonkSource; obj4.volume *= Plugin.Settings.ROTATOR_BONK_VOLUME.Value; Plugin.Settings.ROTATOR_BONK_VOLUME.SettingChanged += ChangeRotatorBonkVolume; } if ((Object)(object)rotatorWhooshSource != (Object)null) { DefaultRotatorWhooshVolume = rotatorWhooshSource.volume; AudioSource? obj5 = rotatorWhooshSource; obj5.volume *= Plugin.Settings.ROTATOR_WHOOSH_VOLUME.Value; Plugin.Settings.ROTATOR_WHOOSH_VOLUME.SettingChanged += ChangeRotatorWhooshVolume; } if ((Object)(object)airVentSource != (Object)null) { DefaultAirVentVolume = airVentSource.volume; AudioSource? obj6 = airVentSource; obj6.volume *= Plugin.Settings.VENT_AMBIENCE_VOLUME.Value; Plugin.Settings.VENT_AMBIENCE_VOLUME.SettingChanged += ChangeAirVentVolume; } if ((Object)(object)lightsHumSource != (Object)null) { DefaultLightsHumVolume = lightsHumSource.volume; AudioSource? obj7 = lightsHumSource; obj7.volume *= Plugin.Settings.LIGHT_AMBIENCE_VOLUME.Value; Plugin.Settings.LIGHT_AMBIENCE_VOLUME.SettingChanged += ChangeLightsHumVolume; } if ((Object)(object)vendingMachineSource != (Object)null) { DefaultVendingMachineVolume = vendingMachineSource.volume; AudioSource? obj8 = vendingMachineSource; obj8.volume *= Plugin.Settings.VENDING_MACHINE_VOLUME.Value; Plugin.Settings.VENDING_MACHINE_VOLUME.SettingChanged += ChangeVendingMachineVolume; } if ((Object)(object)bowlingBallEvent != (Object)null && !Plugin.Settings.BOWLING_BALL_TOM_SCREAM.Value) { bowlingBallEvent.RemoveWeightEntry(0); } } public void OnDestroy() { Plugin.Settings.ELEVATOR_MUSIC_VOLUME.SettingChanged -= ChangeElevatorVolume; Plugin.Settings.BOWLING_MUSIC_VOLUME.SettingChanged -= ChangeDiscoVolume; Plugin.Settings.TRAMPOLINE_VOLUME.SettingChanged -= ChangeTrampolineVolume; Plugin.Settings.ROTATOR_BONK_VOLUME.SettingChanged -= ChangeRotatorBonkVolume; Plugin.Settings.ROTATOR_WHOOSH_VOLUME.SettingChanged -= ChangeRotatorWhooshVolume; Plugin.Settings.VENT_AMBIENCE_VOLUME.SettingChanged -= ChangeAirVentVolume; Plugin.Settings.LIGHT_AMBIENCE_VOLUME.SettingChanged -= ChangeLightsHumVolume; Plugin.Settings.VENDING_MACHINE_VOLUME.SettingChanged -= ChangeVendingMachineVolume; } public void ChangeElevatorVolume(object sender, EventArgs args) { if ((Object)(object)elevatorSource != (Object)null) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null); if (val != null && val.ChangedSetting is ConfigEntry<float> val2) { elevatorSource.volume = DefaultElevatorVolume * val2.Value; } } } public void ChangeDiscoVolume(object sender, EventArgs args) { if ((Object)(object)discoSource != (Object)null) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null); if (val != null && val.ChangedSetting is ConfigEntry<float> val2) { discoSource.volume = DefaultDiscoVolume * val2.Value; } } } public void ChangeTrampolineVolume(object sender, EventArgs args) { if ((Object)(object)trampolineSource != (Object)null) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null); if (val != null && val.ChangedSetting is ConfigEntry<float> val2) { trampolineSource.volume = DefaultTrampolineVolume * val2.Value; } } } public void ChangeRotatorBonkVolume(object sender, EventArgs args) { if ((Object)(object)rotatorBonkSource != (Object)null) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null); if (val != null && val.ChangedSetting is ConfigEntry<float> val2) { rotatorBonkSource.volume = DefaultRotatorBonkVolume * val2.Value; } } } public void ChangeRotatorWhooshVolume(object sender, EventArgs args) { if ((Object)(object)rotatorWhooshSource != (Object)null) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null); if (val != null && val.ChangedSetting is ConfigEntry<float> val2) { rotatorWhooshSource.volume = DefaultRotatorWhooshVolume * val2.Value; } } } public void ChangeAirVentVolume(object sender, EventArgs args) { if ((Object)(object)airVentSource != (Object)null) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null); if (val != null && val.ChangedSetting is ConfigEntry<float> val2) { airVentSource.volume = DefaultAirVentVolume * val2.Value; } } } public void ChangeLightsHumVolume(object sender, EventArgs args) { if ((Object)(object)lightsHumSource != (Object)null) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null); if (val != null && val.ChangedSetting is ConfigEntry<float> val2) { lightsHumSource.volume = DefaultLightsHumVolume * val2.Value; } } } public void ChangeVendingMachineVolume(object sender, EventArgs args) { if ((Object)(object)vendingMachineSource != (Object)null) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((args is SettingChangedEventArgs) ? args : null); if (val != null && val.ChangedSetting is ConfigEntry<float> val2) { vendingMachineSource.volume = DefaultVendingMachineVolume * val2.Value; } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }